/*
 * $Id$
 * $URL$
 */

package org.subethamail.web.action;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.subethamail.core.admin.i.ConfigData;
import org.subethamail.entity.Config;
import org.subethamail.web.Backend;
import org.subethamail.web.action.auth.AuthAction;
import org.subethamail.web.model.ErrorMapModel;
import org.tagonist.propertize.Property;

/**
 * Configures settings specific to the site.
 * 
 * @author Jon Stevens
 */
public class GetSiteSettings extends AuthAction
{
	/** */
	private static Log log = LogFactory.getLog(GetSiteSettings.class);

	public static class Model extends ErrorMapModel
	{
		/** */
		@Property List<ConfigData> configData;
		@Property String siteUrl;
	}

	public void initialize()
	{
		this.getCtx().setModel(new Model());
	}

	/** */
	public void execute() throws Exception
	{
		Model model = (Model)this.getCtx().getModel();
		
		model.configData = Backend.instance().getAdmin().getSiteConfig();
		
		for (ConfigData cd : model.configData)
		{
			if (cd.getId().equals(Config.ConfigKey.ID_SITE_URL.getKey()))
			{
				model.siteUrl = cd.getValue().toString();
				break;
			}
		}
	}
}

@@ -228,47 +228,8 @@
 a;%0D%0A
-import org.subethamail.entity.Config;%0D%0A
 impo
@@ -1076,67 +1076,79 @@
 %0A%09%09%09
-if (cd.getId().equals(Config.ConfigKey.ID_SITE_URL.getKey()
+// FIXME: get key string correctly.%0D%0A%09%09%09if (cd.getId().equals(%22siteUrl%22
 ))%0D%0A

fix broken build. damn that separation of code!