Examples of StructureStylesheetUserPreferences


Examples of org.jasig.portal.StructureStylesheetUserPreferences

      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

Examples of org.jasig.portal.StructureStylesheetUserPreferences

      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

Examples of org.jasig.portal.StructureStylesheetUserPreferences

    public void renderXML(ContentHandler out) throws PortalException {
      // construct gpref XML
      Document doc = DocumentFactory.getNewDocument();
      Element edEl = doc.createElement("gpref");
      StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
      Element spEl = doc.createElement("structureparameters");
      for (Enumeration e = context.getStructureStylesheetDescription().getStylesheetParameterNames(); e.hasMoreElements();) {
        Element atEl = doc.createElement("parameter");
        Element atNameEl = doc.createElement("name");
        String atName = (String)e.nextElement();
        atNameEl.appendChild(doc.createTextNode(atName));
        atEl.appendChild(atNameEl);
        Element valueEl = doc.createElement("value");
        String value = ssup.getParameterValue(atName);
        if (value == null) {
          // set the default value
          value = context.getStructureStylesheetDescription().getStylesheetParameterDefaultValue(atName);
        }
        valueEl.appendChild(doc.createTextNode(value));
View Full Code Here

Examples of org.jasig.portal.StructureStylesheetUserPreferences

          throw  new ResourceMissingException("", "stylesheet", "Unable to find stylesheet to display content for this media");
      }
    }

    private void prepareSaveEditGPrefs() throws PortalException {
      StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
      for (Enumeration e = context.getStructureStylesheetDescription().getStylesheetParameterNames(); e.hasMoreElements();) {
        String parName = (String)e.nextElement();
        String value = runtimeData.getParameter(parName);
        if (value == null) {
          ssup.putParameterValue(parName, context.getStructureStylesheetDescription().getStylesheetParameterDefaultValue(parName));
        } else {
          ssup.putParameterValue(parName, value);
          //        log.debug("CUserPreferences.GGlobalPrefsState::prepareSaveEditGPrefs() : setting sparameter "+parName+"=\""+value+"\".");
        }
      }
      ThemeStylesheetUserPreferences tsup = context.getUserPreferences().getThemeStylesheetUserPreferences();
      for (Enumeration e = context.getThemeStylesheetDescription().getStylesheetParameterNames(); e.hasMoreElements();) {
View Full Code Here

Examples of org.jasig.portal.StructureStylesheetUserPreferences

    return activeTab;
  }

  private final void setActiveTab(String activeTab) throws Exception
  {
    StructureStylesheetUserPreferences ssup = userPrefs.getStructureStylesheetUserPreferences();
    ssup.putParameterValue("activeTab", activeTab);

    // Persist structure stylesheet user preferences
    int profileId = editedUserProfile.getProfileId();
    ulStore.setStructureStylesheetUserPreferences(staticData.getPerson(), profileId, ssup);
  }
View Full Code Here

Examples of org.jasig.portal.StructureStylesheetUserPreferences

  {
    // Must get from store because the one in memory is comtaminated with stylesheet params
    // that shouldn't get persisted
    //UserPreferences userPrefsFromStore = context.getUserPreferencesFromStore(context.getCurrentUserPreferences().getProfile());
    //StructureStylesheetUserPreferences ssup = userPrefsFromStore.getStructureStylesheetUserPreferences();
    StructureStylesheetUserPreferences ssup = userPrefs.getStructureStylesheetUserPreferences();

    /*
      userPrefs is loaded directly from the database not copied from the
      UserPreferencesManager's value. As such it does not contain current
      session values like the structure stylesheet parameter userLayoutRoot
      which tells the rendering engine the node id that should be displayed
      in focused mode. While in preferences this node id is the node id of the
      preferences channel. That is a session value and should not be preserved.
      But the UserPreferencesManager's structure stylesheet user preferences
      object is being replaced by the version that we have here so that column
      width changes take immediate affect. Therefore, after persisting them we
      need to push the value of the userLayoutRoot node back into the
      preferences now held by the UserPreferencesManager so that the
      preferences channel remains in focus after changing the column widths.
     */
    String focusedNode = context.getUserPreferencesManager()
        .getUserPreferences().getStructureStylesheetUserPreferences()
        .getParameterValue( "userLayoutRoot" );
    String activeTab = context.getUserPreferencesManager()
        .getUserPreferences().getStructureStylesheetUserPreferences()
        .getParameterValue( "activeTab" );
   
    java.util.Set sColWidths = columnWidths.keySet();
    java.util.Iterator iterator = sColWidths.iterator();
    while(iterator.hasNext())
    {
      String folderId = (String)iterator.next();
      String newWidth = (String)columnWidths.get(folderId);

      // Only accept widths that are either percentages or integers (fixed widths)
      boolean widthIsValid = true;
      try
      {
        Integer.parseInt(newWidth.endsWith("%") ? newWidth.substring(0, newWidth.indexOf("%")) : newWidth);
      }
      catch (java.lang.NumberFormatException nfe)
      {
        widthIsValid = false;
      }

      if (widthIsValid)
      {
        ssup.setFolderAttributeValue(folderId, "width", newWidth);
        Element folder = ulm.getUserLayoutDOM().getElementById( folderId );
        UserPrefsHandler.setUserPreference( folder, "width",
                                            staticData.getPerson() );
      }
      else
        if (log.isDebugEnabled())
            log.debug("User id " + staticData.getPerson().getID() + " entered invalid column width: " + newWidth);
       
    }

    // Persist structure stylesheet user preferences
    saveUserPreferences();
    saveLayout(false);
   
    // now push the focused node value back into new rendering prefs object.
    ssup.putParameterValue( "userLayoutRoot", focusedNode );
   
    if ( activeTab != null )
        ssup.putParameterValue( "activeTab", activeTab );
    }
View Full Code Here

Examples of org.jasig.portal.StructureStylesheetUserPreferences

          sstr.setParameter("activeTab", activeTab);
          sstr.setParameter("action", action);
          sstr.setParameter("elementID", elementID != null ? elementID : "none");
          sstr.setParameter("errorMessage", errorMessage);

          StructureStylesheetUserPreferences ssup = userPrefs.getStructureStylesheetUserPreferences();
          StructureAttributesIncorporationFilter saif = new StructureAttributesIncorporationFilter(th, ssup);

          // Put a duplicating filter before th
          StringWriter sw = null;
          OutputFormat outputFormat = null;
View Full Code Here

Examples of org.jasig.portal.StructureStylesheetUserPreferences

          sstr.setParameter("activeTab", activeTab);
          sstr.setParameter("action", action);
          sstr.setParameter("elementID", elementID != null ? elementID : "none");
          sstr.setParameter("errorMessage", errorMessage);

          StructureStylesheetUserPreferences ssup = userPrefs.getStructureStylesheetUserPreferences();
          StructureAttributesIncorporationFilter saif = new StructureAttributesIncorporationFilter(th, ssup);

          // Put a duplicating filter before th
          StringWriter sw = null;
          OutputFormat outputFormat = null;
View Full Code Here

Examples of org.jasig.portal.StructureStylesheetUserPreferences

    return activeTab;
  }

  private final void setActiveTab(String activeTab) throws Exception
  {
    StructureStylesheetUserPreferences ssup = userPrefs.getStructureStylesheetUserPreferences();
    ssup.putParameterValue("activeTab", activeTab);

    // Persist structure stylesheet user preferences
    int profileId = editedUserProfile.getProfileId();
    ulStore.setStructureStylesheetUserPreferences(staticData.getPerson(), profileId, ssup);
  }
View Full Code Here

Examples of org.jasig.portal.StructureStylesheetUserPreferences

      }
  }

  private final void changeColumnWidths(HashMap columnWidths) throws Exception
  {
    StructureStylesheetUserPreferences ssup = userPrefs.getStructureStylesheetUserPreferences();
    java.util.Set sColWidths = columnWidths.keySet();
    java.util.Iterator iterator = sColWidths.iterator();
    while(iterator.hasNext())
    {
      String folderId = (String)iterator.next();
      String newWidth = (String)columnWidths.get(folderId);

      // Only accept widths that are either percentages or integers (fixed widths)
      boolean widthIsValid = true;
      try
      {
        Integer.parseInt(newWidth.endsWith("%") ? newWidth.substring(0, newWidth.indexOf("%")) : newWidth);
      }
      catch (java.lang.NumberFormatException nfe)
      {
        widthIsValid = false;
      }

      if (widthIsValid)
        ssup.setFolderAttributeValue(folderId, "width", newWidth);
      else
        if (log.isDebugEnabled())
            log.debug("User id " + staticData.getPerson().getID() + " entered invalid column width: " + newWidth);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.