This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
/
manifest.xml
152 lines (150 loc) · 9.25 KB
/
manifest.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?xml version="1.0" encoding="UTF-8"?>
<ajxp_plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd"
name="compression" enabled="true" label="CONF_MESSAGE[Tar Archives Support]"
description="CONF_MESSAGE[Create and extract tar, tar.gz and tar.bz2 archives.]" >
<client_settings>
<resources>
<i18n namespace="compression" path="plugins/action.compression/res/i18n"/>
</resources>
</client_settings>
<registry_contributions>
<extensions>
<extension mime="tar" font="archive" icon="archive.png" messageId="61"/>
<extension mime="bz2" font="archive" icon="archive.png" messageId="61"/>
</extensions>
<actions>
<action name="compression">
<processing>
<serverCallback methodName="receiveAction"/>
</processing>
</action>
<action name="compress_ui">
<processing>
<clientCallback prepareModal="true"><![CDATA[
var crtDir = pydio.getContextHolder().getContextNode().getPath();
var userSelection = pydio.getUserSelection();
if (!userSelection.isEmpty()) {
var loadFunc = function (oForm) {
if (userSelection.isEmpty()) {
return;
}
var archive_nameInput = oForm.down('input[id="archive_name"]');
var changeDuplicateArchiveName = function (name, extension) {
var nameLastIndexOf = name.lastIndexOf("-");
var tmpFileName = name.substr(0, nameLastIndexOf);
var compteurFileName = name.substr(nameLastIndexOf + 1);
if (nameLastIndexOf == -1) {
tmpFileName = name;
compteurFileName = 1;
}
while(userSelection.fileNameExists(name + extension)){
name = tmpFileName + "-" + compteurFileName;
compteurFileName ++;
}
archive_nameInput.setValue(name + extension);
return name;
};
var archive_name = archive_nameInput.getValue();
var archiveTypeSelect = oForm.down('select[id="type_archive"]');
if(window.multipleFilesDownloadEnabled){
archiveTypeSelect.insert({top:'<option value=".zip">ZIP</option>'});
}
var archiveExtension = archiveTypeSelect.getValue();
if (userSelection.isUnique()) {
if (userSelection.getUniqueNode().isLeaf() == true) {
archive_name = getBaseName(userSelection.getUniqueFileName()).split(".").shift();
} else {
archive_name = getBaseName(userSelection.getUniqueFileName());
}
} else if (crtDir.length == 1) {
archive_name = "Archive";
} else {
archive_name = getBaseName(crtDir);
}
var updateFormAndArchiveName = function (){
var archiveExtension = archiveTypeSelect.getValue();
if(archiveExtension == ".zip"){
oForm.setAttribute("action", "compress");
oForm.down("#compression_form").setAttribute("action", "compress");
oForm.down('input[name="get_action"]').value = "compress";
}else{
oForm.setAttribute("action", "compression");
oForm.down("#compression_form").setAttribute("action", "compression");
oForm.down('input[name="get_action"]').value = "compression";
}
changeDuplicateArchiveName(archive_name, archiveExtension);
};
updateFormAndArchiveName();
archiveTypeSelect.observe("change", updateFormAndArchiveName);
archive_nameInput.observe("change", function () {
archive_name = archive_nameInput.getValue().slice(0, -archiveTypeSelect.getValue().length);
changeDuplicateArchiveName(archive_name, archiveTypeSelect.getValue());
});
};
var closeFunc = function(){
userSelection.updateFormOrUrl(modal.getForm());
PydioApi.getClient().submitForm(modal.getForm(), true);
hideLightBox();
};
modal.showDialogForm('Compress selection to ...', 'compression_form', loadFunc, closeFunc);
}
]]></clientCallback>
<clientForm id="compression_form"><![CDATA[
<div id="compression_form" action="compression" box_width="272">
<label class="dialogLegend" id="type_archive" style="display: inline-block;margin-top: 11px;">AJXP_MESSAGE[compression.3]</label>
<select style="width:100px;" name="type_archive" id="type_archive" class="dialogFocus initFicName">
<option value=".tar">TAR</option>
<option value=".tar.gz">TAR.GZ</option>
<option value=".tar.bz2">TAR.BZ2</option>
</select>
<br/>
<label class="dialogLegend" for="archive_name" style="display: inline-block;margin-top: 11px;">AJXP_MESSAGE[compression.4]</label>
<br/>
<input style="width: 93%;margin-left: 9px;margin-top: 7px; margin-bottom:12px;" type="text" name="archive_name" id="archive_name" class="dialogFocus initFicName" />
</div>
]]></clientForm>
</processing>
</action>
<action name="check_compression_status">
<processing>
<serverCallback methodName="receiveAction"/>
</processing>
</action>
<action name="extraction">
<gui text="compression.9" title="compression.10" src="archive_insert.png" iconClass="icon-briefcase" accessKey="" hasAccessKey="false">
<context selection="true" dir="true" recycle="hidden"
actionBar="true" contextMenu="true" infoPanel="false"
actionBarGroup="change" inZip="false">
</context>
<selectionContext dir="false" file="true" recycle="false" unique="true" allowedMimes="tar,gz,bz2"/>
</gui>
<processing>
<clientCallback prepareModal="false"><![CDATA[
var crtDir = pydio.getContextHolder().getContextNode().getPath();
var userSelection = pydio.getUserSelection();
if (!userSelection.isEmpty()) {
var file = userSelection.getFileNames();
var dir = userSelection.getContextNode().getPath();
var connexion = new Connexion();
connexion.setParameters({get_action : "extraction", file : file, currentDir : dir});
connexion.sendAsync();
connexion.onComplete=function(transport){
PydioApi.getClient().parseXmlMessage(transport.responseXML);
};
}
]]></clientCallback>
<serverCallback methodName="receiveAction" pluginId="action.compression" />
</processing>
</action>
<action name="check_extraction_status">
<processing>
<serverCallback methodName="receiveAction"/>
</processing>
</action>
</actions>
</registry_contributions>
<class_definition filename="plugins/action.compression/class.PluginCompression.php" classname="PluginCompression"/>
<dependencies>
<activePlugin pluginName="access.fs"/>
</dependencies>
</ajxp_plugin>