Merge branch 'master' of mojotrollz.eu:system

This commit is contained in:
Ulf Gebhardt 2014-10-13 17:39:30 +02:00
commit 69a996ad57
159 changed files with 618 additions and 364 deletions

View File

@ -14,6 +14,10 @@ class api_system extends api_login{
public static function call_pagestates($group){ public static function call_pagestates($group){
return \SYSTEM\PAGE\State::get($group);} return \SYSTEM\PAGE\State::get($group);}
public static function call_pagestates_flag_js($group){
return \SYSTEM\PAGE\State::get_js($group);}
public static function call_pagestates_flag_css($group){
return \SYSTEM\PAGE\State::get_css($group);}
public static function static__lang($lang){ public static function static__lang($lang){
\SYSTEM\locale::set($lang);} \SYSTEM\locale::set($lang);}

2
api/autoload.inc.php Normal file
View File

@ -0,0 +1,2 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\API');

View File

@ -1,38 +1,23 @@
<?php <?php
//include autoloadclass //include autoload class
require_once dirname(__FILE__).'/system/path.php'; require_once dirname(__FILE__).'/system/path.php';
require_once dirname(__FILE__).'/system/autoload.php'; require_once dirname(__FILE__).'/system/autoload.php';
//Register autoload //Register autoload
\SYSTEM\autoload::register_autoload(); \SYSTEM\autoload::register_autoload();
//Register system classes //Autoload submodules
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/system','SYSTEM'); require_once dirname(__FILE__).'/system/autoload.inc.php';
require_once dirname(__FILE__).'/log/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/log/result','SYSTEM\LOG'); require_once dirname(__FILE__).'/api/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/log','SYSTEM\LOG'); require_once dirname(__FILE__).'/page/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/log/exceptions','SYSTEM\LOG'); require_once dirname(__FILE__).'/dbd/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/log/error_handler','SYSTEM\LOG'); require_once dirname(__FILE__).'/db/autoload.inc.php';
require_once dirname(__FILE__).'/security/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/api','SYSTEM\API'); require_once dirname(__FILE__).'/config/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/page','SYSTEM\PAGE'); require_once dirname(__FILE__).'/cache/autoload.inc.php';
require_once dirname(__FILE__).'/docu/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/dbd/tbl/','SYSTEM\DBD'); require_once dirname(__FILE__).'/files/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/dbd/qq/','SYSTEM\DBD'); require_once dirname(__FILE__).'/cron/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db','SYSTEM\DB'); require_once dirname(__FILE__).'/sai/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/dbinfo','SYSTEM\DB'); require_once dirname(__FILE__).'/lib/autoload.inc.php';
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/connection','SYSTEM\DB');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/result','SYSTEM\DB');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/qq','SYSTEM\DB');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/security','SYSTEM\SECURITY');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/config','SYSTEM\CONFIG');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/cache','SYSTEM\CACHE');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/sai','SYSTEM\SAI');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/docu','SYSTEM\DOCU');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/files','SYSTEM\FILES');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/cron','SYSTEM\CRON');
require_once dirname(__FILE__).'/lib/autoload.inc.php';
require_once dirname(__FILE__).'/docu/register_sys_docu.php';
require_once dirname(__FILE__).'/sai/autoload.inc.php';

2
cache/autoload.inc.php vendored Normal file
View File

@ -0,0 +1,2 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\CACHE');

2
config/autoload.inc.php Normal file
View File

@ -0,0 +1,2 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\CONFIG');

2
cron/autoload.inc.php Normal file
View File

@ -0,0 +1,2 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\CRON');

View File

@ -2,9 +2,9 @@
namespace SYSTEM\CRON; namespace SYSTEM\CRON;
class cron { class cron {
private static function check($cron){ public static function check($class){
if( !\class_exists($cron) || if( !\class_exists($class) ||
!\is_array($parents = \class_parents($cron)) || !\is_array($parents = \class_parents($class)) ||
!\array_search('SYSTEM\CRON\cronjob', $parents)){ !\array_search('SYSTEM\CRON\cronjob', $parents)){
return false;} return false;}
return true;} return true;}
@ -17,7 +17,7 @@ class cron {
self::status($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS], \SYSTEM\CRON\cronstatus::CRON_STATUS_FAIL_CLASS); self::status($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS], \SYSTEM\CRON\cronstatus::CRON_STATUS_FAIL_CLASS);
continue;} continue;}
//time to execute? //time to execute?
if(!\SYSTEM\CRON\crontime::check_now( time($cron[\SYSTEM\DBD\system_cron::FIELD_LAST_RUN]), if(!\SYSTEM\CRON\crontime::check_now( strtotime($cron[\SYSTEM\DBD\system_cron::FIELD_LAST_RUN]),
$cron[\SYSTEM\DBD\system_cron::FIELD_MIN], $cron[\SYSTEM\DBD\system_cron::FIELD_MIN],
$cron[\SYSTEM\DBD\system_cron::FIELD_HOUR], $cron[\SYSTEM\DBD\system_cron::FIELD_HOUR],
$cron[\SYSTEM\DBD\system_cron::FIELD_DAY], $cron[\SYSTEM\DBD\system_cron::FIELD_DAY],
@ -35,6 +35,19 @@ class cron {
return \SYSTEM\LOG\JsonResult::ok(); return \SYSTEM\LOG\JsonResult::ok();
} }
public static function next($class){
$cron = \SYSTEM\DBD\SYS_CRON_GET::Q1(array($class));
//check module
if(!self::check($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS])){
throw new \SYSTEM\LOG\ERROR("Given class is not a cronjob");}
//time
return \SYSTEM\CRON\crontime::next_now( $cron[\SYSTEM\DBD\system_cron::FIELD_MIN],
$cron[\SYSTEM\DBD\system_cron::FIELD_HOUR],
$cron[\SYSTEM\DBD\system_cron::FIELD_DAY],
$cron[\SYSTEM\DBD\system_cron::FIELD_DAY_WEEK],
$cron[\SYSTEM\DBD\system_cron::FIELD_MONTH]);
}
private static function status($class, $status){ private static function status($class, $status){
new \SYSTEM\LOG\CRON('Cron Status for Class '.$class.' updated to: '. \SYSTEM\CRON\cronstatus::decode($status)); new \SYSTEM\LOG\CRON('Cron Status for Class '.$class.' updated to: '. \SYSTEM\CRON\cronstatus::decode($status));
return \SYSTEM\DBD\SYS_CRON_UPD::QI(array($status,time(),$class));} return \SYSTEM\DBD\SYS_CRON_UPD::QI(array($status,time(),$class));}

View File

@ -1,9 +0,0 @@
<?php
namespace SYSTEM\CRON;
class cronjobtest extends cronjob {
public static function run(){
new \SYSTEM\LOG\WARNING("Unimplemented!");
return \SYSTEM\CRON\cronstatus::CRON_STATUS_SUCCESFULLY;
}
}

View File

@ -1,23 +1,21 @@
<?php <?php
namespace SYSTEM\CRON; namespace SYSTEM\CRON;
//http://coderzone.org/library/PHP-PHP-Cron-Parser-Class_1084.htm
class crontime { class crontime {
public static function next($base_time,$min,$hour,$day,$day_week,$month){ public static function next($base_time,$min,$hour,$day,$day_week,$month){
list( $now_min, $now_hour, $now_day, $now_month, $now_day_week ) = preg_split( "/ /", date("i H d n N", $base_time ) ); list( $now_min, $now_hour, $now_day, $now_month, $now_day_week ) = preg_split( "/ /", date("i H d n N", $base_time ) );
list( $next_min, $next_hour, $next_day, $next_month, $next_year) = preg_split( "/ /", date("i H d n Y", $base_time ) ); list( $next_min, $next_hour, $next_day, $next_month, $next_year) = preg_split( "/ /", date("i H d n Y", $base_time ) );
if($month){ if($month){
if($month < $now_month){ $next_year += 1;} if(($month + $now_month)> 12){ $next_year += 1;}
$next_month = $month;} $next_month = ($now_month+$month)%12;}
if($day){ if($day){
if($day < $now_day){ $next_month += 1;} if($day + $now_day> 31){ $next_month += 1;}
$next_day = $day;} $next_day = ($now_day+$day)%31;}
if($hour){ if($hour){
if($hour < $now_hour){ $next_day += 1;} if(($hour + $now_hour)> 24){ $next_day += 1;}
$next_hour = $hour;} $next_hour = ($now_hour+$hour)%24;}
if($min){ if($min){
if($min < $now_min){ $next_hour += 1;} if(($min + $now_min)> 60){ $next_hour += 1;}
$next_min = $min;} $next_min = ($now_min+$min)%60;}
if($day_week){ if($day_week){
$day_week = $day_week % 6; // 7 and 0 both mean Sunday $day_week = $day_week % 6; // 7 and 0 both mean Sunday
$now_day_week = $now_day_week % 6; // 7 and 0 both mean Sunday $now_day_week = $now_day_week % 6; // 7 and 0 both mean Sunday
@ -28,17 +26,17 @@ class crontime {
list( $now_min, $now_hour, $now_day, $now_month, $now_day_week ) = preg_split( "/ /", date("i H d n N", $base_time ) ); list( $now_min, $now_hour, $now_day, $now_month, $now_day_week ) = preg_split( "/ /", date("i H d n N", $base_time ) );
list( $last_min, $last_hour, $last_day, $last_month, $last_year) = preg_split( "/ /", date("i H d n Y", $base_time ) ); list( $last_min, $last_hour, $last_day, $last_month, $last_year) = preg_split( "/ /", date("i H d n Y", $base_time ) );
if($month){ if($month){
if($month > $now_month){ $last_year -= 1;} if(($now_month - $month)< 12){ $last_year -= 1;}
$last_month = $month;} $last_month = ($now_month-$month)%12;}
if($day){ if($day){
if($day > $now_day){ $last_month -= 1;} if(($now_day - $day)> 31){ $last_month -= 1;}
$last_day = $day;} $last_day = ($now_day-$day)%31;}
if($hour){ if($hour){
if($hour > $now_hour){ $last_day -= 1;} if(($now_hour - $hour)> 24){ $last_day -= 1;}
$last_hour = $hour;} $last_hour = ($now_hour-$hour)%24;}
if($min){ if($min){
if($min > $now_min){ $last_hour -= 1;} if(($now_min - $min)> 60){ $last_hour -= 1;}
$last_min = $min;} $last_min = ($now_min-$min)%60;}
if($day_week){ if($day_week){
$day_week = $day_week % 6; // 7 and 0 both mean Sunday $day_week = $day_week % 6; // 7 and 0 both mean Sunday
$now_day_week = $now_day_week % 6; // 7 and 0 both mean Sunday $now_day_week = $now_day_week % 6; // 7 and 0 both mean Sunday
@ -46,9 +44,10 @@ class crontime {
return mktime($last_hour, $last_min, 0, $last_month, $last_day, $last_year); return mktime($last_hour, $last_min, 0, $last_month, $last_day, $last_year);
} }
public static function check($base_time,$last_run,$min,$hour,$day,$day_week,$month){ public static function check($base_time,$last_run,$min,$hour,$day,$day_week,$month){
return crontime::next($last_run, $min, $hour, $day, $day_week, $month) < $base_time ? true : false;} //new \SYSTEM\LOG\INFO('next:'.self::next($last_run, $min, $hour, $day, $day_week, $month).' bt:'.$base_time.' last:'.$last_run.' dif:'.(self::next($last_run, $min, $hour, $day, $day_week, $month) - time($base_time)).' run:'.(self::next($last_run, $min, $hour, $day, $day_week, $month) <= time($base_time) ? 'run' : 'not run'));
return self::next($last_run, $min, $hour, $day, $day_week, $month) <= $base_time ? true : false;}
public static function next_now($min,$hour,$day,$day_week,$month){ public static function next_now($min,$hour,$day,$day_week,$month){
self::next(time(),$min,$hour,$day,$day_week,$month);} return self::next(time(),$min,$hour,$day,$day_week,$month);}
public static function last_now($min,$hour,$day,$day_week,$month){ public static function last_now($min,$hour,$day,$day_week,$month){
return self::last(time(),$min,$hour,$day,$day_week,$month);} return self::last(time(),$min,$hour,$day,$day_week,$month);}
public static function check_now($last_run,$min,$hour,$day,$day_week,$month){ public static function check_now($last_run,$min,$hour,$day,$day_week,$month){

6
db/autoload.inc.php Normal file
View File

@ -0,0 +1,6 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\DB');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/dbinfo','SYSTEM\DB');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/connection','SYSTEM\DB');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/result','SYSTEM\DB');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq','SYSTEM\DB');

3
dbd/autoload.inc.php Normal file
View File

@ -0,0 +1,3 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/tbl','SYSTEM\DBD');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq','SYSTEM\DBD');

11
dbd/qq/SYS_CRON_GET.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace SYSTEM\DBD;
class SYS_CRON_GET extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'SELECT * FROM '.\SYSTEM\DBD\system_cron::NAME_PG.' WHERE class = ?;',
//mys
'SELECT * FROM '.\SYSTEM\DBD\system_cron::NAME_MYS.' WHERE class = ?;'
);}}

View File

@ -21,4 +21,6 @@ INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('b
INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('basic_placeholder_password', 1, 'my secret123', 'geheim567'); INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('basic_placeholder_password', 1, 'my secret123', 'geheim567');
INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('basic_placeholder_email', 1, 'peter@world.org', 'peter@world.org'); INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('basic_placeholder_email', 1, 'peter@world.org', 'peter@world.org');
INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('basic_state_login', 1, 'You are logged in.', 'You are logged in.'); INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('basic_state_login', 1, 'You are logged in.', 'You are logged in.');
INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('basic_example', 1, '<h1><img style="float: right;" title="TinyMCE Logo" src="http://www.tinymce.com/tryit/img/tlogo.png" alt="TinyMCE Logo" width="92" height="80" />Welcome to the TinyMCE editor demo!</h1>\n<p>Feel free to try out the different features that are provided, please note that the <strong>MoxieManager</strong> specific functionality is part of our commercial offering. The demo is to show the integration.</p>\n<h2>Got questions or need help?</h2>\n<p>If you have questions or need help, feel free to visit our <a href="forum/index.php">community forum</a>! We also offer Enterprise <a href="enterprise/support.php">support</a> solutions. Also do not miss out on the <a href="wiki.php">documentation</a>, its a great resource wiki for understanding how TinyMCE works and integrates.</p>\n<h2>Found a bug?</h2>\n<p>If you think you have found a bug, you can use the <a href="develop/bugtracker.php">Bug Tracker</a> to report bugs to the developers.</p>\n<p>And here is a simple table for you to play with.</p>\n<table border="0">\n<tbody>\n<tr>\n<td><strong>Product</strong></td>\n<td><strong>Cost</strong></td>\n<td><strong>Really?</strong></td>\n</tr>\n<tr>\n<td>TinyMCE</td>\n<td>Free</td>\n<td>YES!</td>\n</tr>\n<tr>\n<td>Plupload</td>\n<td>Free</td>\n<td>YES!</td>\n</tr>\n</tbody>\n</table>\n<p>Enjoy our software and create great content!</p>\n<p>Oh, and by the way, don\'t forget to check out our other product called <a href="http://www.plupload.com" target="_blank">Plupload</a>, your ultimate upload solution with HTML5 upload support!</p>', '<h1><img style="float: right;" title="TinyMCE Logo" src="http://www.tinymce.com/tryit/img/tlogo.png" alt="TinyMCE Logo" width="92" height="80" />Welcome to the TinyMCE editor demo!</h1>\n<p>Feel free to try out the different features that are provided, please note that the <strong>MoxieManager</strong> specific functionality is part of our commercial offering. The demo is to show the integration.</p>\n<h2>Got questions or need help?</h2>\n<p>If you have questions or need help, feel free to visit our <a href="forum/index.php">community forum</a>! We also offer Enterprise <a href="enterprise/support.php">support</a> solutions. Also do not miss out on the <a href="wiki.php">documentation</a>, its a great resource wiki for understanding how TinyMCE works and integrates.</p>\n<h2>Found a bug?</h2>\n<p>If you think you have found a bug, you can use the <a href="develop/bugtracker.php">Bug Tracker</a> to report bugs to the developers.</p>\n<p>And here is a simple table for you to play with.</p>\n<table border="0">\n<tbody>\n<tr>\n<td><strong>Product</strong></td>\n<td><strong>Cost</strong></td>\n<td><strong>Really?</strong></td>\n</tr>\n<tr>\n<td>TinyMCE</td>\n<td>Free</td>\n<td>YES!</td>\n</tr>\n<tr>\n<td>Plupload</td>\n<td>Free</td>\n<td>YES!</td>\n</tr>\n</tbody>\n</table>\n<p>Enjoy our software and create great content!</p>\n<p>Oh, and by the way, don\'t forget to check out our other product called <a href="http://www.plupload.com" target="_blank">Plupload</a>, your ultimate upload solution with HTML5 upload support!</p>');

View File

@ -22,6 +22,10 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (40, 42, 2, 10, 'text', 'request', 'STRING'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (40, 42, 2, 10, 'text', 'request', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (41, 42, 2, 40, 'text', 'lang', 'LANG'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (41, 42, 2, 40, 'text', 'lang', 'LANG');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (50, 42, 2, 10, 'pagestates', 'group', 'UINT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (50, 42, 2, 10, 'pagestates', 'group', 'UINT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (51, 42, 1, 50, NULL, 'js', NULL);
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (52, 42, 2, 51, NULL, 'group', 'UINT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (55, 42, 1, 50, NULL, 'css', NULL);
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (56, 42, 2, 55, NULL, 'group', 'UINT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (90, 42, 4, -1, NULL, '_lang', 'LANG'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (90, 42, 4, -1, NULL, '_lang', 'LANG');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (91, 42, 4, -1, NULL, '_result', 'RESULT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (91, 42, 4, -1, NULL, '_result', 'RESULT');
@ -124,4 +128,14 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
-- INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1000, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_todo', 'action', NULL); -- INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1000, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_todo', 'action', NULL);
-- INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1100, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_docu', 'action', NULL); -- INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1100, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_docu', 'action', NULL);
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1200, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_cron', 'action', NULL);
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1201, 42, 2, 1200, 'add', 'cls', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1202, 42, 2, 1200, 'add', 'min', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1203, 42, 2, 1200, 'add', 'hour', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1204, 42, 2, 1200, 'add', 'day', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1205, 42, 2, 1200, 'add', 'day_week', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1206, 42, 2, 1200, 'add', 'month', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1208, 42, 2, 1200, 'del', 'cls', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1209, 42, 2, 1200, 'deldialog', 'cls', 'STRING');

View File

@ -19,6 +19,10 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (41, 0, 2, 10, 'text', 'lang', 'LANG'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (41, 0, 2, 10, 'text', 'lang', 'LANG');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (50, 0, 2, 10, 'pagestates', 'group', 'UINT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (50, 0, 2, 10, 'pagestates', 'group', 'UINT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (51, 0, 1, 50, NULL, 'js', NULL);
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (52, 0, 2, 50, NULL, 'group', 'UINT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (55, 0, 1, 50, NULL, 'css', NULL);
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (56, 0, 2, 55, NULL, 'group', 'UINT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (90, 42, 4, -1, NULL, '_lang', 'LANG'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (90, 42, 4, -1, NULL, '_lang', 'LANG');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (91, 42, 4, -1, NULL, '_result', 'RESULT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (91, 42, 4, -1, NULL, '_result', 'RESULT');

View File

@ -8,4 +8,6 @@ INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (10, 'SYS_SAI_L
INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (15, 'SYS_SAI_IMG', 'Allows access to the Image Module in SAI to delete or add Pictures'); INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (15, 'SYS_SAI_IMG', 'Allows access to the Image Module in SAI to delete or add Pictures');
INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (20, 'SYS_SAI_API', 'SAI API Access right'); INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (20, 'SYS_SAI_API', 'SAI API Access right');
INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (21, 'SYS_SAI_API_EDIT', 'SAI API Edit right'); INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (21, 'SYS_SAI_API_EDIT', 'SAI API Edit right');
INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (25, 'SYS_SAI_CRON', 'SAI Cron Access right');

4
docu/autoload.inc.php Normal file
View File

@ -0,0 +1,4 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\DOCU');
require_once dirname(__FILE__).'/register_sys_docu.php';

3
files/autoload.inc.php Normal file
View File

@ -0,0 +1,3 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\FILES');
require_once dirname(__FILE__).'/register_sys_files.php';

View File

@ -0,0 +1,2 @@
<?php
\SYSTEM\FILES\files::registerFolder(dirname(__FILE__).'/sys_js/','sys_js');

74
files/sys_js/system.js Normal file
View File

@ -0,0 +1,74 @@
//mother object
function SYSTEM(endpoint, group){
this.endpoint = endpoint;
this.group = group;
this.pagestates = null;
}
//internal function to handle pagestate result
SYSTEM.prototype.handle_call_pagestates = function (data) {
if(data['status']){
newps = data['result'];
console.log('SYSTEM: loaded Pagestates');
result = true;
} else {
console.log('SYSTEM: Problem with your Pagestates.');
result = false;}
}
//send a call to the endpoint
SYSTEM.prototype.call = function(call,success,data,data_type,async){
$.ajax({
async: async,
data: data,
dataType: data_type,
url: this.endpoint+'?'+call,
success: success,
error: function(XMLHttpRequest, textStatus, errorThrown){console.log(call);}
});
}
//get the pagestates and save em
SYSTEM.prototype.load_pagestates = function(){
result = false;
newps = this.pagestates;
if(!this.pagestates){
this.call('call=pagestates&group='+this.group,this.handle_call_pagestates,{},"json",false);
} else { result = true;}
this.pagestates = newps;
return result;
};
//load a pagestatewith given id
SYSTEM.prototype.load = function(id){
console.log('Load Pagestate: '+id);
if(!this.load_pagestates()){
return false;}
var push = true;
this.pagestates.forEach(function(entry) {
if(entry['id'] === id){
if(push){
window.history.pushState(null, "", '#'+id);
push = false;}
$.ajax({
async: false,
data: {},
dataType: 'html',
url: entry['url'],
success: function(data){$(entry['div']).html(data); var fn = window[entry['func']]; if(typeof fn === 'function'){fn()};},
error: function(XMLHttpRequest, textStatus, errorThrown){console.log(errorThrown);}
});
//$(entry['div']).load(entry['url'],fn);
}
});
return push ? false : true;
};
//what?
SYSTEM.prototype.cur_state = function() {
var pathName = window.location.href;
if (pathName.indexOf('#') != -1) {
return pathName.split('#').pop();}
return '';
}
SYSTEM.prototype.go_state = function(default_state){
pageName = this.cur_state();
this.load(pageName ? pageName : default_state);
}

5
log/autoload.inc.php Normal file
View File

@ -0,0 +1,5 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\LOG');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/result','SYSTEM\LOG');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/exceptions','SYSTEM\LOG');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/error_handler','SYSTEM\LOG');

View File

@ -4,4 +4,6 @@ namespace SYSTEM\PAGE;
abstract class Page { abstract class Page {
abstract public function html(); abstract public function html();
//abstract public function js();
//abstract public function css();
} }

View File

@ -4,4 +4,10 @@ namespace SYSTEM\PAGE;
class State { class State {
public static function get($group){ public static function get($group){
return \SYSTEM\LOG\JsonResult::toString(\SYSTEM\DBD\SYS_PAGESTATES_GROUP::QA(array($group)));} return \SYSTEM\LOG\JsonResult::toString(\SYSTEM\DBD\SYS_PAGESTATES_GROUP::QA(array($group)));}
public static function get_js($group){
}
public static function get_css($group){
}
} }

2
page/autoload.inc.php Normal file
View File

@ -0,0 +1,2 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\PAGE');

View File

@ -1,7 +1,5 @@
<?php <?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/sai','SYSTEM\SAI'); SYSTEM\autoload::registerFolder(dirname(__FILE__).'/sai','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/page','SYSTEM\SAI'); SYSTEM\autoload::registerFolder(dirname(__FILE__).'/page','SYSTEM\SAI');
require_once dirname(__FILE__).'/modules/autoload.inc';
require_once dirname(__FILE__).'/modules/autoload_modules.php';
require_once dirname(__FILE__).'/modules/register_modules.php';

16
sai/modules/autoload.inc Normal file
View File

@ -0,0 +1,16 @@
<?php
SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
require_once dirname(__FILE__).'/saistart_sys_sai/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_log/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_security/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_mod/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_config/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_api/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_locale/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_files/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_cache/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_cron/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_todo/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_docu/autoload.inc';
require_once dirname(__FILE__).'/saimod_sys_login/autoload.inc';

View File

@ -1,15 +0,0 @@
<?php
SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saistart_sys_sai','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_login','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_log','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_security','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_mod','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_config','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_api','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_locale','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_cache','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_docu','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_todo','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_files','SYSTEM\SAI');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_sys_cron','SYSTEM\SAI');

View File

@ -1,13 +0,0 @@
<?php
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_log');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_security');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_mod');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_config');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_api');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_locale');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_files');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_cache');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_cron');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_todo');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_docu');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_login');

View File

@ -0,0 +1,5 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq/','SYSTEM\DBD');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_api');

View File

@ -19,7 +19,7 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
$vars2 = array( 'active' => ($first ? 'active' : ''), $vars2 = array( 'active' => ($first ? 'active' : ''),
'tab_id' => $r['group']); 'tab_id' => $r['group']);
$first = false; $first = false;
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/tabopt.tpl'), $vars2); $vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/tpl/tabopt.tpl'), $vars2);
} }
if(\SYSTEM\system::isSystemDbInfoPG()){ if(\SYSTEM\system::isSystemDbInfoPG()){
@ -33,7 +33,7 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
$tabs[$r['group']]['content'] = isset($tabs[$r['group']]['content']) ? $tabs[$r['group']]['content'] : ''; $tabs[$r['group']]['content'] = isset($tabs[$r['group']]['content']) ? $tabs[$r['group']]['content'] : '';
$r['tr_class'] = self::tablerow_class($r['type']); $r['tr_class'] = self::tablerow_class($r['type']);
$r['type'] = self::type_names($r['type']); $r['type'] = self::type_names($r['type']);
$tabs[$r['group']]['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/list_entry.tpl'), $r); $tabs[$r['group']]['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/tpl/list_entry.tpl'), $r);
} }
$vars['tabs'] = ''; $vars['tabs'] = '';
@ -41,9 +41,9 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
foreach($tabs as $tab){ foreach($tabs as $tab){
$tab['active'] = ($first ? 'active' : ''); $tab['active'] = ($first ? 'active' : '');
$first = false; $first = false;
$vars['tabs'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/tab.tpl'), $tab);} $vars['tabs'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/tpl/tab.tpl'), $tab);}
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/tabs.tpl'), $vars); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/tpl/tabs.tpl'), $vars);
/* $result = ""; /* $result = "";
$result .= '<tr class="'.self::tablerow_class($r['type']).'">'.'<td>'.$r['ID'].'</td>'.'<td>'.$r['group'].'</td>'.'<td>'.$r['type'].'</td>'.'<td>'.$r['parentID'].'</td>'.'<td>'.$r['parentValue'].'</td>'.'<td>'.$r['name'].'</td>'.'<td>'.$r['verify'].'</td>'.'</tr>'; $result .= '<tr class="'.self::tablerow_class($r['type']).'">'.'<td>'.$r['ID'].'</td>'.'<td>'.$r['group'].'</td>'.'<td>'.$r['type'].'</td>'.'<td>'.$r['parentID'].'</td>'.'<td>'.$r['parentValue'].'</td>'.'<td>'.$r['name'].'</td>'.'<td>'.$r['verify'].'</td>'.'</tr>';
@ -52,12 +52,14 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
public static function sai_mod__system_sai_saimod_sys_api_action_deletedialog($ID){ public static function sai_mod__system_sai_saimod_sys_api_action_deletedialog($ID){
$res = \SYSTEM\DBD\SYS_SAIMOD_API_SINGLE_SELECT::Q1(array($ID)); $res = \SYSTEM\DBD\SYS_SAIMOD_API_SINGLE_SELECT::Q1(array($ID));
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/delete_dialog.tpl'), $res); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/tpl/delete_dialog.tpl'), $res);
} }
public static function sai_mod__system_sai_saimod_sys_api_action_addcall($ID,$group,$type,$parentID,$parentValue,$name,$verify){ public static function sai_mod__system_sai_saimod_sys_api_action_addcall($ID,$group,$type,$parentID,$parentValue,$name,$verify){
if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){ if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){
throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");} throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");}
if($parentValue == ''){ $parentValue = NULL;}
if($verify == ''){ $verify = NULL;}
\SYSTEM\DBD\SYS_SAIMOD_API_ADD::QI(array($ID,$group,$type,$parentID,$parentValue,$name,$verify)); \SYSTEM\DBD\SYS_SAIMOD_API_ADD::QI(array($ID,$group,$type,$parentID,$parentValue,$name,$verify));
return \SYSTEM\LOG\JsonResult::ok(); return \SYSTEM\LOG\JsonResult::ok();
} }

View File

@ -0,0 +1,5 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq/','SYSTEM\DBD');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_cache');

View File

@ -0,0 +1,5 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq/','SYSTEM\DBD');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_config');

View File

@ -0,0 +1,5 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq/','SYSTEM\DBD');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_cron');

View File

@ -1,26 +0,0 @@
<div id="api_deletedialog">
<h5>Api Call: ${ID}</h5>
<hr>
<table class="table sai_table">
<tr>
<th>ID</th>
<th>Group</th>
<th>Type</th>
<th>ParentID</th>
<th>ParentValue</th>
<th>Name</th>
<th>Verify</th>
</tr>
<tr>
<td>${ID}</td>
<td>${group}</td>
<td>${type}</td>
<td>${parentID}</td>
<td>${parentValue}</td>
<td>${name}</td>
<td>${verify}</td>
</tr>
</table>
</div>
<button type="button" class="btn btn-small btn-danger" id="del_api_del">Delete</button>
<button type="button" class="btn btn-small" id="del_api_close">Close</button>

View File

@ -0,0 +1,11 @@
<?php
namespace SYSTEM\DBD;
class SYS_SAIMOD_CRON_ADD extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'INSERT INTO '.\SYSTEM\DBD\system_cron::NAME_PG.' (class, min, hour, day, day_week, month) VALUES ($1, $2, $3, $4, $5, $6);',
//mys
'INSERT INTO '.\SYSTEM\DBD\system_cron::NAME_MYS.' (class, min, hour, day, day_week, month) VALUES (?, ?, ?, ?, ?, ?);'
);}}

View File

@ -0,0 +1,11 @@
<?php
namespace SYSTEM\DBD;
class SYS_SAIMOD_CRON_DEL extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'DELETE FROM '.\SYSTEM\DBD\system_cron::NAME_PG.' WHERE class = $1;',
//mys
'DELETE FROM '.\SYSTEM\DBD\system_cron::NAME_MYS.' WHERE class = ?;'
);}}

View File

@ -0,0 +1,11 @@
<?php
namespace SYSTEM\DBD;
class SYS_SAIMOD_CRON_SINGLE_SELECT extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'SELECT * FROM '.\SYSTEM\DBD\system_cron::NAME_PG.' WHERE class = $1;',
//mys
'SELECT * FROM '.\SYSTEM\DBD\system_cron::NAME_MYS.' WHERE class = ?;'
);}}

View File

@ -1,98 +1,63 @@
var currentID = ''; function init__SYSTEM_SAI_saimod_sys_cron() {
saimod_sys_cron_register_clickevents();}
function init__SYSTEM_SAI_saimod_sys_api() {
saimod_sys_api_tree();
saimod_sys_api_register_clickevents();
}
function saimod_sys_api_loadcontent(){ function saimod_sys_cron_register_clickevents(){
$('#api_wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_api', function(){ $('tr.cron_entries').click(function() {
console.log('api module loaded');
saimod_sys_api_register_clickevents();
});
}
function saimod_sys_api_register_clickevents(){
$('tr.api_entries').click(function() {
console.log("ahsf"); console.log("ahsf");
currentID = $(this).attr("id");
$.ajax({ $.ajax({
url: SAI_ENDPOINT, url: SAI_ENDPOINT,
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_api', data: { sai_mod: '.SYSTEM.SAI.saimod_sys_cron',
action: 'deletedialog', action: 'deldialog',
ID: currentID}, cls: $(this).attr("cls")},
type: 'GET', type: 'GET',
success: function(data) { success: function(data) {
console.log("works"); console.log("works");
$('#api_content').html(data); $('#cron_content').html(data);
$('#del_api_close').click(function() { $('#del_cron_close').click(function() {
console.log("olenski"); console.log("olenski");
$('#del_api_description').hide(); $('#del_api_description').hide();
$('#del_api_del').show(); $('#del_api_del').show();
saimod_sys_api_loadcontent();
}); });
$('#del_api_del').click(function() { $('#del_cron_del').click(function() {
$.ajax({ $.ajax({
url: SAI_ENDPOINT, url: SAI_ENDPOINT,
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_api', data: { sai_mod: '.SYSTEM.SAI.saimod_sys_cron',
action: 'deletecall', action: 'del',
ID: currentID}, cls: $(this).attr("cls")},
type: 'GET', type: 'GET',
success: function(data) { success: function(data) {
console.log("api call deleted"); console.log("cron call deleted");
$('#api_deletedialog').html('<p>Api call deleted!</p>'); $('#cron_deletedialog').html('<p>Api call deleted!</p>');
$('#del_api_del').hide(); $('#del_cron_del').hide();
}});});}});}); }});});}});});
$('#addcall').click(function() { $('#addcron').click(function() {
var id = $('#new_call_id').val(); var cls = $('#new_cron_class').val();
var group = $('#new_call_group').val(); var min = $('#new_cron_min').val();
var type = $('#new_call_type').val(); var hour = $('#new_cron_hour').val();
var parentid = $('#new_call_parentid').val(); var day = $('#new_cron_day').val();
var parentvalue = $('#new_call_parentvalue').val(); var day_week = $('#new_cron_day_week').val();
var name = $('#new_call_name').val(); var month = $('#new_cron_month').val();
var verify = $('#new_call_verify').val();
$.ajax({ $.ajax({
url: SAI_ENDPOINT, url: SAI_ENDPOINT,
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_api', data: { sai_mod: '.SYSTEM.SAI.saimod_sys_cron',
action: 'addcall', action: 'add',
ID: id, cls: cls,
group: group, min: min,
type: type, hour: hour,
parentID: parentid, day: day,
parentValue : parentvalue, day_week: day_week,
name: name, month: month},
verify: verify},
type: 'GET', type: 'GET',
success: function(data) { success: function(data) {
console.log("new api call added"); console.log("new cronjob added");
saimod_sys_api_loadcontent();
} }
}); });
}); });
$('#del_api_close').click(function() { $('#del_cron_close').click(function() {
console.log("olenski"); console.log("olenski");
$('#del_api_description').hide(); $('#del_cron_description').hide();
$('#del_api_del').show(); $('#del_cron_del').show();
saimod_sys_api_loadcontent();
});
$('#localetab a').click(function (e) {e.preventDefault(); $(this).tab('show');});
}
function saimod_sys_api_tree(){
$('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch');
$('.tree li.parent_li > span').on('click', function (e) {
var children = $(this).parent('li.parent_li').find(' > ul > li');
if (children.is(":visible")) {
children.hide('fast');
$(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign');
} else {
children.show('fast');
$(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign');
}
e.stopPropagation();
}); });
} }

View File

@ -4,48 +4,34 @@ namespace SYSTEM\SAI;
class saimod_sys_cron extends \SYSTEM\SAI\SaiModule { class saimod_sys_cron extends \SYSTEM\SAI\SaiModule {
public static function sai_mod__SYSTEM_SAI_saimod_sys_cron(){ public static function sai_mod__SYSTEM_SAI_saimod_sys_cron(){
$vars = array(); $vars = array();
$vars['tabopts'] = \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tabopt.tpl'), array());
$vars['content'] = ''; $vars['content'] = '';
$res = \SYSTEM\DBD\SYS_SAIMOD_CRON::QQ();
$res = \SYSTEM\DBD\SYS_SAIMOD_CRON::QQ();
while($r = $res->next()){ while($r = $res->next()){
$vars['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/list_entry.tpl'), $r);} $r['next'] = date('Y-m-d H:i:s',\SYSTEM\CRON\cron::next($r['class']));
$vars['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tpl/list_entry.tpl'), $r);}
$vars['tabs'] = \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tab.tpl'), $vars); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tpl/tabs.tpl'), $vars);
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tabs.tpl'), $vars);
} }
public static function sai_mod__system_sai_saimod_sys_api_action_deletedialog($ID){ public static function sai_mod__system_sai_saimod_sys_cron_action_deldialog($cls){
$res = \SYSTEM\DBD\SYS_SAIMOD_API_SINGLE_SELECT::Q1(array($ID)); $res = \SYSTEM\DBD\SYS_SAIMOD_CRON_SINGLE_SELECT::Q1(array($cls));
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/delete_dialog.tpl'), $res); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_cron/tpl/delete_dialog.tpl'), $res);}
}
public static function sai_mod__system_sai_saimod_sys_api_action_addcall($ID,$group,$type,$parentID,$parentValue,$name,$verify){ public static function sai_mod__system_sai_saimod_sys_cron_action_add($cls,$min,$hour,$day,$day_week,$month){
if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){ if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_CRON)){
throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");} throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");}
\SYSTEM\DBD\SYS_SAIMOD_API_ADD::QI(array($ID,$group,$type,$parentID,$parentValue,$name,$verify)); \SYSTEM\DBD\SYS_SAIMOD_CRON_ADD::QI(array($cls,$min,$hour,$day,$day_week,$month));
return \SYSTEM\LOG\JsonResult::ok(); return \SYSTEM\LOG\JsonResult::ok();
} }
public static function sai_mod__system_sai_saimod_sys_api_action_deletecall($ID){ public static function sai_mod__system_sai_saimod_sys_cron_action_del($cls){
if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){ if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_CRON)){
throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");} throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");}
\SYSTEM\DBD\SYS_SAIMOD_API_DEL::QI(array($ID)); \SYSTEM\DBD\SYS_SAIMOD_CRON_DEL::QI(array($cls));
return \SYSTEM\LOG\JsonResult::ok(); return \SYSTEM\LOG\JsonResult::ok();}
}
private static function tablerow_class($flag){
switch($flag){
case 0: return 'info';
case 1: return '';
case 4: return 'warning';
default: return 'success';
}
}
public static function html_li_menu(){return '<li><a href="#" saimenu=".SYSTEM.SAI.saimod_sys_cron">Cron</a></li>';} public static function html_li_menu(){return '<li><a href="#" saimenu=".SYSTEM.SAI.saimod_sys_cron">Cron</a></li>';}
public static function right_public(){return false;} public static function right_public(){return false;}
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_CRON);}
public static function sai_mod__SYSTEM_SAI_saimod_sys_cron_flag_css(){ public static function sai_mod__SYSTEM_SAI_saimod_sys_cron_flag_css(){
return \SYSTEM\LOG\JsonResult::toString( return \SYSTEM\LOG\JsonResult::toString(

View File

@ -1,15 +0,0 @@
<div class="tab-pane active" id="tab_cron">
<table class="table table-hover table-condensed" style="overflow: auto;">
<tr>
<th>class</th>
<th>min</th>
<th>hour</th>
<th>day</th>
<th>day_week</th>
<th>month</th>
<th>last_run</th>
<th>status</th>
</tr>
${content}
</table>
</div>

View File

@ -1 +0,0 @@
<li class="active"><a href="#tab_cron">Cron</a></li>

View File

@ -1,38 +0,0 @@
<div id="cron_wrapper">
<h4>System Cron</h4>
<hr>
<div id="cron_content">
<div class="tabbable">
<ul class="nav nav-tabs" id="crontab">
${tabopts}
</ul>
<div class="tab-content">
${tabs}
</div>
</div>
<table class="table table-hover table-condensed" style="overflow: auto;">
<tr>
<th>class</th>
<th>min</th>
<th>hour</th>
<th>day</th>
<th>day_week</th>
<th>month</th>
<th>last_run</th>
<th>status</th>
</tr>
<tr>
<td><input type="text" id="new_cron_class" placeholder="class" style="width: 140px;"></td>
<td><input type="text" id="new_cron_min" placeholder="min" style="width: 140px;"></td>
<td><input type="text" id="new_cron_hour" placeholder="hour" style="width: 140px;"></td>
<td><input type="text" id="new_cron_day" placeholder="day" style="width: 140px;"></td>
<td><input type="text" id="new_cron_day" placeholder="day_week" style="width: 140px;"></td>
<td><input type="text" id="new_cron_month" placeholder="month" style="width: 140px;"></td>
<td></td>
<td></td>
</tr>
</table>
<!--<button type="button" class="btn-small btn-success" id="addcron">Add</button>-->
</div><!-- /.modal -->
</div>

View File

@ -0,0 +1,24 @@
<div id="cron_deletedialog">
<h5>Cron Job: ${class}</h5>
<hr>
<table class="table sai_table">
<tr>
<th>class</th>
<th>min</th>
<th>hour</th>
<th>day</th>
<th>day_week</th>
<th>month</th>
</tr>
<tr>
<td>${class}</td>
<td>${min}</td>
<td>${hour}</td>
<td>${day}</td>
<td>${day_week}</td>
<td>${month}</td>
</tr>
</table>
</div>
<button type="button" class="btn btn-small btn-danger" cls="${class}" id="del_cron_del">Delete</button>
<button type="button" class="btn btn-small" id="del_cron_close">Close</button>

View File

@ -1,4 +1,4 @@
<tr class="${tr_class} cron_entries"> <tr class="${tr_class} cron_entries" cls="${class}">
<td>${class}</td> <td>${class}</td>
<td>${min}</td> <td>${min}</td>
<td>${hour}</td> <td>${hour}</td>
@ -6,5 +6,6 @@
<td>${day_week}</td> <td>${day_week}</td>
<td>${month}</td> <td>${month}</td>
<td>${last_run}</td> <td>${last_run}</td>
<td>${next}</td>
<td>${status}</td> <td>${status}</td>
</tr> </tr>

View File

@ -0,0 +1,30 @@
<div id="cron_wrapper">
<h4>System Cron</h4>
<hr>
<div id="cron_content">
<table class="table table-hover table-condensed sai_table" style="overflow: auto;">
<tr>
<th>class</th>
<th>min</th>
<th>hour</th>
<th>day</th>
<th>day_week</th>
<th>month</th>
<th>last_run</th>
<th>next_run</th>
<th>status</th>
</tr>
${content}
<tr>
<td><input type="text" id="new_cron_class" placeholder="class" style="width: 140px;"></td>
<td><input type="text" id="new_cron_min" placeholder="min" style="width: 140px;"></td>
<td><input type="text" id="new_cron_hour" placeholder="hour" style="width: 140px;"></td>
<td><input type="text" id="new_cron_day" placeholder="day" style="width: 140px;"></td>
<td><input type="text" id="new_cron_day_week" placeholder="day_week" style="width: 140px;"></td>
<td><input type="text" id="new_cron_month" placeholder="month" style="width: 140px;"></td>
<td></td>
<td><button type="button" class="btn-small btn-success" id="addcron">Add</button></td>
</tr>
</table>
</div>
</div>

View File

@ -0,0 +1,5 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq/','SYSTEM\DBD');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_docu');

View File

@ -12,7 +12,7 @@ class saimod_sys_docu extends \SYSTEM\SAI\SaiModule {
'tab_id' => str_replace(' ', '_', $cat), 'tab_id' => str_replace(' ', '_', $cat),
'tab_id_pretty' => $cat); 'tab_id_pretty' => $cat);
$first = false; $first = false;
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_docu/tabopt.tpl'), $vars2); $vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_docu/tpl/tabopt.tpl'), $vars2);
$first2 = true; $first2 = true;
foreach($docs as $doc){ foreach($docs as $doc){
@ -23,11 +23,11 @@ class saimod_sys_docu extends \SYSTEM\SAI\SaiModule {
$vars3 = array( 'active' => ($first2 ? 'active' : ''), $vars3 = array( 'active' => ($first2 ? 'active' : ''),
'content' => \Michelf\MarkdownExtra::defaultTransform(file_get_contents($doc)), 'content' => \Michelf\MarkdownExtra::defaultTransform(file_get_contents($doc)),
'tab_id' => str_replace(array('.',' ','\\','/'), '_', $doc)); 'tab_id' => str_replace(array('.',' ','\\','/'), '_', $doc));
$tabs[$cat]['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_docu/tab2.tpl'), $vars3); $tabs[$cat]['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_docu/tpl/tab2.tpl'), $vars3);
$vars3 = array( 'active' => ($first2 ? 'active' : ''), $vars3 = array( 'active' => ($first2 ? 'active' : ''),
'tab_id' => str_replace(array('.',' ','\\','/'), '_', $doc), 'tab_id' => str_replace(array('.',' ','\\','/'), '_', $doc),
'tab_id_pretty' => basename($doc)); 'tab_id_pretty' => basename($doc));
$tabs[$cat]['menu'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_docu/tabopt.tpl'), $vars3); $tabs[$cat]['menu'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_docu/tpl/tabopt.tpl'), $vars3);
$first2 = false; $first2 = false;
} }
@ -36,9 +36,9 @@ class saimod_sys_docu extends \SYSTEM\SAI\SaiModule {
foreach($tabs as $tab){ foreach($tabs as $tab){
$tab['active'] = ($first ? 'active' : ''); $tab['active'] = ($first ? 'active' : '');
$first = false; $first = false;
$vars['tabs'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_docu/tab.tpl'), $tab);} $vars['tabs'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_docu/tpl/tab.tpl'), $tab);}
} }
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_docu/tabs.tpl'), $vars); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_docu/tpl/tabs.tpl'), $vars);
} }
public static function html_li_menu(){return '<li><a href="#" saimenu=".SYSTEM.SAI.saimod_sys_docu">Docu</a></li>';} public static function html_li_menu(){return '<li><a href="#" saimenu=".SYSTEM.SAI.saimod_sys_docu">Docu</a></li>';}

View File

@ -0,0 +1,5 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq/','SYSTEM\DBD');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_files');

View File

@ -28,11 +28,11 @@ class saimod_sys_files extends \SYSTEM\SAI\SaiModule {
$file_folders = \SYSTEM\FILES\files::get(); $file_folders = \SYSTEM\FILES\files::get();
$first = true; $first = true;
foreach($file_folders as $name=>$folder){ foreach($file_folders as $name=>$folder){
$result['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_files/saimod_sys_files_tabopt.tpl'),array('name' => $name, 'active' => $first ? 'active' : '')); $result['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_files/tpl/saimod_sys_files_tabopt.tpl'),array('name' => $name, 'active' => $first ? 'active' : ''));
$result['tabs'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_files/saimod_sys_files_tab.tpl'),array('name' => $name, 'active' => $first ? 'active' : '', 'content' => $first ? self::sai_mod__SYSTEM_SAI_saimod_sys_files_action_tab($name) : '')); $result['tabs'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_files/tpl/saimod_sys_files_tab.tpl'),array('name' => $name, 'active' => $first ? 'active' : '', 'content' => $first ? self::sai_mod__SYSTEM_SAI_saimod_sys_files_action_tab($name) : ''));
$first = false; $first = false;
} }
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_files/saimod_sys_files.tpl'),$result); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_files/tpl/saimod_sys_files.tpl'),$result);
} }
public static function sai_mod__SYSTEM_SAI_saimod_sys_files_action_tab($name){ public static function sai_mod__SYSTEM_SAI_saimod_sys_files_action_tab($name){
@ -40,8 +40,8 @@ class saimod_sys_files extends \SYSTEM\SAI\SaiModule {
$cat = \SYSTEM\FILES\files::get($name); $cat = \SYSTEM\FILES\files::get($name);
$i = 0; $i = 0;
foreach($cat as $file){ foreach($cat as $file){
$result .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_files/saimod_sys_files_tableentry.tpl'), array('i' => $i++, 'cat' => $name, 'name' => $file, 'extension' => substr($file,-3,3), 'url' => 'api.php?call=files&cat='.$name.'&id='.$file));} $result .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_files/tpl/saimod_sys_files_tableentry.tpl'), array('i' => $i++, 'cat' => $name, 'name' => $file, 'extension' => substr($file,-3,3), 'url' => 'api.php?call=files&cat='.$name.'&id='.$file));}
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_files/saimod_sys_files_tabfull.tpl'), array('cat' => $name, 'content' => $result));} return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_files/tpl/saimod_sys_files_tabfull.tpl'), array('cat' => $name, 'content' => $result));}
public static function html_li_menu(){return '<li><a href="#" saimenu=".SYSTEM.SAI.saimod_sys_files">Files</a></li>';} public static function html_li_menu(){return '<li><a href="#" saimenu=".SYSTEM.SAI.saimod_sys_files">Files</a></li>';}
public static function right_public(){return false;} public static function right_public(){return false;}

View File

@ -0,0 +1,5 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq/','SYSTEM\DBD');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_locale');

View File

@ -51,21 +51,29 @@ function init__SYSTEM_SAI_saimod_sys_locale() {
$('#'+cData.lang).addClass('active'); $('#'+cData.lang).addClass('active');
saimod_sys_locale_loadcontent(cData.lang, cData.group); saimod_sys_locale_loadcontent(cData.lang, cData.group);
if (cData.editmode === true){ if (cData.editmode === true){
console.log("now i am true");
saimod_sys_locale_loadsinglecontent(cData.id, cData.lang); saimod_sys_locale_loadsinglecontent(cData.id, cData.lang);
cData.editmode = false;
}}); }});
$('#changetext').click(function(){ $('#changetext').click(function(){
saimod_sys_locale_savecontent(cData.id, cData.lang);}); saimod_sys_locale_savecontent(cData.id, cData.lang);});
$('#del_text').click(function(){ $('#del_text').click(function(){
saimod_sys_locale_delete($('#modaltitle').html());}); saimod_sys_locale_delete($('#modaltitle').html());
cData.editmode = false;});
$(document).keyup(function(e) { $(document).keyup(function(e) {
if (e.keyCode === 27) { $('#addtext').show(); } // esc if (e.keyCode === 27) { $('#addtext').show(); } // esc
}); });
//tiny mce modal fix
$(document).on('focusin', function(e) {
if ($(e.target).closest(".mce-window").length) {
e.stopImmediatePropagation();
}
});
} }
function saimod_sys_locale_newtext(){ function saimod_sys_locale_newtext(){
cData.editmode = true;
$('#modaltitle').hide(); $('#modaltitle').hide();
$('#modaltextarea').hide(); $('#modaltextarea').hide();
$('#del_text').hide(); $('#del_text').hide();
@ -165,6 +173,7 @@ function saimod_sys_locale_loadsinglecontent(id, lang){
} }
function saimod_sys_locale_loadcontent(id, group){ function saimod_sys_locale_loadcontent(id, group){
cData.editmode = true;
$('#tab-content').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=load&id='+id+'&group='+group, function(){ $('#tab-content').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=load&id='+id+'&group='+group, function(){
$('.tableentry').click(function(){ $('.tableentry').click(function(){
cData.editmode = true; cData.editmode = true;
@ -185,7 +194,7 @@ function saimod_sys_locale_delete(buttonID){
function init_tinymce(){ function init_tinymce(){
tinymce.init({ // General options tinymce.init({ // General options
mode : "textareas", /*mode : "textareas",
theme : "modern", theme : "modern",
formats : { formats : {
@ -204,6 +213,63 @@ function init_tinymce(){
height: "250px", height: "250px",
// Example content CSS (should be your site CSS) // Example content CSS (should be your site CSS)
content_css : "../../page/index.css" content_css : "../../page/index.css"*/
// General options
/* mode : "textareas",
//theme : "advanced",
theme : "modern",
plugins : "autolink,lists,pagebreak,layer,table,save,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,template,code",*/
//xhtmlxtras,emotions,advimage,advlink,iespell,inlinepopups,advhr,style,spellchecker,
// Theme options
/*theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,*/
// Skin options
//skin : "o2k7",
//skin_variant : "silver",
width: "100%",
height: "250px",
// Example content CSS (should be your site CSS)
//content_css : "css/example.css",
//content_css : "../../page/index.css"
// Drop lists for link/image/media/template dialogs
/*template_external_list_url : "js/template_list.js",
external_link_list_url : "js/link_list.js",
external_image_list_url : "js/image_list.js",
media_external_list_url : "js/media_list.js",
forced_root_block : "",
force_br_newlines : true,
force_p_newlines : false,
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}*/
selector: "textarea",
theme: "modern",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor"
],
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "print preview media | forecolor backcolor emoticons",
image_advtab: true,
templates: [
{title: 'Test template 1', content: 'Test 1'},
{title: 'Test template 2', content: 'Test 2'}
]
}); });
} }

View File

@ -16,20 +16,20 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
$vars2 = array( 'active' => ($first ? 'active' : ''), $vars2 = array( 'active' => ($first ? 'active' : ''),
'tab_id' => $r['category']); 'tab_id' => $r['category']);
$first = false; $first = false;
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tabopt.tpl'), $vars2); $vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tpl/tabopt.tpl'), $vars2);
} }
$langtab_ = ''; $langtab_ = '';
foreach (self::getLanguages() as $lang){ foreach (self::getLanguages() as $lang){
$details['langs'] = $lang; $details['langs'] = $lang;
$langtab_ .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/langtabopt.tpl'), $details); $langtab_ .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tpl/langtabopt.tpl'), $details);
$languages[] = $lang; $languages[] = $lang;
} }
$langtab['langs'] = $langtab_; $langtab['langs'] = $langtab_;
$langhead = \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/langtabs.tpl'), $langtab); $langhead = \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tpl/langtabs.tpl'), $langtab);
$vars['tabs'] = $langhead; $vars['tabs'] = $langhead;
$vars['langs'] = $langtab_; $vars['langs'] = $langtab_;
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tabs.tpl'), $vars); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tpl/tabs.tpl'), $vars);
//.\SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/editmode.tpl'), $vars); //.\SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tpl/editmode.tpl'), $vars);
} }
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_load($lang, $group){ public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_load($lang, $group){
@ -41,7 +41,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
while($r = $res->next()){ while($r = $res->next()){
$temparr['lang'] = $r[$lang]; $temparr['lang'] = $r[$lang];
$temparr['id'] = $r['id']; $temparr['id'] = $r['id'];
$entries .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/entry.tpl'), $temparr); $entries .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tpl/entry.tpl'), $temparr);
} }
return $entries; return $entries;
} }
@ -50,13 +50,11 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
$con = new \SYSTEM\DB\Connection(); $con = new \SYSTEM\DB\Connection();
$result = ""; $result = "";
$query = 'SELECT '.$lang.' FROM `'.\SYSTEM\DBD\system_locale_string::NAME_MYS.'` WHERE id=\''.$id.'\' ORDER BY category ASC;'; $query = 'SELECT '.$lang.' FROM `'.\SYSTEM\DBD\system_locale_string::NAME_MYS.'` WHERE id=\''.$id.'\' ORDER BY category ASC;';
new \SYSTEM\LOG\WARNING($query); $res = $con->query($query);
$res = $con->query($query); $entries = '';
$entries = ''; $temparr = array();
$temparr = array(); while($r = $res->next()){
while($r = $res->next()){ $entries .= $r[$lang];}
$entries .= $r[$lang];
}
return $entries; return $entries;
} }

View File

@ -0,0 +1,5 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM\SAI');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq/','SYSTEM\DBD');
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_log');

View File

@ -9,11 +9,11 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats(){ public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats(){
$vars = array(); $vars = array();
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_stats.tpl'), $vars);} return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/tpl/saimod_sys_log_stats.tpl'), $vars);}
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_admin(){ public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_admin(){
$vars = array(); $vars = array();
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_admin.tpl'), $vars);} return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/tpl/saimod_sys_log_admin.tpl'), $vars);}
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_system($filter){ public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_system($filter){
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_CLASS_SYSTEM::QA(array($filter)); $result = \SYSTEM\DBD\SYS_SAIMOD_LOG_CLASS_SYSTEM::QA(array($filter));
@ -58,7 +58,7 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_error($error){ public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_error($error){
$vars = \SYSTEM\DBD\SYS_SAIMOD_LOG_ERROR::QQ(array($error))->next(); $vars = \SYSTEM\DBD\SYS_SAIMOD_LOG_ERROR::QQ(array($error))->next();
$vars['trace'] = implode('</br>', array_slice(explode('#', $vars['trace']), 1, -1)); $vars['trace'] = implode('</br>', array_slice(explode('#', $vars['trace']), 1, -1));
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_error.tpl'), $vars);} return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/tpl/saimod_sys_log_error.tpl'), $vars);}
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_filter($filter = "%"){ public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_filter($filter = "%"){
$count = \SYSTEM\DBD\SYS_SAIMOD_LOG_FILTER_COUNT::Q1(array($filter)); $count = \SYSTEM\DBD\SYS_SAIMOD_LOG_FILTER_COUNT::Q1(array($filter));
@ -69,19 +69,19 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
$r['class_row'] = self::tablerow_class($r['class']); $r['class_row'] = self::tablerow_class($r['class']);
$r['time'] = self::time_elapsed_string(strtotime($r['time'])); $r['time'] = self::time_elapsed_string(strtotime($r['time']));
$r['message'] = substr($r['message'],0,255); $r['message'] = substr($r['message'],0,255);
$table .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_table_row.tpl'),$r); $table .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/tpl/saimod_sys_log_table_row.tpl'),$r);
} }
$vars = array(); $vars = array();
$vars['count'] = $count['count']; $vars['count'] = $count['count'];
$vars['table'] = $table; $vars['table'] = $table;
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_table.tpl'), $vars); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/tpl/saimod_sys_log_table.tpl'), $vars);
} }
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_log(){ public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_log(){
$vars = array(); $vars = array();
$vars['table'] = self::sai_mod__SYSTEM_SAI_saimod_sys_log_action_filter(); $vars['table'] = self::sai_mod__SYSTEM_SAI_saimod_sys_log_action_filter();
$vars['error_filter'] = self::generate_error_filters(); $vars['error_filter'] = self::generate_error_filters();
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_filter.tpl'), $vars); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/tpl/saimod_sys_log_filter.tpl'), $vars);
} }
private static function time_elapsed_string($ptime){ private static function time_elapsed_string($ptime){
@ -115,7 +115,7 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
public static function sai_mod__SYSTEM_SAI_saimod_sys_log(){ public static function sai_mod__SYSTEM_SAI_saimod_sys_log(){
$vars = array(); $vars = array();
$vars['PICPATH'] = \SYSTEM\WEBPATH(new \SYSTEM\PSAI(), 'modules/saimod_sys_log/img/'); $vars['PICPATH'] = \SYSTEM\WEBPATH(new \SYSTEM\PSAI(), 'modules/saimod_sys_log/img/');
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log.tpl'), $vars); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/tpl/saimod_sys_log.tpl'), $vars);
} }
public static function tablerow_class($class){ public static function tablerow_class($class){

Some files were not shown because too many files have changed in this diff Show More