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

Commit

Permalink
use documentName
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Feb 25, 2016
1 parent 850f249 commit 7e203af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 79 deletions.
78 changes: 3 additions & 75 deletions core/src/plugins/action.share/class.ShareCenter.php
Expand Up @@ -1459,6 +1459,8 @@ public function shareNode($httpVars, &$update){
$originalHttpVars = $httpVars;
$ocsStore = new Pydio\OCS\Model\SQLStore();
$ocsClient = new Pydio\OCS\Client\OCSClient();
$userSelection = new UserSelection($this->repository, $httpVars);

/**
* @var ShareLink[] $shareObjects
*/
Expand Down Expand Up @@ -1507,7 +1509,7 @@ public function shareNode($httpVars, &$update){
}else{
$link = new Pydio\OCS\Model\TargettedLink($this->getShareStore());
if(AuthService::usersEnabled()) $link->setOwnerId(AuthService::getLoggedUser()->getId());
$link->prepareInvitation($linkData["HOST"], $linkData["USER"]);
$link->prepareInvitation($linkData["HOST"], $linkData["USER"], $userSelection->getUniqueNode()->getLabel());
}
$hiddenUserEntries[] = $this->prepareSharedUserEntry(
$linkData,
Expand All @@ -1520,47 +1522,6 @@ public function shareNode($httpVars, &$update){
}
}

/*
// OCS LINK
if(isSet($httpVars["ocs_data"])){
$ocsData = json_decode($httpVars["ocs_data"], true);
$existingOcsHash = isSet($ocsData["hash"]) ? AJXP_Utils::sanitize($ocsData["hash"], AJXP_SANITIZE_ALPHANUM) : null;
if(!empty($existingOcsHash)){
$existingInvitations = $ocsStore->invitationsForLink($existingOcsHash);
$totalInvitations = $this->getRightsManager()->remoteUsersFromParameters($ocsData, $existingInvitations, $newOcsUsers, $unShareInvitations);
if(!$totalInvitations){
$this->getShareStore()->deleteShare("minisite", $existingOcsHash, true);
}else{
$ocsLink = $this->getShareStore()->loadShareObject($existingOcsHash);
}
}else{
$totalInvitations = $this->getRightsManager()->remoteUsersFromParameters($ocsData, array(), $newOcsUsers, $unShareInvitations);
if($totalInvitations > 0){
$ocsLink = new Pydio\OCS\Model\TargettedLink($this->getShareStore());
if(AuthService::usersEnabled()){
$ocsLink->setOwnerId(AuthService::getLoggedUser()->getId());
}
}
}
if(isSet($ocsLink)){
$ocsLink->parseHttpVars($httpVars);
if(isSet($shareObject)){
$ocsLink->setUniqueUser($shareObject->getUniqueUser(), $shareObject->shouldRequirePassword());
}else{
$hiddenUserEntry = $this->prepareSharedUserEntry(
$httpVars,
$ocsLink,
isSet($httpVars["hash"]) || isSet($ocsData["hash"]),
isSet($httpVars["guest_user_pass"])?$httpVars["guest_user_pass"]:null
);
}
}
}
*/

$userSelection = new UserSelection($this->repository, $httpVars);
$this->filterHttpVarsForLeafPath($httpVars, $userSelection);

$users = array(); $groups = array();
Expand Down Expand Up @@ -1867,39 +1828,6 @@ public function shareToJson($shareId, $shareMeta, $node = null){
$shareLink->setAdditionalMeta($shareMeta);
$jsonData["minisite"] = $shareLink->getJsonData($this->getPublicAccessManager(), $messages);
}
/*
if ($minisite && isSet($storedData)) {
if(!empty($storedData["DOWNLOAD_LIMIT"]) && !$dlDisabled){
$jsonData["download_counter"] = $this->getShareStore()->getCurrentDownloadCounter($shareId);
$jsonData["download_limit"] = $storedData["DOWNLOAD_LIMIT"];
}
if(!empty($storedData["EXPIRE_TIME"])){
$delta = $storedData["EXPIRE_TIME"] - time();
$days = round($delta / (60*60*24));
$jsonData["expire_time"] = date($messages["date_format"], $storedData["EXPIRE_TIME"]);
$jsonData["expire_after"] = $days;
}else{
$jsonData["expire_after"] = 0;
}
$jsonData["is_expired"] = $this->getShareStore()->isShareExpired($shareId, $storedData);
if(isSet($storedData["AJXP_TEMPLATE_NAME"])){
$jsonData["minisite_layout"] = $storedData["AJXP_TEMPLATE_NAME"];
}
if(!$minisiteIsPublic){
$jsonData["has_password"] = true;
}
$jsonData["minisite"] = array(
"public" => $minisiteIsPublic?"true":"false",
"public_link" => $minisiteLink,
"disable_download" => $dlDisabled,
"hash" => $shareId,
"hash_is_shorten" => isSet($shareMeta["short_form_url"])
);
foreach($this->getShareStore()->modifiableShareKeys as $key){
if(isSet($storedData[$key])) $jsonData[$key] = $storedData[$key];
}
}*/

}

Expand Down
11 changes: 7 additions & 4 deletions core/src/plugins/core.ocs/src/Model/TargettedLink.php
Expand Up @@ -40,16 +40,18 @@ public function __construct($store, $storeData = array()){
/**
* @param string $remoteServer
* @param string $remoteUser
* @param string $documentName
* @return ShareInvitation
*/
public function createInvitation($remoteServer, $remoteUser){
public function createInvitation($remoteServer, $remoteUser, $documentName){

$invitation = new ShareInvitation();
$invitation->setStatus(OCS_INVITATION_STATUS_PENDING);
$invitation->setLinkHash($this->getHash());
$invitation->setOwner($this->getOwnerId());
$invitation->setTargetHost($remoteServer);
$invitation->setTargetUser($remoteUser);
$invitation->setDocumentName($documentName);

return $invitation;

Expand All @@ -58,17 +60,18 @@ public function createInvitation($remoteServer, $remoteUser){
/**
* @param string $remoteServer
* @param string $remoteUser
* @param $documentName
*/
public function prepareInvitation($remoteServer, $remoteUser){
$this->pendingInvitation = array("host" => $remoteServer, "user" => $remoteUser);
public function prepareInvitation($remoteServer, $remoteUser, $documentName){
$this->pendingInvitation = array("host" => $remoteServer, "user" => $remoteUser, "documentName" => $documentName);
}

/**
* @return null|ShareInvitation
*/
public function getPendingInvitation(){
if(isSet($this->pendingInvitation)){
return $this->createInvitation($this->pendingInvitation["host"], $this->pendingInvitation["user"]);
return $this->createInvitation($this->pendingInvitation["host"], $this->pendingInvitation["user"], $this->pendingInvitation["documentName"]);
}
return null;
}
Expand Down

0 comments on commit 7e203af

Please sign in to comment.