svn commit: r464866 - in /incubator/ofbiz/trunk/framework/webtools: webapp/webtools/WEB-INF/ webapp/webtools/WEB-INF/actions/service/ webapp/webtools/service/ widget/

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

svn commit: r464866 - in /incubator/ofbiz/trunk/framework/webtools: webapp/webtools/WEB-INF/ webapp/webtools/WEB-INF/actions/service/ webapp/webtools/service/ widget/

jacopoc
Author: jacopoc
Date: Tue Oct 17 02:07:12 2006
New Revision: 464866

URL: http://svn.apache.org/viewvc?view=rev&rev=464866
Log:
Converted all the service related "region" pages to screen widget.

Added:
    incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh   (with props)
    incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml   (with props)
    incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/setServiceParameter.ftl   (with props)
Removed:
    incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/schedulejob.jsp
Modified:
    incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml
    incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/regions.xml
    incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/jobs.ftl
    incubator/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml

Added: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh?view=auto&rev=464866
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh (added)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh Tue Oct 17 02:07:12 2006
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2001-2006 The Apache Software Foundation
+ *
+ * Licensed 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.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.sql.Timestamp;
+
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.service.ServiceDispatcher;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.ModelService;
+import org.ofbiz.service.ModelParam;
+import org.ofbiz.service.RunningService;
+import org.ofbiz.service.engine.GenericEngine;
+import org.ofbiz.service.config.ServiceConfigUtil;
+
+String serviceName = request.getParameter("SERVICE_NAME");
+context.put("POOL_NAME", ServiceConfigUtil.getSendPool());
+
+List scheduleOptions = new ArrayList();
+List serviceParameters = new ArrayList();
+Enumeration e = request.getParameterNames();
+while (e.hasMoreElements()) {
+    String paramName = (String) e.nextElement();
+    String paramValue = request.getParameter(paramName);
+    scheduleOptions.add(UtilMisc.toMap("name", paramName, "value", paramValue));
+}
+
+context.put("scheduleOptions", scheduleOptions);
+
+if (UtilValidate.isNotEmpty(serviceName)) {
+    DispatchContext dctx = dispatcher.getDispatchContext();
+    ModelService model = dctx.getModelService(serviceName);
+    Iterator params = model.getInParamNames().iterator();
+    while (params.hasNext()) {
+        ModelParam par = model.getParam((String)params.next());
+        if (par.internal) {
+            continue;
+        }
+        serviceParameters.add(UtilMisc.toMap("name", par.name, "type", par.type, "optional", (par.optional? "Y": "N")));
+    }
+}
+context.put("serviceParameters", serviceParameters);

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml?view=diff&rev=464866&r1=464865&r2=464866
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml (original)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml Tue Oct 17 02:07:12 2006
@@ -335,6 +335,10 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="scheduleJob"/>
     </request-map>
+    <request-map uri="setServiceParameters">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="setServiceParameters"/>
+    </request-map>
     <request-map uri="scheduleService">
         <security https="true" auth="true"/>
         <event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="scheduleService"/>
@@ -342,7 +346,7 @@
         <response name="error" type="view" value="scheduleJob"/>
     </request-map>  
     
-    <!-- Available services requests(Ashish Hareet - [hidden email]) -->
+    <!-- Available services requests -->
     <request-map uri="availableServices">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="availableServices"/>
@@ -540,11 +544,11 @@
 
     <view-map name="EditCustomTimePeriod" type="region"/>
 
-    <view-map name="scheduleJob" type="region"/>
-
     <view-map name="serviceList" type="screen" page="component://webtools/widget/ServiceScreens.xml#ServiceList"/>
     <view-map name="jobList" type="screen" page="component://webtools/widget/ServiceScreens.xml#JobList"/>
     <view-map name="threadList" type="screen" page="component://webtools/widget/ServiceScreens.xml#ThreadList"/>
+    <view-map name="scheduleJob" type="screen" page="component://webtools/widget/ServiceScreens.xml#ScheduleJob"/>
+    <view-map name="setServiceParameters" type="screen" page="component://webtools/widget/ServiceScreens.xml#setServiceParameters"/>
     <view-map name="availableServices" type="screen" page="component://webtools/widget/AvailableServicesScreens.xml#AvailableServicesList"/>
     <view-map name="serviceEcaDetail" type="screen" page="component://webtools/widget/AvailableServicesScreens.xml#ServiceEcaDetail"/>
 

Modified: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/regions.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/regions.xml?view=diff&rev=464866&r1=464865&r2=464866
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/regions.xml (original)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/regions.xml Tue Oct 17 02:07:12 2006
@@ -114,9 +114,4 @@
         <put section="title">Edit CustomTimePeriod</put>
         <put section="content" content="/period/EditCustomTimePeriod.jsp"/>
     </define>
-
-    <define id="scheduleJob" region="MAIN_REGION">
-     <put section="title">Schedule Job</put>
-     <put section="content" content="/service/schedulejob.jsp"/>
-    </define>    
 </regions>

Added: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml?view=auto&rev=464866
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml (added)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml Tue Oct 17 02:07:12 2006
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+Copyright 2001-2006 The Apache Software Foundation
+
+Licensed 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.
+-->
+
+<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd">
+
+    <form name="scheduleJob" type="single" target="setServiceParameters" title="" default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
+        <field name="SERVICE_NAME" title="Service"><text/></field>
+        <field name="POOL_NAME" title="Pool Name"><text/></field>
+        <field name="SERVICE_TIME" title="Start Date/Time"><date-time/></field>
+        <field name="SERVICE_END_TIME" title="Finish Date/Time"><date-time/></field>
+        <field name="SERVICE_FREQUENCY" title="Frequency">
+            <drop-down>
+                <option key="" description="None"/>
+                <option key="4" description="Daily"/>
+                <option key="5" description="Weekly"/>
+                <option key="6" description="Monthly"/>
+                <option key="7" description="Yearly"/>
+                <option key="3" description="Hourly"/>
+                <option key="2" description="Minutely"/>
+                <option key="1" description="Secondly"/>
+            </drop-down>
+        </field>
+        <field name="SERVICE_INTERVAL" title="Interval" tooltip="for use with frequency"><text/></field>
+        <field name="SERVICE_COUNT" title="Count" tooltip="number of time the job will run; use -1 for no limit i.e. forever"><text default-value="1"/></field>
+        <field name="SERVICE_MAXRETRY" title="Max Retry" tooltip="number of time the job will retry on error; use -1 for no limit or leave empty for service default"><text/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
+</forms>

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/jobs.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/jobs.ftl?view=diff&rev=464866&r1=464865&r2=464866
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/jobs.ftl (original)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/jobs.ftl Tue Oct 17 02:07:12 2006
@@ -42,7 +42,7 @@
     </td>
     <td align="center">
       <#if !(job.startDateTime?exists) && !(job.finishDateTime?exists) && !(job.cancelDateTime?exists)>
-      <a href="<@ofbizUrl>cancelJob?jobId=${job.jobId}</@ofbizUrl>" class="buttontext">Cancel Job.</a>
+      <a href="<@ofbizUrl>cancelJob?jobId=${job.jobId}</@ofbizUrl>" class="buttontext">Cancel Job</a>
       </#if>
       &nbsp;
     </td>

Added: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/setServiceParameter.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/setServiceParameter.ftl?view=auto&rev=464866
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/setServiceParameter.ftl (added)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/setServiceParameter.ftl Tue Oct 17 02:07:12 2006
@@ -0,0 +1,37 @@
+<#--
+Copyright 2001-2006 The Apache Software Foundation
+
+Licensed 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.
+-->
+
+<form name="scheduleForm" method="POST" action="<@ofbizUrl>scheduleService</@ofbizUrl>">
+    <#list scheduleOptions as scheduleOption>
+ <input type="hidden" name="${scheduleOption.name}" value="${scheduleOption.value}"/>
+    </#list>
+
+    <table border="0">
+        
+    <#list serviceParameters as serviceParameter>
+      <tr>
+        <td align="right"><div class="tabletext">${serviceParameter.name} (${serviceParameter.type})</div></td>
+        <td>
+          <input type="text" class="inputBox" size="20" name="${serviceParameter.name}"/>
+          <span class="tabletext"><#if serviceParameter.optional == "N">(required)<#else>(optional)</#if></span>
+        </td>
+      </tr>
+    </#list>
+      <tr>
+        <td colspan="2" align="center"><input type="submit" class="smallSubmit" value="Submit"></td>
+      </tr>      
+    </table>
+</form>

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/setServiceParameter.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/setServiceParameter.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/setServiceParameter.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?view=diff&rev=464866&r1=464865&r2=464866
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml (original)
+++ incubator/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Tue Oct 17 02:07:12 2006
@@ -109,6 +109,43 @@
             </widgets>
         </section>
     </screen>
+    <screen name="ScheduleJob">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleScheduleJob"/>
+                <set field="headerItem" value="services"/>
+                <set field="tabButtonItem" value="ScheduleJob"/>
+                <script location="component://webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonServiceDecorator">
+                    <decorator-section name="body">
+                        <label style="head1">Step 1: Service And Recurrence Information</label>
+                        <include-form name="scheduleJob" location="component://webtools/webapp/webtools/service/ServiceForms.xml"/>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="setServiceParameters">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleScheduleJob"/>
+                <set field="headerItem" value="services"/>
+                <set field="tabButtonItem" value="ScheduleJob"/>
+                <script location="component://webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonServiceDecorator">
+                    <decorator-section name="body">
+                        <label style="head1">Step 2: Service Parameters</label>
+                        <platform-specific>
+                            <html><html-template location="component://webtools/webapp/webtools/service/setServiceParameter.ftl"/></html>
+                        </platform-specific>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 
 </screens>
-