X-Git-Url: http://git.hcoop.net/hcoop/zz_old/portal.git/blobdiff_plain/184f6cde4a5968a170f879052e127b1994952004..HEAD:/issue.mlt diff --git a/issue.mlt b/issue.mlt index 48c78ef..f8a7230 100644 --- a/issue.mlt +++ b/issue.mlt @@ -12,14 +12,15 @@ ref showNormal = true; if $"cmd" = "new" then showNormal := false %> -

New issue

+

New issue

-
+ - - - +
Title:
Only make this issue accessible to the admins for this support category.
+ + +
Title:
Only make this issue accessible to the admins for this support category.
Description:
@@ -27,39 +28,64 @@ if $"cmd" = "new" then <% elseif $"cmd" = "add" then val title = $"title"; if not (Support.validTitle title) then - %>

Invalid title

<% + %>

Invalid title

<% else val id = Support.addIssue (you, catId, title, $"priv" = "on", Support.NEW); + val _ = Support.addPost (you, id, $"body"); + if not (Support.notifyCreation id) then + %>

Error sending e-mail notification

<% + end; viewingIssue := SOME id end -elseif $"mod" <> "" then +elseif $"cmd" = "list" then + showNormal := false %> +

All issues

+ + +<% foreach (name, issue) in Support.listCategoryIssues catId do + if (iff admin then true else (iff #priv issue then (#usr issue = you) else true)) then %> + + + + +<% end +end %> +
<% Web.html (#title issue) %> +<% if #priv issue then %>(private)<% end %> + <% name %><% #stamp issue %><% switch #status issue of + Support.NEW => %>New<% + | Support.PENDING => %>Pending<% + | Support.CLOSED => %>Closed<% + end %>
+ +<% elseif $"mod" <> "" then showNormal := false; val id = Web.stoi ($"mod"); val issue = Support.lookupIssue id; if catId <> #cat issue then - %>

Inconsistent cat field

<% + %>

Inconsistent cat field

<% elseif not admin then - %>

You aren't authorized to modify that.

<% + %>

You aren't authorized to modify that.

<% else %> -

Modify issue

+

Modify issue

-
+ - -
Category: + - - - + + - +
Category:
Title:
checked<% end %>> Only make this issue accessible to the admins for this support category.
Status:
Title:
checked<% end %>> Only make this issue accessible to the admins for this support category.
Status:
<% end @@ -68,26 +94,34 @@ elseif $"save" <> "" then val id = Web.stoi ($"save"); val issue = Support.lookupIssue id; val title = $"title"; + val oldStatus = #status issue; val status = Web.stoi ($"status"); val newCat = Support.lookupCategory (Web.stoi ($"newCat")); if catId <> #cat issue then - %>

Inconsistent cat field

<% + %>

Inconsistent cat field

<% elseif (iff admin then not (Group.inGroupNum (#grp newCat)) else false) then - %>

Authorization failure

<% + %>

Authorization failure

<% elseif not (Support.validTitle title) then - %>

Invalid title

<% + %>

Invalid title

<% elseif (iff status < 0 then false else status > 2) then - %>

Invalid status

<% + %>

Invalid status

<% else + val status = (case status of + 0 => Support.NEW + | 1 => Support.PENDING + | _ => Support.CLOSED); + Support.modIssue {issue with cat = #id newCat, title = title, priv = ($"priv" = "on"), - status = (case status of - 0 => Support.NEW - | 1 => Support.PENDING - | _ => Support.CLOSED)}; + status = status}; + if status <> oldStatus then + if not (Support.notifyStatus (you, oldStatus, status, id)) then + %>

Error sending e-mail notification

<% + end + end; viewingIssue := SOME id - %>

Issue saved

Issue saved "" then @@ -96,11 +130,11 @@ elseif $"del" <> "" then val issue = Support.lookupIssue id; if catId <> #cat issue then - %>

Inconsistent cat field

<% + %>

Inconsistent cat field

<% elseif not admin then - %>

Authorization failure

<% + %>

Authorization failure

<% else - %>

Are you sure you want to delete "<% Web.html (#title issue) %>"?

+ %>

Are you sure you want to delete "<% Web.html (#title issue) %>"?

Yes, delete "<% Web.html (#title issue) %>"!<% end @@ -109,12 +143,95 @@ elseif $"del2" <> "" then val issue = Support.lookupIssue id; if catId <> #cat issue then - %>

Inconsistent cat field

<% + %>

Inconsistent cat field

<% elseif not admin then - %>

Authorization failure

<% + %>

Authorization failure

<% else Support.deleteIssue id - %>

Issue "<% Web.html (#title issue) %>" deleted

<% + %>

Issue "<% Web.html (#title issue) %>" deleted

<% + end + +elseif $"cmd" = "post" then + val id = Web.stoi ($"iss"); + viewingIssue := SOME id; + val issue = Support.lookupIssue id; + + if catId <> #cat issue then + %>

Inconsistent cat field

<% + elseif not (Support.allowedToSee id) then + %>

Authorization failure

<% + else + val id = Support.addPost (you, id, $"body"); + if not (Support.notifyPost id) then + %>

Error sending e-mail notification

<% + end + %>

Posted

<% + end + +elseif $"modPost" <> "" then + showNormal := false; + val id = Web.stoi ($"modPost"); + val post = Support.lookupPost id; + val issue = Support.lookupIssue (#iss post); + if catId <> #cat issue then + %>

Inconsistent cat field

<% + elseif not admin then + %>

You aren't authorized to modify that.

<% + else %> +

Modify post

+ +
+ + + + +
+<% end + +elseif $"savePost" <> "" then + val id = Web.stoi ($"savePost"); + val post = Support.lookupPost id; + val issue = Support.lookupIssue (#iss post); + + if catId <> #cat issue then + %>

Inconsistent cat field

<% + elseif not admin then + %>

Authorization failure

<% + else + Support.modPost {post with body = $"body"}; + viewingIssue := SOME (#iss post) + %>

Post saved "" then + showNormal := false; + val id = Web.stoi ($"delPost"); + val post = Support.lookupPost id; + val issue = Support.lookupIssue (#iss post); + + if catId <> #cat issue then + %>

Inconsistent cat field

<% + elseif not admin then + %>

Authorization failure

<% + else + %>

Are you sure you want to delete this post?

+
<% Web.htmlNl (#body post) %>
+ Yes, delete it!<% + end + +elseif $"delPost2" <> "" then + val id = Web.stoi ($"delPost2"); + val post = Support.lookupPost id; + val issue = Support.lookupIssue (#iss post); + + if catId <> #cat issue then + %>

Inconsistent cat field

<% + elseif not admin then + %>

Authorization failure

<% + else + Support.deletePost id; + viewingIssue := SOME (#iss post) + %>

Post deleted

<% end elseif $"id" <> "" then @@ -124,51 +241,81 @@ end; switch viewingIssue of SOME id => val issue = Support.lookupIssue id; - val canEdit = (iff #usr issue = you then true else admin); - val canView = (iff #priv issue then canEdit else true); + val canEdit = Support.allowedToEdit id; + val canView = Support.allowedToSee id; if catId <> #cat issue then - %>

Inconsistent cat field

<% + %>

Inconsistent cat field

<% elseif not canView then - %>

You aren't authorized to view that.

<% + %>

You aren't authorized to view that.

<% else val user = Init.lookupUser (#usr issue) %> - - - - - -
Title: <% Web.html (#title issue) %>
Created by: <% #name user %>
At: <% #stamp issue %>
Private: <% if #priv issue then %>yes<% else %>no<% end %>
Status: <% switch #status issue of + + + + + + +<% switch #pstamp issue of + SOME stamp => %><% + end; + switch #cstamp issue of + SOME stamp => %><% + end %>
Title: <% Web.html (#title issue) %>
Created by: <% #name user %>
At: <% #stamp issue %>
Private: <% if #priv issue then %>yes<% else %>no<% end %>
Status: <% switch #status issue of Support.NEW => %>New<% | Support.PENDING => %>Pending<% | Support.CLOSED => %>Closed<% end %>
Changed to pending: <% stamp %>
Closed: <% stamp %>
<% if admin then %> Modify this issue
Delete this issue
+<% end; + +foreach (name, post) in Support.listPosts id do %> +


+<% name %> at <% #stamp post %>: +<% if admin then %> +[Modify] +[Delete] +<% end %> + +

<% Web.htmlNl (#body post) %>

+ <% end %> -<% end +


+ +

Post to this thread

+ +
+ + + +
+ +
+ +<% end | NONE => if showNormal then %> -New issue +New issue
+List all issues (including closed issues) -

Open issues

+

Open issues

<% val issues = iff admin then Support.listOpenCategoryIssuesAdmin catId else Support.listOpenCategoryIssues (catId, you); -foreach issue in issues do - val user = Init.lookupUser (#usr issue) %> +foreach (name, issue) in issues do %> - +
<% Web.html (#title issue) %> <% if #priv issue then %>(private)<% end %> <% #name user %><% name %> <% #stamp issue %> <% switch #status issue of Support.NEW => %>New<%