Permalink
Browse files

Fix HTML Embed Code. Fix SoundManager (use CDN and basic template).

Display Watch status on root folder if set by share owner.
  • Loading branch information...
1 parent 9017328 commit b17066860d67c225f0e5cb787d8528c6ba246b66 @cdujeu cdujeu committed Jul 1, 2016
@@ -15,6 +15,7 @@
<global_param name="EMAIL_INVITE_EXTERNAL" group="CONF_MESSAGE[Link Generation]" description="CONF_MESSAGE[Use external mailer for invitations]" label="CONF_MESSAGE[Force External Mailer]" type="boolean" default="false" expose="true"/>
<global_param name="CREATE_QRCODE" group="CONF_MESSAGE[Link Generation]" description="CONF_MESSAGE[Create and display QRCode for shared link]" label="CONF_MESSAGE[Create QRCode]" type="boolean" default="false" expose="true"/>
<global_param name="INFOPANEL_DISPLAY_HTML_EMBED" group="CONF_MESSAGE[Link Generation]" description="CONF_MESSAGE[Display pasteable HTML snippet in right-hand information panel]" label="CONF_MESSAGE[Display HTML Embed code]" type="boolean" default="false" expose="true"/>
+ <global_param name="INFOPANEL_DISPLAY_DIRECT_DOWNLOAD" group="CONF_MESSAGE[Link Generation]" description="CONF_MESSAGE[Display pasteable download link in right-hand information panel]" label="CONF_MESSAGE[Display Direct Download Link]" type="boolean" default="false" expose="true"/>
<global_param name="AVOID_SHARED_FOLDER_SAME_LABEL" group="CONF_MESSAGE[Internal Sharing]" description="CONF_MESSAGE[Disallow users to create shared folders if a workspace already exists with the same label]" label="CONF_MESSAGE[Avoid labels duplication]" type="boolean" default="false"/>
<global_param name="SHARED_USERS_TMP_PREFIX" group="CONF_MESSAGE[Internal Sharing]" description="CONF_MESSAGE[Mandatory prefix for users created temporary users login]" label="CONF_MESSAGE[Tmp users prefix]" type="string" expose="true"/>
<global_param name="FORK_EVENT_FORWARDING" group="CONF_MESSAGE[Internal Sharing]" type="boolean" label="CONF_MESSAGE[Fork Events Forwarding]" description="CONF_MESSAGE[If you detect performances issues while modifiyng files under deep trees, try activating that one. Please be sure of what you do, this may trigger a whole lot of php processes on the server.]" default="false"/>
@@ -245,4 +245,5 @@
"226" => "You are not allowed to create public links on folders",
"227" => "You are not allowed to share files internally",
"228" => "You are not allowed to share folders internally",
+ "229" => "Insert a preview of the file by pasting this code inside an HTML page."
);
@@ -151,10 +151,10 @@
let tplString ;
let messKey = "61";
- let newlink = this.props.publicLink + (this.props.publicLink.indexOf('?') !== -1 ? '&' : '?') + 'dl=true&ct=true';
+ let newlink = ReactModel.Share.buildDirectDownloadUrl(this.props.node, this.props.publicLink, true);
let template = global.pydio.UI.getSharedPreviewTemplateForEditor(editors[0], this.props.node);
if(template){
- tplString = template.evaluate({WIDTH:480, HEIGHT:260, DL_CT_LINK:newlink});
+ tplString = template.evaluate({WIDTH:350, HEIGHT:350, DL_CT_LINK:newlink});
}else{
tplString = newlink;
messKey = "60";
@@ -173,7 +173,7 @@
inputValue={data.templateString}
inputClassName="share_info_panel_link"
getMessage={this.props.getMessage}
- inputCopyMessage="192"
+ inputCopyMessage="229"
/>;
}
@@ -215,15 +215,31 @@
var linkData = this.state.model.getPublicLinks()[0];
var isExpired = linkData["is_expired"];
+ // Main Link Field
var linkField = (<InfoPanelInputRow
inputTitle="121"
inputValue={linkData['public_link']}
inputClassName={"share_info_panel_link" + (isExpired?" share_info_panel_link_expired":"")}
getMessage={this.getMessage}
inputCopyMessage="192"
/>);
+ if(this.props.node.isLeaf() && this.props.pydio.getPluginConfigs("action.share").get("INFOPANEL_DISPLAY_DIRECT_DOWNLOAD")){
+ // Direct Download Field
+ var downloadField = <InfoPanelInputRow
+ inputTitle="60"
+ inputValue={ReactModel.Share.buildDirectDownloadUrl(this.props.node, linkData['public_link'])}
+ inputClassName="share_info_panel_link"
+ getMessage={this.getMessage}
+ inputCopyMessage="192"
+ />;
+ }
if(this.props.node.isLeaf() && this.props.pydio.getPluginConfigs("action.share").get("INFOPANEL_DISPLAY_HTML_EMBED")){
- var templateField = <TemplatePanel {...this.props} getMessage={this.getMessage} publicLink={linkData.public_link} />;
+ // HTML Code Snippet (may be empty)
+ var templateField = <TemplatePanel
+ {...this.props}
+ getMessage={this.getMessage}
+ publicLink={linkData.public_link}
+ />;
}
}
var users = this.state.model.getSharedUsers();
@@ -282,6 +298,7 @@
return (
<div>
{linkField}
+ {downloadField}
{templateField}
{sharedUsersBlock}
</div>
@@ -865,6 +865,11 @@
static federatedSharingEnabled(){
return global.pydio.getPluginConfigs("core.ocs").get("ENABLE_FEDERATED_SHARING");
}
+
+ static buildDirectDownloadUrl(node, publicLink, contentProvider = false){
+ let ctString = contentProvider ? '&ct=true' : '';
+ return publicLink + (publicLink.indexOf('?') !== -1 ? '&' : '?') + 'dl=true'+ ctString +'&file=/'+encodeURIComponent(node.getLabel());
+ }
prepareEmail(shareType, linkId = null){
var MessageHash = global.pydio.MessageHash;
@@ -708,7 +708,7 @@ Class.create("Diaporama", AbstractEditor, {
getSharedPreviewTemplate : function(node){
- return new Template('<img width="#{WIDTH}" height="#{HEIGHT}" src="#{DL_CT_LINK}">');
+ return new Template('<img src="#{DL_CT_LINK}">');
},
@@ -224,16 +224,21 @@ Class.create("SMPlayer", AbstractEditor, {
var rgxtrim = new RegExp('\/+$');
crtRoot = crtRoot.replace(rgxtrim, '');
- return new Template('<link rel="stylesheet" type="text/css" href="'+crtRoot+'/plugins/editor.soundmanager/sm/shared/mp3-player-button.css" />\n\
-<script type="text/javascript" src="'+crtRoot+'/plugins/editor.soundmanager/sm/shared/soundmanager2.js"></script>;\n\
-<script type="text/javascript" src="'+crtRoot+'/plugins/editor.soundmanager/sm/shared/mp3-player-button.js"></script>\n\
+ return new Template('\
+<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/soundmanager2/2.97a.20150601/script/soundmanager2-nodebug-jsmin.js"></script>\n\
<script>\n \
soundManager.setup({\n\
- url: "'+crtRoot+'/plugins/editor.soundmanager/sm/swf/",\n\
- debugMode : false\n\
+ url: "https://cdnjs.cloudflare.com/ajax/libs/soundmanager2/2.97a.20150601/swf/",\n\
+ debugMode : false,\n\
+ onready: function() {\n\
+ var mySound = soundManager.createSound({\n\
+ id: "pydioSound",\n\
+ url: "#{DL_CT_LINK}&fake=ext.'+getAjxpMimeType(node)+'"\n\
+ });\n\
+ mySound.play();\n\
+ }\n\
});\n\
-</script>\n\
-<a href="#{DL_CT_LINK}&fake=ext.'+getAjxpMimeType(node)+'" class="sm2_button">'+node.getLabel()+'</a> '+node.getLabel());
+</script>');
},
@@ -401,7 +401,23 @@ public function switchActions(\Psr\Http\Message\ServerRequestInterface $requestI
);
$userId = $ctx->hasUser() ? $ctx->getUser()->getId() : "shared";
- if ($cmd == "watch_stop" && isSet($meta) && isSet($meta[$userId])) {
+ if($node->isRoot() && $node->getRepository()->hasParent() && $cmd == "watch_stop" && !(isSet($meta) && isSet($meta[$userId]))){
+ $usersMeta = $this->metaStore->retrieveMetadata(
+ $node,
+ self::$META_WATCH_USERS_NAMESPACE,
+ false,
+ AJXP_METADATA_SCOPE_REPOSITORY);
+ if(is_array($usersMeta) && array_key_exists(self::$META_WATCH_USERS_CHANGE, $usersMeta) && array_key_exists($userId,$usersMeta[self::$META_WATCH_USERS_CHANGE])) {
+ unset($usersMeta[self::$META_WATCH_USERS_CHANGE][$userId]);
+ $this->metaStore->setMetadata(
+ $node,
+ self::$META_WATCH_USERS_NAMESPACE,
+ $usersMeta,
+ false,
+ AJXP_METADATA_SCOPE_REPOSITORY
+ );
+ }
+ } else if ($cmd == "watch_stop" && isSet($meta) && isSet($meta[$userId])) {
unset($meta[$userId]);
$this->metaStore->removeMetadata(
$node,
@@ -531,6 +547,19 @@ public function enrichNode(&$node)
"overlay_icon" => "meta.watch/ICON_SIZE/watch.png",
"overlay_class" => "icon-eye-open"
), true);
+ }else if($node->isRoot() && $node->getRepository()->hasParent()){
+ $usersMeta = $this->metaStore->retrieveMetadata(
+ $node,
+ self::$META_WATCH_USERS_NAMESPACE,
+ false,
+ AJXP_METADATA_SCOPE_REPOSITORY);
+ if(is_array($usersMeta) && array_key_exists(self::$META_WATCH_USERS_CHANGE, $usersMeta) && array_key_exists($userId,$usersMeta[self::$META_WATCH_USERS_CHANGE])) {
+ $node->mergeMetadata(array(
+ "meta_watched" => self::$META_WATCH_CHANGE,
+ "overlay_icon" => "meta.watch/ICON_SIZE/watch.png",
+ "overlay_class" => "icon-eye-open"
+ ), true);
+ }
}
}

0 comments on commit b170668

Please sign in to comment.