1 31 32 package org.opencms.workplace.explorer; 33 34 import org.opencms.file.types.CmsResourceTypePointer; 35 import org.opencms.jsp.CmsJspActionElement; 36 import org.opencms.workplace.CmsWorkplaceSettings; 37 38 import java.util.List ; 39 40 import javax.servlet.http.HttpServletRequest ; 41 import javax.servlet.http.HttpServletResponse ; 42 import javax.servlet.jsp.JspException ; 43 import javax.servlet.jsp.PageContext ; 44 45 60 public class CmsNewResourcePointer extends CmsNewResource { 61 62 63 public static final String PARAM_LINKTARGET = "linktarget"; 64 65 private String m_paramLinkTarget; 66 67 72 public CmsNewResourcePointer(CmsJspActionElement jsp) { 73 74 super(jsp); 75 } 76 77 84 public CmsNewResourcePointer(PageContext context, HttpServletRequest req, HttpServletResponse res) { 85 86 this(new CmsJspActionElement(context, req, res)); 87 } 88 89 94 public void actionCreateResource() throws JspException { 95 96 try { 97 String title = computeNewTitleProperty(); 99 String fullResourceName = computeFullResourceName(); 101 List properties = createResourceProperties( 103 fullResourceName, 104 CmsResourceTypePointer.getStaticTypeName(), 105 title); 106 String linkTarget = getParamLinkTarget(); 108 if (linkTarget == null) { 109 linkTarget = ""; 110 } 111 getCms().createResource( 113 fullResourceName, 114 CmsResourceTypePointer.getStaticTypeId(), 115 linkTarget.getBytes(), 116 properties); 117 setParamResource(fullResourceName); 118 setResourceCreated(true); 119 } catch (Throwable e) { 120 setParamMessage(Messages.get().getBundle(getLocale()).key(Messages.ERR_CREATE_LINK_0)); 122 includeErrorpage(this, e); 123 } 124 125 } 126 127 132 public String getParamLinkTarget() { 133 134 return m_paramLinkTarget; 135 } 136 137 142 public void setParamLinkTarget(String linkTarget) { 143 144 m_paramLinkTarget = linkTarget; 145 } 146 147 150 protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) { 151 152 fillParamValues(request); 154 setParamDialogtype(DIALOG_TYPE); 156 if (DIALOG_OK.equals(getParamAction())) { 158 setAction(ACTION_OK); 159 } else if (DIALOG_CANCEL.equals(getParamAction())) { 160 setAction(ACTION_CANCEL); 161 } else { 162 setAction(ACTION_DEFAULT); 163 setParamTitle(key(Messages.GUI_NEWRESOURCE_POINTER_0)); 165 } 166 } 167 168 } | Popular Tags |