diff --git a/api/src/Etemplate.php b/api/src/Etemplate.php index c365fc4397..5aee92ca42 100644 --- a/api/src/Etemplate.php +++ b/api/src/Etemplate.php @@ -164,7 +164,7 @@ class Etemplate extends Etemplate\Widget\Template if (empty($this->name)) throw new Exception\AssertionFailed("Template name is not set '$this->name' !"); // instanciate template to fill self::$request->sel_options for select-* widgets // not sure if we want to handle it this way, thought otherwise we will have a few ajax request for each dialog fetching predefined selectboxes - $template = self::instance($this->name, $this->template_set, $this->version, $this->laod_via); + $template = self::instance($this->name, $this->template_set, $this->version, $this->load_via); if (!$template) throw new Exception\AssertionFailed("Template $this->name not instanciable! Maybe you forgot to rename template id."); $this->children = array($template); $template->run('beforeSendToClient', array('', array('cont'=>$content))); @@ -504,7 +504,7 @@ class Etemplate extends Etemplate\Widget\Template public $name; public $template_set; public $version; - public $laod_via; + public $load_via; /** * @@ -536,7 +536,7 @@ class Etemplate extends Etemplate\Widget\Template unset($lang); unset($group); // not used, but in old signature $this->rel_path = self::relPath($this->name=$name, $this->template_set=$template_set, - $this->version=$version, $this->laod_via = $load_via); + $this->version=$version, $this->load_via = $load_via); //error_log(__METHOD__."('$name', '$template_set', '$lang', $group, '$version', '$load_via') rel_path=".array2string($this->rel_path)); $this->dom_id = isset($_GET['fw_target']) ? $name.'-'.$_GET['fw_target'] : $name; diff --git a/api/src/Etemplate/Widget/Select.php b/api/src/Etemplate/Widget/Select.php index 713a5d21e2..84817c9aa5 100644 --- a/api/src/Etemplate/Widget/Select.php +++ b/api/src/Etemplate/Widget/Select.php @@ -729,19 +729,22 @@ class Select extends Etemplate\Widget MCAL_M_WEEKEND => 'weekend', ); } - $value_in = $value; - $value = array(); - foreach(array_keys($options) as $val) + if (!is_array($value)) { - if (($value_in & $val) == $val) + $value_in = $value; + $value = array(); + foreach (array_keys($options) as $val) { - $value[] = $val; - - if ($val == MCAL_M_ALLDAYS || - $val == MCAL_M_WEEKDAYS && $value_in == MCAL_M_WEEKDAYS || - $val == MCAL_M_WEEKEND && $value_in == MCAL_M_WEEKEND) + if (($value_in & $val) == $val) { - break; // dont set the others + $value[] = $val; + + if ($val == MCAL_M_ALLDAYS || + $val == MCAL_M_WEEKDAYS && $value_in == MCAL_M_WEEKDAYS || + $val == MCAL_M_WEEKEND && $value_in == MCAL_M_WEEKEND) + { + break; // dont set the others + } } } } diff --git a/api/src/Etemplate/Widget/Template.php b/api/src/Etemplate/Widget/Template.php index 35bb014510..5b9c30435f 100644 --- a/api/src/Etemplate/Widget/Template.php +++ b/api/src/Etemplate/Widget/Template.php @@ -66,7 +66,7 @@ class Template extends Etemplate\Widget //$start = microtime(true); list($name) = explode('?', $_name); // remove optional cache-buster - if (isset(self::$cache[$name]) || !($path = self::relPath($name, $template_set, $version))) + if (isset(self::$cache[$name]) || !($path = self::relPath($name, $template_set, $version, $load_via))) { if ((!$path || self::read($load_via, $template_set)) && isset(self::$cache[$name])) { @@ -139,13 +139,14 @@ class Template extends Etemplate\Widget * @param string $name * @param string $template_set =null default try template-set from user and if not found "default" * @param string $version ='' + * @param string $load_via ='' * @return string path of template xml file or null if not found */ - public static function relPath($name, $template_set=null, $version='') + public static function relPath($name, $template_set=null, $version='', $load_via='') { static $prefixes = null; unset($version); // not used currently - list($app, $rest) = explode('.', $name, 2); + list($app, $rest) = explode('.', $load_via ?: $name, 2); if (empty($template_set)) {