You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2006/11/12 18:02:40 UTC
svn commit: r473992 [2/2] - in /incubator/ofbiz/trunk: ./
framework/webtools/config/ framework/webtools/webapp/webtools/WEB-INF/
framework/webtools/webapp/webtools/WEB-INF/actions/entity/
framework/webtools/webapp/webtools/entity/ framework/webtools/wi...
Modified: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/FindGeneric.jsp
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/FindGeneric.jsp?view=diff&rev=473992&r1=473991&r2=473992
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/FindGeneric.jsp (original)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/FindGeneric.jsp Sun Nov 12 09:02:39 2006
@@ -1,300 +0,0 @@
-<%--
-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.
---%>
-
-<%@ page import="java.text.*, java.util.*, java.net.*" %>
-<%@ page import="org.ofbiz.security.*, org.ofbiz.entity.*, org.ofbiz.base.util.*, org.ofbiz.webapp.pseudotag.*" %>
-<%@ page import="org.ofbiz.entity.model.*, org.ofbiz.entity.util.*, org.ofbiz.entity.condition.*, org.ofbiz.entity.transaction.*" %>
-
-<%@ taglib uri="ofbizTags" prefix="ofbiz" %>
-
-<jsp:useBean id="security" type="org.ofbiz.security.Security" scope="request" />
-<jsp:useBean id="delegator" type="org.ofbiz.entity.GenericDelegator" scope="request" />
-<%try {%>
-
-<%String entityName=request.getParameter("entityName");%>
-<%ModelReader reader = delegator.getModelReader();%>
-<%ModelEntity modelEntity = reader.getModelEntity(entityName);%>
-
-<%boolean hasViewPermission = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session);%>
-<%boolean hasCreatePermission = security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_CREATE", session);%>
-<%boolean hasUpdatePermission = security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_UPDATE", session);%>
-<%boolean hasDeletePermission = security.hasEntityPermission("ENTITY_DATA", "_DELETE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_DELETE", session);%>
-<%if(hasViewPermission){%>
-<%
- String rowClassTop1 = "viewOneTR1";
- String rowClassTop2 = "viewOneTR2";
- String rowClassTop = "";
- String rowClassResultIndex = "viewOneTR2";
- String rowClassResultHeader = "viewOneTR1";
- String rowClassResult1 = "viewManyTR1";
- String rowClassResult2 = "viewManyTR2";
- String rowClassResult = "";
-
- String find = request.getParameter("find");
- if (find == null) find="false";
- String curFindString = "entityName=" + entityName + "&find=" + find;
- GenericEntity findByEntity = delegator.makeValue(entityName, null);
- for (int fnum=0; fnum < modelEntity.getFieldsSize(); fnum++) {
- ModelField field = modelEntity.getField(fnum);
- String fval = request.getParameter(field.getName());
- if (fval != null) {
- if (fval.length() > 0) {
- curFindString = curFindString + "&" + field.getName() + "=" + fval;
- findByEntity.setString(field.getName(), fval);
- }
- }
- }
- curFindString = UtilFormatOut.encodeQuery(curFindString);
-
-%>
-<%
-//--------------
- String viewIndexString = (String)request.getParameter("VIEW_INDEX");
- if (viewIndexString == null || viewIndexString.length() == 0) { viewIndexString = "0"; }
- int viewIndex = 0;
- try { viewIndex = Integer.valueOf(viewIndexString).intValue(); }
- catch (NumberFormatException nfe) { viewIndex = 0; }
-
- String viewSizeString = (String)request.getParameter("VIEW_SIZE");
- if (viewSizeString == null || viewSizeString.length() == 0) { viewSizeString = "10"; }
- int viewSize = 10;
- try { viewSize = Integer.valueOf(viewSizeString).intValue(); }
- catch (NumberFormatException nfe) { viewSize = 10; }
-
- int lowIndex = viewIndex*viewSize+1;
- int highIndex = (viewIndex+1)*viewSize;
- int arraySize = 0;
- List resultPartialList = null;
-//--------------
- if ("true".equals(find)) {
- EntityCondition condition = new EntityFieldMap(findByEntity, EntityOperator.AND);
- arraySize = (int) delegator.findCountByCondition(findByEntity.getEntityName(), condition, null);
- if (arraySize < highIndex) highIndex = arraySize;
- if ((highIndex - lowIndex + 1) > 0) {
- boolean beganTransaction = false;
- try {
- beganTransaction = TransactionUtil.begin();
-
- EntityFindOptions efo = new EntityFindOptions();
- efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE);
- EntityListIterator resultEli = null;
- //new ArrayList(findByEntity.getPrimaryKey().keySet())
- resultEli = delegator.findListIteratorByCondition(findByEntity.getEntityName(), condition, null, null, null, efo);
- resultPartialList = resultEli.getPartialList(lowIndex, highIndex - lowIndex + 1);
- resultEli.close();
- } catch (GenericEntityException e) {
- Debug.logError(e, "Failure in operation, rolling back transaction", "FindGeneric.jsp");
- try {
- // only rollback the transaction if we started one...
- TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e);
- } catch (GenericEntityException e2) {
- Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "FindGeneric.jsp");
- }
- // after rolling back, rethrow the exception
- throw e;
- } finally {
- // only commit the transaction if we started one... this will throw an exception if it fails
- TransactionUtil.commit(beganTransaction);
- }
- }
- }
-//--------------
- Debug.log("viewIndex=" + viewIndex + " lowIndex=" + lowIndex + " highIndex=" + highIndex + " arraySize=" + arraySize);
-%>
-<div class="head1">Find Values</div>
-<div class="head2">For Entity: <%=modelEntity.getEntityName()%></div>
-<br/>
-<div>
- <a href="<ofbiz:url>/entitymaint</ofbiz:url>" class="buttontext">Back To Entity List</a>
-</div>
-<div>
- <a href="<ofbiz:url>/ViewRelations?entityName=<%=entityName%></ofbiz:url>" class="buttontext">View Relations</a>
- <a href="<ofbiz:url>/FindGeneric?entityName=<%=entityName%>&find=true&VIEW_SIZE=50&VIEW_INDEX=0</ofbiz:url>" class="buttontext">Find All</a>
- <%if (hasCreatePermission) {%>
- <a href="<ofbiz:url>/ViewGeneric?entityName=<%=entityName%></ofbiz:url>" class="buttontext">Create New</a>
- <%}%>
-</div>
-<br/>
-<div class="tabletext">To find ALL <%=modelEntity.getEntityName()%>s, leave all entries blank.</div>
-<%--<div class="tabletext">You may use the '&' character as a wildcard for String fields.</div>--%>
-<form method="post" action="<ofbiz:url>/FindGeneric?entityName=<%=entityName%></ofbiz:url>" style="margin:0;">
-<input type="hidden" name="find" value="true">
-<table border="1" cellpadding="2" cellspacing="0">
- <tr class="viewOneTR1">
- <td valign="top">
- <span class="tableheadtext">Field Name</span>
- </td>
- <td valign="top">
- <span class="tableheadtext">PK</span>
- </td>
- <td valign="top">
- <span class="tableheadtext">Field Type</span>
- </td>
- <td valign="top">
- <span class="tableheadtext"><input type="submit" value="Find" class="smallSubmit"></span>
- </td>
- </tr>
- <%for (int fnum=0; fnum<modelEntity.getFieldsSize(); fnum++) {%>
- <%ModelField field = modelEntity.getField(fnum);%>
- <%ModelFieldType type = delegator.getEntityFieldType(modelEntity, field.getType());%>
- <tr>
- <td valign="top">
- <span class="tableheadtext"><%=field.getName()%></span>
- </td>
- <td valign="top">
- <span class="tabletext"><%if (field.getIsPk()) {%>*<%}%> </span>
- </td>
- <td valign="top">
- <span class="tabletext"><%=type.getJavaType()%>,<%=type.getSqlType()%></span>
- </td>
- <td valign="top">
- <input type="text" name="<%=field.getName()%>" value="<%=(request.getParameter(field.getName()) != null? request.getParameter(field.getName()): "")%>" size="40" class="inputBox">
- </td>
- </tr>
- <%}%>
- <tr>
- <td valign="top" align="center" colspan="4"><input type="submit" value="Find" class="smallSubmit"></td>
- </tr>
-</table>
-</form>
-
-<br/>
-<%if (hasCreatePermission) {%>
- <a href='<ofbiz:url>/ViewGeneric?entityName=<%=entityName%></ofbiz:url>' class="buttontext">Create New <%=modelEntity.getEntityName()%></a>
-<%}%>
-<table border="0" width="100%" cellpadding="2">
-<% if (arraySize > 0) { %>
- <tr>
- <td align="left">
- <span class="tableheadtext">
- <% if(viewIndex > 0) { %>
- <a href='<ofbiz:url>/FindGeneric?<%=curFindString%>&VIEW_SIZE=<%=viewSize%>&VIEW_INDEX=<%=(viewIndex-1)%></ofbiz:url>' class="buttontext">Previous</a> |
- <% } %>
- <% if(arraySize > 0) { %>
- <%=lowIndex%> - <%=highIndex%> of <%=arraySize%>
- <% } %>
- <% if(arraySize>highIndex) { %>
- | <a href='<ofbiz:url>/FindGeneric?<%=curFindString%>&VIEW_SIZE=<%=viewSize%>&VIEW_INDEX=<%=(viewIndex+1)%></ofbiz:url>' class="buttontext">Next</a>
- <% } %>
- </span>
- </td>
- </tr>
-<%}%>
-</table>
-
- <table border="1" cellpadding="2" cellspacing="0" class="calendarTable">
- <tr class="viewOneTR1">
- <td> </td>
- <%if (hasDeletePermission) {%>
- <td> </td>
- <%}%>
- <%for (int fnum = 0; fnum < modelEntity.getFieldsSize(); fnum++) {%>
- <%ModelField field = modelEntity.getField(fnum);%>
- <td nowrap><span class="tableheadtext"><%=field.getName()%></span></td>
- <%}%>
- </tr>
-<%
- if (resultPartialList != null) {
- //int loopIndex = lowIndex;
- Iterator resultPartialIter = resultPartialList.iterator();
- while (resultPartialIter.hasNext()) {
- GenericValue value = (GenericValue) resultPartialIter.next();
-%>
- <%rowClassResult=(rowClassResult==rowClassResult1?rowClassResult2:rowClassResult1);%>
- <tr>
- <td>
- <%
- String findString = "entityName=" + entityName;
- for (int pknum = 0; pknum < modelEntity.getPksSize(); pknum++) {
- ModelField pkField = modelEntity.getPk(pknum);
- ModelFieldType type = delegator.getEntityFieldType(modelEntity, pkField.getType());
- findString += "&" + pkField.getName() + "=" + value.get(pkField.getName());
- }
- %>
- <a href='<ofbiz:url>/ViewGeneric?<%=findString%></ofbiz:url>' class="buttontext">View</a>
- </td>
- <%if (hasDeletePermission) {%>
- <td>
- <a href='<ofbiz:url>/UpdateGeneric?<%=findString%>&UPDATE_MODE=DELETE&<%=curFindString%></ofbiz:url>' class="buttontext">Delete</a>
- </td>
- <%}%>
- <%for (int fnum = 0; fnum < modelEntity.getFieldsSize(); fnum++) {%>
- <%ModelField field = modelEntity.getField(fnum);%>
- <%ModelFieldType type = delegator.getEntityFieldType(modelEntity, field.getType());%>
- <td>
- <div class="tabletext">
- <%if(type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {%>
- <%java.sql.Timestamp dtVal = value.getTimestamp(field.getName());%>
- <%=dtVal==null?"":dtVal.toString()%>
- <%} else if(type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {%>
- <%java.sql.Date dateVal = value.getDate(field.getName());%>
- <%=dateVal==null?"":dateVal.toString()%>
- <%} else if(type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {%>
- <%java.sql.Time timeVal = value.getTime(field.getName());%>
- <%=timeVal==null?"":timeVal.toString()%>
- <%} else if(type.getJavaType().indexOf("Integer") >= 0) {%>
- <%=UtilFormatOut.safeToString((Integer)value.get(field.getName()))%>
- <%} else if(type.getJavaType().indexOf("Long") >= 0) {%>
- <%=UtilFormatOut.safeToString((Long)value.get(field.getName()))%>
- <%} else if(type.getJavaType().indexOf("Double") >= 0) {%>
- <%=UtilFormatOut.safeToString((Double)value.get(field.getName()))%>
- <%} else if(type.getJavaType().indexOf("Float") >= 0) {%>
- <%=UtilFormatOut.safeToString((Float)value.get(field.getName()))%>
- <%} else if(type.getJavaType().indexOf("String") >= 0) {%>
- <%=UtilFormatOut.checkNull((String)value.get(field.getName()))%>
- <%}%>
- </div>
- </td><%}%>
- </tr>
- <%}%>
-<%
- } else {
-%>
-<%rowClassResult=(rowClassResult==rowClassResult1?rowClassResult2:rowClassResult1);%>
-<tr>
-<td colspan="<%=modelEntity.getFieldsSize() + 2%>">
-<div class="head2">No <%=modelEntity.getEntityName()%> records Found.</div>
-</td>
-</tr>
-<%}%>
-</table>
-
-<table border="0" width="100%" cellpadding="2">
-<% if (arraySize > 0) { %>
- <tr>
- <td align="left">
- <span class="tableheadtext">
- <% if (viewIndex > 0) { %>
- <a href='<ofbiz:url>/FindGeneric?<%=curFindString%>&VIEW_SIZE=<%=viewSize%>&VIEW_INDEX=<%=(viewIndex-1)%></ofbiz:url>' class="buttontext">Previous</a> |
- <% } %>
- <% if (arraySize > 0) { %>
- <%=lowIndex%> - <%=highIndex%> of <%=arraySize%>
- <% } %>
- <% if (arraySize>highIndex) { %>
- | <a href='<ofbiz:url>/FindGeneric?<%=curFindString%>&VIEW_SIZE=<%=viewSize%>&VIEW_INDEX=<%=(viewIndex+1)%></ofbiz:url>' class="buttontext">Next</a>
- <% } %>
- </span>
- </td>
- </tr>
-<%}%>
-</table>
-<%if (hasCreatePermission){%>
- <a href='<ofbiz:url>/ViewGeneric?entityName=<%=entityName%></ofbiz:url>' class="buttontext">Create New <%=modelEntity.getEntityName()%></a>
-<%}%>
-<%} else {%>
- <div class="head2">You do not have permission to view this page (<%=modelEntity.getPlainTableName()%>_ADMIN, or <%=modelEntity.getPlainTableName()%>_VIEW needed).</div>
-<%}%>
-<%} catch (Exception e) { Debug.log(e); throw e; }%>
Added: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl?view=auto&rev=473992
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl (added)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl Sun Nov 12 09:02:39 2006
@@ -0,0 +1,285 @@
+<#--
+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.
+-->
+<STYLE>
+ .topouter { overflow: hidden; border-style: none; height: 900px;}
+ .topcontainer { POSITION: absolute; VISIBILITY: visible; width: 90%; border-style: none; }
+ .topcontainerhidden { POSITION: absolute; VISIBILITY: hidden; }
+</STYLE>
+<script language="JavaScript" type="text/javascript">
+ var numTabs=${relSize};
+ function ShowTab(lname) {
+ for(inc=1; inc <= numTabs; inc++) {
+ document.getElementById('area' + inc).className = (lname == 'tab' + inc) ? 'topcontainer' : 'topcontainerhidden';
+ }
+ }
+</script>
+<div class="topouter">
+ <div class="head1">${uiLabelMap.WebtoolsViewValue}</div>
+ <div class="head2">${uiLabelMap.WebtoolsForEntity}: ${entityName}</div>
+ <div class="head2">${uiLabelMap.WebtoolsWithPk}: ${findByPk}</div>
+ <div> </div>
+ <div>
+ <a href='<@o...@ofbizUrl>' class="buttontext">${uiLabelMap.WebtoolsBackToFindScreen}</a>
+ </div>
+ <div>
+ <#if hasCreatePermission>
+ <a href='<@o...@ofbizUrl>' class="buttontext">${uiLabelMap.CommonCreateNew}</a>
+ <a href='javascript:ShowTab("tab2")' class="buttontext">${uiLabelMap.CommonEdit}</a>
+ </#if>
+ <#if value?has_content>
+ <#if hasDeletePermission>
+ <a href='<@o...@ofbizUrl>' class="buttontext">${uiLabelMap.WebtoolsDeleteThisValue}</a>
+ </#if>
+ </#if>
+ </div>
+ <div> </div>
+ <#if value?has_content>
+ <form name="relationForm">
+ <table cellpadding='0' cellspacing='0'>
+ <tr>
+ <td class="tableheadtext">${uiLabelMap.CommonView}:</td>
+ </tr>
+ <tr>
+ <td>
+ <select name="relations" onchange='javascript:ShowTab(this.options[this.selectedIndex].value)' class="selectBox">
+ <option value="tab1"><b>${entityName}</b></option>
+ <#list relations as relation>
+ <option value="${relation.tab}">${relation.title}${relation.relEntityName} (${relation.type})</option>
+ </#list>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </#if>
+ <#assign rowClass = "viewOneTR1">
+ <div id='area1' class='topcontainer' width="1%">
+ <table border="1" cellpadding="2" cellspacing="0" class="calendarTable">
+ <#if value?has_content>
+ <#assign rowClass = 'viewManyTR1'>
+ <#list fields as field>
+ <tr class="${rowClass}">
+ <td valign="top"><div class="tabletext"><b>${field.name}</b></div></td>
+ <td valign="top">
+ <div class="tabletext">
+ ${field.value}
+
+ </div>
+ </td>
+ </tr>
+ <#if rowClass == 'viewManyTR1'>
+ <#assign rowClass = 'viewManyTR2'>
+ <#else>
+ <#assign rowClass = 'viewManyTR1'>
+ </#if>
+ </#list>
+ <#else>
+ <tr class="${rowClass}">
+ <td>
+ <h3>${uiLabelMap.WebtoolsSpecifiedEntity1} ${entityName} ${uiLabelMap.WebtoolsSpecifiedEntity2}.</h3>
+ </td>
+ </tr>
+ </#if>
+ </table>
+ </div>
+ <#if hasUpdatePermission || hasCreatePermission>
+ <div id='area2' class='topcontainerhidden' width="1%">
+ <#if pkNotFound>
+ <div class="tabletext">${uiLabelMap.WebtoolsEntityName} ${entityName} ${uiLabelMap.WebtoolsWithPk} ${findByPk} ${uiLabelMap.WebtoolsSpecifiedEntity2}.</div>
+ </#if>
+ <form action='<@o...@ofbizUrl>' method="POST" name="updateForm">
+ <table border="1" cellpadding="2" cellspacing="0" class="calendarTable">
+ <#assign showFields = true>
+ <#assign rowClass = 'viewManyTR1'>
+ <#if value?has_content>
+ <#if hasUpdatePermission>
+ <#if newFieldPkList?has_content>
+ <input type="hidden" name="UPDATE_MODE" value="UPDATE"/>
+ <#assign rowClass = 'viewManyTR1'>
+ <#list newFieldPkList as field>
+ <tr class="${rowClass}">
+ <td valign="top"><div class="tabletext"><b>${field.name}</b></div></td>
+ <td valign="top">
+ <div class="tabletext">
+ <input type="hidden" name="${field.name}" value="${field.value}">
+ ${field.value}
+
+ </div>
+ </td>
+ </tr>
+ <#if rowClass == 'viewManyTR1'>
+ <#assign rowClass = 'viewManyTR2'>
+ <#else>
+ <#assign rowClass = 'viewManyTR1'>
+ </#if>
+ </#list>
+ </#if>
+ <#else>
+ ${uiLabelMap.WebtoolsMesseage17} ${entityName} ${plainTableName} ${uiLabelMap.WebtoolsMesseage18}
+ <#assign showFields = false>
+ </#if>
+ <#else>
+ <#if hasCreatePermission>
+ <#if newFieldPkList?has_content>
+ <div class="tabletext">${uiLabelMap.WebtoolsMessage15} ${entityName} ${uiLabelMap.WebtoolsMessage16}.</div>
+ <input type="hidden" name="UPDATE_MODE" value="CREATE"/>
+ <#list newFieldPkList as field>
+ <tr class="${rowClass}">
+ <td valign="top"><div class="tabletext"><b>${field.name}</b></div></td>
+ <td valign="top">
+ <div class="tabletext">
+ <#if field.fieldType == 'DateTime'>
+ DateTime(YYYY-MM-DD HH:mm:SS.sss):<input class='editInputBox' type="text" name="${field.name}" size="24" value="${field.value}">
+ <a href="javascript:call_cal(document.updateForm.${field.name}>, '${field.value}');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar'></a>
+ <#elseif field.fieldType == 'Date'>
+ Date(YYYY-MM-DD):<input class='editInputBox' type="text" name="${field.name}" size="11" value="${field.value}">
+ <a href="javascript:call_cal(document.updateForm.${field.name}>, '${field.value}');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar'></a>
+ <#elseif field.fieldType == 'Time'>
+ Time(HH:mm:SS.sss):<input class='editInputBox' type="text" size="6" maxlength="10" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'Integer'>
+ <input class='editInputBox' type="text" size="20" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'Long'>
+ <input class='editInputBox' type="text" size="20" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'Double'>
+ <input class='editInputBox' type="text" size="20" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'Float'>
+ <input class='editInputBox' type="text" size="20" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'StringOneRow'>
+ <input class='editInputBox' type="text" size="${field.stringLength}" maxlength="${field.stringLength}" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'String'>
+ <input class='editInputBox' type="text" size="80" maxlength="${field.stringLength}" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'Textarea'>
+ <textarea cols="60" rows="3" maxlength="${field.stringLength}" name="${field.name}">${field.value}</textarea>
+ </#if>
+
+ </div>
+ </td>
+ </tr>
+ <#if rowClass == 'viewManyTR1'>
+ <#assign rowClass = 'viewManyTR2'>
+ <#else>
+ <#assign rowClass = 'viewManyTR1'>
+ </#if>
+ </#list>
+ </#if>
+ <#else>
+ ${uiLabelMap.WebtoolsMesseage17} ${entityName} ${plainTableName} ${uiLabelMap.WebtoolsMesseage18}
+ <#assign showFields = false>
+ </#if>
+ </#if>
+ <#if showFields>
+ <#if newFieldNoPkList?has_content>
+ <#list newFieldNoPkList as field>
+ <tr class="${rowClass}">
+ <td valign="top"><div class="tabletext"><b>${field.name}</b></div></td>
+ <td valign="top">
+ <div class="tabletext">
+ <#if field.fieldType == 'DateTime'>
+ DateTime(YYYY-MM-DD HH:mm:SS.sss):<input class='editInputBox' type="text" name="${field.name}" size="24" value="${field.value}">
+ <a href="javascript:call_cal(document.updateForm.${field.name}>, '${field.value}');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar'></a>
+ <#elseif field.fieldType == 'Date'>
+ Date(YYYY-MM-DD):<input class='editInputBox' type="text" name="${field.name}" size="11" value="${field.value}">
+ <a href="javascript:call_cal(document.updateForm.${field.name}>, '${field.value}');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar'></a>
+ <#elseif field.fieldType == 'Time'>
+ Time(HH:mm:SS.sss):<input class='editInputBox' type="text" size="6" maxlength="10" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'Integer'>
+ <input class='editInputBox' type="text" size="20" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'Long'>
+ <input class='editInputBox' type="text" size="20" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'Double'>
+ <input class='editInputBox' type="text" size="20" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'Float'>
+ <input class='editInputBox' type="text" size="20" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'StringOneRow'>
+ <input class='editInputBox' type="text" size="${field.stringLength}" maxlength="${field.stringLength}" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'String'>
+ <input class='editInputBox' type="text" size="80" maxlength="${field.stringLength}" name="${field.name}" value="${field.value}">
+ <#elseif field.fieldType == 'Textarea'>
+ <textarea cols="60" rows="3" maxlength="${field.stringLength}" name="${field.name}">${field.value}</textarea>
+ </#if>
+
+ </div>
+ </td>
+ </tr>
+ <#if rowClass == 'viewManyTR1'>
+ <#assign rowClass = 'viewManyTR2'>
+ <#else>
+ <#assign rowClass = 'viewManyTR1'>
+ </#if>
+ </#list>
+ <#if value?has_content>
+ <#assign button = "${uiLabelMap.CommonUpdate}">
+ <#else>
+ <#assign button = "${uiLabelMap.CommonCreate}">
+ </#if>
+ <tr class="${rowClass}" align="center">
+ <td colspan="2"><input type="submit" name="Update" value="${button}"></td>
+ </tr>
+ </#if>
+ </#if>
+ </table>
+ </form>
+ </div>
+ </#if>
+ <#if relationFieldList?has_content>
+ <#list relationFieldList as relation>
+ <div id="area${relation.relIndex}" class='topcontainerhidden' width="100%">
+ <div class='areaheader'>
+ <b>${relation.title}</b> ${uiLabelMap.WebtoolsRelatedEntity}: <b>${relation.relatedTable}</b>
+ ${uiLabelMap.WebtoolsWithPk}: <#if relation.valueRelated?has_content>${relation.valueRelatedPk?if_exists}<#else>"${uiLabelMap.WebtoolsSpecifiedEntity1} ${uiLabelMap.WebtoolsSpecifiedEntity2}!"</#if>
+ </div>
+ <#if relation.valueRelated?has_content>
+ <a href='<@o...@ofbizUrl>' class="buttontext">[${uiLabelMap.CommonView} ${relation.relatedTable}]</a>
+ <#else>
+ <#if hasAllCreate || relCreate>
+ <a href='<@o...@ofbizUrl>' class="buttontext">[${uiLabelMap.CommonCreate} ${relation.relatedTable}]</a>
+ </#if>
+ </#if>
+ <div style='width: 100%; overflow: visible; border-style: none;'>
+ <table border="1" cellpadding="2" cellspacing="0" class="calendarTable">
+ <#assign rowClass = 'viewManyTR1'>
+ <#if relation.valueRelated?has_content>
+ <#if relation.relatedFieldsList?has_content>
+ <#list relation.relatedFieldsList as relatedField>
+ <tr class="${rowClass}">
+ <td valign="top"><div class="tabletext"><b>${relatedField.name}</b></div></td>
+ <td valign="top">
+ <div class="tabletext">
+ ${relatedField.value}
+ </div>
+ </td>
+ </tr>
+ <#if rowClass == 'viewManyTR1'>
+ <#assign rowClass = 'viewManyTR2'>
+ <#else>
+ <#assign rowClass = 'viewManyTR1'>
+ </#if>
+ </#list>
+ </#if>
+ <#else>
+ <tr class="${rowClass}"><td><b>${uiLabelMap.WebtoolsSpecifiedEntity1} ${relation.relatedTable} ${uiLabelMap.WebtoolsSpecifiedEntity2}.</b></td></tr>
+ </#if>
+ </table>
+ </div>
+ </div>
+ </#list>
+ </#if>
+</div>
+<#if (hasUpdatePermission || hasCreatePermission) && !useValue>
+ <script language="JavaScript" type="text/javascript">
+ ShowTab("tab2");
+ </script>
+</#if>
Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.ftl
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.jsp
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.jsp?view=diff&rev=473992&r1=473991&r2=473992
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.jsp (original)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewGeneric.jsp Sun Nov 12 09:02:39 2006
@@ -1,591 +0,0 @@
-<%--
-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.
---%>
-
-<%@ page import="java.text.*, java.util.*, java.net.*" %>
-<%@ page import="org.ofbiz.security.*, org.ofbiz.entity.*, org.ofbiz.base.util.*, org.ofbiz.webapp.pseudotag.*" %>
-<%@ page import="org.ofbiz.entity.model.*" %>
-
-<%@ taglib uri="ofbizTags" prefix="ofbiz" %>
-
-<jsp:useBean id="security" type="org.ofbiz.security.Security" scope="request" />
-<jsp:useBean id="delegator" type="org.ofbiz.entity.GenericDelegator" scope="request" />
-<%try {%>
-
-<%String entityName = request.getParameter("entityName");%>
-<%ModelReader reader = delegator.getModelReader();%>
-<%ModelEntity entity = reader.getModelEntity(entityName);%>
-
-<%boolean hasAllView = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session);%>
-<%boolean hasAllCreate = security.hasEntityPermission("ENTITY_DATA", "_CREATE", session);%>
-<%boolean hasAllUpdate = security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session);%>
-<%boolean hasAllDelete = security.hasEntityPermission("ENTITY_DATA", "_DELETE", session);%>
-
-<%boolean hasViewPermission = hasAllView || security.hasEntityPermission(entity.getPlainTableName(), "_VIEW", session);%>
-<%boolean hasCreatePermission = hasAllCreate || security.hasEntityPermission(entity.getPlainTableName(), "_CREATE", session);%>
-<%boolean hasUpdatePermission = hasAllUpdate || security.hasEntityPermission(entity.getPlainTableName(), "_UPDATE", session);%>
-<%boolean hasDeletePermission = hasAllDelete || security.hasEntityPermission(entity.getPlainTableName(), "_DELETE", session);%>
-<%if(hasViewPermission){%>
-
-<%
- boolean useValue = true;
-
- String rowClass1 = "viewOneTR1";
- String rowClass2 = "viewOneTR2";
- String rowClass = "";
- String curFindString = "entityName=" + entityName;
- GenericPK findByPK = delegator.makePK(entityName, null);
- for(int fnum = 0; fnum < entity.getPksSize(); fnum++) {
- ModelField field = entity.getPk(fnum);
- ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
- String fval = request.getParameter(field.getName());
- if(fval != null && fval.length() > 0) {
- curFindString = curFindString + "&" + field.getName() + "=" + fval;
- findByPK.setString(field.getName(), fval);
- }
- }
- curFindString = UtilFormatOut.encodeQuery(curFindString);
-
- GenericValue value = null;
- //only try to find it if this is a valid primary key...
- if(findByPK.isPrimaryKey()) value = delegator.findByPrimaryKey(findByPK);
- if(value == null) useValue = false;
-%>
-<br/>
-<STYLE>
- .topouter { overflow: visible; border-style: none; }
- .topcontainer { POSITION: absolute; VISIBILITY: visible; width: 90%; border-style: none; }
- .topcontainerhidden { POSITION: absolute; VISIBILITY: hidden; }
-</STYLE>
-<script language="JavaScript" type="text/javascript">
-var numTabs=<%=entity.getRelationsSize()+2%>;
-function ShowTab(lname) {
- for(inc=1; inc <= numTabs; inc++) {
- document.getElementById('area' + inc).className = (lname == 'tab' + inc) ? 'topcontainer' : 'topcontainerhidden';
- }
-}
-</script>
-<div class="head1">View Value</div>
-<div class="head2">For Entity: <%=entityName%></div>
-<div class="head2">With PK: <%=findByPK.toString()%></div>
-<br/>
-<div>
-<a href='<ofbiz:url>/FindGeneric?entityName=<%=entityName%></ofbiz:url>' class="buttontext">Back To Find Screen</a>
-</div>
-<div>
-<%if (hasCreatePermission) {%>
-<a href='<ofbiz:url>/ViewGeneric?entityName=<%=entityName%></ofbiz:url>' class="buttontext">Create New</a>
-<a href='javascript:ShowTab("tab2")' class="buttontext">Edit</a>
-<%}%>
-
-<%if (value != null) {%>
- <%if (hasDeletePermission) {%>
- <a href='<ofbiz:url>/UpdateGeneric?UPDATE_MODE=DELETE&<%=curFindString%></ofbiz:url>' class="buttontext">Delete This Value</a>
- <%}%>
-<%}%>
-</div>
-<br/>
-<%if (value != null) {%>
-<form name="relationForm">
-<table cellpadding='0' cellspacing='0'><tr>
-<tr>
-<td class="tableheadtext">View:</td>
-</tr>
-<tr>
-<td>
-<select name="relations" onchange='javascript:ShowTab(this.options[this.selectedIndex].value)' class="selectBox">
- <option value="tab1"><b><%=entityName%></b></option>
- <%for(int tabIndex = 0; tabIndex < entity.getRelationsSize(); tabIndex++){%>
- <%ModelRelation relation = entity.getRelation(tabIndex);%>
- <%ModelEntity relatedEntity = reader.getModelEntity(relation.getRelEntityName());%>
- <%if (hasAllView || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_VIEW", session)) {%>
- <option value="tab<%=tabIndex+3%>"><%=relation.getTitle()%><%=relation.getRelEntityName()%> (<%=relation.getType()%>)</option>
- <%}%>
- <%}%>
-</select>
-</td>
-</tr>
-</table>
-</form>
-<%}%>
-
-<div class='topouter'>
- <DIV id='area1' class='topcontainer' width="1%">
-
-<table border="0" cellspacing="2" cellpadding="2">
-<%if (value == null) {%>
-<tr class="<%=rowClass1%>">
- <td>
- <h3>Specified <%=entityName%> was not found.</h3>
- </td>
-</tr>
-<%} else {%>
- <%for (int fnum = 0; fnum < entity.getFieldsSize(); fnum++) {%>
- <%ModelField field = entity.getField(fnum);%>
- <%ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());%>
- <%rowClass=(rowClass==rowClass1?rowClass2:rowClass1);%><tr class="<%=rowClass%>">
- <td valign="top"><div class="tabletext"><b><%=field.getName()%></b></div></td>
- <td valign="top">
- <div class="tabletext">
- <%if(type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")){%>
- <%java.sql.Timestamp dtVal = value.getTimestamp(field.getName());%>
- <%=dtVal==null?"":dtVal.toString()%>
- <%} else if(type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")){%>
- <%java.sql.Date dateVal = value.getDate(field.getName());%>
- <%=dateVal==null?"":dateVal.toString()%>
- <%} else if(type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")){%>
- <%java.sql.Time timeVal = value.getTime(field.getName());%>
- <%=timeVal==null?"":timeVal.toString()%>
- <%}else if(type.getJavaType().indexOf("Integer") >= 0){%>
- <%=UtilFormatOut.safeToString((Integer)value.get(field.getName()))%>
- <%}else if(type.getJavaType().indexOf("Long") >= 0){%>
- <%=UtilFormatOut.safeToString((Long)value.get(field.getName()))%>
- <%}else if(type.getJavaType().indexOf("Double") >= 0){%>
- <%=UtilFormatOut.safeToString((Double)value.get(field.getName()))%>
- <%}else if(type.getJavaType().indexOf("Float") >= 0){%>
- <%=UtilFormatOut.safeToString((Float)value.get(field.getName()))%>
- <%}else if(type.getJavaType().indexOf("String") >= 0){%>
- <%=UtilFormatOut.checkNull((String)value.get(field.getName()))%>
- <%}%>
- </div>
- </td>
- </tr>
- <%}%>
-<%} //end if value == null %>
-</table>
- </div>
-
-<%GenericValue valueSave = value;%>
-<%if(hasUpdatePermission || hasCreatePermission){%>
- <DIV id='area2' class='topcontainerhidden' width="1%">
-<%boolean showFields = true;%>
-<%if(value == null && (findByPK.getAllFields().size() > 0)){%>
- <div class="tabletext"><%=entity.getEntityName()%> with primary key <%=findByPK.toString()%> not found.</div>
-<%}%>
-<%
- String lastUpdateMode = request.getParameter("UPDATE_MODE");
- if((session.getAttribute("_ERROR_MESSAGE_") != null || request.getAttribute("_ERROR_MESSAGE_") != null) &&
- lastUpdateMode != null && !lastUpdateMode.equals("DELETE")) {
- //if we are updating and there is an error, don't use the entity data for the fields, use parameters to get the old value
- useValue = false;
- }
-%>
-<form action='<ofbiz:url>/UpdateGeneric?entityName=<%=entityName%></ofbiz:url>' method="POST" name="updateForm" style="margin:0;">
-<table cellpadding="2" cellspacing="2" border="0">
-
-<%if (value == null) {%>
- <%if (hasCreatePermission) {%>
- <div class="tabletext">You may create a <%=entityName%> by entering the values you want, and clicking Update.</div>
- <input type="hidden" name="UPDATE_MODE" value="CREATE"/>
- <%for (int fnum = 0; fnum < entity.getPksSize();fnum++) {%>
- <%ModelField field = entity.getPk(fnum);%>
- <%ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());%>
- <%rowClass=(rowClass==rowClass1?rowClass2:rowClass1);%><tr class="<%=rowClass%>">
- <td valign="top"><div class="tabletext"><b><%=field.getName()%></b></div></td>
- <td valign="top">
- <div class="tabletext">
- <%if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {%>
- <%
- String dateTimeString = null;
- if (findByPK != null && useValue) {
- java.sql.Timestamp dtVal = findByPK.getTimestamp(field.getName());
- if(dtVal != null) {
- dateTimeString = dtVal.toString();
- }
- } else if (!useValue) {
- dateTimeString = request.getParameter(field.getName());
- }
- %>
- DateTime(YYYY-MM-DD HH:mm:SS.sss):<input class='editInputBox' type="text" name="<%=field.getName()%>" size="24" value="<%=UtilFormatOut.checkNull(dateTimeString)%>">
- <a href="javascript:call_cal(document.updateForm.<%=field.getName()%>, '<%=UtilFormatOut.checkNull(dateTimeString)%>');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar'></a>
- <%} else if(type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")){%>
- <%
- String dateString = null;
- if (findByPK != null && useValue) {
- java.sql.Date dateVal = value.getDate(field.getName());
- dateString = dateVal==null?"":dateVal.toString();
- } else if (!useValue) {
- dateString = request.getParameter(field.getName());
- }
- %>
- Date(YYYY-MM-DD):<input class='editInputBox' type="text" name="<%=field.getName()%>" size="11" value="<%=UtilFormatOut.checkNull(dateString)%>">
- <a href="javascript:call_cal(document.updateForm.<%=field.getName()%>, '<%=UtilFormatOut.checkNull(dateString)%>');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar'></a>
- <%} else if(type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")){%>
- <%
- String timeString = null;
- if (findByPK != null && useValue) {
- java.sql.Time timeVal = value.getTime(field.getName());
- timeString = timeVal==null?"":timeVal.toString();
- } else if (!useValue) {
- timeString = request.getParameter(field.getName());
- }
- %>
- Time(HH:mm:SS.sss):<input class='editInputBox' type="text" size="6" maxlength="10" name="<%=field.getName()%>" value="<%=UtilFormatOut.checkNull(timeString)%>">
- <%}else if(type.getJavaType().indexOf("Integer") >= 0){%>
- <input class='editInputBox' type="text" size="20" name="<%=field.getName()%>" value="<%=(findByPK!=null&&useValue)?UtilFormatOut.safeToString((Integer)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(request.getParameter(field.getName())))%>">
- <%}else if(type.getJavaType().indexOf("Long") >= 0){%>
- <input class='editInputBox' type="text" size="20" name="<%=field.getName()%>" value="<%=(findByPK!=null&&useValue)?UtilFormatOut.safeToString((Long)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(request.getParameter(field.getName())))%>">
- <%}else if(type.getJavaType().indexOf("Double") >= 0){%>
- <input class='editInputBox' type="text" size="20" name="<%=field.getName()%>" value="<%=(findByPK!=null&&useValue)?UtilFormatOut.safeToString((Double)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(request.getParameter(field.getName())))%>">
- <%}else if(type.getJavaType().indexOf("Float") >= 0){%>
- <input class='editInputBox' type="text" size="20" name="<%=field.getName()%>" value="<%=(findByPK!=null&&useValue)?UtilFormatOut.safeToString((Float)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(request.getParameter(field.getName())))%>">
- <%}else if(type.getJavaType().indexOf("String") >= 0){%>
- <%if(type.stringLength() <= 80){%>
- <input class='editInputBox' type="text" size="<%=type.stringLength()%>" maxlength="<%=type.stringLength()%>" name="<%=field.getName()%>" value="<%=(findByPK!=null&&useValue)?UtilFormatOut.checkNull((String)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(request.getParameter(field.getName())))%>">
- <%} else if(type.stringLength() <= 255){%>
- <input class='editInputBox' type="text" size="80" maxlength="<%=type.stringLength()%>" name="<%=field.getName()%>" value="<%=(findByPK!=null&&useValue)?UtilFormatOut.checkNull((String)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(request.getParameter(field.getName())))%>">
- <%} else {%>
- <textarea cols="60" rows="3" maxlength="<%=type.stringLength()%>" name="<%=field.getName()%>"><%=(findByPK!=null&&useValue)?UtilFormatOut.checkNull((String)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(request.getParameter(field.getName())))%></textarea>
- <%}%>
- <%}%>
- </div>
- </td>
- </tr>
- <%}%>
- <%}else{%>
- <%showFields=false;%>
- You do not have permission to create a <%=entityName%> (<%=entity.getPlainTableName()%>_ADMIN, or <%=entity.getPlainTableName()%>_CREATE needed).
- <%}%>
-<%}else{%>
- <%if(hasUpdatePermission){%>
- <input type="hidden" name="UPDATE_MODE" value="UPDATE">
-
- <%for (int fnum = 0; fnum < entity.getPksSize();fnum++){%>
- <%ModelField field = entity.getPk(fnum);%>
- <%ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());%>
- <%rowClass=(rowClass==rowClass1?rowClass2:rowClass1);%><tr class="<%=rowClass%>">
- <td valign="top"><div class="tabletext"><b><%=field.getName()%></b></div></td>
- <td valign="top">
- <div class="tabletext">
- <%if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {%>
- <%java.sql.Timestamp dtVal = value.getTimestamp(field.getName());%>
- <%String dtStr = dtVal==null?"":dtVal.toString();%>
- <input type="hidden" name="<%=field.getName()%>" value="<%=dtStr%>">
- <%=dtStr%>
- <%} else if(type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {%>
- <%java.sql.Date dateVal = value.getDate(field.getName());%>
- <input type="hidden" name="<%=field.getName()%>" value="<%=dateVal==null?"":dateVal.toString()%>">
- <%=dateVal==null?"":dateVal.toString()%>
- <%} else if(type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {%>
- <%java.sql.Time timeVal = value.getTime(field.getName());%>
- <input type="hidden" name="<%=field.getName()%>" value="<%=timeVal==null?"":timeVal.toString()%>">
- <%=timeVal==null?"":timeVal.toString()%>
- <%} else if(type.getJavaType().indexOf("Integer") >= 0) {%>
- <%Integer numVal = (Integer) value.get(field.getName());%>
- <input type="hidden" name="<%=field.getName()%>" value="<%=numVal==null?"":numVal.toString()%>">
- <%=numVal==null?"":numVal.toString()%>
- <%} else if(type.getJavaType().indexOf("Long") >= 0) {%>
- <%Long numVal = (Long) value.get(field.getName());%>
- <input type="hidden" name="<%=field.getName()%>" value="<%=numVal==null?"":numVal.toString()%>">
- <%=numVal==null?"":numVal.toString()%>
- <%} else if(type.getJavaType().indexOf("Double") >= 0) {%>
- <%Double numVal = (Double) value.get(field.getName());%>
- <input type="hidden" name="<%=field.getName()%>" value="<%=numVal==null?"":numVal.toString()%>">
- <%=numVal==null?"":numVal.toString()%>
- <%} else if(type.getJavaType().indexOf("Float") >= 0) {%>
- <%Float numVal = (Float) value.get(field.getName());%>
- <input type="hidden" name="<%=field.getName()%>" value="<%=numVal==null?"":numVal.toString()%>">
- <%=numVal==null?"":numVal.toString()%>
- <%} else if(type.getJavaType().indexOf("String") >= 0) {%>
- <input type="hidden" name="<%=field.getName()%>" value="<%=UtilFormatOut.checkNull((String)value.get(field.getName()))%>">
- <%=UtilFormatOut.checkNull((String)value.get(field.getName()))%>
- <%}%>
- </div>
- </td>
- </tr>
- <%}%>
-
- <%} else {%>
- <%showFields=false;%>
- You do not have permission to update a <%=entityName%> (<%=entity.getPlainTableName()%>_ADMIN, or <%=entity.getPlainTableName()%>_UPDATE needed).
- <%}%>
-<%} //end if value == null %>
-
-<%if (showFields) {%>
- <%for (int fnum = 0; fnum < entity.getNopksSize(); fnum++) {%>
- <%ModelField field = entity.getNopk(fnum);%>
- <%ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());%>
- <%rowClass=(rowClass==rowClass1?rowClass2:rowClass1);%><tr class="<%=rowClass%>">
- <td valign="top"><div class="tabletext"><b><%=field.getName()%></b></div></td>
- <td valign="top">
- <div class="tabletext">
- <%if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {%>
- <%
- String dateTimeString = null;
- if (value != null && useValue) {
- java.sql.Timestamp dtVal = value.getTimestamp(field.getName());
- if(dtVal != null) {
- dateTimeString = dtVal.toString();
- }
- } else if (!useValue) {
- dateTimeString = request.getParameter(field.getName());
- }
- %>
- DateTime(YYYY-MM-DD HH:mm:SS.sss):<input class='editInputBox' type="text" name="<%=field.getName()%>" size="24" value="<%=UtilFormatOut.checkNull(dateTimeString)%>">
- <a href="javascript:call_cal(document.updateForm.<%=field.getName()%>, '<%=UtilFormatOut.checkNull(dateTimeString)%>');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar'></a>
- <%} else if (type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {%>
- <%
- String dateString = null;
- if (value != null && useValue) {
- java.sql.Date dateVal = value.getDate(field.getName());
- dateString = dateVal==null?"":dateVal.toString();
- } else if (!useValue) {
- dateString = request.getParameter(field.getName());
- }
- %>
- Date(YYYY-MM-DD):<input class='editInputBox' type="text" name="<%=field.getName()%>" size="11" value="<%=UtilFormatOut.checkNull(dateString)%>">
- <a href="javascript:call_cal(document.updateForm.<%=field.getName()%>, null);" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Click here For Calendar'></a>
- <%} else if (type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {%>
- <%
- String timeString = null;
- if (value != null && useValue) {
- java.sql.Time timeVal = value.getTime(field.getName());
- timeString = timeVal==null?"":timeVal.toString();
- } else if (!useValue) {
- timeString = request.getParameter(field.getName());
- }
- %>
- Time(HH:mm:SS.sss):<input class='editInputBox' type="text" size="6" maxlength="10" name="<%=field.getName()%>" value="<%=UtilFormatOut.checkNull(timeString)%>">
- <%}else if (type.getJavaType().indexOf("Integer") >= 0){%>
- <input class='editInputBox' type="text" size="20" name="<%=field.getName()%>" value="<%=(value!=null&&useValue)?UtilFormatOut.safeToString((Integer)value.get(field.getName())):UtilFormatOut.checkNull(request.getParameter(field.getName()))%>">
- <%}else if (type.getJavaType().indexOf("Long") >= 0){%>
- <input class='editInputBox' type="text" size="20" name="<%=field.getName()%>" value="<%=(value!=null&&useValue)?UtilFormatOut.safeToString((Long)value.get(field.getName())):UtilFormatOut.checkNull(request.getParameter(field.getName()))%>">
- <%}else if (type.getJavaType().indexOf("Double") >= 0){%>
- <input class='editInputBox' type="text" size="20" name="<%=field.getName()%>" value="<%=(value!=null&&useValue)?UtilFormatOut.safeToString((Double)value.get(field.getName())):UtilFormatOut.checkNull(request.getParameter(field.getName()))%>">
- <%}else if (type.getJavaType().indexOf("Float") >= 0){%>
- <input class='editInputBox' type="text" size="20" name="<%=field.getName()%>" value="<%=(value!=null&&useValue)?UtilFormatOut.safeToString((Float)value.get(field.getName())):UtilFormatOut.checkNull(request.getParameter(field.getName()))%>">
- <%}else if (type.getJavaType().indexOf("String") >= 0){%>
- <%if (type.stringLength() <= 80){%>
- <input class='editInputBox' type="text" size="<%=type.stringLength()%>" maxlength="<%=type.stringLength()%>" name="<%=field.getName()%>" value="<%=(value!=null&&useValue)?UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(request.getParameter(field.getName()))%>">
- <%} else if (type.stringLength() <= 255){%>
- <input class='editInputBox' type="text" size="80" maxlength="<%=type.stringLength()%>" name="<%=field.getName()%>" value="<%=(value!=null&&useValue)?UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(request.getParameter(field.getName()))%>">
- <%} else {%>
- <textarea cols="60" rows="3" maxlength="<%=type.stringLength()%>" name="<%=field.getName()%>"><%=(value!=null&&useValue)?UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(request.getParameter(field.getName()))%></textarea>
- <%}%>
- <%}%>
- </div>
- </td>
- </tr>
- <%}%>
-
- <%rowClass=(rowClass==rowClass1?rowClass2:rowClass1);%><tr class="<%=rowClass%>">
- <td colspan="2"><input type="submit" name="Update" value="Update"></td>
- </tr>
-<%}%>
-</table>
-</form>
- </div>
-<%}%>
-<%-- ======================================================================== --%>
-
-<%for (int relIndex = 0; relIndex < entity.getRelationsSize(); relIndex++) {%>
- <%ModelRelation relation = entity.getRelation(relIndex);%>
- <%ModelEntity relatedEntity = reader.getModelEntity(relation.getRelEntityName());%>
- <%if("one".equals(relation.getType()) || "one-nofk".equals(relation.getType())) {%>
-<%-- Start ModelRelation for <%=relation.relatedEjbName%>, type: one --%>
-<%if (value != null) {%>
- <%if (hasAllView || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_VIEW", session)) {%>
- <%-- GenericValue valueRelated = delegator.findByPrimaryKey(value.get<%=relation.keyMapUpperString("(), " + GenUtil.lowerFirstChar(entity.getEntityName()) + ".get", "()")%>); --%>
- <%Iterator tempIter = UtilMisc.toIterator(value.getRelated(relation.getTitle() + relatedEntity.getEntityName()));%>
- <%GenericValue valueRelated = null;%>
- <%if (tempIter != null && tempIter.hasNext()) valueRelated = (GenericValue) tempIter.next();%>
- <DIV id='area<%=relIndex+3%>' class='topcontainerhidden' width="100%">
- <div class='areaheader'>
- <b><%=relation.getTitle()%></b> Related Entity: <b><%=relatedEntity.getEntityName()%></b> with PK: <%=valueRelated!=null?valueRelated.getPrimaryKey().toString():"entity not found!"%>
- </div>
- <%
- String findString = "entityName=" + relatedEntity.getEntityName();
- for (int knum = 0; knum < relation.getKeyMapsSize(); knum++) {
- ModelKeyMap keyMap = relation.getKeyMap(knum);
- if (value.get(keyMap.getFieldName()) != null) {
- findString += "&" + keyMap.getRelFieldName() + "=" + value.get(keyMap.getFieldName());
- }
- }
- %>
-
- <%if(valueRelated == null){%>
- <%if(hasAllCreate || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_CREATE", session)){%>
- <a href='<ofbiz:url>/ViewGeneric?<%=findString%></ofbiz:url>' class="buttontext">[Create <%=relatedEntity.getEntityName()%>]</a>
- <%}%>
- <%}else{%>
- <a href='<ofbiz:url>/ViewGeneric?<%=findString%></ofbiz:url>' class="buttontext">[View <%=relatedEntity.getEntityName()%>]</a>
- <%}%>
- <div style='width: 100%; overflow: visible; border-style: none;'>
- <table border="0" cellspacing="2" cellpadding="2">
- <%if (valueRelated == null) {%>
- <tr class="<%=rowClass1%>"><td><b>Specified <%=relatedEntity.getEntityName()%> entity was not found.</b></td></tr>
- <%} else {%>
- <%for(int fnum = 0; fnum < relatedEntity.getFieldsSize(); fnum++) {%>
- <%ModelField field = relatedEntity.getField(fnum);%>
- <%ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());%>
- <%rowClass=(rowClass==rowClass1?rowClass2:rowClass1);%><tr class="<%=rowClass%>">
- <td valign="top"><div class="tabletext"><b><%=field.getName()%></b></div></td>
- <td valign="top">
- <div class="tabletext">
- <%if(type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")){%>
- <%java.sql.Timestamp dtVal = valueRelated.getTimestamp(field.getName());%>
- <%=dtVal==null?"":dtVal.toString()%>
- <%} else if(type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")){%>
- <%java.sql.Date dateVal = valueRelated.getDate(field.getName());%>
- <%=dateVal==null?"":dateVal.toString()%>
- <%} else if(type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")){%>
- <%java.sql.Time timeVal = valueRelated.getTime(field.getName());%>
- <%=timeVal==null?"":timeVal.toString()%>
- <%}else if(type.getJavaType().indexOf("Integer") >= 0){%>
- <%=UtilFormatOut.safeToString((Integer)valueRelated.get(field.getName()))%>
- <%}else if(type.getJavaType().indexOf("Long") >= 0){%>
- <%=UtilFormatOut.safeToString((Long)valueRelated.get(field.getName()))%>
- <%}else if(type.getJavaType().indexOf("Double") >= 0){%>
- <%=UtilFormatOut.safeToString((Double)valueRelated.get(field.getName()))%>
- <%}else if(type.getJavaType().indexOf("Float") >= 0){%>
- <%=UtilFormatOut.safeToString((Float)valueRelated.get(field.getName()))%>
- <%}else if(type.getJavaType().indexOf("String") >= 0){%>
- <%=UtilFormatOut.checkNull((String)valueRelated.get(field.getName()))%>
- <%}%>
- </div>
- </td>
- </tr>
- <%}%>
- <%} //end if valueRelated == null %>
- </table>
- </div>
- </div>
- <%}%>
-<%}%>
-<%-- End ModelRelation for <%=relation.relatedEjbName%>, type: one --%>
- <%}else if(relation.getType().equalsIgnoreCase("many")){%>
-<%-- Start ModelRelation for <%=relation.relatedEjbName%>, type: many --%>
-
-<%if(value != null){%>
- <%if(hasAllView || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_VIEW", session)){%>
- <%-- Iterator relatedIterator = UtilMisc.toIterator(value.getRelated(relation.getTitle() + relatedEntity.getEntityName())); --%>
- <DIV id=area<%=relIndex+3%> class='topcontainerhidden' width="100%">
- <div class=areaheader>
- <b><%=relation.getTitle()%></b> Related Entities: <b><%=relatedEntity.getEntityName()%></b> with
- </div>
- <%boolean relatedCreatePerm = hasAllCreate || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_CREATE", session);%>
- <%boolean relatedUpdatePerm = hasAllUpdate || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_UPDATE", session);%>
- <%boolean relatedDeletePerm = hasAllDelete || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_DELETE", session);%>
- <%
- String rowClassResultHeader = "viewManyHeaderTR";
- String rowClassResult1 = "viewManyTR1";
- String rowClassResult2 = "viewManyTR2";
- String rowClassResult = "";
- %>
- <%
- String findString = "entityName=" + relatedEntity.getEntityName();
- for (int knum = 0; knum < relation.getKeyMapsSize(); knum++) {
- ModelKeyMap keyMap = relation.getKeyMap(knum);
- if(value.get(keyMap.getFieldName()) != null) {
- findString += "&" + keyMap.getRelFieldName() + "=" + value.get(keyMap.getFieldName());
- }
- }
- %>
- <%if(relatedCreatePerm){%>
- <a href='<ofbiz:url>/ViewGeneric?<%=UtilFormatOut.encodeQuery(findString)%></ofbiz:url>' class="buttontext">[Create <%=relatedEntity.getEntityName()%>]</a>
- <%}%>
- <a href='<ofbiz:url>/FindGeneric?find=true&<%=UtilFormatOut.encodeQuery(findString)%></ofbiz:url>' class="buttontext">[Find <%=relatedEntity.getEntityName()%>]</a>
-<%--
- <div style='width:100%;overflow:visible;border-style:none;'>
- <table width="100%" cellpadding="2" cellspacing="2" border="0">
- <tr class="<%=rowClassResultHeader%>">
- <%for(i=0;i<relatedEntity.fields.size();i++){%>
- <td><div class="tabletext"><b><nobr><%=((ModelField)relatedEntity.fields.elementAt(i)).columnName%></nobr></b></div></td><%}%>
- <td> </td>
- <%if(relatedDeletePerm){%>
- <td> </td>
- <%}%>
- </tr>
- <%
- int relatedLoopCount = 0;
- if (relatedIterator != null && relatedIterator.hasNext()) {
- while (relatedIterator != null && relatedIterator.hasNext()) {
- relatedLoopCount++; //if(relatedLoopCount > 10) break;
- <%=relatedEntity.getEntityName()%> valueRelated = (<%=relatedEntity.getEntityName()%>)relatedIterator.next();
- if(valueRelated != null) {
- %>
- <%rowClassResult=(rowClassResult==rowClassResult1?rowClassResult2:rowClassResult1);%><tr class="<%=rowClassResult%>">
- <%for (i=0;i<relatedEntity.fields.size();i++) {%>
- <td>
- <div class="tabletext"><%if(((ModelField)relatedEntity.fields.elementAt(i)).javaType.equals("Timestamp") || ((ModelField)relatedEntity.fields.elementAt(i)).javaType.equals("java.sql.Timestamp")){%>
- <%{
- String dateTimeString = null;
- if (valueRelated != null) {
- java.sql.Timestamp timeStamp = valueRelated.get<%=GenUtil.upperFirstChar(((ModelField)relatedEntity.fields.elementAt(i)).getFieldName())%>();
- if (timeStamp != null) {
- dateTimeString = timeStamp.toString();
- }
- }
- %>
- <%=UtilFormatOut.checkNull(dateString)%> <%=UtilFormatOut.checkNull(timeString)%>
- <%}%><%} else if(((ModelField)relatedEntity.fields.elementAt(i)).javaType.equals("Date") || ((ModelField)relatedEntity.fields.elementAt(i)).javaType.equals("java.util.Date")) {%>
- <%{
- String dateString = null;
- String timeString = null;
- if (valueRelated != null) {
- java.util.Date date = valueRelated.get<%=GenUtil.upperFirstChar(((ModelField)relatedEntity.fields.elementAt(i)).getFieldName())%>();
- if (date != null) {
- dateString = UtilDateTime.toDateString(date);
- timeString = UtilDateTime.toTimeString(date);
- }
- }
- %>
- <%=UtilFormatOut.checkNull(dateString)%> <%=UtilFormatOut.checkNull(timeString)%>
- <%}%><%}else if(((ModelField)relatedEntity.fields.elementAt(i)).javaType.indexOf("Integer") >= 0 || ((ModelField)relatedEntity.fields.elementAt(i)).javaType.indexOf("Long") >= 0 || ((ModelField)relatedEntity.fields.elementAt(i)).javaType.indexOf("Double") >= 0 || ((ModelField)relatedEntity.fields.elementAt(i)).javaType.indexOf("Float") >= 0){%>
- <%=UtilFormatOut.safeToString(valueRelated.get<%=GenUtil.upperFirstChar(((ModelField)relatedEntity.fields.elementAt(i)).getFieldName())%>())%><%}else{%>
- <%=UtilFormatOut.checkNull(valueRelated.get<%=GenUtil.upperFirstChar(((ModelField)relatedEntity.fields.elementAt(i)).getFieldName())%>())%><%}%>
- </div>
- </td>
- <%}%>
- <td>
- <a href="<%=response.encodeURL(controlPath + "/View<%=relatedEntity.getEntityName()%>?" + <%=relatedEntity.httpArgListFromClass(relatedEntity.pks, "Related")%>)%>" class="buttontext">[View]</a>
- </td>
- <%if (relatedDeletePerm) {%>
- <td>
- <a href="<%=response.encodeURL(controlPath + "/Update<%=relatedEntity.getEntityName()%>?" + <%=relatedEntity.httpArgListFromClass(relatedEntity.pks, "Related")%> + "&" + <%=entity.httpArgList(entity.pks)%> + "&UPDATE_MODE=DELETE")%>" class="buttontext">[Delete]</a>
- </td>
- <%}%>
- </tr>
- <%}%>
- <%}%>
-<%} else {%>
-<%rowClassResult=(rowClassResult==rowClassResult1?rowClassResult2:rowClassResult1);%><tr class="<%=rowClassResult%>">
-<td colspan="<%=relatedEntity.fields.size() + 2%>">
-<h3>No <%=relatedEntity.getEntityName()%>s Found.</h3>
-</td>
-</tr>
-<%}%>
- </table>
- </div>
-Displaying <%=relatedLoopCount%> entities.
---%>
- </div>
- <%}%>
-<%}%>
-<%-- End ModelRelation for <%=relation.relatedEjbName%>, type: many --%>
- <%}%>
-<%}%>
-</div>
-<%if ((hasUpdatePermission || hasCreatePermission) && !useValue) {%>
- <script language="JavaScript" type="text/javascript">
- ShowTab("tab2");
- </script>
-<%}%>
-
-<br/>
-<%} else {%>
- <h3>You do not have permission to view this page (<%=entity.getPlainTableName()%>_ADMIN, or <%=entity.getPlainTableName()%>_VIEW needed).</h3>
-<%}%>
-<%} catch (Exception e) { Debug.log(e); throw e;%><%}%>
Added: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.ftl?view=auto&rev=473992
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.ftl (added)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.ftl Sun Nov 12 09:02:39 2006
@@ -0,0 +1,54 @@
+<#--
+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.
+-->
+<#if hasViewPermission>
+ <div class="head1">${uiLabelMap.WebtoolsRelations}</div>
+ <div class="head2">${uiLabelMap.WebtoolsForEntity}: ${entityName}</div>
+ <div> </div>
+ <div>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.WebtoolsBackToFindScreen}</a>
+ </div>
+ <div> </div>
+ <table border="1" cellpadding="2" cellspacing="0" class="calendarTable">
+ <tr>
+ <td class="viewOneTR2"><b>${uiLabelMap.WebtoolsTitle}</b></td>
+ <td class="viewOneTR2"><b>${uiLabelMap.WebtoolsRelatedEntity}</b></td>
+ <td class="viewOneTR2"><b>${uiLabelMap.WebtoolsRelationType}</b></td>
+ <td class="viewOneTR2"><b>${uiLabelMap.WebtoolsFKName}</b></td>
+ <td class="viewOneTR2"><b>${uiLabelMap.WebtoolsFieldsList}</b></td>
+ </tr>
+ <#assign rowClass = 'viewManyTR1'>
+ <#list relations as relation>
+ <tr class="${rowClass}">
+ <td>${relation.title}</td>
+ <td><a href='<@o...@ofbizUrl>' class="buttontext">${relation.relEntityName}</a></td>
+ <td>${relation.type}</td>
+ <td>${relation.fkName}</td>
+ <td>
+ <#list relation.relFields as field>
+ ${field.fieldName} -> ${field.relFieldName}<br/>
+ </#list>
+ </td>
+ </tr>
+ <#if rowClass == 'viewManyTR1'>
+ <#assign rowClass = 'viewManyTR2'>
+ <#else>
+ <#assign rowClass = 'viewManyTR1'>
+ </#if>
+ </#list>
+ </table>
+<#else>
+ <h3>${uiLabelMap.WebtoolsMesseage17} ${entityName} ${plainTableName} ${uiLabelMap.WebtoolsMesseage18}.</h3>
+</#if>
Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.ftl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.ftl
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.ftl
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.jsp
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.jsp?view=diff&rev=473992&r1=473991&r2=473992
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.jsp (original)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ViewRelations.jsp Sun Nov 12 09:02:39 2006
@@ -1,79 +0,0 @@
-<%--
-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.
---%>
-
-
-<%@ page import="java.text.*, java.util.*, java.net.*" %>
-<%@ page import="org.ofbiz.security.*, org.ofbiz.entity.*, org.ofbiz.base.util.*, org.ofbiz.webapp.pseudotag.*" %>
-<%@ page import="org.ofbiz.entity.model.*, org.ofbiz.entity.util.*, org.ofbiz.entity.condition.*, org.ofbiz.entity.transaction.*" %>
-
-<%@ taglib uri="ofbizTags" prefix="ofbiz" %>
-
-<jsp:useBean id="security" type="org.ofbiz.security.Security" scope="request" />
-<jsp:useBean id="delegator" type="org.ofbiz.entity.GenericDelegator" scope="request" />
-
-<%
- String rowClassResultIndex = "viewOneTR2";
- String rowClassResultHeader = "viewOneTR1";
- String rowClassResult1 = "viewManyTR1";
- String rowClassResult2 = "viewManyTR2";
- String rowClassResult = "";
-
- try {%>
-
-<%String entityName=request.getParameter("entityName");%>
-<%ModelReader reader = delegator.getModelReader();%>
-<%ModelEntity modelEntity = reader.getModelEntity(entityName);%>
-
-<%boolean hasViewPermission = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session);%>
-
-<%if(hasViewPermission){%>
-<div class="head1">Relations</div>
-<div class="head2">For Entity: <%=entityName%></div>
-<br/>
-<div>
- <a href="<ofbiz:url>/FindGeneric?entityName=<%=entityName%>&find=true&VIEW_SIZE=50&VIEW_INDEX=0</ofbiz:url>" class="buttontext">Back To Find Screen</a>
-</div>
-<br/>
-
-<table>
- <tr>
- <td class="<%=rowClassResultHeader%>"><b>Title</b></td>
- <td class="<%=rowClassResultHeader%>"><b>Related Entity</b></td>
- <td class="<%=rowClassResultHeader%>"><b>Relation Type</b></td>
- <td class="<%=rowClassResultHeader%>"><b>FK Name</b></td>
- <td class="<%=rowClassResultHeader%>"><b>Key Map</b></td>
- </tr>
-
-<% for (Iterator rit = modelEntity.getRelationsIterator(); rit.hasNext(); ) {
- ModelRelation modelRelation = (ModelRelation) rit.next();%>
- <%rowClassResult=(rowClassResult==rowClassResult1?rowClassResult2:rowClassResult1);%>
- <tr class="<%=rowClassResult%>">
- <td><%=modelRelation.getTitle()%></td>
- <td><a href='<ofbiz:url>/FindGeneric?entityName=<%=modelRelation.getRelEntityName()%>&find=true&VIEW_SIZE=50&VIEW_INDEX=0</ofbiz:url>' class="buttontext"><%=modelRelation.getRelEntityName()%></a></td>
- <td> <%=modelRelation.getType()%></td>
- <td><%=modelRelation.getFkName()%></td>
- <td><% for (Iterator kit = modelRelation.getKeyMapsIterator(); kit.hasNext(); ) {
- ModelKeyMap keyMap = (ModelKeyMap) kit.next(); %>
- <%=keyMap.getFieldName()%> -> <%=keyMap.getRelFieldName()%> <br/>
- <%}%>
- </tr>
-<%}%>
-</table>
-<%} else {%>
- <h3>You do not have permission to view this page (<%=modelEntity.getPlainTableName()%>_ADMIN, or <%=modelEntity.getPlainTableName()%>_VIEW needed).</h3>
-<%}%>
-
-<%} catch (Exception e) { Debug.log(e); throw e; }%>
Modified: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/entitymaint.jsp
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/entitymaint.jsp?view=diff&rev=473992&r1=473991&r2=473992
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/entitymaint.jsp (original)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/entity/entitymaint.jsp Sun Nov 12 09:02:39 2006
@@ -1,126 +0,0 @@
-<%--
-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.
---%>
-
-<%@ page import="java.util.*, java.net.*" %>
-<%@ page import="org.ofbiz.security.*, org.ofbiz.entity.*, org.ofbiz.base.util.*, org.ofbiz.webapp.pseudotag.*" %>
-<%@ page import="org.ofbiz.entity.model.*" %>
-<%@ page import="org.ofbiz.base.util.collections.*" %>
-
-<%@ taglib uri="ofbizTags" prefix="ofbiz" %>
-
-<jsp:useBean id="security" type="org.ofbiz.security.Security" scope="request" />
-<jsp:useBean id="delegator" type="org.ofbiz.entity.GenericDelegator" scope="request" />
-
-<% ResourceBundleMapWrapper uiLabelMap = (ResourceBundleMapWrapper)request.getAttribute("uiLabelMap"); %>
-
-<%
- ModelReader reader = delegator.getModelReader();
- Collection ec = reader.getEntityNames();
- TreeSet entities = new TreeSet(ec);
- Iterator classNamesIterator = entities.iterator();
-%>
-<h3 style='margin:0;'><%=uiLabelMap.get("WebtoolsEntityDataMaintenance")%></h3>
-<%if (security.hasPermission("ENTITY_MAINT", session)) {%>
-
-<%
- String rowColor1 = "viewManyTR2";
- String rowColor2 = "viewManyTR1";
- String rowColor = "";
-%>
-<table cellpadding='1' cellspacing='1' border='0'>
- <tr>
- <td valign="top">
- <table cellpadding='1' cellspacing='1' border='0'>
- <tr class='viewOneTR1'>
- <td>Entity Name</td>
- <td> </td>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
-
- <%int colSize = entities.size()/3 + 1;%>
- <%int kIdx = 0;%>
- <%while (classNamesIterator != null && classNamesIterator.hasNext()) { ModelEntity entity = reader.getModelEntity((String)classNamesIterator.next());%>
- <%rowColor=(rowColor==rowColor1?rowColor2:rowColor1);%><tr class="<%=rowColor%>">
- <td><div class='tabletext' style='FONT-SIZE: xx-small;'><%=entity.getEntityName()%></div></td>
- <%if (entity instanceof ModelViewEntity) {%>
- <%if (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(entity.getPlainTableName(), "_VIEW", session)) {%>
- <td colspan='3' align="center"><div class='tabletext' style='FONT-SIZE: xx-small;'>View Entity</div></td>
- <td><a href='<ofbiz:url>/FindGeneric?entityName=<%=entity.getEntityName()%>&find=true&VIEW_SIZE=50&VIEW_INDEX=0</ofbiz:url>' class="buttontext" style='FONT-SIZE: xx-small;'>All</a></td>
- <%} else {%>
- <td colspan='3' align="center"><div class='tabletext' style='FONT-SIZE: xx-small;'>View Entity</div></td>
- <%}%>
- <%} else {%>
- <%if (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) || security.hasEntityPermission(entity.getPlainTableName(), "_CREATE", session)) {%>
- <td><a href='<ofbiz:url>/ViewGeneric?entityName=<%=entity.getEntityName()%></ofbiz:url>' class="buttontext" style='FONT-SIZE: xx-small;'>Crt</a></td>
- <%} else {%>
- <td><div class='tabletext' style='FONT-SIZE: xx-small;'>NP</div></td>
- <%}%>
- <%if (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(entity.getPlainTableName(), "_VIEW", session)) {%>
- <td><a href='<ofbiz:url>/ViewRelations?entityName=<%=entity.getEntityName()%></ofbiz:url>' class="buttontext" style='FONT-SIZE: xx-small;'>Reln</a></td>
- <td><a href='<ofbiz:url>/FindGeneric?entityName=<%=entity.getEntityName()%></ofbiz:url>' class="buttontext" style='FONT-SIZE: xx-small;'>Fnd</a></td>
- <td><a href='<ofbiz:url>/FindGeneric?entityName=<%=entity.getEntityName()%>&find=true&VIEW_SIZE=50&VIEW_INDEX=0</ofbiz:url>' class="buttontext" style='FONT-SIZE: xx-small;'>All</a></td>
- <%} else {%>
- <td><div class='tabletext' style='FONT-SIZE: xx-small;'>NP</div></td>
- <td><div class='tabletext' style='FONT-SIZE: xx-small;'>NP</div></td>
- <%}%>
- <%}%>
- </tr>
-
- <%kIdx++;%>
- <%if(kIdx >= colSize) {%>
- <%colSize += colSize;%>
- </table>
- </td>
- <td valign="top">
- <table cellpadding='1' cellspacing='1' border='0'>
- <%rowColor = "";%>
- <tr class='viewOneTR1'>
- <td>Entity Name</td>
- <td> </td>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
- <%}%>
- <%}%>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td> </td>
- </tr>
- <tr>
- <td class="tableheadtext">Note : </td>
- </tr>
- <tr>
- <td class="tabletext">Crt :- Create New</td>
- </tr>
- <tr>
- <td class="tabletext">Reln :- View Relation</td>
- </tr>
- <tr>
- <td class="tabletext">Fnd :- Find Record</td>
- </tr>
- <tr>
- <td class="tabletext">All :- Find All Records</td>
- </tr>
-</table>
-<%}else{%>
- <h3>You do not have permission to view this page (ENTITY_MAINT needed).</h3>
-<%}%>
Modified: incubator/ofbiz/trunk/framework/webtools/widget/EntityScreens.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/widget/EntityScreens.xml?view=diff&rev=473992&r1=473991&r2=473992
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/widget/EntityScreens.xml (original)
+++ incubator/ofbiz/trunk/framework/webtools/widget/EntityScreens.xml Sun Nov 12 09:02:39 2006
@@ -125,5 +125,97 @@
</fail-widgets>
</section>
</screen>
+ <screen name="EntityMaint">
+ <section>
+ <condition>
+ <if-has-permission permission="ENTITY_MAINT"/>
+ </condition>
+ <actions>
+ <set field="titleProperty" value="WebtoolsEntityDataMaintenance"/>
+ <script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityMaint.bsh"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="CommonWebtoolsDecorator" location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <platform-specific>
+ <html><html-template location="component://webtools/webapp/webtools/entity/EntityMaint.ftl"/></html>
+ </platform-specific>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ <fail-widgets>
+ <label style="head3">${uiLabelMap.WebtoolsPermissionError}</label>
+ </fail-widgets>
+ </section>
+ </screen>
+ <screen name="FindGeneric">
+ <section>
+ <condition>
+ <if-has-permission permission="ENTITY_MAINT"/>
+ </condition>
+ <actions>
+ <set field="titleProperty" value="WebtoolsFindValues"/>
+ <script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="CommonWebtoolsDecorator" location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <platform-specific>
+ <html><html-template location="component://webtools/webapp/webtools/entity/FindGeneric.ftl"/></html>
+ </platform-specific>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ <fail-widgets>
+ <label style="head3">${uiLabelMap.WebtoolsPermissionError}</label>
+ </fail-widgets>
+ </section>
+ </screen>
+ <screen name="ViewGeneric">
+ <section>
+ <condition>
+ <if-has-permission permission="ENTITY_MAINT"/>
+ </condition>
+ <actions>
+ <set field="titleProperty" value="WebtoolsViewValue"/>
+ <script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/ViewGeneric.bsh"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="CommonWebtoolsDecorator" location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <platform-specific>
+ <html><html-template location="component://webtools/webapp/webtools/entity/ViewGeneric.ftl"/></html>
+ </platform-specific>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ <fail-widgets>
+ <label style="head3">${uiLabelMap.WebtoolsPermissionError}</label>
+ </fail-widgets>
+ </section>
+ </screen>
+ <screen name="ViewRelations">
+ <section>
+ <condition>
+ <if-has-permission permission="ENTITY_MAINT"/>
+ </condition>
+ <actions>
+ <set field="titleProperty" value="WebtoolsRelations"/>
+ <script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/ViewRelations.bsh"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="CommonWebtoolsDecorator" location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <platform-specific>
+ <html><html-template location="component://webtools/webapp/webtools/entity/ViewRelations.ftl"/></html>
+ </platform-specific>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ <fail-widgets>
+ <label style="head3">${uiLabelMap.WebtoolsPermissionError}</label>
+ </fail-widgets>
+ </section>
+ </screen>
</screens>