public function init()
 {
     $this->addView('site_template', 'seeingsystem.views.SiteTemplate');
     //$this->addView('footer','seeingsystem.views.Footer');
     $this->addView('navigation', 'seeingsystem.views.Navigation');
     $this->addStylesheet('seeingsystem.views.Stylesheet');
     //$this->noAjax();
     $this->setValue('domain', $_SERVER['HTTP_HOST']);
     switch ($this->getvalue('domain')) {
         case 'seeing-system.kynan.net.au':
             $this->setValue('googlemap_api_key', 'ABQIAAAAZ1ExNUH_sGhIXkD0QHtloBR9yyzuukAtSm-r5oQlC6xD25hv9BRdPuqwpXtiycGWmUirhBmdWE8Q4Q');
             break;
         case 'seeing-system.stage.kynan.net.au':
             $this->setValue('googlemap_api_key', 'ABQIAAAAZ1ExNUH_sGhIXkD0QHtloBTZTjDFXr-IdzEJOBcfrzZw1J4xKxTe9QC43lVgjqGTeVg6snFMwwRAuA');
             break;
         case 'seeing-system.localhost':
             $this->setValue('googlemap_api_key', 'ABQIAAAAZ1ExNUH_sGhIXkD0QHtloBSHdQQXdyl9qcReiEnrUCyPGp_R1hTlLFsgeGDQ3S-10dLdv9ezac1g_A');
             break;
     }
     //echo "<br />DEBUG: HERE<br />\n";
     $this->setValue('googlemap_scripts', '<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=' . $this->getValue('googlemap_api_key') . '" />');
     ////$this->setValue('googlemap_scripts', '');
     // NOTE: THIS DOESN'T WORK BECAUSE JsRegister::current()->registerScript() PUTS ".js" AT THE END
     // Set the plugin path back to nothing to get the remode script with a full URL
     //JsRegister::current()->setPluginPath('http://maps.google.com/maps');
     //JsRegister::current()->registerScript('?file=api&amp;v=2&amp;key='.$this->getValue('googlemap_api_key'));
     JsRegister::current()->setPluginPath('packages/seeingsystem/views/js/');
     JsRegister::current()->registerScript('config');
     JsRegister::current()->registerScript('ss');
     //JsRegister::current()->registerScript('slideshow');
     JsRegister::current()->registerScript('prototype');
     JsRegister::current()->registerScript('scriptaculous');
     JsRegister::current()->registerScript('DOMAssistantCompressed-2.7.1');
 }
Example #2
0
 public function display()
 {
     $disp = Display::current();
     require_once 'packages/magpierss/rss_fetch.inc';
     $rss = fetch_rss('http://shortsoup.net.au/?feed=rss2&p=11');
     $disp->setValue('comments', $rss->items);
     $disp->setValue('add_comment', $rss->channel['link']);
     print_r($rss->items);
     // Include the javascript for the page
     JsRegister::current()->registerScript('home');
     //			if(Application::current()->user()->authorise('SeeingsystemSetup'))
     $disp->setValue('logged_in', true);
     //			else
     //			{
     //				$disp->setValue('login_error',$this->login_error);
     //				$login_form = Form::load('seeingsystem.views.Login');
     //				$disp->addForm($login_form);
     //			}
     $disp->setTitle('SeeingSystem - A Flickr Slideshow of Ordinary Beautiful Things');
     $disp->addView('page_content', 'seeingsystem.views.Home');
     /*
     			echo "<br />DEBUG: Home::display()<br />\n";
     			exit;
     */
     $disp->displaySiteTemplate();
 }
 public static function current()
 {
     if (!JsRegister::$instance) {
         JsRegister::$instance = new JsRegister();
     }
     return JsRegister::$instance;
 }
 public function registerJavascript($disp)
 {
     $root_params = array('file', 'width', 'height', 'version', 'background', 'id');
     if (!JsRegister::current()->isRegistered('swfobject')) {
         JsRegister::current()->setPluginPath('ext/js/');
         JsRegister::current()->registerScript('swfobject');
     }
     if (!JsRegister::current()->isRegistered('swf_object')) {
         JsRegister::current()->setPluginPath('packages/sys/display/rsml/meta/');
         JsRegister::current()->registerScript('swf_object');
     }
     if (is_object($disp)) {
         $object_params = array();
         $swf_params = array();
         foreach ($this->attributeNames() as $name) {
             if ($name != 'class' && $name != 'name') {
                 if ($this->dynamic_attributes->isDynamic($name)) {
                     $val = Display::rsmlValue($disp->variables(), $this->dynamic_attributes->attribute($name));
                 } else {
                     $val = $this->attribute($name, RsmlNode::CTX_PLAIN);
                 }
                 if (in_array($name, $root_params)) {
                     $object_params[DynamicAttributes::realName($name)] = $val;
                 } else {
                     $swf_params[DynamicAttributes::realName($name)] = $val;
                 }
             }
         }
         if (count($swf_params)) {
             $object_params['params'] = $swf_params;
         }
         JsRegister::current()->appendArgument('swf_object', 'objects', array($object_params));
     }
 }
 public function objectResponse($disp)
 {
     if ($disp->hasForm($this->attribute('name', RsmlNode::CTX_PLAIN))) {
         $arr = $this->attributesExcept(RsmlNode::CTX_ARRAY_ARGUMENT, 'name', 'id');
         $arr_string = implode(',', $arr);
         eval('$vars = array(' . $arr_string . ');');
         ob_start();
         $disp->viewForm($this->attribute('name', RsmlNode::CTX_PLAIN), $vars);
         $data = ob_get_clean();
         if (!JsRegister::current()->isRegistered('append_forms')) {
             JsRegister::current()->setPluginPath('packages/remote/');
             JsRegister::current()->registerScriptBefore('richie_rich', 'append_forms');
         }
         JsRegister::current()->appendArgument('append_forms', 'forms', array($this->idAttribute(RsmlNode::CTX_PLAIN) => preg_replace("/\n/", '', str_replace('"', '\\"', $data))));
     }
 }
        public function registerJavascript($disp)
        {
            if(!JsRegister::current()->isRegistered('rr'))
            {
                JsRegister::current()->setPluginPath('ext/js/rr/');
                JsRegister::current()->registerScript('rr');
            }

            if(!JsRegister::current()->isRegistered('richie_rich'))
            {
                JsRegister::current()->setPluginPath('packages/sys/display/form/meta/');
                JsRegister::current()->registerScript('richie_rich',array("empty" => "nothing"));
            }

            if($disp)
            {
                $args = array(array(
                              'name' => $this->name(),
                              'value' => htmlentities($disp->getValue($this->name().'_value'))
                             ));
                JsRegister::current()->appendArgument('richie_rich','widgets',$args);
            }
        }
 protected function getAjaxResponse()
 {
     $ret = array();
     $this->setResponse('title', 'none', $this->getTitle());
     if ($str = JsRegister::current()->toString()) {
         $this->setResponse('dhtml_load_url', 'none', $str);
     }
     foreach ($this->responses as $response) {
         $id = $response['id'];
         $value = $response['value'];
         $attribute = $response['attribute'];
         $ret[] = $id . ';;;;;' . $attribute . ':::::' . $value;
     }
     return implode('&&&&&', $ret);
 }
 public function jsRegister()
 {
     return JsRegister::current()->toString();
 }