org.sakaiproject.tool.preferences
Class UserPrefsTool

java.lang.Object
  extended byorg.sakaiproject.tool.preferences.UserPrefsTool

public class UserPrefsTool
extends Object

UserPrefsTool is a Sakai Admin tool to view and edit anyone's preferences.

Version:
$Id: UserPrefsTool.java 4847 2005-12-20 22:23:36Z bkirschn@umich.edu $
Author:
Himansu Tripathy

Nested Class Summary
 class UserPrefsTool.KeyNameValue
          Represents a name value pair in a keyed preferences set.
 
Field Summary
protected static String EXCLUDE_SITE_LISTS
           
protected  boolean isNewUser
           
protected  boolean locUpdated
           
protected  PreferencesEdit m_edit
          The PreferencesEdit being worked on.
protected  PreferencesService m_preferencesService
          Preferences service (injected dependency)
protected  String m_refreshElement
          The html "peer" element to refresh on the next rendering.
protected  SessionManager m_sessionManager
          Session manager (injected dependency)
protected  Collection m_stuff
          The PreferencesEdit in KeyNameValue collection form.
protected  boolean notiUpdated
           
protected static String ORDER_SITE_LISTS
           
protected  boolean refreshUpdated
           
protected  boolean tabUpdated
           
protected  boolean tzUpdated
           
 
Constructor Summary
UserPrefsTool()
          no-arg constructor.
 
Method Summary
protected  String buildTypePrefsContext(String type, String prefix, String context, Preferences prefs)
          Add the two context references for defaults for this type.
protected  void cancelEdit()
          Cancel the edit and cleanup.
 boolean getLocUpdated()
           
 String getMsgNotiAnn1()
           
 String getMsgNotiAnn2()
           
 String getMsgNotiAnn3()
           
 String getMsgNotiMail1()
           
 String getMsgNotiMail2()
           
 String getMsgNotiMail3()
           
 String getMsgNotiRsrc1()
           
 String getMsgNotiRsrc2()
           
 String getMsgNotiRsrc3()
           
 String getMsgNotiSyll1()
           
 String getMsgNotiSyll2()
           
 boolean getNotiUpdated()
           
 List getPrefExcludeItems()
           
 List getPrefLocales()
           
 List getPrefOrderItems()
           
 List getPrefTimeZones()
           
 String getRefreshElement()
          Get, and clear, the refresh element
 String getSelectedAnnItem()
           
 String[] getSelectedExcludeItems()
           
 String getSelectedLocaleName()
           
 String getSelectedLocaleString()
           
 String getSelectedMailItem()
           
 String[] getSelectedOrderItems()
           
 String getSelectedRefreshItem()
           
 String getSelectedRsrcItem()
           
 String getSelectedSyllItem()
           
 String getSelectedTimeZone()
           
protected  String getStringPref(String pref_base, String type, Preferences prefs)
          Retrieve a preference
 boolean getTzUpdated()
           
 String getUserId()
           
protected  boolean hasValue(String eval)
          Check String has value, not null
protected  int indexOf(String value, List siteList)
          Find the site in the list that has this id - return the position
 boolean isTabUpdated()
           
protected  void loadNotiData()
          Load saved notification data - this is called from cancel button of notification page as navigation stays in the page
protected  void loadRefreshData()
          Load refresh data from stored information.
 String processActionAdd()
          Process the add command from the edit view.
 String processActionAddAll()
          Process Add All action
 String processActionCancel()
          Process the cancel command from the edit view.
 String processActionEdit()
          Process the edit command.
 String processActionLocCancel()
          process locale cancel
 String processActionLocFrmEdit()
          Process the cancel command from the edit view.
 String processActionLocSave()
          Process the save command from the edit view.
 String processActionMoveDown()
          Move down the selected item in Ordered List
 String processActionMoveUp()
          Move Up the selected item in Ordered List
 String processActionNotiCancel()
          process notification cancel
 String processActionNotiFrmEdit()
          Process the cancel command from the edit view.
 String processActionNotiFrmRefresh()
          Process cancel and navigate to list page.
 String processActionNotiSave()
          Process the save command from the edit view.
 String processActionRefreshCancel()
          Process cancel and navigate to list page.
 String processActionRefreshFrmEdit()
          This is called from edit page for navigation to refresh page
 String processActionRefreshFrmNoti()
          This is called from notification page for navigation to Refresh page
 String processActionRefreshSave()
          process saving of refresh
 String processActionRemove()
          Process remove from order list command
 String processActionRemoveAll()
          Process Remove All command
 String processActionSave()
          Process the save command from the edit view.
 String processActionTzCancel()
          process timezone cancel
 String processActionTZFrmEdit()
          Process the cancel command from the edit view.
 String processActionTzSave()
          Process the save command from the edit view.
protected  void readTypePrefs(String type, String prefix, PreferencesEdit edit, String data)
          Read the two context references for defaults for this type from the form.
protected  void saveEdit()
          Save any changed values from the edit and cleanup.
 void setLocUpdated(boolean locUpdated)
           
 void setNotiUpdated(boolean notiUpdated)
           
 void setPreferencesService(PreferencesService mgr)
           
 void setPrefExcludeItems(List prefExcludeItems)
           
 void setPrefLocales(List prefLocales)
           
 void setPrefOrderItems(List prefOrderItems)
           
 void setPrefTimeZones(List prefTimeZones)
           
 void setRefreshElement(String element)
          Set the "peer" html element to refresh on the next rendering.
 void setSelectedAnnItem(String selectedAnnItem)
           
 void setSelectedExcludeItems(String[] selectedExcludeItems)
           
 void setSelectedLocaleString(String selectedLocale)
           
 void setSelectedMailItem(String selectedMailItem)
           
 void setSelectedOrderItems(String[] selectedOrderItems)
           
 void setSelectedRefreshItem(String selectedRefreshItem)
           
 void setSelectedRsrcItem(String selectedRsrcItem)
           
 void setSelectedSyllItem(String selectedSyllItem)
           
 void setSelectedTimeZone(String selectedTimeZone)
           
 void setSessionManager(SessionManager mgr)
           
protected  void setStringPref(String pref_base, String type, PreferencesEdit edit, String newval)
          Set an integer preference.
 void setTabUpdated(boolean tabUpdated)
           
 void setTzUpdated(boolean tzUpdated)
           
protected  void setUserEditingOn()
          Set editing mode on for user and add user if not existing
 void setUserId(String userId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_edit

protected PreferencesEdit m_edit
The PreferencesEdit being worked on.


m_preferencesService

protected PreferencesService m_preferencesService
Preferences service (injected dependency)


m_sessionManager

protected SessionManager m_sessionManager
Session manager (injected dependency)


m_stuff

protected Collection m_stuff
The PreferencesEdit in KeyNameValue collection form.


EXCLUDE_SITE_LISTS

protected static final String EXCLUDE_SITE_LISTS
See Also:
Constant Field Values

ORDER_SITE_LISTS

protected static final String ORDER_SITE_LISTS
See Also:
Constant Field Values

isNewUser

protected boolean isNewUser

tabUpdated

protected boolean tabUpdated

notiUpdated

protected boolean notiUpdated

tzUpdated

protected boolean tzUpdated

locUpdated

protected boolean locUpdated

refreshUpdated

protected boolean refreshUpdated

m_refreshElement

protected String m_refreshElement
The html "peer" element to refresh on the next rendering.

Constructor Detail

UserPrefsTool

public UserPrefsTool()
no-arg constructor.

Method Detail

getMsgNotiAnn1

public String getMsgNotiAnn1()
Returns:
Returns the ResourceLoader value. Note: workaround for element, which doesn't like using the map variable

getMsgNotiAnn2

public String getMsgNotiAnn2()

getMsgNotiAnn3

public String getMsgNotiAnn3()

getMsgNotiMail1

public String getMsgNotiMail1()

getMsgNotiMail2

public String getMsgNotiMail2()

getMsgNotiMail3

public String getMsgNotiMail3()

getMsgNotiRsrc1

public String getMsgNotiRsrc1()

getMsgNotiRsrc2

public String getMsgNotiRsrc2()

getMsgNotiRsrc3

public String getMsgNotiRsrc3()

getMsgNotiSyll1

public String getMsgNotiSyll1()

getMsgNotiSyll2

public String getMsgNotiSyll2()

getPrefExcludeItems

public List getPrefExcludeItems()
Returns:
Returns the prefExcludeItems.

setPrefExcludeItems

public void setPrefExcludeItems(List prefExcludeItems)
Parameters:
prefExcludeItems - The prefExcludeItems to set.

getPrefOrderItems

public List getPrefOrderItems()
Returns:
Returns the prefOrderItems.

setPrefOrderItems

public void setPrefOrderItems(List prefOrderItems)
Parameters:
prefOrderItems - The prefOrderItems to set.

getPrefTimeZones

public List getPrefTimeZones()
Returns:
Returns the prefTimeZones.

setPrefTimeZones

public void setPrefTimeZones(List prefTimeZones)
Parameters:
prefTimeZones - The prefTimeZones to set.

getPrefLocales

public List getPrefLocales()
Returns:
Returns the prefLocales

setPrefLocales

public void setPrefLocales(List prefLocales)
Parameters:
prefLocales - The prefLocales to set.

getSelectedExcludeItems

public String[] getSelectedExcludeItems()
Returns:
Returns the selectedExcludeItems.

setSelectedExcludeItems

public void setSelectedExcludeItems(String[] selectedExcludeItems)
Parameters:
selectedExcludeItems - The selectedExcludeItems to set.

getSelectedOrderItems

public String[] getSelectedOrderItems()
Returns:
Returns the selectedOrderItems.

setSelectedOrderItems

public void setSelectedOrderItems(String[] selectedOrderItems)
Parameters:
selectedOrderItems - The selectedOrderItems to set.

getSelectedTimeZone

public String getSelectedTimeZone()
Returns:
Returns the user's selected TimeZone ID

setSelectedTimeZone

public void setSelectedTimeZone(String selectedTimeZone)
Parameters:
selectedTimeZone - The selectedTimeZone to set.

getSelectedLocaleName

public String getSelectedLocaleName()
Returns:
Returns the user's selected Locale ID

getSelectedLocaleString

public String getSelectedLocaleString()
Returns:
Returns the user's selected Locale ID

setSelectedLocaleString

public void setSelectedLocaleString(String selectedLocale)
Parameters:
selectedLocale - The selectedLocale to set.

getUserId

public String getUserId()
Returns:
Returns the userId.

setUserId

public void setUserId(String userId)
Parameters:
userId - The userId to set.

setPreferencesService

public void setPreferencesService(PreferencesService mgr)
Parameters:
mgr - The preferences service.

setSessionManager

public void setSessionManager(SessionManager mgr)
Parameters:
mgr - The session manager.

isTabUpdated

public boolean isTabUpdated()
Returns:
Returns the tabUpdated.

setTabUpdated

public void setTabUpdated(boolean tabUpdated)
Parameters:
tabUpdated - The tabUpdated to set.

processActionAdd

public String processActionAdd()
Process the add command from the edit view.

Returns:
navigation outcome to tab customization page (edit)

processActionRemove

public String processActionRemove()
Process remove from order list command

Returns:
navigation output to tab customization page (edit)

processActionAddAll

public String processActionAddAll()
Process Add All action

Returns:
navigation output to tab customization page (edit)

processActionRemoveAll

public String processActionRemoveAll()
Process Remove All command

Returns:
navigation output to tab customization page (edit)

processActionMoveUp

public String processActionMoveUp()
Move Up the selected item in Ordered List

Returns:
navigation output to tab customization page (edit)

processActionMoveDown

public String processActionMoveDown()
Move down the selected item in Ordered List

Returns:
navigation output to tab customization page (edit)

processActionEdit

public String processActionEdit()
Process the edit command.

Returns:
navigation outcome to tab customization page (edit)

processActionSave

public String processActionSave()
Process the save command from the edit view.

Returns:
navigation outcome to tab customization page (edit)

processActionCancel

public String processActionCancel()
Process the cancel command from the edit view.

Returns:
navigation outcome to tab customization page (edit)

processActionNotiFrmEdit

public String processActionNotiFrmEdit()
Process the cancel command from the edit view.

Returns:
navigation outcome to Notification page (list)

processActionTZFrmEdit

public String processActionTZFrmEdit()
Process the cancel command from the edit view.

Returns:
navigation outcome to timezone page (list)

processActionLocFrmEdit

public String processActionLocFrmEdit()
Process the cancel command from the edit view.

Returns:
navigation outcome to locale page (list)

processActionRefreshFrmEdit

public String processActionRefreshFrmEdit()
This is called from edit page for navigation to refresh page

Returns:
navigation outcome to refresh page (refresh)

cancelEdit

protected void cancelEdit()
Cancel the edit and cleanup.


setUserEditingOn

protected void setUserEditingOn()
Set editing mode on for user and add user if not existing


saveEdit

protected void saveEdit()
Save any changed values from the edit and cleanup.


hasValue

protected boolean hasValue(String eval)
Check String has value, not null

Returns:
boolean

indexOf

protected int indexOf(String value,
                      List siteList)
Find the site in the list that has this id - return the position. *

Parameters:
value - The site id to find.
siteList - The list of Site objects.
Returns:
The index position in siteList of the site with site id = value, or -1 if not found.

getSelectedAnnItem

public String getSelectedAnnItem()
Returns:
Returns the selectedAnnItem.

setSelectedAnnItem

public void setSelectedAnnItem(String selectedAnnItem)
Parameters:
selectedAnnItem - The selectedAnnItem to set.

getSelectedMailItem

public String getSelectedMailItem()
Returns:
Returns the selectedMailItem.

setSelectedMailItem

public void setSelectedMailItem(String selectedMailItem)
Parameters:
selectedMailItem - The selectedMailItem to set.

getSelectedRsrcItem

public String getSelectedRsrcItem()
Returns:
Returns the selectedRsrcItem.

setSelectedRsrcItem

public void setSelectedRsrcItem(String selectedRsrcItem)
Parameters:
selectedRsrcItem - The selectedRsrcItem to set.

getSelectedSyllItem

public String getSelectedSyllItem()

setSelectedSyllItem

public void setSelectedSyllItem(String selectedSyllItem)

getNotiUpdated

public boolean getNotiUpdated()
Returns:
Returns the notiUpdated.

setNotiUpdated

public void setNotiUpdated(boolean notiUpdated)
Parameters:
notiUpdated - The notiUpdated to set.

getTzUpdated

public boolean getTzUpdated()
Returns:
Returns the tzUpdated.

setTzUpdated

public void setTzUpdated(boolean tzUpdated)

getLocUpdated

public boolean getLocUpdated()
Returns:
Returns the tzUpdated.

setLocUpdated

public void setLocUpdated(boolean locUpdated)

processActionNotiSave

public String processActionNotiSave()
Process the save command from the edit view.

Returns:
navigation outcome to notification page

processActionNotiCancel

public String processActionNotiCancel()
process notification cancel

Returns:
navigation outcome to notification page

processActionTzSave

public String processActionTzSave()
Process the save command from the edit view.

Returns:
navigation outcome to timezone page

processActionTzCancel

public String processActionTzCancel()
process timezone cancel

Returns:
navigation outcome to timezone page

processActionLocSave

public String processActionLocSave()
Process the save command from the edit view.

Returns:
navigation outcome to locale page

processActionLocCancel

public String processActionLocCancel()
process locale cancel

Returns:
navigation outcome to locale page

processActionRefreshFrmNoti

public String processActionRefreshFrmNoti()
This is called from notification page for navigation to Refresh page

Returns:
navigation outcome to refresh page

loadNotiData

protected void loadNotiData()
Load saved notification data - this is called from cancel button of notification page as navigation stays in the page


readTypePrefs

protected void readTypePrefs(String type,
                             String prefix,
                             PreferencesEdit edit,
                             String data)
Read the two context references for defaults for this type from the form.

Parameters:
type - The resource type (i.e. a service name).
prefix - The prefix for context references.
edit - The preferences being edited.
data - The rundata with the form fields.

buildTypePrefsContext

protected String buildTypePrefsContext(String type,
                                       String prefix,
                                       String context,
                                       Preferences prefs)
Add the two context references for defaults for this type.

Parameters:
type - The resource type (i.e. a service name).
prefix - The prefix for context references.
context - The context.
prefs - The full set of preferences.

getSelectedRefreshItem

public String getSelectedRefreshItem()
Returns:
Returns the selectedRefreshItem.

setSelectedRefreshItem

public void setSelectedRefreshItem(String selectedRefreshItem)
Parameters:
selectedRefreshItem - The selectedRefreshItem to set.

processActionRefreshSave

public String processActionRefreshSave()
process saving of refresh

Returns:
navigation outcome to refresh page

processActionRefreshCancel

public String processActionRefreshCancel()
Process cancel and navigate to list page.

Returns:
navigation outcome to refresh page

processActionNotiFrmRefresh

public String processActionNotiFrmRefresh()
Process cancel and navigate to list page.

Returns:
navigation outcome to notification page

loadRefreshData

protected void loadRefreshData()
Load refresh data from stored information. This is called when navigated into this page for first time.


setStringPref

protected void setStringPref(String pref_base,
                             String type,
                             PreferencesEdit edit,
                             String newval)
Set an integer preference.

Parameters:
type - The particular property
edit - An edit version of the full set of preferences for the current logged in user.
newval - The string to be the new preference.

getStringPref

protected String getStringPref(String pref_base,
                               String type,
                               Preferences prefs)
Retrieve a preference

Parameters:
type - The particular property
prefs - The full set of preferences for the current logged in user.

getRefreshElement

public String getRefreshElement()
Get, and clear, the refresh element

Returns:
The html "peer" element to refresh on the next rendering, or null if none defined.

setRefreshElement

public void setRefreshElement(String element)
Set the "peer" html element to refresh on the next rendering.

Parameters:
element -