Package org.jasig.portal

Examples of org.jasig.portal.UserProfile


        Document layout = null;

        try
        {
            // fix hard coded 1 later for multiple profiles
            UserProfile profile = dls.getUserProfileByFname(owner, "default");
           
            // see if we have structure & theme stylesheets for this user yet.
            // If not then fall back on system's selected stylesheets.
            if (profile.getStructureStylesheetId() == 0 ||
                    profile.getThemeStylesheetId() == 0)
                profile = dls.getSystemProfileByFname(profile.getProfileFname());
           
            view.profileId = profile.getProfileId();
            view.profileFname = profile.getProfileFname();
            view.layoutId = profile.getLayoutId();
            view.structureStylesheetId = profile.getStructureStylesheetId();
            view.themeStylesheetId = profile.getThemeStylesheetId();
           
            layout = dls.getFragmentLayout( owner, profile );
            Element root = layout.getDocumentElement();
            root.setAttribute( Constants.ATT_ID,
                    Constants.FRAGMENT_ID_USER_PREFIX + view.getUserId() +
View Full Code Here


            if (person.isGuest()) {
                return;
            }
           
            //Try invalidating just the layout associated with the current user and profile
            final UserProfile currentUserProfile = (UserProfile)person.getAttribute(UserProfile.USER_PROFILE);
            if (currentUserProfile != null) {
                this.removeCachedLayout(person, currentUserProfile);
                return;
            }
           
View Full Code Here

    StructureStylesheetUserPreferences ssup = upm.getUserPreferences()
        .getStructureStylesheetUserPreferences();

    try {
            String currentTab = ssup.getParameterValue(ACTIVE_TAB_PARAM);
            UserProfile currentProfile = upm.getUserPreferences().getProfile();
            int profileID = currentProfile.getProfileId();
            int structID = currentProfile.getStructureStylesheetId();
            // get the active tab number from the store so that we can preserve it
            String defaultTab = ulStore.getStructureStylesheetUserPreferences(per, profileID, structID).getParameterValue(ACTIVE_TAB_PARAM);
            // set the active tab to previously recorded value
            if (defaultTab.equals(currentTab)) {
                ssup.putParameterValue(ACTIVE_TAB_PARAM, tabPosition);
View Full Code Here

    // set the new width for each column to be equal
    int width = 100 / count;
    String widthString = width + "%";

    StructureStylesheetUserPreferences ssup = upm.getUserPreferences().getStructureStylesheetUserPreferences();
        UserProfile currentProfile = upm.getUserPreferences().getProfile();
    columns = ulm.getChildIds(tabId);
    String currentTab = ssup.getParameterValue( ACTIVE_TAB_PARAM );
    try {
      while (columns.hasMoreElements()) {
        String columnId = (String) columns.nextElement();
View Full Code Here

    printSuccess(response, "Saved new tab name", null);

  }

  private String getDefaultTab(UserPreferencesManager upm, IPerson per) throws Exception {
      UserProfile currentProfile = upm.getUserPreferences().getProfile();
      int profileID = currentProfile.getProfileId();
      int structID = currentProfile.getStructureStylesheetId();
      String defaultTab = ulStore.getStructureStylesheetUserPreferences(per, profileID, structID)
                                .getParameterValue( ACTIVE_TAB_PARAM );
      return defaultTab;
  }
View Full Code Here

    Element edEl = doc.createElement("profiles");
    doc.appendChild(edEl);
    // fill out system-defined profiles
    Element sEl = doc.createElement("system");
    for (Enumeration spe = this.getSystemProfileList().elements(); spe.hasMoreElements();) {
      UserProfile p = (UserProfile)spe.nextElement();
      Element pEl = doc.createElement("profile");
      pEl.setAttribute("id", Integer.toString(p.getProfileId()));
      pEl.setAttribute("name", p.getProfileName());
      Element dEl = doc.createElement("description");
      dEl.appendChild(doc.createTextNode(p.getProfileDescription()));
      pEl.appendChild(dEl);
      sEl.appendChild(pEl);
    }
    edEl.appendChild(sEl);
View Full Code Here

        //Processing that only applies to authenticated users
        if (!person.isGuest()) {
            // Request to change the locale
            final String localesString = request.getParameter(Constants.LOCALES_PARAM);
            if (localesString != null) {
                final UserProfile profile = userPreferences.getProfile();
                final LocaleManager localeManager = profile.getLocaleManager();

                final Locale[] locales = LocaleManager.parseLocales(localesString);
                localeManager.setSessionLocales(locales);
            }
           
View Full Code Here

                    userProfileList = systemProfileList = null;
                    epstate.setRuntimeData(rd);
                    internalState = epstate;
                } else if (action.equals("copy")) {
                    // retrieve a profile from the database
                    UserProfile p=null;
                    if(systemProfile) {
                        p=(UserProfile)systemProfileList.get(new Integer(profileId));
                    } else {
                        p=(UserProfile)userProfileList.get(new Integer(profileId));
                    }
                   
                    if(p!=null) {
                        // create a new layout
                        try {
                          p=this.getUserLayoutStore().addUserProfile(context.getUserPreferencesManager().getPerson(),p);
                        } catch (Exception e) {
                          throw new PortalException(e);
                        }
                        // reset user profile listing
                        userProfileList=null;
                    }
                } else if (action.equals("delete")) {
                    // delete a profile
                    if (systemProfile) {
                        // need to check permissions here
                        // context.getUserPreferencesStore().deleteSystemProfile(Integer.parseInt(profileId));
                        // systemProfileList=null;
                    } else {
                      try {
                        this.getUserLayoutStore().deleteUserProfile(context.getUserPreferencesManager().getPerson(), Integer.parseInt(profileId));
                      } catch (Exception e) {
                        throw new PortalException(e);
                      }

                      userProfileList = null;
                    }
                } else if (action.equals("map")) {
                  try {
                    this.getUserLayoutStore().setUserBrowserMapping(context.getUserPreferencesManager().getPerson(), this.runtimeData.getBrowserInfo().getUserAgent(), Integer.parseInt(profileId));
                  } catch (Exception e) {
                    throw new PortalException(e);
                  }
                  // let userPreferencesManager know that the current profile has changed : everything must be reloaded
                } else if (action.equals("changeView")) {
                    String view=runtimeData.getParameter("view");
                    boolean expand=false;
                    if(view.equals("expanded")) expand=true;
                    if(systemProfile) {
                        systemExpandStates.put(profileId,new Boolean(expand));
                    } else {
                        userExpandStates.put(profileId,new Boolean(expand));
                    }
                }
            }

            if(action.equals("newProfile")) {
                // get a copy of a current layout to copy the values from
                UserProfile cp=context.getCurrentUserPreferences().getProfile();
                if(cp!=null) {
                    // create a new profile
                  // TODO: need to generate distinct profile fname?
                    UserProfile p=new UserProfile(-1,"newProfile","new profile","please edit the profile",cp.getLayoutId(),cp.getStructureStylesheetId(),cp.getThemeStylesheetId());
                    try {
                      p=this.getUserLayoutStore().addUserProfile(context.getUserPreferencesManager().getPerson(),p);
                    } catch (Exception e) {
                      throw new PortalException(e);
                    }

                    // reset user profile listing
                    userProfileList=null;
                }
            } else if(action.equals("condenseAll")) {
                String profileType = runtimeData.getParameter("profileType");
                if (profileType != null && profileType.equals("system")) {
                    // system profiles
                    systemExpandStates.clear();
                } else {
                    // user profiles
                    userExpandStates.clear();
                }
            } else if(action.equals("expandAll")) {
                String profileType = runtimeData.getParameter("profileType");
                if (profileType != null && profileType.equals("system")) {
                    // system profiles
                    systemExpandStates.clear();
                    Boolean expState=new Boolean(true);
                    for (Enumeration upe = this.getSystemProfileList().elements(); upe.hasMoreElements();) {
                        UserProfile p = (UserProfile)upe.nextElement();
                        systemExpandStates.put(Integer.toString(p.getProfileId()),expState);
                    }
                } else {
                    // user profiles
                    userExpandStates.clear();
                    Boolean expState=new Boolean(true);
                    for (Enumeration upe = this.getUserProfileList().elements(); upe.hasMoreElements();) {
                        UserProfile p = (UserProfile)upe.nextElement();
                        userExpandStates.put(Integer.toString(p.getProfileId()),expState);
                    }
                }
            }
        }
        if (internalState != null)
View Full Code Here

          // fill out user-defined profiles
          Element uEl = doc.createElement("user");
          Hashtable upList=this.getUserProfileList();

          for(Enumeration upe = this.getUserProfileList().elements(); upe.hasMoreElements();) {
              UserProfile p = (UserProfile)upe.nextElement();
              Element pEl = doc.createElement("profile");
              Boolean expState=(Boolean) userExpandStates.get(Integer.toString(p.getProfileId()));
              if(expState!=null && expState.booleanValue()) {
                  pEl.setAttribute("view","expanded");
              } else {
                  pEl.setAttribute("view","condensed");
              }
              pEl.setAttribute("id", Integer.toString(p.getProfileId()));
              pEl.setAttribute("name", p.getProfileName());
              Element dEl = doc.createElement("description");
              dEl.appendChild(doc.createTextNode(p.getProfileDescription()));
              pEl.appendChild(dEl);
              uEl.appendChild(pEl);
          }
          edEl.appendChild(uEl);
      }
      // fill out system-defined profiles
      Element sEl = doc.createElement("system");
      for (Enumeration spe = this.getSystemProfileList().elements(); spe.hasMoreElements();) {
        UserProfile p = (UserProfile)spe.nextElement();
        Element pEl = doc.createElement("profile");

        Boolean expState=(Boolean)systemExpandStates.get(Integer.toString(p.getProfileId()));
        if(expState!=null && expState.booleanValue()) {
            pEl.setAttribute("view","expanded");
        } else {
            pEl.setAttribute("view","condensed");
        }
        pEl.setAttribute("id", Integer.toString(p.getProfileId()));
        pEl.setAttribute("name", p.getProfileName());
        Element dEl = doc.createElement("description");
        dEl.appendChild(doc.createTextNode(p.getProfileDescription()));
        pEl.appendChild(dEl);
        sEl.appendChild(pEl);
      }
      edEl.appendChild(sEl);
      /*  try {
       log.debug(org.jasig.portal.utils.XML.serializeNode(doc));
       } catch (Exception e) {
       log.error(e, e);
       }
       */
      // debug printout of the document sent to the XSLT
      /*
      StringWriter dbwr1 = new StringWriter();
      org.apache.xml.serialize.OutputFormat outputFormat = new org.apache.xml.serialize.OutputFormat();
      outputFormat.setIndenting(true);
      org.apache.xml.serialize.XMLSerializer dbser1 = new org.apache.xml.serialize.XMLSerializer(dbwr1, outputFormat);
      try {
          dbser1.serialize(doc);
      log.debug("ManageProfilesState::renderXML() : XML incoming to the XSLT :\n\n" + dbwr1.toString() + "\n\n");
      } catch (Exception e) {
          log.debug("ManageProfilesState::renderXML() : problems serializing incoming XML");
      }
      */

      // find the stylesheet and transform
      StylesheetSet set = context.getStylesheetSet();
      if (set == null)
        throw  new GeneralRenderingException("Unable to determine the stylesheet list");

      String xslURI = set.getStylesheetURI("profileList", runtimeData.getBrowserInfo());
      UserProfile currentProfile = context.getCurrentUserPreferences().getProfile();
      Hashtable params = new Hashtable();

      params.put("allowNewProfile",new Boolean(ALLOW_NEW_PROFILE_BUTTON));
      params.put("allowSystemProfileMapping",new Boolean(ALLOW_SYSTEM_BROWSER_MAPPING));


      params.put("baseActionURL", runtimeData.getBaseActionURL());
      params.put("profileId", Integer.toString(currentProfile.getProfileId()));
      if (currentProfile.isSystemProfile()) {
          params.put("profileType", "system");
      } else {
          params.put("profileType", "user");
      }

View Full Code Here

                    userProfileList = systemProfileList = null;
                    epstate.setRuntimeData(rd);
                    internalState = epstate;
                } else if (action.equals("copy")) {
                    // retrieve a profile from the database
                    UserProfile p=null;
                    if(systemProfile) {
                        p=(UserProfile)systemProfileList.get(new Integer(profileId));
                    } else {
                        p=(UserProfile)userProfileList.get(new Integer(profileId));
                    }
                   
                    if(p!=null) {
                        // create a new layout
                        try {
                          p=this.getUserLayoutStore().addUserProfile(context.getUserPreferencesManager().getPerson(),p);
                        } catch (Exception e) {
                          throw new PortalException(e);
                        }
                        // reset user profile listing
                        userProfileList=null;
                    }
                } else if (action.equals("delete")) {
                    // delete a profile
                    if (systemProfile) {
                        // need to check permissions here
                        //      context.getUserPreferencesStore().deleteSystemProfile(Integer.parseInt(profileId));
                        //      systemProfileList=null;
                    } else {
                      try {
                        this.getUserLayoutStore().deleteUserProfile(context.getUserPreferencesManager().getPerson(), Integer.parseInt(profileId));
                      } catch (Exception e) {
                        throw new PortalException(e);
                      }

                      userProfileList = null;
                    }
                } else if (action.equals("map")) {
                  try {
                    this.getUserLayoutStore().setUserBrowserMapping(context.getUserPreferencesManager().getPerson(), this.runtimeData.getBrowserInfo().getUserAgent(), Integer.parseInt(profileId));
                  } catch (Exception e) {
                    throw new PortalException(e);
                  }
                  // let userPreferencesManager know that the current profile has changed : everything must be reloaded
                } else if (action.equals("changeView")) {
                    String view=runtimeData.getParameter("view");
                    boolean expand=false;
                    if(view.equals("expanded")) expand=true;
                    if(systemProfile) {
                        systemExpandStates.put(profileId,new Boolean(expand));
                    } else {
                        userExpandStates.put(profileId,new Boolean(expand));
                    }
                }
            }

            if(action.equals("newProfile")) {
                // get a copy of a current layout to copy the values from
                UserProfile cp=context.getCurrentUserPreferences().getProfile();
                if(cp!=null) {
                    // create a new profile
                  // TODO: randomly generate profile fname?
                    UserProfile p=new UserProfile(0,"newProfile","new profile","please edit the profile",cp.getLayoutId(),cp.getStructureStylesheetId(),cp.getThemeStylesheetId());
                    try {
                      p=this.getUserLayoutStore().addUserProfile(context.getUserPreferencesManager().getPerson(),p);
                    } catch (Exception e) {
                      throw new PortalException(e);
                    }

                    // reset user profile listing
                    userProfileList=null;
                }
            } else if(action.equals("condenseAll")) {
                String profileType = runtimeData.getParameter("profileType");
                if (profileType != null && profileType.equals("system")) {
                    // system profiles
                    systemExpandStates.clear();
                } else {
                    // user profiles
                    userExpandStates.clear();
                }
            } else if(action.equals("expandAll")) {
                String profileType = runtimeData.getParameter("profileType");
                if (profileType != null && profileType.equals("system")) {
                    // system profiles
                    systemExpandStates.clear();
                    Boolean expState=new Boolean(true);
                    for (Enumeration upe = this.getSystemProfileList().elements(); upe.hasMoreElements();) {
                        UserProfile p = (UserProfile)upe.nextElement();
                        systemExpandStates.put(Integer.toString(p.getProfileId()),expState);
                    }
                } else {
                    // user profiles
                    userExpandStates.clear();
                    Boolean expState=new Boolean(true);
                    for (Enumeration upe = this.getUserProfileList().elements(); upe.hasMoreElements();) {
                        UserProfile p = (UserProfile)upe.nextElement();
                        userExpandStates.put(Integer.toString(p.getProfileId()),expState);
                    }
                }
            }
        }
        if (internalState != null)
View Full Code Here

TOP

Related Classes of org.jasig.portal.UserProfile

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.