Changeset 20523
- Timestamp:
- 03/04/10 08:18:56 (5 months ago)
- Files:
-
- trunk/core/src/net/project/schedule/Schedule.java (modified) (9 diffs)
- trunk/core/src/net/project/schedule/SchedulePropertiesHelper.java (modified) (6 diffs)
- trunk/core/src/net/project/schedule/mvc/handler/workingtime/WorkingTimeEditHandler.java (modified) (3 diffs)
- trunk/core/web/jsp/schedule/workingtime/List.jsp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/core/src/net/project/schedule/Schedule.java
r20514 r20523 269 269 private boolean isShared = false; 270 270 private boolean editingWarning = true; 271 private boolean unAssignedWorkcapture = true; 271 private boolean unAssignedWorkcapture = false; 272 private BigDecimal hoursPerDay; 273 private BigDecimal hoursPerWeek; 274 private BigDecimal daysPerMonth; 275 private String resourceCalendar; 272 276 273 277 /** … … 317 321 editingWarning = true; 318 322 unAssignedWorkcapture = true; 323 hoursPerDay = BigDecimal.valueOf(8); 324 hoursPerWeek = BigDecimal.valueOf(40); 325 daysPerMonth = BigDecimal.valueOf(20); 326 resourceCalendar = SchedulePropertiesHelper.PERSONAL_RESOURCE_CALENDAR; 327 319 328 } 320 329 … … 1535 1544 } 1536 1545 1537 db.prepareCall("{call SCHEDULE.STORE_PLAN(?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,? )}");1546 db.prepareCall("{call SCHEDULE.STORE_PLAN(?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?)}"); 1538 1547 1539 1548 int index = 0; … … 1558 1567 db.cstmt.setBoolean(++index, editingWarning); 1559 1568 db.cstmt.setBoolean(++index, unAssignedWorkcapture); 1569 db.cstmt.setBigDecimal(++index, hoursPerDay); 1570 db.cstmt.setBigDecimal(++index, hoursPerWeek); 1571 db.cstmt.setBigDecimal(++index, daysPerMonth); 1572 db.cstmt.setString(++index, resourceCalendar); 1560 1573 1561 1574 db.cstmt.registerOutParameter((idIndex = ++index), Types.NUMERIC); … … 1620 1633 " p.default_calendar_id, p.timezone_id, shp.space_id, p.default_task_calc_type_id, " + 1621 1634 " p.earliest_start_date, p.earliest_finish_date, p.latest_start_date, " + 1622 " p.latest_finish_date, p.constraint_type_id, p.constraint_date, SYSDATE, inline_editing_warning, un_assigned_workcapture " + 1635 " p.latest_finish_date, p.constraint_type_id, p.constraint_date, SYSDATE, " + 1636 " p.inline_editing_warning, p.un_assigned_workcapture, p.hours_per_day, " + 1637 " p.hours_per_week, p.days_per_month, p.resource_calendar " + 1623 1638 "from " + 1624 1639 " pn_space_has_plan shp, " + … … 1653 1668 int EDITING_WARNING_COL = colID++; 1654 1669 int UN_ASSIGNED_WORKCAPTURE_COL = colID++; 1670 int HOURS_PER_DAY_COL = colID++; 1671 int HOURS_PER_WEEK_COL = colID++; 1672 int DAYS_PER_MONTH_COL = colID++; 1673 int RESOURCE_CALENDAR_COL = colID++; 1655 1674 1656 1675 … … 1682 1701 editingWarning = db.result.getBoolean(EDITING_WARNING_COL); 1683 1702 unAssignedWorkcapture = db.result.getBoolean(UN_ASSIGNED_WORKCAPTURE_COL); 1703 hoursPerDay = db.result.getBigDecimal(HOURS_PER_DAY_COL); 1704 hoursPerWeek = db.result.getBigDecimal(HOURS_PER_WEEK_COL); 1705 daysPerMonth = db.result.getBigDecimal(DAYS_PER_MONTH_COL); 1706 resourceCalendar = db.result.getString(RESOURCE_CALENDAR_COL); 1684 1707 1685 1708 String timeZoneID = db.result.getString(TIMEZONE_ID_COL); … … 2534 2557 clone.editingWarning = this.editingWarning; 2535 2558 clone.unAssignedWorkcapture = this.unAssignedWorkcapture; 2559 clone.hoursPerDay = this.hoursPerDay; 2560 clone.hoursPerWeek = this.hoursPerWeek; 2561 clone.daysPerMonth = this.daysPerMonth; 2562 clone.resourceCalendar = this.resourceCalendar; 2563 2536 2564 //Make copies of all the entries in the entry map 2537 2565 Map clonedEntryMap = new LinkedHashMap(); … … 2675 2703 this.editingWarning = editingWarning; 2676 2704 } 2705 2706 /** 2707 * @return the daysPerMonth 2708 */ 2709 public BigDecimal getDaysPerMonth() { 2710 return daysPerMonth; 2711 } 2712 2713 /** 2714 * @param daysPerMonth the daysPerMonth to set 2715 */ 2716 public void setDaysPerMonth(BigDecimal daysPerMonth) { 2717 this.daysPerMonth = daysPerMonth; 2718 } 2719 2720 /** 2721 * @return the hoursPerDay 2722 */ 2723 public BigDecimal getHoursPerDay() { 2724 return hoursPerDay; 2725 } 2726 2727 /** 2728 * @param hoursPerDay the hoursPerDay to set 2729 */ 2730 public void setHoursPerDay(BigDecimal hoursPerDay) { 2731 this.hoursPerDay = hoursPerDay; 2732 } 2733 2734 /** 2735 * @return the hoursPerWeek 2736 */ 2737 public BigDecimal getHoursPerWeek() { 2738 return hoursPerWeek; 2739 } 2740 2741 /** 2742 * @param hoursPerWeek the hoursPerWeek to set 2743 */ 2744 public void setHoursPerWeek(BigDecimal hoursPerWeek) { 2745 this.hoursPerWeek = hoursPerWeek; 2746 } 2747 2748 /** 2749 * @return the resourceCalendar 2750 */ 2751 public String getResourceCalendar() { 2752 return resourceCalendar; 2753 } 2754 2755 /** 2756 * @param resourceCalendar the resourceCalendar to set 2757 */ 2758 public void setResourceCalendar(String resourceCalendar) { 2759 this.resourceCalendar = resourceCalendar; 2760 } 2677 2761 2678 2762 } trunk/core/src/net/project/schedule/SchedulePropertiesHelper.java
r20514 r20523 42 42 public class SchedulePropertiesHelper { 43 43 44 private User user; 44 public static final String PERSONAL_RESOURCE_CALENDAR = "PERSONAL"; 45 public static final String SCHEDULE_RESOURCE_CALENDAR = "SCHEDULE"; 46 private User user; 45 47 private Date startDate; 46 48 private Date endDate; … … 52 54 private boolean editingWarning; 53 55 private boolean unAssignedWorkcapture; 56 private String resourceCalendar; 54 57 55 58 /** … … 97 100 this.editingWarning = schedule.isEditingWarning(); 98 101 this.unAssignedWorkcapture = schedule.isUnAssignedWorkcapture(); 102 this.resourceCalendar = schedule.getResourceCalendar(); 99 103 } 100 104 … … 254 258 255 259 /** 256 * Returns the "checked" attribute based on the autocalculationsetting257 * @return the string "checked" if auto calculateis on;260 * Returns the "checked" attribute based on the editingWarning setting 261 * @return the string "checked" if Inline Editing Warning is on; 258 262 * otherwise empty string 259 263 */ … … 263 267 264 268 /** 265 * Returns the "checked" attribute based on the autocalculationsetting266 * @return the string "checked" if auto calculate is on;269 * Returns the "checked" attribute based on the unAssignedWorkcapture setting 270 * @return the string "checked" if Un Assigned Task Work Capture is on; 267 271 * otherwise empty string 268 272 */ … … 270 274 return (this.unAssignedWorkcapture ? "checked" : ""); 271 275 } 276 277 /** 278 * Returns the "checked" attribute based on the resourceCalendar setting 279 * @return the string "checked" if auto Personal Resource Calendar is checked ; 280 * otherwise empty string 281 */ 282 public String getCheckedPersonalResourceCalendar(){ 283 return (PERSONAL_RESOURCE_CALENDAR.equals(this.resourceCalendar) ? "checked" : ""); 284 } 285 286 /** 287 * Returns the "checked" attribute based on the resourceCalendar setting 288 * @return the string "checked" if auto Schedule Resource Calendar is checked ; 289 * otherwise empty string 290 */ 291 public String getCheckedScheduleResourceCalendar(){ 292 return (SCHEDULE_RESOURCE_CALENDAR.equals(this.resourceCalendar) ? "checked" : ""); 293 } 272 294 273 295 } trunk/core/src/net/project/schedule/mvc/handler/workingtime/WorkingTimeEditHandler.java
r19181 r20523 23 23 package net.project.schedule.mvc.handler.workingtime; 24 24 25 import java.math.BigDecimal; 25 26 import java.util.HashMap; 26 27 import java.util.Map; … … 29 30 import javax.servlet.http.HttpServletResponse; 30 31 31 import net.project.base.Module;32 32 import net.project.base.PnetException; 33 33 import net.project.base.mvc.ControllerException; 34 import net.project.base.mvc.Handler;35 34 import net.project.base.property.PropertyProvider; 36 import net.project.calendar.workingtime.IWorkingTimeCalendarProvider;37 35 import net.project.calendar.workingtime.WorkingTimeCalendarCreateHelper; 38 36 import net.project.calendar.workingtime.WorkingTimeCalendarHelper; … … 192 190 prepareEdit(model, helper); 193 191 192 }else if (theAction.equals("workingtimes")) { 193 // User selected a preset calendar type 194 195 Schedule schedule = (Schedule) request.getSession().getAttribute("schedule"); 196 if (schedule == null) { 197 throw new ControllerException("Missing session attribute 'schedule'"); 198 } 199 if(!Validator.isBlankOrNull(request.getParameter("hoursPerDay")) 200 && !Validator.isBlankOrNull(request.getParameter("hoursPerDay")) 201 && !Validator.isBlankOrNull(request.getParameter("hoursPerDay"))){ 202 schedule.setHoursPerDay(BigDecimal.valueOf(Double.parseDouble(request.getParameter("hoursPerDay")))); 203 schedule.setHoursPerWeek(BigDecimal.valueOf(Double.parseDouble(request.getParameter("hoursPerWeek")))); 204 schedule.setDaysPerMonth(BigDecimal.valueOf(Double.parseDouble(request.getParameter("daysPerMonth")))); 205 schedule.store(); 206 }else{ 207 errorReporter.addError(PropertyProvider.get("prm.schedule.properties.workingtimes.required.message")); 208 } 209 prepareList(request, model); 194 210 } else { 195 211 throw new ControllerException("Unknown action '" + theAction + "'"); trunk/core/web/jsp/schedule/workingtime/List.jsp
r19063 r20523 27 27 <%@ include file="/base/taglibInclude.jsp"%> 28 28 <jsp:useBean id="listHelper" type="net.project.calendar.workingtime.WorkingTimeCalendarListHelper" scope="request" /> 29 29 <jsp:useBean id="schedule" class="net.project.schedule.Schedule" scope="session" /> 30 30 <security:verifyAccess action="view" module="<%=Module.SCHEDULE%>" /> 31 31 … … 39 39 <template:getSpaceCSS /> 40 40 41 <%-- Import Javascript --%> 42 <template:import type="javascript" src="/src/errorHandler.js" /> 43 <template:import type="javascript" src="/src/checkComponentForms.js" /> 41 44 <script language="javascript" type="text/javascript"> 42 45 var theForm; … … 97 100 } 98 101 102 function submit() { 103 if(validateForm(theForm)) { 104 theAction("workingtimes"); 105 theForm.submit(); 106 } 107 } 108 function validateForm(theForm) { 109 if (!checkNumeric(theForm.hoursPerDay,'<display:get name="prm.schedule.properties.hoursperday.mumericrequired.message"/>')) return false; 110 if(theForm.hoursPerDay.value <=0 || theForm.hoursPerDay.value > 24){ 111 extAlert(errorTitle, '<display:get name="prm.schedule.properties.hoursperday.range.message"/>' , Ext.MessageBox.ERROR); 112 theForm.hoursPerDay.focus() 113 return false; 114 } 115 if (!checkNumeric(theForm.hoursPerWeek,'<display:get name="prm.schedule.properties.hoursperweek.mumericrequired.message"/>')) return false; 116 if(theForm.hoursPerWeek.value <=0 || theForm.hoursPerDay.value > 186){ 117 extAlert(errorTitle, '<display:get name="prm.schedule.properties.hoursperweek.range.message"/>' , Ext.MessageBox.ERROR); 118 theForm.hoursPerWeek.focus() 119 return false; 120 } 121 if (!checkNumeric(theForm.daysPerMonth,'<display:get name="prm.schedule.properties.dayspermonth.mumericrequired.message"/>')) return false; 122 if(theForm.daysPerMonth.value <=0 || theForm.hoursPerDay.value > 30){ 123 extAlert(errorTitle, '<display:get name="prm.schedule.properties.daysspermonth.range.message"/>' , Ext.MessageBox.ERROR); 124 theForm.daysPerMonth.focus() 125 return false; 126 } 127 return true; 128 } 99 129 </script> 100 130 … … 165 195 <td> </td> 166 196 </tr> 197 198 <tr><td colspan="4"> </td></tr> 199 200 <tr> 201 <td class="channelHeader" width="1%"><img src="<%=SessionManager.getJSPRootURL()%>/images/icons/channelbar-left_end.gif" width=8 height=15></td> 202 <td nowrap class="channelHeader" align=left colspan="2"><display:get name="prm.schedule.properties.workingtimes.channltitle" /></td> 203 <td width="1%" align="right" class="channelHeader"><img src="<%=SessionManager.getJSPRootURL()%>/images/icons/channelbar-right_end.gif" width=8 height=15></td> 204 </tr> 205 206 <%-- Hours per day --%> 207 <tr> 208 <td> </td> 209 <td class="tableHeader" width="24%"> 210 <display:get name="prm.schedule.properties.hoursperday.label"/> 211 </td> 212 <td class="tableContent"> 213 <input type="text" name="hoursPerDay" size="20" maxlength="80" value='<jsp:getProperty name="schedule" property="hoursPerDay"/>'> 214 </td> 215 <td> </td> 216 </tr> 217 <%-- Hours per week --%> 218 <tr> 219 <td> </td> 220 <td class="tableHeader"> 221 <display:get name="prm.schedule.properties.hoursperweek.label"/> 222 </td> 223 <td class="tableContent"> 224 <input type="text" name="hoursPerWeek" size="20" maxlength="80" value='<jsp:getProperty name="schedule" property="hoursPerWeek"/>'> 225 </td> 226 <td> </td> 227 </tr> 228 <%-- Days per Month --%> 229 <tr> 230 <td> </td> 231 <td class="tableHeader"> 232 <display:get name="prm.schedule.properties.dayspermonth.label"/> 233 </td> 234 <td class="tableContent"> 235 <input type="text" name="daysPerMonth" size="20" maxlength="80" value='<jsp:getProperty name="schedule" property="daysPerMonth"/>'> 236 </td> 237 <td> </td> 238 </tr> 239 167 240 168 241 <tr><td colspan="4"> </td></tr> … … 195 268 <tb:band name="action"> 196 269 <tb:button type="cancel"/> 270 <tb:button type="submit"/> 197 271 </tb:band> 198 272 </tb:toolbar>
