Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/UrlServletHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/UrlServletHelper.java?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/UrlServletHelper.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/UrlServletHelper.java Mon Dec 8 10:21:56 2014 @@ -57,15 +57,17 @@ public class UrlServletHelper extends Co try { // if tenant was specified, replace delegator with the new per-tenant delegator and set tenantId to session attribute delegator = getDelegator(servletContext); - List<GenericValue> tenants = delegator.findList("Tenant", EntityCondition.makeCondition("domainName", serverName), null, UtilMisc.toList("-createdStamp"), null, false); - if (UtilValidate.isNotEmpty(tenants)) { - GenericValue tenant = EntityUtil.getFirst(tenants); - String tenantId = tenant.getString("tenantId"); - + + //Use base delegator for fetching data from entity of entityGroup org.ofbiz.tenant + Delegator baseDelegator = DelegatorFactory.getDelegator(delegator.getDelegatorBaseName()); + GenericValue tenantDomainName = baseDelegator.findOne("TenantDomainName", UtilMisc.toMap("domainName", serverName), false); + + if (UtilValidate.isNotEmpty(tenantDomainName)) { + String tenantId = tenantDomainName.getString("tenantId"); // make that tenant active, setup a new delegator and a new dispatcher String tenantDelegatorName = delegator.getDelegatorBaseName() + "#" + tenantId; httpRequest.getSession().setAttribute("delegatorName", tenantDelegatorName); - + // after this line the delegator is replaced with the new per-tenant delegator delegator = DelegatorFactory.getDelegator(tenantDelegatorName); servletContext.setAttribute("delegator", delegator); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/entitydef/entitygroup.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/entitydef/entitygroup.xml?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/entitydef/entitygroup.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/entitydef/entitygroup.xml Mon Dec 8 10:21:56 2014 @@ -29,4 +29,5 @@ under the License. <!-- <entity-group group="org.ofbiz.tenant" entity="TenantUserLogin"/> --> <entity-group group="org.ofbiz.tenant" entity="Component"/> <entity-group group="org.ofbiz.tenant" entity="TenantComponent"/> + <entity-group group="org.ofbiz.tenant" entity="TenantDomainName"/> </entitygroup> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/entitydef/entitymodel.xml?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/entitydef/entitymodel.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/entitydef/entitymodel.xml Mon Dec 8 10:21:56 2014 @@ -66,7 +66,6 @@ under the License. <entity entity-name="Tenant" package-name="org.ofbiz.entity.tenant"> <field name="tenantId" type="id-ne"/> <field name="tenantName" type="name"/> - <field name="domainName" type="long-varchar"/> <field name="initialPath" type="value"/> <field name="disabled" type="indicator"><description>Disabled if 'Y', defaults to 'N' (not disabled).</description></field> <prim-key field="tenantId"/> @@ -153,4 +152,13 @@ under the License. <key-map field-name="componentName"/> </relation> </entity> + <entity entity-name="TenantDomainName" package-name="org.ofbiz.entity.tenant" + title="Tenant and its Domain Name"> + <field name="tenantId" type="id-ne"></field> + <field name="domainName" type="long-varchar"></field> + <prim-key field="domainName"/> + <relation type="one" fk-name="TNNT_DMNAM" rel-entity-name="Tenant"> + <key-map field-name="tenantId"/> + </relation> + </entity> </entitymodel> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Mon Dec 8 10:21:56 2014 @@ -478,9 +478,12 @@ public class GenericDelegator implements if (helperBaseName == null) { return null; } - GenericHelperInfo helperInfo = new GenericHelperInfo(entityGroupName, helperBaseName); + if (UtilValidate.isNotEmpty(this.delegatorTenantId) && "org.ofbiz.tenant".equals(entityGroupName)) { + Debug.logInfo("Can't access entity of entityGroup = " + entityGroupName + " using tenant delegator "+ this.getDelegatorName()+", use base delegator instead", module); + return null; + } - // to avoid infinite recursion, and to behave right for shared org.ofbiz.tenant entities, do nothing with the tenantId if the entityGroupName=org.ofbiz.tenant + GenericHelperInfo helperInfo = new GenericHelperInfo(entityGroupName, helperBaseName); if (UtilValidate.isNotEmpty(this.delegatorTenantId)) { // get the JDBC parameters from the DB for the entityGroupName and tenantId try { @@ -500,7 +503,6 @@ public class GenericDelegator implements // don't complain about this too much, just log the error if there is one Debug.logInfo(e, "Error getting TenantDataSource info for tenantId=" + this.delegatorTenantId + ", entityGroupName=" + entityGroupName, module); } - } return helperInfo; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-Derby.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-Derby.xml?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-Derby.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-Derby.xml Mon Dec 8 10:21:56 2014 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <entity-engine-xml> <Tenant tenantId="@tenantId@" tenantName="@tenantName@" /> + <TenantDomainName tenantId="@tenantId@" domainName="@domainName@" /> <TenantDataSource tenantId="@tenantId@" entityGroupName="org.ofbiz" jdbcUri="jdbc:derby:ofbiz_@tenantId@;create=true" jdbcUsername="ofbiz" jdbcPassword="ofbiz"/> <TenantDataSource tenantId="@tenantId@" entityGroupName="org.ofbiz.olap" Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-MySQL.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-MySQL.xml?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-MySQL.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-MySQL.xml Mon Dec 8 10:21:56 2014 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <entity-engine-xml> <Tenant tenantId="@tenantId@" tenantName="@tenantName@"/> + <TenantDomainName tenantId="@tenantId@" domainName="@domainName@" /> <TenantDataSource tenantId="@tenantId@" entityGroupName="org.ofbiz" jdbcUri="jdbc:mysql://@db-IP@/ofbiz_@tenantId@" jdbcUsername="@db-User@" jdbcPassword="@db-Password@"/> <TenantDataSource tenantId="@tenantId@" entityGroupName="org.ofbiz.olap" Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-Oracle.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-Oracle.xml?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-Oracle.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-Oracle.xml Mon Dec 8 10:21:56 2014 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <entity-engine-xml> <Tenant tenantId="@tenantId@" tenantName="@tenantName@"/> + <TenantDomainName tenantId="@tenantId@" domainName="@domainName@" /> <TenantDataSource tenantId="@tenantId@" entityGroupName="org.ofbiz" jdbcUri="jdbc:oracle:thin:@@db-IP@:ofbiz_@tenantId@" jdbcUsername="@db-User@" jdbcPassword="@db-Password@"/> <TenantDataSource tenantId="@tenantId@" entityGroupName="org.ofbiz.olap" Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-PostgreSQL.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-PostgreSQL.xml?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-PostgreSQL.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/resources/templates/AdminNewTenantData-PostgreSQL.xml Mon Dec 8 10:21:56 2014 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <entity-engine-xml> <Tenant tenantId="@tenantId@" tenantName="@tenantName@"/> + <TenantDomainName tenantId="@tenantId@" domainName="@domainName@" /> <TenantDataSource tenantId="@tenantId@" entityGroupName="org.ofbiz" jdbcUri="jdbc:postgresql://@db-IP@/ofbiz_@tenantId@" jdbcUsername="@db-User@" jdbcPassword="@db-Password@"/> <TenantDataSource tenantId="@tenantId@" entityGroupName="org.ofbiz.olap" Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java Mon Dec 8 10:21:56 2014 @@ -90,13 +90,20 @@ public final class EntityAutoEngine exte try { boolean allPksInOnly = true; LinkedList<String> pkFieldNameOutOnly = null; + /* Check for each pk if it's : + * 1. part IN + * 2. or part IN and OUT, but without value but present on parameters map + * Help the engine to determinate the operation to realize for a create call or validate that + * any pk is present for update/delete call. + */ for (ModelField pkField: modelEntity.getPkFieldsUnmodifiable()) { ModelParam pkParam = modelService.getParam(pkField.getName()); - if (pkParam.isOut()) { - allPksInOnly = false; - } - if (pkParam.isOut() && !pkParam.isIn()) { - if (pkFieldNameOutOnly == null) pkFieldNameOutOnly = new LinkedList(); + boolean pkValueInParameters = pkParam.isIn() && UtilValidate.isNotEmpty(parameters.get(pkParam.getFieldName())); + if (pkParam.isOut() && !pkValueInParameters) { + if (pkFieldNameOutOnly == null) { + pkFieldNameOutOnly = new LinkedList(); + allPksInOnly = false; + } pkFieldNameOutOnly.add(pkField.getName()); } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Mon Dec 8 10:21:56 2014 @@ -255,13 +255,17 @@ public class ContextFilter implements Fi try { // if tenant was specified, replace delegator with the new per-tenant delegator and set tenantId to session attribute Delegator delegator = getDelegator(config.getServletContext()); - List<GenericValue> tenants = delegator.findList("Tenant", EntityCondition.makeCondition("domainName", serverName), null, UtilMisc.toList("-createdStamp"), null, false); - if (UtilValidate.isNotEmpty(tenants)) { - GenericValue tenant = EntityUtil.getFirst(tenants); - String tenantId = tenant.getString("tenantId"); + + //Use base delegator for fetching data from entity of entityGroup org.ofbiz.tenant + Delegator baseDelegator = DelegatorFactory.getDelegator(delegator.getDelegatorBaseName()); + GenericValue tenantDomainName = baseDelegator.findOne("TenantDomainName", UtilMisc.toMap("domainName", serverName), false); + + if (UtilValidate.isNotEmpty(tenantDomainName)) { + String tenantId = tenantDomainName.getString("tenantId"); // if the request path is a root mount then redirect to the initial path if (UtilValidate.isNotEmpty(requestPath) && requestPath.equals(contextUri)) { + GenericValue tenant = baseDelegator.findOne("Tenant", UtilMisc.toMap("tenantId", tenantId), false); String initialPath = tenant.getString("initialPath"); if (UtilValidate.isNotEmpty(initialPath) && !"/".equals(initialPath)) { ((HttpServletResponse)response).sendRedirect(initialPath); @@ -291,6 +295,30 @@ public class ContextFilter implements Fi request.setAttribute("security", security); request.setAttribute("tenantId", tenantId); + } else if (delegator.getDelegatorBaseName() != delegator.getDelegatorName()) { + + // Set default delegator + Debug.logInfo("No tenant found for requested domain name " + serverName, module); + Debug.logInfo("Setting default delegator and dispatcher", module); + String delegatorName = delegator.getDelegatorBaseName(); + httpRequest.getSession().setAttribute("delegatorName", delegatorName); + + // after this line the delegator is replaced with the new per-tenant delegator + delegator = DelegatorFactory.getDelegator(delegatorName); + config.getServletContext().setAttribute("delegator", delegator); + + // clear web context objects + config.getServletContext().setAttribute("security", null); + config.getServletContext().setAttribute("dispatcher", null); + + // initialize security + Security security = getSecurity(); + // initialize the services dispatcher + LocalDispatcher dispatcher = getDispatcher(config.getServletContext()); + + // set web context objects + request.setAttribute("dispatcher", dispatcher); + request.setAttribute("security", security); } // NOTE DEJ20101130: do NOT always put the delegator name in the user's session because the user may Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Mon Dec 8 10:21:56 2014 @@ -394,9 +394,13 @@ public class LoginWorker { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Delegator delegator = (Delegator) request.getAttribute("delegator"); + ServletContext servletContext = session.getServletContext(); // if a tenantId was passed in, see if the userLoginId is associated with that tenantId (can use any delegator for this, entity is not tenant-specific) String tenantId = request.getParameter("tenantId"); + if (UtilValidate.isEmpty(tenantId)) { + tenantId = (String) request.getAttribute("tenantId"); + } if (UtilValidate.isNotEmpty(tenantId)) { // see if we need to activate a tenant delegator, only do if the current delegatorName has a hash symbol in it, and if the passed in tenantId doesn't match the one in the delegatorName String oldDelegatorName = delegator.getDelegatorName(); @@ -438,7 +442,6 @@ public class LoginWorker { } */ - ServletContext servletContext = session.getServletContext(); // make that tenant active, setup a new delegator and a new dispatcher String delegatorName = delegator.getDelegatorBaseName() + "#" + tenantId; @@ -458,6 +461,22 @@ public class LoginWorker { // NOTE: these will be local for now and set in the request and session later, after we've verified that the user setupNewDelegatorEtc = true; } + } else { + // Set default delegator + Debug.logInfo("Setting default delegator", module); + String delegatorName = delegator.getDelegatorBaseName(); + try { + // after this line the delegator is replaced with default delegator + delegator = DelegatorFactory.getDelegator(delegatorName); + dispatcher = ContextFilter.makeWebappDispatcher(servletContext, delegator); + } catch (NullPointerException e) { + Debug.logError(e, "Error getting default delegator", module); + Map<String, String> messageMap = UtilMisc.toMap("errorMessage", "Error getting default delegator"); + String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.following_error_occurred_during_login", messageMap, UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + setupNewDelegatorEtc = true; } Map<String, Object> result = null; @@ -514,7 +533,6 @@ public class LoginWorker { } } } - if (setupNewDelegatorEtc) { // now set the delegator and dispatcher in a bunch of places just in case they were changed setWebContextObjects(request, response, delegator, dispatcher); @@ -696,10 +714,11 @@ public class LoginWorker { if (currCatalog != null) session.setAttribute("CURRENT_CATALOG_ID", currCatalog); if (delegatorName != null) { + //Commented it as multi tenancy support is now available for front-store application as well. // if there is a tenantId in the delegatorName remove it now so that tenant selection doesn't last beyond logout - if (delegatorName.indexOf('#') > 0) { + /*if (delegatorName.indexOf('#') > 0) { delegatorName = delegatorName.substring(0, delegatorName.indexOf('#')); - } + }*/ session.setAttribute("delegatorName", delegatorName); delegator = DelegatorFactory.getDelegator(delegatorName); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/event/RequestBodyMapHandlerFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/event/RequestBodyMapHandlerFactory.java?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/event/RequestBodyMapHandlerFactory.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/event/RequestBodyMapHandlerFactory.java Mon Dec 8 10:21:56 2014 @@ -31,7 +31,11 @@ public class RequestBodyMapHandlerFactor } public static RequestBodyMapHandler getRequestBodyMapHandler(ServletRequest request) { - return requestBodyMapHandlers.get(request.getContentType()); + String contentType = request.getContentType(); + if (contentType != null && contentType.indexOf(";") != -1) { + contentType = contentType.substring(0, contentType.indexOf(";")); + } + return requestBodyMapHandlers.get(contentType); } public static Map<String, Object> extractMapFromRequestBody(ServletRequest request) throws IOException { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java Mon Dec 8 10:21:56 2014 @@ -325,7 +325,7 @@ public final class ArtifactInfoGatherer @Override public void visit(DecoratorScreen decoratorScreen) throws Exception { - for (DecoratorSection section : decoratorScreen.getSectionMap().values()) { + for (ModelScreenWidget section : decoratorScreen.getSectionMap().values()) { section.accept(this); } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Mon Dec 8 10:21:56 2014 @@ -288,6 +288,10 @@ public class ModelMenu extends ModelWidg } } + public void runActions(Map<String, Object> context) { + ModelWidgetAction.runSubActions(this.actions, context); + } + public int renderedMenuItemCount(Map<String, Object> context) { int count = 0; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Mon Dec 8 10:21:56 2014 @@ -22,6 +22,7 @@ import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -67,7 +68,6 @@ public class HtmlWidget extends ModelScr super(version); } - @SuppressWarnings("unchecked") @Override public TemplateModel wrap(Object object) throws TemplateModelException { // This StringHtmlWrapperForFtl option seems to be the best option @@ -76,7 +76,7 @@ public class HtmlWidget extends ModelScr return new StringHtmlWrapperForFtl((String) object, this); } else if (object instanceof Collection && !(object instanceof Map)) { // An additional wrapper to ensure ${aCollection} is properly encoded for html - return new CollectionHtmlWrapperForFtl((Collection) object, this); + return new CollectionHtmlWrapperForFtl((Collection<?>) object, this); } return super.wrap(object); } @@ -94,8 +94,7 @@ public class HtmlWidget extends ModelScr public static class CollectionHtmlWrapperForFtl extends CollectionModel { - @SuppressWarnings("unchecked") - public CollectionHtmlWrapperForFtl(Collection collection, BeansWrapper wrapper) { + public CollectionHtmlWrapperForFtl(Collection<?> collection, BeansWrapper wrapper) { super(collection, wrapper); } @@ -108,22 +107,33 @@ public class HtmlWidget extends ModelScr // End Static, begin class section - protected List<ModelScreenWidget> subWidgets = new ArrayList<ModelScreenWidget>(); + private final List<ModelScreenWidget> subWidgets; public HtmlWidget(ModelScreen modelScreen, Element htmlElement) { super(modelScreen, htmlElement); List<? extends Element> childElementList = UtilXml.childElementList(htmlElement); - for (Element childElement : childElementList) { - if ("html-template".equals(childElement.getNodeName())) { - this.subWidgets.add(new HtmlTemplate(modelScreen, childElement)); - } else if ("html-template-decorator".equals(childElement.getNodeName())) { - this.subWidgets.add(new HtmlTemplateDecorator(modelScreen, childElement)); - } else { - throw new IllegalArgumentException("Tag not supported under the platform-specific -> html tag with name: " + childElement.getNodeName()); + if (childElementList.isEmpty()) { + this.subWidgets = Collections.emptyList(); + } else { + List<ModelScreenWidget> subWidgets = new ArrayList<ModelScreenWidget>(childElementList.size()); + for (Element childElement : childElementList) { + if ("html-template".equals(childElement.getNodeName())) { + subWidgets.add(new HtmlTemplate(modelScreen, childElement)); + } else if ("html-template-decorator".equals(childElement.getNodeName())) { + subWidgets.add(new HtmlTemplateDecorator(modelScreen, childElement)); + } else { + throw new IllegalArgumentException("Tag not supported under the platform-specific -> html tag with name: " + + childElement.getNodeName()); + } } + this.subWidgets = Collections.unmodifiableList(subWidgets); } } + public List<ModelScreenWidget> getSubWidgets() { + return subWidgets; + } + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { for (ModelScreenWidget subWidget : subWidgets) { @@ -197,6 +207,10 @@ public class HtmlWidget extends ModelScr this.locationExdr = FlexibleStringExpander.getInstance(htmlTemplateElement.getAttribute("location")); } + public String getLocation(Map<String, Object> context) { + return locationExdr.expandString(context); + } + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { renderHtmlTemplate(writer, this.locationExdr, context); @@ -210,7 +224,7 @@ public class HtmlWidget extends ModelScr public static class HtmlTemplateDecorator extends ModelScreenWidget { protected FlexibleStringExpander locationExdr; - protected Map<String, HtmlTemplateDecoratorSection> sectionMap = new HashMap<String, HtmlTemplateDecoratorSection>(); + protected Map<String, ModelScreenWidget> sectionMap = new HashMap<String, ModelScreenWidget>(); public HtmlTemplateDecorator(ModelScreen modelScreen, Element htmlTemplateDecoratorElement) { super(modelScreen, htmlTemplateDecoratorElement); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Mon Dec 8 10:21:56 2014 @@ -108,15 +108,15 @@ public abstract class ModelScreenWidget return this.modelScreen; } - public static final class SectionsRenderer implements Map<String, Object> { - private final Map<String, Object> sectionMap; + public static final class SectionsRenderer implements Map<String, ModelScreenWidget> { + private final Map<String, ModelScreenWidget> sectionMap; private final ScreenStringRenderer screenStringRenderer; private final Map<String, Object> context; private final Appendable writer; - public SectionsRenderer(Map<String, ? extends Object> sectionMap, Map<String, Object> context, Appendable writer, + public SectionsRenderer(Map<String, ModelScreenWidget> sectionMap, Map<String, Object> context, Appendable writer, ScreenStringRenderer screenStringRenderer) { - Map<String, Object> localMap = new HashMap<String, Object>(); + Map<String, ModelScreenWidget> localMap = new HashMap<String, ModelScreenWidget>(); localMap.putAll(sectionMap); this.sectionMap = Collections.unmodifiableMap(localMap); this.context = context; @@ -126,7 +126,7 @@ public abstract class ModelScreenWidget /** This is a lot like the ScreenRenderer class and returns an empty String so it can be used more easily with FreeMarker */ public String render(String sectionName) throws GeneralException, IOException { - ModelScreenWidget section = (ModelScreenWidget) this.get(sectionName); + ModelScreenWidget section = sectionMap.get(sectionName); // if no section by that name, write nothing if (section != null) { section.renderWidgetString(this.writer, this.context, this.screenStringRenderer); @@ -134,61 +134,75 @@ public abstract class ModelScreenWidget return ""; } + @Override public int size() { return sectionMap.size(); } + @Override public boolean isEmpty() { return sectionMap.isEmpty(); } + @Override public boolean containsKey(Object key) { return sectionMap.containsKey(key); } + @Override public boolean containsValue(Object value) { return sectionMap.containsValue(value); } - public Object get(Object key) { + @Override + public ModelScreenWidget get(Object key) { return sectionMap.get(key); } - public Object put(String key, Object value) { + @Override + public ModelScreenWidget put(String key, ModelScreenWidget value) { return sectionMap.put(key, value); } - public Object remove(Object key) { + @Override + public ModelScreenWidget remove(Object key) { return sectionMap.remove(key); } - public void putAll(Map<? extends String, ? extends Object> m) { - sectionMap.putAll(m); - } - + @Override public void clear() { sectionMap.clear(); } + @Override public Set<String> keySet() { return sectionMap.keySet(); } - public Collection<Object> values() { + @Override + public Collection<ModelScreenWidget> values() { return sectionMap.values(); } - public Set<java.util.Map.Entry<String, Object>> entrySet() { + @Override + public Set<java.util.Map.Entry<String, ModelScreenWidget>> entrySet() { return sectionMap.entrySet(); } + @Override public boolean equals(Object o) { return sectionMap.equals(o); } + @Override public int hashCode() { return sectionMap.hashCode(); } + + @Override + public void putAll(Map<? extends String, ? extends ModelScreenWidget> m) { + sectionMap.putAll(m); + } } public static final class Section extends ModelScreenWidget { @@ -723,13 +737,13 @@ public abstract class ModelScreenWidget public static final String TAG_NAME = "decorator-screen"; private final FlexibleStringExpander nameExdr; private final FlexibleStringExpander locationExdr; - private final Map<String, DecoratorSection> sectionMap; + private final Map<String, ModelScreenWidget> sectionMap; public DecoratorScreen(ModelScreen modelScreen, Element decoratorScreenElement) { super(modelScreen, decoratorScreenElement); this.nameExdr = FlexibleStringExpander.getInstance(decoratorScreenElement.getAttribute("name")); this.locationExdr = FlexibleStringExpander.getInstance(decoratorScreenElement.getAttribute("location")); - Map<String, DecoratorSection> sectionMap = new HashMap<String, DecoratorSection>(); + Map<String, ModelScreenWidget> sectionMap = new HashMap<String, ModelScreenWidget>(); List<? extends Element> decoratorSectionElementList = UtilXml.childElementList(decoratorScreenElement, "decorator-section"); for (Element decoratorSectionElement: decoratorSectionElementList) { DecoratorSection decoratorSection = new DecoratorSection(modelScreen, decoratorSectionElement); @@ -773,7 +787,7 @@ public abstract class ModelScreenWidget return this.locationExdr.expandString(context); } - public Map<String, DecoratorSection> getSectionMap() { + public Map<String, ModelScreenWidget> getSectionMap() { return sectionMap; } @@ -1105,6 +1119,10 @@ public abstract class ModelScreenWidget public void accept(ModelWidgetVisitor visitor) throws Exception { visitor.visit(this); } + + public Map<String, ModelScreenWidget> getSubWidgets() { + return subWidgets; + } } public static final class Content extends ModelScreenWidget { Propchange: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/hot-deploy/ ------------------------------------------------------------------------------ --- svn:global-ignores (added) +++ svn:global-ignores Mon Dec 8 10:21:56 2014 @@ -0,0 +1 @@ +cloudfeet Propchange: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/hot-deploy/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Mon Dec 8 10:21:56 2014 @@ -1 +1,2 @@ +desktop.ini Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/data/CmsSiteDemoData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/data/CmsSiteDemoData.xml?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/data/CmsSiteDemoData.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/data/CmsSiteDemoData.xml Mon Dec 8 10:21:56 2014 @@ -101,7 +101,7 @@ under the License. <Content contentId="CMSS_DEMO_HOME" contentTypeId="DOCUMENT" decoratorContentId="CMSS_DEC" contentName="CMS Site Demo Home Page" dataResourceId="CMSS_DEMO_HOME"/> <ContentPurpose contentId="CMSS_DEMO_HOME" contentPurposeTypeId="SECTION"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_HOME" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00" mapKey="demoHome"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_HOME" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="demoHome"/> <WebSiteContent webSiteId="CmsSite" contentId="CMSS_DEMO_HOME" webSiteContentTypeId="DEFAULT_PAGE" fromDate="2001-01-01 00:00:00"/> <!-- yet another demo page --> @@ -114,7 +114,7 @@ under the License. </ElectronicText> <Content contentId="CMSS_DEMO_PAGE1" contentTypeId="DOCUMENT" decoratorContentId="CMSS_DEC" contentName="CMS Site Demo Page 1" dataResourceId="CMSS_DEMO_PAGE1"/> <ContentPurpose contentId="CMSS_DEMO_PAGE1" contentPurposeTypeId="SECTION"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_PAGE1" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00" mapKey="demoPage1"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_PAGE1" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="demoPage1"/> <DataResource dataResourceId="CMSS_DEMO_PAGE1_1" dataResourceTypeId="SHORT_TEXT" objectInfo="Sub-content 1"/> <Content contentId="CMSS_DEMO_PAGE1_1" contentTypeId="DOCUMENT" contentName="CMS Site Demo Page 1_1" dataResourceId="CMSS_DEMO_PAGE1_1"/> <ContentPurpose contentId="CMSS_DEMO_PAGE1_1" contentPurposeTypeId="SECTION"/> @@ -130,16 +130,16 @@ under the License. <DataResource dataResourceId="CMSS_DEMO_SCREEN" dataResourceTypeId="URL_RESOURCE" dataTemplateTypeId="SCREEN_COMBINED" objectInfo="component://cmssite/widget/CmssiteScreens.xml#testScreen"/> <Content contentId="CMSS_DEMO_SCREEN" contentTypeId="DOCUMENT" contentName="CMS Site Demo screen/decorator example" dataResourceId="CMSS_DEMO_SCREEN"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_SCREEN" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_SCREEN" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00"/> <DataResource dataResourceId="CMSS_DEMO_BLOG" dataResourceTypeId="URL_RESOURCE" dataTemplateTypeId="SCREEN_COMBINED" objectInfo="component://cmssite/widget/CmssiteScreens.xml#blogScreen"/> <Content contentId="CMSS_DEMO_BLOG" contentTypeId="DOCUMENT" contentName="CMS Site Demo blog screen example" dataResourceId="CMSS_DEMO_BLOG"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_BLOG" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_BLOG" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00"/> <DataResource dataResourceId="CMSS_DEMO_TPL_DATA" localeString="en" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="data xml file" mimeTypeId="text/xml" isPublic="Y"/> <DataResource dataResourceId="CMSS_DEMO_TPL_TEMPL" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="FTL" statusId="CTNT_IN_PROGRESS" dataResourceName="demo xml templ" mimeTypeId="text/html" isPublic="Y" /> <Content contentId="CMSS_DEMO_TPL_DATA" contentTypeId="DOCUMENT" templateDataResourceId="CMSS_DEMO_TPL_TEMPL" dataResourceId="CMSS_DEMO_TPL_DATA" statusId="CTNT_IN_PROGRESS" contentName="Demo xml data + ftl template file" mimeTypeId="text/html"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_TPL_DATA" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_TPL_DATA" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00"/> <ElectronicText dataResourceId="CMSS_DEMO_TPL_DATA"> <textData><![CDATA[ <root> @@ -194,7 +194,7 @@ under the License. <DataResource dataResourceId="OFBIZ_HOME" dataResourceTypeId="URL_RESOURCE" dataTemplateTypeId="SCREEN_COMBINED" objectInfo="component://cmssite/widget/OfbizsiteScreens.xml#main"/> <Content contentId="OFBIZ_HOME" contentTypeId="DOCUMENT" contentName="OFBiz Site Home Page" dataResourceId="OFBIZ_HOME"/> - <ContentAssoc contentId="OFBIZ_PPOINT" contentIdTo="OFBIZ_HOME" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00" mapKey="demoHome"/> + <ContentAssoc contentId="OFBIZ_PPOINT" contentIdTo="OFBIZ_HOME" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="demoHome"/> <WebSiteContent webSiteId="OfbizSite" contentId="OFBIZ_HOME" webSiteContentTypeId="DEFAULT_PAGE" fromDate="2001-01-01 00:00:00"/> <!-- documents website --> @@ -219,8 +219,8 @@ under the License. <ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_U_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="PUBLIC_DOCS" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_HTML" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00" mapKey="documents"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_PDF" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00" mapKey="documents"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="PUBLIC_DOCS" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="documents"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_PDF" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="documents"/> </entity-engine-xml> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/template/cms/MainDecorator.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/template/cms/MainDecorator.ftl?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/template/cms/MainDecorator.ftl (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/template/cms/MainDecorator.ftl Mon Dec 8 10:21:56 2014 @@ -16,11 +16,10 @@ KIND, either express or implied. See th specific language governing permissions and limitations under the License. --> -<#if decoratedContent??> + ${(decoratedContent.subcontent.htmlHead)?default((thisContent.subcontent.htmlHead)!)} ${(decoratedContent.subcontent.header)?default((thisContent.subcontent.header)!)} ${decoratedContent} ${(decoratedContent.subcontent.footer)?default((thisContent.subcontent.footer)!)} -</#if> \ No newline at end of file Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/data/DemoWebSitePublishPointData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/data/DemoWebSitePublishPointData.xml?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/data/DemoWebSitePublishPointData.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/data/DemoWebSitePublishPointData.xml Mon Dec 8 10:21:56 2014 @@ -25,39 +25,39 @@ under the License. <WebSiteContent webSiteId="WebStore" contentId="WebStoreCONTENT" webSiteContentTypeId="PUBLISH_POINT" fromDate="2001-01-01 00:00:00"/> <Content contentId="CNTGIZMOS" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Gizmos" description="Gizmos" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="CNTGIZMOS" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="CNTGIZMOS" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <ContentAttribute contentId="CNTGIZMOS" attrName="publishOperation" attrValue="HAS_USER_ROLE"/> <Content contentId="CNTGIZMOSLRG" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="CNTGIZMOS" contentName="Large Gizmos" description="Large Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTGIZMOS" contentIdTo="CNTGIZMOSLRG" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTGIZMOS" contentIdTo="CNTGIZMOSLRG" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="CNTGIZMOSSML" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="CNTGIZMOS" contentName="Small Gizmos" description="Large Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTGIZMOS" contentIdTo="CNTGIZMOSSML" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTGIZMOS" contentIdTo="CNTGIZMOSSML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="GIZMOSLRG" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="CNTGIZMOS" contentName="Advocacy" description="Advocacy" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTGIZMOS" contentIdTo="GIZMOSLRG" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTGIZMOS" contentIdTo="GIZMOSLRG" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="GIZMOSSML" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Case Studies" description="Case Studies" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTGIZMOS" contentIdTo="GIZMOSSML" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTGIZMOS" contentIdTo="GIZMOSSML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="CNTWIDGETS" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Widgets" description="Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <ContentAttribute contentId="CNTWIDGETS" attrName="publishOperation" attrValue="HAS_USER_ROLE"/> - <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="CNTWIDGETS" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="CNTWIDGETS" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="WIDGETSSML" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Sightings" description="Sightings of Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTWIDGETS" contentIdTo="WIDGETSSML" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTWIDGETS" contentIdTo="WIDGETSSML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="WIDGETSLRG" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Care & Groom" description="Care and Grooming" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTWIDGETS" contentIdTo="WIDGETSLRG" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTWIDGETS" contentIdTo="WIDGETSLRG" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="CNTWIDGETSLRG" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="CNTWIDGETS" contentName="Large Widgets" description="Large Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTWIDGETS" contentIdTo="CNTWIDGETSLRG" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTWIDGETS" contentIdTo="CNTWIDGETSLRG" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="CNTWIDGETSSML" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="CNTWIDGETS" contentName="Small Widgets" description="Large Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTWIDGETS" contentIdTo="CNTWIDGETSSML" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTWIDGETS" contentIdTo="CNTWIDGETSSML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="POLICY" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Policies" description="Policies" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="POLICY" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="POLICY" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <ContentAttribute contentId="POLICY" attrName="publishOperation" attrValue="HAS_USER_ROLE"/> <Content contentId="WebStoreFACTOID" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="" contentName="Factoids" description="Factoids" createdDate="2004-07-05 12:00:00.000" createdByUserLogin="admin"/> @@ -79,7 +79,7 @@ under the License. </ElectronicText> <Content contentId="STORE_POLICIES" contentTypeId="DOCUMENT" ownerContentId="WebStoreCONTENT" dataResourceId="STORE_POLICIES" contentName="Store Policies 1" description="Store Policies 1 Description" mimeTypeId="text/html" localeString="en_US" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="STORE_POLICIES" mapKey="policies" contentAssocTypeId="PUBLISH_LINK" + <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="STORE_POLICIES" mapKey="policies" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <DataResource dataResourceId="STORE_POLICIES2" dataResourceTypeId="ELECTRONIC_TEXT" mimeTypeId="text/html" localeString="en_US" isPublic="Y" dataResourceName="Store Policies"/> <ElectronicText dataResourceId="STORE_POLICIES2"> @@ -96,6 +96,6 @@ under the License. </ElectronicText> <Content contentId="STORE_POLICIES2" contentTypeId="DOCUMENT" ownerContentId="WebStoreCONTENT" dataResourceId="STORE_POLICIES2" contentName="Store Policies 2" description="Store Policies 2 Description" mimeTypeId="text/html" localeString="en_US" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="STORE_POLICIES2" mapKey="policies2" contentAssocTypeId="PUBLISH_LINK" + <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="STORE_POLICIES2" mapKey="policies2" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> </entity-engine-xml> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/data/topic.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/data/topic.ftl?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/data/topic.ftl (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/data/topic.ftl Mon Dec 8 10:21:56 2014 @@ -34,7 +34,7 @@ under the License. <#assign firstPart=internalNameParts[0] /> <#assign nowStamp=Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp()/> <#if firstPart == "WIDGETS"> - <ContentAssoc contentId="CNTWIDGETS" contentIdTo="${contentId}" contentAssocTypeId="PUBLISH_LINK" fromDate="${nowStamp?string("yyyy-MM-dd HH:mm:ss")}"/> + <ContentAssoc contentId="CNTWIDGETS" contentIdTo="${contentId}" contentAssocTypeId="SUB_CONTENT" fromDate="${nowStamp?string("yyyy-MM-dd HH:mm:ss")}"/> </#if> </#macro> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/projectmgr/widget/ProjectScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/projectmgr/widget/ProjectScreens.xml?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/projectmgr/widget/ProjectScreens.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/projectmgr/widget/ProjectScreens.xml Mon Dec 8 10:21:56 2014 @@ -915,12 +915,13 @@ under the License. <entity-one entity-name="Content" value-field="content"/> <set field="projectId" from-field="parameters.projectId" default-value="${parameters.workEffortId}"/> <set field="workEffortId" from-field="parameters.projectId" default-value="${parameters.workEffortId}"/> + <entity-one entity-name="WorkEffortContent" value-field="workEffortContent"/> <entity-and entity-name="WorkEffortAndContentDataResource" list="workEffortAndContentDataResources"> <field-map field-name="workEffortId" from-field="projectId"/> </entity-and> </actions> <widgets> - <decorator-screen name="CommonProjectDecorator" location="${parameters.mainDecoratorLocation}"> + <decorator-screen name="CommonProjectDecorator" location="${parameters.mainDecoratorLocation}"> <decorator-section name="body"> <section> <condition> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/projectmgr/widget/forms/ProjectForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=1643778&r1=1643777&r2=1643778&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/projectmgr/widget/forms/ProjectForms.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Mon Dec 8 10:21:56 2014 @@ -848,22 +848,18 @@ </field> <field name="submitButton" title="${uiLabelMap.PageTitleAddProjectTimeToNewInvoice}" widget-style="smallSubmit"><submit button-type="button"/></field> </form> - <form name="ListContents" extends="ListWorkEffortContents" extends-resource="component://workeffort/widget/WorkEffortForms.xml"> + <form name="ListContents" extends="ListWorkEffortContents" extends-resource="component://workeffort/widget/WorkEffortForms.xml" default-entity-name="WorkEffortContent"> <field name="contentId" use-when="headerItem.equals("EditProjectContents")"> <display-entity entity-name="Content" key-field-name="contentId" description="${contentName}" also-hidden="true"> <sub-hyperlink target="EditProjectContents" description="${contentId}" link-style="buttontext" target-type="inter-app"> - <parameter param-name="contentId"/> - <parameter param-name="projectId"/> - <parameter param-name="workEffortContentTypeId"/> + <auto-parameters-entity/> </sub-hyperlink> </display-entity> </field> <field name="contentId" use-when="headerItem.equals("EditTaskContents")"> <display-entity entity-name="Content" key-field-name="contentId" description="${contentName}" also-hidden="true"> <sub-hyperlink target="EditTaskContents" description="${contentId}" link-style="buttontext" target-type="inter-app"> - <parameter param-name="contentId"/> - <parameter param-name="workEffortId"/> - <parameter param-name="workEffortContentTypeId"/> + <auto-parameters-entity/> </sub-hyperlink> </display-entity> </field> @@ -871,10 +867,7 @@ <field name="submitButton"><ignored/></field> <field name="deleteLink" title=" " widget-style="buttontext" use-when="headerItem.equals("EditProjectContents")"> <hyperlink also-hidden="false" description="${uiLabelMap.CommonDelete}" target="deleteProjectContent"> - <parameter param-name="contentId"/> - <parameter param-name="workEffortId"/> - <parameter param-name="workEffortContentTypeId"/> - <parameter param-name="fromDate"/> + <auto-parameters-entity/> </hyperlink> </field> <field name="downloadLink" title=" " widget-style="buttontext"> @@ -882,10 +875,7 @@ </field> <field name="deleteLink" title=" " widget-style="buttontext" use-when="headerItem.equals("EditTaskContents")"> <hyperlink also-hidden="false" description="${uiLabelMap.CommonDelete}" target="deleteTaskContent"> - <parameter param-name="contentId"/> - <parameter param-name="workEffortId"/> - <parameter param-name="workEffortContentTypeId"/> - <parameter param-name="fromDate"/> + <auto-parameters-entity/> </hyperlink> </field> </form> @@ -902,27 +892,29 @@ </entity-one> </actions> - <alt-target use-when="content!=null&&headerItem.equals("EditTaskContents")" target="updateTaskContent"/> - <alt-target use-when="content==null&&headerItem.equals("EditProjectContents")" target="createProjectContent"/> - <alt-target use-when="content==null&&headerItem.equals("EditTaskContents")" target="createTaskContent"/> + <alt-target use-when="workEffortContent!=null&&headerItem.equals("EditTaskContents")" target="updateTaskContent"/> + <alt-target use-when="workEffortContent==null&&headerItem.equals("EditProjectContents")" target="createProjectContent"/> + <alt-target use-when="workEffortContent==null&&headerItem.equals("EditTaskContents")" target="createTaskContent"/> <field name="workEffortId" map-name="parameters"><hidden/></field> <field name="projectId" map-name="parameters"><hidden/></field> - <field use-when="content!=null" name="contentId" tooltip="${uiLabelMap.CommonNotModifRecreat}"><display/></field> - <field use-when="content==null" name="contentIdTo" title="${uiLabelMap.FormFieldTitle_existContentId}"> + <field name="contentId" use-when="workEffortContent!=null" tooltip="${uiLabelMap.CommonNotModifRecreat}"><display-entity entity-name="Content" description="[${contentId}] ${contentName}"/></field> + <field name="contentIdTo" use-when="workEffortContent==null" title="${uiLabelMap.FormFieldTitle_existContentId}"> <lookup target-form-name="LookupTreeContent"/> </field> - - <field name="workEffortContentTypeId"> + <field name="workEffortContentTypeId" use-when="workEffortContent!=null" map-name="workEffortContent"> + <display-entity entity-name="WorkEffortContentType" description="${description}"/> + </field> + <field name="workEffortContentTypeId" use-when="workEffortContent==null"> <drop-down allow-empty="false"> - <entity-options description="${description}" entity-name="WorkEffortContentType" key-field-name="workEffortContentTypeId"/> + <entity-options description="${description}" entity-name="WorkEffortContentType"/> </drop-down> </field> <!-- note sure if these two are necessray, but they are kind of confusing in this context: <field name="ownerContentId"><lookup target-form-name="LookupContent"/></field> <field name="dataResourceId"><lookup target-form-name="LookupDataResource"/></field> --> - <field name="contentTypeId"> + <field name="contentTypeId" use-when="workEffortContent!=null"> <drop-down allow-empty="false" no-current-selected-key="DOCUMENT"> <entity-options description="${description}" entity-name="ContentType"/> </drop-down> @@ -948,7 +940,7 @@ <entity-options description="${description}" entity-name="MimeType" key-field-name="mimeTypeId"/> </drop-down> </field> - <field name="dataResourceName" title="${uiLabelMap.CommonUpload}"><file/></field> + <field name="dataResourceName" use-when="workEffortContent==null" title="${uiLabelMap.CommonUpload}"><file/></field> <field name="contentIdFrom" title="${uiLabelMap.ContentCompDocParentContentId}"><lookup target-form-name="LookupDetailContentTree"/></field> <!--field name="dataCategoryId" use-when="dataResource==null"> <drop-down allow-empty="false"> @@ -964,8 +956,8 @@ <entity-options description="${categoryName}" entity-name="DataCategory" key-field-name="dataCategoryId"/> </drop-down> </field--> - <field name="createButton" use-when="content==null"><submit button-type="button"/></field> - <field name="updateButton" use-when="content!=null"><submit button-type="button"/></field> + <field name="createButton" use-when="workEffortContent==null"><submit button-type="button"/></field> + <field name="updateButton" use-when="workEffortContent!=null"><submit button-type="button"/></field> </form> <form name="ListPhaseInfo" extends="ListPhaseInfo" extends-resource="component://projectmgr/widget/forms/ProjectForms.xml"> <field name="phase"><display description="${phaseName}"/></field> |
Free forum by Nabble | Edit this page |