saimod css&js support, 2 menus in sai(project&sys), fixed login
This commit is contained in:
parent
e68c4fed17
commit
02010010c9
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_sai');
|
\SYSTEM\SAI\sai::getInstance()->register_sys('\SYSTEM\SAI\saimod_sys_sai');
|
||||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_login');
|
\SYSTEM\SAI\sai::getInstance()->register_sys('\SYSTEM\SAI\saimod_sys_login');
|
||||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_error');
|
\SYSTEM\SAI\sai::getInstance()->register_sys('\SYSTEM\SAI\saimod_sys_error');
|
||||||
//\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_sys');
|
//\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_sys');
|
||||||
//\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_api');
|
//\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_api');
|
||||||
//\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_page');
|
//\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_page');
|
||||||
|
|||||||
@ -10,7 +10,7 @@ class saimod_sys_error extends \SYSTEM\SAI\SaiModule {
|
|||||||
|
|
||||||
$now = microtime(true);
|
$now = microtime(true);
|
||||||
|
|
||||||
$result = '<table class="table table-hover table-condensed" style="position:absolute; left:0;overflow: auto;">'.
|
$result = '<table class="table table-hover table-condensed" style="overflow: auto;">'.
|
||||||
'<tr>'.'<th>'.'time ago in sec'.'</th>'.'<th>'.'time'.'</th>'.'<th>'.'class'.'</th>'.'<th>'.'message'.'</th>'.'<th>'.'code'.'</th>'.'<th>'.'file'.'</th>'.'<th>'.'line'.'</th>'.'<th>'.'ip'.'</th>'.'<th>'.'querytime'.'</tr>';
|
'<tr>'.'<th>'.'time ago in sec'.'</th>'.'<th>'.'time'.'</th>'.'<th>'.'class'.'</th>'.'<th>'.'message'.'</th>'.'<th>'.'code'.'</th>'.'<th>'.'file'.'</th>'.'<th>'.'line'.'</th>'.'<th>'.'ip'.'</th>'.'<th>'.'querytime'.'</tr>';
|
||||||
while($r = $res->next()){
|
while($r = $res->next()){
|
||||||
$result .= '<tr class="'.self::tablerow_class($r['class']).'">'.'<td>'.(int)($now - strtotime($r['time'])).'</td>'.'<td>'.$r['time'].'</td>'.'<td>'.$r['class'].'</td>'.'<td>'.$r['message'].'</td>'.'<td>'.$r['code'].'</td>'.'<td>'.$r['file'].'</td>'.'<td>'.$r['line'].'</td>'.'<td>'.$r['ip'].'</td>'.'<td>'.$r['querytime'].'</tr>';
|
$result .= '<tr class="'.self::tablerow_class($r['class']).'">'.'<td>'.(int)($now - strtotime($r['time'])).'</td>'.'<td>'.$r['time'].'</td>'.'<td>'.$r['class'].'</td>'.'<td>'.$r['message'].'</td>'.'<td>'.$r['code'].'</td>'.'<td>'.$r['file'].'</td>'.'<td>'.$r['line'].'</td>'.'<td>'.$r['ip'].'</td>'.'<td>'.$r['querytime'].'</tr>';
|
||||||
@ -38,4 +38,7 @@ class saimod_sys_error extends \SYSTEM\SAI\SaiModule {
|
|||||||
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_error">SYS Error</a></li>';}
|
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_error">SYS Error</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\system::getSystemDBInfo(), \SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
|
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\system::getSystemDBInfo(), \SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
|
||||||
|
|
||||||
|
public static function src_css(){}
|
||||||
|
public static function src_js(){}
|
||||||
}
|
}
|
||||||
21
sai/modules/saimod_sys_login/login.js
Normal file
21
sai/modules/saimod_sys_login/login.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* jQuery on document ready */
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$("#submitButton").click(function(){
|
||||||
|
$.get('./api.php?call=account&action=login&username='+$('#username').val()+'&password_sha='+$.sha1($('#password').val())+'&password_md5='+hex_md5($('#password').val()), function (data) {
|
||||||
|
if(data === 1){
|
||||||
|
$("#loginStatusMsg").html('Login successful!!');
|
||||||
|
} else {
|
||||||
|
$("#loginStatusMsg").html('Wrong username or password!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@ -1,18 +1,32 @@
|
|||||||
Please login for developer access.
|
Please login for developer access.
|
||||||
</br>
|
</br>
|
||||||
<font color="red">${message}</font>
|
|
||||||
|
|
||||||
<form id='login' action='?action=developer&sai_mod=.SYSTEM.SAI.saimod_sys_login' method='post' accept-charset='UTF-8'>
|
<form class="textbox" style="padding:10px" id="login_form">
|
||||||
<fieldset>
|
<div class="control-group">
|
||||||
<legend>Login</legend>
|
<div class="controls">
|
||||||
<input type='hidden' name='submitted' id='submitted' value='1'/>
|
<input type="text"
|
||||||
|
size="30"
|
||||||
<label for='username' >UserName:</label>
|
style="margin-bottom: 15px;"
|
||||||
<input type='text' name='username' id='username' maxlength="50" />
|
id="bt_login_user"
|
||||||
|
placeholder="${loginUsername}"
|
||||||
<label for='password' >Password:</label>
|
minlength="3" data-validation-minlength-message="${login_username_too_short}"
|
||||||
<input type='password' name='password' id='password' maxlength="50" />
|
maxlength="16" data-validation-maxlength-message="${login_username_too_long}"
|
||||||
|
required data-validation-required-message="${login_username_required}"/>
|
||||||
<input type='submit' name='Submit' value='Submit' />
|
</div>
|
||||||
</fieldset>
|
<div class="controls">
|
||||||
|
<input type="password"
|
||||||
|
size="30"
|
||||||
|
style="margin-bottom: 15px;"
|
||||||
|
id="bt_login_password"
|
||||||
|
placeholder="${loginPassword}"
|
||||||
|
minlength="5" data-validation-minlength-message="${login_password_too_short}"
|
||||||
|
maxlength="16" data-validation-maxlength-message="${login_password_too_short}"
|
||||||
|
required data-validation-required-message="${login_password_required}"/>
|
||||||
|
</div>
|
||||||
|
<div class="help-block"></div>
|
||||||
|
<input type="hidden" />
|
||||||
|
<button class="btn btn-primary" style="clear: left; height: 32px; font-size: 13px;"
|
||||||
|
type="submit"
|
||||||
|
id="login_submit">${login}</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
32
sai/modules/saimod_sys_login/login.tpl.tpl
Normal file
32
sai/modules/saimod_sys_login/login.tpl.tpl
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
Please login for developer access.
|
||||||
|
</br>
|
||||||
|
|
||||||
|
<form class="textbox" style="padding:10px" id="login_form">
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text"
|
||||||
|
size="30"
|
||||||
|
style="margin-bottom: 15px;"
|
||||||
|
id="bt_login_user"
|
||||||
|
placeholder="${loginUsername}"
|
||||||
|
minlength="3" data-validation-minlength-message="${login_username_too_short}"
|
||||||
|
maxlength="16" data-validation-maxlength-message="${login_username_too_long}"
|
||||||
|
required data-validation-required-message="${login_username_required}"/>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="password"
|
||||||
|
size="30"
|
||||||
|
style="margin-bottom: 15px;"
|
||||||
|
id="bt_login_password"
|
||||||
|
placeholder="${loginPassword}"
|
||||||
|
minlength="5" data-validation-minlength-message="${login_password_too_short}"
|
||||||
|
maxlength="16" data-validation-maxlength-message="${login_password_too_short}"
|
||||||
|
required data-validation-required-message="${login_password_required}"/>
|
||||||
|
</div>
|
||||||
|
<div class="help-block"></div>
|
||||||
|
<input type="hidden" />
|
||||||
|
<button class="btn btn-primary" style="clear: left; height: 32px; font-size: 13px;"
|
||||||
|
type="submit"
|
||||||
|
id="login_submit">${login}</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@ -1 +0,0 @@
|
|||||||
Login successful.
|
|
||||||
12
sai/modules/saimod_sys_login/logout.tpl
Normal file
12
sai/modules/saimod_sys_login/logout.tpl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
You are logged in
|
||||||
|
</br>
|
||||||
|
|
||||||
|
<form class="textbox" style="padding:10px" id="logout_form">
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="help-block"></div>
|
||||||
|
<input type="hidden" />
|
||||||
|
<button class="btn btn-primary" style="clear: left; height: 32px; font-size: 13px;"
|
||||||
|
type="submit"
|
||||||
|
id="logout_submit">${logout}</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
34
sai/modules/saimod_sys_login/sai_sys_login_submit.js
Normal file
34
sai/modules/saimod_sys_login/sai_sys_login_submit.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
//jqBootstrapValidation
|
||||||
|
$("#login_form input").not("[type=submit]").jqBootstrapValidation({
|
||||||
|
preventSubmit: true,
|
||||||
|
submitError: function($form, event, errors) {},
|
||||||
|
submitSuccess: function($form, event){
|
||||||
|
$.get('./api.php?call=account&action=login&username='+$('#bt_login_user').val()+'&password_sha='+$.sha1($('#bt_login_password').val())+'&password_md5='+hex_md5($('#bt_login_password').val()), function (data) {
|
||||||
|
if(data == 1){
|
||||||
|
$('.help-block').html("Login successfull.</br>");
|
||||||
|
location.reload(true);
|
||||||
|
} else {
|
||||||
|
$('.help-block').html("Login not successfull.</br> User & Password combination wrong.")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#logout_form input").not("[type=submit]").jqBootstrapValidation({
|
||||||
|
preventSubmit: true,
|
||||||
|
submitError: function($form, event, errors) {},
|
||||||
|
submitSuccess: function($form, event){
|
||||||
|
$.get('./api.php?call=account&action=logout', function (data) {
|
||||||
|
if(data == 1){
|
||||||
|
$('.help-block').html("Logout successfull.</br>");
|
||||||
|
location.reload(true);
|
||||||
|
} else {
|
||||||
|
$('.help-block').html("Logout not successfull.</br>")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -8,12 +8,29 @@ class saimod_sys_login extends \SYSTEM\SAI\SaiModule {
|
|||||||
if( isset($_POST['username']) && isset($_POST['password']) &&
|
if( isset($_POST['username']) && isset($_POST['password']) &&
|
||||||
\SYSTEM\SECURITY\Security::login(\SYSTEM\system::getSystemDBInfo(), $_POST['username'], sha1($_POST['password']), md5($_POST['password']))){
|
\SYSTEM\SECURITY\Security::login(\SYSTEM\system::getSystemDBInfo(), $_POST['username'], sha1($_POST['password']), md5($_POST['password']))){
|
||||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/login_success.tpl'), array());}
|
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/login_success.tpl'), array());}
|
||||||
|
|
||||||
$vars = array();
|
$vars = array();
|
||||||
$vars['message'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? 'You are already logged in! Maybe you dont have the required rights ;-).' : 'Not logged in!';
|
$vars['login'] = 'Login';
|
||||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/login.tpl'), $vars);
|
$vars['logout'] = 'Logout';
|
||||||
|
$vars['loginUsername'] = 'Username';
|
||||||
|
$vars['loginPassword'] = 'Password';
|
||||||
|
$vars['login_username_too_short'] = 'Username to short.';
|
||||||
|
$vars['login_password_too_short'] = 'Password to short.';
|
||||||
|
|
||||||
|
if(\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||||
|
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/logout.tpl'), $vars);
|
||||||
|
} else {
|
||||||
|
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/login.tpl'), $vars);}
|
||||||
}
|
}
|
||||||
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_login">SYS Login</a></li>';}
|
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_login">SYS Login</a></li>';}
|
||||||
public static function right_public(){return true;}
|
public static function right_public(){return true;}
|
||||||
public static function right_right(){}
|
public static function right_right(){}
|
||||||
|
|
||||||
|
public static function src_css(){}
|
||||||
|
public static function src_js(){return \SYSTEM\LOG\JsonResult::toString(
|
||||||
|
array( \SYSTEM\WEBPATH(new \PPAGE(),'default_page/js/jqBootstrapValidation.js'),
|
||||||
|
\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/sai_sys_login_submit.js'),
|
||||||
|
\SYSTEM\WEBPATH(new \PPAGE(),'default_page/js/crypto/md5.js'),
|
||||||
|
\SYSTEM\WEBPATH(new \PPAGE(),'default_page/js/crypto/jquery.sha1.js')
|
||||||
|
));}
|
||||||
}
|
}
|
||||||
@ -7,4 +7,7 @@ class saimod_sys_sai extends \SYSTEM\SAI\SaiModule {
|
|||||||
public static function html_li_menu(){return '<li class="active"><a href="#" id=".SYSTEM.SAI.saimod_sys_sai">SYS SAI</a></li>';}
|
public static function html_li_menu(){return '<li class="active"><a href="#" id=".SYSTEM.SAI.saimod_sys_sai">SYS SAI</a></li>';}
|
||||||
public static function right_public(){return true;}
|
public static function right_public(){return true;}
|
||||||
public static function right_right(){}
|
public static function right_right(){}
|
||||||
|
|
||||||
|
public static function src_css(){}
|
||||||
|
public static function src_js(){}
|
||||||
}
|
}
|
||||||
@ -6,18 +6,27 @@ class default_module extends \SYSTEM\PAGE\Page {
|
|||||||
|
|
||||||
private $module = null;
|
private $module = null;
|
||||||
private $post_get = null;
|
private $post_get = null;
|
||||||
|
private $css = null;
|
||||||
|
private $js = null;
|
||||||
|
|
||||||
public function __construct($module,$post_get){
|
public function __construct($module,$post_get){
|
||||||
$this->module = $module;
|
$this->module = $module;
|
||||||
$this->post_get = $post_get;}
|
$this->post_get = $post_get;
|
||||||
|
$this->css = isset($post_get['css']) ? $post_get['css'] : null;
|
||||||
|
$this->js = isset($post_get['js']) ? $post_get['js'] : null;
|
||||||
|
}
|
||||||
|
|
||||||
public function html(){
|
public function html(){
|
||||||
if($this->module != null){
|
if($this->module != null){
|
||||||
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
|
$mods = \SYSTEM\SAI\sai::getInstance()->getAllModules();
|
||||||
if( $this->module &&
|
if( $this->module &&
|
||||||
\array_search($this->module, $mods) !== false &&
|
\array_search($this->module, $mods) !== false &&
|
||||||
( \call_user_func(array($this->module, 'right_public')) ||
|
( \call_user_func(array($this->module, 'right_public')) ||
|
||||||
\call_user_func(array($this->module, 'right_right')))){
|
\call_user_func(array($this->module, 'right_right')))){
|
||||||
|
if($this->css != null){
|
||||||
|
return \call_user_func(array($this->module, 'src_css'));}
|
||||||
|
if($this->js != null){
|
||||||
|
return \call_user_func(array($this->module, 'src_js'));}
|
||||||
return \call_user_func(array($this->module, 'html_content'),array($this->post_get));}
|
return \call_user_func(array($this->module, 'html_content'),array($this->post_get));}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,19 @@ namespace SYSTEM\SAI;
|
|||||||
|
|
||||||
class default_page extends \SYSTEM\PAGE\Page {
|
class default_page extends \SYSTEM\PAGE\Page {
|
||||||
|
|
||||||
private function menu(){
|
private function menu_sys(){
|
||||||
|
$result = '';
|
||||||
|
|
||||||
|
$mods = \SYSTEM\SAI\sai::getInstance()->getSysModules();
|
||||||
|
foreach($mods as $mod){
|
||||||
|
if(\call_user_func(array($mod, 'right_public')) ||
|
||||||
|
\call_user_func(array($mod, 'right_right'))){
|
||||||
|
$result .= \call_user_func(array($mod, 'html_li_menu'));}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function menu_proj(){
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
|
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
|
||||||
@ -13,7 +25,7 @@ class default_page extends \SYSTEM\PAGE\Page {
|
|||||||
\call_user_func(array($mod, 'right_right'))){
|
\call_user_func(array($mod, 'right_right'))){
|
||||||
$result .= \call_user_func(array($mod, 'html_li_menu'));}
|
$result .= \call_user_func(array($mod, 'html_li_menu'));}
|
||||||
}
|
}
|
||||||
return $result.'</ul>';
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function css(){
|
private function css(){
|
||||||
@ -23,11 +35,9 @@ class default_page extends \SYSTEM\PAGE\Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function js(){
|
private function js(){
|
||||||
//if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\system::getSystemDBInfo() , \SYSTEM\SECURITY\RIGHTS::SYS_SAI)){
|
|
||||||
// $login = new \SYSTEM\SAI\login_page();
|
|
||||||
// return $login->html();}
|
|
||||||
$result = '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/libs/jquery.min.js').'" type="text/javascript"></script>'.
|
$result = '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/libs/jquery.min.js').'" type="text/javascript"></script>'.
|
||||||
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>'.
|
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>'.
|
||||||
|
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/loadcssjs.js').'" type="text/javascript"></script>'.
|
||||||
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/index.js').'" type="text/javascript"></script>';
|
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/js/index.js').'" type="text/javascript"></script>';
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -38,14 +48,10 @@ class default_page extends \SYSTEM\PAGE\Page {
|
|||||||
$vars['css'] = $this->css();
|
$vars['css'] = $this->css();
|
||||||
$vars['js'] = $this->js();
|
$vars['js'] = $this->js();
|
||||||
|
|
||||||
$vars['menu'] = $this->menu();
|
$vars['menu_sys'] = $this->menu_sys();
|
||||||
|
$vars['menu_proj'] = $this->menu_proj();
|
||||||
$vars['navimg'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG);
|
$vars['navimg'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG);
|
||||||
|
|
||||||
|
|
||||||
//$vars['PATH_IMG'] = SYSTEM\WEBPATH(new PPAGE(),'default_developer/img/');
|
|
||||||
//$vars['PATH_LIB'] = SYSTEM\WEBPATH(new PLIB());
|
|
||||||
//$vars['PATH_JS'] = SYSTEM\WEBPATH(new PJS());
|
|
||||||
//$vars = array_merge($vars, SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_DASENSE));
|
|
||||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'page/default_page/sai.tpl'), $vars);
|
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'page/default_page/sai.tpl'), $vars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,34 +3,41 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
// initialize content
|
// initialize content
|
||||||
$('div#content-wrapper').load('./?action=developer&sai_mod=.SYSTEM.SAI.saimod_sys_sai', function() {
|
loadModuleContent('.SYSTEM.SAI.saimod_sys_sai');
|
||||||
$('.carousel').carousel();
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
//load content -> menu
|
||||||
* generic navigation control
|
$('#sai_navbar ul li a, #project_navbar ul li a').click(function () {
|
||||||
*/
|
var id = $(this).attr("id");
|
||||||
$('div#developer-navbar ul#developer-nav li a').click(function () {
|
|
||||||
var id = $(this).attr("id");
|
|
||||||
if(id !== undefined){
|
if(id !== undefined){
|
||||||
console.log("Module: "+id);
|
console.log("Module: "+id);
|
||||||
|
|
||||||
$('div#developer-navbar ul#developer-nav li').each(function(){
|
$('#sai_navbar li, #project_navbar li').each(function(){
|
||||||
$(this).removeClass('active');
|
$(this).removeClass('active');});
|
||||||
});
|
|
||||||
$(this).parent().addClass('active');
|
$(this).parent().addClass('active');
|
||||||
|
|
||||||
loadModuleContent(id);
|
loadModuleContent(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.brand').click(function(){
|
$('.brand').click(function(){
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadModuleContent(id){
|
function loadModuleContent(id){
|
||||||
$('div#content-wrapper').load('./?action=developer&sai_mod='+id, function(){
|
$('div#content-wrapper').load('./?action=developer&sai_mod='+id, function(){});
|
||||||
init();
|
|
||||||
|
$.getJSON('./?action=developer&sai_mod='+id+'&css=1', function (data) {
|
||||||
|
if(data){
|
||||||
|
for(var i=0; i < data['result'].length; i++){
|
||||||
|
loadCSS(data['result'][i]);}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$.getJSON('./?action=developer&sai_mod='+id+'&js=1', function (data) {
|
||||||
|
if(data){
|
||||||
|
for(var i=0; i < data['result'].length; i++){
|
||||||
|
loadJS(unescape(data['result'][i]));}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
18
sai/page/default_page/js/loadcssjs.js
Normal file
18
sai/page/default_page/js/loadcssjs.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
function loadJS(jssrc) {
|
||||||
|
if(jssrc){
|
||||||
|
var snode = document.createElement('script');
|
||||||
|
snode.setAttribute('type','text/javascript');
|
||||||
|
snode.setAttribute('src',jssrc);
|
||||||
|
document.getElementsByTagName('head')[0].appendChild(snode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadCSS(csssrc) {
|
||||||
|
if(csssrc){
|
||||||
|
var snode = document.createElement('link');
|
||||||
|
snode.setAttribute('type','text/css');
|
||||||
|
snode.setAttribute('rel', 'stylesheet');
|
||||||
|
snode.setAttribute('href',csssrc);
|
||||||
|
document.getElementsByTagName('head')[0].appendChild(snode);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,18 +10,26 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="developer-navbar" class="navbar">
|
<div id="sai_navbar" class="navbar">
|
||||||
<div class="navbar-inner">
|
<div class="navbar-inner">
|
||||||
<div class="brand-logo">
|
<div class="brand-logo">
|
||||||
<img src="${navimg}" height="24" width="24">
|
<img src="${navimg}" height="24" width="24">
|
||||||
</div>
|
</div>
|
||||||
<a class="brand" href="#">developer</a>
|
<a class="brand" href="#">developer</a>
|
||||||
<ul id="developer-nav" class="nav">
|
<ul class="nav">
|
||||||
${menu}
|
${menu_sys}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="project_navbar" style="width:150px;float:left;">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<ul class="nav nav-list">
|
||||||
|
${menu_proj}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div id="content-wrapper"></div>
|
<div id="content-wrapper"></div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@ -13,5 +13,11 @@ abstract class SaiModule {
|
|||||||
//check your rights here -> returns true or false
|
//check your rights here -> returns true or false
|
||||||
public static function right_right(){
|
public static function right_right(){
|
||||||
throw new RuntimeException("Unimplemented!");}
|
throw new RuntimeException("Unimplemented!");}
|
||||||
|
//array with paths as json
|
||||||
|
public static function src_js(){
|
||||||
|
throw new RuntimeException("Unimplemented!");}
|
||||||
|
//array with paths as json
|
||||||
|
public static function src_css(){
|
||||||
|
throw new RuntimeException("Unimplemented!");}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -5,6 +5,7 @@ namespace SYSTEM\SAI;
|
|||||||
class sai {
|
class sai {
|
||||||
|
|
||||||
private $modules = array(); //only strings!
|
private $modules = array(); //only strings!
|
||||||
|
private $modules_sys = array(); //only strings!
|
||||||
|
|
||||||
//SINGLETON!
|
//SINGLETON!
|
||||||
static private $instance = null;
|
static private $instance = null;
|
||||||
@ -16,13 +17,23 @@ class sai {
|
|||||||
private function __construct(){}
|
private function __construct(){}
|
||||||
private function __clone(){}
|
private function __clone(){}
|
||||||
|
|
||||||
public function register($module){
|
public function register($module){
|
||||||
if( !\class_exists($module) ||
|
if( !\class_exists($module) ||
|
||||||
!\is_array($parents = \class_parents($module)) ||
|
!\is_array($parents = \class_parents($module)) ||
|
||||||
!\array_search('SYSTEM\SAI\SaiModule', $parents)){
|
!\array_search('SYSTEM\SAI\SaiModule', $parents)){
|
||||||
throw new \Exception('Problem with your Sysmodule class: '.$module);}
|
throw new \Exception('Problem with your Sysmodule class: '.$module);}
|
||||||
$this->modules[] = $module;}
|
$this->modules[] = $module;}
|
||||||
|
public function register_sys($module){
|
||||||
|
if( !\class_exists($module) ||
|
||||||
|
!\is_array($parents = \class_parents($module)) ||
|
||||||
|
!\array_search('SYSTEM\SAI\SaiModule', $parents)){
|
||||||
|
throw new \Exception('Problem with your Sysmodule class: '.$module);}
|
||||||
|
$this->modules_sys[] = $module;}
|
||||||
|
|
||||||
public function getModules(){
|
public function getModules(){
|
||||||
return $this->modules;}
|
return $this->modules;}
|
||||||
|
public function getSysModules(){
|
||||||
|
return $this->modules_sys;}
|
||||||
|
public function getAllModules(){
|
||||||
|
return array_merge($this->modules_sys,$this->modules);}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user