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

Commit

Permalink
Fix various details on Share Center: display "view parameters" instea…
Browse files Browse the repository at this point in the history
…d of "change parameters" if panel is in readonly mode. Disable some actions if in ajxp_* workspace.
  • Loading branch information
cdujeu committed Oct 19, 2015
1 parent 2115463 commit f5936ae
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 35 deletions.
60 changes: 32 additions & 28 deletions core/src/plugins/action.share/class.ShareCenter.php
Expand Up @@ -36,7 +36,6 @@ class ShareCenter extends AJXP_Plugin
*/
private $repository;
private $urlBase;
private $baseProtocol;

/**
* @var ShareStore
Expand All @@ -53,41 +52,46 @@ protected function parseSpecificContributions(&$contribNode)
parent::parseSpecificContributions($contribNode);
$disableSharing = false;
$downloadFolder = ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER");
if ($downloadFolder == "") {
$disableSharing = true;
} else if ((!is_dir($downloadFolder) || !is_writable($downloadFolder))) {
$this->logDebug("Disabling Public links, $downloadFolder is not writeable!", array("folder" => $downloadFolder, "is_dir" => is_dir($downloadFolder),"is_writeable" => is_writable($downloadFolder)));
$disableSharing = true;
} else {
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null && AuthService::isReservedUserId($loggedUser->getId())) {
$disableSharing = true;
}
} else {
if ( empty($downloadFolder) || (!is_dir($downloadFolder) || !is_writable($downloadFolder))) {
$this->logError("Warning on public links, $downloadFolder is not writeable!", array("folder" => $downloadFolder, "is_dir" => is_dir($downloadFolder),"is_writeable" => is_writable($downloadFolder)));
}

$xpathesToRemove = array();

if( strpos(ConfService::getRepository()->getAccessType(), "ajxp_") === 0){

$xpathesToRemove[] = 'action[@name="share-file-minisite"]';
$xpathesToRemove[] = 'action[@name="share-folder-minisite-public"]';
$xpathesToRemove[] = 'action[@name="share-edit-shared"]';

}else if (AuthService::usersEnabled()) {

$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null && AuthService::isReservedUserId($loggedUser->getId())) {
$disableSharing = true;
}
$xpathesToRemove = array();
if ($disableSharing) {
// All share- actions
$xpathesToRemove[] = 'action[contains(@name, "share-")]';
}else{
$folderSharingAllowed = $this->getAuthorization("folder", "any"); // $this->pluginConf["ENABLE_FOLDER_SHARING"];
$fileSharingAllowed = $this->getAuthorization("file"); //$this->pluginConf["ENABLE_FILE_PUBLIC_LINK"];
if($fileSharingAllowed === false){
// Share file button
$xpathesToRemove[] = 'action[@name="share-file-minisite"]';
}
if(!$folderSharingAllowed){
// Share folder button
$xpathesToRemove[] = 'action[@name="share-folder-minisite-public"]';
}

} else {

$disableSharing = true;

}
if ($disableSharing) {
// All share- actions
$xpathesToRemove[] = 'action[contains(@name, "share-")]';
}else{
$folderSharingAllowed = $this->getAuthorization("folder", "any");
$fileSharingAllowed = $this->getAuthorization("file");
if($fileSharingAllowed === false){
// Share file button
$xpathesToRemove[] = 'action[@name="share-file-minisite"]';
}
if(!$folderSharingAllowed){
// Share folder button
$xpathesToRemove[] = 'action[@name="share-folder-minisite-public"]';
}
}

foreach($xpathesToRemove as $xpath){
$actionXpath=new DOMXPath($contribNode->ownerDocument);
$nodeList = $actionXpath->query($xpath, $contribNode);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/action.share/manifest.xml
Expand Up @@ -102,7 +102,7 @@
<span class="mode-minipub no_share_leaf">AJXP_MESSAGE[share_center.138]</span>
<span class="mode-ws no_share_leaf">AJXP_MESSAGE[share_center.139]</span>
<span class="mode-minipub only_share_leaf">AJXP_MESSAGE[share_center.140]</span>
<a><span class="params_view">AJXP_MESSAGE[share_center.141]</span><span class="params_hide">AJXP_MESSAGE[share_center.142]</span></a>
<a><span class="params_view">AJXP_MESSAGE[share_center.141]</span><span class="params_hide">AJXP_MESSAGE[share_center.142]</span><span class="params_view_readonly">AJXP_MESSAGE[share_center.177]</span></a>
<div class="SF_horizontal_actions SF_horizontal_pastilles"></div>
</div>
<div style="display:none;position:relative;margin:10px;min-height:85px;" id="share_result" class="">
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/action.share/res/i18n/ca.php
Expand Up @@ -188,4 +188,5 @@
"174" => "Reset Password",
"175" => "Please set a password and make sure it's long enough!",
"176" => "(Mandatory)",
"177" => "View parameters",
);
1 change: 1 addition & 0 deletions core/src/plugins/action.share/res/i18n/de.php
Expand Up @@ -187,4 +187,5 @@
"174" => "Deaktiviere Passwort",
"175" => "Please set a password and make sure it's long enough!",
"176" => "(Mandatory)",
"177" => "View parameters",
);
1 change: 1 addition & 0 deletions core/src/plugins/action.share/res/i18n/en.php
Expand Up @@ -189,4 +189,5 @@
"174" => "Reset Password",
"175" => "Please set a password and make sure it's long enough!",
"176" => "(Mandatory)",
"177" => "View parameters",
);
1 change: 1 addition & 0 deletions core/src/plugins/action.share/res/i18n/es.php
Expand Up @@ -188,4 +188,5 @@
"174" => "Disable Password",
"175" => "Please set a password and make sure it's long enough!",
"176" => "(Mandatory)",
"177" => "View parameters",
);
5 changes: 3 additions & 2 deletions core/src/plugins/action.share/res/i18n/fr.php
Expand Up @@ -186,6 +186,7 @@
"172" => "Désolé ce lien est déjà utilisé, veuillez en choisir un autre.",
"173" => "Si vous voulez créer un lien durable, vous pouvez utiliser ce champ pour fixer la dernière partie du lien (e.g. https://.../mon-joli-lien). Laisser vide pour générer automatiquement.",
"174" => "Remettre à zéro",
"175" => "Please set a password and make sure it's long enough!",
"176" => "(Mandatory)",
"175" => "Veuillez mettre un mot de passe et vous assurer qu'il est assez long!",
"176" => "(Obligatoire)",
"177" => "Voir les paramètres",
);
1 change: 1 addition & 0 deletions core/src/plugins/action.share/res/i18n/it.php
Expand Up @@ -185,4 +185,5 @@
"174" => "Disabilita Password",
"175" => "Please set a password and make sure it's long enough!",
"176" => "(Mandatory)",
"177" => "View parameters",
);
1 change: 1 addition & 0 deletions core/src/plugins/action.share/res/i18n/pt.php
Expand Up @@ -188,4 +188,5 @@
"174" => "Reset Password",
"175" => "Please set a password and make sure it's long enough!",
"176" => "(Mandatory)",
"177" => "View parameters",
);
1 change: 1 addition & 0 deletions core/src/plugins/action.share/res/i18n/ru.php
Expand Up @@ -184,4 +184,5 @@
"174" => "Выключить пароль",
"175" => "Please set a password and make sure it's long enough!",
"176" => "(Mandatory)",
"177" => "View parameters",
);
20 changes: 17 additions & 3 deletions core/src/plugins/gui.ajax/res/themes/orbit/css/ajaxplorer.css
Expand Up @@ -540,7 +540,7 @@ div.shadow_class
.dialogContent input:disabled,
.dialogContent input[type="text"]:disabled,
.dialogContent input[type="password"]:disabled,
.dialogContent option:disabled
.dialogContent option:disabled,
.dialogContent textarea:disabled
{
background: #eee;
Expand Down Expand Up @@ -5133,16 +5133,30 @@ form.share_expired div.macos_only{
display: block !important;
}

div#target_repository_toggle span.params_view_readonly
{
display: none;
}

.readonly_mode div#target_repository_toggle span.params_view_readonly{
display: inline;
}

#target_repository_toggle span.params_hide,
.edit_parameters div#target_repository_toggle span.params_view
.edit_parameters div#target_repository_toggle span.params_view,
.readonly_mode div#target_repository_toggle span.params_view,
.edit_parameters div#target_repository_toggle span.params_view_readonly
{
display: none !important;
}
.edit_parameters div#target_repository_toggle span.params_hide{
display: inline !important;
}

.share_edit.type-ws span.params_hide, .share_edit.type-ws span.params_view{
.share_edit.type-ws span.params_hide,
.share_edit.type-ws span.params_view,
.share_edit.type-ws span.params_view_readonly
{
display: none !important;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/gui.ajax/res/themes/orbit/css/allz.css

Large diffs are not rendered by default.

0 comments on commit f5936ae

Please sign in to comment.