Thanks to Scott Gray for the patch (Apache OFBIZ-87). git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@422872 13f79535-47bb-0310-9956-ffa450edef68
98 lines
4.1 KiB
Plaintext
98 lines
4.1 KiB
Plaintext
/*
|
|
* Copyright 2001-2006 The Apache Software Foundation
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
* use this file except in compliance with the License. You may obtain a copy of
|
|
* the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
* License for the specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
|
|
/**
|
|
*
|
|
* @author <a href="mailto:byersa@automationgroups.com">Al Byers</a>
|
|
* @version $Revision$
|
|
* @since 3.0
|
|
|
|
*/
|
|
|
|
import org.ofbiz.base.util.*;
|
|
import org.ofbiz.entity.*;
|
|
import org.ofbiz.security.*;
|
|
import org.ofbiz.service.*;
|
|
import org.ofbiz.entity.model.*;
|
|
import org.ofbiz.widget.html.*;
|
|
import org.ofbiz.widget.form.*;
|
|
import org.ofbiz.content.data.DataResourceWorker;
|
|
import org.ofbiz.webapp.ftl.FreeMarkerViewHandler;
|
|
import org.ofbiz.content.content.ContentWorker;
|
|
import org.ofbiz.content.ContentManagementWorker;
|
|
|
|
import java.io.StringWriter;
|
|
import freemarker.ext.beans.BeansWrapper;
|
|
import freemarker.template.SimpleHash;
|
|
import freemarker.template.WrappingTemplateModel;
|
|
|
|
|
|
import javax.servlet.*;
|
|
import javax.servlet.http.*;
|
|
|
|
// load edit or create Content form
|
|
|
|
dispatcher = (LocalDispatcher)request.getAttribute("dispatcher");
|
|
delegator = (GenericDelegator) request.getAttribute("delegator");
|
|
security = (Security)request.getAttribute("security");
|
|
//Debug.logInfo("in ownerprep, security:" + security, "");
|
|
|
|
ServletContext servletContext = session.getServletContext();
|
|
String rootPubPt = (String) servletContext.getAttribute("webSiteId");
|
|
//Debug.logInfo("in ownerprep, rootPubPt:" + rootPubPt, "");
|
|
//security = (Security)session.getAttribute("security");
|
|
userLogin = session.getAttribute("userLogin");
|
|
entityAction = page.getProperty("entityOperation");
|
|
permittedOperations = page.getProperty("permittedOperations");
|
|
|
|
allDepartmentContentList = ContentManagementWorker.getAllDepartmentContent(delegator, rootPubPt);
|
|
//Debug.logInfo("in ownercontentprep, allDepartmentContentList:" + allDepartmentContentList, "");
|
|
departmentPointList = ContentManagementWorker.getPermittedDepartmentPoints( delegator, allDepartmentContentList, userLogin, security, entityAction, "CONTENT_CREATE", null );
|
|
//Debug.logInfo("in ownercontentprep, departmentPointList:" + departmentPointList, "");
|
|
Map departmentPointMap = new HashMap();
|
|
Map departmentPointMapAll = new HashMap();
|
|
List ownerContentList = new ArrayList();
|
|
Iterator it = departmentPointList.iterator();
|
|
while (it.hasNext()) {
|
|
String [] arr = (String [])it.next();
|
|
String contentId = (String)arr[0];
|
|
String description = (String)arr[1];
|
|
List subPointList = new ArrayList();
|
|
Map lineMap = new HashMap();
|
|
lineMap.put("contentId", contentId);
|
|
lineMap.put("description", description.toUpperCase());
|
|
ownerContentList.add(lineMap);
|
|
List subDepartmentContentList = ContentManagementWorker.getAllDepartmentContent( delegator, contentId );
|
|
Iterator it2 = subDepartmentContentList.iterator();
|
|
while (it2.hasNext()) {
|
|
GenericValue departmentPoint2 = (GenericValue)it2.next();
|
|
String contentId2 = (String)departmentPoint2.get("contentId");
|
|
String description2 = (String)departmentPoint2.get("templateTitle");
|
|
Map lineMap2 = new HashMap();
|
|
lineMap2.put("contentId", contentId2);
|
|
lineMap2.put("description", " -" + description2);
|
|
ownerContentList.add(lineMap2);
|
|
}
|
|
}
|
|
//Debug.logInfo("in ownercontentprep, ownerContentList:" + ownerContentList, "");
|
|
|
|
pubPt = context.get("pubPt");
|
|
//Debug.logInfo("in ownercontentprep, pubPt:" + pubPt, "");
|
|
singleWrapper = context.get("singleWrapper");
|
|
singleWrapper.putInContext("ownerContentList", ownerContentList);
|
|
singleWrapper.putInContext("pubPt", pubPt);
|
|
|