/** * Returns the OpenCms request context path.<p> * * This is a convenience method to use in the editor.<p> * * @return the OpenCms request context path */ public String getOpenCmsContext() { return OpenCms.getSystemInfo().getOpenCmsContext(); }
/** * Returns the OpenCms request context path.<p> * * This is a convenience method to use in the editor.<p> * * @return the OpenCms request context path */ public String getOpenCmsContext() { return OpenCms.getSystemInfo().getOpenCmsContext(); }
/** * @see org.opencms.widgets.A_CmsAdeGalleryWidget#getOpenPreviewCall(org.opencms.widgets.I_CmsWidgetDialog, java.lang.String) */ @Override protected String getOpenPreviewCall(I_CmsWidgetDialog widgetDialog, String id) { // using the 'cmsOpenImagePreview' function instead of 'cmsOpenPreview' StringBuffer sb = new StringBuffer(64); // using the 'cmsOpenImagePreview' function instead of 'cmsOpenPreview' sb.append("javascript:cmsOpenImagePreview('").append( widgetDialog.getMessages().key(Messages.GUI_BUTTON_PREVIEW_0)); sb.append("', '").append(OpenCms.getSystemInfo().getOpenCmsContext()); sb.append("', '").append(id); sb.append("'); return false;"); return sb.toString(); }
/** * Returns the javascript call to open the preview dialog.<p> * * @param widgetDialog the dialog where the widget is used on * @param id the field id * * @return the javascript call to open the preview dialog */ protected String getOpenPreviewCall(I_CmsWidgetDialog widgetDialog, String id) { StringBuffer sb = new StringBuffer(64); sb.append("javascript:cmsOpenPreview('").append(widgetDialog.getMessages().key(Messages.GUI_BUTTON_PREVIEW_0)); sb.append("', '").append(OpenCms.getSystemInfo().getOpenCmsContext()); sb.append("', '").append(id); sb.append("'); return false;"); return sb.toString(); }
/** * Returns the needed java script for the search button.<p> * * @param id the id of the widget to generate the search button for * @param form the id of the form where to which the widget belongs * * @return javascript code */ public String getButtonJs(String id, String form) { StringBuffer buttonJs = new StringBuffer(8); buttonJs.append("javascript:openPrincipalWin('"); buttonJs.append(OpenCms.getSystemInfo().getOpenCmsContext()); buttonJs.append("/system/workplace/commons/principal_selection.jsp"); buttonJs.append("','"+form+"', '"); buttonJs.append(id); buttonJs.append("', document, '"); if (m_flags != null) { buttonJs.append(m_flags); } else { buttonJs.append("null"); } buttonJs.append("'"); buttonJs.append(");"); return buttonJs.toString(); }
/** * Returns the needed java script for the search button.<p> * * @param id the id of the widget to generate the search button for * @param form the id of the form where to which the widget belongs * * @return javascript code */ public String getButtonJs(String id, String form) { StringBuffer buttonJs = new StringBuffer(8); buttonJs.append("javascript:openPrincipalWin('"); buttonJs.append(OpenCms.getSystemInfo().getOpenCmsContext()); buttonJs.append("/system/workplace/commons/principal_selection.jsp"); buttonJs.append("','" + form + "', '"); buttonJs.append(id); buttonJs.append("', document, '"); if (m_flags != null) { buttonJs.append(m_flags); } else { buttonJs.append("null"); } buttonJs.append("'"); buttonJs.append(");"); return buttonJs.toString(); }
/** * Given a path to a VFS resource, the method removes the OpenCms context, * in case the path is prefixed by that context. * @param path the path where the OpenCms context should be removed * @return the adjusted path */ public static String removeOpenCmsContext(final String path) { String context = OpenCms.getSystemInfo().getOpenCmsContext(); if (path.startsWith(context + "/")) { return path.substring(context.length()); } String renderPrefix = OpenCms.getStaticExportManager().getVfsPrefix(); if (path.startsWith(renderPrefix + "/")) { return path.substring(renderPrefix.length()); } return path; }
/** * Sets the ServerPath parameter.<p> * * @param paramServerPath the ServerPath parameter */ public void setParamServerPath(String paramServerPath) { if (CmsStringUtil.isEmpty(paramServerPath)) { m_paramServerPath = OpenCms.getSystemInfo().getOpenCmsContext() + getParamCurrentFolder(); } else { m_paramServerPath = OpenCms.getSystemInfo().getOpenCmsContext() + paramServerPath; } }
/** * @see org.opencms.widgets.I_CmsWidget#getDialogInitMethod(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog) */ @Override public String getDialogInitMethod(CmsObject cms, I_CmsWidgetDialog widgetDialog) { StringBuffer result = new StringBuffer(16); result.append("function initVfsFileSelector() {\n"); //initialize tree javascript, does parts of <code>CmsTree.initTree(CmsObject, encoding, skinuri);</code> result.append("\tinitResources(\""); result.append(OpenCms.getWorkplaceManager().getEncoding()); result.append("\", \""); result.append(CmsWorkplace.VFS_PATH_WORKPLACE); result.append("\", \""); result.append(CmsWorkplace.getSkinUri()); result.append("\", \""); result.append(OpenCms.getSystemInfo().getOpenCmsContext()); result.append("\");\n"); result.append("}\n"); return result.toString(); }
/** * @see org.opencms.widgets.I_CmsWidget#getDialogInitMethod(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog) */ @Override public String getDialogInitMethod(CmsObject cms, I_CmsWidgetDialog widgetDialog) { StringBuffer result = new StringBuffer(16); result.append("function initVfsFileSelector() {\n"); //initialize tree javascript, does parts of <code>CmsTree.initTree(CmsObject, encoding, skinuri);</code> result.append("\tinitResources(\""); result.append(OpenCms.getWorkplaceManager().getEncoding()); result.append("\", \""); result.append(CmsWorkplace.VFS_PATH_WORKPLACE); result.append("\", \""); result.append(CmsWorkplace.getSkinUri()); result.append("\", \""); result.append(OpenCms.getSystemInfo().getOpenCmsContext()); result.append("\");\n"); result.append("}\n"); return result.toString(); }
/** * Wraps the request URI, overloading the standard API.<p> * * This ensures that any wrapped request will use the "faked" * target parameters. Remember that for the real request, * a mixture of PathInfo and other request information is used to * identify the target.<p> * * @return a faked URI that will point to the wrapped target in the VFS * * @see javax.servlet.http.HttpServletRequest#getRequestURI() */ @Override public String getRequestURI() { if (m_requestUri != null) { return m_requestUri; } StringBuffer buf = new StringBuffer(128); buf.append(OpenCms.getSystemInfo().getOpenCmsContext()); buf.append(getElementUri()); m_requestUri = buf.toString(); return m_requestUri; }
/** * Wraps the request URI, overloading the standard API.<p> * * This ensures that any wrapped request will use the "faked" * target parameters. Remember that for the real request, * a mixture of PathInfo and other request information is used to * identify the target.<p> * * @return a faked URI that will point to the wrapped target in the VFS * * @see javax.servlet.http.HttpServletRequest#getRequestURI() */ @Override public String getRequestURI() { if (m_requestUri != null) { return m_requestUri; } StringBuffer buf = new StringBuffer(128); buf.append(OpenCms.getSystemInfo().getOpenCmsContext()); buf.append(getElementUri()); m_requestUri = buf.toString(); return m_requestUri; }
/** * Sends a http redirect to the specified URI in the OpenCms VFS.<p> * * @param location the location the response is redirected to * @throws IOException in case redirection fails */ public void sendCmsRedirect(String location) throws IOException { // TOOD: IBM Websphere v5 has problems here, use forward instead (which has other problems) getJsp().getResponse().sendRedirect(OpenCms.getSystemInfo().getOpenCmsContext() + location); }
/** * Sends a http redirect to the specified URI in the OpenCms VFS.<p> * * @param location the location the response is redirected to * @throws IOException in case redirection fails */ public void sendCmsRedirect(String location) throws IOException { // TOOD: IBM Websphere v5 has problems here, use forward instead (which has other problems) getJsp().getResponse().sendRedirect(OpenCms.getSystemInfo().getOpenCmsContext() + location); }
/** * Returns the absolute path of the requested resource in the VFS of OpenCms.<p> * * @return the absolute path of the requested resource in the VFS of OpenCms */ public String getRequestResourceName() { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getRequestUri()) && getRequestUri().startsWith(OpenCms.getSystemInfo().getOpenCmsContext())) { return getRequestUri().substring(OpenCms.getSystemInfo().getOpenCmsContext().length()); } return getRequestUri(); }
if (itemUrl.startsWith(OpenCms.getSystemInfo().getOpenCmsContext())) { itemUrl = itemUrl.substring(OpenCms.getSystemInfo().getOpenCmsContext().length());
prefix = site.getUrl() + OpenCms.getSystemInfo().getOpenCmsContext() + prefix; } else {
+ OpenCms.getSystemInfo().getOpenCmsContext() + "\""); res.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
/** * Returns a JSON object containing information of the given resource for usage in the gallery.<p> * * The content of the JSON object consists of a common and a specific part of the given resource.<p> * * @param res the resource to create the object from * @return the JSON object containing information from the given resource */ protected JSONObject buildJsonItemObject(CmsResource res) { // create a new JSON object JSONObject jsonObj = new JSONObject(); String sitePath = getCms().getRequestContext().getSitePath(res); OpenCms.getSystemInfo().getOpenCmsContext(); // fill JSON object with common information buildJsonItemCommonPart(jsonObj, res, sitePath); // fill JSON object with specific information buildJsonItemSpecificPart(jsonObj, res, sitePath); return jsonObj; }
resInfo.setViewLink( CmsStringUtil.joinPaths( OpenCms.getSystemInfo().getOpenCmsContext(), CmsPermalinkResourceHandler.PERMALINK_HANDLER, resource.getStructureId().toString()));