forked from c9/cloud9
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtree.xml
More file actions
141 lines (132 loc) · 6.04 KB
/
Copy pathtree.xml
File metadata and controls
141 lines (132 loc) · 6.04 KB
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
<a:application xmlns:a="http://ajax.org/2005/aml">
<a:script><![CDATA[
function filesort(value, args, xmlNode) {
return (xmlNode.tagName == "folder" ? 0 : 1) + value.toLowerCase();
}
var confirmed = false;
function remove() {
if (!confirmed) {
var files = trFiles.getSelection();
function confirm(file) {
var name = file.getAttribute("name");
require("core/util").question(
"Remove file?",
"You are about to remove the file " + name,
"Do you want continue? (This change cannot be undone)",
function () { // Yes
confirmed = true;
trFiles.remove(file);
confirmed = false;
if (files.length > 0)
confirm(files.shift());
else
winQuestion.hide();
},
function () { // Yes to all
confirmed = true;
trFiles.remove(file);
files.forEach(function (file) {
trFiles.remove(file);
});
confirmed = false;
winQuestion.hide();
},
function () { // No
if (files.length > 0)
confirm(files.shift());
else
winQuestion.hide();
},
function () { // No to all
winQuestion.hide();
}
);
btnQuestionYesToAll.setAttribute("visible", files.length > 0);
btnQuestionNoToAll.setAttribute("visible", files.length > 0);
}
confirm(files.shift());
return false;
} else
return true;
};
function copy(a, b) {
davProject.copy(a, b + /\/[^\/]*$/.exec(a));
};
function move(a, b) {
davProject.move(a, b + /\/[^\/]*$/.exec(a));
};
]]></a:script>
<a:window id="winFilesViewer"
flex = "1"
skin = "fm-window"
title = "Project Files"
modal = "false"
visible = "true"
buttons = "close"
optimize = "true">
<a:button
top="-22"
skin="header-btn"
right="5"
icon="refresh.png"
onclick="require('ext/tree/tree').refresh()" />
<!--a:button skin="header-btn" icon="order.png" top="-22" right="7"></a:button-->
<a:hbox
anchors = "0 0 0 0"
overflow = "hidden"
id = "hboxTrFiles"
class = "hboxTrFiles"
>
<a:tree id="trFiles" canrename="true" border="0"
contextmenu="mnuCtxTree" multiselect="true" reselectable="true"
onbeforeremove="return remove()" disabled="{!stServerConnected.active}"
flex="1"
>
<a:each match="[project|file|folder]" sort="[@name]" sort-method="filesort">
<a:insert match="[folder]" get="{location.host and davProject.readdir([@path])}" />
<a:caption match="[@name]" value="{([../@changed] == 1 ? '*' : '') + [.]}" />
<a:icon match="[folder|project]" value="folder.png" />
<a:icon match="[file]" value="{require('core/util').getFileIcon(%[.])}" />
</a:each>
<a:add type="folder" get="{davProject.mkdir([@path], 'New Folder')}" />
<a:add type="file" get="{davProject.create([@path], 'New File.txt', '')}" />
<a:rename match="[file|folder[not(@path='/workspace')]]" set="{davProject.rename([@name], [@path])}"/>
<a:copy match="[file|folder]" set="{copy([@path], [../@path])}"/>
<a:move set="{move([@path], [../@path])}"/>
<a:remove match="[file|folder]" set="{require('ext/filesystem/filesystem').remove([@path])}"/>
<a:drag match="[folder|file]" />
<a:drop match="[folder|file]" target="[folder]"
action="tree-append" copy="{event.ctrlKey}" />
</a:tree>
<a:scrollbar
for = "trFiles"
id = "sbTrFiles"
margin = "2"
skin = "sbios"
width = "7"
overflow = "auto"
/>
</a:hbox>
<a:menu id="mnuCtxTree" disabled="{!stServerConnected.active}">
<a:item match="[file]" class="strong" onclick="
require('core/ide').dispatchEvent('openfile', {doc: require('core/ide').createDocument(apf.activeElement.selected)})
">Edit</a:item>
<a:divider />
<a:item onclick="require('ext/tree/tree').refresh()">Refresh</a:item>
<a:item match="[file|folder[not(@path='/workspace')]]" onclick="apf.activeElement.startRename()">Rename</a:item>
<a:item match="[file|folder]" onclick="apf.activeElement.remove()">Delete</a:item>
<a:divider />
<a:item match="[file|folder]" onclick="
apf.clipboard.cutSelection(apf.activeElement);
">Cut</a:item>
<a:item match="[file|folder]" onclick="
apf.clipboard.copySelection(apf.activeElement);
">Copy</a:item>
<a:item match="[folder|project]" disabled="{!apf.clipboard.empty}" onclick="
apf.clipboard.pasteSelection(apf.activeElement);
">Paste</a:item>
<a:divider />
<a:item submenu="mnuNew">New</a:item>
</a:menu>
</a:window>
</a:application>