diff --git a/inc/inc.ClassViewCommon.php b/inc/inc.ClassViewCommon.php index 29b3ea03a..8a885e81c 100644 --- a/inc/inc.ClassViewCommon.php +++ b/inc/inc.ClassViewCommon.php @@ -25,17 +25,26 @@ * @version Release: @package_version@ */ class SeedDMS_View_Common { - var $theme; + protected $theme; - var $params; - -// var $settings; + protected $params; function __construct($params, $theme='blue') { $this->theme = $theme; $this->params = $params; } + function __invoke($get=array()) { + if(isset($get['action']) && $get['action']) { + if(method_exists($this, $get['action'])) { + $this->{$get['action']}(); + } else { + echo "Missing action '".$get['action']."'"; + } + } else + $this->show(); + } + function setParams($params) { $this->params = $params; } @@ -49,12 +58,6 @@ class SeedDMS_View_Common { unset($this->params[$name]); } -/* - function setConfiguration($conf) { - $this->settings = $conf; - } -*/ - function show() { } diff --git a/out/out.UsrMgr.php b/out/out.UsrMgr.php index 6886b2aff..e8fc46e81 100644 --- a/out/out.UsrMgr.php +++ b/out/out.UsrMgr.php @@ -49,14 +49,7 @@ if(isset($_GET['userid']) && $_GET['userid']) { $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'seluser'=>$seluser, 'allusers'=>$users, 'allgroups'=>$groups, 'passwordstrength'=>$settings->_passwordStrength, 'passwordexpiration'=>$settings->_passwordExpiration, 'httproot'=>$settings->_httpRoot, 'enableuserimage'=>$settings->_enableUserImage, 'undeluserids'=>explode(',', $settings->_undelUserIds), 'workflowmode'=>$settings->_workflowMode, 'quota'=>$settings->_quota)); if($view) { - if(isset($_GET['action']) && $_GET['action']) { - if(method_exists($view, $_GET['action'])) { - $view->{$_GET['action']}(); - exit; - } - } - $view->show(); - exit; + $view($_GET); } ?> diff --git a/styles/bootstrap/application.js b/styles/bootstrap/application.js index a12886dcb..3cab1670e 100644 --- a/styles/bootstrap/application.js +++ b/styles/bootstrap/application.js @@ -421,15 +421,30 @@ $(document).ready( function() { $('div.ajax').each(function(index) { var element = $(this); - var url = element.data('href'); - console.log('Calling '+url); + var url = ''; + var href = element.data('href'); + var view = element.data('view'); + var action = element.data('action'); + if(view && action) + url = "out."+view+".php?action="+action; + else + url = href; + // console.log('Calling '+url); $.get(url, function(data) { element.html(data); + $(".chzn-select").chosen(); }); }); $('div.ajax').on('update', function(event, param1) { var element = $(this); - var url = element.data('href'); + var url = ''; + var href = element.data('href'); + var view = element.data('view'); + var action = element.data('action'); + if(view && action) + url = "out."+view+".php?action="+action; + else + url = href; if(typeof param1 === 'object') { for(var key in param1) { url += "&"+key+"="+param1[key]; @@ -437,11 +452,11 @@ $(document).ready( function() { } else { url += "&"+param1; } - console.log("Calling: "+url); + // console.log("Calling: "+url); element.prepend('