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('
'); -// element.html('
'); $.get(url, function(data) { element.html(data); + $(".chzn-select").chosen(); }); }); $("body").on("click", ".ajax-click", function() { diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 4618fda09..22a240b63 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -2214,5 +2214,27 @@ mayscript> $value) { + $used = (int) ($value/$max*100.0+0.5); + $free = 100-$used; + } else { + $free = 0; + $used = 100; + } + $html = ' +
+
+
+
'; + return $html; + } /* }}} */ } ?> diff --git a/views/bootstrap/class.UserList.php b/views/bootstrap/class.UserList.php index 91c3a8e2c..0c41130b6 100644 --- a/views/bootstrap/class.UserList.php +++ b/views/bootstrap/class.UserList.php @@ -76,27 +76,10 @@ class SeedDMS_View_UserList extends SeedDMS_Bootstrap_Style { echo ""; echo SeedDMS_Core_File::format_filesize($currUser->getUsedDiskSpace()); if($quota) { - $qt = $currUser->getQuota(); - if($qt == 0) - $qt = $quota; - if($qt > $currUser->getUsedDiskSpace()) { - $used = (int) ($currUser->getUsedDiskSpace()/$qt*100.0+0.5); - $free = 100-$used; - } else { - $free = 0; - $used = 100; - } echo " / "; - if($currUser->getQuota() != 0) - echo SeedDMS_Core_File::format_filesize($currUser->getQuota())."
"; - else - echo SeedDMS_Core_File::format_filesize($quota)."
"; -?> -
-
-
-
-getQuota() ? $currUser->getQuota() : $quota; + echo SeedDMS_Core_File::format_filesize($qt)."
"; + echo $this->getProgressBar($currUser->getUsedDiskSpace(), $qt); } echo ""; echo ""; diff --git a/views/bootstrap/class.UsrMgr.php b/views/bootstrap/class.UsrMgr.php index 102fe288c..f867e46b4 100644 --- a/views/bootstrap/class.UsrMgr.php +++ b/views/bootstrap/class.UsrMgr.php @@ -31,6 +31,30 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_UsrMgr extends SeedDMS_Bootstrap_Style { + function info() { /* {{{ */ + $dms = $this->params['dms']; + $seluser = $this->params['seluser']; + $quota = $this->params['quota']; + + $sessionmgr = new SeedDMS_SessionMgr($dms->getDB()); + + $this->contentHeading(getMLText("user_info")); + echo "\n"; + echo "\n"; + $documents = $seluser->getDocuments(); + echo "\n"; + $sessions = $sessionmgr->getUserSessions($seluser); + if($sessions) { + $session = array_shift($sessions); + echo "\n"; + } + echo "
".getMLText('discspace').""; + $qt = $seluser->getQuota() ? $seluser->getQuota() : $quota; + echo SeedDMS_Core_File::format_filesize($seluser->getUsedDiskSpace())." / ".SeedDMS_Core_File::format_filesize($qt)."
"; + echo $this->getProgressBar($seluser->getUsedDiskSpace(), $qt); + echo "
".getMLText('documents')."".count($documents)."
".getMLText('lastaccess')."".getLongReadableDate($session->getLastAccess())."
"; + } /* }}} */ + function form() { /* {{{ */ $seluser = $this->params['seluser']; @@ -448,11 +472,12 @@ function showUser(selectObj) { ?>
+
-
+