home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 May / CMCD0505.ISO / Software / Shareware / Programare / bugzero / jsp / trigger.jsp < prev    next >
Text File  |  2004-12-10  |  6KB  |  140 lines

  1. <%@ page
  2.     import="com.websina.bean.*,com.websina.util.*,com.websina.util.log.Log"
  3. %>
  4. <html>
  5. <head>
  6. <head><title>Email Notification Configuration</title>
  7. <script LANGUAGE="JavaScript" src="script/trigger.js"></script>
  8. </head>
  9. <body topmargin=0>
  10. <%@ include file="_header.jspf" %>
  11. <%      
  12.   String title = label.get("prefs_email_notification");
  13.   String[] triggers = EmailTrigger.load(person);
  14.   String name = request.getParameter("name");
  15.   String action = request.getParameter("action");
  16.   if (action == null) {
  17.     action = "";
  18.   } else if (action.equals("create") && name != null) {
  19.     for (int i=0; i<triggers.length; i++) {
  20.       if (name.equalsIgnoreCase(triggers[i])) {
  21.          action = "edit";
  22.          name = triggers[i]; 
  23.          break;
  24.       }
  25.     }
  26.   }
  27. %>
  28. <center>
  29. <%-- the title part --%>
  30. <table bgcolor="#ffffff" cellpadding=0 cellspacing=0 border=0>
  31.   <tr><td align=center height=30><font size=+1><b><%=title%></b></font></td></tr>
  32. </table>
  33.  
  34. <% String msg = request.getParameter("msg");
  35.    if (msg != null) { %>
  36. <p><font color=red><b><%=msg%></b></font>
  37. <% } %>
  38.  
  39. <form name="triggerForm" method="post" action="<%=contextPath%>/servlet/trigger" onSubmit="return false;">
  40. <input type="hidden" name="action" value="<%=action%>">
  41. <input type="hidden" name="name" value="<%=name%>">
  42. <%-- the trigger list part --%>
  43. <% if (triggers.length > 0) { %>
  44. <table cellpadding=2 cellspacing=1 border=0 class="box">
  45. <tr class="header"><td colspan=2>
  46. <%=label.get("current_triggers")%> 
  47. </td></tr>
  48. <% for (int i=0; i<triggers.length; i++) { %>
  49. <tr><td class="e8" width=50%><%=triggers[i]%></td>
  50. <td class="f1" align=center>
  51. <nobr>
  52. <input class="button" type="button" value="<%=label.get("edit_button")%>" 
  53. onClick="location.href='trigger.jsp?action=edit&name='+<%=escape%>('<%=triggers[i]%>');">
  54. <input class="button" type="button" value="<%=label.get("delete_button")%>" 
  55. onClick="if (confirm('<%=label.getEscaped("delete_confirmation")%>  <%=triggers[i]%>')){
  56. delete_trigger(triggerForm, '<%=triggers[i]%>');}">
  57. </nobr>
  58. </td></tr>
  59. <% } %>
  60. </table>
  61. <p>
  62. <% } %>
  63.  
  64. <% if (name == null) { %>
  65. <table bgcolor="#ffffff" cellpadding=2 cellspacing=2 border=0>
  66. <tr><td colspan=2><%=label.get("add_trigger")%></td><td>
  67. <tr><td><input type=text size=40 maxlength=255 name=new_name></td><td>
  68. <input class="button" type="button" value="<%=label.get("add_button")%>" 
  69. onClick="
  70. if(isEmpty(triggerForm.new_name,'You need enter a name for the trigger'))return false;
  71. location.href='trigger.jsp?action=create&name='+<%=escape%>(triggerForm.new_name.value);">
  72. </td></tr></table>
  73. <% } else { 
  74.   String projectId = person.getProject();
  75.   String group = person.getGroup();
  76.   Project conf = Project.getInstance(projectId);
  77.   String[] optionList;
  78.   com.websina.util.Field field;
  79.   EmailTrigger trigger = new EmailTrigger(person, name);
  80.   trigger.load();
  81. %>
  82. <p>
  83. <b><%=name%></b>
  84. <p>
  85. <table cellpadding=2 cellspacing=1 border=0 class="box">
  86. <tr><td colspan=2><font size="-1" color="#555555"><b><%=label.get("define_trigger")%></b></font>
  87. </td></tr>
  88.    <% if (conf.isFieldEnabled("author", group) && !Group.getInstance().isGuest(group)) { %>
  89.     <tr><td class="e8"><%=label.get("author", projectId)%></td>
  90.     <td class="f1"><select name=author size=3 multiple> 
  91.        <%=ListMaker.makeOptionList(conf.getAccess().getAuthors(), trigger.get(0)) %>
  92.         </select> </td></tr>
  93.   <% } else { %>
  94.     <input type="hidden" name=author value="<%=person.getUsername()%>">
  95.   <% } %>
  96.   <% if (conf.isFieldEnabled("responsible", group)) { %>
  97.     <tr><td class="e8"><%=label.get("responsible", projectId)%></td>
  98.     <td class="f1"><select name=responsible size=3 multiple>
  99.         <%=ListMaker.makeOptionList(conf.getAccess().getUsers("edit", "editasgn"), trigger.get(1)) %>
  100.         </select></td></tr>
  101.   <% } %>
  102.     <tr><td class="e8"><%=label.get("assignable", projectId)%></td>
  103.     <td class="f1"><select name=assignable size=3 multiple>
  104.         <%=ListMaker.makeOptionList(conf.getField("assignable").getValue(), trigger.get(2)) %>
  105.         </select></td></tr>
  106.     <tr><td class="e8"><%=label.get("state", projectId)%></td>
  107.     <td class="f1"><select name=state size=3 multiple>
  108.         <%=ListMaker.makeOptionList(conf.getField("state").getValue(), trigger.get(3)) %>
  109.         </select></td></tr>
  110.   <% if( conf.isFieldEnabled("category", group) && (field=conf.getField("category")) != null && (optionList=field.getValue()) != null) { %>
  111.     <tr><td class="e8"><%=label.get("category", projectId)%></td>
  112.     <td class="f1"><select name=category size=3 multiple> 
  113.        <%=ListMaker.makeOptionList(optionList, trigger.get(4)) %>
  114.         </select> </td></tr>
  115.   <% } %>
  116.   <% if( conf.isFieldEnabled("severity", group) && (field=conf.getField("severity")) != null && (optionList=field.getValue()) != null) { %>
  117.     <tr><td class="e8"><%=label.get("severity", projectId)%></td>
  118.     <td class="f1"><select name=severity size=3 multiple>
  119.         <%=ListMaker.makeOptionList(optionList, trigger.get(5)) %>
  120.         </select></td></tr>
  121.   <% } %>
  122.   <% if( conf.isFieldEnabled("priority", group) && (field=conf.getField("priority")) != null && (optionList=field.getValue()) != null) { %>
  123.     <tr><td class="e8"><%=label.get("priority", projectId)%></td>
  124.     <td class="f1"><select name=priority size=3 multiple>
  125.         <%=ListMaker.makeOptionList(optionList, trigger.get(6)) %>
  126.         </select></td></tr>
  127.   <% } %>
  128. <tr><td colspan=2 align=center width=320>
  129. <input class="button" type="button" value="<%=label.get("save_button")%>"
  130. onClick="this.disabled=true; submit();">
  131. <input class="button" type="button" value="<%=label.get("cancel_button")%>"
  132. onClick="location.href='trigger.jsp';">
  133. </td></tr>
  134. </table>
  135. <% } %>
  136. </form>
  137. </center>
  138.  
  139. </body>
  140. </html>