Author: hansbak
Date: Wed Feb 18 08:04:48 2009 New Revision: 745407 URL: http://svn.apache.org/viewvc?rev=745407&view=rev Log: add a content navigation tree, demo data and including a DOS tree conversion program to be able to mimic an office file server Added: ofbiz/trunk/applications/content/data/DemoTreeContent.xml (with props) ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java (with props) ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl (with props) ofbiz/trunk/applications/content/webapp/content/content/EditContentTree.ftl (with props) Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.xml ofbiz/trunk/applications/content/ofbiz-component.xml ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentEvents.xml ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml ofbiz/trunk/applications/content/widget/CommonScreens.xml ofbiz/trunk/applications/content/widget/content/ContentForms.xml ofbiz/trunk/applications/content/widget/content/ContentMenus.xml ofbiz/trunk/applications/content/widget/content/ContentScreens.xml Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/config/ContentUiLabels.xml?rev=745407&r1=745406&r2=745407&view=diff ============================================================================== --- ofbiz/trunk/applications/content/config/ContentUiLabels.xml (original) +++ ofbiz/trunk/applications/content/config/ContentUiLabels.xml Wed Feb 18 08:04:48 2009 @@ -491,6 +491,10 @@ <value xml:lang="en">Document Type</value> <value xml:lang="it">Tipo documento</value> </property> + <property key="ContentDeleteFolder"> + <value xml:lang="en">Delete Folder</value> + <value xml:lang="th">ลà¸à¸à¸¥à¹à¸à¸</value> + </property> <property key="ContentEditProductStore"> <value xml:lang="ar">تØرÙر ٠خز٠اÙÙ ÙتÙج</value> <value xml:lang="de">Produktladen bearbeiten</value> @@ -811,6 +815,20 @@ <value xml:lang="it">Naviga</value> <value xml:lang="th">หาà¹à¸ªà¹à¸à¸à¸²à¸</value> </property> + <property key="ContentNewContentInFolder"> + <value xml:lang="de">New Content in Folder</value> + <value xml:lang="en">New Content in Folder</value> + <value xml:lang="fr">New Content in Folder</value> + <value xml:lang="it">New Content in Folder</value> + <value xml:lang="th">สรà¹à¸²à¸à¹à¸à¸·à¹à¸à¸«à¸²à¹à¸«à¸¡à¹à¹à¸à¸à¸¥à¹à¸à¸</value> + </property> + <property key="ContentNewFolder"> + <value xml:lang="de">New Folder</value> + <value xml:lang="en">New Folder</value> + <value xml:lang="fr">New Folder</value> + <value xml:lang="it">New Folder</value> + <value xml:lang="th">สรà¹à¸²à¸à¸à¸¥à¹à¸à¸à¹à¸«à¸¡à¹</value> + </property> <property key="ContentOtherLayout"> <value xml:lang="ar">اÙÙضعÙات اÙأخر٠اÙ٠ستع٠ÙØ© ÙÙذا اÙÙ ØتÙ٠اÙتØتÙ</value> <value xml:lang="de">Andere Layouts die dieses untergeordneten Inhalt verwenden</value> @@ -899,6 +917,10 @@ <property key="ContentRejected"> <value xml:lang="en">Rejected</value> <value xml:lang="it">Rifiutato</value> + </property> + <property key="ContentRenameFolder"> + <value xml:lang="en">Rename Folder</value> + <value xml:lang="th">à¹à¸à¸¥à¸µà¹à¸¢à¸à¸à¸·à¹à¸à¸à¸¥à¹à¸à¸</value> </property> <property key="ContentResourceAudio"> <value xml:lang="de">Audio</value> @@ -3701,6 +3723,10 @@ <value xml:lang="th">à¸à¹à¸à¸«à¸²à¸à¸²à¸£à¸ªà¸³à¸£à¸§à¸à¸à¸³à¸à¸à¸</value> <value xml:lang="zh">æ¥æ¾è°æ¥åç</value> </property> + <property key="PageTitleNavigateContent"> + <value xml:lang="en">Navigate Content</value> + <value xml:lang="th">à¹à¸¥à¸·à¸à¸à¸à¸¹à¹à¸à¸·à¹à¸à¸«à¸²</value> + </property> <property key="PageTitleNavigateDataResources"> <value xml:lang="de">Durch Datenressourcen navigieren mittels Datenkategorien</value> <value xml:lang="en">Navigate Data Resources using Data Categories</value> Added: ofbiz/trunk/applications/content/data/DemoTreeContent.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/data/DemoTreeContent.xml?rev=745407&view=auto ============================================================================== --- ofbiz/trunk/applications/content/data/DemoTreeContent.xml (added) +++ ofbiz/trunk/applications/content/data/DemoTreeContent.xml Wed Feb 18 08:04:48 2009 @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<entity-engine-xml> + <Content contentId="TREE_ROOT" contentTypeId="DOCUMENT" contentName="ROOT" dataResourceId=""/> + <Content contentId="PICTURE" contentTypeId="DOCUMENT" contentName="Picture" dataResourceId=""/> + <Content contentId="PROD_DESCRIPTION" contentTypeId="DOCUMENT" contentName="Product Description" dataResourceId=""/> + <Content contentId="GENERAL" contentTypeId="DOCUMENT" contentName="General" dataResourceId=""/> + <Content contentId="STORE_POLICIES" contentTypeId="DOCUMENT" contentName="Store Policies" dataResourceId=""/> + + <ContentAssoc contentId="TREE_ROOT" contentIdTo="PICTURE" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="TREE_ROOT" contentIdTo="PROD_DESCRIPTION" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="TREE_ROOT" contentIdTo="GENERAL" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="TREE_ROOT" contentIdTo="STORE_POLICIES" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + + <ContentAssoc contentId="PICTURE" contentIdTo="GZ-DIG" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C101DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C101DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C101DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C102DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C102DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C102DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C200DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C200DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C200DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C2011DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C2011DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C2011DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C2012DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C2012DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C2012DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C201DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C201DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C201DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CFOOD-001DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CFOOD-001DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CFOOD-001DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CGC-100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CGC-100DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CGC-100DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CGC-101DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CGC-101DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CGC-101DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CGC-102DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CGC-102DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CGC-102DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CPC-100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CPC-100DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CPC-100DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CPROMO-001DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="CPROMO-001DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="GZ2644DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="GZ2644DESCFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="GZ2644DESCIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="GZ2644NAMEEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="GZ2644NAMEFR" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="GZ2644NAMEIT" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="PROD_DESCRIPTION" contentIdTo="C100DESCEN" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + + <ContentAssoc contentId="GENERAL" contentIdTo="FACT_1" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="GENERAL" contentIdTo="FACT_2" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="GENERAL" contentIdTo="FACT_3" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="GENERAL" contentIdTo="FACT_4" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="GENERAL" contentIdTo="FACT_5" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + + <ContentAssoc contentId="STORE_POLICIES" contentIdTo="STORE_POLICIES" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + <ContentAssoc contentId="STORE_POLICIES" contentIdTo="STORE_POLICIES2" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> + +</entity-engine-xml> \ No newline at end of file Propchange: ofbiz/trunk/applications/content/data/DemoTreeContent.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/content/data/DemoTreeContent.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/content/data/DemoTreeContent.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/applications/content/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/ofbiz-component.xml?rev=745407&r1=745406&r2=745407&view=diff ============================================================================== --- ofbiz/trunk/applications/content/ofbiz-component.xml (original) +++ ofbiz/trunk/applications/content/ofbiz-component.xml Wed Feb 18 08:04:48 2009 @@ -46,6 +46,7 @@ <entity-resource type="data" reader-name="demo" loader="main" location="data/WebSitePublishPointData.xml"/> <entity-resource type="data" reader-name="demo" loader="main" location="data/CompDocData.xml"/> <entity-resource type="data" reader-name="demo" loader="main" location="data/ForumDemoData.xml"/> + <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoTreeContent.xml"/> <service-resource type="model" loader="main" location="servicedef/services.xml"/> <service-resource type="model" loader="main" location="servicedef/services_content.xml"/> <service-resource type="model" loader="main" location="servicedef/services_contenttypes.xml"/> Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentEvents.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentEvents.xml?rev=745407&r1=745406&r2=745407&view=diff ============================================================================== --- ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentEvents.xml (original) +++ ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentEvents.xml Wed Feb 18 08:04:48 2009 @@ -134,4 +134,16 @@ <call-service in-map-name="context3" service-name="assocContent"></call-service> </simple-method> + <simple-method method-name="createDocument" short-description="Create Document Tree"> + <set field="content.contentName" from-field="parameters.contentName"/> + <set field="content.contentTypeId" from-field="parameters.contentTypeId"/> + <session-to-field field="content.userLogin" session-name="userLogin"/> + <call-service service-name="createContent" in-map-name="content"> + <result-to-field result-name="contentId" field="contentAssoc.contentIdTo"/> + </call-service> + <set field="contentAssoc.contentId" from-field="parameters.contentId"/> + <set field="contentAssoc.contentAssocTypeId" from-field="parameters.contentAssocTypeId"/> + <session-to-field field="contentAssoc.userLogin" session-name="userLogin"/> + <call-service service-name="createContentAssoc" in-map-name="contentAssoc"/> + </simple-method> </simple-methods> Added: ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java?rev=745407&view=auto ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java (added) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java Wed Feb 18 08:04:48 2009 @@ -0,0 +1,403 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.content.tree; + +import java.io.*; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javolution.util.FastMap; + +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.GenericDelegator; +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ServiceUtil; + +public class ConvertTree{ + public static final String module = ConvertTree.class.getName(); + +/* + +This program will convert the output of the DOS 'tree' command into a contantAssoc tree. +the leaves in the tree will point to filenames on the local disk. + +With this program and the content navigation a office file server can be replaced with a +document tree in OFBiz. From that point on the documents can be connected to the cutomers, +orders, invoices etc.. + +In order ta make this service active add the following to the service definition file: + +<service name="convertTree" auth="true" engine="java" invoke="convertTree" transaction-timeout="3600" + location="org.ofbiz.content.tree.ConvertTree"> + <description>Convert DOS tree output to ContentAssoc tree.</description> + <attribute name="file" type="String" mode="IN" optional="false"/> +</service> + + +*/ + + + public static Map<String, Object> convertTree(DispatchContext dctx, Map context) { + GenericDelegator delegator = dctx.getDelegator(); + LocalDispatcher dispatcher = dctx.getDispatcher(); + GenericValue userLogin = (GenericValue) context.get("userLogin"); + String file = (String) context.get("file"); + String errMsg = "", sucMsg= ""; + GenericValue Entity = null; + try { + BufferedReader input = null; + try{ + if(!UtilValidate.isEmpty(file)){ + input = new BufferedReader( new FileReader(file)); + String line = null; + int size=0; + if(file != null){ + int counterLine=0; + //Home Document + Entity = null; + Entity = delegator.makeValue("Content"); + Entity.set("contentId", "ROOT"); + Entity.set("contentName", "ROOT"); + Entity.set("contentTypeId", "DOCUMENT"); + Entity.set("createdByUserLogin", userLogin.get("userLoginId")); + Entity.set("lastModifiedByUserLogin", userLogin.get("userLoginId")); + Entity.set("createdDate", UtilDateTime.nowTimestamp()); + Entity.set("lastUpdatedStamp",UtilDateTime.nowTimestamp()); + Entity.set("lastUpdatedTxStamp",UtilDateTime.nowTimestamp()); + Entity.set("createdStamp",UtilDateTime.nowTimestamp()); + Entity.set("createdTxStamp",UtilDateTime.nowTimestamp()); + delegator.create(Entity); + + Entity = null; + Entity = delegator.makeValue("Content"); + Entity.set("contentId", "HOME_DUCUMENT"); + Entity.set("contentName", "Home"); + Entity.set("contentTypeId", "DOCUMENT"); + Entity.set("createdByUserLogin", userLogin.get("userLoginId")); + Entity.set("lastModifiedByUserLogin", userLogin.get("userLoginId")); + Entity.set("createdDate", UtilDateTime.nowTimestamp()); + Entity.set("lastUpdatedStamp",UtilDateTime.nowTimestamp()); + Entity.set("lastUpdatedTxStamp",UtilDateTime.nowTimestamp()); + Entity.set("createdStamp",UtilDateTime.nowTimestamp()); + Entity.set("createdTxStamp",UtilDateTime.nowTimestamp()); + delegator.create(Entity); + + Map<String, Object> contentAssoc = FastMap.newInstance(); + contentAssoc.put("contentId", "HOME_DUCUMENT"); + contentAssoc.put("contentAssocTypeId", "TREE_CHILD"); + contentAssoc.put("contentIdTo", "ROOT"); + contentAssoc.put("userLogin", userLogin); + dispatcher.runSync("createContentAssoc", contentAssoc); + int recordCount = 0; + while (( line = input.readLine()) != null){//start line + boolean hasFolder=true; + String + rootContent=null, + contentId = null; + counterLine++; + if(counterLine>1){ + size = line.length(); + String + check = "\\", + checkSubContent = ",", + contentName = "", + contentNameInprogress = "", + data = line.substring(3,size); + //Debug.log("======Data======"+data); + size = data.length(); + List<GenericValue> contents = null; + + for(int index = 0; index< size; index++){//start character in line + boolean contentNameMatch = false; + int contentAssocSize=0; + List<GenericValue> contentAssocs = null; + if (data.charAt(index) == check.charAt(0)||data.charAt(index)== checkSubContent.charAt(0)) {//store data + contentName = contentName + contentNameInprogress; + if(contentName.length()>100){ + contentName = contentName.substring(0,100); + } + //check duplicate folder + contents = delegator.findByAnd("Content", UtilMisc.toMap("contentName",contentName)); + if(contents.size() > 0){ + GenericValue contentResult = contents.get(0); + contentId = contentResult.get("contentId").toString(); + } + if(contents.size() > 0 && hasFolder==true){ + GenericValue contentResult = contents.get(0); + contentId = contentResult.get("contentId").toString(); + if(rootContent != null){ + contentAssocs= delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId",contentId, "contentIdTo", rootContent)); + List<GenericValue> contentAssocCheck= delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentIdTo", rootContent)); + Iterator<GenericValue> contentAssChecks = contentAssocCheck.iterator(); + while(contentAssChecks.hasNext() && contentNameMatch == false){ + GenericValue contentAss = contentAssChecks.next(); + GenericValue contentcheck = delegator.findByPrimaryKey("Content",UtilMisc.toMap("contentId",contentAss.get("contentId"))); + if(contentcheck!=null){ + if(contentcheck.get("contentName").equals(contentName) && contentNameMatch==false){ + contentNameMatch = true; + contentId = contentcheck.get("contentId").toString(); + } + } + } + }else{ + rootContent = "HOME_DUCUMENT"; + contentAssocs= delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId",contentId, "contentIdTo", rootContent)); + + } + contentAssocSize=contentAssocs.size(); + } + + if( contentAssocSize == 0 && contentNameMatch==false){//New Root Content + Entity = null; + contentId = delegator.getNextSeqId("Content"); + Entity = delegator.makeValue("Content"); + Entity.set("contentId", contentId); + Entity.set("contentName", contentName); + Entity.set("contentTypeId", "DOCUMENT"); + Entity.set("createdByUserLogin", userLogin.get("userLoginId")); + Entity.set("lastModifiedByUserLogin", userLogin.get("userLoginId")); + Entity.set("createdDate", UtilDateTime.nowTimestamp()); + Entity.set("lastUpdatedStamp",UtilDateTime.nowTimestamp()); + Entity.set("lastUpdatedTxStamp",UtilDateTime.nowTimestamp()); + Entity.set("createdStamp",UtilDateTime.nowTimestamp()); + Entity.set("createdTxStamp",UtilDateTime.nowTimestamp()); + delegator.create(Entity); + hasFolder = false; + }else{ + //Debug.log("Content Name = [ "+contentId+"] already exist.");//ShoW log file + hasFolder = true; + } + //Relation Content + if(rootContent==null){ + rootContent = "HOME_DUCUMENT"; + } + contentAssocs = delegator.findByAnd("ContentAssoc", + UtilMisc.toMap("contentId",contentId,"contentIdTo",rootContent,"contentAssocTypeId","TREE_CHILD")); + if(contentAssocs.size()==0){ + contentAssoc = FastMap.newInstance(); + contentAssoc.put("contentId", contentId); + contentAssoc.put("contentAssocTypeId", "TREE_CHILD"); + contentAssoc.put("contentIdTo", rootContent); + contentAssoc.put("userLogin", userLogin); + dispatcher.runSync("createContentAssoc", contentAssoc); + rootContent=contentId; + }else{ + //Debug.log("ContentAssoc [contentId= "+contentId+",contentIdTo="+rootContent+"] already exist.");//ShoW log file + rootContent=contentId; + } + contentName = ""; + contentNameInprogress=""; + } + if(data.charAt(index)== checkSubContent.charAt(0)){//Have sub content + createSubContent(index, data, rootContent, context, dctx); + index=size; + continue; + } + if((data.charAt(index))!= check.charAt(0)){ + contentNameInprogress = contentNameInprogress.concat(Character.toString(data.charAt(index))); + if(contentNameInprogress.length()>99){ + contentName = contentName + contentNameInprogress; + contentNameInprogress=""; + } + } + }//end character in line + recordCount++; + } + }//end line + sucMsg = "Convert Documents Tree Successful.<br/>Total : "+counterLine+" rows"; + } + } + } + finally { + input.close(); + } + return ServiceUtil.returnSuccess(sucMsg); + }catch(IOException e){ + errMsg = "IOException "+ UtilMisc.toMap("errMessage", e.toString()); + Debug.logError(e, errMsg, module); + return ServiceUtil.returnError(errMsg); + }catch(GenericServiceException e){ + errMsg = "GenericServiceException "+ UtilMisc.toMap("errMessage", e.toString()); + Debug.logError(e, errMsg, module); + return ServiceUtil.returnError(errMsg); + }catch(GenericEntityException e){ + errMsg = "GenericEntityException "+ UtilMisc.toMap("errMessage", e.toString()); + Debug.logError(e, errMsg, module); + e.printStackTrace(); + return ServiceUtil.returnError(errMsg); + } + } + + public static Map<String,Object> createSubContent(int index,String line,String rootContent, Map context, DispatchContext dctx) { + GenericDelegator delegator = dctx.getDelegator(); + LocalDispatcher dispatcher = dctx.getDispatcher(); + GenericValue userLogin = (GenericValue) context.get("userLogin"); + String + subContents=null, + check = ",", + oldChar = "\"", + newChar = "", + contentNameInprogress = "", + contentName = "", + contentId =null; + GenericValue Entity = null; + String errMsg = "", sucMsg= ""; + subContents = line.substring(index+1, line.length()); + subContents = subContents.replace(oldChar, newChar); + int size = subContents.length(); + try{ + for(index = 0; index < size; index++){//start character in line + boolean contentNameMatch = false; + if (subContents.charAt(index) == check.charAt(0)) {//store data + contentName = contentName + contentNameInprogress; + //Debug.log("subcontentName---->"+contentName); + if(contentName.length()>100){ + contentName = contentName.substring(0,100); + } + List<GenericValue> contents = delegator.findByAnd("Content", UtilMisc.toMap("contentName",contentName),null,"-contentId"); + if(contents!=null){ + Iterator<GenericValue> contentCheck = contents.iterator(); + while(contentCheck.hasNext() && contentNameMatch==false){ + GenericValue contentch = contentCheck.next(); + if(contentch!=null){ + List<GenericValue> contentAssocsChecks = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId",contentch.get("contentId"), "contentIdTo", rootContent)); + if(contentAssocsChecks.size() > 0){ + contentNameMatch = true; + } + } + } + } + contentId = null; + if(contentNameMatch==false){ + //create DataResource + Map<String,Object> data = FastMap.newInstance(); + data.put("userLogin", userLogin); + String dataResourceId = (dispatcher.runSync("createDataResource",data)).get("dataResourceId").toString(); + //Debug.log("==dataResourceId"+dataResourceId); + + //create Content + contentId = delegator.getNextSeqId("Content"); + Entity = null; + Entity = delegator.makeValue("Content"); + Entity.set("contentId", contentId); + Entity.set("contentName", contentName); + Entity.set("contentTypeId", "DOCUMENT"); + Entity.set("dataResourceId", dataResourceId); + Entity.set("createdByUserLogin", userLogin.get("userLoginId")); + Entity.set("lastModifiedByUserLogin", userLogin.get("userLoginId")); + Entity.set("createdDate", UtilDateTime.nowTimestamp()); + Entity.set("lastUpdatedStamp",UtilDateTime.nowTimestamp()); + Entity.set("lastUpdatedTxStamp",UtilDateTime.nowTimestamp()); + Entity.set("createdStamp",UtilDateTime.nowTimestamp()); + Entity.set("createdTxStamp",UtilDateTime.nowTimestamp()); + delegator.create(Entity); + + //Relation Content + Map<String,Object> contentAssoc = FastMap.newInstance(); + contentAssoc.put("contentId", contentId); + contentAssoc.put("contentAssocTypeId", "SUB_CONTENT"); + contentAssoc.put("contentIdTo", rootContent); + contentAssoc.put("userLogin", userLogin); + dispatcher.runSync("createContentAssoc", contentAssoc); + } + contentName =""; + contentNameInprogress=""; + } + + if((subContents.charAt(index))!= check.charAt(0)){ + contentNameInprogress = contentNameInprogress.concat(Character.toString(subContents.charAt(index))); + if(contentNameInprogress.length() > 99){ + contentName = contentName + contentNameInprogress; + contentNameInprogress=""; + } + } + //lastItem + if(index==size-1){ + contentNameMatch = false; + List<GenericValue> contents = delegator.findByAnd("Content", UtilMisc.toMap("contentName",contentName)); + if(contents!=null){ + Iterator<GenericValue> contentCheck = contents.iterator(); + while(contentCheck.hasNext() && contentNameMatch==false){ + GenericValue contentch = contentCheck.next(); + if(contentch!=null){ + List<GenericValue> contentAssocsChecks = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId",contentch.get("contentId"), "contentIdTo", rootContent)); + if(contentAssocsChecks.size() > 0){ + contentNameMatch = true; + } + } + } + } + contentId = null; + if(contentNameMatch == false){ + //create DataResource + Map<String,Object> data = FastMap.newInstance(); + data.put("userLogin", userLogin); + String dataResourceId = (dispatcher.runSync("createDataResource",data)).get("dataResourceId").toString(); + //Debug.log("==dataResourceId"+dataResourceId); + + //create Content + contentId = delegator.getNextSeqId("Content"); + Entity = null; + Entity = delegator.makeValue("Content"); + Entity.set("contentId", contentId); + Entity.set("contentName", contentName); + Entity.set("contentTypeId", "DOCUMENT"); + Entity.set("dataResourceId", dataResourceId); + Entity.set("createdByUserLogin", userLogin.get("userLoginId")); + Entity.set("lastModifiedByUserLogin", userLogin.get("userLoginId")); + Entity.set("createdDate", UtilDateTime.nowTimestamp()); + Entity.set("lastUpdatedStamp",UtilDateTime.nowTimestamp()); + Entity.set("lastUpdatedTxStamp",UtilDateTime.nowTimestamp()); + Entity.set("createdStamp",UtilDateTime.nowTimestamp()); + Entity.set("createdTxStamp",UtilDateTime.nowTimestamp()); + delegator.create(Entity); + + //create ContentAssoc + Map<String,Object> contentAssoc = FastMap.newInstance(); + contentAssoc.put("contentId", contentId); + contentAssoc.put("contentAssocTypeId", "SUB_CONTENT"); + contentAssoc.put("contentIdTo", rootContent); + contentAssoc.put("userLogin", userLogin); + dispatcher.runSync("createContentAssoc", contentAssoc); + } + } + + } + return ServiceUtil.returnSuccess(sucMsg); + }catch(GenericEntityException e){ + errMsg = "GenericEntityException "+ UtilMisc.toMap("errMessage", e.toString()); + Debug.logError(e, errMsg, module); + e.printStackTrace(); + return ServiceUtil.returnError(errMsg); + }catch(GenericServiceException e){ + errMsg = "GenericServiceException"+ UtilMisc.toMap("errMessage", e.toString()); + Debug.logError(e, errMsg, module); + e.printStackTrace(); + return ServiceUtil.returnError(errMsg); + } + } +} Propchange: ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml?rev=745407&r1=745406&r2=745407&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml Wed Feb 18 08:04:48 2009 @@ -1775,6 +1775,31 @@ <request-map uri="LookupProductFeature"><security auth="true" https="true"/><response name="success" type="view" value="LookupProductFeature"/></request-map> <request-map uri="LookupPartyName"><security https="true" auth="true"/><response name="success" type="view" value="LookupPartyName"/></request-map> <request-map uri="LookupWorkEffort"><security https="true" auth="true"/><response name="success" type="view" value="LookupWorkEffort"/></request-map> + + <!-- ================ Content Navigate Requests ================= --> + <request-map uri="navigateContent"> + <security auth="true" https="true"/> + <response name="success" type="view" value="navigateContent"/> + </request-map> + <request-map uri="updateDocumentTree"> + <security auth="true" https="true"/> + <event invoke="updateContent" type="service"/> + <response name="success" type="request-redirect" value="navigateContent"/> + <response name="error" type="view" value="navigateContent"/> + </request-map> + <request-map uri="removeDocumentFromTree"> + <security auth="true" https="true"/> + <event invoke="removeContentAssoc" path="" type="service"/> + <response name="success" type="request-redirect" value="navigateContent"/> + <response name="error" type="view" value="navigateContent"/> + </request-map> + <request-map uri="addDocumentToTree"> + <security auth="true" https="true"/> + <event invoke="createDocument" path="org/ofbiz/content/content/ContentEvents.xml" type="simple"/> + <response name="success" type="request-redirect" value="navigateContent"/> + <response name="error" type="request" value="navigateContent"/> + </request-map> + <!-- View Mappings --> <view-map name="main" type="screen" page="component://content/widget/CommonScreens.xml#main"/> <view-map name="fonts.fo" type="screenfop" page="component://content/widget/CommonScreens.xml#fonts.fo" content-type="application/pdf" encoding="none"/> @@ -1820,7 +1845,7 @@ <view-map name="EditContent" page="component://content/widget/content/ContentScreens.xml#EditContent" type="screen"/> <view-map name="EditContentAssoc" page="component://content/widget/content/ContentScreens.xml#EditContentAssoc" type="screen"/> <view-map name="ListWebSite" page="component://content/widget/content/ContentScreens.xml#ListWebSite" type="screen"/> - + <view-map name="EditContentAttribute" page="component://content/widget/content/ContentScreens.xml#EditContentAttribute" type="screen"/> <view-map name="EditContentMetaData" page="component://content/widget/content/ContentScreens.xml#EditContentMetaData" type="screen"/> <view-map name="EditContentType" page="component://content/widget/contentsetup/ContentSetupScreens.xml#EditContentType" type="screen"/> @@ -1933,5 +1958,12 @@ <view-map name="LookupProductFeature" page="component://product/widget/catalog/LookupScreens.xml#LookupProductFeature" type="screen"/> <view-map name="LookupPartyName" type="screen" page="component://party/widget/partymgr/LookupScreens.xml#LookupPartyName"/> <view-map name="LookupWorkEffort" type="screen" page="component://workeffort/widget/LookupScreens.xml#LookupWorkEffort"/> - <!-- end of view mappings --> + + <!-- content navigate view --> + <view-map name="navigateContent" type="screen" page="component://content/widget/content/ContentScreens.xml#navigateContent"/> + <view-map name="EditDocumentTree" type="screen" page="component://content/widget/content/ContentScreens.xml#EditDocumentTree"/> + <view-map name="EditDocument" type="screen" page="component://content/widget/content/ContentScreens.xml#EditDocument"/> + <view-map name="ListDocument" type="screen" page="component://content/widget/content/ContentScreens.xml#ListDocument"/> + + <!-- end of view mappings --> </site-conf> Added: ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl?rev=745407&view=auto ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl (added) +++ ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl Wed Feb 18 08:04:48 2009 @@ -0,0 +1,233 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<script type="text/javascript"> + + dojo.require("dojo.widget.*"); + dojo.require("dojo.event.*"); + dojo.require("dojo.io.*"); + + var treeSelected = false; + var editDocumentTreeUrl = '<@ofbizUrl>/views/EditDocumentTree</@ofbizUrl>'; + var listDocument = '<@ofbizUrl>/views/ListDocument</@ofbizUrl>'; + var editDocumentUrl = '<@ofbizUrl>/views/EditDocument</@ofbizUrl>'; + var deleteDocumentUrl = '<@ofbizUrl>removeDocumentFromTree</@ofbizUrl>'; +<#-------------------------------------------------------------------------------------Load function--> + dojo.addOnLoad(function() { + dojo.event.topic.subscribe("showDocument", + function(message) { + treeSelected = true; + var ctx = new Array(); + ctx['contentId'] = message.node.widgetId; + callDocument(ctx); + } + + ); + dojo.event.topic.subscribe("NewDocumentTree/engage", + function (menuItem) { + var node = menuItem.getTreeNode(); + callCreateDocumentTree(node.widgetId); + } + + ); + dojo.event.topic.subscribe("NewDocument/engage", + function (menuItem) { + var node = menuItem.getTreeNode(); + callCreateDocument(node.widgetId); + } + + ); + dojo.event.topic.subscribe("EditDocument/engage", + function (menuItem) { + var node = menuItem.getTreeNode(); + callEditDocument(node.widgetId); + } + ); + dojo.event.topic.subscribe("RenameDocumentTree/engage", + function (menuItem) { + var node = menuItem.getTreeNode(); + callRenameDocumentTree(node.widgetId); + } + + ); + dojo.event.topic.subscribe("DeleteDocument/engage", + function (menuItem) { + var node = menuItem.getTreeNode(); + callDeleteDocument(node.widgetId, node.object); + } + ); + } + ); + +<#-------------------------------------------------------------------------------------call ofbiz function--> + function callDocument(ctx) { + var bindArgs = { + url: listDocument, + method: 'POST', + mimetype: 'text/html', + content: ctx, + error: function(type, data, evt) { + alert("An error occured loading content! : " + data); + }, + load: function(type, data, evt) { + var innerPage = dojo.byId('Document'); + innerPage.innerHTML = data; + } + }; + dojo.io.bind(bindArgs); + } +<#-------------------------------------------------------------------------------------callCreateFolder function--> + function callCreateDocumentTree(contentId) { + var bindArgs = { + url: editDocumentTreeUrl, + method: 'POST', + mimetype: 'text/html', + content: { contentId: contentId, + contentAssocTypeId:'TREE_CHILD'}, + error: function(type, data, evt) { + alert("An error occured loading content! : " + data); + }, + load: function(type, data, evt) { + var innerPage = dojo.byId('EditDocumentTree'); + innerPage.innerHTML = data; + } + }; + dojo.io.bind(bindArgs); + } +<#-------------------------------------------------------------------------------------callCreateSection function--> + function callCreateDocument(ctx) { + var bindArgs = { + url: editDocumentUrl, + method: 'POST', + mimetype: 'text/html', + content: {contentId: ctx}, + error: function(type, data, evt) { + alert("An error occured loading content! : " + data); + }, + load: function(type, data, evt) { + var innerPage = dojo.byId('Document'); + innerPage.innerHTML = data; + } + }; + dojo.io.bind(bindArgs); + } +<#-------------------------------------------------------------------------------------callEditSection function--> + function callEditDocument(ctx) { + + var bindArgs = { + url: editDocumentUrl, + method: 'POST', + mimetype: 'text/html', + content: {contentIdTo: ctx}, + error: function(type, data, evt) { + alert("An error occured loading content! : " + data); + }, + load: function(type, data, evt) { + var innerPage = dojo.byId('Document'); + innerPage.innerHTML = data; + } + }; + dojo.io.bind(bindArgs); + + } +<#-------------------------------------------------------------------------------------callDeleteItem function--> + function callDeleteDocument(contentIdTo,objstr) { + var ctx = new Array(); + if (objstr != null && objstr.length > 0) { + var obj = objstr.split("|"); + ctx['contentId'] = obj[0]; + ctx['contentAssocTypeId'] = obj[1]; + ctx['fromDate'] = obj[2]; + } + ctx['contentIdTo']=contentIdTo; + var bindArgs = { + url: deleteDocumentUrl, + method: 'POST', + mimetype: 'text/html', + content: ctx, + error: function(type, data, evt) { + alert("An error occured loading content! : " + data); + }, + load: function(type, data, evt) { + location.reload(); + } + }; + dojo.io.bind(bindArgs); + } + <#-------------------------------------------------------------------------------------callRename function--> + function callRenameDocumentTree(contentId) { + var bindArgs = { + url: editDocumentTreeUrl, + method: 'POST', + mimetype: 'text/html', + content: { contentId: contentId, + contentAssocTypeId:'TREE_CHILD', + rename: 'Y' + }, + error: function(type, data, evt) { + alert("An error occured loading content! : " + data); + }, + load: function(type, data, evt) { + var innerPage = dojo.byId('EditDocumentTree'); + innerPage.innerHTML = data; + } + }; + dojo.io.bind(bindArgs); + } +</script> + +<style> +.dojoContextMenu { + background-color: #ccc; + font-size: 10px; +} +</style> + +<#-- looping macro --> +<#macro fillTree assocList> + <#if (assocList?has_content)> + <#list assocList as assoc> + <#assign content = delegator.findByPrimaryKey("Content",Static["org.ofbiz.base.util.UtilMisc"].toMap("contentId",assoc.contentIdTo))/> + <div dojoType="TreeNode" title="${content.contentName?default(assoc.contentIdTo)}" widgetId="${assoc.contentIdTo}" + object="${assoc.contentId}|${assoc.contentAssocTypeId}|${assoc.fromDate}"> + <#assign assocChilds = delegator.findByAnd("ContentAssoc",Static["org.ofbiz.base.util.UtilMisc"].toMap("contentId",assoc.contentIdTo,"contentAssocTypeId", "TREE_CHILD"))/> + <#if assocChilds?has_content> + <@fillTree assocList = assocChilds/> + </#if> + </div> + </#list> + </#if> +</#macro> + +<dl dojoType="TreeContextMenu" id="contentContextMenu" style="font-size: 1em; color: #ccc;"> + <dt dojoType="TreeMenuItem" id="NewDocumentTree" caption="${uiLabelMap.ContentNewFolder}"/> + <dt dojoType="TreeMenuItem" id="NewDocument" caption="${uiLabelMap.ContentNewContentInFolder}"/> + <#--<dt dojoType="TreeMenuItem" id="EditDocument" caption="Edit Document"/> --> + <dt dojoType="TreeMenuItem" id="RenameDocumentTree" caption="${uiLabelMap.ContentRenameFolder}"/> + <dt dojoType="TreeMenuItem" id="DeleteDocument" caption="${uiLabelMap.ContentDeleteFolder}"/> +</dl> + + +<dojo:TreeSelector widgetId="contentTreeSelector" eventNames="select:showDocument"></dojo:TreeSelector> +<div dojoType="Tree" menu="contentContextMenu" widgetId="contentTree" selector="contentTreeSelector" toggler="fade" toggleDuration="500"> + <#if (contentAssoc?has_content)> + <@fillTree assocList = contentAssoc/> + </#if> +</div> + Propchange: ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/applications/content/webapp/content/content/EditContentTree.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/content/EditContentTree.ftl?rev=745407&view=auto ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/content/EditContentTree.ftl (added) +++ ofbiz/trunk/applications/content/webapp/content/content/EditContentTree.ftl Wed Feb 18 08:04:48 2009 @@ -0,0 +1,35 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> +<form name="editContentTree" action="<#if parameters.rename?has_content><@ofbizUrl>updateDocumentTree</@ofbizUrl><#else><@ofbizUrl>addDocumentToTree</@ofbizUrl></#if>" method="post"> + <#assign content = delegator.findByPrimaryKey("Content",Static["org.ofbiz.base.util.UtilMisc"].toMap("contentId",parameters.contentId))/> + <#if parameters.rename?has_content> + <div class="h3">${uiLabelMap.ContentRenameFolder}</div> + ${uiLabelMap.ContentRenameFolder} : ${content.contentName}<br/> + <input type="text" name="contentName" value="${content.contentName}"> + <br/ <a class="buttontext" href="javascript:document.editContentTree.submit();">${uiLabelMap.ContentRenameFolder}</a><a class="buttontext" href="<@ofbizUrl>navigateContent</@ofbizUrl>">${uiLabelMap.CommonCancel}</a> + <#else> + <div class="h3">${uiLabelMap.ContentNewFolder}</div> + ${uiLabelMap.ContentRootContent} : ${content.contentName} + <input type="text" name="contentName"> + <br/><a class="buttontext" href="javascript:document.editContentTree.submit();">${uiLabelMap.CommonCreate}</a><a class="buttontext" href="<@ofbizUrl>navigateContent</@ofbizUrl>">${uiLabelMap.CommonCancel}</a> + </#if> + <input type="hidden" name="contentId" value="${parameters.contentId}"/> + <input type="hidden" name="contentAssocTypeId" value="TREE_CHILD"/> +</form> +<hr/> Propchange: ofbiz/trunk/applications/content/webapp/content/content/EditContentTree.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/content/webapp/content/content/EditContentTree.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/content/webapp/content/content/EditContentTree.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/applications/content/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/CommonScreens.xml?rev=745407&r1=745406&r2=745407&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/CommonScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/CommonScreens.xml Wed Feb 18 08:04:48 2009 @@ -112,6 +112,33 @@ </section> </screen> + <screen name="contentDecorator"> + <section> + <actions> + <set field="headerItem" value="Content"/> + </actions> + <widgets> + <decorator-screen name="main-decorator"> + <decorator-section name="body"> + <section> + <condition> + <if-has-permission permission="CONTENTMGR" action="UPDATE"/> + </condition> + <widgets> + <include-menu name="contentTopMenu" location="component://content/widget/content/ContentMenus.xml"/> + <decorator-section-include name="body"/> + </widgets> + <fail-widgets> + <label style="h3">${uiLabelMap.ContentUpdatePermissionError}</label> + </fail-widgets> + </section> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + + <screen name="commonDataResourceDecorator"> <section> <actions> Modified: ofbiz/trunk/applications/content/widget/content/ContentForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/ContentForms.xml?rev=745407&r1=745406&r2=745407&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/content/ContentForms.xml (original) +++ ofbiz/trunk/applications/content/widget/content/ContentForms.xml Wed Feb 18 08:04:48 2009 @@ -493,4 +493,66 @@ <hyperlink also-hidden="false" description="${uiLabelMap.CommonDelete}" target="deleteWorkEffortContent?workEffortContentTypeId=${workEffortContentTypeId}&fromDate=${fromDate}&workEffortId=${workEffortId}&contentId=${contentId}"/> </field> </form> + <form name="ListDocument" target="" type="list" list-name="contentAssoc" paginate-target="navigateContent" + odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> + <row-actions> + <entity-one entity-name="Content" value-field="content"> + <field-map field-name="contentId" from-field="contentIdTo"/> + </entity-one> + <set field="contentTypeId" from-field="content.contentTypeId"/> + <set field="statusId" from-field="content.statusId"/> + <entity-one entity-name="DataResource" value-field="dataResource"> + <field-map field-name="dataResourceId" from-field="content.dataResourceId"/> + </entity-one> + <set field="mimeTypeId" from-field="dataResource.mimeTypeId"/> + </row-actions> + <field name="contentId"> + <hyperlink also-hidden="false" description="${content.contentName} [${content.contentId}]" target="ViewSimpleContent?contentId=${content.contentId}&dataResourceId=${content.dataResourceId}"/> + </field> + <field name="contentTypeId"> + <display-entity entity-name="ContentType" key-field-name="contentTypeId" description="${description}"/> + </field> + <field name="mimeTypeId"> + <display-entity entity-name="MimeType" key-field-name="mimeTypeId" description="${description}"/> + </field> + <field name="statusId"> + <display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/> + </field> + <field name="createdDate"><display description="${content.createdDate}"/></field> + <field name="delete"> + <hyperlink target="removeDocumentFromTree?contentId=${contentId}&contentIdTo=${contentIdTo}&contentAssocTypeId=${contentAssocTypeId}&fromDate=${fromDate}" description="Delete"/> + </field> + </form> + <form name="AddDocument" target="addDocumentToTree" title="" type="single" + header-row-style="header-row" default-table-style="basic-table"> + <actions> + <entity-one entity-name="Content" value-field="content"> + <field-map field-name="contentId" from-field="parameters.contentId"/> + </entity-one> + </actions> + <field name="contentIdTo"><hidden/></field> + <field name="contentId" title="${uiLabelMap.ContentRoot}"><display description="${content.contentName}[${content.contentId}]"/></field> + <field name="contentName"><text/></field> + <field name="contentTypeId"> + <drop-down allow-empty="true"> + <entity-options description="${description}" entity-name="ContentType"> + <entity-order-by field-name="description"/> + </entity-options> + </drop-down> + </field> + <field name="contentAssocTypeId"><hidden value="SUB_CONTENT"/></field> + <field name="fromDate"><date-time/></field> + <field name="thruDate"><date-time/></field> + <field name="contentAssocPredicateId"><text/></field> + <field name="dataSourceId"><lookup target-form-name="LookupDataResource"></lookup></field> + <field name="mapKey"><text/></field> + <field name="upperCoordinate"><text/></field> + <field name="leftCoordinate"><text/></field> + <field name="metaDataPredicateId"> + <drop-down allow-empty="true"> + <entity-options description="${description}" entity-name="MetaDataPredicate"/> + </drop-down> + </field> + <field name="submit"><submit/></field> + </form> </forms> Modified: ofbiz/trunk/applications/content/widget/content/ContentMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/ContentMenus.xml?rev=745407&r1=745406&r2=745407&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/content/ContentMenus.xml (original) +++ ofbiz/trunk/applications/content/widget/content/ContentMenus.xml Wed Feb 18 08:04:48 2009 @@ -187,4 +187,12 @@ <link target="EditBlogArticle?blogContentId=${parameters.blogContentId}"/> </menu-item> </menu> + <menu name="contentTopMenu" menu-container-style="button-bar tab-bar" default-selected-style="selected" type="simple" selected-menuitem-context-field-name="tabButtonItem"> + <menu-item name="findContent" title="${uiLabelMap.CommonFind}"> + <link target="findContent"/> + </menu-item> + <menu-item name="navigateContent" title="${uiLabelMap.ContentNavigate}"> + <link target="navigateContent"/> + </menu-item> + </menu> </menus> Modified: ofbiz/trunk/applications/content/widget/content/ContentScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/ContentScreens.xml?rev=745407&r1=745406&r2=745407&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/content/ContentScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/content/ContentScreens.xml Wed Feb 18 08:04:48 2009 @@ -30,12 +30,13 @@ <set field="headerItem" value="Content"/> <set field="titleProperty" value="PageTitleFindContent"/> <set field="entityName" value="Content"/> + <set field="tabButtonItem" value="findContent"/> <set field="queryString" from-field="result.queryString"/> <set field="viewIndex" from-field="requestParameters.VIEW_INDEX" type="Integer"/> <set field="viewSize" from-field="requestParameters.VIEW_SIZE" type="Integer" default-value="30"/> </actions> <widgets> - <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> + <decorator-screen name="contentDecorator" location="${parameters.mainDecoratorLocation}"> <decorator-section name="body"> <section> <widgets> @@ -71,6 +72,101 @@ </widgets> </section> </screen> + <screen name="navigateContent"> + <section> + <actions> + <set field="layoutSettings.javaScripts[+0]" value="/images/dojo/dojo.js" global="true"/> + <set field="titleProperty" value="PageTitleNavigateContent"/> + <set field="tabButtonItem" value="navigateContent"/> + <set field="labelTitleProperty" value="PageTitleNavigateContent"/> + <entity-and entity-name="ContentAssoc" list="contentAssoc"> + <field-map field-name="contentId" value="TREE_ROOT"/> + <field-map field-name="contentAssocTypeId" value="TREE_CHILD"/> + </entity-and> + </actions> + <widgets> + <decorator-screen name="contentDecorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <section> + <widgets> + <container style="left-border"> + <screenlet title="${uiLabelMap.PageTitleNavigateContent}" > + <container id="EditDocumentTree"/> + <include-screen name="navigateMenu"/> + </screenlet> + </container> + <container style="leftonly"> + <container style="screenlet-title-bar h3"> + <label text="${uiLabelMap.ContentContent}"/> + </container> + <container id="Document" style="screenlet"> + <include-screen name="ListDocument"/> + </container> + </container> + </widgets> + </section> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + <screen name="navigateMenu"> + <section> + <widgets> + <platform-specific> + <html> + <html-template location="component://content/webapp/content/content/ContentNav.ftl"/> + </html> + </platform-specific> + </widgets> + </section> + </screen> + <screen name="EditDocument"> + <section> + <actions> + <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/> + <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/> + </actions> + <widgets> + <container> + <include-form name="AddDocument" location="component://content/widget/content/ContentForms.xml"/> + </container> + </widgets> + </section> + </screen> + <screen name="ListDocument"> + <section> + <actions> + <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/> + <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/> + <set field="contentIdTo" from-field="parameters.contentIdTo"/> + <set field="contentId" from-field="parameters.contentId"/> + <entity-condition entity-name="ContentAssoc" list="contentAssoc"> + <condition-list combine="and"> + <condition-expr field-name="contentId" from-field="contentId" operator="equals"/> + </condition-list> + </entity-condition> + </actions> + <widgets> + <include-form name="ListDocument" location="component://content/widget/content/ContentForms.xml"/> + </widgets> + </section> + </screen> + <screen name="EditDocumentTree"> + <section> + <actions> + <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/> + <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/> + </actions> + <widgets> + <platform-specific> + <html> + <html-template location="component://content/webapp/content/content/EditContentTree.ftl"/> + </html> + </platform-specific> + </widgets> + </section> + </screen> <screen name="EditContent"> <section> <actions> |
Free forum by Nabble | Edit this page |