home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 May
/
CMCD0505.ISO
/
Software
/
Shareware
/
Programare
/
bugzero
/
jsp
/
trigger.jsp
< prev
next >
Wrap
Text File
|
2004-12-10
|
6KB
|
140 lines
<%@ page
import="com.websina.bean.*,com.websina.util.*,com.websina.util.log.Log"
%>
<html>
<head>
<head><title>Email Notification Configuration</title>
<script LANGUAGE="JavaScript" src="script/trigger.js"></script>
</head>
<body topmargin=0>
<%@ include file="_header.jspf" %>
<%
String title = label.get("prefs_email_notification");
String[] triggers = EmailTrigger.load(person);
String name = request.getParameter("name");
String action = request.getParameter("action");
if (action == null) {
action = "";
} else if (action.equals("create") && name != null) {
for (int i=0; i<triggers.length; i++) {
if (name.equalsIgnoreCase(triggers[i])) {
action = "edit";
name = triggers[i];
break;
}
}
}
%>
<center>
<%-- the title part --%>
<table bgcolor="#ffffff" cellpadding=0 cellspacing=0 border=0>
<tr><td align=center height=30><font size=+1><b><%=title%></b></font></td></tr>
</table>
<% String msg = request.getParameter("msg");
if (msg != null) { %>
<p><font color=red><b><%=msg%></b></font>
<% } %>
<form name="triggerForm" method="post" action="<%=contextPath%>/servlet/trigger" onSubmit="return false;">
<input type="hidden" name="action" value="<%=action%>">
<input type="hidden" name="name" value="<%=name%>">
<%-- the trigger list part --%>
<% if (triggers.length > 0) { %>
<table cellpadding=2 cellspacing=1 border=0 class="box">
<tr class="header"><td colspan=2>
<%=label.get("current_triggers")%>
</td></tr>
<% for (int i=0; i<triggers.length; i++) { %>
<tr><td class="e8" width=50%><%=triggers[i]%></td>
<td class="f1" align=center>
<nobr>
<input class="button" type="button" value="<%=label.get("edit_button")%>"
onClick="location.href='trigger.jsp?action=edit&name='+<%=escape%>('<%=triggers[i]%>');">
<input class="button" type="button" value="<%=label.get("delete_button")%>"
onClick="if (confirm('<%=label.getEscaped("delete_confirmation")%> <%=triggers[i]%>')){
delete_trigger(triggerForm, '<%=triggers[i]%>');}">
</nobr>
</td></tr>
<% } %>
</table>
<p>
<% } %>
<% if (name == null) { %>
<table bgcolor="#ffffff" cellpadding=2 cellspacing=2 border=0>
<tr><td colspan=2><%=label.get("add_trigger")%></td><td>
<tr><td><input type=text size=40 maxlength=255 name=new_name></td><td>
<input class="button" type="button" value="<%=label.get("add_button")%>"
onClick="
if(isEmpty(triggerForm.new_name,'You need enter a name for the trigger'))return false;
location.href='trigger.jsp?action=create&name='+<%=escape%>(triggerForm.new_name.value);">
</td></tr></table>
<% } else {
String projectId = person.getProject();
String group = person.getGroup();
Project conf = Project.getInstance(projectId);
String[] optionList;
com.websina.util.Field field;
EmailTrigger trigger = new EmailTrigger(person, name);
trigger.load();
%>
<p>
<b><%=name%></b>
<p>
<table cellpadding=2 cellspacing=1 border=0 class="box">
<tr><td colspan=2><font size="-1" color="#555555"><b><%=label.get("define_trigger")%></b></font>
</td></tr>
<% if (conf.isFieldEnabled("author", group) && !Group.getInstance().isGuest(group)) { %>
<tr><td class="e8"><%=label.get("author", projectId)%></td>
<td class="f1"><select name=author size=3 multiple>
<%=ListMaker.makeOptionList(conf.getAccess().getAuthors(), trigger.get(0)) %>
</select> </td></tr>
<% } else { %>
<input type="hidden" name=author value="<%=person.getUsername()%>">
<% } %>
<% if (conf.isFieldEnabled("responsible", group)) { %>
<tr><td class="e8"><%=label.get("responsible", projectId)%></td>
<td class="f1"><select name=responsible size=3 multiple>
<%=ListMaker.makeOptionList(conf.getAccess().getUsers("edit", "editasgn"), trigger.get(1)) %>
</select></td></tr>
<% } %>
<tr><td class="e8"><%=label.get("assignable", projectId)%></td>
<td class="f1"><select name=assignable size=3 multiple>
<%=ListMaker.makeOptionList(conf.getField("assignable").getValue(), trigger.get(2)) %>
</select></td></tr>
<tr><td class="e8"><%=label.get("state", projectId)%></td>
<td class="f1"><select name=state size=3 multiple>
<%=ListMaker.makeOptionList(conf.getField("state").getValue(), trigger.get(3)) %>
</select></td></tr>
<% if( conf.isFieldEnabled("category", group) && (field=conf.getField("category")) != null && (optionList=field.getValue()) != null) { %>
<tr><td class="e8"><%=label.get("category", projectId)%></td>
<td class="f1"><select name=category size=3 multiple>
<%=ListMaker.makeOptionList(optionList, trigger.get(4)) %>
</select> </td></tr>
<% } %>
<% if( conf.isFieldEnabled("severity", group) && (field=conf.getField("severity")) != null && (optionList=field.getValue()) != null) { %>
<tr><td class="e8"><%=label.get("severity", projectId)%></td>
<td class="f1"><select name=severity size=3 multiple>
<%=ListMaker.makeOptionList(optionList, trigger.get(5)) %>
</select></td></tr>
<% } %>
<% if( conf.isFieldEnabled("priority", group) && (field=conf.getField("priority")) != null && (optionList=field.getValue()) != null) { %>
<tr><td class="e8"><%=label.get("priority", projectId)%></td>
<td class="f1"><select name=priority size=3 multiple>
<%=ListMaker.makeOptionList(optionList, trigger.get(6)) %>
</select></td></tr>
<% } %>
<tr><td colspan=2 align=center width=320>
<input class="button" type="button" value="<%=label.get("save_button")%>"
onClick="this.disabled=true; submit();">
<input class="button" type="button" value="<%=label.get("cancel_button")%>"
onClick="location.href='trigger.jsp';">
</td></tr>
</table>
<% } %>
</form>
</center>
</body>
</html>