From 8053aa658bcf33655b7194428f3484890246ae87 Mon Sep 17 00:00:00 2001 From: cdujeu Date: Wed, 30 Jul 2014 17:20:06 +0200 Subject: [PATCH] New method load_repository_info to feed the home page blocks --- core/src/core/classes/class.AJXP_Utils.php | 12 +++- core/src/core/classes/class.AuthService.php | 4 +- .../class.UserDashboardHome.js | 57 ++++++++++++++++++- core/src/plugins/access.ajxp_home/home.css | 42 +++++++++++++- .../boot.conf/class.BootConfLoader.php | 5 +- .../conf.serial/class.serialConfDriver.php | 9 ++- .../plugins/conf.sql/class.sqlConfDriver.php | 46 +++++++++++++-- core/src/plugins/core.ajaxplorer/i18n/ca.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/cs.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/da.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/de.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/en.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/es.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/et.php | 6 +- core/src/plugins/core.ajaxplorer/i18n/eus.php | 6 +- core/src/plugins/core.ajaxplorer/i18n/fi.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/fr.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/gr.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/he.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/hu.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/it.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/ja.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/kr.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/nl.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/no.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/pl.php | 5 ++ .../plugins/core.ajaxplorer/i18n/pt-br.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/pt.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/ru.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/si.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/sv.php | 6 +- core/src/plugins/core.ajaxplorer/i18n/tr.php | 5 ++ .../plugins/core.ajaxplorer/i18n/zh-tw.php | 5 ++ core/src/plugins/core.ajaxplorer/i18n/zh.php | 5 ++ .../core.conf/class.AbstractConfDriver.php | 18 +++++- .../core.conf/standard_conf_actions.xml | 29 ++++++++++ .../class.AJXP_NotificationCenter.php | 26 ++++++++- .../plugins/core.notifications/manifest.xml | 1 + .../meta.quota/class.QuotaComputer.php | 7 +++ core/src/plugins/meta.quota/i18n/en.php | 3 +- core/src/plugins/meta.quota/i18n/fr.php | 1 + core/src/plugins/meta.quota/i18n/pt.php | 1 + core/src/plugins/meta.quota/manifest.xml | 33 ++++++++++- 43 files changed, 401 insertions(+), 31 deletions(-) diff --git a/core/src/core/classes/class.AJXP_Utils.php b/core/src/core/classes/class.AJXP_Utils.php index 953343a458..f7f7c8f812 100644 --- a/core/src/core/classes/class.AJXP_Utils.php +++ b/core/src/core/classes/class.AJXP_Utils.php @@ -718,8 +718,9 @@ public static function convertBytes($value) //Relative Date Function - public static function relativeDate($time, $messages) + public static function relativeDate($time, $messages, $shortestForm = false) { + $crtYear = date('Y'); $today = strtotime(date('M j, Y')); $reldays = ($time - $today)/86400; $relTime = date($messages['date_relative_time_format'], $time); @@ -746,7 +747,14 @@ public static function relativeDate($time, $messages) } - return str_replace("DATE", date($messages["date_relative_date_format"], $time ? $time : time()), $messages["date_relative_date"]); + $finalDate = date($messages["date_relative_date_format"], $time ? $time : time()); + if(!$shortestForm || strpos($finalDate, $crtYear) !== false){ + $finalDate = str_replace($crtYear, '', $finalDate); + return str_replace("DATE", $finalDate, $messages["date_relative_date"]); + }else{ + return $finalDate = date("M Y", $time ? $time : time()); + } + //return str_replace("DATE", $finalDate, $messages["date_relative_date"]); } diff --git a/core/src/core/classes/class.AuthService.php b/core/src/core/classes/class.AuthService.php index 4945b17e83..aebdf758ea 100644 --- a/core/src/core/classes/class.AuthService.php +++ b/core/src/core/classes/class.AuthService.php @@ -898,9 +898,9 @@ public static function getUsersForRepository($repositoryId) return ConfService::getConfStorageImpl()->getUsersForRepository($repositoryId); } - public static function countUsersForRepository($repositoryId) + public static function countUsersForRepository($repositoryId, $details = false) { - return ConfService::getConfStorageImpl()->countUsersForRepository($repositoryId); + return ConfService::getConfStorageImpl()->countUsersForRepository($repositoryId, $details); } /** diff --git a/core/src/plugins/access.ajxp_home/class.UserDashboardHome.js b/core/src/plugins/access.ajxp_home/class.UserDashboardHome.js index 3c6a915bc1..c678a3e561 100644 --- a/core/src/plugins/access.ajxp_home/class.UserDashboardHome.js +++ b/core/src/plugins/access.ajxp_home/class.UserDashboardHome.js @@ -21,11 +21,14 @@ Class.create("UserDashboardHome", AjxpPane, { _formManager: null, + _repoInfos: null, + _repoInfosLoading:null, initialize: function($super, oFormObject, editorOptions){ $super(oFormObject, editorOptions); - + this._repoInfos = $H(); + this._repoInfosLoading = $H(); var dashLogo = ajaxplorer.getPluginConfigs("guidriver").get("CUSTOM_DASH_LOGO"); if(dashLogo){ var url; @@ -60,6 +63,27 @@ Class.create("UserDashboardHome", AjxpPane, { ajaxplorer.triggerRepositoryChange(repoId); }; + var updateRepoInfo = function(block, repoId){ + var data = this._repoInfos.get(repoId); + var blocks = 0; + if(data['core.users'] && data['core.users']['internal'] != undefined && data['core.users']['external'] != undefined){ + blocks++; + block.insert('
'+MessageHash[527]+'
'+MessageHash[531]+' ' + data['core.users']['internal'] + '
'+MessageHash[532]+' ' + data['core.users']['external']+"
"); + } + if(data['meta.quota']){ + blocks++; + block.insert('
'+MessageHash['meta.quota.4']+'
' + parseInt(100*data['meta.quota']['usage']/data['meta.quota']['total']) + '%
' + roundSize(data['meta.quota']['total'], MessageHash["byte_unit_symbol"]) +"
"); + } + if(data['core.notifications'] && data['core.notifications'][0]){ + var date = data['core.notifications'][0]['short_date']; + blocks++; + block.insert('
'+MessageHash[4]+'
' + date + "
"); + } + if(!blocks){ + block.previous('small').addClassName('show_description'); + } + }.bind(this); + var updateWsLegend = function(repoObject){ var legendBlock = this.htmlElement.down('#ws_legend'); if(!repoObject && this.htmlElement.down('#go_to_ws').CURRENT_REPO_OBJECT){ @@ -73,16 +97,43 @@ Class.create("UserDashboardHome", AjxpPane, { this.timer = window.setTimeout(function(){ if(! legendBlock.up('#home_center_panel') ) return; legendBlock.update(''); + legendBlock.writeAttribute("data-repoId", ""); legendBlock.up('#home_center_panel').removeClassName('legend_visible'); }, 3500); return; } - legendBlock.update(repoObject.getLabel() + '' + repoObject.getDescription() + ''); + var repoId = repoObject.getId(); + legendBlock.writeAttribute("data-repoId", repoId); + legendBlock.update(repoObject.getLabel() + '' + repoObject.getDescription() + '
'); legendBlock.insert(''+MessageHash['user_home.42']+''); legendBlock.down('a').observe('click', function(){ - switchToRepo(repoObject.getId()); + switchToRepo(repoId); }); legendBlock.up('#home_center_panel').addClassName('legend_visible'); + if(!this._repoInfosLoading.get(repoId) && !this._repoInfos.get(repoId)){ + var conn = new Connexion(); + this._repoInfosLoading.set(repoId, 'loading'); + conn.setParameters({ + get_action:'load_repository_info', + tmp_repository_id:repoObject.getId(), + collect:'true' + }); + conn.onComplete = function(transport){ + this._repoInfosLoading.unset(repoId); + if(transport.responseJSON){ + var data = transport.responseJSON; + this._repoInfos.set(repoId, data); + if(legendBlock.readAttribute("data-repoId") == repoId){ + updateRepoInfo(legendBlock.down(".repoInfo"), repoId); + }else{ + + } + } + }.bind(this); + conn.sendAsync(); + }else if(this._repoInfos.get(repoId)){ + updateRepoInfo(legendBlock.down(".repoInfo"), repoId); + } }.bind(this); var renderElement = function(repoObject){ diff --git a/core/src/plugins/access.ajxp_home/home.css b/core/src/plugins/access.ajxp_home/home.css index 350fa44c54..3ce45022a9 100644 --- a/core/src/plugins/access.ajxp_home/home.css +++ b/core/src/plugins/access.ajxp_home/home.css @@ -32,6 +32,37 @@ float: left; } +.repoInfoBadge { + display: inline-block; + font-size: 30px; + width: 190px; + line-height: 30px; + border: 1px solid rgba(255,255,255,0.7); + border-radius: 8px; + margin: 10px 16px; + height: 116px; + font-family: "Open sans Regular", Arial, sans-serif; + vertical-align: top; + padding: 3px 8px; + text-align: left; +} + +.repoInfoTitle { + text-transform: uppercase; + font-family: "Open sans Light", Arial, sans-serif; + font-size: 18px; + text-align: center; + margin-bottom: 9px; +} + +.repoInfoBadge span { + display: block; + font-size: 50px; + float: left; + margin: 6px 16px 0 14px; + opacity: 0.9; +} + #home_account_pane #close-icon{ position: absolute; margin-left: 2px; @@ -181,9 +212,16 @@ div.legend_visible div#logo_div{ margin: 0 20px; } -#home_account_pane div#ws_legend small{ +#home_account_pane div#ws_legend > small { display: block; - font-size: 0.7em; + font-size: 0.6em; + line-height: 1em; + visibility: hidden; +} + +#home_account_pane div#ws_legend > small.show_description { + line-height: 1.9em; + visibility: visible; } #home_account_pane div#ws_legend a{ diff --git a/core/src/plugins/boot.conf/class.BootConfLoader.php b/core/src/plugins/boot.conf/class.BootConfLoader.php index a5e25a64c4..e47660b6e5 100644 --- a/core/src/plugins/boot.conf/class.BootConfLoader.php +++ b/core/src/plugins/boot.conf/class.BootConfLoader.php @@ -618,9 +618,10 @@ public function getUsersForRepository($repositoryId) /** * @param string $repositoryId - * @return array('INTERNAL' => count, 'SHARED' => count) + * @param boolean $details + * @return array('internal' => count, 'external' => count) */ - public function countUsersForRepository($repositoryId){ + public function countUsersForRepository($repositoryId, $details = false){ } diff --git a/core/src/plugins/conf.serial/class.serialConfDriver.php b/core/src/plugins/conf.serial/class.serialConfDriver.php index 65cbc18dae..045c6154e7 100644 --- a/core/src/plugins/conf.serial/class.serialConfDriver.php +++ b/core/src/plugins/conf.serial/class.serialConfDriver.php @@ -371,10 +371,13 @@ public function getUsersForRepository($repositoryId) /** * @param string $repositoryId - * @return array('INTERNAL' => count, 'SHARED' => count) + * @param boolean $details + * @return array('internal' => count, 'external' => count) */ - public function countUsersForRepository($repositoryId){ - return count($this->getUsersForRepository($repositoryId)); + public function countUsersForRepository($repositoryId, $details = false){ + $c = count($this->getUsersForRepository($repositoryId)); + if($details) return array("internal" => $c); + else return $c; } diff --git a/core/src/plugins/conf.sql/class.sqlConfDriver.php b/core/src/plugins/conf.sql/class.sqlConfDriver.php index 73491260d6..e7153891fb 100644 --- a/core/src/plugins/conf.sql/class.sqlConfDriver.php +++ b/core/src/plugins/conf.sql/class.sqlConfDriver.php @@ -510,24 +510,58 @@ public function getUsersForRepository($repositoryId) /** * @param string $repositoryId - * @return Integer + * @param boolean $details + * @return Integer|Array */ - public function countUsersForRepository($repositoryId){ + public function countUsersForRepository($repositoryId, $details = false){ + $object = ConfService::getRepositoryById($repositoryId); + if($object->securityScope() == "USER"){ + if($details) return array('internal' => 1); + else return 1; + }else if($object->securityScope() == "GROUP"){ + // Count users from current group + $groupUsers = AuthService::authCountUsers(AuthService::getLoggedUser()->getGroupPath()); + if($details) return array('internal' => $groupUsers); + else return $groupUsers; + } // NEW METHOD : SEARCH PERSONAL ROLE + if(is_numeric($repositoryId)){ + $likeValue = "i:$repositoryId;s:"; + }else{ + $likeValue = '"'.$repositoryId.'";s:'; + } switch ($this->sqlDriver["driver"]) { case "sqlite": case "sqlite3": case "postgre": - $res = dibi::query('SELECT count([role_id]) FROM [ajxp_roles] WHERE [searchable_repositories] LIKE %~like~', '"'.$repositoryId.'";s:'); + $q = 'SELECT count([role_id]) FROM [ajxp_roles] WHERE [role_id] LIKE \'AJXP_USR_/%\' AND [searchable_repositories] LIKE %~like~'; break; case "mysql": - $res = dibi::query('SELECT count([role_id]) as c FROM [ajxp_roles] WHERE [serial_role] LIKE %~like~', '"'.$repositoryId.'";s:'); + $q = 'SELECT count([role_id]) as c FROM [ajxp_roles] WHERE [role_id] LIKE \'AJXP_USR_/%\' AND [serial_role] LIKE %~like~'; break; default: return "ERROR!, DB driver "+ $this->sqlDriver["driver"] +" not supported yet in __FUNCTION__"; } - $all = $res->fetchAll(); - return intval($all[0]['c']); + if($details){ + if($this->sqlDriver["driver"] == "sqlite" || $this->sqlDriver["driver"] == "sqlite3"){ + $internalClause = " AND NOT EXISTS (SELECT * FROM [ajxp_user_rights] WHERE [ajxp_roles].[role_id]='AJXP_USR_/'||[ajxp_user_rights].[login] AND [ajxp_user_rights].[repo_uuid] = 'ajxp.parent_user')"; + $externalClause = " AND EXISTS (SELECT * FROM [ajxp_user_rights] WHERE [ajxp_roles].[role_id]='AJXP_USR_/'||[ajxp_user_rights].[login] AND [ajxp_user_rights].[repo_uuid] = 'ajxp.parent_user')"; + }else{ + $internalClause = " AND NOT EXISTS (SELECT * FROM [ajxp_user_rights] WHERE [ajxp_roles].[role_id]=CONCAT('AJXP_USR_/',[ajxp_user_rights].[login]) AND [ajxp_user_rights].[repo_uuid] = 'ajxp.parent_user')"; + $externalClause = " AND EXISTS (SELECT * FROM [ajxp_user_rights] WHERE [ajxp_roles].[role_id]=CONCAT('AJXP_USR_/',[ajxp_user_rights].[login]) AND [ajxp_user_rights].[repo_uuid] = 'ajxp.parent_user')"; + } + $intRes = dibi::query($q.$internalClause, $likeValue); + $extRes = dibi::query($q.$externalClause, $likeValue); + return array( + 'internal' => $intRes->fetchSingle(), + 'external' => $extRes->fetchSingle() + ); + }else{ + $res = dibi::query($q, $likeValue); + return $res->fetchSingle(); + + } + //$all = $res->fetchAll(); } diff --git a/core/src/plugins/core.ajaxplorer/i18n/ca.php b/core/src/plugins/core.ajaxplorer/i18n/ca.php index 4f6e726034..6e89e10939 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/ca.php +++ b/core/src/plugins/core.ajaxplorer/i18n/ca.php @@ -582,5 +582,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/cs.php b/core/src/plugins/core.ajaxplorer/i18n/cs.php index ab9a65e634..cc436fe629 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/cs.php +++ b/core/src/plugins/core.ajaxplorer/i18n/cs.php @@ -580,5 +580,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/da.php b/core/src/plugins/core.ajaxplorer/i18n/da.php index 0768277199..3f8e1fc6c5 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/da.php +++ b/core/src/plugins/core.ajaxplorer/i18n/da.php @@ -585,5 +585,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/de.php b/core/src/plugins/core.ajaxplorer/i18n/de.php index 6cf64a424e..b804c36662 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/de.php +++ b/core/src/plugins/core.ajaxplorer/i18n/de.php @@ -594,5 +594,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/en.php b/core/src/plugins/core.ajaxplorer/i18n/en.php index a1bcd269b5..46b8ce8da7 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/en.php +++ b/core/src/plugins/core.ajaxplorer/i18n/en.php @@ -582,4 +582,9 @@ "524"=> "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", +"527"=> "Shared with", +"528"=> "Internal users", +"530"=> "External users", +"531"=> "Int.", +"532"=> "Ext.", ); diff --git a/core/src/plugins/core.ajaxplorer/i18n/es.php b/core/src/plugins/core.ajaxplorer/i18n/es.php index 9b3ffbd406..5eb68d0cdf 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/es.php +++ b/core/src/plugins/core.ajaxplorer/i18n/es.php @@ -586,5 +586,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/et.php b/core/src/plugins/core.ajaxplorer/i18n/et.php index cfa76dc4a1..63cc89ebfa 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/et.php +++ b/core/src/plugins/core.ajaxplorer/i18n/et.php @@ -583,6 +583,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", - + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/eus.php b/core/src/plugins/core.ajaxplorer/i18n/eus.php index dd044e4f27..a58d6639ea 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/eus.php +++ b/core/src/plugins/core.ajaxplorer/i18n/eus.php @@ -581,6 +581,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", - /* END SENTENCE */ + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/fi.php b/core/src/plugins/core.ajaxplorer/i18n/fi.php index 142e3be9c6..266d995c3f 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/fi.php +++ b/core/src/plugins/core.ajaxplorer/i18n/fi.php @@ -583,5 +583,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/fr.php b/core/src/plugins/core.ajaxplorer/i18n/fr.php index 96edee70ab..8ad2d47d01 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/fr.php +++ b/core/src/plugins/core.ajaxplorer/i18n/fr.php @@ -582,5 +582,10 @@ "524"=> "Nouveau mot de passe", "525"=> "Voir la photo originale", "526"=> "Version basse-résolution", +"527"=> "Partagé", +"528"=> "Utilisateurs internes", +"530"=> "Utilisateurs externes", +"531"=> "Int.", +"532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/gr.php b/core/src/plugins/core.ajaxplorer/i18n/gr.php index a27daf593e..bed70f810e 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/gr.php +++ b/core/src/plugins/core.ajaxplorer/i18n/gr.php @@ -580,5 +580,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/he.php b/core/src/plugins/core.ajaxplorer/i18n/he.php index 53af45d34c..e770072ce1 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/he.php +++ b/core/src/plugins/core.ajaxplorer/i18n/he.php @@ -580,5 +580,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/hu.php b/core/src/plugins/core.ajaxplorer/i18n/hu.php index 863eefbe4e..6b6e16231d 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/hu.php +++ b/core/src/plugins/core.ajaxplorer/i18n/hu.php @@ -585,5 +585,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/it.php b/core/src/plugins/core.ajaxplorer/i18n/it.php index 8ea5e1a201..a06ea81b53 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/it.php +++ b/core/src/plugins/core.ajaxplorer/i18n/it.php @@ -600,5 +600,10 @@ "524" => "Aggiorna Password", "525" => "Mostra immagine originale", "526" => "Versione a bassa risoluzione", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); diff --git a/core/src/plugins/core.ajaxplorer/i18n/ja.php b/core/src/plugins/core.ajaxplorer/i18n/ja.php index de4f4adda1..2b90776896 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/ja.php +++ b/core/src/plugins/core.ajaxplorer/i18n/ja.php @@ -585,6 +585,11 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* 文章はここまで */ /* 文章終了 */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/kr.php b/core/src/plugins/core.ajaxplorer/i18n/kr.php index 3565e3842f..3255272580 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/kr.php +++ b/core/src/plugins/core.ajaxplorer/i18n/kr.php @@ -589,5 +589,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/nl.php b/core/src/plugins/core.ajaxplorer/i18n/nl.php index 81496ab39b..42b4706cbf 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/nl.php +++ b/core/src/plugins/core.ajaxplorer/i18n/nl.php @@ -586,5 +586,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/no.php b/core/src/plugins/core.ajaxplorer/i18n/no.php index 9f534dafa9..412f6c9ef6 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/no.php +++ b/core/src/plugins/core.ajaxplorer/i18n/no.php @@ -584,5 +584,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/pl.php b/core/src/plugins/core.ajaxplorer/i18n/pl.php index 0bc92e1390..f59168117c 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/pl.php +++ b/core/src/plugins/core.ajaxplorer/i18n/pl.php @@ -580,5 +580,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/pt-br.php b/core/src/plugins/core.ajaxplorer/i18n/pt-br.php index 73ba3d756d..9974d41b6a 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/pt-br.php +++ b/core/src/plugins/core.ajaxplorer/i18n/pt-br.php @@ -584,5 +584,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/pt.php b/core/src/plugins/core.ajaxplorer/i18n/pt.php index d7b9241008..b57d93d511 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/pt.php +++ b/core/src/plugins/core.ajaxplorer/i18n/pt.php @@ -580,6 +580,11 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ /* password strength tester */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/ru.php b/core/src/plugins/core.ajaxplorer/i18n/ru.php index c22adc0df6..c46e1c634e 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/ru.php +++ b/core/src/plugins/core.ajaxplorer/i18n/ru.php @@ -580,5 +580,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/si.php b/core/src/plugins/core.ajaxplorer/i18n/si.php index 11844716e2..7b65a3fcf8 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/si.php +++ b/core/src/plugins/core.ajaxplorer/i18n/si.php @@ -581,6 +581,11 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ /* password strength tester */ /* quick access keys */ diff --git a/core/src/plugins/core.ajaxplorer/i18n/sv.php b/core/src/plugins/core.ajaxplorer/i18n/sv.php index b42b5c928c..f06b74a208 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/sv.php +++ b/core/src/plugins/core.ajaxplorer/i18n/sv.php @@ -580,6 +580,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", - + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/tr.php b/core/src/plugins/core.ajaxplorer/i18n/tr.php index 6d04deda0a..62175ca0b0 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/tr.php +++ b/core/src/plugins/core.ajaxplorer/i18n/tr.php @@ -583,5 +583,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/zh-tw.php b/core/src/plugins/core.ajaxplorer/i18n/zh-tw.php index ac8e4203be..9dbc9a5b38 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/zh-tw.php +++ b/core/src/plugins/core.ajaxplorer/i18n/zh-tw.php @@ -583,5 +583,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.ajaxplorer/i18n/zh.php b/core/src/plugins/core.ajaxplorer/i18n/zh.php index df7250e95a..33ce5f6fa0 100644 --- a/core/src/plugins/core.ajaxplorer/i18n/zh.php +++ b/core/src/plugins/core.ajaxplorer/i18n/zh.php @@ -592,5 +592,10 @@ "524" => "Update Password", "525"=> "Show original picture", "526"=> "Low-resolution version", + "527"=> "Shared with", + "528"=> "Internal users", + "530"=> "External users", + "531"=> "Int.", + "532"=> "Ext.", /* END SENTENCE */ ); \ No newline at end of file diff --git a/core/src/plugins/core.conf/class.AbstractConfDriver.php b/core/src/plugins/core.conf/class.AbstractConfDriver.php index 4adef5529d..b8fff26237 100644 --- a/core/src/plugins/core.conf/class.AbstractConfDriver.php +++ b/core/src/plugins/core.conf/class.AbstractConfDriver.php @@ -429,9 +429,10 @@ abstract public function getUsersForRepository($repositoryId); /** * @abstract * @param string $repositoryId - * @return Integer + * @param boolean $details + * @return Integer|Array */ - abstract public function countUsersForRepository($repositoryId); + abstract public function countUsersForRepository($repositoryId, $details = false); /** @@ -1102,6 +1103,19 @@ public function switchAction($action, $httpVars, $fileVars) break; + case "load_repository_info": + + $data = array(); + $users = AuthService::countUsersForRepository(ConfService::getRepository()->getId(), true); + $data["core.users"] = $users; + if(isSet($httpVars["collect"]) && $httpVars["collect"] == "true"){ + AJXP_Controller::applyHook("repository.load_info", array(&$data)); + } + HTMLWriter::charsetHeader("application/json"); + echo json_encode($data); + + break; + case "get_binary_param" : if (isSet($httpVars["tmp_file"])) { diff --git a/core/src/plugins/core.conf/standard_conf_actions.xml b/core/src/plugins/core.conf/standard_conf_actions.xml index 46fbc1e551..827458b8d4 100644 --- a/core/src/plugins/core.conf/standard_conf_actions.xml +++ b/core/src/plugins/core.conf/standard_conf_actions.xml @@ -19,6 +19,11 @@ + + + + + @@ -615,5 +620,29 @@ ]]> + + + + + + +
Shared With...
+
+ + + ]]> +
+
diff --git a/core/src/plugins/core.notifications/class.AJXP_NotificationCenter.php b/core/src/plugins/core.notifications/class.AJXP_NotificationCenter.php index 82ca210e49..f0434c2fdd 100755 --- a/core/src/plugins/core.notifications/class.AJXP_NotificationCenter.php +++ b/core/src/plugins/core.notifications/class.AJXP_NotificationCenter.php @@ -104,6 +104,19 @@ public function persistChangeHookToFeed(AJXP_Node $oldNode = null, AJXP_Node $ne } + public function loadRepositoryInfo(&$data){ + $f = $this->loadUserFeed("get_my_feed", array( + 'format' => 'array', + 'current_repository'=>true, + 'feed_type'=>'notif', + 'limit' => 1, + 'path'=>'/', + 'merge_description'=>true, + 'description_as_label'=>false + ), array()); + $data["core.notifications"] = $f; + } + public function loadUserFeed($actionName, $httpVars, $fileVars) { if(!$this->eventStore) return; @@ -144,7 +157,7 @@ public function loadUserFeed($actionName, $httpVars, $fileVars) echo("
    "); } else if($format == "json"){ $jsonNodes = array(); - } else { + } else if($format != 'array') { AJXP_XMLWriter::header(); } @@ -182,6 +195,7 @@ public function loadUserFeed($actionName, $httpVars, $fileVars) $node->event_description = ucfirst($notif->getDescriptionBlock()) . " ".$mess["notification.tpl.block.user_link"] ." ". $notif->getAuthorLabel(); $node->event_description_long = $notif->getDescriptionLong(true); $node->event_date = AJXP_Utils::relativeDate($notif->getDate(), $mess); + $node->short_date = AJXP_Utils::relativeDate($notif->getDate(), $mess, true); $node->event_time = $notif->getDate(); $node->event_type = "notification"; $node->event_id = $object->event_id; @@ -205,13 +219,17 @@ public function loadUserFeed($actionName, $httpVars, $fileVars) $url = parse_url($node->getUrl()); $node->setUrl($url["scheme"]."://".$url["host"]."/notification_".$index); $index ++; - if($format == "json"){ + if($format == "json" || $format == "array"){ $keys = $node->listMetaKeys(); $data = array(); foreach($keys as $k){ $data[$k] = $node->$k; } - $jsonNodes[] = json_encode($data); + if($format == "json"){ + $jsonNodes[] = json_encode($data); + }else{ + $jsonNodes[] = $data; + } }else{ AJXP_XMLWriter::renderAjxpNode($node); } @@ -223,6 +241,8 @@ public function loadUserFeed($actionName, $httpVars, $fileVars) } else if($format == "json"){ HTMLWriter::charsetHeader("application/json"); echo('[' . implode(",", $jsonNodes). ']'); + } else if($format == "array"){ + return $jsonNodes; } else { AJXP_XMLWriter::close(); } diff --git a/core/src/plugins/core.notifications/manifest.xml b/core/src/plugins/core.notifications/manifest.xml index 0badf07367..0a87d5b152 100644 --- a/core/src/plugins/core.notifications/manifest.xml +++ b/core/src/plugins/core.notifications/manifest.xml @@ -94,6 +94,7 @@ + diff --git a/core/src/plugins/meta.quota/class.QuotaComputer.php b/core/src/plugins/meta.quota/class.QuotaComputer.php index c0735a02da..d03f2cf052 100644 --- a/core/src/plugins/meta.quota/class.QuotaComputer.php +++ b/core/src/plugins/meta.quota/class.QuotaComputer.php @@ -128,6 +128,13 @@ public function getCurrentQuota($action, $httpVars, $fileVars) return; } + public function loadRepositoryInfo(&$data){ + $data['meta.quota'] = array( + 'usage' => $u = $this->getUsage($this->getWorkingPath()), + 'total' => $this->getAuthorized() + ); + } + public function recomputeQuotaUsage($oldNode = null, $newNode = null, $copy = false) { $path = $this->getWorkingPath(); diff --git a/core/src/plugins/meta.quota/i18n/en.php b/core/src/plugins/meta.quota/i18n/en.php index 1bd1ddde9a..eb7f543f53 100644 --- a/core/src/plugins/meta.quota/i18n/en.php +++ b/core/src/plugins/meta.quota/i18n/en.php @@ -19,7 +19,8 @@ * The latest code can be found at . */ $mess=array( -"1" => "Quota usage...", +"1" => "Quota usage (loading...)", "2" => "Click to reload quota usage", "3" => "You are exceeding your quota", +"4" => "Quota usage", ); diff --git a/core/src/plugins/meta.quota/i18n/fr.php b/core/src/plugins/meta.quota/i18n/fr.php index 73d2794901..e3d130f44a 100644 --- a/core/src/plugins/meta.quota/i18n/fr.php +++ b/core/src/plugins/meta.quota/i18n/fr.php @@ -22,4 +22,5 @@ "1" => "Quota (en cours...)", "2" => "Cliquer pour recharger l'utilisation du quota", "3" => "Vous dépassez votre quota", +"4" => "Espace utilisé", ); diff --git a/core/src/plugins/meta.quota/i18n/pt.php b/core/src/plugins/meta.quota/i18n/pt.php index bb9e67961d..b752f81bdb 100644 --- a/core/src/plugins/meta.quota/i18n/pt.php +++ b/core/src/plugins/meta.quota/i18n/pt.php @@ -22,4 +22,5 @@ "1" => "Uso da Quota...", "2" => "Clique aqui para recalcular a Quota", "3" => "Ultrapassou o Limite da sua Quota", +"4" => "Uso da Quota", ); diff --git a/core/src/plugins/meta.quota/manifest.xml b/core/src/plugins/meta.quota/manifest.xml index d93ebecb33..f171c45ff9 100644 --- a/core/src/plugins/meta.quota/manifest.xml +++ b/core/src/plugins/meta.quota/manifest.xml @@ -23,6 +23,7 @@ + @@ -39,7 +40,11 @@ var action = ajaxplorer.getActionBar().getActionByName("monitor_quota"); if(!action) return; var data = transport.responseJSON; - action.options.text = roundSize(data.USAGE, MessageHash["byte_unit_symbol"]) + "/" + roundSize(data.TOTAL, MessageHash["byte_unit_symbol"]); + ajaxplorer.meta_quota_text = roundSize(data.USAGE, MessageHash["byte_unit_symbol"]) + "/" + roundSize(data.TOTAL, MessageHash["byte_unit_symbol"]); + action.options.text = ajaxplorer.meta_quota_text; + if($('ajxp_quota_panel_content')){ + $('ajxp_quota_panel_content').update(ajaxplorer.meta_quota_text); + } action.refreshInstances(); }; c.sendAsync(); @@ -53,7 +58,11 @@ if(newValue){ var action = ajaxplorer.getActionBar().getActionByName("monitor_quota"); if(!action) return; - action.options.text = roundSize(newValue.getAttribute("usage"), MessageHash["byte_unit_symbol"]) + "/" + roundSize(newValue.getAttribute("total"), MessageHash["byte_unit_symbol"]); + ajaxplorer.meta_quota_text = roundSize(newValue.getAttribute("usage"), MessageHash["byte_unit_symbol"]) + "/" + roundSize(newValue.getAttribute("total"), MessageHash["byte_unit_symbol"]); + action.options.text = ajaxplorer.meta_quota_text; + if($('ajxp_quota_panel_content')){ + $('ajxp_quota_panel_content').update(ajaxplorer.meta_quota_text); + } action.refreshInstances(); } }); @@ -76,5 +85,25 @@ + + + + + + + +
    #{quota_string}
    +
    + + + ]]> +
    +
    +