home *** CD-ROM | disk | FTP | other *** search
- <%!
- String[] getOptions(com.websina.bean.Filter filter, String fieldName) {
- if (filter == null) {
- return null;
- } else {
- return filter.getField(fieldName);
- }
- }
-
- String dateOp() {
- return ListMaker.makeOptionList(new String[]{">=", "<", "-"}, new String[]{"after", "before", "between"}, null);
- }
-
- String ageOp() {
- return ListMaker.makeOptionList(new String[]{">=", "<"}, new String[]{"within last", "older than"}, null);
- }
-
- String[] ageUnit() {
- return new String[]{"day", "hour", "week"};
- }
-
- String sortOrder(String order) {
- return ListMaker.makeOptionList(new String[]{"", "A", "D"}, new String[]{"", "ascending", "descending"}, order);
- }
-
- String onClick(Project conf, Person person, String form) {
- StringBuffer buf = new StringBuffer();
- String[] fields = conf.getFields();
- String group = person.getGroup();
- for (int ix=0; ix<fields.length; ix++) {
- String fieldName = fields[ix];
- com.websina.util.Field field = conf.getField(fieldName);
- if (conf.isFieldEnabled(fieldName, group) && field != null) {
- if (field.isDateField()) {
- buf.append("if(!validDatetime(")
- .append(form).append(".")
- .append(fieldName).append(".value))return false; ");
- } else if (field.isNumberField()) {
- buf.append("if(!validNumberQuery(")
- .append(form).append(".")
- .append(fieldName).append(".value))return false; ");
- }
- }
- }
- return buf.toString();
- }
- %>
-
- <%
- boolean isReport = "report.jsp".equals(parent);
- String[] fields = conf.getFields();
- com.websina.util.Field field;
- %>
- <% for (int i=0; i<fields.length; i++) {
- String fieldName = fields[i];
- if (fieldName.equals("attachment")) {
- continue;
- } else if (fieldName.equals("author") && person.isGuest()) {
- continue;
- } else if (isReport) {
- if (fieldName.equals("author")
- ||fieldName.equals("cc_mail")
- ||fieldName.equals("synopsis")
- ||fieldName.equals("detail")
- ) continue;
- }
- if (conf.isFieldEnabled(fieldName, person.getGroup()) && (field=conf.getField(fieldName)) != null) {
- %>
- <%--/// The Description field ///--%>
- <% if (fieldName.equals("detail")) { %>
- <tr><td class="e8">
- <%=label.get(fieldName, projectId)%>/<br>
- <%=label.get("response", projectId)%> <font color=red>²</font>
- </td>
- <td class="f1"><input name=detail size=60 maxlength=255></td></tr>
-
- <%--/// Responsible field ///--%>
- <% } else if (fieldName.equals("responsible")) { %>
- <tr><td class="cf">
- <%=label.get(fieldName, projectId)%></td>
- <td class="cf"><select name=<%=fieldName%> size=3 multiple style="width: 400px;">
- <%=ListMaker.makeOptionList(conf.getAccess().getUsers("edit", "editasgn"), getOptions(filter, fieldName)) %>
- </select> </td></tr>
-
- <%--/// Author field ///--%>
- <% } else if (fieldName.equals("author")) {
- String selected= "";
- if (filter != null && !filter.isOR(fieldName)) {
- selected = "selected";
- }
- %>
- <tr><td class="cf">
- <select name=author_or>
- <option value="OR"> | |</option>
- <option value="AND" <%=selected%>>&&</option>
- </select>
- <%=label.get(fieldName, projectId)%>
- <font color=red>³</font>
- </td>
- <td class="cf"><select name=<%=fieldName%> size=3 multiple style="width: 400px;">
- <%=ListMaker.makeOptionList(conf.getAccess().getAuthors(), getOptions(filter, fieldName)) %>
- </select> </td></tr>
- <%--/// the author (second) text field ///--%>
- <tr><td class="e8">
- <%=label.get(fieldName, projectId)%> <font color=red>²</font></td>
- <td class="f1"><input size=60 name=author2> </td></tr>
-
- <%--/// User type fields ///--%>
- <% } else if (field.isUserField()) { %>
- <% if (!isReport) {
- String selected= "";
- if (filter != null && !filter.isOR(fieldName)) {
- selected = "selected";
- }
- %>
- <tr><td class="cf">
- <select name=<%=fieldName%>_or>
- <option value="OR"> | |</option>
- <option value="AND" <%=selected%>>&&</option>
- </select>
- <%=label.get(fieldName, projectId)%>
- <font color=red>³</font>
- <% } else { %>
- <tr><td class="cf">
- <%=label.get(fieldName, projectId)%>
- <% } %>
- </td>
- <td class="cf"><select name=<%=fieldName%> size=3 multiple style="width: 400px;">
- <%=ListMaker.makeOptionList(conf.getAccess().getAuthors(), getOptions(filter, fieldName)) %>
- </select> </td></tr>
-
- <%--/// Datetime fields ///--%>
- <% } else if (field.isDateField()) { %>
- <tr><td class="e8">
- <%=label.get(fieldName, projectId)%>
- <font color=red>¹</font></td>
- <td class="f1"><nobr>
- <select name=<%=fieldName%>_dateOp style="width: 66px;">
- <%=dateOp()%></select>
- <input size=14 name=<%=fieldName%>>
- ||
- <select name=<%=fieldName%>_ageOp style="width: 86px;">
- <%=ageOp()%></select>
- <input size=2 maxlength=4 name=<%=fieldName%>_age>
- <select name=<%=fieldName%>_ageUnit>
- <%=ListMaker.makeOptionList(label, ageUnit(), null)%></select>
- </nobr>
- </td></tr>
-
- <%--/// Number fields ///--%>
- <% } else if (field.isNumberField()) { %>
- <tr><td class="e8">
- <%=label.get(fieldName, projectId)%></td>
- <td class="f1"><input name="<%=fieldName%>" size=60 maxlength=255>
- </td></tr>
-
- <%--/// Text Input and area fields ///--%>
- <% } else if (field.isTextField()) { %>
- <tr><td class="e8">
- <%=label.get(fieldName, projectId)%>
- <font color=red>²</font></td>
- <td class="f1"><input name="<%=fieldName%>" size=60 maxlength=255>
- </td></tr>
- <input type="hidden" name="<%=fieldName%>_type" value="text">
-
- <%--/// All Other Menu fields ///--%>
- <% } else if ((optionList=field.getValue()) != null) { %>
- <tr><td class="e8">
- <%=label.get(fieldName, projectId)%></td>
- <td class="f1"><select name=<%=fieldName%> size=3 multiple style="width: 400px;">
- <%=ListMaker.makeOptionList(optionList, getOptions(filter, fieldName)) %>
- </select> </td></tr>
- <% }}} %>
-