@@ -9,15 +9,15 @@ |
||
| 9 | 9 | |
| 10 | 10 | function smartobject_plugin_smartpartner() |
| 11 | 11 | { |
| 12 | - $pluginInfo = array(); |
|
| 12 | + $pluginInfo = array(); |
|
| 13 | 13 | |
| 14 | - $pluginInfo['items']['partner']['caption'] = 'Partner'; |
|
| 15 | - $pluginInfo['items']['partner']['url'] = 'partner.php?partnerid=%u'; |
|
| 16 | - $pluginInfo['items']['partner']['request'] = 'partnerid'; |
|
| 14 | + $pluginInfo['items']['partner']['caption'] = 'Partner'; |
|
| 15 | + $pluginInfo['items']['partner']['url'] = 'partner.php?partnerid=%u'; |
|
| 16 | + $pluginInfo['items']['partner']['request'] = 'partnerid'; |
|
| 17 | 17 | |
| 18 | - $pluginInfo['items']['category']['caption'] = 'Category'; |
|
| 19 | - $pluginInfo['items']['category']['url'] = 'index.php?view_category_id=%u'; |
|
| 20 | - $pluginInfo['items']['category']['request'] = 'view_category_id'; |
|
| 18 | + $pluginInfo['items']['category']['caption'] = 'Category'; |
|
| 19 | + $pluginInfo['items']['category']['url'] = 'index.php?view_category_id=%u'; |
|
| 20 | + $pluginInfo['items']['category']['request'] = 'view_category_id'; |
|
| 21 | 21 | |
| 22 | - return $pluginInfo; |
|
| 22 | + return $pluginInfo; |
|
| 23 | 23 | } |
@@ -9,15 +9,15 @@ |
||
| 9 | 9 | |
| 10 | 10 | function smartobject_plugin_smartsection() |
| 11 | 11 | { |
| 12 | - $pluginInfo = array(); |
|
| 12 | + $pluginInfo = array(); |
|
| 13 | 13 | |
| 14 | - $pluginInfo['items']['item']['caption'] = 'Article'; |
|
| 15 | - $pluginInfo['items']['item']['url'] = 'item.php?itemid=%u'; |
|
| 16 | - $pluginInfo['items']['item']['request'] = 'itemid'; |
|
| 14 | + $pluginInfo['items']['item']['caption'] = 'Article'; |
|
| 15 | + $pluginInfo['items']['item']['url'] = 'item.php?itemid=%u'; |
|
| 16 | + $pluginInfo['items']['item']['request'] = 'itemid'; |
|
| 17 | 17 | |
| 18 | - $pluginInfo['items']['category']['caption'] = 'Category'; |
|
| 19 | - $pluginInfo['items']['category']['url'] = 'category.php?categoryid=%u'; |
|
| 20 | - $pluginInfo['items']['category']['request'] = 'categoryid'; |
|
| 18 | + $pluginInfo['items']['category']['caption'] = 'Category'; |
|
| 19 | + $pluginInfo['items']['category']['url'] = 'category.php?categoryid=%u'; |
|
| 20 | + $pluginInfo['items']['category']['request'] = 'categoryid'; |
|
| 21 | 21 | |
| 22 | - return $pluginInfo; |
|
| 22 | + return $pluginInfo; |
|
| 23 | 23 | } |
@@ -9,12 +9,12 @@ |
||
| 9 | 9 | |
| 10 | 10 | function smartobject_plugin_xcgal() |
| 11 | 11 | { |
| 12 | - global $xoopsConfig; |
|
| 12 | + global $xoopsConfig; |
|
| 13 | 13 | |
| 14 | - $pluginInfo = array(); |
|
| 15 | - $pluginInfo['items']['album']['caption'] = 'Album'; |
|
| 16 | - $pluginInfo['items']['item']['url'] = 'thumbnails.php?album=%u'; |
|
| 17 | - $pluginInfo['items']['item']['request'] = 'album'; |
|
| 14 | + $pluginInfo = array(); |
|
| 15 | + $pluginInfo['items']['album']['caption'] = 'Album'; |
|
| 16 | + $pluginInfo['items']['item']['url'] = 'thumbnails.php?album=%u'; |
|
| 17 | + $pluginInfo['items']['item']['request'] = 'album'; |
|
| 18 | 18 | |
| 19 | - return $pluginInfo; |
|
| 19 | + return $pluginInfo; |
|
| 20 | 20 | } |
@@ -9,15 +9,15 @@ |
||
| 9 | 9 | |
| 10 | 10 | function smartobject_plugin_smartshop() |
| 11 | 11 | { |
| 12 | - $pluginInfo = array(); |
|
| 12 | + $pluginInfo = array(); |
|
| 13 | 13 | |
| 14 | - $pluginInfo['items']['item']['caption'] = 'Item'; |
|
| 15 | - $pluginInfo['items']['item']['url'] = 'item.php?itemid=%u'; |
|
| 16 | - $pluginInfo['items']['item']['request'] = 'itemid'; |
|
| 14 | + $pluginInfo['items']['item']['caption'] = 'Item'; |
|
| 15 | + $pluginInfo['items']['item']['url'] = 'item.php?itemid=%u'; |
|
| 16 | + $pluginInfo['items']['item']['request'] = 'itemid'; |
|
| 17 | 17 | |
| 18 | - $pluginInfo['items']['category']['caption'] = 'Category'; |
|
| 19 | - $pluginInfo['items']['category']['url'] = 'category.php?categoryid=%u'; |
|
| 20 | - $pluginInfo['items']['category']['request'] = 'categoryid'; |
|
| 18 | + $pluginInfo['items']['category']['caption'] = 'Category'; |
|
| 19 | + $pluginInfo['items']['category']['url'] = 'category.php?categoryid=%u'; |
|
| 20 | + $pluginInfo['items']['category']['request'] = 'categoryid'; |
|
| 21 | 21 | |
| 22 | - return $pluginInfo; |
|
| 22 | + return $pluginInfo; |
|
| 23 | 23 | } |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | |
| 10 | 10 | function smartobject_plugin_smartband() |
| 11 | 11 | { |
| 12 | - global $xoopsConfig; |
|
| 13 | - include_once(XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php'); |
|
| 12 | + global $xoopsConfig; |
|
| 13 | + include_once(XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php'); |
|
| 14 | 14 | |
| 15 | - $pluginInfo = array(); |
|
| 16 | - $pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP; |
|
| 17 | - $pluginInfo['items']['item']['url'] = 'item.php?itemid=%u'; |
|
| 18 | - $pluginInfo['items']['item']['request'] = 'itemid'; |
|
| 15 | + $pluginInfo = array(); |
|
| 16 | + $pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP; |
|
| 17 | + $pluginInfo['items']['item']['url'] = 'item.php?itemid=%u'; |
|
| 18 | + $pluginInfo['items']['item']['request'] = 'itemid'; |
|
| 19 | 19 | |
| 20 | - $pluginInfo['items']['category']['caption'] = _MD_ARTALBUM_CATEGORY; |
|
| 21 | - $pluginInfo['items']['category']['url'] = 'category.php?categoryid=%u'; |
|
| 22 | - $pluginInfo['items']['category']['request'] = 'categoryid'; |
|
| 20 | + $pluginInfo['items']['category']['caption'] = _MD_ARTALBUM_CATEGORY; |
|
| 21 | + $pluginInfo['items']['category']['url'] = 'category.php?categoryid=%u'; |
|
| 22 | + $pluginInfo['items']['category']['request'] = 'categoryid'; |
|
| 23 | 23 | |
| 24 | - return $pluginInfo; |
|
| 24 | + return $pluginInfo; |
|
| 25 | 25 | } |
@@ -2,5 +2,5 @@ |
||
| 2 | 2 | |
| 3 | 3 | function smarthook_footer_start() |
| 4 | 4 | { |
| 5 | - // code... |
|
| 5 | + // code... |
|
| 6 | 6 | } |
@@ -14,22 +14,22 @@ |
||
| 14 | 14 | * SmartObject library path |
| 15 | 15 | */ |
| 16 | 16 | if (!defined('SMARTOBJECT_URL')) { |
| 17 | - define('SMARTOBJECT_URL', XOOPS_URL . '/modules/smartobject/'); |
|
| 17 | + define('SMARTOBJECT_URL', XOOPS_URL . '/modules/smartobject/'); |
|
| 18 | 18 | } |
| 19 | 19 | if (!defined('SMARTOBJECT_ROOT_PATH')) { |
| 20 | - define('SMARTOBJECT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/smartobject/'); |
|
| 20 | + define('SMARTOBJECT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/smartobject/'); |
|
| 21 | 21 | } |
| 22 | 22 | if (!defined('SMARTOBJECT_IMAGES_URL')) { |
| 23 | - define('SMARTOBJECT_IMAGES_URL', SMARTOBJECT_URL . 'assets/images/'); |
|
| 23 | + define('SMARTOBJECT_IMAGES_URL', SMARTOBJECT_URL . 'assets/images/'); |
|
| 24 | 24 | } |
| 25 | 25 | if (!defined('SMARTOBJECT_IMAGES_ROOT_PATH')) { |
| 26 | - define('SMARTOBJECT_IMAGES_ROOT_PATH', SMARTOBJECT_ROOT_PATH . 'assets/images/'); |
|
| 26 | + define('SMARTOBJECT_IMAGES_ROOT_PATH', SMARTOBJECT_ROOT_PATH . 'assets/images/'); |
|
| 27 | 27 | } |
| 28 | 28 | if (!defined('SMARTOBJECT_IMAGES_ACTIONS_URL')) { |
| 29 | - define('SMARTOBJECT_IMAGES_ACTIONS_URL', SMARTOBJECT_URL . 'assets/images/actions/'); |
|
| 29 | + define('SMARTOBJECT_IMAGES_ACTIONS_URL', SMARTOBJECT_URL . 'assets/images/actions/'); |
|
| 30 | 30 | } |
| 31 | 31 | if (!defined('SMARTOBJECT_IMAGES_ACTIONS_ROOT_PATH')) { |
| 32 | - define('SMARTOBJECT_IMAGES_ACTIONS_ROOT_PATH', SMARTOBJECT_ROOT_PATH . 'assets/images/actions/'); |
|
| 32 | + define('SMARTOBJECT_IMAGES_ACTIONS_ROOT_PATH', SMARTOBJECT_ROOT_PATH . 'assets/images/actions/'); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -10,16 +10,16 @@ |
||
| 10 | 10 | |
| 11 | 11 | function smart_adsense_initiate_smartytags() |
| 12 | 12 | { |
| 13 | - global $xoopsTpl, $smartobjectAdsenseHandler; |
|
| 14 | - if (is_object($xoopsTpl)) { |
|
| 15 | - foreach ($smartobjectAdsenseHandler->objects as $k => $v) { |
|
| 16 | - $xoopsTpl->assign('adsense_' . $k, $v->render()); |
|
| 17 | - } |
|
| 18 | - } |
|
| 13 | + global $xoopsTpl, $smartobjectAdsenseHandler; |
|
| 14 | + if (is_object($xoopsTpl)) { |
|
| 15 | + foreach ($smartobjectAdsenseHandler->objects as $k => $v) { |
|
| 16 | + $xoopsTpl->assign('adsense_' . $k, $v->render()); |
|
| 17 | + } |
|
| 18 | + } |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | if (!defined('SMARTOBJECT_URL')) { |
| 22 | - include_once(XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'); |
|
| 22 | + include_once(XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | include_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
@@ -15,307 +15,307 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | class Scriptaculous extends Prototype |
| 17 | 17 | { |
| 18 | - public $TOGGLE_EFFECTS = array('toggle_appear', 'toggle_slide', 'toggle_blind'); |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Scriptaculous constructor. |
|
| 22 | - */ |
|
| 23 | - public function __construct() |
|
| 24 | - { |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * @param $element_id |
|
| 29 | - * @param null $options |
|
| 30 | - * @return string |
|
| 31 | - */ |
|
| 32 | - public function dragable_element($element_id, $options = null) |
|
| 33 | - { |
|
| 34 | - return $this->tag($this->_dragable_element_js($element_id, $options)); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @param $element_id |
|
| 39 | - * @param null $options |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - public function drop_receiving_element($element_id, $options = null) |
|
| 43 | - { |
|
| 44 | - return $this->tag($this->_drop_receiving_element($element_id, $options)); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @param $name |
|
| 49 | - * @param bool $element_id |
|
| 50 | - * @param null $js_options |
|
| 51 | - * @return string |
|
| 52 | - */ |
|
| 53 | - public function visual_effect($name, $element_id = false, $js_options = null) |
|
| 54 | - { |
|
| 55 | - $element = $element_id ? "'$element_id'" : 'element'; |
|
| 56 | - |
|
| 57 | - $js_queue = ''; |
|
| 58 | - if (isset($js_options) && is_array($js_options['queue'])) { |
|
| 59 | - } elseif (isset($js_options)) { |
|
| 60 | - $js_queue = "'$js_options'"; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - if (in_array($name, $this->TOGGLE_EFFECTS)) { |
|
| 64 | - return "Effect.toggle($element,'" . str_replace('toggle_', '', $name) . "'," . $this->_options_for_javascript($js_options) . ')'; |
|
| 65 | - } else { |
|
| 66 | - return 'new Effect.' . ucwords($name) . "($element," . $this->_options_for_javascript($js_options) . ')'; |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * @param $element_id |
|
| 72 | - * @param null $options |
|
| 73 | - * @return string |
|
| 74 | - */ |
|
| 75 | - public function sortabe_element($element_id, $options = null) |
|
| 76 | - { |
|
| 77 | - return $this->tag($this->_sortabe_element($element_id, $options)); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
| 81 | - // Private functions |
|
| 82 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @param $element_id |
|
| 86 | - * @param $options |
|
| 87 | - * @return string |
|
| 88 | - */ |
|
| 89 | - public function _sortabe_element($element_id, $options) |
|
| 90 | - { |
|
| 91 | - //if (isset($options['with'])) { |
|
| 92 | - $options['with'] = "Sortable.serialize('$element_id')"; |
|
| 93 | - // } |
|
| 94 | - |
|
| 95 | - //if (isset($option['onUpdate'])) { |
|
| 96 | - $options['onUpdate'] = 'function(){' . $this->remote_function($options) . '}'; |
|
| 97 | - //} |
|
| 98 | - |
|
| 99 | - foreach ($options as $var => $val) { |
|
| 100 | - if (in_array($var, $this->AJAX_OPTIONS)) { |
|
| 101 | - unset($options[$var]); |
|
| 102 | - } |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - $arr = array('tag', 'overlap', 'contraint', 'handle'); |
|
| 106 | - |
|
| 107 | - foreach ($arr as $var) { |
|
| 108 | - if (isset($options[$var])) { |
|
| 109 | - $options[$var] = "'" . $options[$var] . "'"; |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - if (isset($options['containment'])) { |
|
| 114 | - $options['containment'] = $this->_array_or_string_for_javascript($options['containment']); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - if (isset($options['only'])) { |
|
| 118 | - $options['only'] = $this->_array_or_string_for_javascript($options['only']); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - return "Sortable.create('$element_id'," . $this->_options_for_javascript($options) . ')'; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * @param $element_id |
|
| 126 | - * @param $options |
|
| 127 | - * @return string |
|
| 128 | - */ |
|
| 129 | - public function _dragable_element_js($element_id, $options) |
|
| 130 | - { |
|
| 131 | - return 'new Draggable(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * @param $element_id |
|
| 136 | - * @param $options |
|
| 137 | - * @return string |
|
| 138 | - */ |
|
| 139 | - public function _drop_receiving_element($element_id, $options) |
|
| 140 | - { |
|
| 141 | - |
|
| 142 | - //if (isset($options['with'])) { |
|
| 143 | - $options['with'] = '\'id=\' + encodeURIComponent(element.id)'; |
|
| 144 | - // } |
|
| 145 | - |
|
| 146 | - //if (isset($option['onDrop'])) |
|
| 147 | - |
|
| 148 | - { |
|
| 149 | - $options['onDrop'] = 'function(element){' . $this->remote_function($options) . '}'; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - if (is_array($options)) { |
|
| 153 | - foreach ($options as $var => $val) { |
|
| 154 | - if (in_array($var, $this->AJAX_OPTIONS)) { |
|
| 155 | - unset($options[$var]); |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - if (isset($options['accept'])) { |
|
| 161 | - $options['accept'] = $this->_array_or_string_for_javascript($options['accept']); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - if (isset($options['hoverclass'])) { |
|
| 165 | - $options['hoverclass'] = "'" . $options['hoverclass'] . "'"; |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - return 'Droppables.add(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
| 172 | - // Merged Javascript macro |
|
| 173 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * @param $field_id |
|
| 177 | - * @param $options |
|
| 178 | - * @param bool $tag |
|
| 179 | - * @return string |
|
| 180 | - */ |
|
| 181 | - public function in_place_editor($field_id, $options, $tag = true) |
|
| 182 | - { |
|
| 183 | - $function = 'new Ajax.InPlaceEditor('; |
|
| 184 | - $function .= "'$field_id', "; |
|
| 185 | - $function .= "'" . $options['url'] . "'"; |
|
| 186 | - |
|
| 187 | - $js_options = array(); |
|
| 188 | - if (isset($options['cancel_text'])) { |
|
| 189 | - $js_options['cancelText'] = $options['cancel_text']; |
|
| 190 | - } |
|
| 191 | - if (isset($options['save_text'])) { |
|
| 192 | - $js_options['okText'] = $options['save_text']; |
|
| 193 | - } |
|
| 194 | - if (isset($options['loading_text'])) { |
|
| 195 | - $js_options['loadingText'] = $options['loading_text']; |
|
| 196 | - } |
|
| 197 | - if (isset($options['rows'])) { |
|
| 198 | - $js_options['rows'] = $options['rows']; |
|
| 199 | - } |
|
| 200 | - if (isset($options['cols'])) { |
|
| 201 | - $js_options['cols'] = $options['cols']; |
|
| 202 | - } |
|
| 203 | - if (isset($options['size'])) { |
|
| 204 | - $js_options['size'] = $options['size']; |
|
| 205 | - } |
|
| 206 | - if (isset($options['external_control'])) { |
|
| 207 | - $js_options['externalControl'] = "'" . $options['external_control'] . "'"; |
|
| 208 | - } |
|
| 209 | - if (isset($options['load_text_url'])) { |
|
| 210 | - $js_options['loadTextURL'] = "'" . $options['load_text_url'] . "'"; |
|
| 211 | - } |
|
| 212 | - if (isset($options['options'])) { |
|
| 213 | - $js_options['ajaxOptions'] = $options['options']; |
|
| 214 | - } |
|
| 215 | - if (isset($options['script'])) { |
|
| 216 | - $js_options['evalScripts'] = $options['script']; |
|
| 217 | - } |
|
| 218 | - if (isset($options['with'])) { |
|
| 219 | - $js_options['callback'] = 'function(form) { return ' . $options['with'] . ' }'; |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
| 223 | - if ($tag) { |
|
| 224 | - return $this->tag($function); |
|
| 225 | - } else { |
|
| 226 | - return $function; |
|
| 227 | - } |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * @param $object |
|
| 232 | - * @param null $tag_options |
|
| 233 | - * @param null $in_place_editor_options |
|
| 234 | - * @return string |
|
| 235 | - */ |
|
| 236 | - public function in_place_editor_field($object, $tag_options = null, $in_place_editor_options = null) |
|
| 237 | - { |
|
| 238 | - $ret_val = ''; |
|
| 239 | - $ret_val .= '<span id="' . $object . '" class="in_place_editor_field">' . (isset($tag_options['value']) ? $tag_options['value'] : '') . '</span>'; |
|
| 240 | - $ret_val .= $this->in_place_editor($object, $in_place_editor_options); |
|
| 241 | - |
|
| 242 | - return $ret_val; |
|
| 243 | - } |
|
| 244 | - |
|
| 245 | - /** |
|
| 246 | - * @param $field_id |
|
| 247 | - * @param $options |
|
| 248 | - * @return mixed |
|
| 249 | - */ |
|
| 250 | - public function auto_complete_field($field_id, $options) |
|
| 251 | - { |
|
| 252 | - $function = "var $field_id" . '_auto_completer = new Ajax.Autocompleter('; |
|
| 253 | - $function .= "'$field_id', "; |
|
| 254 | - $function .= "'" . (isset($options['update']) ? $options['update'] : $field_id . '_auto_complete') . "', "; |
|
| 255 | - $function .= "'" . $options['url'] . "'"; |
|
| 256 | - |
|
| 257 | - $js_options = array(); |
|
| 258 | - if (isset($options['tokens'])) { |
|
| 259 | - $js_options['tokens'] = $this->javascript->_array_or_string_for_javascript($options['tokens']); |
|
| 260 | - } |
|
| 261 | - if (isset($options['with'])) { |
|
| 262 | - $js_options['callback'] = 'function(element, value) { return ' . $options['with'] . ' }'; |
|
| 263 | - } |
|
| 264 | - if (isset($options['indicator'])) { |
|
| 265 | - $js_options['indicator'] = "'" . $options['indicator'] . "'"; |
|
| 266 | - } |
|
| 267 | - if (isset($options['select'])) { |
|
| 268 | - $js_options['select'] = "'" . $options['select'] . "'"; |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - foreach (array('on_show' => 'onShow', 'on_hide' => 'onHide', 'min_chars' => 'min_chars') as $var => $val) { |
|
| 272 | - if (isset($options[$var])) { |
|
| 273 | - $js_options['$val'] = $options['var']; |
|
| 274 | - } |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
| 278 | - |
|
| 279 | - return $this->tag($function); |
|
| 280 | - } |
|
| 281 | - |
|
| 282 | - /** |
|
| 283 | - * @param $entries |
|
| 284 | - * @param $field |
|
| 285 | - * @param null $phrase |
|
| 286 | - */ |
|
| 287 | - public function auto_complete_results($entries, $field, $phrase = null) |
|
| 288 | - { |
|
| 289 | - if (!is_array($entries)) { |
|
| 290 | - return; |
|
| 291 | - } |
|
| 292 | - $ret_val = '<ul>'; |
|
| 293 | - // Complete this function |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - /** |
|
| 297 | - * @param $object |
|
| 298 | - * @param null $tag_options |
|
| 299 | - * @param null $completion_options |
|
| 300 | - * @return string |
|
| 301 | - */ |
|
| 302 | - public function text_field_with_auto_complete($object, $tag_options = null, $completion_options = null) |
|
| 303 | - { |
|
| 304 | - $ret_val = isset($completion_options['skip_style']) ? '' : $this->_auto_complete_stylesheet(); |
|
| 305 | - $ret_val .= '<input autocomplete="off" id="' . $object . '" name="' . $object . '" size="' . (isset($tag_options['size']) ? $tag_options['size'] : 30) . '" type="text" value="' . (isset($tag_options['size']) ? $tag_options['value'] : '') . '" ' . (isset($tag_options['class']) ? 'class = "' . $tag_options['class'] . '" ' : '') . '/>'; |
|
| 306 | - |
|
| 307 | - $ret_val .= '<div id="' . $object . '_auto_complete" class="auto_complete"></div>'; |
|
| 308 | - $ret_val .= $this->auto_complete_field($object, $completion_options); |
|
| 309 | - |
|
| 310 | - return $ret_val; |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * @return string |
|
| 315 | - */ |
|
| 316 | - public function _auto_complete_stylesheet() |
|
| 317 | - { |
|
| 318 | - return '<style> div.auto_complete { |
|
| 18 | + public $TOGGLE_EFFECTS = array('toggle_appear', 'toggle_slide', 'toggle_blind'); |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Scriptaculous constructor. |
|
| 22 | + */ |
|
| 23 | + public function __construct() |
|
| 24 | + { |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @param $element_id |
|
| 29 | + * @param null $options |
|
| 30 | + * @return string |
|
| 31 | + */ |
|
| 32 | + public function dragable_element($element_id, $options = null) |
|
| 33 | + { |
|
| 34 | + return $this->tag($this->_dragable_element_js($element_id, $options)); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @param $element_id |
|
| 39 | + * @param null $options |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + public function drop_receiving_element($element_id, $options = null) |
|
| 43 | + { |
|
| 44 | + return $this->tag($this->_drop_receiving_element($element_id, $options)); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @param $name |
|
| 49 | + * @param bool $element_id |
|
| 50 | + * @param null $js_options |
|
| 51 | + * @return string |
|
| 52 | + */ |
|
| 53 | + public function visual_effect($name, $element_id = false, $js_options = null) |
|
| 54 | + { |
|
| 55 | + $element = $element_id ? "'$element_id'" : 'element'; |
|
| 56 | + |
|
| 57 | + $js_queue = ''; |
|
| 58 | + if (isset($js_options) && is_array($js_options['queue'])) { |
|
| 59 | + } elseif (isset($js_options)) { |
|
| 60 | + $js_queue = "'$js_options'"; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + if (in_array($name, $this->TOGGLE_EFFECTS)) { |
|
| 64 | + return "Effect.toggle($element,'" . str_replace('toggle_', '', $name) . "'," . $this->_options_for_javascript($js_options) . ')'; |
|
| 65 | + } else { |
|
| 66 | + return 'new Effect.' . ucwords($name) . "($element," . $this->_options_for_javascript($js_options) . ')'; |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * @param $element_id |
|
| 72 | + * @param null $options |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 75 | + public function sortabe_element($element_id, $options = null) |
|
| 76 | + { |
|
| 77 | + return $this->tag($this->_sortabe_element($element_id, $options)); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
| 81 | + // Private functions |
|
| 82 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @param $element_id |
|
| 86 | + * @param $options |
|
| 87 | + * @return string |
|
| 88 | + */ |
|
| 89 | + public function _sortabe_element($element_id, $options) |
|
| 90 | + { |
|
| 91 | + //if (isset($options['with'])) { |
|
| 92 | + $options['with'] = "Sortable.serialize('$element_id')"; |
|
| 93 | + // } |
|
| 94 | + |
|
| 95 | + //if (isset($option['onUpdate'])) { |
|
| 96 | + $options['onUpdate'] = 'function(){' . $this->remote_function($options) . '}'; |
|
| 97 | + //} |
|
| 98 | + |
|
| 99 | + foreach ($options as $var => $val) { |
|
| 100 | + if (in_array($var, $this->AJAX_OPTIONS)) { |
|
| 101 | + unset($options[$var]); |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + $arr = array('tag', 'overlap', 'contraint', 'handle'); |
|
| 106 | + |
|
| 107 | + foreach ($arr as $var) { |
|
| 108 | + if (isset($options[$var])) { |
|
| 109 | + $options[$var] = "'" . $options[$var] . "'"; |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + if (isset($options['containment'])) { |
|
| 114 | + $options['containment'] = $this->_array_or_string_for_javascript($options['containment']); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + if (isset($options['only'])) { |
|
| 118 | + $options['only'] = $this->_array_or_string_for_javascript($options['only']); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + return "Sortable.create('$element_id'," . $this->_options_for_javascript($options) . ')'; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * @param $element_id |
|
| 126 | + * @param $options |
|
| 127 | + * @return string |
|
| 128 | + */ |
|
| 129 | + public function _dragable_element_js($element_id, $options) |
|
| 130 | + { |
|
| 131 | + return 'new Draggable(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * @param $element_id |
|
| 136 | + * @param $options |
|
| 137 | + * @return string |
|
| 138 | + */ |
|
| 139 | + public function _drop_receiving_element($element_id, $options) |
|
| 140 | + { |
|
| 141 | + |
|
| 142 | + //if (isset($options['with'])) { |
|
| 143 | + $options['with'] = '\'id=\' + encodeURIComponent(element.id)'; |
|
| 144 | + // } |
|
| 145 | + |
|
| 146 | + //if (isset($option['onDrop'])) |
|
| 147 | + |
|
| 148 | + { |
|
| 149 | + $options['onDrop'] = 'function(element){' . $this->remote_function($options) . '}'; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + if (is_array($options)) { |
|
| 153 | + foreach ($options as $var => $val) { |
|
| 154 | + if (in_array($var, $this->AJAX_OPTIONS)) { |
|
| 155 | + unset($options[$var]); |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + if (isset($options['accept'])) { |
|
| 161 | + $options['accept'] = $this->_array_or_string_for_javascript($options['accept']); |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + if (isset($options['hoverclass'])) { |
|
| 165 | + $options['hoverclass'] = "'" . $options['hoverclass'] . "'"; |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + return 'Droppables.add(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
| 172 | + // Merged Javascript macro |
|
| 173 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * @param $field_id |
|
| 177 | + * @param $options |
|
| 178 | + * @param bool $tag |
|
| 179 | + * @return string |
|
| 180 | + */ |
|
| 181 | + public function in_place_editor($field_id, $options, $tag = true) |
|
| 182 | + { |
|
| 183 | + $function = 'new Ajax.InPlaceEditor('; |
|
| 184 | + $function .= "'$field_id', "; |
|
| 185 | + $function .= "'" . $options['url'] . "'"; |
|
| 186 | + |
|
| 187 | + $js_options = array(); |
|
| 188 | + if (isset($options['cancel_text'])) { |
|
| 189 | + $js_options['cancelText'] = $options['cancel_text']; |
|
| 190 | + } |
|
| 191 | + if (isset($options['save_text'])) { |
|
| 192 | + $js_options['okText'] = $options['save_text']; |
|
| 193 | + } |
|
| 194 | + if (isset($options['loading_text'])) { |
|
| 195 | + $js_options['loadingText'] = $options['loading_text']; |
|
| 196 | + } |
|
| 197 | + if (isset($options['rows'])) { |
|
| 198 | + $js_options['rows'] = $options['rows']; |
|
| 199 | + } |
|
| 200 | + if (isset($options['cols'])) { |
|
| 201 | + $js_options['cols'] = $options['cols']; |
|
| 202 | + } |
|
| 203 | + if (isset($options['size'])) { |
|
| 204 | + $js_options['size'] = $options['size']; |
|
| 205 | + } |
|
| 206 | + if (isset($options['external_control'])) { |
|
| 207 | + $js_options['externalControl'] = "'" . $options['external_control'] . "'"; |
|
| 208 | + } |
|
| 209 | + if (isset($options['load_text_url'])) { |
|
| 210 | + $js_options['loadTextURL'] = "'" . $options['load_text_url'] . "'"; |
|
| 211 | + } |
|
| 212 | + if (isset($options['options'])) { |
|
| 213 | + $js_options['ajaxOptions'] = $options['options']; |
|
| 214 | + } |
|
| 215 | + if (isset($options['script'])) { |
|
| 216 | + $js_options['evalScripts'] = $options['script']; |
|
| 217 | + } |
|
| 218 | + if (isset($options['with'])) { |
|
| 219 | + $js_options['callback'] = 'function(form) { return ' . $options['with'] . ' }'; |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
| 223 | + if ($tag) { |
|
| 224 | + return $this->tag($function); |
|
| 225 | + } else { |
|
| 226 | + return $function; |
|
| 227 | + } |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * @param $object |
|
| 232 | + * @param null $tag_options |
|
| 233 | + * @param null $in_place_editor_options |
|
| 234 | + * @return string |
|
| 235 | + */ |
|
| 236 | + public function in_place_editor_field($object, $tag_options = null, $in_place_editor_options = null) |
|
| 237 | + { |
|
| 238 | + $ret_val = ''; |
|
| 239 | + $ret_val .= '<span id="' . $object . '" class="in_place_editor_field">' . (isset($tag_options['value']) ? $tag_options['value'] : '') . '</span>'; |
|
| 240 | + $ret_val .= $this->in_place_editor($object, $in_place_editor_options); |
|
| 241 | + |
|
| 242 | + return $ret_val; |
|
| 243 | + } |
|
| 244 | + |
|
| 245 | + /** |
|
| 246 | + * @param $field_id |
|
| 247 | + * @param $options |
|
| 248 | + * @return mixed |
|
| 249 | + */ |
|
| 250 | + public function auto_complete_field($field_id, $options) |
|
| 251 | + { |
|
| 252 | + $function = "var $field_id" . '_auto_completer = new Ajax.Autocompleter('; |
|
| 253 | + $function .= "'$field_id', "; |
|
| 254 | + $function .= "'" . (isset($options['update']) ? $options['update'] : $field_id . '_auto_complete') . "', "; |
|
| 255 | + $function .= "'" . $options['url'] . "'"; |
|
| 256 | + |
|
| 257 | + $js_options = array(); |
|
| 258 | + if (isset($options['tokens'])) { |
|
| 259 | + $js_options['tokens'] = $this->javascript->_array_or_string_for_javascript($options['tokens']); |
|
| 260 | + } |
|
| 261 | + if (isset($options['with'])) { |
|
| 262 | + $js_options['callback'] = 'function(element, value) { return ' . $options['with'] . ' }'; |
|
| 263 | + } |
|
| 264 | + if (isset($options['indicator'])) { |
|
| 265 | + $js_options['indicator'] = "'" . $options['indicator'] . "'"; |
|
| 266 | + } |
|
| 267 | + if (isset($options['select'])) { |
|
| 268 | + $js_options['select'] = "'" . $options['select'] . "'"; |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + foreach (array('on_show' => 'onShow', 'on_hide' => 'onHide', 'min_chars' => 'min_chars') as $var => $val) { |
|
| 272 | + if (isset($options[$var])) { |
|
| 273 | + $js_options['$val'] = $options['var']; |
|
| 274 | + } |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
| 278 | + |
|
| 279 | + return $this->tag($function); |
|
| 280 | + } |
|
| 281 | + |
|
| 282 | + /** |
|
| 283 | + * @param $entries |
|
| 284 | + * @param $field |
|
| 285 | + * @param null $phrase |
|
| 286 | + */ |
|
| 287 | + public function auto_complete_results($entries, $field, $phrase = null) |
|
| 288 | + { |
|
| 289 | + if (!is_array($entries)) { |
|
| 290 | + return; |
|
| 291 | + } |
|
| 292 | + $ret_val = '<ul>'; |
|
| 293 | + // Complete this function |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + /** |
|
| 297 | + * @param $object |
|
| 298 | + * @param null $tag_options |
|
| 299 | + * @param null $completion_options |
|
| 300 | + * @return string |
|
| 301 | + */ |
|
| 302 | + public function text_field_with_auto_complete($object, $tag_options = null, $completion_options = null) |
|
| 303 | + { |
|
| 304 | + $ret_val = isset($completion_options['skip_style']) ? '' : $this->_auto_complete_stylesheet(); |
|
| 305 | + $ret_val .= '<input autocomplete="off" id="' . $object . '" name="' . $object . '" size="' . (isset($tag_options['size']) ? $tag_options['size'] : 30) . '" type="text" value="' . (isset($tag_options['size']) ? $tag_options['value'] : '') . '" ' . (isset($tag_options['class']) ? 'class = "' . $tag_options['class'] . '" ' : '') . '/>'; |
|
| 306 | + |
|
| 307 | + $ret_val .= '<div id="' . $object . '_auto_complete" class="auto_complete"></div>'; |
|
| 308 | + $ret_val .= $this->auto_complete_field($object, $completion_options); |
|
| 309 | + |
|
| 310 | + return $ret_val; |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * @return string |
|
| 315 | + */ |
|
| 316 | + public function _auto_complete_stylesheet() |
|
| 317 | + { |
|
| 318 | + return '<style> div.auto_complete { |
|
| 319 | 319 | width: 350px; |
| 320 | 320 | background: #fff; |
| 321 | 321 | } |
@@ -339,5 +339,5 @@ discard block |
||
| 339 | 339 | padding:0; |
| 340 | 340 | } |
| 341 | 341 | </style>'; |
| 342 | - } |
|
| 342 | + } |
|
| 343 | 343 | } |