Author: Michael Slusarz (slusarz@horde.org)
Exemplo n.º 1
0
 /**
  */
 protected function _content()
 {
     global $registry, $prefs;
     if (!empty($this->_params['show_notepad'])) {
         $shares = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Share')->create();
     }
     $html = '';
     $memos = Mnemo::listMemos($prefs->getValue('sortby'), $prefs->getValue('sortdir'));
     foreach ($memos as $id => $memo) {
         $html .= '<tr>';
         if (!empty($this->_params['show_actions'])) {
             $editImg = Horde_Themes::img('edit.png');
             $editurl = Horde::url('memo.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id']));
             $html .= '<td width="1%">' . Horde::link(htmlspecialchars(Horde::url($editurl, true)->add('actionID', 'modify_memo')), _("Edit Note")) . Horde::img($editImg, _("Edit Note")) . '</a></td>';
         }
         if (!empty($this->_params['show_notepad'])) {
             $html .= '<td>' . htmlspecialchars(Mnemo::getLabel($shares->getShare($memo['memolist_id']))) . '</td>';
         }
         $viewurl = Horde::url('view.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id']));
         $html .= '<td>' . Horde::linkTooltip(htmlspecialchars(Horde::url($viewurl, true)), '', '', '', '', $memo['body'] != $memo['desc'] ? Mnemo::getNotePreview($memo) : '') . (strlen($memo['desc']) ? htmlspecialchars($memo['desc']) : '<em>' . _("Empty Note") . '</em>') . '</a> <ul class="horde-tags">';
         foreach ($memo['tags'] as $tag) {
             $html .= '<li>' . htmlspecialchars($tag) . '</li>';
         }
         $html .= '</ul></td></tr>';
     }
     if (!$memos) {
         return '<p><em>' . _("No notes to display") . '</em></p>';
     }
     return '<table cellspacing="0" width="100%" class="linedRow">' . $html . '</table>';
 }
Exemplo n.º 2
0
 /**
  * Add base javascript variables to the page.
  */
 protected function _addBaseVars()
 {
     global $conf, $injector, $prefs, $registry;
     $auth_name = $registry->getAuth();
     $has_tasks = Kronolith::hasApiPermission('tasks');
     $identity = $injector->getInstance('Horde_Core_Factory_Identity')->create();
     $app_urls = $js_vars = array();
     if (isset($conf['menu']['apps']) && is_array($conf['menu']['apps'])) {
         foreach ($conf['menu']['apps'] as $app) {
             $app_urls[$app] = strval(Horde::url($registry->getInitialPage($app), true));
         }
     }
     /* Variables used in core javascript files. */
     $js_vars['conf'] = array_filter(array('URI_CALENDAR_EXPORT' => str_replace(array('%23', '%2523', '%7B', '%257B', '%7D', '%257D'), array('#', '#', '{', '{', '}', '}'), strval($registry->downloadUrl('#{calendar}.ics', array('actionID' => 'export', 'all_events' => 1, 'exportID' => Horde_Data::EXPORT_ICALENDAR, 'exportCal' => 'internal_#{calendar}'))->setRaw(true))), 'URI_RESOURCE_EXPORT' => str_replace(array('%23', '%2523', '%7B', '%257B', '%7D', '%257D'), array('#', '#', '{', '{', '}', '}'), strval($registry->downloadUrl('#{calendar}.ics', array('actionID' => 'export', 'all_events' => 1, 'exportID' => Horde_Data::EXPORT_ICALENDAR, 'exportCal' => 'resource_#{calendar}'))->setRaw(true))), 'URI_EVENT_EXPORT' => str_replace(array('%23', '%7B', '%7D'), array('#', '{', '}'), Horde::url('event.php', true)->add(array('view' => 'ExportEvent', 'eventID' => '#{id}', 'calendar' => '#{calendar}', 'type' => '#{type}'))), 'images' => array('alarm' => strval(Horde_Themes::img('alarm-fff.png')), 'attendees' => strval(Horde_Themes::img('attendees-fff.png')), 'exception' => strval(Horde_Themes::img('exception-fff.png')), 'new_event' => strval(Horde_Themes::img('new.png')), 'new_task' => strval(Horde_Themes::img('new_task.png')), 'recur' => strval(Horde_Themes::img('recur-fff.png'))), 'new_event' => $injector->getInstance('Kronolith_View_Sidebar')->newLink . $injector->getInstance('Kronolith_View_Sidebar')->newText . '</a>', 'new_task' => $injector->getInstance('Kronolith_View_SidebarTasks')->newLink . $injector->getInstance('Kronolith_View_SidebarTasks')->newText . '</a>', 'user' => $registry->convertUsername($auth_name, false), 'name' => $identity->getName(), 'email' => strval($identity->getDefaultFromAddress()), 'prefs_url' => strval($registry->getServiceLink('prefs', 'kronolith')->setRaw(true)), 'app_urls' => $app_urls, 'name' => $registry->get('name'), 'has_tasks' => intval($has_tasks), 'has_resources' => intval(!empty($conf['resource']['driver'])), 'login_view' => $prefs->getValue('defaultview') == 'workweek' ? 'week' : $prefs->getValue('defaultview'), 'default_calendar' => 'internal|' . Kronolith::getDefaultCalendar(Horde_Perms::EDIT), 'max_events' => intval($prefs->getValue('max_events')), 'date_format' => Horde_Core_Script_Package_Datejs::translateFormat(Horde_Nls::getLangInfo(D_FMT)), 'time_format' => $prefs->getValue('twentyFour') ? 'HH:mm' : 'hh:mm tt', 'import_file' => Horde_Data::IMPORT_FILE, 'import_url' => Horde_Data::IMPORT_URL, 'show_time' => Kronolith::viewShowTime(), 'default_alarm' => intval($prefs->getValue('default_alarm')), 'status' => array('cancelled' => Kronolith::STATUS_CANCELLED, 'confirmed' => Kronolith::STATUS_CONFIRMED, 'free' => Kronolith::STATUS_FREE, 'tentative' => Kronolith::STATUS_TENTATIVE), 'recur' => array(Horde_Date_Recurrence::RECUR_NONE => 'None', Horde_Date_Recurrence::RECUR_DAILY => 'Daily', Horde_Date_Recurrence::RECUR_WEEKLY => 'Weekly', Horde_Date_Recurrence::RECUR_MONTHLY_DATE => 'Monthly', Horde_Date_Recurrence::RECUR_MONTHLY_WEEKDAY => 'Monthly', Horde_Date_Recurrence::RECUR_YEARLY_DATE => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_DAY => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_WEEKDAY => 'Yearly'), 'perms' => array('all' => Horde_Perms::ALL, 'show' => Horde_Perms::SHOW, 'read' => Horde_Perms::READ, 'edit' => Horde_Perms::EDIT, 'delete' => Horde_Perms::DELETE, 'delegate' => Kronolith::PERMS_DELEGATE), 'tasks' => $has_tasks ? $registry->tasks->ajaxDefaults() : null));
     /* Make sure this value is not optimized out by array_filter(). */
     $js_vars['conf']['week_start'] = intval($prefs->getValue('week_start_monday'));
     /* Gettext strings. */
     $js_vars['text'] = array('alarm' => _("Alarm:"), 'alerts' => _("Notifications"), 'allday' => _("All day"), 'delete_calendar' => _("Are you sure you want to delete this calendar and all the events in it?"), 'delete_tasklist' => _("Are you sure you want to delete this task list and all the tasks in it?"), 'external_category' => _("Other events"), 'fix_form_values' => _("Please enter correct values in the form first."), 'geocode_error' => _("Unable to locate requested address"), 'hidelog' => _("Hide Notifications"), 'import_warning' => _("Importing calendar data. This may take a while..."), 'more' => _("more..."), 'no_assignee' => _("None"), 'no_calendar_title' => _("The calendar title must not be empty."), 'no_parent' => _("No parent task"), 'no_tasklist_title' => _("The task list title must not be empty."), 'no_url' => _("You must specify a URL."), 'prefs' => _("Preferences"), 'searching' => sprintf(_("Events matching \"%s\""), '#{term}'), 'shared' => _("Shared"), 'tasks' => _("Tasks"), 'unknown_resource' => _("Unknown resource."), 'wrong_auth' => _("The authentication information you specified wasn't accepted."), 'wrong_date_format' => sprintf(_("You used an unknown date format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'), 'wrong_time_format' => sprintf(_("You used an unknown time format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'));
     for ($i = 1; $i <= 12; ++$i) {
         $js_vars['text']['month'][$i - 1] = Horde_Nls::getLangInfo(constant('MON_' . $i));
     }
     for ($i = 1; $i <= 7; ++$i) {
         $js_vars['text']['weekday'][$i] = Horde_Nls::getLangInfo(constant('DAY_' . $i));
     }
     foreach (array_diff(array_keys($js_vars['conf']['recur']), array(Horde_Date_Recurrence::RECUR_NONE)) as $recurType) {
         $js_vars['text']['recur'][$recurType] = Kronolith::recurToString($recurType);
     }
     $js_vars['text']['recur']['exception'] = _("Exception");
     // Maps
     $js_vars['conf']['maps'] = $conf['maps'];
     return $js_vars;
 }
Exemplo n.º 3
0
 /**
  * Browse through Whups' object tree.
  *
  * @param string $path  The level of the tree to browse.
  *
  * @return array  The contents of $path
  */
 public function browse($path = '')
 {
     global $whups_driver, $registry;
     if (substr($path, 0, 5) == 'whups') {
         $path = substr($path, 5);
     }
     $path = trim($path, '/');
     if (empty($path)) {
         $results = array('whups/queue' => array('name' => _("Queues"), 'icon' => Horde_Themes::img('whups.png'), 'browseable' => count(Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::READ))));
     } else {
         $path = explode('/', $path);
         $results = array();
         switch ($path[0]) {
             case 'queue':
                 $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::SHOW);
                 if (count($path) == 1) {
                     foreach ($queues as $queue => $name) {
                         $results['whups/queue/' . $queue] = array('name' => sprintf(_("Tickets from %s"), $name), 'browseable' => true);
                     }
                 } else {
                     if (!Whups::hasPermission($queues[$path[1]], 'queue', Horde_Perms::READ)) {
                         throw new Horde_Exception_PermissionDenied();
                     }
                     $tickets = $whups_driver->getTicketsByProperties(array('queue' => $path[1]));
                     foreach ($tickets as $ticket) {
                         $results['whups/queue/' . $path[1] . '/' . $ticket['id']] = array('name' => $ticket['summary'], 'browseable' => false);
                     }
                 }
                 break;
         }
     }
     return $results;
 }
Exemplo n.º 4
0
 /**
  * Constructs a correctly-pathed tag to an image.
  *
  * @param mixed $src   The image file (either a string or a
  *                     Horde_Themes_Image object).
  * @param array $opts  Additional options:
  *   - alt: (string) Text describing the image.
  *   - attr: (mixed) Any additional attributes for the image tag. Can be a
  *           pre-built string or an array of key/value pairs that will be
  *           assembled and html-encoded.
  *   - fullsrc: (boolean) TODO
  *   - imgopts: (array) TODO
  *
  * @return string  The full image tag.
  */
 public static function tag($src, array $opts = array())
 {
     global $browser, $conf;
     $opts = array_merge(array('alt' => '', 'attr' => array(), 'fullsrc' => false, 'imgopts' => array()), $opts);
     /* If browser does not support images, simply return the ALT text. */
     if (!$browser->hasFeature('images')) {
         return htmlspecialchars($opts['alt']);
     }
     $xml = new SimpleXMLElement('<root><img ' . (is_array($opts['attr']) ? '' : $opts['attr']) . '/></root>');
     $img = $xml->img;
     if (is_array($opts['attr'])) {
         foreach ($opts['attr'] as $key => $val) {
             $img->addAttribute($key, $val);
         }
     }
     if (strlen($opts['alt'])) {
         $img->addAttribute('alt', $opts['alt']);
     }
     /* If no directory has been specified, get it from the registry. */
     if (!$src instanceof Horde_Themes_Image && substr($src, 0, 1) != '/') {
         $src = Horde_Themes::img($src, $opts['imgopts']);
     }
     if (empty($conf['nobase64_img'])) {
         $src = self::base64ImgData($src);
     }
     if ($opts['fullsrc'] && substr($src, 0, 10) != 'data:image') {
         $src = Horde::url($src, true, array('append_session' => -1));
     }
     $img->addAttribute('src', $src);
     return $img->asXML();
 }
Exemplo n.º 5
0
 /**
  */
 public function __construct(array $params = array())
 {
     global $page_output;
     parent::__construct(array_merge(array('boxClass' => 'hordeACBox impACBox', 'boxClassFocus' => 'impACBoxFocus', 'deleteIcon' => strval(Horde_Themes::img('delete-small.png')), 'displayFilter' => 'new Function("t", "return t.sub(/<[^>]*>$/, \\"\\").strip().escapeHTML()")', 'growingInputClass' => 'hordeACTrigger impACTrigger', 'listClass' => 'hordeACList impACList', 'processValueCallback' => 'ImpComposeBase.autocompleteValue.bind(ImpComposeBase)', 'removeClass' => 'hordeACItemRemove impACItemRemove', 'triggerContainer' => strval(new Horde_Support_Randomid())), $params));
     $this->_raw = array_merge($this->_raw, array('displayFilter', 'filterCallback', 'onAdd', 'onRemove', 'processValueCallback'));
     $page_output->addScriptFile('compose-base.js');
     $page_output->addScriptFile('prettyautocomplete.js');
 }
Exemplo n.º 6
0
 /**
  * Outputs the html for a DateGallery tile.
  *
  * @param Ansel_Gallery_Decorator_Date $dgallery  The Ansel_Gallery_Date we are
  *                                     displaying.
  * @param Ansel_Style $style  A style object.
  * @param boolean $mini       Force the use of a mini thumbail?
  * @param array $params       An array containing additional parameters.
  *                            Currently, gallery_view_url and image_view_url
  *                            are used to override the respective urls.
  *                            %g and %i are replaced with image id and
  *                            gallery id, respectively.
  *
  * @return string  The HTML for the tile.
  */
 public function getTile(Ansel_Gallery_Decorator_Date $dgallery, Ansel_Style $style = null, $mini = false, array $params = array())
 {
     $view = $GLOBALS['injector']->createInstance('Horde_View');
     $view->addTemplatePath(ANSEL_TEMPLATES . '/tile');
     // User's preferred date format
     $date_format = $GLOBALS['prefs']->getValue('date_format');
     $date_array = $dgallery->getDate();
     if (empty($date_array['month'])) {
         $date_array['month'] = 1;
     }
     if (empty($date_array['day'])) {
         $date_array['day'] = 1;
     }
     $full_date = new Horde_Date($date_array);
     // Need the unaltered date part array
     $date_array = $dgallery->getDate();
     // Figure out the needed link for the next drill down level. We *must*
     // have at least a year since we are in a date tile.
     if (empty($date_array['month'])) {
         // unit == year
         $view->caption = $full_date->strftime('%Y');
         $next_date = array('year' => (int) $view->caption);
     } elseif (empty($date_array['day'])) {
         // unit == month
         $view->caption = $full_date->strftime('%B %Y');
         $next_date = array('year' => date('Y', $full_date->timestamp()), 'month' => date('n', $full_date->timestamp()));
     } else {
         // unit == day
         $view->caption = $full_date->strftime($date_format);
         $next_date = array('year' => date('Y', $full_date->timestamp()), 'month' => date('n', $full_date->timestamp()), 'day' => date('j', $full_date->timestamp()));
     }
     // Check permissions on the gallery and get appropriate tile image
     if ($dgallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
         if (is_null($style)) {
             $style = $dgallery->getStyle();
         }
         $thumbstyle = $mini ? 'mini' : 'thumb';
         $view->gallery_image = Ansel::getImageUrl($dgallery->getKeyImage(), $thumbstyle, true, $style);
     } else {
         $view->gallery_image = Horde_Themes::img('thumb-error.png');
     }
     /* Check for being called via the api and generate correct view links */
     if (!isset($params['gallery_view_url'])) {
         if (empty($params['style'])) {
             $gstyle = $dgallery->getStyle();
         } else {
             $gstyle = $params['style'];
         }
         $params = array('gallery' => $dgallery->id, 'view' => 'Gallery', 'slug' => $dgallery->get('slug'));
         $view->view_link = Ansel::getUrlFor('view', array_merge($params, $next_date));
     } else {
         $view->view_link = new Horde_Url(str_replace(array('%g', '%s'), array($dgallery->id, $dgallery->get('slug')), urldecode($params['gallery_view_url'])));
         $view->view_link->add($next_date);
     }
     $view->gallery_count = $dgallery->countImages(true);
     return $view->render('dategallery');
 }
Exemplo n.º 7
0
 /**
  * Generate flag image object.
  *
  * @since 2.10.0
  *
  * @param string $host  The hostname.
  *
  * @return array  False if not found, or an array with these keys:
  * <pre>
  *   - name: (string) Country name.
  *   - ob: (Horde_Themes_Image) Image object.
  * </pre>
  */
 public static function getFlagImageObByHost($host)
 {
     global $conf;
     $data = Horde_Nls::getCountryByHost($host, empty($conf['geoip']['datafile']) ? null : $conf['geoip']['datafile']);
     if ($data === false) {
         return false;
     }
     return array('name' => $data['name'], 'ob' => Horde_Themes::img('flags/' . $data['code'] . '.png'));
 }
Exemplo n.º 8
0
Arquivo: Ui.php Projeto: horde/horde
 /**
  * Return a Horde_Tree representation of the permissions tree.
  *
  * @return string  The html showing the permissions as a Horde_Tree.
  * @throws Horde_Perms_Exception
  */
 public function renderTree($current = Horde_Perms::ROOT)
 {
     /* Get the perms tree. */
     $nodes = $this->_perms->getTree();
     $perms_node = array('icon' => Horde_Themes::img('perms.png'));
     $add = Horde::url('admin/perms/addchild.php');
     $add_img = Horde_Themes_Image::tag('plus.png', array('alt' => Horde_Core_Translation::t("Add Permission")));
     $edit = Horde::url('admin/perms/edit.php');
     $delete = Horde::url('admin/perms/delete.php');
     $edit_img = Horde_Themes_Image::tag('edit.png', array('alt' => Horde_Core_Translation::t("Edit Permission")));
     $delete_img = Horde_Themes_Image::tag('delete.png', array('alt' => Horde_Core_Translation::t("Delete Permission")));
     $blank_img = Horde_Themes_Image::tag('blank.gif', array('attr' => array('width' => 16, 'height' => 16)));
     /* Set up the tree. */
     $tree = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Tree')->create('perms_ui', 'Javascript', array('alternate' => true, 'hideHeaders' => true));
     $tree->setHeader(array(array('class' => 'horde-tree-spacer')));
     foreach ($nodes as $perm_id => $node) {
         $node_class = $current == $perm_id ? array('class' => 'selected') : array();
         if ($perm_id == Horde_Perms::ROOT) {
             $add_link = $add->add('perm_id', $perm_id)->link(array('class' => 'permsAdd', 'title' => Horde_Core_Translation::t("Add New Permission"))) . $add_img . '</a>';
             $base_node_params = array('icon' => Horde_Themes::img('administration.png'));
             $tree->addNode(array('id' => $perm_id, 'label' => Horde_Core_Translation::t("All Permissions"), 'expanded' => true, 'params' => $base_node_params + $node_class, 'right' => array($add_link)));
         } else {
             $parent_id = $this->_perms->getParent($node);
             $perms_extra = array();
             $parents = explode(':', $node);
             if (!in_array($parents[0], $GLOBALS['registry']->listApps(array('notoolbar', 'active', 'hidden')))) {
                 // This backend has permissions for an application that is
                 // not installed.  Perhaps the application has been removed
                 // or the backend is shared with other Horde installations.
                 // Skip this app and do not include it in the tree.
                 continue;
             }
             try {
                 $app_perms = $this->_corePerms->getApplicationPermissions($parents[0]);
             } catch (Horde_Perms_Exception $e) {
                 $GLOBALS['notification']->push($e);
                 continue;
             }
             if (isset($app_perms['tree']) && is_array(Horde_Array::getElement($app_perms['tree'], $parents))) {
                 $add_link = $add->add('perm_id', $perm_id)->link(array('class' => 'permsAdd', 'title' => Horde_Core_Translation::t("Add Child Permission"))) . $add_img . '</a>';
                 $perms_extra[] = $add_link;
             } else {
                 $perms_extra[] = $blank_img;
             }
             $edit_link = $edit->add('perm_id', $perm_id)->link(array('class' => 'permsEdit', 'title' => Horde_Core_Translation::t("Edit Permission"))) . $edit_img . '</a>';
             $perms_extra[] = $edit_link;
             $delete_link = $delete->add('perm_id', $perm_id)->link(array('class' => 'permsDelete', 'title' => Horde_Core_Translation::t("Delete Permission"))) . $delete_img . '</a>';
             $perms_extra[] = $delete_link;
             $name = $this->_corePerms->getTitle($node);
             $expanded = isset($nodes[$current]) && strpos($nodes[$current], $node) === 0 && $nodes[$current] != $node;
             $tree->addNode(array('id' => $perm_id, 'parent' => $parent_id, 'label' => $name, 'expanded' => $expanded, 'params' => $perms_node + $node_class, 'right' => $perms_extra));
         }
     }
     $tree->sort('label');
     return $tree->renderTree();
 }
Exemplo n.º 9
0
 /**
  * Returns an apropriate icon for the given bookmark.
  *
  * @param Trean_Bookmark $bookmark  The bookmark object.
  *
  * @return  Horde_Url The URL for the image.
  */
 static function getFavicon($bookmark)
 {
     if ($bookmark->favicon_url) {
         return Horde::url('favicon.php')->add('bookmark_id', $bookmark->id);
     } else {
         // Default to the protocol icon.
         $protocol = substr($bookmark->url, 0, strpos($bookmark->url, '://'));
         return Horde_Themes::img('protocol/' . (empty($protocol) ? 'http' : $protocol) . '.png');
     }
 }
Exemplo n.º 10
0
 /**
  * Generate flag image object.
  *
  * @since 2.10.0
  *
  * @param string $host  The hostname.
  *
  * @return array  False if not found, or an array with these keys:
  * <pre>
  *   - name: (string) Country name.
  *   - ob: (Horde_Themes_Image) Image object.
  * </pre>
  */
 public static function getFlagImageObByHost($host)
 {
     global $conf, $injector;
     if (!Horde_Nls::$dnsResolver) {
         Horde_Nls::$dnsResolver = $injector->getInstance('Net_DNS2_Resolver');
     }
     $data = Horde_Nls::getCountryByHost($host, empty($conf['geoip']['datafile']) ? null : $conf['geoip']['datafile']);
     if ($data === false) {
         return false;
     }
     return array('name' => $data['name'], 'ob' => Horde_Themes::img('flags/' . $data['code'] . '.png'));
 }
Exemplo n.º 11
0
 /**
  */
 public function display(Horde_Core_Prefs_Ui $ui)
 {
     global $prefs;
     $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/prefs'));
     $view->addHelper('FormTag');
     $view->addHelper('Tag');
     $view->addHelper('Text');
     $newmail_audio = $view->newmail_audio = $prefs->getValue('newmail_audio');
     $sounds = array();
     foreach (Horde_Themes::soundList() as $key => $val) {
         $sounds[] = array('c' => $newmail_audio == $key, 'l' => $key, 's' => $val->uri, 'v' => $key);
     }
     $view->sounds = $sounds;
     return $view->render('newmailaudio');
 }
Exemplo n.º 12
0
Arquivo: Ajax.php Projeto: horde/horde
 /**
  */
 protected function _addBaseVars()
 {
     global $prefs, $injector, $conf, $registry;
     $app_urls = $js_vars = array();
     if (isset($conf['menu']['apps']) && is_array($conf['menu']['apps'])) {
         foreach ($conf['menu']['apps'] as $app) {
             $app_urls[$app] = strval(Horde::url($registry->getInitialPage($app), true));
         }
     }
     $identity = $injector->getInstance('Horde_Core_Factory_Identity')->create();
     $format_date = str_replace(array('%x', '%X'), array(Horde_Nls::getLangInfo(D_FMT, Horde_Nls::getLangInfo(D_T_FMT))), $prefs->getValue('date_format_mini'));
     /* Variables used in core javascript files. */
     $js_vars['conf'] = array('URI_EXPORT' => (string) $registry->downloadUrl('time.csv', array('actionID' => 'export'))->setRaw(true), 'images' => array('timerlog' => (string) Horde_Themes::img('log.png'), 'timerplay' => (string) Horde_Themes::img('play.png'), 'timerpause' => (string) Horde_Themes::img('pause.png')), 'user' => $registry->convertUsername($registry->getAuth(), false), 'prefs_url' => strval($registry->getServiceLink('prefs', 'hermes')->setRaw(true)), 'app_urls' => $app_urls, 'name' => $identity->getName(), 'login_view' => 'time', 'date_format' => str_replace(array('%e', '%d', '%a', '%A', '%m', '%h', '%b', '%B', '%y', '%Y'), array('d', 'dd', 'ddd', 'dddd', 'MM', 'MMM', 'MMM', 'MMMM', 'yy', 'yyyy'), $format_date), 'client_name_field' => $conf['client']['field'], 'has_review_edit' => $injector->getInstance('Horde_Perms')->hasPermission('hermes:review', $GLOBALS['registry']->getAuth(), Horde_Perms::EDIT), 'has_review' => $registry->isAdmin(array('permission' => 'hermes:review')), 'has_timeadmin' => $registry->isAdmin(array('permission' => 'hermes:timeadmin')), 'has_deliverableadmin' => $registry->isAdmin(array('permission' => 'hermes:deliverables')));
     /* Gettext strings used in core javascript files. */
     $js_vars['text'] = array('noalerts' => _("No Notifications"), 'alerts' => sprintf(_("%s notifications"), '#{count}'), 'hidelog' => _("Hide Notifications"), 'more' => _("more..."), 'prefs' => _("Preferences"), 'fix_form_values' => _("Please enter correct values in the form first."), 'wrong_date_format' => sprintf(_("You used an unknown date format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'), 'timeentry' => _("Time Entry"), 'edittime' => _("Editing Time Entry"), 'select_jobtype' => _("Select a Job Type"), 'missing_client' => _("You must select a client first."), 'billable' => _("Billable"), 'nonbillable' => _("Non billable"), 'hours' => _("Hours"), 'type' => _("Job Type"), 'budget' => _("Budget hours"));
     return $js_vars;
 }
Exemplo n.º 13
0
 /**
  * Add all kinds of variables and captions dependent on prefs, locale, state...
  * TODO: This could be stripped further and still serve demonstrational purposes
  */
 protected function _addBaseVars()
 {
     global $prefs, $injector, $conf, $registry;
     $app_urls = $js_vars = array();
     if (isset($conf['menu']['apps']) && is_array($conf['menu']['apps'])) {
         foreach ($conf['menu']['apps'] as $app) {
             $app_urls[$app] = strval(Horde::url($registry->getInitialPage($app), true));
         }
     }
     $identity = $injector->getInstance('Horde_Core_Factory_Identity')->create();
     $format_date = str_replace(array('%x', '%X'), array(Horde_Nls::getLangInfo(D_FMT, Horde_Nls::getLangInfo(D_T_FMT))), $prefs->getValue('date_format_mini'));
     /* Variables used in core javascript files. */
     $js_vars['conf'] = array('images' => array('timerlog' => (string) Horde_Themes::img('log.png')), 'user' => $registry->convertUsername($registry->getAuth(), false), 'prefs_url' => strval($registry->getServiceLink('prefs', 'hermes')->setRaw(true)), 'app_urls' => $app_urls, 'name' => $identity->getName(), 'login_view' => 'example1', 'date_format' => str_replace(array('%e', '%d', '%a', '%A', '%m', '%h', '%b', '%B', '%y', '%Y'), array('d', 'dd', 'ddd', 'dddd', 'MM', 'MMM', 'MMM', 'MMMM', 'yy', 'yyyy'), $format_date));
     /* Gettext strings used in core javascript files. */
     $js_vars['text'] = array('noalerts' => _("No Notifications"), 'alerts' => sprintf(_("%s notifications"), '#{count}'), 'hidelog' => _("Hide Notifications"), 'more' => _("more..."), 'prefs' => _("Preferences"));
     return $js_vars;
 }
Exemplo n.º 14
0
 /**
  * Initialize a HordeMap.
  *
  * @param array $params
  */
 public static function init(array $params = array())
 {
     global $browser, $conf, $language, $page_output, $registry;
     // Language specific file needed?
     $language = str_replace('_', '-', $language);
     if (!file_exists($registry->get('jsfs', 'horde') . '/map/lang/' . $language . '.js')) {
         $language = 'en-US';
     }
     $params = array_merge(array('conf' => array('language' => $language, 'markerImage' => strval(Horde_Themes::img('map/marker.png')), 'markerBackground' => strval(Horde_Themes::img('map/marker-shadow.png')), 'useMarkerLayer' => true), 'driver' => 'Horde', 'geocoder' => $conf['maps']['geocoder'], 'jsuri' => $registry->get('jsuri', 'horde') . '/map/', 'providers' => $conf['maps']['providers'], 'ssl' => $browser->usingSSLConnection()), $params);
     foreach ($params['providers'] as $layer) {
         switch ($layer) {
             case 'Google':
                 $params['conf']['apikeys']['google'] = $conf['api']['googlemaps'];
                 break;
             case 'Yahoo':
                 $params['conf']['apikeys']['yahoo'] = $conf['api']['yahoomaps'];
                 break;
             case 'Cloudmade':
                 $params['conf']['apikeys']['cloudmade'] = $conf['api']['cloudmade'];
                 break;
             case 'Mytopo':
                 /* Mytopo requires a hash of the *client* IP address and the
                  * key. Note that this also causes Mytopo to break if the
                  * client's IP address presented as an internal address. */
                 $params['conf']['apikeys']['mytopo'] = array('id' => $conf['api']['mytopo_partnerID'], 'hash' => strtoupper(md5($conf['api']['mytopo'] . $browser->getIpAddress())));
                 break;
         }
     }
     if (!empty($params['geocoder'])) {
         switch ($params['geocoder']) {
             case 'Google':
                 $params['conf']['apikeys']['google'] = $conf['api']['googlemaps'];
                 break;
             case 'Yahoo':
                 $params['conf']['apikeys']['yahoo'] = $conf['api']['yahoomaps'];
                 break;
             case 'Cloudmade':
                 $params['conf']['apikeys']['cloudmade'] = $conf['api']['cloudmade'];
                 break;
         }
     }
     $page_output->addScriptFile('map/map.js', 'horde');
     $page_output->addInlineScript(array('HordeMap.initialize(' . Horde_Serialize::serialize($params, HORDE_SERIALIZE::JSON) . ');'));
 }
Exemplo n.º 15
0
 /**
  * Return the full rendered version of the Horde_Mime_Part object.
  *
  * URL parameters used by this function:
  *   - pdf_view_thumbnail: (boolean) Output the thumbnail info.
  *
  * @return array  See parent::render().
  */
 protected function _render()
 {
     /* Create the thumbnail and display. */
     if (!$GLOBALS['injector']->getInstance('Horde_Variables')->pdf_view_thumbnail) {
         return parent::_render();
     }
     $img = $this->_getHordeImageOb(true);
     if ($img) {
         $img->resize(150, 150, true);
         $type = $img->getContentType();
         $data = $img->raw(true);
     }
     if (!$img || !$data) {
         $type = 'image/png';
         $img_ob = Horde_Themes::img('mini-error.png', 'imp');
         $data = file_get_contents($img_ob->fs);
     }
     return array($this->_mimepart->getMimeId() => array('data' => $data, 'type' => $type));
 }
Exemplo n.º 16
0
 /**
  * Build the HTML for this widget
  *
  * @return string  The HTML representing this widget.
  */
 public function html()
 {
     $view = $GLOBALS['injector']->getInstance('Horde_View');
     $view->addTemplatePath(ANSEL_TEMPLATES . '/widgets');
     $view->title = _("Tags");
     $view->background = $this->_style->background;
     $view->action_url = Horde::url('gallery.php');
     $image_id = $this->_resourceType == 'image' ? $this->_view->resource->id : null;
     try {
         $view->tag_html = $this->_getTagHTML();
     } catch (Ansel_Exception $e) {
         $view->error_text = sprintf(_("There was an error fetching tags: %s"), $e->getMessage());
     }
     if ($this->_view->gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
         $view->have_edit = true;
         $GLOBALS['page_output']->addScriptFile('widgets/tagactions.js');
         $GLOBALS['page_output']->addInlineJsVars(array('AnselTagActions.gallery' => $this->_view->gallery->id, 'AnselTagActions.image' => $image_id, 'AnselTagActions.remove_image' => strval(Horde_Themes::img('delete-small.png'))));
     }
     return $view->render('tags');
 }
Exemplo n.º 17
0
 /**
  * Constructor.
  *
  * @param array $config  Configuration key-value pairs.
  */
 public function __construct($config = array())
 {
     global $injector, $prefs, $registry;
     if (empty($config['templatePath'])) {
         $config['templatePath'] = $registry->get('templates', 'horde') . '/topbar';
     }
     parent::__construct($config);
     $this->addHelper('Text');
     /* Logo. */
     $this->portalUrl = $registry->getServiceLink('portal', $registry->getApp());
     if (class_exists('Horde_Bundle')) {
         $this->version = Horde_Bundle::SHORTNAME . ' ' . Horde_Bundle::VERSION;
     } else {
         $this->version = $registry->getVersion('horde');
     }
     /* Main menu. */
     $topbar = $injector->getInstance('Horde_Core_Factory_Topbar')->create('Horde_Tree_Renderer_Menu', array('nosession' => true));
     $this->menu = $topbar->getTree();
     /* Search form. */
     $this->searchAction = '#';
     $this->searchIcon = Horde_Themes::img('search-topbar.png');
     $this->searchLabel = _("Search");
     /* Login/Logout. */
     if ($registry->getAuth()) {
         if ($registry->showService('logout')) {
             $this->logoutUrl = $registry->getServiceLink('logout', $registry->getApp())->setRaw(false);
         }
     } else {
         if ($registry->showService('login')) {
             $this->loginUrl = $registry->getServiceLink('login', $registry->getApp())->setRaw(false)->add('url', Horde::selfUrl(true, true, true));
         }
     }
     /* Sub bar. */
     $this->date = strftime($prefs->getValue('date_format'));
     $pageOutput = $injector->getInstance('Horde_PageOutput');
     $pageOutput->addScriptPackage('Horde_Core_Script_Package_Datejs');
     $pageOutput->addScriptFile('topbar.js', 'horde');
     $pageOutput->addInlineJsVars(array('HordeTopbar.conf' => array('URI_AJAX' => $registry->getServiceLink('ajax', 'horde')->url, 'app' => $registry->getApp(), 'format' => Horde_Core_Script_Package_Datejs::translateFormat($prefs->getValue('date_format')), 'hash' => $topbar->getHash(), 'refresh' => intval($prefs->getValue('menu_refresh_time')))));
     /* Sidebar. */
     $this->sidebarWidth = $prefs->getValue('sidebar_width');
 }
Exemplo n.º 18
0
 /**
  * String representation of this object.
  *
  * @return string  String representation.
  */
 public function __toString()
 {
     switch ($this->type) {
         case 'imp.forward':
             $img = 'forwarded.png';
             $label = _("Forward");
             break;
         case 'imp.redirect':
             $img = 'forwarded.png';
             $label = _("Redirect");
             break;
         case 'imp.reply':
         case 'imp.reply_all':
         case 'imp.reply_list':
             $img = 'answered.png';
             $label = _("Reply");
             break;
         default:
             return parent::__toString();
     }
     return Horde_Themes_Image::tag(Horde_Themes::img($img, 'imp'), array('alt' => $label)) . '<div class="noticetext">' . parent::__toString() . '</div>';
 }
Exemplo n.º 19
0
<div class="diff-caption">
<?php 
$blank = Horde_Themes::img('blank.gif');
?>
<img class="diff-unmodified" src="<?php 
echo $blank;
?>
" alt="<?php 
echo _("Unmodified");
?>
" /> <?php 
echo _("Unmodified");
?>
<img class="diff-added" src="<?php 
echo $blank;
?>
" alt="<?php 
echo _("Added");
?>
" /> <?php 
echo _("Added");
?>
<img class="diff-modified" src="<?php 
echo $blank;
?>
" alt="<?php 
echo _("Modified");
?>
" /> <?php 
echo _("Modified");
?>
Exemplo n.º 20
0
 function init()
 {
     $this->_sounds = array_keys(Horde_Themes::soundList());
 }
Exemplo n.º 21
0
 /**
  * The HTML image source to use for blocked images.
  *
  * @return string  The HTML image source.
  */
 protected function _imgBlockImg()
 {
     if (!isset($this->_imptmp['blockimg'])) {
         $this->_imptmp['blockimg'] = strval(Horde_Themes::img('spacer_red.png'));
     }
     return $this->_imptmp['blockimg'];
 }
Exemplo n.º 22
0
 /**
  * Returns an alarm hash of this event suitable for Horde_Alarm.
  *
  * @param Horde_Date $time  Time of alarm.
  * @param string $user      The user to return alarms for.
  * @param Prefs $prefs      A Prefs instance.
  *
  * @return array  Alarm hash or null.
  */
 public function toAlarm($time, $user = null, $prefs = null)
 {
     if (!$this->alarm || $this->status == Kronolith::STATUS_CANCELLED) {
         return;
     }
     if ($this->recurs()) {
         $eventDate = $this->recurrence->nextRecurrence($time);
         if (!$eventDate || $eventDate && $this->recurrence->hasException($eventDate->year, $eventDate->month, $eventDate->mday)) {
             return;
         }
         $start = clone $eventDate;
         $diff = Date_Calc::dateDiff($this->start->mday, $this->start->month, $this->start->year, $this->end->mday, $this->end->month, $this->end->year);
         if ($diff == -1) {
             $diff = 0;
         }
         $end = new Horde_Date(array('year' => $start->year, 'month' => $start->month, 'mday' => $start->mday + $diff, 'hour' => $this->end->hour, 'min' => $this->end->min, 'sec' => $this->end->sec));
     } else {
         $start = clone $this->start;
         $end = clone $this->end;
     }
     $serverName = $_SERVER['SERVER_NAME'];
     $serverConf = $GLOBALS['conf']['server']['name'];
     if (!empty($GLOBALS['conf']['reminder']['server_name'])) {
         $_SERVER['SERVER_NAME'] = $GLOBALS['conf']['server']['name'] = $GLOBALS['conf']['reminder']['server_name'];
     }
     if (empty($user)) {
         $user = $GLOBALS['registry']->getAuth();
     }
     if (empty($prefs)) {
         $prefs = $GLOBALS['prefs'];
     }
     $methods = !empty($this->methods) ? $this->methods : @unserialize($prefs->getValue('event_alarms'));
     if (isset($methods['notify'])) {
         $methods['notify']['show'] = array('__app' => $GLOBALS['registry']->getApp(), 'event' => $this->id, 'calendar' => $this->calendar);
         $methods['notify']['ajax'] = 'event:' . $this->calendarType . '|' . $this->calendar . ':' . $this->id . ':' . $start->dateString();
         if (!empty($methods['notify']['sound'])) {
             if ($methods['notify']['sound'] == 'on') {
                 // Handle boolean sound preferences.
                 $methods['notify']['sound'] = (string) Horde_Themes::sound('theetone.wav');
             } else {
                 // Else we know we have a sound name that can be
                 // served from Horde.
                 $methods['notify']['sound'] = (string) Horde_Themes::sound($methods['notify']['sound']);
             }
         }
         if ($this->isAllDay()) {
             if ($start->compareDate($end) == 0) {
                 $methods['notify']['subtitle'] = sprintf(_("On %s"), '<strong>' . $start->strftime($prefs->getValue('date_format')) . '</strong>');
             } else {
                 $methods['notify']['subtitle'] = sprintf(_("From %s to %s"), '<strong>' . $start->strftime($prefs->getValue('date_format')) . '</strong>', '<strong>' . $end->strftime($prefs->getValue('date_format')) . '</strong>');
             }
         } else {
             $methods['notify']['subtitle'] = sprintf(_("From %s at %s to %s at %s"), '<strong>' . $start->strftime($prefs->getValue('date_format')), $start->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia') . '</strong>', '<strong>' . $end->strftime($prefs->getValue('date_format')), $this->end->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia') . '</strong>');
         }
     }
     if (isset($methods['mail'])) {
         $image = Kronolith::getImagePart('big_alarm.png');
         $view = new Horde_View(array('templatePath' => KRONOLITH_TEMPLATES . '/alarm', 'encoding' => 'UTF-8'));
         new Horde_View_Helper_Text($view);
         $view->event = $this;
         $view->imageId = $image->getContentId();
         $view->user = $user;
         $view->dateFormat = $prefs->getValue('date_format');
         $view->timeFormat = $prefs->getValue('twentyFour') ? 'H:i' : 'h:ia';
         $view->start = $start;
         if (!$prefs->isLocked('event_reminder')) {
             $view->prefsUrl = Horde::url($GLOBALS['registry']->getServiceLink('prefs', 'kronolith'), true)->remove(session_name());
         }
         if ($this->attendees) {
             $view->attendees = Kronolith::getAttendeeEmailList($this->attendees)->addresses;
         }
         $methods['mail']['mimepart'] = Kronolith::buildMimeMessage($view, 'mail', $image);
     }
     if (isset($methods['desktop'])) {
         if ($this->isAllDay()) {
             if ($this->start->compareDate($this->end) == 0) {
                 $methods['desktop']['subtitle'] = sprintf(_("On %s"), $start->strftime($prefs->getValue('date_format')));
             } else {
                 $methods['desktop']['subtitle'] = sprintf(_("From %s to %s"), $start->strftime($prefs->getValue('date_format')), $end->strftime($prefs->getValue('date_format')));
             }
         } else {
             $methods['desktop']['subtitle'] = sprintf(_("From %s at %s to %s at %s"), $start->strftime($prefs->getValue('date_format')), $start->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia'), $end->strftime($prefs->getValue('date_format')), $this->end->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia'));
         }
         $methods['desktop']['url'] = strval($this->getViewUrl(array(), true, false));
     }
     $alarmStart = clone $start;
     $alarmStart->min -= $this->alarm;
     $alarm = array('id' => $this->uid, 'user' => $user, 'start' => $alarmStart, 'end' => $end, 'methods' => array_keys($methods), 'params' => $methods, 'title' => $this->getTitle($user), 'text' => $this->description, 'instanceid' => $this->recurs() ? $eventDate->dateString() : null);
     $_SERVER['SERVER_NAME'] = $serverName;
     $GLOBALS['conf']['server']['name'] = $serverConf;
     return $alarm;
 }
Exemplo n.º 23
0
        $taskAlarmParams .= ' <label for="kronolithTaskAlarmParam' . $name . '">' . $param['desc'] . '</label> ';
        $taskNameAtt = 'name="task[methods][' . $method . '][' . $name . ']"';
        $taskAtt = 'id="kronolithTaskAlarmParam' . $name . '" ' . $taskNameAtt;
        switch ($param['type']) {
            case 'text':
                $eventAlarmParams .= '<input type="text" ' . $eventAtt . ' />';
                $taskAlarmParams .= '<input type="text" ' . $taskAtt . ' />';
                break;
            case 'boolean':
                $eventAlarmParams .= '<input type="checkbox" ' . $eventAtt . ' />';
                $taskAlarmParams .= '<input type="checkbox" ' . $taskAtt . ' />';
                break;
            case 'sound':
                $eventAlarmParams .= '<ul class="sound-list"><li><input type="radio" ' . $eventAtt . ' value="" checked="checked" /> ' . _("No Sound") . '</li>';
                $taskAlarmParams .= '<ul class="sound-list"><li><input type="radio" ' . $taskAtt . ' value="" checked="checked" /> ' . _("No Sound") . '</li>';
                foreach (Horde_Themes::soundList() as $key => $val) {
                    $sound = htmlspecialchars($key);
                    $value = sprintf('<li><input type="radio" id="%s%s" %s value="%s" /> <embed autostart="false" src="%s" /> %s</li>', '%s', $name . str_replace('.wav', '', $sound), '%s', $sound, htmlspecialchars($val->uri), $sound);
                    $eventAlarmParams .= sprintf($value, 'kronolithEventAlarmParam', $eventNameAtt);
                    $taskAlarmParams .= sprintf($value, 'kronolithTaskAlarmParam', $taskNameAtt);
                }
                $eventAlarmParams .= '</ul>';
                $taskAlarmParams .= '</ul>';
                break;
        }
        $eventAlarmParams .= '<br />';
        $taskAlarmParams .= '<br />';
    }
    $eventAlarmParams = substr($eventAlarmParams, 0, -6) . '</div>';
    $taskAlarmParams = substr($taskAlarmParams, 0, -6) . '</div>';
}
Exemplo n.º 24
0
 /**
  * Returns a link to display, download, and delete a file from the VFS
  * backend associated with this object.
  *
  * @param string $file  The file name.
  *
  * @return string  The HTML code of the generated link.
  */
 public function vfsEditUrl($file)
 {
     $delform = '<form action="' . Horde::url('deletefile.php') . '" style="display:inline" method="post">' . Horde_Util::formInput() . '<input type="hidden" name="file" value="' . htmlspecialchars($file['name']) . '" />' . '<input type="hidden" name="source" value="' . htmlspecialchars($this->driver->getName()) . '" />' . '<input type="hidden" name="key" value="' . htmlspecialchars($this->getValue('__key')) . '" />' . '<input type="image" class="img" src="' . Horde_Themes::img('delete.png') . '" />' . '</form>';
     return $this->vfsDisplayUrl($file) . ' ' . $delform;
 }
Exemplo n.º 25
0
<?php

global $prefs, $registry;
$kronolith_webroot = $registry->get('webroot');
$horde_webroot = $registry->get('webroot', 'horde');
$has_tasks = Kronolith::hasApiPermission('tasks');
/* Variables used in core javascript files. */
$code['conf'] = array('images' => array('attendees' => (string) Horde_Themes::img('attendees-fff.png'), 'alarm' => (string) Horde_Themes::img('alarm-fff.png'), 'recur' => (string) Horde_Themes::img('recur-fff.png'), 'exception' => (string) Horde_Themes::img('exception-fff.png')), 'user' => $GLOBALS['registry']->convertUsername($GLOBALS['registry']->getAuth(), false), 'prefs_url' => strval($registry->getServiceLink('prefs', 'kronolith')->setRaw(true)), 'name' => $registry->get('name'), 'has_tasks' => $has_tasks, 'default_calendar' => 'internal|' . Kronolith::getDefaultCalendar(Horde_Perms::EDIT), 'week_start' => (int) $prefs->getValue('week_start_monday'), 'max_events' => (int) $prefs->getValue('max_events'), 'date_format' => str_replace(array('%e', '%d', '%a', '%A', '%m', '%h', '%b', '%B', '%y', '%Y'), array('d', 'dd', 'ddd', 'dddd', 'MM', 'MMM', 'MMM', 'MMMM', 'yy', 'yyyy'), Horde_Nls::getLangInfo(D_FMT)), 'time_format' => $prefs->getValue('twentyFour') ? 'HH:mm' : 'hh:mm tt', 'status' => array('tentative' => Kronolith::STATUS_TENTATIVE, 'confirmed' => Kronolith::STATUS_CONFIRMED, 'cancelled' => Kronolith::STATUS_CANCELLED, 'free' => Kronolith::STATUS_FREE), 'recur' => array(Horde_Date_Recurrence::RECUR_NONE => 'None', Horde_Date_Recurrence::RECUR_DAILY => 'Daily', Horde_Date_Recurrence::RECUR_WEEKLY => 'Weekly', Horde_Date_Recurrence::RECUR_MONTHLY_DATE => 'Monthly', Horde_Date_Recurrence::RECUR_MONTHLY_WEEKDAY => 'Monthly', Horde_Date_Recurrence::RECUR_MONTHLY_LAST_WEEKDAY => 'Monthly', Horde_Date_Recurrence::RECUR_YEARLY_DATE => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_DAY => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_WEEKDAY => 'Yearly'), 'perms' => array('all' => Horde_Perms::ALL, 'show' => Horde_Perms::SHOW, 'read' => Horde_Perms::READ, 'edit' => Horde_Perms::EDIT, 'delete' => Horde_Perms::DELETE, 'delegate' => Kronolith::PERMS_DELEGATE));
if ($has_tasks) {
    $code['conf']['tasks'] = $registry->tasks->ajaxDefaults();
}
// Calendars
foreach (array(true, false) as $my) {
    foreach ($GLOBALS['calendar_manager']->get(Kronolith::ALL_CALENDARS) as $id => $calendar) {
        $owner = $GLOBALS['registry']->getAuth() && $calendar->owner() == $GLOBALS['registry']->getAuth();
        if ($my && $owner || !$my && !$owner) {
            $code['conf']['calendars']['internal'][$id] = array('name' => ($owner || !$calendar->owner() ? '' : '[' . $GLOBALS['registry']->convertUsername($calendar->owner(), false) . '] ') . $calendar->name(), 'desc' => $calendar->description(), 'owner' => $owner, 'fg' => $calendar->foreground(), 'bg' => $calendar->background(), 'show' => in_array($id, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS)), 'edit' => $calendar->hasPermission(Horde_Perms::EDIT), 'feed' => (string) Kronolith::feedUrl($id), 'embed' => Kronolith::embedCode($id));
            if ($owner) {
                $code['conf']['calendars']['internal'][$id]['perms'] = Kronolith::permissionToJson($calendar->share()->getPermission());
            }
        }
    }
    // Tasklists
    if (!$has_tasks) {
        continue;
    }
    foreach ($registry->tasks->listTasklists($my, Horde_Perms::SHOW) as $id => $tasklist) {
        $owner = $GLOBALS['registry']->getAuth() && $tasklist->get('owner') == $GLOBALS['registry']->getAuth();
        if ($my && $owner || !$my && !$owner) {
            $code['conf']['calendars']['tasklists']['tasks/' . $id] = array('name' => Kronolith::getLabel($tasklist), 'desc' => $tasklist->get('desc'), 'owner' => $owner, 'fg' => Kronolith::foregroundColor($tasklist), 'bg' => Kronolith::backgroundColor($tasklist), 'show' => in_array('tasks/' . $id, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_EXTERNAL_CALENDARS)), 'edit' => $tasklist->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT));
            if ($owner) {
Exemplo n.º 26
0
/**
 * This file is the basic display of the Inventory application for Horde,
 * Sesha. It should also be able to display search results and other useful
 * things.
 *
 * Copyright 2004-2007 Andrew Coleman <*****@*****.**>
 * Copyright 2004-2014 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('sesha');
$topbar = $injector->getInstance('Horde_View_Topbar');
$topbar->search = true;
$topbar->searchAction = new Horde_Url('list.php');
$topbar->searchLabel = _("Stock ID");
$topbar->searchIcon = Horde_Themes::img('search-topbar.png');
// Page variables.
$title = _("Search Inventory");
$actionId = Horde_Util::getFormData('actionId');
// Form creation.
$vars = Horde_Variables::getDefaultVariables();
$renderer = new Horde_Form_Renderer();
$form = new Sesha_Form_Search($vars);
$vars->set('location', array(Sesha::SEARCH_NAME));
// Page display.
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
$form->renderActive($renderer, $vars, Horde::url('list.php'), 'post');
$page_output->footer();
Exemplo n.º 27
0
$url = new Horde_Url('icon_browser.php');
$vars = $injector->getInstance('Horde_Variables');
if (($app = basename($vars->app)) && in_array($app, $apps)) {
    $img = Horde_Themes::img(null, array('app' => $app, 'theme' => 'default'));
    $img_fs = $img->fs;
    // Throws Exception on error.
    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($img_fs));
    // Provide a non-white background for eyeballing transparency.
    echo '<html><body bgcolor="#aaaaaa">' . '<h2>' . sprintf(_("Icons for %s"), $registry->get('name', $app)) . '</h2>';
    foreach ($iterator as $val) {
        if ($val->isFile() && in_array(substr($val->getFilename(), -4), array('.png', '.gif', 'jpg'))) {
            $imgs[] = strval($val);
        }
    }
    if (count($imgs)) {
        natsort($imgs);
        foreach ($imgs as $img) {
            echo Horde_Themes_Image::tag(Horde_Themes::img(str_replace($img_fs . DIRECTORY_SEPARATOR, '', $img), array('app' => $app, 'theme' => 'default')), array('alt' => $img, 'attr' => array('hspace' => 10, 'title' => $img, 'vspace' => 10)));
        }
    } else {
        echo _("No icons found.");
    }
    echo '<p /><a href="' . $url . '">Return to app browser</a></body></html>';
} else {
    // List apps.
    foreach ($apps as $app) {
        if ($name = $registry->get('name', $app)) {
            echo Horde::link($url->add('app', $app)) . htmlspecialchars($name) . ' [' . htmlspecialchars($app) . ']</a><br />';
        }
    }
}
Exemplo n.º 28
0
if (isset($conf['urls']['pretty']) && $conf['urls']['pretty'] == 'rewrite') {
    $self_url = Horde::url('feed/' . $calendar, true, -1);
} else {
    $self_url = Horde::url('feed/index.php', true, -1)->add('c', $calendar);
}
$owner = $share->get('owner');
$identity = $injector->getInstance('Horde_Core_Factory_Identity')->create($owner);
$history = $injector->getInstance('Horde_History');
$now = new Horde_Date(time());
$template = $injector->createInstance('Horde_Template');
$template->set('updated', $now->format(DATE_ATOM));
$template->set('kronolith_name', 'Kronolith');
$template->set('kronolith_version', $registry->getVersion());
$template->set('kronolith_uri', 'http://www.horde.org/kronolith/');
$template->set('kronolith_icon', Horde::url(Horde_Themes::img('kronolith.png'), true, -1));
$template->set('xsl', Horde_Themes::getFeedXsl());
$template->set('calendar_name', htmlspecialchars($share->get('name')));
$template->set('calendar_desc', htmlspecialchars($share->get('desc')), true);
$template->set('calendar_owner', htmlspecialchars($identity->getValue('fullname')));
$template->set('calendar_email', htmlspecialchars($identity->getValue('from_addr')), true);
$template->set('self_url', $self_url);
$twentyFour = $prefs->getValue('twentyFor');
$entries = array();
foreach ($events as $day_events) {
    foreach ($day_events as $id => $event) {
        /* Modification date. */
        $modified = $history->getActionTimestamp('kronolith:' . $calendar . ':' . $event->uid, 'modify');
        if (!$modified) {
            $modified = $history->getActionTimestamp('kronolith:' . $calendar . ':' . $event->uid, 'add');
        }
        $modified = new Horde_Date($modified);
Exemplo n.º 29
0
 /**
  * Return icon information.
  *
  * @return object  Object with the following properties:
  *   - alt
  *   - class
  *   - icon
  *   - iconopen
  *   - user_icon
  */
 protected function _getIcon()
 {
     global $injector;
     $info = new stdClass();
     $info->iconopen = null;
     $info->user_icon = false;
     if ($this->container) {
         /* We are dealing with folders here. */
         if ($this->is_open) {
             $info->alt = _("Opened Folder");
             $info->class = 'folderopenImg';
             $info->icon = 'folders/open.png';
         } else {
             $info->alt = _("Folder");
             $info->class = 'folderImg';
             $info->icon = 'folders/folder.png';
             $info->iconopen = Horde_Themes::img('folders/open.png');
         }
     } elseif ($this->remote_container) {
         $info->alt = _("Remote Account");
         $info->class = 'remoteImg';
         $info->icon = 'shared.png';
     } else {
         $special = $this->getSpecialMailboxes();
         switch ($this->_mbox) {
             case 'INBOX':
                 $info->alt = _("Inbox");
                 $info->class = 'inboxImg';
                 $info->icon = 'folders/inbox.png';
                 break;
             case $special[self::SPECIAL_COMPOSETEMPLATES]:
                 $info->alt = "Templates";
                 $info->class = 'composetemplatesImg';
                 $info->icon = 'folders/drafts.png';
                 break;
             case $special[self::SPECIAL_DRAFTS]:
                 $info->alt = _("Drafts");
                 $info->class = 'draftsImg';
                 $info->icon = 'folders/drafts.png';
                 break;
             case $special[self::SPECIAL_SPAM]:
                 $info->alt = _("Spam");
                 $info->class = 'spamImg';
                 $info->icon = 'folders/spam.png';
                 break;
             case $special[self::SPECIAL_TRASH]:
                 $info->alt = _("Trash");
                 $info->class = 'trashImg';
                 $info->icon = 'folders/trash.png';
                 break;
             default:
                 if (in_array($this->_mbox, $special[self::SPECIAL_SENT])) {
                     $info->alt = _("Sent");
                     $info->class = 'sentImg';
                     $info->icon = 'folders/sent.png';
                 } else {
                     $info->alt = in_array($this->_mbox, $special[self::SPECIAL_USER]) ? $this->display : _("Mailbox");
                     if ($this->is_open) {
                         $info->class = 'folderopenImg';
                         $info->icon = 'folders/open.png';
                     } else {
                         $info->class = 'folderImg';
                         $info->icon = 'folders/folder.png';
                     }
                 }
                 break;
         }
         /* Virtual folders. */
         if ($this->vfolder) {
             $imp_search = $injector->getInstance('IMP_Search');
             if ($imp_search->isVTrash($this->_mbox)) {
                 $info->alt = $imp_search[$this->_mbox]->label;
                 $info->class = 'trashImg';
                 $info->icon = 'folders/trash.png';
             } elseif ($imp_search->isVinbox($this->_mbox)) {
                 $info->alt = $imp_search[$this->_mbox]->label;
                 $info->class = 'inboxImg';
                 $info->icon = 'folders/inbox.png';
             }
         }
     }
     /* Overwrite the icon information now. */
     $mi = $injector->getInstance('IMP_Mailbox_SessionCache')->getIcons($this->_mbox);
     if (!empty($mi)) {
         if (isset($mi['alt'])) {
             $info->alt = $mi['alt'];
         }
         $info->icon = strval($mi['icon']);
         $info->user_icon = true;
     } elseif ($info->icon) {
         $info->icon = Horde_Themes::img($info->icon);
     }
     return $info;
 }
Exemplo n.º 30
0
Arquivo: Icon.php Projeto: horde/horde
 /**
  */
 public function __toString()
 {
     return strval(Horde_Themes::img($this->_path)->fulluri);
 }