<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/module_plugins/block.mod_select.php</filename>
    </added>
    <added>
      <filename>lib/module_plugins/function.mod_options.php</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -449,7 +449,7 @@ class CmsSmarty extends Smarty {
 		return true;
 	}
 	
-	function module_get_template ($tpl_name, &amp;$tpl_source, &amp;$smarty_obj)
+	function module_get_template($tpl_name, &amp;$tpl_source, &amp;$smarty_obj)
 	{
 		global $gCms;
 		$pageinfo =&amp; $gCms-&gt;variables['pageinfo'];
@@ -468,7 +468,8 @@ class CmsSmarty extends Smarty {
 			{
 				$action = $params['action'];
 			}
-			echo $gCms-&gt;modules[$tpl_name]['object']-&gt;DoActionBase($action, $id, $params, isset($pageinfo)?$pageinfo-&gt;content_id:'');
+			$request = $gCms-&gt;modules[$tpl_name]['object']-&gt;create_request_instance($id, isset($pageinfo)?$pageinfo-&gt;content_id:'');
+			echo $request-&gt;do_action_base($action, $params);
 			$modoutput = @ob_get_contents();
 			@ob_end_clean();
 </diff>
      <filename>lib/classes/class.cms_smarty.php</filename>
    </modified>
    <modified>
      <diff>@@ -437,7 +437,8 @@ abstract class CmsModuleBase extends CmsObject
 					{
 						@ob_start();
 
-						$result = $cmsmodules[$modulename]['object']-&gt;do_action_base($action, $id, $params, $returnid);
+						$request = $cmsmodules[$modulename]['object']-&gt;create_request_instance($id, $returnid);
+						$result = $request-&gt;do_action_base($action, $params);
 						if ($result !== FALSE)
 						{
 							echo $result;
@@ -983,24 +984,6 @@ abstract class CmsModuleBase extends CmsObject
 	}
 
 	/**
-	 * Returns the xhtml equivalent of a multi-select list.	 This is basically a nice little wrapper
-	 * to make sure that id's are placed in names and also that it is xhtml compliant.
-	 *
-	 * @param string The id given to the module on execution
-	 * @param string The html name of the select list
-	 * @param string An array of items to put into the list... they should be $key=&gt;$value pairs
-	 * @param string An array of items in the list that should default to selected.
-	 * @param string The number of rows to be visible in the list (before scrolling).
-	 * @param string Any additional text that should be added into the tag when rendered
-	 * @param boolean indicates wether multiple selections are allowed (defaults to true)
-	 */
-	public function create_input_select_list($id, $name, $items, $selecteditems=array(), $size=3, $addttext='', $multiple = true, $html_id = '')
-	{
-		$this-&gt;load_form_methods();
-		return cms_module_CreateInputSelectList($this, $id, $name, $items, $selecteditems, $size, $addttext, $multiple, $html_id);
-	}
-
-	/**
 	 * Returns the xhtml equivalent of a set of radio buttons.	This is basically a nice little wrapper
 	 * to make sure that id's are placed in names and also that it is xhtml compliant.
 	 *</diff>
      <filename>lib/classes/module/class.cms_module_base.php</filename>
    </modified>
    <modified>
      <diff>@@ -602,17 +602,14 @@ class CmsModuleRequest extends CmsObject
 	}
 	
 	/**
-	 * Returns the xhtml equivalent of a dropdown input.  This is basically a nice little wrapper
+	 * Returns the xhtml equivalent of the opening of a select input.  This is basically a nice little wrapper
 	 * to make sure that id's are placed in names and also that it's xhtml compliant.
 	 * Parameters:
 	 * 'name' - The name of the field.  Defaults to 'input'.
-	 * 'items' - An associative array of key/values to represent the value and text of the items in the list.  This can also be
-	 *           passed a string in the form of 'key,value,key,value'.  Defaults to array().
-	 * 'selected_value' - A string that will set the matching item (by value) as selected.  Defaults = ''.
-	 * 'selected_index' - An integer that will set the matching item (by index) as selected.  Defaults to -1 (no selection).
 	 * 'extra' - Text to append to the &lt;input&gt;-statement, ex. for javascript-validation code.  Defaults to ''.
 	 * 'html_id' - Id to use for the html id=&quot;&quot;.  Defaults to an autogenerated value.
-	 * 'flip_items' - Boolean that tells whether or not the value and text of the given items should be swapped.  Defaults to false.
+	 * 'multiple' - Boolean of whether or not this is should show multiple items.  Defaults to false.
+	 * 'size' - Number of items to show if multiple is set to true.  Defaults to 3.
 	 * 'params' - An array of key/value pairs to add as attributes to the input tag.  These will merge into any
 	 *      additional parameters you pass along in to the $params hash that aren't parsed by the function.
 	 *
@@ -623,15 +620,13 @@ class CmsModuleRequest extends CmsObject
 	 * @return string
 	 * @author Ted Kulp
 	 */
-	public function create_input_dropdown($params = array(), $check_keys = false)
+	public function create_input_select($params = array(), $check_keys = false)
 	{
 		$default_params = array(
 			'name' =&gt; $this-&gt;id . coalesce_key($params, 'name', 'input', FILTER_SANITIZE_STRING),
-			'items' =&gt; coalesce_key($params, 'items', array()),
-			'selected_value' =&gt; coalesce_key($params, 'selected_value', '', FILTER_SANITIZE_STRING),
-			'selected_index' =&gt; coalesce_key($params, 'selected_index', -1, FILTER_SANITIZE_NUMBER_INT),
 			'extra' =&gt; coalesce_key($params, 'extra', ''),
-			'flip_items' =&gt; coalesce_key($params, 'flip_items', false, FILTER_VALIDATE_BOOLEAN),
+			'multiple' =&gt; coalesce_key($params, 'multiple', false, FILTER_VALIDATE_BOOLEAN),
+			'size' =&gt; coalesce_key($params, 'size', 3, FILTER_SANITIZE_NUMBER_INT),
 			'params' =&gt; coalesce_key($params, 'params', array())
 		);
 		$default_params['id'] = coalesce_key($params,
@@ -647,8 +642,66 @@ class CmsModuleRequest extends CmsObject
 		$params = array_merge($default_params, $this-&gt;strip_extra_params($params, $default_params, 'params'));
 		unset($params['params']);
 		
+		if ($params['multiple'])
+		{
+			$params['multiple'] = 'multiple';
+		}
+		else
+		{
+			unset($params['multiple']);
+			unset($params['size']);
+		}
+		
+		$extra = '';
+		if ($params['extra'])
+		{
+			$extra = $params['extra'];
+		}
+		unset($params['extra']);
+		
+		return $this-&gt;create_start_tag('select', $params, false, $extra);
+	}
+	
+	/**
+	 * Returns the xhtml equivalent of options tags.  This is basically a nice little wrapper
+	 * to make sure that id's are placed in names and also that it's xhtml compliant.
+	 * Parameters:
+	 * 'items' - An associative array of key/values to represent the value and text of the items in the list.  This can also be
+	 *           passed a string in the form of 'key,value,key,value'.  Defaults to array().
+	 * 'selected_value' - A string that will set the matching item (by value) as selected.  Defaults = ''.
+	 * 'selected_index' - An integer that will set the matching item (by index) as selected.  Defaults to -1 (no selection).
+	 * 'selected_values' - An array of strings that will set the matching item as selected.  This is for multiple select items.
+	 * 'extra' - Text to append to the &lt;input&gt;-statement, ex. for javascript-validation code.  Defaults to ''.
+	 * 'flip_items' - Boolean that tells whether or not the value and text of the given items should be swapped.  Defaults to false.
+	 *
+	 * @param array An array of parameters to pass to the method.  Unrecognized parameters will be added as attributes to the 
+	 *        tag and merged correctly with anything in the 'params' key if passed.
+	 * @param boolean Test whether keys are all valid or not.  Not helpful if you're 
+	 *        passing extra key/values along, but good for debugging.
+	 * @return string
+	 * @author Ted Kulp
+	 */
+	public function create_input_options($params = array(), $check_keys = false)
+	{
+		$default_params = array(
+			'items' =&gt; coalesce_key($params, 'items', array()),
+			'selected_value' =&gt; coalesce_key($params, 'selected_value', '', FILTER_SANITIZE_STRING),
+			'selected_index' =&gt; coalesce_key($params, 'selected_index', -1, FILTER_SANITIZE_NUMBER_INT),
+			'selected_values' =&gt; coalesce_key($params, 'selected_value', array()),
+			'flip_items' =&gt; coalesce_key($params, 'flip_items', false, FILTER_VALIDATE_BOOLEAN),
+			'params' =&gt; coalesce_key($params, 'params', array())
+		);
+		
+		if ($check_keys &amp;&amp; !are_all_keys_valid($params, $default_params))
+			throw new CmsInvalidKeyException(invalid_key($params, $default_params));
+
+		//Combine EVERYTHING together into a big managerie
+		$params = array_merge($default_params, $this-&gt;strip_extra_params($params, $default_params, 'params'));
+		unset($params['params']);
+		
 		$selected_index = $params['selected_index']; unset($params['selected_index']);
 		$selected_value = $params['selected_value']; unset($params['selected_value']);
+		$selected_values = $params['selected_values']; unset($params['selected_values']);
 		
 		$items = $params['items'];
 		unset($params['items']);
@@ -667,20 +720,13 @@ class CmsModuleRequest extends CmsObject
 			$items = array_flip($items);
 		unset($params['flip_items']);
 		
-		$extra = '';
-		if ($params['extra'])
-		{
-			$extra = $params['extra'];
-		}
-		unset($params['extra']);
-		
-		$text = $this-&gt;create_start_tag('select', $params, false, $extra);
+		$text = '';
 		
 		$count = 0;
 		foreach ($items as $k=&gt;$v)
 		{
 			$hash = array('value' =&gt; $k);
-			if ($count == $selected_index || $k == $selected_value)
+			if ($count == $selected_index || $k == $selected_value || in_array($k, $selected_values))
 			{
 				$hash['selected'] = 'selected';
 			}
@@ -688,8 +734,6 @@ class CmsModuleRequest extends CmsObject
 			$count++;
 		}
 		
-		$text .= $this-&gt;create_end_tag('select');
-		
 		return $text;
 	}
 }</diff>
      <filename>lib/classes/module/class.cms_module_request.php</filename>
    </modified>
    <modified>
      <diff>@@ -20,7 +20,7 @@ function smarty_cms_function_mod_dropdown($params, &amp;$smarty)
 {
 	$request =&amp; $smarty-&gt;get_template_vars('request');
 
-	return $request-&gt;create_input_dropdown($params);
+	return $request-&gt;create_input_select($params) . $request-&gt;create_input_options($params) . $request-&gt;create_end_tag('select');
 }
 
 ?&gt;</diff>
      <filename>lib/module_plugins/function.mod_dropdown.php</filename>
    </modified>
    <modified>
      <diff>@@ -18,11 +18,12 @@
 
 function smarty_cms_function_mod_password($params, &amp;$smarty)
 {
-	$module =&amp; $smarty-&gt;get_template_vars('cms_mapi_module');
-	$id = $smarty-&gt;get_template_vars('cms_mapi_id');
-	#$return_id = $smarty-&gt;get_template_vars('cms_mapi_return_id');
+	$request =&amp; $smarty-&gt;get_template_vars('request');
 
-	return $module-&gt;create_input_password($id, $params['name'], coalesce_key($params, 'value', ''), coalesce_key($params, 'size', '10'), coalesce_key($params, 'maxlength', '255'), coalesce_key($params, 'addttext', ''), coalesce_key($params, 'id', ''));
+	if (!isset($params['password']))
+		$params['password'] = true;
+
+	return $request-&gt;create_input_text($params);
 }
 
 ?&gt;</diff>
      <filename>lib/module_plugins/function.mod_password.php</filename>
    </modified>
    <modified>
      <diff>@@ -114,7 +114,8 @@ function smarty_cms_function_content($params, &amp;$smarty)
 							{
 								$returnid = $pageinfo-&gt;content_id;
 							}
-							$result = $cmsmodules[$modulename]['object']-&gt;do_action_base($action, $id, $params, $returnid);
+							$request = $gCms-&gt;modules[$modulename]['object']-&gt;create_request_instance($id, $returnid);
+							echo $request-&gt;do_action_base($action, $params);
 							if ($result !== FALSE)
 							{
 								echo $result;</diff>
      <filename>plugins/function.content.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d6aecd81aa793efd729fa1a94dae04818bcb0a25</id>
    </parent>
  </parents>
  <author>
    <name>wishy</name>
    <email>wishy@3d254a34-79dc-0310-9e5f-be208747d8a0</email>
  </author>
  <url>http://github.com/tedkulp/cmsmadesimple-2-0/commit/45da30f7eff5ea96770a5cbf8eab2dee648c957f</url>
  <id>45da30f7eff5ea96770a5cbf8eab2dee648c957f</id>
  <committed-date>2008-12-14T10:32:56-08:00</committed-date>
  <authored-date>2008-12-14T10:32:56-08:00</authored-date>
  <message>Move more form methods to the new format in CmsModuleRequest
Move dropdown to 2 separate methods (select and options) to allow for more flexibility
Hack dropdown to work, but call it depreated
Get the rest of the module api entry points to generate the request object

git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@5348 3d254a34-79dc-0310-9e5f-be208747d8a0</message>
  <tree>64f0bf32cad235dad1e8b5447df35b0a721c0767</tree>
  <committer>
    <name>wishy</name>
    <email>wishy@3d254a34-79dc-0310-9e5f-be208747d8a0</email>
  </committer>
</commit>
