svn commit: r574663 - in /ofbiz/trunk/specialpurpose/assetmaint: config/ webapp/assetmaint/WEB-INF/ webapp/assetmaint/WEB-INF/actions/assetmaint/ webapp/assetmaint/WEB-INF/actions/workeffort/ widget/ widget/forms/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r574663 - in /ofbiz/trunk/specialpurpose/assetmaint: config/ webapp/assetmaint/WEB-INF/ webapp/assetmaint/WEB-INF/actions/assetmaint/ webapp/assetmaint/WEB-INF/actions/workeffort/ widget/ widget/forms/

adrianc
Author: adrianc
Date: Tue Sep 11 11:46:09 2007
New Revision: 574663

URL: http://svn.apache.org/viewvc?rev=574663&view=rev
Log:
Functional change. I replaced the existing Asset Maintenance calendar feature with one that displays maintenance tasks. The previous calendar only displayed production capacity - not very meaningful for this component.

Added:
    ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/editMaint.bsh
    ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/viewCalendar.bsh
Modified:
    ofbiz/trunk/specialpurpose/assetmaint/config/AssetMaintUiLabels.properties
    ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/assetmaint/widget/AssetmaintScreens.xml
    ofbiz/trunk/specialpurpose/assetmaint/widget/FixedAssetScreens.xml
    ofbiz/trunk/specialpurpose/assetmaint/widget/Menus.xml
    ofbiz/trunk/specialpurpose/assetmaint/widget/forms/FixedAssetForms.xml

Modified: ofbiz/trunk/specialpurpose/assetmaint/config/AssetMaintUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/config/AssetMaintUiLabels.properties?rev=574663&r1=574662&r2=574663&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/config/AssetMaintUiLabels.properties (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/config/AssetMaintUiLabels.properties Tue Sep 11 11:46:09 2007
@@ -90,3 +90,4 @@
 
 AssetMaintInvalidPartProductIdError="Part Id ${productId} provided is invalid please check and try again"
 AssetMaintLowPartInventoryError="Available Inventory level for ${productId} is ${quantity}"
+AssetMaintMaintenanceCalendar=Maintenance Calendar

Added: ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/editMaint.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/editMaint.bsh?rev=574663&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/editMaint.bsh (added)
+++ ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/editMaint.bsh Tue Sep 11 11:46:09 2007
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.base.util.*;
+import org.ofbiz.entity.*;
+import org.ofbiz.entity.util.*;
+
+// This is a small script to set things up when the EditFixedAssetMaint
+// screen is called from one of the WorkEffort calendar screens.
+// The URL coming from WorkEffort does not contain the maintHistSeqId parameter,
+// so this script will look it up using the workEffortId parameter.
+
+String maintHistSeqId = parameters.get("maintHistSeqId");
+String workEffortId = parameters.get("workEffortId");
+
+if (UtilValidate.isEmpty(maintHistSeqId) && UtilValidate.isNotEmpty(workEffortId)) {
+    GenericValue fixedAssetMaint = EntityUtil.getFirst(delegator.findByAnd("FixedAssetMaint", UtilMisc.toMap("scheduleWorkEffortId", workEffortId)));
+    if (fixedAssetMaint != null) {
+        parameters.put("fixedAssetId", fixedAssetMaint.get("fixedAssetId"));
+        parameters.put("maintHistSeqId", fixedAssetMaint.get("maintHistSeqId"));
+    }
+}

Added: ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/viewCalendar.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/viewCalendar.bsh?rev=574663&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/viewCalendar.bsh (added)
+++ ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/viewCalendar.bsh Tue Sep 11 11:46:09 2007
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.*;
+import org.ofbiz.entity.*;
+import org.ofbiz.entity.condition.*;
+import org.ofbiz.base.util.*;
+import java.sql.Timestamp;
+import java.text.*;
+
+// The view mode - Day, Week, or Month
+String viewMode = parameters.get("viewMode");
+if (UtilValidate.isEmpty(viewMode)) {
+    viewMode = "W";
+    parameters.put("viewMode", viewMode);
+}
+
+// Prepare vars for mode-specific date calculations
+String startParam = parameters.get("start");
+if(startParam == null) {
+    start = nowTimestamp.clone();
+} else {
+    start = new Timestamp(Long.parseLong(startParam));
+}
+int numPeriods = 24;
+int periodType = Calendar.HOUR;
+Timestamp getFrom = null;
+Timestamp prev = null;
+Timestamp next = null;
+Timestamp end = null;
+
+if ("D".equals(viewMode)) {
+    // Day view
+    start = UtilDateTime.getDayStart(start, timeZone, locale);
+    getFrom = new Timestamp(start.getTime());
+    prev = UtilDateTime.getDayStart(start, -1, timeZone, locale);
+    next = UtilDateTime.getDayStart(start, 1, timeZone, locale);
+} else if ("W".equals(viewMode)) {
+    // Week view
+    start = UtilDateTime.getWeekStart(start, timeZone, locale);
+    getFrom = new Timestamp(start.getTime());
+    prev = UtilDateTime.getDayStart(start,-7, timeZone, locale);
+    next = UtilDateTime.getDayStart(start,7, timeZone, locale);
+    end = UtilDateTime.getDayStart(start,6, timeZone, locale);
+    numPeriods = 7;
+    periodType = Calendar.DATE;
+} else {
+    // Month view
+    start = UtilDateTime.getMonthStart(start, timeZone, locale);
+    Calendar tempCal = UtilDateTime.toCalendar(start, timeZone, locale);
+    int firstWeekNum = tempCal.get(Calendar.WEEK_OF_YEAR);
+    globalContext.put("firstWeekNum", new Integer(firstWeekNum));
+    numPeriods = tempCal.getActualMaximum(Calendar.DAY_OF_MONTH);
+    prev = UtilDateTime.getDayStart(start, -1, timeZone, locale);
+    next = UtilDateTime.getDayStart(start, numPeriods+1, timeZone, locale);
+    end = UtilDateTime.getDayStart(start, numPeriods, timeZone, locale);
+    int prevMonthDays = tempCal.get(Calendar.DAY_OF_WEEK) - tempCal.getFirstDayOfWeek();
+    if (prevMonthDays < 0) {
+        prevMonthDays = 7 + prevMonthDays;
+    }
+    tempCal.add(Calendar.DATE, -(prevMonthDays));
+    numPeriods += prevMonthDays;
+    getFrom = new Timestamp(tempCal.getTimeInMillis());
+    periodType = Calendar.DATE;
+    globalContext.put("end", end);
+}
+
+List entityExprList = UtilMisc.toList(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"),
+    new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "TASK"), new EntityExpr("workEffortPurposeTypeId", EntityOperator.EQUALS, "WEPT_MAINTENANCE"));
+String fixedAssetId = parameters.get("fixedAssetId");
+if (UtilValidate.isNotEmpty(fixedAssetId)) {
+    entityExprList.add(new EntityExpr("fixedAssetId", EntityOperator.EQUALS, fixedAssetId));
+    globalContext.put("fixedAssetId", fixedAssetId);
+    globalContext.put("addlParam", "&fixedAssetId=" + fixedAssetId);
+}
+serviceCtx = UtilMisc.toMap("userLogin", userLogin, "start", getFrom, "numPeriods", new Integer(numPeriods), "periodType", new Integer(periodType));
+serviceCtx.putAll(UtilMisc.toMap("entityExprList", entityExprList, "locale", locale, "timeZone", timeZone));
+result = dispatcher.runSync("getWorkEffortEventsByPeriod", serviceCtx);
+globalContext.put("periods", result.get("periods"));
+globalContext.put("maxConcurrentEntries", result.get("maxConcurrentEntries"));
+
+globalContext.put("start", start);
+globalContext.put("prev", prev);
+globalContext.put("next", next);

Modified: ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml?rev=574663&r1=574662&r2=574663&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml Tue Sep 11 11:46:09 2007
@@ -186,7 +186,6 @@
     <view-map name="FindFixedAssets" type="screen" page="component://assetmaint/widget/FixedAssetScreens.xml#FindFixedAssets" />
     <view-map name="EditFixedAsset" type="screen" page="component://assetmaint/widget/FixedAssetScreens.xml#EditFixedAsset" />
     <view-map name="FixedAssetChildren" type="screen" page="component://assetmaint/widget/FixedAssetScreens.xml#FixedAssetChildren"/>
-    <view-map name="ListFixedAssetCalendar" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#ListFixedAssetCalendar"/>
     <view-map name="updateFixedAssetCalendar" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#updateFixedAssetCalendar"/>
     <view-map name="EditFixedAssetStdCosts" type="screen" page="component://assetmaint/widget/FixedAssetScreens.xml#EditFixedAssetStdCosts"/>
     <view-map name="EditFixedAssetIdents" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditFixedAssetIdents"/>
@@ -203,7 +202,6 @@
     <view-map name="EditItemIssuances" type="screen" page="component://assetmaint/widget/AssetmaintScreens.xml#EditItemIssuances"/>
     <view-map name="PrintFixedAssetMaint" type="screenfop" page="component://assetmaint/widget/AssetmaintScreens.xml#PrintFixedAssetMaint"/>
 
-
     <!-- Lookup request mappings -->
     <view-map name="LookupFixedAsset" type="screen" page="component://accounting/widget/LookupScreens.xml#LookupFixedAsset"/>
     <view-map name="LookupPartyName" type="screen" page="component://party/widget/partymgr/LookupScreens.xml#LookupPartyName"/>
@@ -216,5 +214,11 @@
     <!-- Facility  screens -->
     <view-map name="FindFacility" type="screen" page="component://assetmaint/widget/FacilityScreens.xml#FindFacility"/>
     
+    <!-- Asset Maint Calendar screens -->
+    <view-map name="day" type="screen" page="component://assetmaint/widget/FixedAssetScreens.xml#CalendarDay"/>
+    <view-map name="week" type="screen" page="component://assetmaint/widget/FixedAssetScreens.xml#CalendarWeek"/>
+    <view-map name="month" type="screen" page="component://assetmaint/widget/FixedAssetScreens.xml#CalendarMonth"/>
+    <view-map name="EditWorkEffort" type="screen" page="component://assetmaint/widget/AssetmaintScreens.xml#EditFixedAssetMaint"/>
+    <view-map name="WorkEffortSummary" type="screen" page="component://assetmaint/widget/AssetmaintScreens.xml#EditFixedAssetMaint"/>
     <!-- end of view mappings -->
 </site-conf>

Modified: ofbiz/trunk/specialpurpose/assetmaint/widget/AssetmaintScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/widget/AssetmaintScreens.xml?rev=574663&r1=574662&r2=574663&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/widget/AssetmaintScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/widget/AssetmaintScreens.xml Tue Sep 11 11:46:09 2007
@@ -52,6 +52,7 @@
                 <set field="titleProperty" value="AccountingFixedAssetMaint"/>
                 <set field="labelTitleProperty" value="AccountingFixedAssetMaint"/>
                 <set field="tabButtonItemFixedAssetMaint" value="EditFixedAssetMaint"/>
+                <script location="component://assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/editMaint.bsh"/>
                 <set field="fixedAssetId" from-field="parameters.fixedAssetId"/>
                 <set field="maintHistSeqId" from-field="parameters.maintHistSeqId"/>
                 <entity-one entity-name="FixedAsset" value-name="fixedAsset"/>

Modified: ofbiz/trunk/specialpurpose/assetmaint/widget/FixedAssetScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/widget/FixedAssetScreens.xml?rev=574663&r1=574662&r2=574663&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/widget/FixedAssetScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/widget/FixedAssetScreens.xml Tue Sep 11 11:46:09 2007
@@ -53,7 +53,7 @@
         <section>
             <actions>
                 <set field="titleProperty" value="AccountingEditFixedAsset" />
-                <set field="labelTitleProperty" value="AccountingEditFixedAsset" />
+                <set field="labelTitleProperty" value="AssetMaintMaintenanceCalendar" />
                 <set field="tabButtonItem" value="EditFixedAsset" />
                 <set field="fixedAssetId" from-field="parameters.fixedAssetId" />
                 <entity-one entity-name="FixedAsset" value-name="fixedAsset" />
@@ -149,4 +149,77 @@
             </widgets>
         </section>
     </screen>
+
+    <screen name="CommonCalendarDecorator">
+        <section>
+            <actions>
+                <set field="layoutSettings.styleSheets[]" value="/images/calendarstyles.css" global="true"/>
+                <set field="titleProperty" value="AssetMaintMaintenanceCalendar"/>
+                <set field="tabButtonItem" value="ListFixedAssetCalendar"/>
+                <set field="labelTitleProperty" value="AssetMaintMaintenanceCalendar"/>
+                <script location="component://assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/viewCalendar.bsh"/>
+                <entity-one entity-name="FixedAsset" value-name="fixedAsset"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonFixedAssetDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <include-menu name="CalendarTabBar" location="component://assetmaint/widget/Menus.xml"/>
+                        <decorator-section-include name="body"/>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="CalendarDay">
+        <section>
+            <actions>
+                <set field="parameters.viewMode" value="D"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonCalendarDecorator">
+                    <decorator-section name="body">
+                        <platform-specific>
+                            <html><html-template location="component://workeffort/webapp/workeffort/calendar/day.ftl"/></html>
+                        </platform-specific>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="CalendarWeek">
+        <section>
+            <actions>
+                <set field="parameters.viewMode" value="W"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonCalendarDecorator">
+                    <decorator-section name="body">
+                        <platform-specific>
+                            <html><html-template location="component://workeffort/webapp/workeffort/calendar/week.ftl"/></html>
+                        </platform-specific>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="CalendarMonth">
+        <section>
+            <actions>
+                <set field="parameters.viewMode" value="M"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonCalendarDecorator">
+                    <decorator-section name="body">
+                        <platform-specific>
+                            <html><html-template location="component://workeffort/webapp/workeffort/calendar/month.ftl"/></html>
+                        </platform-specific>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
 </screens>

Modified: ofbiz/trunk/specialpurpose/assetmaint/widget/Menus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/widget/Menus.xml?rev=574663&r1=574662&r2=574663&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/widget/Menus.xml (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/widget/Menus.xml Tue Sep 11 11:46:09 2007
@@ -30,7 +30,7 @@
             <link target="FixedAssetChildren?rootAssetId=${fixedAssetId}&amp;trail=${fixedAssetId}"/>
         </menu-item>
         <menu-item name="ListFixedAssetCalendar" title="${uiLabelMap.AccountingFixedAssetCalendar}">
-            <link target="ListFixedAssetCalendar?fixedAssetId=${fixedAssetId}"/>
+            <link target="week?fixedAssetId=${fixedAssetId}"/>
         </menu-item>
         <menu-item name="EditFixedAssetStdCosts" title="${uiLabelMap.AccountingFixedAssetStdCosts}">
             <link target="EditFixedAssetStdCosts?fixedAssetId=${fixedAssetId}"/>
@@ -96,6 +96,19 @@
         </menu-item>
     </menu>  
     
+    <menu name="CalendarTabBar" selected-menuitem-context-field-name="parameters.viewMode"
+         type="simple" default-selected-style="selected" menu-container-style="button-bar button-style-1">
+        <menu-item name="D" title="${uiLabelMap.CommonDay}">
+            <link target="day?fixedAssetId=${fixedAssetId}"/>
+        </menu-item>
+        <menu-item name="W" title="${uiLabelMap.CommonWeek}">
+            <link target="week?fixedAssetId=${fixedAssetId}"/>
+        </menu-item>
+        <menu-item name="M" title="${uiLabelMap.CommonMonth}">
+            <link target="month?fixedAssetId=${fixedAssetId}"/>
+        </menu-item>
+    </menu>
+
 </menus>
     
     

Modified: ofbiz/trunk/specialpurpose/assetmaint/widget/forms/FixedAssetForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/widget/forms/FixedAssetForms.xml?rev=574663&r1=574662&r2=574663&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/widget/forms/FixedAssetForms.xml (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/widget/forms/FixedAssetForms.xml Tue Sep 11 11:46:09 2007
@@ -193,6 +193,8 @@
         <!--  field name="scheduleWorkEffortId"  position="1"  title="${uiLabelMap.WorkEffortWorkEffort}" widget-style="buttontext">
             <hyperlink also-hidden="false" description="${fixedAssetMaint.scheduleWorkEffortId}" target="EditWorkEffort?workEffortId=${fixedAssetMaint.scheduleWorkEffortId}"/>
         </field -->
+        <field map-name="workEffort" title="${uiLabelMap.WorkEffortEstimatedStartDate}" position="1"  name="estimatedStartDate"><date-time/></field>
+        <field map-name="workEffort" title="${uiLabelMap.WorkEffortEstimatedCompletionDate}" position="2"  name="estimatedCompletionDate"><date-time/></field>
         <field map-name="workEffort" title="${uiLabelMap.WorkEffortActualStartDate}" position="1"  name="actualStartDate"><date-time/></field>
         <field map-name="workEffort" title="${uiLabelMap.WorkEffortActualCompletionDate}" position="2"  name="actualCompletionDate"><date-time/></field>
         <field name="quickAssignPartyId" title="${uiLabelMap.PartyPartyId}" use-when="fixedAssetMaint == null" field-name="partyId">