Ansel::initJSVariables PHP Method

initJSVariables() public static method

Simple helper to output initial Ansel JS.
public static initJSVariables ( )
    public static function initJSVariables()
    {
        if (!$GLOBALS['browser']->isMobile()) {
            $code['conf'] = array('BASE_URI' => (string) Horde::url('', true, array('app' => 'ansel', 'append_session' => -1)));
            $code['conf']['maps'] = $GLOBALS['conf']['maps'];
            $code['conf']['pixeluri'] = (string) $GLOBALS['registry']->getServiceLink('pixel', 'ansel');
            $code['conf']['markeruri'] = (string) Horde_Themes::img('photomarker.png');
            $code['conf']['shadowuri'] = (string) Horde_Themes::img('photomarker-shadow.png');
            $code['conf']['havetwitter'] = !empty($GLOBALS['conf']['twitter']['enabled']);
            $code['ajax'] = new stdClass();
            $code['widgets'] = new stdClass();
            $GLOBALS['page_output']->addInlineJsVars(array('var Ansel' => $code));
        }
    }

Usage Example

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');
 }
All Usage Examples Of Ansel::initJSVariables