Skip to content

Dev #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 9, 2020
Merged

Dev #111

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions iwsy/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
rest get Script from `/resources/ecs/iwsy.txt?v=` cat now
run Script
</pre>

</body>
</html>
6 changes: 4 additions & 2 deletions iwsy/resources/ecs/fileman.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
variable Content
variable Home
variable UserRecord
variable Email
variable Password
variable CurrentPath
variable FilePath
variable Path
Expand Down Expand Up @@ -120,7 +122,7 @@ Show:

! Build the list
Browser:
rest get Content from `list/` cat CurrentPath
rest get Content from `ulist/` cat Email can `/` cat Password cat `/` cat CurrentPath cat `?v=` cat now
or begin
alert `Failed to list files.`
stop
Expand Down Expand Up @@ -222,7 +224,7 @@ SelectFile:
set style `display` of Scroller to `none`
set style `display` of Image to `block`
put CurrentPath cat `/` cat property `name` of File into FilePath
set attribute `src` of Image to `/resources/` cat FilePath
set attribute `src` of Image to `/resources/` cat FilePath cat `?v=` cat now
on click CloseButton go to CloseMedia
set the text of URL to `/resources/` cat FilePath
! highlight URL
Expand Down
32 changes: 22 additions & 10 deletions iwsy/resources/ecs/iwsy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
variable Script
variable Presentation
variable Name
variable CurrentName
variable ShowRun
variable ReadOnly
variable CallStack
Expand All @@ -56,6 +55,8 @@
variable Running
variable UserRecord
variable UserHome
variable UserEmail
variable UserPassword
variable N

! The browser
Expand All @@ -68,7 +69,6 @@
button CloseButton
a FileName
variable Alpha
variable List
variable FileList
variable FileCount
variable File
Expand All @@ -77,7 +77,7 @@

! Test if site is on a static host
clear ReadOnly
rest get List from `list/scripts`
rest get Item from `test`
or begin
print `Static site`
set ReadOnly
Expand Down Expand Up @@ -257,7 +257,6 @@ L2:

on click New
begin
! gosub to StopTestModule
if Presentation is not LastSavedState
begin
if confirm `Content has changed. Do you want to save it?`
Expand All @@ -269,8 +268,8 @@ L2:
set the content of Status to `No script name has been given`
go to ResetStatus
end
if UserRecord rest post Presentation to `save/` cat `users/` cat UserHome cat `/` cat Name
else put Presentation into storage as CurrentName
if UserRecord gosub to SavePresentation
else put Presentation into storage as Name
end
end
clear FileIsOpen
Expand Down Expand Up @@ -303,7 +302,7 @@ L2:
begin
put Presentation into Content
json format Content
rest post Content to `save/` cat `users/` cat `users/` cat UserHome cat `/` cat Name
gosub to SavePresentation
end
else put Presentation into storage as Name
put Presentation into LastSavedState
Expand Down Expand Up @@ -331,7 +330,7 @@ L2:
end
if confirm `Are you sure you want to delete "` cat Name cat `"?`
begin
if UserRecord rest post to `delete/` cat `users/` cat UserHome cat `/` cat Name
if UserRecord gosub to DeletePresentation
else remove Name from storage
gosub to SetStatusGreen
set the content of Status to `Script "` cat Name cat `" deleted`
Expand Down Expand Up @@ -417,9 +416,11 @@ L2:
else if Action is `user`
begin
put property `user` of Message into UserRecord
print UserRecord
put UserRecord into storage as `.user`
put property `home` of UserRecord into UserHome
put UserHome cat `/` cat property `id` of UserRecord into UserHome
put property `email` of UserRecord into UserEmail
get UserPassword from storage as `password`
set attribute `src` of User to `resources/icon/user-loggedin.png`
set attribute `title` of User to `Logged in as ` cat property `name` of UserRecord
gosub to SetStatusGreen
Expand All @@ -429,6 +430,16 @@ print UserRecord
end
stop

SavePresentation:
rest post Content to `usave/` cat UserEmail cat `/` cat UserPassword cat `/`
cat `users/` cat UserHome cat `/scripts/` cat Name
return

DeletePresentation:
rest post Content to `udelete/` cat UserEmail cat `/` cat UserPassword cat `/`
cat `users/` cat UserHome cat `/scripts/` cat Name
return

CreateNewPresentation:
set Presentation to object
set Item to array
Expand Down Expand Up @@ -527,7 +538,8 @@ DoOpen:
! Fill the browser with content from the server
if UserRecord
begin
rest get Files from `list/` cat `users/` cat UserHome cat `/scripts`
rest get Files from `ulist/` cat UserEmail cat `/` cat UserPassword cat `/`
cat `users/` cat UserHome cat `/scripts`
put the json count of Files into FileCount
put empty into Content
put 0 into N
Expand Down
8 changes: 4 additions & 4 deletions iwsy/resources/ecs/scripted.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
put the content of ContentEditor into Content
if Content is not Current
begin
rest post Content to `save/ecs/` cat Name
rest post Content to `save/` cat Password cat `/ecs/` cat Name
put Content into Current
set the content of Status to `Script '` cat Name cat `' saved`
fork to ResetStatus
Expand All @@ -155,7 +155,7 @@
if confirm `Are you sure you want to delete '` cat Name cat `'?`
begin
codemirror close ContentEditor
rest post to `delete/ecs/` cat Name
rest post to `delete/` cat Password cat `/ecs/` cat Name
set the content of Status to `Script '` cat Name cat `' deleted`
set the content of NameEditor to empty
put empty into Content
Expand All @@ -173,7 +173,7 @@ DoOpen:
begin
if confirm `Content has changed. Do you want to save it?`
begin
rest post Content to `save/ecs/' cat CurrentName
rest post Content to `save/` cat Password cat `/ecs/' cat CurrentName
codemirror attach to ContentEditor
codemirror set content of ContentEditor to Content
end
Expand Down Expand Up @@ -201,7 +201,7 @@ DoOpen:
set style `display` of FileListing to `inline-block`

! Fill the browser with content from the server
rest get Files from `list/ecs?v=` cat now
rest get Files from `list/` cat Password cat `/ecs?v=` cat now
put the json count of Files into FileCount
put empty into Content
put 0 into N
Expand Down
1 change: 0 additions & 1 deletion iwsy/resources/ecs/user.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ ProcessLogin:
if Record is empty go to NoRecord
if property `email` of Record is not EmailInput go to NoRecord
put property `password` of Record into Password
replace `/` with `~` in Password
rest get Validated from `validate/` cat Password cat `/` cat PasswordInput
if Validated is `yes`
begin
Expand Down
Loading