Package org.jasig.portal

Examples of org.jasig.portal.StructureStylesheetUserPreferences


    } else {
      throw new PortalException("attempt.to.rename.immutable.tab" + tabId);
    }
   
    StructureStylesheetUserPreferences ssup = upm.getUserPreferences()
      .getStructureStylesheetUserPreferences();
    ssup.setFolderAttributeValue(tabId, "name", tabName);



    printSuccess(response, "Saved new tab name", null);
View Full Code Here


   * @param upm
   * @param per
   * @throws Exception
   */
  private void saveUserLayoutPreservingTab(IUserLayoutManager ulm, UserPreferencesManager upm, IPerson per) throws Exception {
    StructureStylesheetUserPreferences ssup = upm.getUserPreferences().getStructureStylesheetUserPreferences();
    String currentTab = ssup.getParameterValue( ACTIVE_TAB_PARAM );
     
    // get the active tab number from the store so that we can preserve it
      String defaultTab = getDefaultTab(upm, per);
      // set the active tab to previously recorded value
      ssup.putParameterValue( ACTIVE_TAB_PARAM, defaultTab );

      // save the user's layout
    ulm.saveUserLayout();
   
    // set the current active tab back to the previous value
      ssup.putParameterValue( ACTIVE_TAB_PARAM, currentTab );
   
  }
View Full Code Here

        final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
        final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
        final UserPreferences userPreferences = preferencesManager.getUserPreferences();

       
        final StructureStylesheetUserPreferences structureStylesheetUserPreferences = userPreferences.getStructureStylesheetUserPreferences();
        final ThemeStylesheetUserPreferences themeStylesheetUserPreferences = userPreferences.getThemeStylesheetUserPreferences();
       
        String root = request.getParameter("uP_root");
        if (root != null) {
            // If a channel specifies "me" as its root, set the root
            // to the channel's subscribe Id
            if (root.equals("me")) {
                // get uPFile spec and search for "channel" clause
                //TODO get UPFileSpec for original request and store it as a request attribute
                final UPFileSpec upfs = new UPFileSpec(request);
                root = upfs.getTargetNodeId();
            }

            if (IUserLayout.ROOT_NODE_NAME.equals(root)) {
                final String oldChannelId = structureStylesheetUserPreferences.getParameterValue("userLayoutRoot");
               
                if (oldChannelId != null && !IUserLayout.ROOT_NODE_NAME.equals(oldChannelId)) {
                    //Tell the previously maximized channel it is going back to normal
                    if (logger.isDebugEnabled()) {
                        logger.debug("Sending window state event '" + PortalEvent.NORMAL + "' to '" + root + "'.");
                    }
                    channelManager.passPortalEvent(request, response, oldChannelId, PortalEvent.NORMAL);
                }
            }
            else {
                //Make sure that the focused channel isn't rendered minimized
                themeStylesheetUserPreferences.setChannelAttributeValue(root, "minimized", "false");
               
                //Tell the channel it is being maximized
                if (logger.isDebugEnabled()) {
                    logger.debug("Sending window state event '" + PortalEvent.MAXIMIZE + "' to '" + root + "'.");
                }
                channelManager.passPortalEvent(request, response, root, PortalEvent.MAXIMIZE);
            }
           
            structureStylesheetUserPreferences.putParameterValue("userLayoutRoot", root);
        }
       
        // fname and root are mutually exclusive and
        // should not be used in the same request,
        // as an fname is treated as the root target.
        final String fname = request.getParameter(Constants.FNAME_PARAM);
        if (fname != null) {
            // get a subscribe id for the fname
            String subId = null;
            try {
                subId = userLayoutManager.getSubscribeId(fname);
            }
            catch (PortalException pe) {
                logger.warn("Unable to get subscribe ID for fname='" + fname + "'", pe);
            }

            if (subId != null) {
                if (userLayoutManager instanceof TransientUserLayoutManagerWrapper) {
                    // get wrapper implementation for focusing
                    final TransientUserLayoutManagerWrapper transientUserLayoutManagerWrapper = (TransientUserLayoutManagerWrapper) userLayoutManager;
                    // .. and now set it as the focused id
                    transientUserLayoutManagerWrapper.setFocusedId(subId);
                }
   
                structureStylesheetUserPreferences.putParameterValue("userLayoutRoot", subId);
                if (logger.isDebugEnabled()) {
                    logger.debug("setting structure preference 'userLayoutRoot'='" + subId + "'");
                }
            }
        }
       
        // other params
        final String[] structParamNames = request.getParameterValues("uP_sparam");
        if (structParamNames != null) {
            for (final String structParamName : structParamNames) {
                final String structParamValue = request.getParameter(structParamName);
               
                structureStylesheetUserPreferences.putParameterValue(structParamName, structParamValue);
                if (logger.isDebugEnabled()) {
                    logger.debug("set structure parameter '" + structParamName + "'='" + structParamValue + "'.");
                }
            }
        }

        final String[] themeParamNames = request.getParameterValues("uP_tparam");
        if (themeParamNames != null) {
            for (final String themeParamName : themeParamNames) {
                final String themeParamValue = request.getParameter(themeParamName);
               
                themeStylesheetUserPreferences.putParameterValue(themeParamName, themeParamValue);
                if (logger.isDebugEnabled()) {
                    logger.debug("set theme parameter '" + themeParamName + "'='" + themeParamValue + "'.");
                }
            }
        }
       
        // attribute processing
        // structure transformation
        final String[] structFolderAttrNames = request.getParameterValues("uP_sfattr");
        if (structFolderAttrNames != null) {
            for (final String structFolderAttrName : structFolderAttrNames) {
                final String[] folderIds = request.getParameterValues(structFolderAttrName + "_folderId");
               
                if (folderIds != null) {
                    for (final String folderId : folderIds) {
                        final String structFolderAttrValue = request.getParameter(structFolderAttrName + "_" + folderId + "_value");
                        structureStylesheetUserPreferences.setFolderAttributeValue(folderId, structFolderAttrName, structFolderAttrValue);
                       
                        if (logger.isDebugEnabled()) {
                            logger.debug("set structure folder attribute '" + structFolderAttrName + "'='" + structFolderAttrValue + "' on folder '" + folderId + "'.");
                        }
                    }
                }
            }
        }
           
        final String[] structChannelAttrNames = request.getParameterValues("uP_scattr");
        if (structChannelAttrNames != null) {
            for (final String structChannelAttrName : structChannelAttrNames) {
                final String[] channelIds = request.getParameterValues(structChannelAttrName + "_channelId");
               
                if (channelIds != null) {
                    for (final String channelId : channelIds) {
                        final String structChannelAttrValue = request.getParameter(structChannelAttrName + "_" + channelId + "_value");
                        structureStylesheetUserPreferences.setChannelAttributeValue(channelId, structChannelAttrName, structChannelAttrValue);
                       
                        if (logger.isDebugEnabled()) {
                            logger.debug("set structure channel attribute '" + structChannelAttrName + "'='" + structChannelAttrValue + "' on folder '" + channelId + "'.");
                        }
                    }
View Full Code Here

    return  tsd;
  }

  protected StructureStylesheetDescription getStructureStylesheetDescription() throws ResourceMissingException, PortalException {
    if (ssd == null) {
      StructureStylesheetUserPreferences fsup = this.getUserPreferences().getStructureStylesheetUserPreferences();
      try {
        ssd = ulsdb.getStructureStylesheetDescription(fsup.getStylesheetId());
      } catch (Exception e) {
        throw new PortalException(e);
      }
    }
    return  ssd;
View Full Code Here

      getUserLayoutManager().updateNode(node);

      // reset the name
      if (node instanceof IUserLayoutChannelDescription) {
        // target is a channel
        StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
        for (Enumeration ce = ssup.getChannelAttributeNames(); ce.hasMoreElements();) {
          String atName = (String)ce.nextElement();
          String atValue = runtimeData.getParameter(atName);
          if (atValue.equals(context.getStructureStylesheetDescription().getChannelAttributeDefaultValue(atName))) {
              atValue = null;
          }

          ssup.setChannelAttributeValue(editElementID, atName, atValue);
        }
        ThemeStylesheetUserPreferences tsup = context.getUserPreferences().getThemeStylesheetUserPreferences();
        for (Enumeration ca = tsup.getChannelAttributeNames(); ca.hasMoreElements();) {
          String atName = (String)ca.nextElement();
          String atValue = runtimeData.getParameter(atName);
          if (atValue.equals(context.getThemeStylesheetDescription().getChannelAttributeDefaultValue(atName))) {
            atValue = null;
          }
          tsup.setChannelAttributeValue(editElementID, atName, atValue);
        }
      } else {
        // target is a folder
        StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
        for (Enumeration fe = ssup.getFolderAttributeNames(); fe.hasMoreElements();) {
          String atName = (String)fe.nextElement();
          String atValue = runtimeData.getParameter(atName);
          if (atValue.equals(context.getStructureStylesheetDescription().getFolderAttributeDefaultValue(atName))) {
            atValue = null;
          }
          ssup.setFolderAttributeValue(editElementID, atName, atValue);
        }
      }
      context.setModified(true);
      // get back to browse mode
      IPrivilegedChannel bstate = new GBrowseState(context);
View Full Code Here

      nameEl.appendChild(doc.createTextNode(node.getName()));
      edEl.appendChild(nameEl);
      // determine element type
      if (elType.equals("folder")) {
        // target is a folder
        StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
        Element saEl = doc.createElement("structureattributes");
        for (Enumeration fe = ssup.getFolderAttributeNames(); fe.hasMoreElements();) {
          Element atEl = doc.createElement("attribute");
          Element atNameEl = doc.createElement("name");
          String atName = (String)fe.nextElement();
          atNameEl.appendChild(doc.createTextNode(atName));
          atEl.appendChild(atNameEl);
          Element valueEl = doc.createElement("value");
          String value = ssup.getFolderAttributeValue(editElementID, atName);
          if (value == null) {
            // set the default value
            value = context.getStructureStylesheetDescription().getFolderAttributeDefaultValue(atName);
          }
          valueEl.appendChild(doc.createTextNode(value));
          atEl.appendChild(valueEl);
          Element descrEl = doc.createElement("description");
          descrEl.appendChild(doc.createTextNode(context.getStructureStylesheetDescription().getFolderAttributeWordDescription(atName)));
          atEl.appendChild(descrEl);
          saEl.appendChild(atEl);
        }
        edEl.appendChild(saEl);
      } else if (elType.equals("channel")) {
        // target is a channel
        StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
        Element saEl = doc.createElement("structureattributes");
        for (Enumeration ce = ssup.getChannelAttributeNames(); ce.hasMoreElements();) {
          Element atEl = doc.createElement("attribute");
          Element atNameEl = doc.createElement("name");
          String atName = (String)ce.nextElement();
          atNameEl.appendChild(doc.createTextNode(atName));
          atEl.appendChild(atNameEl);
          Element valueEl = doc.createElement("value");
          String value = ssup.getChannelAttributeValue(editElementID, atName);
          if (value == null) {
            value = context.getStructureStylesheetDescription().getChannelAttributeDefaultValue(atName);
          }
          valueEl.appendChild(doc.createTextNode(value));
          atEl.appendChild(valueEl);
View Full Code Here

    return  tsd;
  }

  protected StructureStylesheetDescription getStructureStylesheetDescription() throws ResourceMissingException, PortalException {
    if (ssd == null) {
      StructureStylesheetUserPreferences fsup = this.getUserPreferences().getStructureStylesheetUserPreferences();
      try {
        ssd = ulsdb.getStructureStylesheetDescription(fsup.getStylesheetId());
      } catch (Exception e) {
        throw new PortalException(e);
      }
    }
    return  ssd;
View Full Code Here

      getUserLayoutManager().updateNode(node);
     
      // reset the name
      if (node instanceof IUserLayoutChannelDescription) {
        // target is a channel
        StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
        for (Enumeration ce = ssup.getChannelAttributeNames(); ce.hasMoreElements();) {
          String atName = (String)ce.nextElement();
          String atValue = runtimeData.getParameter(atName);
          if (atValue.equals(context.getStructureStylesheetDescription().getChannelAttributeDefaultValue(atName))) {
              atValue = null;
          }

          ssup.setChannelAttributeValue(editElementID, atName, atValue);
        }
        ThemeStylesheetUserPreferences tsup = context.getUserPreferences().getThemeStylesheetUserPreferences();
        for (Enumeration ca = tsup.getChannelAttributeNames(); ca.hasMoreElements();) {
          String atName = (String)ca.nextElement();
          String atValue = runtimeData.getParameter(atName);
          if (atValue.equals(context.getThemeStylesheetDescription().getChannelAttributeDefaultValue(atName))) {
            atValue = null;
          }
          tsup.setChannelAttributeValue(editElementID, atName, atValue);
        }
      } else {
        // target is a folder
        StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
        for (Enumeration fe = ssup.getFolderAttributeNames(); fe.hasMoreElements();) {
          String atName = (String)fe.nextElement();
          String atValue = runtimeData.getParameter(atName);
          if (atValue.equals(context.getStructureStylesheetDescription().getFolderAttributeDefaultValue(atName))) {
            atValue = null;
          }
          ssup.setFolderAttributeValue(editElementID, atName, atValue);
        }
      }
      context.setModified(true);
      // get back to browse mode
      IPrivilegedChannel bstate = new GBrowseState(context);
View Full Code Here

      nameEl.appendChild(doc.createTextNode(node.getName()));
      edEl.appendChild(nameEl);
      // determine element type
      if (elType.equals("folder")) {
        // target is a folder
        StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
        Element saEl = doc.createElement("structureattributes");
        for (Enumeration fe = ssup.getFolderAttributeNames(); fe.hasMoreElements();) {
          Element atEl = doc.createElement("attribute");
          Element atNameEl = doc.createElement("name");
          String atName = (String)fe.nextElement();
          atNameEl.appendChild(doc.createTextNode(atName));
          atEl.appendChild(atNameEl);
          Element valueEl = doc.createElement("value");
          String value = ssup.getFolderAttributeValue(editElementID, atName);
          if (value == null) {
            // set the default value
            value = context.getStructureStylesheetDescription().getFolderAttributeDefaultValue(atName);
          }
          valueEl.appendChild(doc.createTextNode(value));
          atEl.appendChild(valueEl);
          Element descrEl = doc.createElement("description");
          descrEl.appendChild(doc.createTextNode(context.getStructureStylesheetDescription().getFolderAttributeWordDescription(atName)));
          atEl.appendChild(descrEl);
          saEl.appendChild(atEl);
        }
        edEl.appendChild(saEl);
      } else if (elType.equals("channel")) {
        // target is a channel
        StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
        Element saEl = doc.createElement("structureattributes");
        for (Enumeration ce = ssup.getChannelAttributeNames(); ce.hasMoreElements();) {
          Element atEl = doc.createElement("attribute");
          Element atNameEl = doc.createElement("name");
          String atName = (String)ce.nextElement();
          atNameEl.appendChild(doc.createTextNode(atName));
          atEl.appendChild(atNameEl);
          Element valueEl = doc.createElement("value");
          String value = ssup.getChannelAttributeValue(editElementID, atName);
          if (value == null) {
            value = context.getStructureStylesheetDescription().getChannelAttributeDefaultValue(atName);
          }
          valueEl.appendChild(doc.createTextNode(value));
          atEl.appendChild(valueEl);
View Full Code Here

        final UserPreferences preferences = user.getPreferencesManager().getUserPreferences();
       
        final String requestUrl = req.getRequestURL().toString();
       
        // Process Structure Parameters...
        final StructureStylesheetUserPreferences ssup = preferences.getStructureStylesheetUserPreferences();
        for (Map.Entry<String, Pattern> y : structureParameters.entrySet()) {
            final Matcher m = y.getValue().matcher(requestUrl);
            if (m.find()) {
                ssup.putParameterValue(y.getKey(), m.group(1));
            }
        }
       
        // Process Theme Parameters...
        final ThemeStylesheetUserPreferences tsup = preferences.getThemeStylesheetUserPreferences();
View Full Code Here

TOP

Related Classes of org.jasig.portal.StructureStylesheetUserPreferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.