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

Commit

Permalink
Fix Shares edition in user and admin dashboard: legacy shares were br…
Browse files Browse the repository at this point in the history
…oken - disable "Update" button, leave only invite & stop active. Fix #648
  • Loading branch information
cdujeu committed Oct 27, 2014
1 parent 68310fb commit 077db04
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
6 changes: 3 additions & 3 deletions core/src/plugins/action.share/class.ShareCenter.js
Expand Up @@ -261,9 +261,11 @@ Class.create("ShareCenter", {
});

oForm.removeClassName('share_leaf');
oForm.removeClassName('readonly_mode');
oForm.removeClassName('type-ws');
var pluginConfigs = ajaxplorer.getPluginConfigs("action.share");
if(this.currentNode.isLeaf()) oForm.addClassName('share_leaf');
if(this.readonlyMode) oForm.addClassName('readonly_mode');
this.maxexpiration = parseInt(pluginConfigs.get("FILE_MAX_EXPIRATION"));
if(this.maxexpiration > 0){
oForm.down("[name='expiration']").setValue(this.maxexpiration);
Expand Down Expand Up @@ -470,9 +472,7 @@ Class.create("ShareCenter", {
}else{
var El = new Element('div', {className:"SF_horizontal_fieldsRow"}).update('<div class="SF_horizontal_actions SF_horizontal_pastilles" style="padding-top: 12px;padding-left: 7px;"></div>');
oForm.down("#shareDialogButtons").insert({top:El});
this.updateDialogButtons(El, oForm, "folder", json, function(){
submitFunc(oForm);
});
this.updateDialogButtons(El, oForm, "folder", json, !this.readonlyMode?function(){submitFunc(oForm);}:null);
}
oForm.select('span.simple_tooltip_observer').each(function(e){
modal.simpleTooltip(e, e.readAttribute('data-tooltipTitle'), 'top center', 'down_arrow_tip', 'element');
Expand Down
14 changes: 9 additions & 5 deletions core/src/plugins/action.share/class.ShareCenter.php
Expand Up @@ -363,8 +363,7 @@ public function switchAction($action, $httpVars, $fileVars)
case "unshare":

if(isSet($httpVars["hash"])){
$mess = ConfService::getMessages();
$userId = AuthService::getLoggedUser()->getId();

$res = $this->getShareStore()->deleteShare($httpVars["element_type"], $httpVars["hash"]);
if($res !== false){
AJXP_XMLWriter::header();
Expand Down Expand Up @@ -1943,6 +1942,7 @@ public function listSharesAsNodes($rootPath, $currentUser = true, $parentReposit
$meta["share_data"] = $meta["copy_url"] = $this->buildPublicletLink($hash);
$meta["share_link"] = true;
$meta["shared_element_hash"] = $hash;
$meta["ajxp_shared_publiclet"] = $hash;

}else{

Expand Down Expand Up @@ -2227,10 +2227,14 @@ public function shareToJson($shareId, $shareData, $node = null){

}else if($shareData["type"] == "minisite" || $shareData["type"] == "repository"){

$minisite = ($shareData["type"] == "minisite");
$repoId = $shareId;
if(strpos($repoId, "repo-") === 0){
// Legacy
$repoId = str_replace("repo-", "", $repoId);
$shareData["type"] = "repository";
}
$minisite = ($shareData["type"] == "minisite");
if ($minisite) {

$minisiteData = $this->getShareStore()->loadShare($shareId);
$repoId = $minisiteData["REPOSITORY"];
$minisiteIsPublic = isSet($minisiteData["PRELOG_USER"]);
Expand All @@ -2255,7 +2259,7 @@ public function shareToJson($shareId, $shareData, $node = null){
);

$repo = ConfService::getRepositoryById($repoId);
if($repo == null && $node != null){
if($repoId == null || ($repo == null && $node != null)){
if($minisite){
$this->removeShareFromMeta($node, $shareId);
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/plugins/action.share/class.ShareStore.php
Expand Up @@ -248,7 +248,7 @@ public function listShares($limitToUser = '', $parentRepository = '', $cursor =
$oldRepos = ConfService::listRepositoriesWithCriteria($criteria, $count);
foreach($oldRepos as $sharedWorkspace){
if(!$sharedWorkspace->hasContentFilter()){
$dbLets[] = array(
$dbLets['repo-'.$sharedWorkspace->getId()] = array(
"SHARE_TYPE" => "repository",
"OWNER_ID" => $sharedWorkspace->getOwner(),
"REPOSITORY" => $sharedWorkspace->getUniqueId(),
Expand Down Expand Up @@ -293,6 +293,7 @@ public function deleteShare($type, $element)
AJXP_Logger::debug(__CLASS__, __FILE__, "Deleting shared element ".$type."-".$element);

if ($type == "repository") {
if(strpos($element, "repo-") === 0) $element = str_replace("repo-", "", $element);
$repo = ConfService::getRepositoryById($element);
if($repo == null) {
// Maybe a share has
Expand Down
4 changes: 4 additions & 0 deletions core/src/plugins/gui.ajax/res/themes/orbit/css/ajaxplorer.css
Expand Up @@ -4780,6 +4780,10 @@ div#share_result div.macos_only
background-color: #A00;
}

.readonly_mode div#share_update {
display: none !important;
}

div.user_entry span.cbContainer{

}
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 077db04

Please sign in to comment.