35
35
variable UserRecord
36
36
variable Email
37
37
variable Password
38
+ variable AdminPassword
38
39
variable CurrentPath
39
40
variable FilePath
40
41
variable Path
41
42
variable N
42
43
variable Even
44
+ variable Args
45
+ variable Protocol
46
+ variable Domain
47
+ variable Properties
48
+ variable UserPath
49
+ variable Resources
50
+ variable Message
51
+ variable Post
52
+
53
+ json parse url the location as Args
54
+ put property `protocol` of Args into Protocol
55
+ put property `domain` of Args into Domain
56
+ rest get Properties from Protocol cat Domain cat `/easycoder-properties.json`
57
+ put property `path` of Properties into UserPath
58
+ put property `resources` of Properties into Resources
59
+ if Resources is empty put `resources` into Resources
43
60
44
61
if portrait
45
62
begin
122
139
Show:
123
140
set style `display` of Container to `block`
124
141
125
- get UserRecord from storage as `.user`
126
- put property `email` of UserRecord into Email
127
- get Password from storage as `user.password`
128
- put property `home` of UserRecord into Home
129
- put Home cat `/` cat property `id` of UserRecord cat `/images` into Home
130
- put `users/` cat Home into Home
142
+ if UserPath
143
+ begin
144
+ put UserPath cat `/images` into Home
145
+ end
146
+ else
147
+ begin
148
+ get UserRecord from storage as `.user`
149
+ put property `email` of UserRecord into Email
150
+ get Password from storage as `user.password`
151
+ put property `home` of UserRecord into Home
152
+ put Home cat `/` cat property `id` of UserRecord cat `/images` into Home
153
+ put `users/` cat Home into Home
154
+ end
131
155
get CurrentPath from storage as `.filepath`
132
156
if CurrentPath is empty put Home into CurrentPath
157
+ get AdminPassword from storage as `.password`
133
158
134
159
! Build the list
135
160
Browser:
136
161
put CurrentPath into storage as `.filepath`
137
- rest get Content from `ulist/` cat Email cat `/` cat Password cat `/` cat CurrentPath cat `?v=` cat now
138
- or begin
139
- alert `Failed to list files.`
140
- put empty into storage as `.filepath`
141
- go to Show
162
+ if UserPath
163
+ begin
164
+ if AdminPassword is empty
165
+ begin
166
+ set Message to object
167
+ set property `Action` of Message to `password`
168
+ send Message to parent
169
+ stop
170
+ end
171
+ rest get Content from `list/` cat AdminPassword cat `/` cat CurrentPath cat `?v=` cat now
172
+ or begin
173
+ alert `Failed to list files.`
174
+ put empty into storage as `.filepath`
175
+ stop
176
+ end
177
+ end
178
+ else
179
+ begin
180
+ rest get Content from `ulist/` cat Email cat `/` cat Password cat `/` cat CurrentPath cat `?v=` cat now
181
+ or begin
182
+ alert `Failed to list files.`
183
+ put empty into storage as `.filepath`
184
+ stop
185
+ end
142
186
end
143
187
put CurrentPath into Path
144
188
set the content of Location to `Current path: ` cat Path
@@ -199,7 +243,9 @@ Browser:
199
243
if FileCount is 0
200
244
begin
201
245
put Path into CurrentPath
202
- rest post to `udelete/` cat Email cat `/` cat Password cat `/` cat CurrentPath or
246
+ if UserPath put `delete/` cat AdminPassword cat `/` cat CurrentPath into Post
247
+ else put `udelete/` cat Email cat `/` cat Password cat `/` cat CurrentPath into Post
248
+ rest post to Post or
203
249
begin
204
250
alert `Failed to delete a file.`
205
251
stop
@@ -240,12 +286,14 @@ SelectFile:
240
286
set the text of URL to `resources/` cat FilePath
241
287
on click DeleteButton
242
288
begin
243
- rest post to `udelete/` cat Email cat `/` cat Password cat `/` cat FilePath or
244
- begin
245
- alert `Failed to delete the image.`
246
- stop
247
- end
248
- go to CloseMedia
289
+ if UserPath put `delete/` cat AdminPassword cat `/` cat FilePath into Post
290
+ else put `udelete/` cat Email cat `/` cat Password cat `/` cat FilePath into Post
291
+ rest post to Post or
292
+ begin
293
+ alert `Failed to delete the image.`
294
+ stop
295
+ end
296
+ go to CloseMedia
249
297
end
250
298
end
251
299
stop
@@ -267,12 +315,13 @@ Upload:
267
315
else
268
316
begin
269
317
put CurrentPath into Path
270
- put `upload/` cat Email cat `/` cat Password cat `/` cat Path into Path
318
+ if UserPath put `upload/` cat AdminPassword cat `/` cat Path into Path
319
+ else put `uupload/` cat Password cat `/` cat Email cat `/` cat Password cat `/` cat Path into Path
271
320
upload UploadFile to Path with UploadProgress and UploadStatus
272
321
goto Browser
273
322
end
274
323
stop
275
324
276
325
Exit:
277
326
set style `display` of Container to `none`
278
- stop
327
+ stop
0 commit comments