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

Commit a50fb0e

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents b1b5670 + 6f04f1e commit a50fb0e

File tree

14 files changed

+108
-74
lines changed

14 files changed

+108
-74
lines changed

core/src/core/classes/class.AJXP_PluginsService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ protected function mergeChildByTagName($new, &$old)
793793
if ($newChild->nodeName == "post_processing" || $newChild->nodeName == "pre_processing") {
794794
$old->appendChild($newChild->cloneNode(true));
795795
} else {
796-
$this->mergeChildByTagName($newChild, $found);
796+
$this->mergeChildByTagName($newChild->cloneNode(true), $found);
797797
}
798798
} else {
799799
// CloneNode or it's messing with the current foreach loop.

core/src/plugins/access.fs/class.fsAccessDriver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ public function disableArchiveBrowsingContributions(&$contribNode)
173173
if(!$compressNodeList->length) return ;
174174
$compressNode = $compressNodeList->item(0);
175175
$contribNode->removeChild($compressNode);
176+
$compressNodeList = $actionXpath->query('action[@name="compress_ui"]', $contribNode);
177+
if(!$compressNodeList->length) return ;
178+
$compressNode = $compressNodeList->item(0);
179+
$contribNode->removeChild($compressNode);
176180
// Disable "download" if selection is multiple
177181
$nodeList = $actionXpath->query('action[@name="download"]/gui/selectionContext', $contribNode);
178182
$selectionNode = $nodeList->item(0);

core/src/plugins/access.fs/fsActions.xml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,15 @@
331331
</processing>
332332
</action>
333333
<action name="compress">
334+
<processing>
335+
<serverCallback methodName="switchAction" restParams="/file+" checkParams="false" sdkMethodName="compress" developerComment="Compress one or many files into a Zip archive. May be disabled for remote-access workspaces (like FTP).">
336+
<input_param description="User selection" name="nodes" type="AJXP_NODE[]" mandatory="true"/>
337+
<input_param description="Force new archive name. If not set, the parent folder name is used" name="archive_name" type="string"/>
338+
<input_param description="Skip the original folder structure and store all files at the root of the archive" name="compress_flat" type="boolean"/>
339+
</serverCallback>
340+
</processing>
341+
</action>
342+
<action name="compress_ui">
334343
<gui text="313" title="314" src="archive_insert.png" iconClass="icon-briefcase" accessKey="" hasAccessKey="false">
335344
<context selection="true" dir="" recycle="hidden"
336345
actionBar="true" contextMenu="false" infoPanel="true"
@@ -376,7 +385,7 @@
376385
<clientListener name="selectionChange"><![CDATA[
377386
if(ajaxplorer){
378387
var userSelection = ajaxplorer.getUserSelection();
379-
var action = pydio.getController().getActionByName("compress");
388+
var action = pydio.getController().getActionByName("compress_ui");
380389
if(!window.zipEnabled || !window.multipleFilesDownloadEnabled){
381390
if(action){
382391
if(userSelection.isUnique()) action.selectionContext.multipleOnly = true;
@@ -385,12 +394,7 @@
385394
}
386395
}
387396
]]></clientListener>
388-
<serverCallback methodName="switchAction" restParams="/file+" checkParams="false" sdkMethodName="compress" developerComment="Compress one or many files into a Zip archive. May be disabled for remote-access workspaces (like FTP).">
389-
<input_param description="User selection" name="nodes" type="AJXP_NODE[]" mandatory="true"/>
390-
<input_param description="Force new archive name. If not set, the parent folder name is used" name="archive_name" type="string"/>
391-
<input_param description="Skip the original folder structure and store all files at the root of the archive" name="compress_flat" type="boolean"/>
392-
</serverCallback>
393-
</processing>
397+
</processing>
394398
</action>
395399
<action name="open_with_unique">
396400
<gui text="462" title="462" src="fileopen.png" iconClass="icon-eye-close" accessKey="preview_access_key" hasAccessKey="true">

core/src/plugins/access.sftp_psl/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
</component_config>
5656
</client_configs>
5757
<external_file filename="plugins/access.fs/fsTemplatePart.xml" include="client_configs/*" exclude=""/>
58-
<external_file filename="plugins/access.fs/fsActions.xml" include="actions/*" exclude="actions/action[@name='compress'],actions/action[@name='empty_recycle'],actions/action[@name='restore'],actions/action[@name='purge']"/>
58+
<external_file filename="plugins/access.fs/fsActions.xml" include="actions/*" exclude="actions/action[@name='compress'],actions/action[@name='compress_ui'],actions/action[@name='empty_recycle'],actions/action[@name='restore'],actions/action[@name='purge']"/>
5959
<external_file filename="plugins/access.fs/fsActions.xml" include="client_configs/*" exclude=""/>
6060
<external_file filename="plugins/access.fs/manifest.xml" include="registry_contributions/hooks/*" exclude=""/>
6161
</registry_contributions>

core/src/plugins/action.compression/class.PluginCompression.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function receiveAction($action, $httpVars, $fileVars)
5959
}
6060
$progressExtractFileName = $this->getPluginCacheDir(false, true) . DIRECTORY_SEPARATOR . "progressExtractID-" . $extractId . ".txt";
6161
if ($action == "compression") {
62-
$archiveName = AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic($httpVars["archiveName"]), AJXP_SANITIZE_FILENAME);
62+
$archiveName = AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic($httpVars["archive_name"]), AJXP_SANITIZE_FILENAME);
6363
$archiveFormat = $httpVars["type_archive"];
6464
$tabTypeArchive = array(".tar", ".tar.gz", ".tar.bz2");
6565
$acceptedExtension = false;
@@ -176,7 +176,7 @@ public function receiveAction($action, $httpVars, $fileVars)
176176
AJXP_Controller::applyHook("node.change", array(null, $newNode, false));
177177
AJXP_XMLWriter::header();
178178
AJXP_XMLWriter::sendMessage($messages["compression.8"], null);
179-
AJXP_XMLWriter::writeNodesDiff($nodesDiffs, false);
179+
AJXP_XMLWriter::writeNodesDiff($nodesDiffs, true);
180180
AJXP_XMLWriter::close();
181181
unlink($progressCompressionFileName);
182182
}
@@ -269,7 +269,7 @@ public function receiveAction($action, $httpVars, $fileVars)
269269
AJXP_Controller::applyHook("node.change", array(null, $newNode, false));
270270
AJXP_XMLWriter::header();
271271
AJXP_XMLWriter::sendMessage(sprintf($messages["compression.14"], $onlyFileName), null);
272-
AJXP_XMLWriter::writeNodesDiff($nodesDiffs, false);
272+
AJXP_XMLWriter::writeNodesDiff($nodesDiffs, true);
273273
AJXP_XMLWriter::close();
274274
if (file_exists($progressExtractFileName)) {
275275
unlink($progressExtractFileName);
Lines changed: 59 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<ajxp_plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd" name="compression" enabled="false" label="CONF_MESSAGE[Compression Plugin]" description="CONF_MESSAGE[Compress some files.]" >
2+
<ajxp_plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd"
3+
name="compression" enabled="true" label="CONF_MESSAGE[Tar Archives Support]"
4+
description="CONF_MESSAGE[Create and extract tar, tar.gz and tar.bz2 archives.]" >
35

46
<client_settings>
57
<resources>
@@ -8,25 +10,27 @@
810
</client_settings>
911

1012
<registry_contributions>
13+
<extensions>
14+
<extension mime="tar" icon="archive.png" messageId="61"/>
15+
<extension mime="bz2" icon="archive.png" messageId="61"/>
16+
</extensions>
1117
<actions>
1218
<action name="compression">
13-
<gui text="compression.1" title="compression.2" src="archive_insert.png" iconClass="icon-briefcase" accessKey="" hasAccessKey="false">
14-
<context selection="true" dir="true" recycle="hidden"
15-
actionBar="true" contextMenu="false" infoPanel="false"
16-
actionBarGroup="remote" inZip="false">
17-
</context>
18-
<selectionContext dir="true" file="true" recycle="false" unique="false"/>
19-
</gui>
2019
<processing>
21-
<clientCallback prepareModal="false"><![CDATA[
20+
<serverCallback methodName="receiveAction"/>
21+
</processing>
22+
</action>
23+
<action name="compress_ui">
24+
<processing>
25+
<clientCallback prepareModal="true"><![CDATA[
2226
var crtDir = pydio.getContextHolder().getContextNode().getPath();
2327
var userSelection = pydio.getUserSelection();
2428
if (!userSelection.isEmpty()) {
2529
var loadFunc = function (oForm) {
2630
if (userSelection.isEmpty()) {
2731
return;
2832
}
29-
var archiveNameInput = oForm.down('input[id="archiveName"]');
33+
var archive_nameInput = oForm.down('input[id="archive_name"]');
3034
var changeDuplicateArchiveName = function (name, extension) {
3135
var nameLastIndexOf = name.lastIndexOf("-");
3236
var tmpFileName = name.substr(0, nameLastIndexOf);
@@ -39,49 +43,64 @@
3943
name = tmpFileName + "-" + compteurFileName;
4044
compteurFileName ++;
4145
}
42-
archiveNameInput.setValue(name + extension);
46+
archive_nameInput.setValue(name + extension);
4347
return name;
4448
};
45-
var archiveName = archiveNameInput.getValue();
49+
var archive_name = archive_nameInput.getValue();
4650
var archiveTypeSelect = oForm.down('select[id="type_archive"]');
51+
if(window.multipleFilesDownloadEnabled){
52+
archiveTypeSelect.insert({top:'<option value=".zip">ZIP</option>'});
53+
}
4754
var archiveExtension = archiveTypeSelect.getValue();
4855
if (userSelection.isUnique()) {
49-
archiveName = getBaseName(userSelection.getUniqueFileName()).split(".").shift();
56+
archive_name = getBaseName(userSelection.getUniqueFileName()).split(".").shift();
5057
} else if (crtDir.length == 1) {
51-
archiveName = "Archive";
58+
archive_name = "Archive";
5259
} else {
53-
archiveName = getBaseName(crtDir);
60+
archive_name = getBaseName(crtDir);
5461
}
55-
archiveName = changeDuplicateArchiveName(archiveName, archiveExtension);
56-
archiveTypeSelect.observe("change", function (){
57-
archiveName = changeDuplicateArchiveName(archiveName, archiveTypeSelect.getValue());
58-
});
59-
archiveNameInput.observe("change", function () {
60-
archiveName = archiveNameInput.getValue().slice(0, -archiveTypeSelect.getValue().length);
61-
archiveName = changeDuplicateArchiveName(archiveName, archiveTypeSelect.getValue());
62+
var updateFormAndArchiveName = function (){
63+
var archiveExtension = archiveTypeSelect.getValue();
64+
if(archiveExtension == ".zip"){
65+
oForm.setAttribute("action", "compress");
66+
oForm.down("#compression_form").setAttribute("action", "compress");
67+
oForm.down('input[name="get_action"]').value = "compress";
68+
}else{
69+
oForm.setAttribute("action", "compression");
70+
oForm.down("#compression_form").setAttribute("action", "compression");
71+
oForm.down('input[name="get_action"]').value = "compression";
72+
}
73+
changeDuplicateArchiveName(archive_name, archiveExtension);
74+
};
75+
updateFormAndArchiveName();
76+
archiveTypeSelect.observe("change", updateFormAndArchiveName);
77+
archive_nameInput.observe("change", function () {
78+
archive_name = archive_nameInput.getValue().slice(0, -archiveTypeSelect.getValue().length);
79+
changeDuplicateArchiveName(archive_name, archiveTypeSelect.getValue());
6280
});
6381
};
6482
var closeFunc = function(){
6583
userSelection.updateFormOrUrl(modal.getForm());
66-
pydio.Controller.submitForm(modal.getForm(), true);
84+
PydioApi.getClient().submitForm(modal.getForm(), true);
6785
hideLightBox();
6886
};
6987
modal.showDialogForm('Compress selection to ...', 'compression_form', loadFunc, closeFunc);
7088
}
7189
]]></clientCallback>
72-
<clientForm id="extract_form"><![CDATA[
73-
<div id="compression_form" action="compression" box_width="272">
74-
<label class="dialogLegend" id="type_archive">AJXP_MESSAGE[compression.3]</label>
75-
<select name="type_archive" id="type_archive" class="dialogFocus initFicName">
76-
<option value=".tar">Archiver en TAR</option>
77-
<option value=".tar.gz">Archiver en TAR.GZ</option>
78-
<option value=".tar.bz2">Archiver en TAR.BZ2</option>
79-
</select>
80-
<label class="dialogLegend" for="archiveName">AJXP_MESSAGE[compression.4]</label>
81-
<input type="text" name="archiveName" id="archiveName" class="dialogFocus initFicName" />
82-
</div>
90+
<clientForm id="compression_form"><![CDATA[
91+
<div id="compression_form" action="compression" box_width="272">
92+
<label class="dialogLegend" id="type_archive" style="display: inline-block;margin-top: 11px;">AJXP_MESSAGE[compression.3]</label>
93+
<select style="width:100px;" name="type_archive" id="type_archive" class="dialogFocus initFicName">
94+
<option value=".tar">TAR</option>
95+
<option value=".tar.gz">TAR.GZ</option>
96+
<option value=".tar.bz2">TAR.BZ2</option>
97+
</select>
98+
<br/>
99+
<label class="dialogLegend" for="archive_name" style="display: inline-block;margin-top: 11px;">AJXP_MESSAGE[compression.4]</label>
100+
<br/>
101+
<input style="width: 93%;margin-left: 9px;margin-top: 7px; margin-bottom:12px;" type="text" name="archive_name" id="archive_name" class="dialogFocus initFicName" />
102+
</div>
83103
]]></clientForm>
84-
<serverCallback methodName="receiveAction" pluginId="action.compression" />
85104
</processing>
86105
</action>
87106
<action name="check_compression_status">
@@ -92,8 +111,8 @@
92111
<action name="extraction">
93112
<gui text="compression.9" title="compression.10" src="archive_insert.png" iconClass="icon-briefcase" accessKey="" hasAccessKey="false">
94113
<context selection="true" dir="true" recycle="hidden"
95-
actionBar="true" contextMenu="false" infoPanel="false"
96-
actionBarGroup="remote" inZip="false">
114+
actionBar="true" contextMenu="true" infoPanel="false"
115+
actionBarGroup="change" inZip="false">
97116
</context>
98117
<selectionContext dir="false" file="true" recycle="false" unique="true"/>
99118
</gui>
@@ -123,4 +142,7 @@
123142
</actions>
124143
</registry_contributions>
125144
<class_definition filename="plugins/action.compression/class.PluginCompression.php" classname="PluginCompression"/>
145+
<dependencies>
146+
<activePlugin pluginName="access.fs"/>
147+
</dependencies>
126148
</ajxp_plugin>

core/src/plugins/action.compression/res/i18n/conf/en.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
* The latest code can be found at <http://pyd.io/>.
2020
*/
2121
$mess=array(
22-
"Compression/Extraction Plugin" => "Compression/Extraction Plugin",
23-
"Compress or extract some files." => "Compress or extract some files.",
22+
"Tar Archives Support" => "Tar Archives Support",
23+
"Create and extract tar, tar.gz and tar.bz2 archives." => "Create and extract tar, tar.gz and tar.bz2 archives.",
2424
);

core/src/plugins/action.compression/res/i18n/conf/fr.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
* The latest code can be found at <http://pyd.io/>.
2020
*/
2121
$mess=array(
22-
"Compression/Extraction Plugin" => "Plugin Compression/Extraction",
23-
"Compress or extract some files." => "Archive vos fichiers selectionner ou extrait vos archives selectionner.",
22+
"Tar Archives Support" => "Tar Archives Support",
23+
"Create and extract tar, tar.gz and tar.bz2 archives." => "Create and extract tar, tar.gz and tar.bz2 archives.",
2424
);

core/src/plugins/action.compression/res/i18n/conf/it.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
* The latest code can be found at <http://pyd.io/>.
2020
*/
2121
$mess=array(
22-
"Compression/Extraction Plugin" => "Plugin compressione/estrazione",
23-
"Compress or extract some files." => "Comprime od estrae alcuni file.",
22+
"Tar Archives Support" => "Tar Archives Support",
23+
"Create and extract tar, tar.gz and tar.bz2 archives." => "Create and extract tar, tar.gz and tar.bz2 archives.",
2424
);

core/src/plugins/action.compression/res/i18n/en.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
$mess = array(
2525
"1" => "Compress",
26-
"2" => "Compress selected files",
27-
"3" => "Compress the selected files in ",
26+
"2" => "Compress Selection",
27+
"3" => "Select the format of the archive:",
2828
"4" => "Archive's name :",
2929
"5" => "Starting compression...",
3030
"6" => "Adding files in the archive... %s ",
@@ -35,7 +35,7 @@
3535
"11" => "Path of the extracted files ",
3636
"12" => "Starting extraction...",
3737
"13" => "Extracting files ... %s ",
38-
"14" => "Extraction finished successfullly in the folder '%s' !!",
39-
"15" => "The selected file is't a TAR, TAR.GZ or TAR.BZ2 archive !!",
40-
"16" => "You can only compress in TAR, TAR.GZ or TAR.BZ2 !!",
38+
"14" => "Extraction finished successfullly in the folder '%s'.",
39+
"15" => "The selected file is neither a TAR or a TAR.GZ or a TAR.BZ2 archive.",
40+
"16" => "You can only compress in TAR, TAR.GZ or TAR.BZ2."
4141
);

0 commit comments

Comments
 (0)