package org.sakaiproject.user.tool;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.sakaiproject.component.cover.ServerConfigurationService;
import org.sakaiproject.jsf.util.JsfTool;

public class PreferenceServlet extends JsfTool {

	@Override
	public void init(ServletConfig config) throws ServletException {
		// TODO Auto-generated method stub
		super.init(config);
		//UserPrefsTool tool = (UserPrefsTool) config.getServletContext().getAttribute("UserPrefsTool");
		m_default= defaultValue();
	}

	protected String defaultValue()
	{
		String defaultPreference="prefs_tab_title, prefs_noti_title, prefs_timezone_title, prefs_lang_title";
		String Notification="prefs_noti_title", CustomTab="prefs_tab_title", Timezone="prefs_timezone_title", Language="prefs_lang_title";
		String tabOrder=ServerConfigurationService.getString("preference.pages",defaultPreference);
		String[] tablist=tabOrder.split(",");
		String defaultPage=null;

		if(tablist[0].equals(Notification)) defaultPage="noti";
		else if(tablist[0].equals(CustomTab)) defaultPage="tab";
		else if(tablist[0].equals(Timezone)) defaultPage="timezone";
		else if (tablist[0].equals(Language)) defaultPage="locale";

		return defaultPage;
	}



}	

@@ -1189,17 +1189,153 @@
 tomTab))
- 
+%7B%09%09%09%0A%09%09%09if (ServerConfigurationService.getBoolean (%22portal.use.dhtml.more%22, false))%0A%09%09%09%09defaultPage = %22tab-dhtml-moresites%22;%0A%09%09%09else%0A%09%09%09%09
 defaultP
@@ -1345,16 +1345,20 @@
 =%22tab%22;%0A
+%09%09%7D%0A
 %09%09else i

Fix to SAK-14983: Incorrect initial view when My Active Sites is enabled