Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Mar 25, 2016
2 parents bbbecdb + 4a3cfbe commit 680fc91
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 60 deletions.
2 changes: 1 addition & 1 deletion core/src/core/classes/class.Repository.php
Expand Up @@ -705,7 +705,7 @@ public function securityScope()
if(strpos($path, "AJXP_GROUP_PATH_FLAT") !== false) return "GROUP";
}
$path = $this->getOption("PATH", true);
if($this->accessType == "ajxp_conf" || $this->accessType == "ajxp_admin") return "USER";
if($this->accessType == "ajxp_conf" || $this->accessType == "ajxp_admin" || $this->accessType == "inbox") return "USER";
if(empty($path)) return false;
if(strpos($path, "AJXP_USER") !== false) return "USER";
if(strpos($path, "AJXP_GROUP_PATH") !== false) return "GROUP";
Expand Down
21 changes: 21 additions & 0 deletions core/src/plugins/access.ajxp_home/res/react/WelcomeComponents.js
Expand Up @@ -381,6 +381,7 @@
var blocks = [];
var data = this.state.data;
var usersData = data['core.users'];

if(usersData && usersData['users'] != undefined && usersData['groups'] != undefined){
blocks.push(
<HomeWorkspaceLegendInfoBlock key="core.users" badgeTitle={MessageHash[527]} iconClass="mdi mdi-account-network">
Expand All @@ -405,6 +406,26 @@
</HomeWorkspaceLegendInfoBlock>
);
}
if(data['access.inbox']){
blocks.push(
<HomeWorkspaceLegendInfoBlock key="core.users" badgeTitle={MessageHash['inbox_driver.2p']} iconClass="mdi mdi-file-multiple">
<div className="table">
<div>
<div>{MessageHash['inbox_driver.16']}</div>
<div className="text-center">{data['access.inbox']['files']}</div>
</div>
{(() => {
if (this.state.workspace.getAccessStatus() > 0) {
return <div>
<div>{MessageHash['inbox_driver.17']}</div>
<div className="text-center">{this.state.workspace.getAccessStatus()}</div>
</div>;
}
})()}
</div>
</HomeWorkspaceLegendInfoBlock>
);
}
if(data['meta.quota']){
blocks.push(
<HomeWorkspaceLegendInfoBlock key="meta.quota" badgeTitle={MessageHash['meta.quota.4']} iconClass="icon-dashboard">
Expand Down
25 changes: 17 additions & 8 deletions core/src/plugins/access.inbox/class.inboxAccessDriver.php
Expand Up @@ -56,6 +56,13 @@ public function loadNodeInfo(&$ajxpNode, $parentNode = false, $details = false)
}
}

public function loadRepositoryInfo(&$data){
$allNodes = self::getNodes(false, false);
$data['access.inbox'] = array(
'files' => count($allNodes)
);
}

public static function getNodeData($nodePath){
$basename = basename(parse_url($nodePath, PHP_URL_PATH));
if(empty($basename)){
Expand Down Expand Up @@ -94,7 +101,7 @@ public static function getNodeData($nodePath){
return $nodeData;
}

public static function getNodes($checkStats = false){
public static function getNodes($checkStats = false, $touch = true){

if(isSet(self::$output)){
return self::$output;
Expand Down Expand Up @@ -207,13 +214,15 @@ public static function getNodes($checkStats = false){
ConfService::loadDriverForRepository(ConfService::getRepository());
self::$output = $output;

if(count($touchReposIds) && AuthService::getLoggedUser() != null){
$uPref = AuthService::getLoggedUser()->getPref("repository_last_connected");
if(empty($uPref)) $uPref = array();
foreach($touchReposIds as $rId){
$uPref[$rId] = time();
if ($touch) {
if (count($touchReposIds) && AuthService::getLoggedUser() != null) {
$uPref = AuthService::getLoggedUser()->getPref("repository_last_connected");
if (empty($uPref)) $uPref = array();
foreach ($touchReposIds as $rId) {
$uPref[$rId] = time();
}
AuthService::getLoggedUser()->setPref("repository_last_connected", $uPref);
}
AuthService::getLoggedUser()->setPref("repository_last_connected", $uPref);
}
return $output;
}
Expand All @@ -228,4 +237,4 @@ protected static function disableWriteInStat(&$stat){
$stat["mode"] = $stat[2] = octdec($octRights);
}

}
}
26 changes: 15 additions & 11 deletions core/src/plugins/access.inbox/manifest.xml
Expand Up @@ -10,12 +10,16 @@
</client_settings>
<registry_contributions>
<external_file filename="plugins/access.fs/fsTemplatePart.xml" include="client_configs/*" exclude=""/>
<external_file filename="plugins/access.fs/fsActions.xml"
<external_file filename="plugins/access.fs/fsActions.xml"
include="actions/*"
exclude="actions/action[@name='download_all']|actions/action[@name='download']|actions/action[@name='download_chunk']|actions/action[@name='rename']|actions/action[@name='move']|actions/action[@name='copy']|actions/action[@name='delete']|actions/action[@name='chmod']|actions/action[@name='compress']|actions/action[@name='compress_ui']"/>
<external_file filename="plugins/access.fs/fsActions.xml" include="client_configs/*" exclude=""/>
<external_file filename="plugins/access.fs/fsActions.xml" include="client_configs/*" exclude=""/>
<external_file filename="plugins/access.fs/manifest.xml" include="registry_contributions/hooks/*" exclude=""/>

<hooks>
<serverCallback methodName="loadRepositoryInfo" hookName="repository.load_info" />
</hooks>

<actions>
<action name="inbox_accept_invitation">
<gui src="" text="547" title="547" iconClass="icon-ok-sign">
Expand Down Expand Up @@ -69,15 +73,15 @@
<rightsContext noUser="true" userLogged="only" read="true" write="false" adminOnly=""/>
<processing>
<clientCallback prepareModal="true"><![CDATA[
var userSelection = ajaxplorer.getUserSelection();
if(window.gaTrackEvent){
var fileNames = userSelection.getFileNames();
for(var i=0; i<fileNames.length;i++){
window.gaTrackEvent("Data", "Download", fileNames[i]);
var userSelection = ajaxplorer.getUserSelection();
if(window.gaTrackEvent){
var fileNames = userSelection.getFileNames();
for(var i=0; i<fileNames.length;i++){
window.gaTrackEvent("Data", "Download", fileNames[i]);
}
}
}
PydioApi.getClient().downloadSelection(userSelection, $('download_form'), 'download');
]]></clientCallback>
PydioApi.getClient().downloadSelection(userSelection, $('download_form'), 'download');
]]></clientCallback>
<serverCallback methodName="switchAction" restParams="/file+" checkParams="false" sdkMethodName="download" developerComment="Download one or many files at once. If multiple files (or a folder path) passed, they are sent back as an archive.">
<input_param description="User selection" name="nodes" type="AJXP_NODE[]" mandatory="true"/>
<output type="stream"/>
Expand Down Expand Up @@ -214,7 +218,7 @@
<client_configs>
<template_part ajxpClass="AjxpReactComponent" ajxpId="topPane" ajxpOptions='{"componentNamespace":"InboxWidgets","componentName":"LeftPanel"}'/>
</client_configs>
</registry_contributions>
</registry_contributions>
<dependencies>
<pluginClass pluginName="access.fs"/>
<pluginResources pluginName="access.fs"/>
Expand Down
4 changes: 3 additions & 1 deletion core/src/plugins/access.inbox/res/i18n/en.php
Expand Up @@ -18,4 +18,6 @@
"13" => "Files shared with me by other users",
"14" => "Copy to a workspace",
"15" => "Copy file to another of your workspaces",
);
"16" => "Total",
"17" => "New"
);
4 changes: 3 additions & 1 deletion core/src/plugins/access.inbox/res/i18n/fr.php
Expand Up @@ -18,4 +18,6 @@
"13" => "Les fichiers partagés avec moi par d'autres utilisateurs",
"14" => "Copier dans un workspace",
"15" => "Copier dans un autre de vos workspaces",
);
"16" => "Total",
"17" => "Nouveaux"
);
28 changes: 22 additions & 6 deletions core/src/plugins/action.share/res/react/ShareDialog.js
Expand Up @@ -299,7 +299,6 @@
return {showMenu:false};
},
showMenu: function () {
console.log("show menu ? ");
this.setState({showMenu: true});
},
/****************************/
Expand Down Expand Up @@ -345,7 +344,6 @@
return {text:text, payload:m.callback};
});
var menuBox = <ReactMUI.Menu onItemClick={this.menuClicked} zDepth={0} menuItems={menuItems}/>;
console.log("building menu");
}
return (
<div className="user-badge-menu-box">
Expand Down Expand Up @@ -604,9 +602,13 @@
);
},

render: function(){
render: function() {
var ocsLinks = this.props.shareModel.getOcsLinksByStatus(),
inv, rwHeader, hasActiveOcsLink = false;

inv = ocsLinks.map(function(link){
hasActiveOcsLink = (!hasActiveOcsLink && link && link.invitation && link.invitation.STATUS == 2) ? true : hasActiveOcsLink;

var inv = this.props.shareModel.getOcsLinks().map(function(link){
return (
<RemoteUserEntry
shareModel={this.props.shareModel}
Expand All @@ -616,15 +618,29 @@
/>
);
}.bind(this));

if(hasActiveOcsLink){
rwHeader = (
<div>
<div className="shared-users-rights-header">
<span className="read">{this.context.getMessage('361', '')}</span>
<span className="read">{this.context.getMessage('181')}</span>
</div>
</div>
);
}

return (
<div style={{marginTop:16}}>
<h3>{this.context.getMessage('207')}</h3>
<div className="section-legend">{this.context.getMessage('208')}</div>
{this.renderForm()}
<div>{inv}</div>
<div>
{rwHeader}
{inv}
</div>
</div>
);

}
});

Expand Down
10 changes: 9 additions & 1 deletion core/src/plugins/action.share/res/react/model/ShareModel.js
Expand Up @@ -313,6 +313,13 @@
return result;
}

getOcsLinksByStatus() {
return this.getOcsLinks().sort(function(a, b) {
if (!a.invitation || !b.invitation) return 0
return b.invitation.STATUS - a.invitation.STATUS;
});
}

userEntryForLink(linkId){
var linkData;
if(this._pendingData["ocs_links"] && this._pendingData["ocs_links"][linkId]){
Expand Down Expand Up @@ -546,7 +553,7 @@
if(this._pendingData["ocs_links"][linkId]){
delete this._pendingData["ocs_links"][linkId];
}
this._setStatus("modified");
this.save();
}

_ocsLinksToParameters(params){
Expand Down Expand Up @@ -706,6 +713,7 @@
this._pydio.fireNodeRefresh(this._node);
}else{
// There must have been an error, revert
this.load();
}
}.bind(this), null);
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/plugins/conf.sql/class.sqlConfDriver.php
Expand Up @@ -603,7 +603,7 @@ public function getRolesForRepository($repositoryId, $rolePrefix = '', $splitByT
}

// Building group by
if (!empty($q['where'])) {
if (!empty($q['groupBy'])) {
$reqStr .= 'GROUP BY';
$reqStr .= ' ';
$reqStr .= join(', ', $q['groupBy']);
Expand Down Expand Up @@ -646,12 +646,12 @@ public function countUsersForRepository($repositoryId, $details = false, $admin=
$object = ConfService::getRepositoryById($repositoryId);
if(!$admin){
if($object->securityScope() == "USER"){
if($details) return array('internal' => 1);
if($details) return array('users' => 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);
if($details) return array('users' => $groupUsers);
else return $groupUsers;
}
}
Expand Down

0 comments on commit 680fc91

Please sign in to comment.