1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11: class Ansel_Ajax_Imple_ToggleOtherGalleries extends Horde_Core_Ajax_Imple
12: {
13: public function attach()
14: {
15:
16: Horde::addScriptFile('togglewidget.js');
17:
18: $url = $this->_getUrl('ToggleOtherGalleries', 'ansel', array('post' => 'value', 'sessionWrite' => true));
19: $js = array();
20: $js[] = "Ansel.widgets['otherGalleries'] = {'bindTo': '" . $this->_params['bindTo'] . "', 'url': '" . $url . "'}";
21: $js[] = "Event.observe(Ansel.widgets.otherGalleries.bindTo + '-toggle', 'click', function(event) {doActionToggle('" . $this->_params['bindTo'] . "', 'otherGalleries'); Event.stop(event)});";
22:
23: Horde::addInlineScript($js, 'dom');
24: }
25:
26: public function handle($args, $post)
27: {
28: if (!isset($post['value'])) {
29: return 0;
30: }
31:
32: $GLOBALS['prefs']->setValue('show_othergalleries', $post['value']);
33:
34: return $GLOBALS['prefs']->getValue('show_othergalleries');
35: }
36:
37: }
38: