details page, layout and inpage functions + back button

This commit is contained in:
Ulf Gebhardt 2019-08-31 13:45:43 +02:00
parent 7e4c4b45db
commit 0b5cf67803
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
10 changed files with 316 additions and 2 deletions

View File

@ -124,4 +124,28 @@ function init_saimod_project() {
});
});
}
function init_saimod_project_details(){
$('#input-project-image').change(function(){
$('#output-project-image').attr('src','./files/projects/'+$(this).val())
});
//.input-badge-color
$('.input-badge-badge, #input-focus-badge, #input-type-badge').on('input',function(){
$(this).parent().parent().find('.badge').html($(this).val());
});
$('.input-badge-color, #input-focus-color, #input-type-color').change(function(){
$(this).parent().parent().find('.badge').removeClass(function (index, className) {
return (className.match (/(^|\s)badge-\S+/g) || []).join(' ');
});
$(this).parent().parent().find('.badge').addClass($(this).val());
});
$('#btn-project-back').click(function(){
system.back();
});
$('#btn-project-update').click(function(){
});
}

View File

@ -82,6 +82,69 @@ class saimod_project extends \SYSTEM\SAI\sai_module{
return \SYSTEM\LOG\JsonResult::ok();
}
public static function sai_mod__SAI_saimod_project_action_project_details($project){
// $vars = array();
$vars = \SQL\SELECT_PROJECT::Q1(array($project));
$vars['selected_invisible'] = $vars['visible'] !== 1 ? 'selected' : '';
$vars['selected_visible'] = $vars['visible'] == 1 ? 'selected' : '';
//images
$images = \SYSTEM\FILES\files::get('projects');
$vars['images'] = '';
foreach($images as $image){
$img = ['name' => $image, 'selected' => $vars['img'] == $image ? 'selected' : ''];
$vars['images'] .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/saimod_project_image_file.tpl'))->SERVERPATH(),$img);
}
// Focus
$vars['focus'] = '';
$focus = \SQL\SELECT_BADGES_PROJECT::QQ(array(self::BADGE_TYPE_PROJECT_FOCUS,$project));
while($row = $focus->next()){
$row['selected_invisible'] = $row['visible'] !== 1 ? 'selected' : '';
$row['selected_visible'] = $row['visible'] == 1 ? 'selected' : '';
$row['badge_colors'] = self::badge_color_options($row['color']);
$vars['focus'] .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/saimod_project_badge_tr.tpl'))->SERVERPATH(),$row);
}
// Type
$vars['type'] = '';
$type = \SQL\SELECT_BADGES_PROJECT::QQ(array(self::BADGE_TYPE_PROJECT_TYPE,$project));
while($row = $type->next()){
$row['selected_invisible'] = $row['visible'] !== 1 ? 'selected' : '';
$row['selected_visible'] = $row['visible'] == 1 ? 'selected' : '';
$row['badge_colors'] = self::badge_color_options($row['color']);
$vars['type'] .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/saimod_project_badge_tr.tpl'))->SERVERPATH(),$row);
}
$vars['badge_colors'] = self::badge_color_options();
return \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/saimod_project_details.tpl'))->SERVERPATH(),$vars);
}
private static function badge_color_options($selected = null){
$colors = array(
'badge-primary',
'badge-secondary',
'badge-success',
'badge-danger',
'badge-warning',
'badge-info',
'badge-light',
'badge-dark'
);
$result = '';
foreach($colors as $color){
$vars = array('value' => $color, 'selected' => $color == $selected ? 'selected' : '');
$result .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/badge_color_option.tpl'))->SERVERPATH(),$vars);
}
return $result;
}
public static function menu(){
return new \SYSTEM\SAI\sai_module_menu( 101,
\SYSTEM\SAI\sai_module_menu::POISITION_LEFT,

View File

@ -0,0 +1,36 @@
<?php
/**
* System - PHP Framework
*
* PHP Version 5.6
*
* @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link https://github.com/webcraftmedia/system
* @package SYSTEM\SQL
*/
namespace SQL;
/**
* QQ to get System Api Tree by group
*/
class SELECT_BADGES_PROJECT extends \SYSTEM\DB\QP {
/**
* Get Classname of the QQ
*
* @return string Returns classname
*/
public static function get_class(){return \get_class();}
/**
* Get QQs MYSQL Query String
*
* @return string Returns MYSQL Query String
*/
public static function mysql(){return
'SELECT *'.
' FROM `badges`'.
' WHERE `type` = ? AND `ref_id` = ? '.
' ORDER BY `order`;';
}
}

View File

@ -0,0 +1,35 @@
<?php
/**
* System - PHP Framework
*
* PHP Version 5.6
*
* @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link https://github.com/webcraftmedia/system
* @package SYSTEM\SQL
*/
namespace SQL;
/**
* QQ to get System Api Tree by group
*/
class SELECT_PROJECT extends \SYSTEM\DB\QP {
/**
* Get Classname of the QQ
*
* @return string Returns classname
*/
public static function get_class(){return \get_class();}
/**
* Get QQs MYSQL Query String
*
* @return string Returns MYSQL Query String
*/
public static function mysql(){return
'SELECT *'.
' FROM `projects`'.
' WHERE `id` = ?;';
}
}

View File

@ -6,12 +6,13 @@ REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `na
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9010, 42, 2, 9000, 'project_delete', 'data', 'JSON');
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9020, 42, 2, 9000, 'project_order', 'data', 'JSON');
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9030, 42, 2, 9000, 'project_visibility', 'data', 'JSON');
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9040, 42, 2, 9000, 'project_details', 'project', 'UINT0');
-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9030, 42, 2, 9000, 'contact', 'email', 'STRING');
-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9035, 42, 2, 9000, 'update_contact', 'data', 'JSON');
-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9037, 42, 2, 9000, 'insert_contact', 'data', 'JSON');
-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9039, 42, 2, 9000, 'delete_contact', 'data', 'JSON');
-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9040, 42, 2, 9000, 'email', 'id', 'UINT0');
-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9043, 42, 2, 9000, 'send_email', 'data', 'JSON');
-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9045, 42, 2, 9000, 'update_email', 'data', 'JSON');
-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9047, 42, 2, 9000, 'insert_email', 'data', 'JSON');

View File

@ -1,9 +1,10 @@
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (900, 42, 'project', 'project', -1, 0, 0, '#content', './sai.php?sai_mod=.SAI.saimod_project&search=${search}&page=${page}', 'init_saimod_project', '\\SAI\\saimod_project');
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (910, 42, 'new', 'project', 900, 0, 1, '#content', './sai.php?sai_mod=.SAI.saimod_project&action=project_new', 'init_saimod_project_new', '\\SAI\\saimod_project');
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (920, 42, 'details', 'project', 900, 0, 1, '#content', './sai.php?sai_mod=.SAI.saimod_project&action=project_details&project=${project}', 'init_saimod_project_details', '\\SAI\\saimod_project');
-- REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (901, 42, 'overview', 'mail', 900, 0, 0, '#content_mail', './sai.php?sai_mod=.SAI.saimod_mail&action=overview', 'init_saimod_mail_overview', '\\SAI\\saimod_mail');
-- REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (910, 42, 'contacts', 'mail', 900, 0, 1, '#content_mail', './sai.php?sai_mod=.SAI.saimod_mail&action=contacts&search=${search}&page=${page}&list=${list}', 'init_saimod_mail_contacts', '\\SAI\\saimod_mail');
-- REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (915, 42, 'contact', 'mail', 900, 0, 1, '#content_mail', './sai.php?sai_mod=.SAI.saimod_mail&action=contact&email=${email}', 'init_saimod_mail_contact', '\\SAI\\saimod_mail');
-- REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (917, 42, 'contact_new', 'mail', 900, 0, 1, '#content_mail', './sai.php?sai_mod=.SAI.saimod_mail&action=contact_new', 'init_saimod_mail_contact_new', '\\SAI\\saimod_mail');
-- REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (920, 42, 'lists', 'mail', 900, 0, 1, '#content_mail', './sai.php?sai_mod=.SAI.saimod_mail&action=lists', 'init_saimod_mail_lists', '\\SAI\\saimod_mail');
-- REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (925, 42, 'list', 'mail', 900, 0, 1, '#content_mail', './sai.php?sai_mod=.SAI.saimod_mail&action=list&id=${id}', 'init_saimod_mail_list', '\\SAI\\saimod_mail');

View File

@ -0,0 +1 @@
<option value="${value}" ${selected}>${value}</option>

View File

@ -0,0 +1,22 @@
<tr>
<td><span class="badge ${color}">${badge}</span></td>
<td><input class="input-badge-badge form-control" type="text" value="${badge}" style="width: 100%"/></td>
<td>
<select class="input-badge-color form-control">
${badge_colors}
</select>
</td>
<td style="font-size: 30px">
<a href="#" class="project-order-up" project="${id}" order="${order}"><i class="fa fa-caret-up"></i></a>
<a href="#" class="project-order-down" project="${id}" order="${order}"><i class="fa fa-caret-down"></i></a>
</td>
<td>
<select class="project-visibility form-control" project="${id}">
<option value="0" ${selected_invisible}>Invisible</option>
<option value="1" ${selected_visible}>Visible</option>
</select>
</td>
<td>
<input type="checkbox" class="pull-right project-check" project="${id}"/>
</td>
</tr>

View File

@ -0,0 +1,130 @@
<div class="row">
<div class="table-responsive">
<table class="table table-striped table-condensed tablesorter sai_margin_off" id="table-project-details">
<tbody>
<tr>
<th>
<img id="output-project-image" src="./files/projects/${img}" alt="Image Not Found" style="width: 150px; height: 150px;"/>
</th>
<td>
<select id="input-project-image" class="form-control">
${images}
</select>
</td>
</tr>
<tr>
<th>Name</th>
<td><input id="input-project-name" class="form-control" type="text" value="${name}" style="width: 100%"/></td>
</tr>
<tr>
<th>Info</th>
<td><textarea id="input-project-info" class="form-control" style="width: 100%; min-height: 100px;">${info}</textarea></td>
</tr>
<tr>
<th>Website</th>
<td><input id="input-project-website" class="form-control" type="text" value="${website}" style="width: 100%"/></td>
</tr>
<tr>
<th>Visibility</th>
<td>
<select id="input-project-visibility" class="form-control" project="${id}">
<option value="0" ${selected_invisible}>Invisible</option>
<option value="1" ${selected_visible}>Visible</option>
</select>
</td>
</tr>
<tr>
<th colspan="2"></th>
</tr>
<tr>
<th colspan="2">Focus</th>
</tr>
<tr>
<th colspan="2">
<table class="table table-striped table-condensed tablesorter sai_margin_off" id="table-project-focus">
<thead>
<tr>
<th>Preview</th>
<th>Badge</th>
<th>Color</th>
<th>Order</th>
<th>Visible</th>
<th>
<button type="button" id="btn-focus-del" class="btn btn-sm btn-danger pull-right"><i class="fa fa-trash"></i></button>
</th>
</tr>
</thead>
<tbody>
${focus}
<tr>
<td><span class="badge badge-primary"></span></td>
<td><input id="input-focus-badge" class="form-control" type="text" style="width: 100%"/></td>
<td>
<select id="input-focus-color" class="form-control">
${badge_colors}
</select>
</td>
<td></td>
<td>
<select class="focus-visibility form-control" project="${id}">
<option value="0" >Invisible</option>
<option value="1" selected>Visible</option>
</select>
</td>
<td>
<button type="button" id="btn-project-focus-new" class="btn btn-sm btn-success pull-right"><i class="fa fa-plus"></i></button>
</td>
</tr>
</tbody>
</table>
</th>
</tr>
<tr>
<th colspan="2">Type</th>
</tr>
<tr>
<th colspan="2">
<table class="table table-striped table-condensed tablesorter sai_margin_off" id="table-project-type">
<thead>
<tr>
<th>Preview</th>
<th>Badge</th>
<th>Color</th>
<th>Order</th>
<th>Visible</th>
<th>
<button type="button" id="btn-type-del" class="btn btn-sm btn-danger pull-right"><i class="fa fa-trash"></i></button>
</th>
</tr>
</thead>
<tbody>
${type}
<tr>
<td><span class="badge badge-primary"></span></td>
<td><input id="input-type-badge" class="form-control" type="text" style="width: 100%"/></td>
<td>
<select id="input-type-color" class="form-control">
${badge_colors}
</select>
</td>
<td></td>
<td>
<select class="type-visibility form-control" project="${id}">
<option value="0" >Invisible</option>
<option value="1" selected>Visible</option>
</select>
</td>
<td>
<button type="button" id="btn-project-type-new" class="btn btn-sm btn-success pull-right"><i class="fa fa-plus"></i></button>
</td>
</tr>
</tbody>
</table>
</th>
</tr>
</tbody>
</table>
<button id="btn-project-back" class="btn btn-sm btn-default" style="margin: 12px;"><i class="fa fa-angle-left"></i>&nbsp;Back</button>
<button id="btn-project-update" class="btn btn-sm btn-success pull-right" style="margin: 12px;"><i class="fa fa-edit"></i>&nbsp;Update</button>
</div>
</div>

View File

@ -0,0 +1 @@
<option value="${name}" ${selected}>${name}</option>