initJSVariables() public static method

Simple helper to output initial Ansel JS.
public static initJSVariables ( )
Example #1
0
 /**
  * Initialize the view. Needs the following parameters:
  * <pre>
  *   'browse_button' - Dom id of button to open file system browser.
  *   'target'        - Url of the target page to upload images to.
  *   'drop_target'   - Dom id of the element to receive drag and drop images
  *                     (If runtime supports it).
  *   'gallery'       - The gallery id we are uploading to.
  * </pre>
  * @param <type> $params
  */
 public function __construct(array $params = array())
 {
     $this->_params = $params;
     $this->_gallery = $this->_params['gallery'];
     if (!empty($params['forceNoScript'])) {
         $this->_forceNoScript = true;
     }
     Ansel::initJSVariables();
     global $page_output;
     $page_output->addScriptFile('scriptaculous/effects.js', 'horde');
     $page_output->addScriptFile('carousel.js');
 }
Example #2
0
/*
 * All parameters get passed into the View via a $params array so we can
 * pass the same parameters easily via API calls.
 */
$params['page'] = Horde_Util::getFormData('page', 0);
$params['sort'] = Horde_Util::getFormData('sort');
$params['sort_dir'] = Horde_Util::getFormData('sort_dir', 0);
$params['year'] = Horde_Util::getFormData('year', 0);
$params['month'] = Horde_Util::getFormData('month', 0);
$params['day'] = Horde_Util::getFormData('day', 0);
$params['view'] = $viewname;
$params['gallery_view'] = Horde_Util::getFormData('gallery_view');
$params['gallery_id'] = Horde_Util::getFormData('gallery');
$params['gallery_slug'] = Horde_Util::getFormData('slug');
$params['force_grouping'] = Horde_Util::getFormData('force_grouping');
$params['image_id'] = Horde_Util::getFormData('image');
try {
    $view = new $view($params);
} catch (Horde_Exception $e) {
    $page_output->header();
    $notification->notify(array('listeners' => 'status'));
    echo '<br /><em>' . htmlspecialchars($e->getMessage()) . '</em>';
    $page_output->footer();
    exit;
}
Ansel::initJSVariables();
$page_output->growler = true;
$page_output->header(array('title' => $view->getTitle(), 'ajax' => true));
$notification->notify(array('listeners' => 'status'));
echo $view->html();
$page_output->footer();