You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2008/03/22 07:11:04 UTC

svn commit: r639954 - in /ofbiz/trunk/framework: base/src/base/org/ofbiz/base/util/ webtools/src/org/ofbiz/webtools/artifactinfo/ webtools/webapp/webtools/artifactinfo/

Author: jonesde
Date: Fri Mar 21 23:11:04 2008
New Revision: 639954

URL: http://svn.apache.org/viewvc?rev=639954&view=rev
Log:
Cleanups to controller url display to minimize it; changed view screen ref to look at all screen render types

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilURL.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java
    ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilURL.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilURL.java?rev=639954&r1=639953&r2=639954&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilURL.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilURL.java Fri Mar 21 23:11:04 2008
@@ -117,4 +117,14 @@
         newFilename = newFilename + filename;
         return fromFilename(newFilename);
     }
+    
+    public static String getOfbizHomeRelativeLocation(URL fileUrl) {
+        String ofbizHome = System.getProperty("ofbiz.home");
+        String path = fileUrl.getPath();
+        if (path.startsWith(ofbizHome)) {
+            // note: the +1 is to remove the leading slash
+            path = path.substring(ofbizHome.length()+1);
+        }
+        return path;
+    }
 }

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java?rev=639954&r1=639953&r2=639954&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java Fri Mar 21 23:11:04 2008
@@ -28,6 +28,7 @@
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilObject;
+import org.ofbiz.base.util.UtilURL;
 import org.ofbiz.webapp.control.ConfigXMLReader;
 
 /**
@@ -128,7 +129,11 @@
     }
     
     public String getDisplayName() {
-        return this.getUniqueId();
+        String location = UtilURL.getOfbizHomeRelativeLocation(this.controllerXmlUrl);
+        if (location.endsWith("/WEB-INF/controller.xml")) {
+            location = location.substring(0, location.length() - 23);
+        }
+        return this.requestUri + " (" + location + ")";
     }
     
     public String getDisplayType() {

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java?rev=639954&r1=639953&r2=639954&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java Fri Mar 21 23:11:04 2008
@@ -26,6 +26,7 @@
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilObject;
+import org.ofbiz.base.util.UtilURL;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.webapp.control.ConfigXMLReader;
 
@@ -57,7 +58,10 @@
             throw new GeneralException("Controller view with name [" + viewUri + "] is not defined in controller file [" + controllerXmlUrl + "].");
         }
         // populate screenCalledByThisView and reverse in aif.allViewInfosReferringToScreen
-        if ("screen".equals(this.viewInfoMap.get(ConfigXMLReader.VIEW_TYPE))) {
+        if ("screen".equals(this.viewInfoMap.get(ConfigXMLReader.VIEW_TYPE)) || 
+                "screenfop".equals(this.viewInfoMap.get(ConfigXMLReader.VIEW_TYPE)) ||
+                "screentext".equals(this.viewInfoMap.get(ConfigXMLReader.VIEW_TYPE)) ||
+                "screenxml".equals(this.viewInfoMap.get(ConfigXMLReader.VIEW_TYPE))) {
             String fullScreenName = this.viewInfoMap.get(ConfigXMLReader.VIEW_PAGE);
             if (UtilValidate.isNotEmpty(fullScreenName)) {
                 int poundIndex = fullScreenName.indexOf('#');
@@ -83,7 +87,11 @@
     }
     
     public String getDisplayName() {
-        return this.getUniqueId();
+        String location = UtilURL.getOfbizHomeRelativeLocation(this.controllerXmlUrl);
+        if (location.endsWith("/WEB-INF/controller.xml")) {
+            location = location.substring(0, location.length() - 23);
+        }
+        return this.viewUri + " (" + location + ")";
     }
     
     public String getDisplayType() {

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl?rev=639954&r1=639953&r2=639954&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl Fri Mar 21 23:11:04 2008
@@ -17,17 +17,27 @@
 under the License.
 -->
 
+<#if sessionAttributes.recentArtifactInfoList?has_content>
+  <div class="right">
+    <h2>Recently Viewed Artifacts:</h2>
+    <#assign highRef = sessionAttributes.recentArtifactInfoList.size() - 1/>
+    <#if (highRef > 19)><#assign highRef = 19/></#if>
+    <#list sessionAttributes.recentArtifactInfoList[0..highRef] as recentArtifactInfo>
+        <div>${recentArtifactInfo_index + 1} - ${recentArtifactInfo.getDisplayType()}: <@displayArtifactInfoLink artifactInfo=recentArtifactInfo/></div>
+    </#list>
+  </div>
+</#if>
 
 <#if !artifactInfo?exists>
 
     <#-- add form here to specify artifact info name. -->
-    <div class="screenlet-body">
+    <div>
       <form name="ArtifactInfoByName" method="post" action="<@o...@ofbizUrl>" class="basic-form">
         Search Names/Locations: <input type="text" name="name" value="${parameters.name?if_exists}" size="40"/>
         <input type="submit" name="submitButton" value="Find"/>
       </form>
     </div>
-    <div class="screenlet-body">
+    <div>
       <form name="ArtifactInfoByNameAndType" method="post" action="<@o...@ofbizUrl>" class="basic-form">
         <div>Name: <input type="text" name="name" value="${parameters.name?if_exists}" size="40"/></div>
         <div>Location: <input type="text" name="location" value="${parameters.location?if_exists}" size="60"/></div>
@@ -47,7 +57,7 @@
     
     <#-- add set of ArtifactInfo if there is not a single one identified, with link to each -->
     <#if artifactInfoSet?has_content>
-    <div class="screenlet-body">
+    <div>
         <h4>Multiple Artifacts Found:</h4>
         <#list artifactInfoSet as curArtifactInfo>
             <div>${curArtifactInfo.getDisplayType()}: <@displayArtifactInfoLink artifactInfo=curArtifactInfo/></div>
@@ -239,15 +249,7 @@
     </#if>
 </#if>
 
-<#if sessionAttributes.recentArtifactInfoList?has_content>
-    <h2>Recently Viewed Artifacts:</h2>
-    <#assign highRef = sessionAttributes.recentArtifactInfoList.size() - 1/>
-    <#if (highRef > 20)><#assign highRef = 20/></#if>
-    <#list sessionAttributes.recentArtifactInfoList[0..highRef] as recentArtifactInfo>
-        <div>${recentArtifactInfo_index + 1} - ${recentArtifactInfo.getDisplayType()}: <@displayArtifactInfoLink artifactInfo=recentArtifactInfo/></div>
-    </#list>
-</#if>
-
+<#-- ==================== MACROS ===================== -->
 <#macro displayEntityArtifactInfo entityArtifactInfo>
     <div>&nbsp;-&nbsp;<@displayArtifactInfoLink artifactInfo=entityArtifactInfo/></div>
 </#macro>