/** * Returns the html for the "preferences" button depending on the current users permissions and * the default workplace settings.<p> * * @return the html for the "preferences" button */ public String getPreferencesButton() { int buttonStyle = getSettings().getUserSettings().getWorkplaceButtonStyle(); if (!getCms().getRequestContext().currentUser().isManaged()) { return button( "../commons/preferences.jsp", "body", "preferences.png", Messages.GUI_BUTTON_PREFERENCES_0, buttonStyle); } else { return button(null, null, "preferences_in.png", Messages.GUI_BUTTON_PREFERENCES_0, buttonStyle); } }
/** * Returns the javascript code for the broadcast message alert in the foot of the workplace.<p> * * @return javascript code showing an alert box when the foot load */ public String getBroadcastMessage() { StringBuffer result = new StringBuffer(512); String message = getBroadcastMessageString(); if (CmsStringUtil.isNotEmpty(message)) { // create a javascript alert for the message result.append("\n<script type=\"text/javascript\">\n<!--\n"); // the timeout gives the frameset enough time to load before the alert is shown result.append("function showMessage() {\n"); result.append("\talert(decodeURIComponent(\""); // the user has pending messages, display them all result.append(CmsEncoder.escapeWBlanks(message, CmsEncoder.ENCODING_UTF_8)); result.append("\"));\n}\n"); result.append("setTimeout('showMessage();', 2000);"); result.append("\n//-->\n</script>"); } return result.toString(); }
/** * Returns the html for the "publish queue" button.<p> * * @return the html for the "publish queue" button */ public String getPublishQueueButton() { int buttonStyle = getSettings().getUserSettings().getWorkplaceButtonStyle(); StringBuffer js = new StringBuffer(128); js.append("javascript:if (parent.body.admin_content && parent.body.admin_menu) {"); js.append("parent.body.location.href = '"); js.append(getJsp().link("/system/workplace/views/admin/admin-fs.jsp?root=admin&path=/publishqueue")); js.append("';"); js.append("} else {"); js.append("parent.body.explorer_body.explorer_files.location.href = '"); js.append(getJsp().link("/system/workplace/views/admin/admin-fs.jsp?root=explorer&path=/publishqueue&menu=no")); js.append("';"); js.append("};"); return button(js.toString(), null, "publish_queue.png", Messages.GUI_BUTTON_PUBLISHQUEUE_0, buttonStyle); }
/** * Performs certain clear cache actions if the top frame is reloaded.<p> * * @param settings the current users workplace settings */ protected void topFrameReload(CmsWorkplaceSettings settings) { // ensure to read the settings from the database initUserSettings(getCms(), settings, true); // reset the HTML list in order to force a full reload settings.setListObject(null); } }
/** * Returns the last login time of the current user in localized format.<p> * * @return the last login time of the current user in localized format */ public String getLoginTime() { return getMessages().getDateTime(getSettings().getUser().getLastlogin()); }
String currentView = getSettings().getViewUri(); if (CmsStringUtil.isNotEmpty(currentView)) { if (getCms().existsResource(view.getUri(), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) { count++; String loopLink = getJsp().link(view.getUri()); String localizedKey = resolveMacros(view.getKey()); options.add(localizedKey); values.add(loopLink); return buildSelect(htmlAttributes, options, values, selectedIndex);
try { String ouFqn = ""; CmsUserSettings settings = new CmsUserSettings(getCms()); if (!settings.getListAllProjects()) { ouFqn = getCms().getRequestContext().getCurrentUser().getOuFqn(); getCms(), ouFqn, settings.getListAllProjects()); allProjects = filterProjectsForSelector(allProjects); ou = OpenCms.getOrgUnitManager().readOrganizationalUnit(getCms(), getCms().getRequestContext().getOuFqn()); } catch (CmsException e) { + " - " + OpenCms.getOrgUnitManager().readOrganizationalUnit( getCms(), project.getOuFqn()).getDisplayName(getLocale()); } catch (CmsException e) { projectName = projectName + " - " + project.getOuFqn(); options.add(projectName); if (project.getUuid().equals(getSettings().getProject())) { return buildSelect(htmlAttributes, options, values, selectedIndex);
/** * Returns a html select box filled with the current users accessible sites.<p> * * @param htmlAttributes attributes that will be inserted into the generated html * @return a html select box filled with the current users accessible sites */ public String getSiteSelect(String htmlAttributes) { List<String> options = new ArrayList<String>(); List<String> values = new ArrayList<String>(); int selectedIndex = 0; List<CmsSite> sites = OpenCms.getSiteManager().getAvailableSites(getCms(), true); Iterator<CmsSite> i = sites.iterator(); int pos = 0; while (i.hasNext()) { CmsSite site = i.next(); values.add(site.getSiteRoot()); options.add(substituteSiteTitle(site.getTitle())); String siteRoot = CmsFileUtil.addTrailingSeparator(site.getSiteRoot()); String settingsSiteRoot = getSettings().getSite(); if (settingsSiteRoot != null) { settingsSiteRoot = CmsFileUtil.addTrailingSeparator(settingsSiteRoot); } if (siteRoot.equals(settingsSiteRoot)) { // this is the user's current site selectedIndex = pos; } pos++; } return buildSelect(htmlAttributes, options, values, selectedIndex); }
/** * Returns a html select box filled with the current users accessible sites.<p> * * @param htmlAttributes attributes that will be inserted into the generated html * @return a html select box filled with the current users accessible sites */ public String getSiteSelect(String htmlAttributes) { List options = new ArrayList(); List values = new ArrayList(); int selectedIndex = 0; List sites = OpenCms.getSiteManager().getAvailableSites(getCms(), true); Iterator i = sites.iterator(); int pos = 0; while (i.hasNext()) { CmsSite site = (CmsSite)i.next(); values.add(site.getSiteRoot()); options.add(site.getTitle()); if (site.getSiteRoot().equals(getSettings().getSite())) { // this is the user's current site selectedIndex = pos; } pos++; } return buildSelect(htmlAttributes, options, values, selectedIndex); }
/** * Indicates if the site selector should be shown in the top frame depending on the count of accessible sites.<p> * * @return true if site selector should be shown, otherwise false */ public boolean showSiteSelector() { if (getSettings().getUserSettings().getRestrictExplorerView()) { // restricted explorer view to site and folder, do not show site selector return false; } // count available sites int siteCount = OpenCms.getSiteManager().getAvailableSites(getCms(), true).size(); return (siteCount > 1); }
/** * Returns the startup URI for display in the main body frame, this can * either be the user default view, or (if set) a specific startup resource.<p> * * @return the startup URI for display in the main body frame */ public String getStartupUri() { String result = getSettings().getViewStartup(); if (result == null) { // no specific startup URI is set, use view from user settings result = getSettings().getViewUri(); } else { // reset the startup URI, so that it is not displayed again on reload of the frameset getSettings().setViewStartup(null); } // add eventual request parameters to startup uri if (getJsp().getRequest().getParameterMap().size() > 0) { Set params = getJsp().getRequest().getParameterMap().entrySet(); Iterator i = params.iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry)i.next(); result = CmsRequestUtil.appendParameter(result, (String)entry.getKey(), ((String[])entry.getValue())[0]); } } // append the frame name to the startup uri return CmsEncoder.escapeXml(CmsRequestUtil.appendParameter(result, CmsFrameset.PARAM_WP_FRAME, FRAMES[2])); }
/** * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest) */ @Override protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) { // check if a startup page has been set String frame = CmsRequestUtil.getNotEmptyDecodedParameter(request, CmsFrameset.PARAM_WP_FRAME); if ((frame == null) || (FRAMES_LIST.indexOf(frame) < 0)) { // illegal or no frame selected, assume the "top" frame frame = FRAMES[0]; } if (FRAMES[0].equals(frame)) { // top frame requested - execute special reload actions topFrameReload(settings); } // check if a startup page has been set String startup = CmsRequestUtil.getNotEmptyDecodedParameter(request, CmsFrameset.PARAM_WP_START); if (startup != null) { m_reloadRequired = true; settings.setViewStartup(startup); } // check if the user requested a view change String view = request.getParameter(CmsFrameset.PARAM_WP_VIEW); if (view != null) { m_reloadRequired = true; settings.setViewUri(view); settings.getFrameUris().put("body", view); } m_reloadRequired = initSettings(settings, request) || m_reloadRequired; }
/** * Returns the reload URI for the OpenCms workplace.<p> * * @return the reload URI for the OpenCms workplace */ public String getWorkplaceReloadUri() { return getJsp().link(CmsFrameset.JSP_WORKPLACE_URI); }
/** * Returns true if the user has enabled synchronization.<p> * * @return true if the user has enabled synchronization */ public boolean isSyncEnabled() { CmsSynchronizeSettings syncSettings = getSettings().getUserSettings().getSynchronizeSettings(); return (syncSettings != null) && syncSettings.isSyncEnabled(); }
/** * Returns the remote ip address of the current user.<p> * * @return the remote ip address of the current user */ public String getLoginAddress() { return getCms().getRequestContext().getRemoteAddress(); }
String currentView = getSettings().getViewUri(); if (CmsStringUtil.isNotEmpty(currentView)) { if (getCms().existsResource(view.getUri(), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) { count++; String loopLink = getJsp().link(view.getUri()); String localizedKey = resolveMacros(view.getKey()); options.add(localizedKey); values.add(loopLink); return buildSelect(htmlAttributes, options, values, selectedIndex);
try { String ouFqn = ""; CmsUserSettings settings = new CmsUserSettings(getCms()); if (!settings.getListAllProjects()) { ouFqn = getCms().getRequestContext().currentUser().getOuFqn(); getCms(), ouFqn, settings.getListAllProjects()); ou = OpenCms.getOrgUnitManager().readOrganizationalUnit(getCms(), getCms().getRequestContext().getOuFqn()); } catch (CmsException e) { projectName = projectName + " - " + OpenCms.getOrgUnitManager().readOrganizationalUnit(getCms(), project.getOuFqn()).getDisplayName( getLocale()); } catch (CmsException e) { projectName = projectName + " - " + project.getOuFqn(); options.add(projectName); if (project.getUuid().equals(getSettings().getProject())) { return buildSelect(htmlAttributes, options, values, selectedIndex);
/** * Returns the last login time of the current user in localized format.<p> * * @return the last login time of the current user in localized format */ public String getLoginTime() { return getMessages().getDateTime(getSettings().getUser().getLastlogin()); }
/** * Performs certain clear cache actions if the top frame is reloaded.<p> * * @param settings the current users workplace settings */ protected void topFrameReload(CmsWorkplaceSettings settings) { // ensure to read the settings from the database initUserSettings(getCms(), settings, true); // reset the HTML list in order to force a full reload settings.setListObject(null); } }
/** * Indicates if the site selector should be shown in the top frame depending on the count of accessible sites.<p> * * @return true if site selector should be shown, otherwise false */ public boolean showSiteSelector() { if (getSettings().getUserSettings().getRestrictExplorerView()) { // restricted explorer view to site and folder, do not show site selector return false; } // count available sites int siteCount = OpenCms.getSiteManager().getAvailableSites(getCms(), true).size(); return (siteCount > 1); }