Beispiel #1
1
 /**
  * Hook for node form - if type is Filemanager Node, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     if (!Zend_Controller_Front::getInstance()->getRequest()->isXmlHttpRequest() && $item->type == "filemanager_file") {
         // Add Filemanager fields
         $form->setAttrib('enctype', 'multipart/form-data');
         $file = new Zend_Form_Element_File('filemanager_file');
         $file->setLabel("Select file")->setDestination(ZfApplication::$_data_path . DIRECTORY_SEPARATOR . "files")->setRequired(false);
         $form->addElement($file);
         $fields[] = 'filemanager_file';
         if ($item->id > 0) {
             // Fetch Filemanager object
             $factory = new Filemanager_File_Factory();
             $file_item = $factory->find($item->id)->current();
             if ($file_item) {
                 $existing = new Zend_Form_Element_Image('filemanager_image');
                 if (substr($file_item->mimetype, 0, 5) == "image") {
                     $imageid = $file_item->nid;
                 } else {
                     $imageid = 0;
                 }
                 $urlOptions = array('module' => 'filemanager', 'controller' => 'file', 'action' => 'show', 'id' => $imageid);
                 $existing->setImage(Zend_Controller_Front::getInstance()->getRouter()->assemble($urlOptions, 'default'));
                 $fields[] = 'filemanager_image';
             }
         }
         $options = array('legend' => Zoo::_("File upload"));
         $form->addDisplayGroup($fields, 'filemanager_fileupload', $options);
     } else {
         // Add content node image selector
     }
 }
Beispiel #2
0
 /**
  * Hook for node form - if type is Guestbook Node, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     if ($item->type == "guestbook_entry") {
         // Add guestbook fields
         $name = new Zend_Form_Element_Text('guestbook_name', array('size' => 35));
         $name->setLabel('Name');
         $name->setRequired(true);
         $email = new Zend_Form_Element_Text('guestbook_email', array('size' => 35));
         $email->setLabel('Email');
         $email->setRequired(true)->addValidator(new Zend_Validate_StringLength(6))->addValidator(new Zend_Validate_EmailAddress());
         $url = new Zend_Form_Element_Text('guestbook_homepage', array('size' => 35));
         $url->setLabel('Homepage');
         $url->setRequired(false)->addValidator(new Zend_Validate_StringLength(4))->addValidator(new Zend_Validate_Hostname());
         $form->addElements(array($name, $email, $url));
         $options = array('legend' => Zoo::_("Guest information"));
         $form->addDisplayGroup(array('guestbook_name', 'guestbook_email', 'guestbook_homepage'), 'guestbook_add', $options);
         if ($item->id > 0) {
             // Fetch guestbook object
             $factory = new Guestbook_Node_Factory();
             $guestbook = $factory->find($item->id)->current();
             if (!$guestbook) {
                 $guestbook = $factory->createRow();
             }
             $values = $guestbook->toArray();
             $populate = array();
             foreach ($values as $key => $value) {
                 $populate['guestbook_' . $key] = $value;
             }
             $form->populate($populate);
         }
     }
 }
Beispiel #3
0
 /**
  * Hook for node form, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     $content_type = Zoo::getService('content')->getType($item->type);
     if ($content_type->has_parent_url == 0) {
         $path = new Zend_Form_Element_Text('rewrite_path', array('size' => 65));
         $path->setLabel('URL');
         $form->addElement($path);
         $options = array('legend' => Zoo::_("URL Rewriting"));
         $form->addDisplayGroup(array('rewrite_path'), 'rewrite_path_options', $options);
         if ($item->id > 0) {
             $factory = new Rewrite_Path_Factory();
             $path = $factory->find($item->id)->current();
             if ($path) {
                 $form->populate(array('rewrite_path' => $path->path));
             } else {
                 // Find parent's path
                 if ($item->pid && ($path = $factory->find($item->pid)->current())) {
                     $form->populate(array('rewrite_path' => $path->path . "/" . $item->id));
                 } else {
                     $form->populate(array('rewrite_path' => $item->url()));
                 }
             }
         }
     }
 }
 /**
  * The default action - show the guestbook entries
  */
 public function indexAction()
 {
     $method = __METHOD__;
     $cacheid = str_replace("::", "_", $method) . intval($this->getRequest()->getParam('page', 1));
     $can_edit = false;
     if (Zoo::getService('acl')->checkAccess('edit')) {
         $cacheid .= "_edit";
         $can_edit = true;
     }
     $content = $this->checkCache($cacheid);
     if (!$content) {
         $limit = 20;
         // Offset = items per page multiplied by the page number minus 1
         $offset = ($this->getRequest()->getParam('page', 1) - 1) * $limit;
         $options = array('active' => true, 'nodetype' => 'guestbook_entry', 'order' => 'created DESC', 'render' => true);
         $select = Zoo::getService('content')->getContentSelect($options, $offset, $limit);
         $this->view->items = Zoo::getService('content')->getContent($options, $offset, $limit);
         // Pagination
         Zend_Paginator::setDefaultScrollingStyle('Elastic');
         Zend_View_Helper_PaginationControl::setDefaultViewPartial(array('pagination_control.phtml', 'zoo'));
         $adapter = new Zend_Paginator_Adapter_DbSelect($select);
         $paginator = new Zend_Paginator($adapter);
         $paginator->setItemCountPerPage($limit);
         $paginator->setCurrentPageNumber($this->getRequest()->getParam('page', 1));
         $paginator->setView($this->view);
         $this->view->assign('paginator', $paginator);
         $this->view->can_edit = $can_edit;
         $content = $this->getContent();
         $this->cache($content, $cacheid, array('nodelist', 'guestbook_list'));
     }
     $this->view->pagetitle = Zoo::_('Guestbook');
     $this->renderContent($content);
 }
Beispiel #5
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => "flex", 'controller' => 'panel', 'action' => 'form'), 'default');
     $this->setAction($url)->setMethod('post');
     $this->setLegend(sprintf(Zoo::_('Edit %s'), $this->target->name));
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Name')->setRequired(true);
     $name->setDescription('Administration-side identifier');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title');
     $title->setDescription('User-visible title of panel');
     $layout = new Zend_Form_Element_Select('layout');
     $layout->setLabel('Layout');
     $layout->setMultiOptions($this->getLayouts());
     $category = new Zend_Form_Element_Text('category');
     $category->setLabel('Category');
     $category->setDescription('Administration-side grouping');
     $category->setRequired(true);
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setLabel('save')->setOrder(100);
     $this->addElements(array($name, $title, $layout, $category));
     $legend = Zoo::_("Basic options");
     $this->addDisplayGroup(array('name', 'title', 'layout', 'category'), 'block_form', array('legend' => $legend));
     $this->addElement($submit);
     if ($this->target->id > 0) {
         $id_ele = new Zend_Form_Element_Hidden('id');
         $id_ele->setValue(intval($this->target->id));
         $this->addElement($id_ele);
     }
     $this->populate($this->target->toArray());
 }
Beispiel #6
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => "flex", 'controller' => 'panel', 'action' => 'layout'), 'default');
     $this->setAction($url)->setMethod('post');
     $this->setLegend(sprintf(Zoo::_('Edit %s'), $this->target->name));
     $settings_elements = $this->target->getLayout()->getSettingsFormElements();
     $this->addElements($settings_elements);
     $settings = $this->target->getLayout()->settings;
     $settings['structure'] = json_encode($settings['structure']);
     $legend = Zoo::_('Layout options');
     $this->addDisplayGroup($settings_elements, 'layout_settings', array('legend' => $legend));
     $regions = $this->target->getLayout()->getAllRegions();
     $allregions = array();
     foreach (array_keys($regions) as $name) {
         $region = new Zend_Form_Element_Select('region_' . $name);
         $region->setLabel($name)->setMultiOptions($this->getRegionStyles());
         $this->addElement($region);
         $allregions[] = 'region_' . $name;
     }
     $legend = Zoo::_('Region styles');
     $this->addDisplayGroup($allregions, 'region_form', array('legend' => $legend));
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setLabel('save')->setOrder(100);
     $this->addElement($submit);
     if ($this->target->id > 0) {
         $id_ele = new Zend_Form_Element_Hidden('id');
         $id_ele->setValue(intval($this->target->id));
         $this->addElement($id_ele);
     }
     $this->populate($settings);
     $this->populate($this->target->toArray());
 }
Beispiel #7
0
 public function getProfiles($ids = array())
 {
     $ret = array(0 => Zoo::_('Anonymous'));
     $users = $this->getFactory()->fetchAll($this->getFactory()->select()->where('uid IN (?)', $ids));
     if ($users) {
         foreach ($users as $user) {
             $ret[$user->uid] = $user;
         }
     }
     return $ret;
 }
 /**
  * Default error page action - show an error message
  *
  */
 public function errorAction()
 {
     $errors = $this->_getParam('error_handler');
     $messages = array();
     switch ((string) $errors->type) {
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
             // 404 error -- controller or action not found
             $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
             $messages[] = Zoo::_("The page you requested was not found.");
             if (ZfApplication::getEnvironment() == "development" || ZfApplication::getEnvironment() == "staging") {
                 $messages[] = $errors->exception->getMessage();
             }
             break;
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_OTHER:
         case 0:
             // application error
             //$messages[] = Zoo::_("An unexpected error occurred with your request. Please try again later.");
             $messages[] = $errors->exception->getMessage();
             if (ZfApplication::getEnvironment() == "development" || ZfApplication::getEnvironment() == "staging") {
                 $trace = $errors->exception->getTrace();
                 foreach (array_keys($trace) as $i) {
                     if ($trace[$i]['args']) {
                         foreach ($trace[$i]['args'] as $index => $arg) {
                             if (is_object($arg)) {
                                 $trace[$i]['args'][$index] = get_class($arg);
                             } elseif (is_array($arg)) {
                                 $trace[$i]['args'][$index] = "array";
                             }
                         }
                     }
                     $trace[$i]['file_short'] = ".." . substr($trace[$i]['file'], strrpos(str_replace("\\", DIRECTORY_SEPARATOR, $trace[$i]['file']), DIRECTORY_SEPARATOR));
                 }
                 $this->view->assign('trace', $trace);
             }
             break;
         default:
             // application error
             $this->getResponse()->setRawHeader('HTTP/1.1 ' . $errors->type);
             $messages[] = $errors->exception->getMessage();
             break;
     }
     // Clear previous content
     $this->getResponse()->clearBody();
     $this->view->assign('errormessages', $messages);
 }
Beispiel #9
0
 /**
  * Set form elements for a Content_Node object
  *
  * @param Content_Node $target
  * @param string $action
  * @param array $options
  */
 function __construct(Content_Node $target, $action, $options = array())
 {
     parent::__construct($options);
     $this->setAction($action)->setMethod('post');
     $this->setAttrib('id', 'content_form');
     $type = Zoo::getService('content')->getType($target->type);
     try {
         Zoo::getService("hook")->trigger("Node", "Form", $this, $target);
     } catch (Zoo_Exception_Service $e) {
         // Hook service not available - log? Better not, some people may live happily without a hook service
     }
     if ($type->has_publishdate_select) {
         // Add publish date and approval settings
         $status = new Zend_Form_Element_Radio('status', array('class' => 'content_status'));
         $status->setLabel('Status');
         $status->addMultiOption(0, Zoo::_('Unpublished'));
         $status->addMultiOption(1, Zoo::_('Published'));
         //$status->addMultiOption(2, Zoo::_('Ready for review'));
         $publishdate = new ZendX_JQuery_Form_Element_DatePicker('published');
         $publishdate->setLabel('Publish date');
         $this->addElements(array($status, $publishdate));
         $this->addDisplayGroup(array('status', 'published'), 'content_publish', array('legend' => Zoo::_("Publish settings")));
         //Workaround for JQuery Theme
         /**
          * @todo replace with unified jquery UI theme selector
          */
         $view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
         $view->headLink()->appendStylesheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/smoothness/jquery-ui.css');
     }
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setLabel('Save');
     $this->addElement($submit);
     if ($target->id > 0) {
         $id_ele = new Zend_Form_Element_Hidden('id');
         $id_ele->setValue(intval($target->id));
         $this->addElement($id_ele);
     } else {
         $target->status = 0;
     }
     $this->addElement(new Zend_Form_Element_Hidden('type', array('value' => $target->type)));
     $this->addElement(new Zend_Form_Element_Hidden('pid', array('value' => $target->pid)));
     $populate = $target->toArray();
     $populate['published'] = date("d M y", $target->published ? $target->published : time());
     $this->populate($populate);
 }
Beispiel #10
0
 /**
  * Hook for node form - if type is Estate Node, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     $title = new Zend_Form_Element_Text('title', array('class' => 'content_title'));
     $title->setLabel('Title');
     $title->setRequired(true)->addValidator(new Zend_Validate_StringLength(2, 255));
     $content = new Zoo_Form_Element_Wysiwyg('content');
     $content->setRequired(false)->setLabel('Content')->setAttrib('cols', 50);
     $form->addElements(array($title, $content));
     $form->addDisplayGroup(array('title', 'content'), 'content_add', array('legend' => Zoo::_('Content')));
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $identity = Zend_Auth::getInstance()->getIdentity();
         $uid = $identity->id;
     } else {
         $uid = 0;
     }
     $filters = Zoo::getService('filter')->getFiltersByUser($uid);
     if ($filters && $filters->count() > 0) {
         foreach ($filters as $filter) {
             $options = array();
             if (!$filter->optional) {
                 $options = array('disabled' => 'disabled', 'value' => 1);
             } elseif ($item->id == 0) {
                 $options['value'] = $filter->default;
             }
             $ele = new Zend_Form_Element_Checkbox("filter_" . $filter->name, $options);
             $ele->setLabel($filter->name);
             $form->addElement($ele);
             $elements[] = "filter_" . $filter->name;
             $userfilters[$filter->id] = $filter;
         }
         $options = array('legend' => Zoo::_("Filters"));
         $form->addDisplayGroup($elements, 'filter_set', $options);
         if ($item->id > 0) {
             // Fetch set filters
             $filters = Zoo::getService('content')->getFilters($item);
             $populate = array();
             foreach ($filters as $filter) {
                 $populate['filter_' . $userfilters[$filter->filter_id]->name] = 1;
             }
             $form->populate($populate);
         }
     }
 }
Beispiel #11
0
 /**
  * Hook for node form - if type is Estate Node, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     if ($item->type == "estate_node") {
         // Add estate fields
         $price = new Zend_Form_Element_Text('estate_price', array('size' => 10));
         $price->setLabel('Price');
         $price->setRequired(true)->addValidator(new Zend_Validate_Int());
         $area = new Zend_Form_Element_Text('estate_area', array('size' => 5));
         $area->setLabel('Area');
         $area->setRequired(true)->addValidator(new Zend_Validate_StringLength(1, 5))->addValidator(new Zend_Validate_Int());
         $rooms = new Zend_Form_Element_Text('estate_rooms', array('size' => 5));
         $rooms->setLabel('Rooms');
         $rooms->setRequired(true)->addValidator(new Zend_Validate_StringLength(1, 5))->addValidator(new Zend_Validate_Int());
         $floors = new Zend_Form_Element_Select('estate_floors');
         $floors->setLabel('Floors');
         $floors->addMultiOptions(array(1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '>5'));
         $year = new Zend_Form_Element_Text('estate_year');
         $year->setLabel('Built Year');
         $year->setRequired(true)->addValidator(new Zend_Validate_GreaterThan(1500))->addValidator(new Zend_Validate_Int());
         $ground = new Zend_Form_Element_Text('estate_ground');
         $ground->setLabel('Ground area');
         $ground->setRequired(true)->addValidator(new Zend_Validate_Int());
         $form->addElements(array($price, $area, $rooms, $floors, $year, $ground));
         $options = array('legend' => Zoo::_("Real estate information"));
         $form->addDisplayGroup(array('estate_price', 'estate_area', 'estate_rooms', 'estate_floors', 'estate_year', 'estate_ground'), 'estate_add', $options);
         if ($item->id > 0) {
             // Fetch estate object
             $factory = new Estate_Node_Factory();
             $estate = $factory->find($item->id)->current();
             if (!$estate) {
                 $estate = $factory->createRow();
             }
             $values = $estate->toArray();
             $populate = array();
             foreach ($values as $key => $value) {
                 $populate['estate_' . $key] = $value;
             }
             $form->populate($populate);
         }
     }
 }
Beispiel #12
0
 /**
  * Get registration form for a new user
  *
  * @return Zend_Form
  */
 function getRegistrationForm()
 {
     $form = new Zend_Form();
     $form->setAction("/register")->setMethod('post');
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username');
     $username->setRequired(true)->addValidator(new Zend_Validate_StringLength(2, 255));
     $password = new Zend_Form_Element_Password('password');
     $password->setRequired(true)->setLabel('Password');
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setLabel('Register');
     $form->addElements(array($username, $password));
     $form->addDisplayGroup(array('username', 'password'), 'user_register', array('legend' => Zoo::_('Register user')));
     try {
         Zoo::getService("hook")->trigger("User", "Registerform", $form);
     } catch (Zoo_Exception_Service $e) {
         // Hook service not available - log? Better not, some people may live happily without a hook service
     }
     $form->addElement($submit);
     return $form;
 }
 public function init()
 {
     $id = intval($this->getRequest()->getParam('id'));
     /**
      * @todo more generic sanitation than intval??
      */
     Zend_Registry::set('content_id', $id);
     $item = Zoo::getService('content')->load($id, 'Display');
     if (!$item) {
         throw new Zend_Controller_Action_Exception(Zoo::_("Content not found"), 404);
     }
     try {
         if (!Zoo::getService('acl')->checkItemAccess($item)) {
             throw new Exception(Zoo::_("Access denied - insufficient privileges"), 403);
         }
     } catch (Zoo_Exception_Service $e) {
         // No acl service installed
     }
     $this->view->assign('item', $item);
     $this->item =& $item;
     $this->view->assign('pagetitle', $item->title);
 }
 /**
  * Perform user logout
  *
  */
 public function logoutAction()
 {
     Zend_Auth::getInstance()->clearIdentity();
     Zoo::getService('user')->getCurrentUser()->logout();
     try {
         Zoo::getService("hook")->trigger("User", "Logout", $form);
     } catch (Zoo_Exception_Service $e) {
         // Hook service not available - log? Better not, some people may live happily without a hook service
     }
     echo Zoo::_("You are now logged out");
     $this->render("index");
 }
Beispiel #15
0
 /**
  * Get a root container for a menu
  * @return Zend_Navigation_Page_Uri
  */
 protected function getRootPage()
 {
     return new Zend_Navigation_Page_Uri(array('uri' => '/', 'title' => Zoo::_('Front page'), 'label' => Zoo::_('Front page'), 'id' => 'root'));
 }
Beispiel #16
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => "utility", 'controller' => 'hook', 'action' => 'save'), 'default');
     $this->setAction($url)->setMethod('post');
     $type = new Zend_Form_Element_Text('type');
     $type->setLabel('Type');
     $type->setRequired(true)->addValidator(new Zend_Validate_StringLength(1, 255));
     $action = new Zend_Form_Element_Text('action');
     $action->setLabel('Action');
     $action->setRequired(true)->addValidator(new Zend_Validate_StringLength(1, 255));
     $type = new Zend_Form_Element_Select('type');
     $type->setLabel('Hook');
     $hooks = $this->getHooks();
     foreach ($hooks as $name => $hook) {
         $values = array();
         ksort($hook);
         foreach ($hook as $value => $modulelist) {
             foreach ($modulelist as $module) {
                 $values[$name . "_" . $value . "_" . $module] = $value . " " . $module;
                 //                    $modules[$module] = $module;
             }
         }
         $type->addMultiOption($name, $values);
     }
     $weight = new Zend_Form_Element_Text('weight');
     $weight->setLabel('Weight')->setAttrib('size', 2);
     $weight->setRequired(true)->addValidator(new Zend_Validate_Int());
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setLabel('save');
     $this->addElements(array($type, $weight));
     $legend = $this->target->id > 0 ? Zoo::_("Edit item") : Zoo::_("Add item");
     $this->addDisplayGroup(array('type', 'action', 'weight'), 'hook_form', array('legend' => $legend));
     $this->addElement($submit);
     if ($this->target->id > 0) {
         $id_ele = new Zend_Form_Element_Hidden('id');
         $id_ele->setValue(intval($target->id));
         $this->addElement($id_ele);
     }
     $this->populate($this->target->toArray());
 }
 /**
  * Perform deletion of guestbook entry, if privileges allow
  *
  * @todo move this to Content module and delete guestbook-specific content through hooks
  * @return void
  */
 public function deleteAction()
 {
     $id = $this->getRequest()->getParam('id');
     $item = Zoo::getService('content')->find($id)->current();
     if ($item) {
         try {
             if (!Zoo::getService('acl')->checkItemAccess($item, 'edit') && !Zoo::getService('acl')->checkItemAccess($item, 'deleteown')) {
                 throw new Exception(Zoo::_("Access denied - insufficient privileges"), 403);
             }
             $item->delete();
             try {
                 Zoo::getService('cache')->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('node_' . $item->id, 'nodelist'));
                 Zoo::getService("hook")->trigger("Node", "Delete", $item);
             } catch (Zoo_Exception_Service $e) {
                 // Hook service not available - log? Better not, some people may live happily without a hook service
             }
         } catch (Zoo_Exception_Service $e) {
             // No acl service installed
         }
     }
     $this->getHelper('layout')->disableLayout();
     $this->getHelper('viewRenderer')->setNoRender();
 }
Beispiel #18
0
 /**
  * Hook for node form - if type is Filemanager Node, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     if ($item->type == "gallery_node") {
         $bgcolor = new Zoo_Form_Element_ColorPicker('gallery_bgcolor');
         $bgcolor->setLabel('Background colour');
         $config = Zoo::getConfig('gallery', 'module');
         /*
         $topimage = new Zend_Form_Element_Radio('gallery_topimage');
         $topimage->setLabel('Top image');
         $topimage->setOptions(array('escape' => false));
         $topimages = Zoo::getService('content')->getContent(array('parent' => $config->top_image, 
         														  'nodetype' => 'filemanager_file'));
         $topimage->addMultiOption(0, Zoo::_("None"));
         foreach ($topimages as $image) {
         	$topimage->addMultiOption($image->id, $image->title."<br /><img src='".$image->hooks['filemanager_file']->getUrl(200)."' />");
         }
         */
         $topimage = new Zoo_Form_Element_FileBrowser('gallery_topimage');
         $topimage->setLabel('Top image');
         $bgimage = new Zoo_Form_Element_FileBrowser('gallery_bgimage');
         $bgimage->setLabel('Background image');
         $form->addElements(array($bgcolor, $topimage, $bgimage));
         $options = array('legend' => Zoo::_("Gallery extras"));
         $form->addDisplayGroup(array('gallery_bgcolor', 'gallery_topimage', 'gallery_bgimage'), 'gallery_node', $options);
         if ($item->id > 0) {
             // Fetch extra information
             $top_image = Zoo::getService('link')->getLinkedNodes($item, 'top_image');
             $populate['gallery_topimage'] = count($top_image) > 0 ? $top_image[0]->id : 0;
             $bg_image = Zoo::getService('link')->getLinkedNodes($item, 'bg_image');
             $populate['gallery_bgimage'] = count($bg_image) > 0 ? $bg_image[0]->id : 0;
             $factory = new Gallery_Node_Factory();
             $gnode = false;
             // Fetch estate object
             $gnode = $factory->find($item->id)->current();
             if ($gnode) {
                 $populate['gallery_bgcolor'] = $gnode->bgcolor;
             }
             $form->populate($populate);
         }
     }
 }
 /**
  * Show nodes connected to a given node with a given connection type
  * @param bool $included whether the content is included in another request or is a stand-alone action. If not included, layout will be disabled and the list rendered
  */
 public function selectedAction($included = false)
 {
     $this->view->headScript()->appendFile('/js/infusion/InfusionAll.js', 'text/javascript');
     $this->view->headLink()->appendStylesheet('/js/infusion/framework/fss/css/fss-layout.css');
     $this->view->headLink()->appendStylesheet('/js/infusion/components/reorderer/css/Reorderer.css');
     $this->view->headLink()->appendStylesheet('/js/infusion/components/reorderer/css/ImageReorderer.css');
     $this->view->headLink()->appendStylesheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/smoothness/jquery-ui.css');
     $found = Zoo::getService('content')->find($this->getRequest()->getParam('connectTo'));
     if ($found->count() == 0) {
         throw new Zend_Controller_Action_Exception(Zoo::_("Content not found"), 404);
     }
     $item = $found->current();
     try {
         if (!Zoo::getService('acl')->checkItemAccess($item, 'edit')) {
             throw new Exception(Zoo::_("Access denied - insufficient privileges"), 403);
         }
     } catch (Zoo_Exception_Service $e) {
         // No acl service installed
     }
     // Find files connected to the item
     $item->hooks['connected_nodes'] = Zoo::getService('link')->getLinkedNodes($item, $this->getRequest()->getParam('type'));
     $this->view->assign('item', $item);
     $this->view->assign('connectTo', $item->id);
     $this->view->assign('type', $this->getRequest()->getParam('type'));
     if (!$included) {
         $this->getHelper('layout')->disableLayout();
         $this->render("sel-list");
     }
 }