Beispiel #1
0
 /**
  * Renders this page in content mode.
  *
  * @return string  The page content.
  * @throws Wicked_Exception
  */
 public function content()
 {
     global $wicked;
     $days = (int) Horde_Util::getGet('days', 3);
     $summaries = $wicked->getRecentChanges($days);
     if (count($summaries) < 10) {
         $summaries = $wicked->mostRecent(10);
     }
     $bydate = array();
     $changes = array();
     foreach ($summaries as $page) {
         $page = new Wicked_Page_StandardPage($page);
         $createDate = $page->versionCreated();
         $tm = localtime($createDate, true);
         $createDate = mktime(0, 0, 0, $tm['tm_mon'], $tm['tm_mday'], $tm['tm_year'], $tm['tm_isdst']);
         $version_url = $page->pageUrl()->add('version', $page->version());
         $diff_url = Horde::url('diff.php')->add(array('page' => $page->pageName(), 'v1' => '?', 'v2' => $page->version()));
         $diff_alt = sprintf(_("Show changes for %s"), $page->version());
         $diff_img = Horde::img('diff.png', $diff_alt);
         $pageInfo = array('author' => $page->author(), 'name' => $page->pageName(), 'url' => $page->pageUrl(), 'version' => $page->version(), 'version_url' => $version_url, 'version_alt' => sprintf(_("Show version %s"), $page->version()), 'diff_url' => $diff_url, 'diff_alt' => $diff_alt, 'diff_img' => $diff_img, 'created' => $page->formatVersionCreated(), 'change_log' => $page->changeLog());
         $bydate[$createDate][$page->versionCreated()][$page->version()] = $pageInfo;
     }
     krsort($bydate);
     foreach ($bydate as $bysecond) {
         $day = array();
         krsort($bysecond);
         foreach ($bysecond as $pageList) {
             krsort($pageList);
             $day = array_merge($day, array_values($pageList));
         }
         $changes[] = array('date' => $day[0]['created'], 'pages' => $day);
     }
     return $changes;
 }
Beispiel #2
0
 public static function bookmarkletLink()
 {
     $view = $GLOBALS['injector']->createInstance('Horde_View');
     $view->url = Horde::url('add.php', true, array('append_session' => -1))->add('popup', 1);
     $view->image = Horde::img('add.png');
     return $view->render('bookmarklet');
 }
Beispiel #3
0
 /**
  */
 protected function _content()
 {
     try {
         $channels = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannels();
     } catch (Jonah_Exception $e) {
         $channels = array();
     }
     $html = '';
     foreach ($channels as $key => $channel) {
         /* Link for HTML delivery. */
         $url = Horde::url('delivery/html.php')->add('channel_id', $channel['channel_id']);
         $label = sprintf(_("\"%s\" stories in HTML"), $channel['channel_name']);
         $html .= '<tr><td width="140">' . Horde::img('story_marker.png') . ' ' . $url->link(array('title' => $label)) . htmlspecialchars($channel['channel_name']) . '</a></td>';
         $html .= '<td>' . ($channel['channel_updated'] ? date('M d, Y H:i', (int) $channel['channel_updated']) : '-') . '</td>';
         /* Link for feed delivery. */
         $url = Horde::url('delivery/rss.php', true, -1)->add('channel_id', $channel['channel_id']);
         $label = sprintf(_("RSS Feed of \"%s\""), $channel['channel_name']);
         $html .= '<td align="right" class="nowrap">' . $url->link(array('title' => $label)) . Horde::img('feed.png') . '</a> ';
     }
     if ($html) {
         return '<table cellspacing="0" width="100%" class="linedRow striped">' . $html . '</table>';
     } else {
         return '<p><em>' . _("No feeds are available.") . '</em></p>';
     }
 }
Beispiel #4
0
 function _content()
 {
     if (empty($this->_params['location'])) {
         return _("No location is set.");
     }
     // Set the timezone variable, if available.
     NLS::setTimeZone();
     list($lat, $long) = explode(':', $this->_params['location']);
     $rise = $this->_calculateSunset(time(), $lat, $long, false, floor(date('Z') / 3600));
     $set = $this->_calculateSunset(time(), $lat, $long, true, floor(date('Z') / 3600));
     $location = '';
     global $coordinates;
     if (!is_array($coordinates)) {
         require HORDE_LIBS . 'Horde/NLS/coordinates.php';
     }
     foreach ($coordinates as $country) {
         if (array_key_exists($this->_params['location'], $country)) {
             $location = $country[$this->_params['location']];
             break;
         }
     }
     $html = '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
     $html .= '<td colspan="2" class="control"><b>' . $location . '</b></td></tr><tr height="100%">';
     $html .= '<td width="50%" align="center">';
     $html .= Horde::img('block/sunrise/sunrise.gif', _("Sun Rise"));
     $html .= '<br/>' . $rise;
     $html .= '</td>';
     $html .= '<td width="50%" align="center">';
     $html .= Horde::img('block/sunrise/sunset.gif', _("Sun Set"));
     $html .= '<br/>' . $set;
     $html .= '</td>';
     $html .= '</tr></table>';
     return $html;
 }
Beispiel #5
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>';
 }
Beispiel #6
0
 /**
  * The title to go in this block.
  *
  * @return string   The title text.
  */
 function _title()
 {
     global $registry;
     $title = isset($this->_params['title']) ? $this->_params['title'] : $this->_params['iframe'];
     $html = Horde::link($this->_params['iframe'], $title, 'header') . $title . '</a>';
     $html .= Horde::link($this->_params['iframe'], _("Open in a new window"), 'smallheader', '_new') . Horde::img('webserver.gif', _("Open in a new window"), 'hspace="5"', Horde::url($registry->getParam('graphics'), true, -1)) . _("Open in a new window") . '</a>';
     return $html;
 }
Beispiel #7
0
 /**
  * Render tag field.
  */
 protected function _renderVarInput_KronolithTags($form, $var, $vars)
 {
     $varname = htmlspecialchars($var->getVarName());
     $value = $var->getValue($vars);
     $html = sprintf('<input id="%s" type="text" name="%s" value="%s" />', $varname, $varname, $value);
     $html .= sprintf('<span id="%s_loading_img" style="display:none;">%s</span>', $varname, Horde::img('loading.gif', _("Loading...")));
     $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('Kronolith_Ajax_Imple_TagAutoCompleter', array('id' => $varname));
     return $html;
 }
Beispiel #8
0
 protected function _title()
 {
     global $prefs;
     $prev = new Horde_Date($this->_start);
     $prev->mday--;
     $next = new Horde_Date($this->_start);
     $next->mday++;
     return Horde::url('#')->link(array('title' => _("Previous Day"), 'onclick' => 'return switchDate(' . $prev->dateString() . ');')) . Horde::img('nav/left.png', '<') . '</a>' . $this->_start->strftime($prefs->getValue('date_format')) . Horde::url('#')->link(array('title' => _("Next Day"), 'onclick' => 'return switchDate(' . $next->dateString() . ');')) . Horde::img('nav/right.png', '>') . '</a>';
 }
Beispiel #9
0
 protected function _title()
 {
     $end = new Horde_Date($this->_start);
     $end->mday += $this->_days - 1;
     $prev = new Horde_Date($this->_start);
     $prev->month--;
     $next = new Horde_Date($this->_start);
     $next->month++;
     return Horde::url('#')->link(array('title' => _("Previous Month"), 'onclick' => 'return switchDate(' . $prev->dateString() . ');')) . Horde::img('nav/left.png', '<') . '</a>' . $this->_start->strftime('%B %Y') . Horde::url('#')->link(array('title' => _("Next Month"), 'onclick' => 'return switchDate(' . $next->dateString() . ');')) . Horde::img('nav/right.png', '>') . '</a>';
 }
Beispiel #10
0
 function _content()
 {
     $phases = $this->_calculateMoonPhases(date('Y'));
     $now = time();
     $lastNew = 0;
     $lastNewStamp = 0;
     $offset = 0;
     foreach ($phases as $key => $val) {
         if ($key < $now && $key > $lastNewStamp && $val == _("New Moon")) {
             $lastNew = $offset;
             $lastNewStamp = $key;
         }
         $offset++;
     }
     if (isset($this->_params['phase']) && $this->_params['phase'] == 'next') {
         $dates = array_slice(array_keys($phases), $lastNew + 4, 4);
     } else {
         $dates = array_slice(array_keys($phases), $lastNew, 4);
     }
     if (isset($this->_params['hemisphere']) && $this->_params['hemisphere'] == 'northern') {
         $location = _("Northern Hemisphere");
     } else {
         $location = _("Southern Hemisphere");
     }
     $html = '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">';
     $html .= '<tr><td colspan="4" class="control"><b>' . $location . '</b></td></tr>';
     $html .= '<tr height="100%"><td width="25%" align="center">';
     $html .= Horde::img('block/moon/newmoon.gif', _("New Moon"));
     $html .= '<br/>' . strftime('%d %b', $dates[0]);
     $html .= '</td>';
     $html .= '<td width="25%" align="center">';
     if (isset($this->_params['hemisphere']) && $this->_params['hemisphere'] == 'northern') {
         $html .= Horde::img('block/moon/lastquarter.gif', _("First Quarter"));
     } else {
         $html .= Horde::img('block/moon/firstquarter.gif', _("First Quarter"));
     }
     $html .= '<br/>' . strftime('%d %b', $dates[1]);
     $html .= '</td>';
     $html .= '<td width="25%" align="center">';
     $html .= Horde::img('block/moon/fullmoon.gif', _("Full Moon"));
     $html .= '<br/>' . strftime('%d %b', $dates[2]);
     $html .= '</td>';
     $html .= '<td width="25%" align="center">';
     if (isset($this->_params['hemisphere']) && $this->_params['hemisphere'] == 'northern') {
         $html .= Horde::img('block/moon/firstquarter.gif', _("Last Quarter"));
     } else {
         $html .= Horde::img('block/moon/lastquarter.gif', _("Last Quarter"));
     }
     $html .= '<br/>' . strftime('%d %b', $dates[3]);
     $html .= '</td>';
     $html .= "</tr></table>";
     return $html;
 }
Beispiel #11
0
 /**
  * The content to go in this block.
  *
  * @return string   The content
  */
 function _content()
 {
     require_once __DIR__ . '/../base.php';
     global $prefs, $klutz, $klutz_driver;
     $showall = $prefs->getValue('summ_showall');
     $date = time();
     // Get the list of comics to display.
     $comics = explode("\t", $prefs->getValue('viewcomics'));
     if (count($comics) == 1 && empty($comics[0])) {
         $comics = null;
     }
     $comicstoday = $klutz->listEnabled($comics, $date);
     if ($showall) {
         $summary = '';
         foreach ($comicstoday as $index) {
             $name = $klutz->getProperty($index, 'name');
             $author = $klutz->getProperty($index, 'author');
             if ($klutz_driver->imageExists($index, $date)) {
                 $size = $klutz_driver->imageSize($index, $date);
                 $url = Horde::url('comics.php')->add(array('date' => $date, 'index' => $index));
                 $img = Horde::img($url->copy()->add('actionID', 'image'), sprintf("%s by %s", $name, $author), $size, '');
                 $link = Horde::link($url->copy()->add('actionID', 'comic'), sprintf("%s by %s", $name, $author));
                 $summary .= '<p>' . $link . $img . '</a></p>';
             }
         }
     } else {
         $this->updateable = true;
         // Pick a comic from the list and make sure it exists.
         do {
             // Make sure we actually have some comics to choose
             // from.
             if (!count($comicstoday)) {
                 return _("Could not find any comics to display.");
             }
             // Pick a comic by random and remove it from the list.
             $i = rand(0, count($comicstoday) - 1);
             $tmp = array_splice($comicstoday, $i, 1);
             $index = array_shift($tmp);
         } while ($klutz_driver->imageExists($index, $date) === false);
         $name = $klutz->getProperty($index, 'name');
         $author = $klutz->getProperty($index, 'author');
         $size = $klutz_driver->imageSize($index, $date);
         $url = Horde::url('comics.php')->add(array('date' => $date, 'index' => $index));
         $img = Horde::img($url->copy()->add('actionID', 'image'), sprintf("%s by %s", $name, $author), $size, '');
         $link = Horde::link($url->copy()->add('actionID', 'comic'), sprintf("%s by %s", $name, $author));
         $summary = '<p class="text">' . $link . $name . ' by ' . $author . '</a></p>' . '<p>' . $link . $img . '</a></p>';
     }
     return $summary;
 }
Beispiel #12
0
 /**
  * Get breadcrumb style navigation html for choosen tags
  *
  * @return string  HTML necessary for displaying the tag trail.
  */
 public function getTagTrail()
 {
     global $registry;
     $html = '<ul class="horde-tags">';
     // Use the local cache to preserve the order
     $count = 0;
     foreach ($this->_tags as $tagname => $tagid) {
         $remove_url = Horde::url('view.php', true)->add(array('view' => 'Results', 'tag' => $tagname, 'actionID' => 'remove'));
         if (!empty($this->_owner)) {
             $remove_url->add('owner', $this->_owner);
         }
         $delete_label = sprintf(_("Remove %s from search"), htmlspecialchars($tagname));
         $html .= '<li>' . htmlspecialchars($tagname) . $remove_url->link(array('title' => $delete_label)) . Horde::img('delete-small.png', $delete_label) . '</a></li>';
     }
     return $html . '</ul>';
 }
Beispiel #13
0
 /**
  *
  */
 public function run()
 {
     extract($this->_params, EXTR_REFS);
     try {
         $channels = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannels();
     } catch (Exception $e) {
         $notification->push(sprintf(_("An error occurred fetching channels: %s"), $e->getMessage()), 'horde.error');
         $channels = false;
     }
     if ($channels) {
         $channels = Jonah::checkPermissions('channels', Horde_Perms::SHOW, $channels);
         /* Build channel specific fields. */
         foreach ($channels as $key => $channel) {
             /* Edit channel link. */
             $url = Horde::url('channels/edit.php')->add('channel_id', $channel['channel_id']);
             $channels[$key]['edit_link'] = $url->link(array('title' => _("Edit channel"))) . Horde::img('edit.png') . '</a>';
             /* Delete channel link. */
             $url = Horde::url('channels/delete.php')->add('channel_id', $channel['channel_id']);
             $channels[$key]['delete_link'] = $url->link(array('title' => _("Delete channel"))) . Horde::img('delete.png') . '</a>';
             /* View stories link. */
             $channels[$key]['stories_url'] = Horde::url('stories/index.php')->add('channel_id', $channel['channel_id']);
             /* Channel type specific links. */
             $channels[$key]['addstory_link'] = '';
             $channels[$key]['refresh_link'] = '';
             switch ($channel['channel_type']) {
                 case Jonah::INTERNAL_CHANNEL:
                     /* Add story link. */
                     $url = Horde::url('stories/edit.php')->add('channel_id', $channel['channel_id']);
                     $channels[$key]['addstory_link'] = $url->link(array('title' => _("Add story"))) . Horde::img('new.png') . '</a>';
                     break;
             }
             $channels[$key]['channel_type'] = Jonah::getChannelTypeLabel($channel['channel_type']);
             $channels[$key]['channel_updated'] = $channel['channel_updated'] ? strftime($prefs->getValue('date_format'), (int) $channel['channel_updated']) : '-';
         }
     }
     $view = new Horde_View(array('templatePath' => JONAH_TEMPLATES . '/view'));
     $view->addHelper('Tag');
     $view->channels = $channels;
     $view->search_img = Horde::img('search.png');
     global $page_output;
     $page_output->addScriptFile('tables.js', 'horde');
     $page_output->addScriptFile('quickfinder.js', 'horde');
     $page_output->header(array('title' => _("Feeds")));
     $notification->notify(array('listeners' => 'status'));
     echo $view->render('channellist');
     $page_output->footer();
 }
Beispiel #14
0
 /**
  * The content to go in this block.
  *
  * @return string   The content
  */
 function _content()
 {
     $html = '<form name="google" onsubmit="open_google_win(); return false;">';
     $html .= '<table width="100%" height="100%">';
     $html .= '<tr><script language="JavaScript" type="text/javascript" src="' . $GLOBALS['registry']->getParam('webroot', 'horde') . '/services/javascript.php?file=open_google_win.js&amp;app=horde"></script>';
     $html .= '<td>' . Horde::img('google.png', 'Google') . '</td></tr>';
     $html .= '<tr><td><input maxLength="256" size="40" name="q" width="100%" /></td></tr>';
     $html .= '<tr><td><table width="100%"><tr><td align="center"><input type="radio" name="area" value="web" width="20%" checked="checked" />' . _("Web") . '</td>';
     $html .= '<td align="center"><input type="radio" name="area" value="images" width="20%" />' . _("Images") . '</td>';
     $html .= '<td align="center"><input type="radio" name="area" value="groups" width="20%" />' . _("Groups") . '</td>';
     $html .= '<td align="center"><input type="radio" name="area" value="directory" width="20%" />' . _("Directory") . '</td>';
     $html .= '<td align="center"><input type="radio" name="area" value="news" width="20%" />' . _("News") . '</td></tr></table></td></tr>';
     $html .= '<tr><td><input type="submit" class="button" value="' . _("Google Search") . '" /></td></tr>';
     $html .= '</table>';
     $html .= '</form>';
     return $html;
 }
Beispiel #15
0
 /**
  */
 protected function _content()
 {
     $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getRandomGallery();
     if (!$gallery) {
         return _("There are no photo galleries available.");
     }
     $imagelist = $gallery->listImages(rand(0, $gallery->countImages() - 1), 1);
     if (empty($imagelist)) {
         return '';
     }
     $imageId = $imagelist[0];
     $viewurl = Ansel::getUrlFor('view', array('gallery' => $gallery->id, 'slug' => $gallery->get('slug'), 'image' => $imageId, 'view' => 'Image'), true);
     if ($gallery->isOldEnough() && !$gallery->hasPasswd()) {
         $img = '<img src="' . Ansel::getImageUrl($imageId, 'thumb', true, Ansel::getStyleDefinition('ansel_default')) . '" alt="[random photo]" />';
     } else {
         $img = Horde::img('thumb-error.png');
     }
     return $viewurl->link(array('title' => _("View Photo"))) . $img . '</a>';
 }
Beispiel #16
0
 /**
  * Construct a new Horde_Form_Renderer::.
  *
  * @param array $params  This is a hash of renderer-specific parameters.
  *                       Possible keys:
  *                       - 'varrenderer_driver': specifies the driver
  *                         parameter to Horde_Core_Ui_VarRenderer::factory().
  *                       - 'encode_title': @see $_encodeTitle
  */
 function Horde_Form_Renderer($params = array())
 {
     global $registry;
     if (isset($registry) && is_a($registry, 'Registry')) {
         /* Registry available, so use a pretty image. */
         $this->_requiredMarker = Horde::img('required.png', '*');
     } else {
         /* No registry available, use something plain. */
         $this->_requiredMarker = '*';
     }
     if (isset($params['encode_title'])) {
         $this->encodeTitle($params['encode_title']);
     }
     $driver = 'html';
     if (isset($params['varrenderer_driver'])) {
         $driver = $params['varrenderer_driver'];
     }
     $this->_varRenderer = Horde_Core_Ui_VarRenderer::factory($driver, $params);
 }
Beispiel #17
0
 /**
  */
 protected function _content()
 {
     try {
         $gallery = $this->_getGallery();
     } catch (Ansel_Exception $e) {
         return $e->getMessage();
     }
     $params = array('gallery_id' => $gallery->id, 'count' => $this->_params['perpage']);
     if (!empty($this->_params['use_lightbox'])) {
         $params['lightbox'] = true;
     }
     $html = Ansel::embedCode($params);
     // Be nice to people with <noscript>
     $viewurl = Ansel::getUrlFor('view', array('view' => 'Gallery', 'gallery' => $gallery->id, 'slug' => $gallery->get('slug')), true);
     $html .= '<noscript>';
     $html .= $viewurl->link(array('title' => sprintf(_("View %s"), $gallery->get('name'))));
     if ($iid = $gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')) && $gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
         $html .= '<img src="' . Ansel::getImageUrl($gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')), 'thumb', true) . '" alt="' . htmlspecialchars($gallery->get('name')) . '" />';
     } else {
         $html .= Horde::img('thumb-error.png');
     }
     return $html . '</a></noscript>';
 }
Beispiel #18
0
 /**
  * Returns a correcty formatted exception date for recurring events and a
  * link to delete this exception.
  *
  * @param string $date  Exception in the format Ymd.
  *
  * @return string  The formatted date and delete link.
  */
 public function exceptionLink($date)
 {
     if (!preg_match('/(\\d{4})(\\d{2})(\\d{2})/', $date, $match)) {
         return '';
     }
     $horde_date = new Horde_Date(array('year' => $match[1], 'month' => $match[2], 'mday' => $match[3]));
     $formatted = $horde_date->strftime($GLOBALS['prefs']->getValue('date_format'));
     return $formatted . Horde::url('edit.php')->add(array('calendar' => $this->calendarType . '_' . $this->calendar, 'eventID' => $this->id, 'del_exception' => $date, 'url' => Horde_Util::getFormData('url')))->link(array('title' => sprintf(_("Delete exception on %s"), $formatted))) . Horde::img('delete-small.png', _("Delete")) . '</a>';
 }
Beispiel #19
0
    /**
     * Render this page in Display mode.
     *
     * @throws Wicked_Exception
     */
    public function display()
    {
        $version = Horde_Util::getFormData('version');
        $page = Wicked_Page::getPage($this->referrer(), $version);
        if (!$page->isValid()) {
            Wicked::url('Wiki/Home', true)->redirect();
        }
        if (empty($version)) {
            $msg = _("Are you sure you want to delete this page? All versions will be permanently removed.");
        } else {
            $msg = sprintf(_("Are you sure you want to delete version %s of this page?"), $page->version());
        }
        ?>
<form method="post" name="deleteform" action="<?php 
        echo Wicked::url('DeletePage');
        ?>
">
<?php 
        Horde_Util::pformInput();
        ?>
<input type="hidden" name="page" value="DeletePage" />
<input type="hidden" name="actionID" value="special" />
<input type="hidden" name="version" value="<?php 
        echo htmlspecialchars($version);
        ?>
" />
<input type="hidden" name="referrer" value="<?php 
        echo htmlspecialchars($page->pageName());
        ?>
" />

<h1 class="header">
 <?php 
        echo _("Delete Page") . ': ' . Horde::link($page->pageUrl()) . htmlspecialchars($page->pageName()) . '</a> ';
        if ($page->isLocked()) {
            echo Horde::img('locked.png', _("Locked"));
        }
        ?>
</h1>

<div class="headerbox" style="padding:4px">
 <p><?php 
        echo $msg;
        ?>
</p>
 <p>
  <input type="submit" value="<?php 
        echo _("Delete");
        ?>
" class="horde-delete" />
  <a class="horde-cancel" href="<?php 
        echo Wicked::url($page->pageName());
        ?>
"><?php 
        echo _("Cancel");
        ?>
</a>
 </p>
</div>

</form>
<?php 
    }
Beispiel #20
0
 /**
  * Constructs message attachments link.
  *
  * @throws Agora_Exception
  */
 public function getAttachmentLink($message_id)
 {
     if (!$this->allowAttachments()) {
         return '';
     }
     $sql = 'SELECT file_id, file_name, file_size, file_type FROM agora_files WHERE message_id = ?';
     try {
         $files = $this->_db->select($sql, array($message_id));
     } catch (Horde_Db_Exception $e) {
         throw new Agora_Exception($e->getMessage());
     }
     if (empty($files)) {
         return $files;
     }
     /* Constuct the link with a tooltip for further info on the download. */
     $html = '<br />';
     $view_url = Horde::url('view.php');
     foreach ($files as $file) {
         $mime_icon = $GLOBALS['injector']->getInstance('Horde_Core_Factory_MimeViewer')->getIcon($file['file_type']);
         $title = _("download") . ': ' . $file['file_name'];
         $tooltip = $title . "\n" . sprintf(_("size: %s"), $this->formatSize($file['file_size'])) . "\n" . sprintf(_("type: %s"), $file['file_type']);
         $url = $view_url->add(array('forum_id' => $this->_forum_id, 'message_id' => $message_id, 'file_id' => $file['file_id'], 'file_name' => $file['file_name'], 'file_type' => $file['file_type']));
         $html .= Horde::linkTooltip($url, $title, '', '', '', $tooltip) . Horde::img($mime_icon, $title, 'align="middle"', '') . '&nbsp;' . $file['file_name'] . '</a>&nbsp;&nbsp;<br />';
     }
     return $html;
 }
Beispiel #21
0
 /**
  * Does a series of checks for a given user to determine the status.
  *
  * @param array $user  The user's details in an array as returned by the
  *                     getUser() function.
  *
  * @return array  Either an array of error messages found during the checks
  *                or an array with a single element stating that the user
  *                is ready.
  * @throws Vilma_Exception if an error occurs looking up the user status.
  */
 public function getUserStatus($user)
 {
     /* Some needed vars. */
     $error = false;
     $status = array();
     $domain_name = Vilma::stripDomain($user['user_name']);
     $user_name = Vilma::stripUser($user['user_name']);
     /* Check if user enabled. */
     if ($user['user_enabled'] !== 'active') {
         $error = true;
         $err_msg = _("User disabled.");
         $status[] = Horde::img('alerts/error.png', $err_msg) . '&nbsp;' . $err_msg;
     }
     /* Check if mailbox exists. */
     try {
         Vilma_MailboxDriver::factory()->checkMailbox($user_name, $domain_name);
     } catch (Exception $result) {
         $error = true;
         $err_msg = $result->getMessage();
         $status[] = Horde::img('alerts/warning.png', $err_msg) . '&nbsp;' . $err_msg;
     }
     /* TODO: Quota checking would be nice too. */
     /* If no errors have been found output a success message for this
      * user's status. */
     if (!$error) {
         $msg = _("User ready.");
         $status = array(Horde::img('alerts/success.png', $msg) . '&nbsp;' . $msg);
     }
     return $status;
 }
Beispiel #22
0
    /**
     * Renders this page in display mode.
     *
     * @throws Wicked_Exception
     */
    public function display()
    {
        $version = Horde_Util::getFormData('version');
        $page = Wicked_Page::getPage($this->referrer(), $version);
        $msg = sprintf(_("Are you sure you want to revert to version %s of this page?"), $version);
        ?>
<form method="post" name="revertform" action="<?php 
        echo Wicked::url('RevertPage');
        ?>
">
<?php 
        Horde_Util::pformInput();
        ?>
<input type="hidden" name="page" value="RevertPage" />
<input type="hidden" name="actionID" value="special" />
<input type="hidden" name="version" value="<?php 
        echo htmlspecialchars($version);
        ?>
" />
<input type="hidden" name="referrer" value="<?php 
        echo htmlspecialchars($page->pageName());
        ?>
" />

<h1 class="header">
 <?php 
        echo _("Revert Page") . ': ' . Horde::link($page->pageUrl(), $page->pageName()) . $page->pageName() . '</a>';
        if ($page->isLocked()) {
            echo Horde::img('locked.png', _("Locked"));
        }
        ?>
</h1>

<div class="headerbox" style="padding:4px">
 <p><?php 
        echo $msg;
        ?>
</p>
 <p>
  <input type="submit" value="<?php 
        echo _("Revert");
        ?>
" class="horde-default" />
  <a class="horde-cancel" href="<?php 
        echo Wicked::url($page->pageName());
        ?>
"><?php 
        echo _("Cancel");
        ?>
</a>
 </p>
</div>

</form>
<?php 
    }
Beispiel #23
0
if (!Vilma::hasPermission()) {
    throw new Horde_Exception_AuthenticationFailure();
}
// Having a current domain doesn't make sense on this page
Vilma::setCurDomain();
try {
    $domains = $vilma->driver->getDomains();
} catch (Exception $e) {
    $notification->push($e, 'horde.error');
    $domains = array();
}
$editurl = Horde::url('domains/edit.php');
$deleteurl = Horde::url('domains/delete.php');
$userurl = Horde::url('users/index.php');
foreach ($domains as &$domain) {
    $domain['edit_url'] = $editurl->copy()->add('domain_id', $domain['domain_id']);
    $domain['del_url'] = $deleteurl->copy()->add('domain_id', $domain['domain_id']);
    $domain['view_url'] = $userurl->copy()->add('domain_id', $domain['domain_id']);
}
/* Set up the template fields. */
$template = $injector->createInstance('Horde_Template');
$template->setOption('gettext', true);
$template->set('domains', $domains);
/* Set up the field list. */
$images = array('delete' => Horde::img('delete.png', _("Delete Domain")), 'edit' => Horde::img('edit.png', _("Edit Domain")));
$template->set('images', $images);
/* Render the page. */
$page_output->header();
$notification->notify(array('listeners' => 'status'));
echo $template->fetch(VILMA_TEMPLATES . '/domains/index.html');
$page_output->footer();
Beispiel #24
0
 /**
  * @TODO: This must be public, but method name has underscore.
  */
 public function _renderRow(&$more, &$path, $type, $criterion, $cvalue, $operator, $value)
 {
     global $whups_driver, $registry;
     $this->currentRow++;
     $pathstring = Whups_Query::pathToString($path);
     $depth = count($path);
     $class = "item" . $this->currentRow % 2;
     switch ($type) {
         case Whups_Query::TYPE_AND:
             $text = _("And");
             break;
         case Whups_Query::TYPE_OR:
             $text = _("Or");
             break;
         case Whups_Query::TYPE_NOT:
             $text = _("Not");
             break;
         case Whups_Query::TYPE_CRITERION:
             switch ($criterion) {
                 case Whups_Query::CRITERION_ID:
                     $text = _("Id");
                     break;
                 case Whups_Query::CRITERION_OWNERS:
                     $text = _("Owners");
                     break;
                 case Whups_Query::CRITERION_GROUPS:
                     $text = _("Groups");
                     break;
                 case Whups_Query::CRITERION_REQUESTER:
                     $text = _("Requester");
                     break;
                 case Whups_Query::CRITERION_ADDED_COMMENT:
                     $text = _("Commentor");
                     break;
                 case Whups_Query::CRITERION_COMMENT:
                     $text = _("Comment");
                     break;
                 case Whups_Query::CRITERION_SUMMARY:
                     $text = _("Summary");
                     break;
                 case Whups_Query::CRITERION_QUEUE:
                     $queue = $whups_driver->getQueue($value);
                     if ($queue) {
                         $text = _("Queue");
                         $value = $queue['name'];
                     }
                     break;
                 case Whups_Query::CRITERION_VERSION:
                     $version = $whups_driver->getVersion($value);
                     if ($version) {
                         $text = _("Version");
                         $value = $version['name'];
                     }
                     break;
                 case Whups_Query::CRITERION_TYPE:
                     $text = _("Type");
                     $value = $whups_driver->getTypeName($value);
                     break;
                 case Whups_Query::CRITERION_STATE:
                     // The value of the following depends on the type.
                     $state = $whups_driver->getState($value);
                     if ($state && isset($this->ticketTypes[$state['type']])) {
                         $text = '[' . $this->ticketTypes[$state['type']] . '] ' . _("State");
                         $value = $state['name'];
                     }
                     break;
                 case Whups_Query::CRITERION_PRIORITY:
                     $state = $whups_driver->getPriority($value);
                     $text = '[' . $this->ticketTypes[$state['type']] . '] ' . _("Priority");
                     $value = $state['name'];
                     break;
                 case Whups_Query::CRITERION_ATTRIBUTE:
                     // The value of the following depends on the type.
                     $aname = $whups_driver->getAttributeName($cvalue);
                     foreach ($this->attributes as $attribute) {
                         if ($attribute['attribute_id'] == $cvalue) {
                             $type = $attribute['type_id'];
                             break;
                         }
                     }
                     if (isset($this->ticketTypes[$type])) {
                         $aname .= ' (' . $this->ticketTypes[$type] . ')';
                     }
                     $text = sprintf("Attribute \"%s\"", $aname);
                     break;
                 case Whups_Query::CRITERION_TIMESTAMP:
                     $text = _("Created");
                     $value = strftime($GLOBALS['prefs']->getValue('report_time_format'), $value);
                     break;
                 case Whups_Query::CRITERION_UPDATED:
                     $text = _("Updated");
                     $value = strftime($GLOBALS['prefs']->getValue('report_time_format'), $value);
                     break;
                 case Whups_Query::CRITERION_RESOLVED:
                     $text = _("Resolved");
                     $value = strftime($GLOBALS['prefs']->getValue('report_time_format'), $value);
                     break;
                 case Whups_Query::CRITERION_ASSIGNED:
                     $text = _("Assigned");
                     $value = strftime($GLOBALS['prefs']->getValue('report_time_format'), $value);
                     break;
                 case Whups_Query::CRITERION_DUE:
                     $text = _("Due");
                     $value = strftime($GLOBALS['prefs']->getValue('report_time_format'), $value);
                     break;
             }
             if (!isset($text)) {
                 $text = sprintf(_("Unknown node type %s"), $type);
                 break;
             }
             $text .= ' ';
             switch ($operator) {
                 case Whups_Query::OPERATOR_GREATER:
                     $text .= _("is greater than");
                     break;
                 case Whups_Query::OPERATOR_LESS:
                     $text .= _("is less than");
                     break;
                 case Whups_Query::OPERATOR_EQUAL:
                     $text .= _("is");
                     break;
                 case Whups_Query::OPERATOR_CI_SUBSTRING:
                     $text .= _("contains (case insensitive) substring");
                     break;
                 case Whups_Query::OPERATOR_CS_SUBSTRING:
                     $text .= _("contains (case sensitive) substring");
                     break;
                 case Whups_Query::OPERATOR_WORD:
                     $text .= _("contains the word");
                     break;
                 case Whups_Query::OPERATOR_PATTERN:
                     $text .= _("matches the pattern");
                     break;
             }
             $text .= " {$value}";
             break;
         default:
             $text = sprintf(_("Unknown node type %s"), $type);
             break;
     }
     // Stick vertical-align: middle; on everything to make it look a
     // little nicer.
     $fimgattrs = 'height="20" width="0" style="vertical-align: middle;"';
     $imgattrs = 'height="20" width="20" style="vertical-align: middle;"';
     $space = '';
     $count = count($more);
     if ($count == 0) {
         // Always have at least one image to make sure all rows are the
         // same height.
         $space = Horde::img('tree/blank.png', '', $fimgattrs) . "\n";
     } else {
         for ($i = 0; $i < $count - 1; $i++) {
             if ($more[$i] == 1) {
                 $space .= Horde::img('tree/line.png', '|', $imgattrs) . "\n";
             } else {
                 $space .= Horde::img('tree/blank.png', '', $imgattrs) . "\n";
             }
         }
     }
     if ($count > 0) {
         if ($more[$count - 1] == 1) {
             $space .= Horde::img('tree/join.png', '+', $imgattrs) . "\n";
         } else {
             $space .= Horde::img('tree/joinbottom.png', '-', $imgattrs) . "\n";
         }
     }
     $extra = $this->isActive ? '' : ' disabled="disabled"';
     $extra .= $pathstring == $this->currentPath ? ' checked="checked"' : '';
     include WHUPS_TEMPLATES . '/renderer/query/render.inc';
 }
Beispiel #25
0
 /**
  * Get HTML to represent the currently selected tags.
  *
  * @return string
  */
 protected function _getTagTrail()
 {
     if ($this->_browser->tagCount() >= 1) {
         $html = '<div class="trean-tags-browsing">' . Horde::img('filter.png') . '<ul class="horde-tags">';
         foreach ($this->_browser->getTags() as $tag => $id) {
             $html .= '<li>' . htmlspecialchars($tag) . $this->_linkRemoveTag($tag)->link() . Horde::img('delete-small.png', _("Remove from search")) . '</a></li>';
         }
         return $html .= '</ul></div>';
     }
     return '';
 }
Beispiel #26
0
 /**
  */
 protected function _content()
 {
     global $conf, $prefs, $registry;
     $html = '';
     if (!empty($this->_params['show_alarms'])) {
         $messages = array();
         try {
             $alarmList = Nag::listAlarms($_SERVER['REQUEST_TIME']);
         } catch (Nag_Exception $e) {
             return '<em>' . htmlspecialchars($e->getMessage()) . '</em>';
         }
         foreach ($alarmList as $task) {
             $differential = $task->getNextDue()->timestamp() - $_SERVER['REQUEST_TIME'];
             $key = $differential;
             while (isset($messages[$key])) {
                 $key++;
             }
             $viewurl = Horde::url('view.php', true)->add(array('task' => $task->id, 'tasklist' => $task->tasklist));
             $link = $viewurl->link() . (!empty($task->name) ? htmlspecialchars($task->name) : _("[none]")) . '</a>';
             if ($differential >= -60 && $differential < 60) {
                 $messages[$key] = sprintf(_("%s is due now."), $link);
             } elseif ($differential >= 60) {
                 $messages[$key] = sprintf(_("%s is due in %s"), $link, Nag::secondsToString($differential));
             }
         }
         ksort($messages);
         foreach ($messages as $message) {
             $html .= '<tr><td class="control">' . Horde::img('alarm_small.png') . '&nbsp;&nbsp;<strong>' . $message . '</strong></td></tr>';
         }
         if (!empty($messages)) {
             $html .= '</table><br /><table cellspacing="0" width="100%" class="linedRow">';
         }
     }
     $i = 0;
     try {
         $tasks = Nag::listTasks(array('tasklists' => isset($this->_params['show_tasklists']) ? $this->_params['show_tasklists'] : array_keys(Nag::listTasklists(false, Horde_Perms::READ)), 'completed' => empty($this->_params['show_completed']) ? Nag::VIEW_INCOMPLETE : Nag::VIEW_ALL, 'include_history' => false));
     } catch (Nag_Exception $e) {
         return '<em>' . htmlspecialchars($e->getMessage()) . '</em>';
     }
     $tasks->reset();
     while ($task = $tasks->each()) {
         $due = $task->due ? $task->getNextDue() : null;
         // Only print tasks due in the past if the show_overdue flag is on.
         if ($due && $due->before($_SERVER['REQUEST_TIME']) && empty($this->_params['show_overdue'])) {
             continue;
         }
         if ($task->completed) {
             $class = 'closed';
         } elseif ($due && $due->before($_SERVER['REQUEST_TIME'])) {
             $class = 'overdue';
         } else {
             $class = '';
         }
         $style = ' style="background-color:' . $task->backgroundColor() . ';color:' . $task->foregroundColor() . '"';
         $html .= '<tr class="' . $class . '">';
         if (!empty($this->_params['show_actions'])) {
             $taskurl = Horde::url('task.php', true)->add(array('task' => $task->id, 'tasklist' => $task->tasklist, 'url' => Horde::selfUrl(true)));
             $label = sprintf(_("Edit \"%s\""), $task->name);
             $html .= '<td width="1%"' . $style . '>' . $taskurl->copy()->add('actionID', 'modify_task')->link() . Horde::img('edit-sidebar-' . substr($task->foregroundColor(), 1) . '.png', $label) . '</a></td>';
             if ($task->completed) {
                 $html .= '<td width="1%">' . $style . '' . Horde::img('checked.png', _("Completed")) . '</td>';
             } else {
                 $label = sprintf(_("Complete \"%s\""), $task->name);
                 $html .= '<td width="1%"' . $style . '>' . Horde::url($conf['urls']['pretty'] == 'rewrite' ? 't/complete' : 'task/complete.php')->add(array('task' => $task->id, 'tasklist' => $task->tasklist, 'url' => Horde::selfUrl(true)))->link() . Horde::img('unchecked.png', $label) . '</a></td>';
             }
         }
         if (!empty($this->_params['show_pri'])) {
             $html .= '<td align="center"' . $style . '>&nbsp;' . Nag::formatPriority($task->priority) . '&nbsp;</td>';
         }
         if (!empty($this->_params['show_tasklist'])) {
             $html .= '<td width="1%" class="nowrap"' . $style . '>' . htmlspecialchars(Nag::getLabel($GLOBALS['injector']->getInstance('Horde_Core_Factory_Share')->create()->getShare($task->tasklist))) . '&nbsp;</td>';
         }
         $html .= '<td' . $style . '>';
         $viewurl = Horde::url('view.php', true)->add(array('task' => $task->id, 'tasklist' => $task->tasklist));
         $html .= $task->treeIcons() . $viewurl->link(array('title' => $task->desc, 'style' => 'color:' . $task->foregroundColor())) . (!empty($task->name) ? htmlspecialchars($task->name) : _("[none]")) . '</a>';
         if ($due && empty($task->completed) && !empty($this->_params['show_due'])) {
             $html .= ' (' . $due->strftime($prefs->getValue('date_format')) . ')';
         }
         $html .= '</td>';
         $html .= "</tr>\n";
     }
     if (empty($html)) {
         return '<em>' . _("No tasks to display") . '</em>';
     }
     return '<table cellspacing="0" width="100%" class="linedRow">' . $html . '</table>';
 }
Beispiel #27
0
 /**
  * @TODO
  *
  * @param <type> $name
  * @param <type> $params
  * @return string
  */
 public static function getTableData($name, $params)
 {
     switch ($name) {
         case 'hours':
             $time_data = $GLOBALS['injector']->getInstance('Hermes_Driver')->getHours($params);
             $subtotal_column = null;
             if ($search_mode = $GLOBALS['session']->get('hermes', 'search_mode')) {
                 switch ($search_mode) {
                     case 'date':
                         $subtotal_column = 'date';
                         break;
                     case 'employee':
                         $subtotal_column = 'employee';
                         break;
                     case 'client':
                         $subtotal_column = '_client_name';
                         break;
                     case 'jobtype':
                         $subtotal_column = '_type_name';
                         break;
                     case 'costobject':
                         $subtotal_column = '_costobject_name';
                         break;
                 }
                 $clients = Hermes::listClients();
                 $column = array();
                 foreach ($time_data as $key => $row) {
                     if (empty($row['client'])) {
                         $time_data[$key]['_client_name'] = _("no client");
                     } elseif (isset($clients[$row['client']])) {
                         $time_data[$key]['_client_name'] = $clients[$row['client']];
                     } else {
                         $time_data[$key]['_client_name'] = $row['client'];
                     }
                     if (!is_null($subtotal_column)) {
                         $column[$key] = $time_data[$key][$subtotal_column] . $time_data[$key]['date'];
                     }
                 }
                 if (!is_null($subtotal_column)) {
                     array_multisort($column, SORT_ASC, $time_data);
                 }
             }
             $total_hours = 0.0;
             $total_billable_hours = 0.0;
             $subtotal_hours = 0.0;
             $subtotal_billable_hours = 0.0;
             $subtotal_control = null;
             $result['data'] = array();
             foreach ($time_data as $k => $vals) {
                 // Initialize subtotal break value.
                 if (is_null($subtotal_control) && isset($vals[$subtotal_column])) {
                     $subtotal_control = $vals[$subtotal_column];
                 }
                 if (!empty($subtotal_column) && $vals[$subtotal_column] != $subtotal_control) {
                     Hermes_Api::renderSubtotals($result['data'], $subtotal_hours, $subtotal_billable_hours, $subtotal_column == 'date' ? strftime("%m/%d/%Y", $subtotal_control) : $subtotal_control);
                     $subtotal_hours = 0.0;
                     $subtotal_billable_hours = 0.0;
                     $subtotal_control = $vals[$subtotal_column];
                 }
                 // Set up edit/delete icons.
                 if (Hermes::canEditTimeslice($vals['id'])) {
                     $edit_link = Horde::url('entry.php', true)->add(array('id' => $vals['id'], 'url' => Horde::selfUrl(true, true, true)));
                     $vals['icons'] = Horde::link($edit_link, _("Edit Entry")) . Horde::img('edit.png', _("Edit Entry"), '') . '</a>';
                     if (empty($vals['submitted'])) {
                         $vals['checkbox'] = '<input type="checkbox" name="item[' . htmlspecialchars($vals['id']) . ']" checked="checked" />';
                     } else {
                         $vals['checkbox'] = '';
                     }
                 }
                 // Add to totals.
                 $subtotal_hours += (double) $vals['hours'];
                 $total_hours += (double) $vals['hours'];
                 if ($vals['billable']) {
                     $subtotal_billable_hours += (double) $vals['hours'];
                     $total_billable_hours += (double) $vals['hours'];
                 }
                 // Localize hours.
                 $vals['hours'] = sprintf('%.02f', $vals['hours']);
                 $result['data'][] = $vals;
             }
             if (!empty($subtotal_column)) {
                 Hermes_Api::renderSubtotals($result['data'], $subtotal_hours, $subtotal_billable_hours, $subtotal_column == 'date' ? strftime("%m/%d/%Y", $subtotal_control) : $subtotal_control);
             }
             // Avoid a divide by zero.
             if ($total_hours == 0.0) {
                 $billable_pct = 0.0;
             } else {
                 $billable_pct = round($total_billable_hours / $total_hours * 100.0);
             }
             $descr = _("Billable Hours") . ' (' . $billable_pct . '%)';
             $result['footer'] = array();
             $result['footer'][] = array('hours' => sprintf('%.02f', $total_billable_hours), 'description' => $descr);
             $descr = _("Non-billable Hours") . ' (' . (100.0 - $billable_pct) . '%)';
             $result['footer'][] = array('hours' => sprintf('%.02f', $total_hours - $total_billable_hours), 'description' => $descr);
             $result['footer'][] = array('hours' => sprintf('%.02f', $total_hours), 'description' => _("Total Hours"), 'approval' => '<div id="approval">' . _("Approved By:") . ' ________________________________________ ' . '&nbsp;</div>');
             break;
     }
     return $result;
 }
Beispiel #28
0
 /**
  * Creates a link to the gollem file selection window.
  *
  * The file section window will return a cache ID value which should be
  * used (along with the selectListResults and returnFromSelectList
  * functions below) to obtain the data from a list of selected files.
  *
  * There MUST be a form field named 'selectlist_selectid' in the calling
  * form. This field will be populated with the selection ID when the user
  * completes file selection.
  *
  * There MUST be a form parameter named 'actionID' in the calling form.
  * This form will be populated with the value 'selectlist_process' when
  * the user completes file selection.  The calling form will be submitted
  * after the window closes (i.e. the calling form must process the
  * 'selectlist_process' actionID).
  *
  * @param string $link_text   The text to use in the link.
  * @param string $link_style  The style to use for the link.
  * @param string $formid      The formid of the calling script.
  * @param boolean $icon       Create the link with an icon instead of
  *                             text?
  * @param string $selectid    Selection ID.
  *
  * @return string  The URL string.
  */
 public function selectlistLink($link_text, $link_style, $formid, $icon = false, $selectid = '')
 {
     $link = Horde::link('#', $link_text, $link_style, '_blank', Horde::popupJs(Horde::url('selectlist.php'), array('params' => array_filter(array('formid' => $formid, 'cacheid' => $selectid)), 'height' => 500, 'width' => 300, 'urlencode' => true)) . 'return false;');
     if ($icon) {
         $link_text = Horde::img('gollem.png', $link_text);
     }
     return '<script type="text/javascript">document.write(\'' . addslashes($link . $link_text) . '<\' + \'/a>\');</script>';
 }
Beispiel #29
0
  <label><?php 
echo _("URL");
?>
:<br />
    <input type="text" name="url" id="kronolithCalendarremoteUrl" class="kronolithLongField" />
  </label>
</div>

<div>
  <label><?php 
echo _("Color");
?>
:<br />
    <input type="text" name="color" id="kronolithCalendarremoteColor" size="7" />
    <?php 
echo Horde::url('#')->link(array('title' => _("Color Picker"), 'class' => 'kronolithColorPicker')) . Horde::img('colorpicker.png', _("Color Picker")) . '</a>';
?>
  </label>
</div>

<div class="kronolithFormActions">
  <input type="button" value="<?php 
echo _("Continue");
?>
" class="kronolithCalendarContinue horde-default" />
  <input type="button" value="<?php 
echo _("Delete");
?>
" class="kronolithCalendarDelete horde-delete" />
  <span class="kronolithSeparator"><?php 
echo _("or");
Beispiel #30
0
 /**
  * Returns the stories of a channel rendered with the specified template.
  *
  * @param integer $channel_id  The news channel to get stories from.
  * @param string  $tpl         The name of the template to use.
  * @param integer $max         The maximum number of stories to get. If
  *                             null, all stories will be returned.
  * @param integer $from        The number of the story to start with.
  * @param integer $order       How to sort the results for internal channels
  *                             Possible values are the Jonah::ORDER_*
  *                             constants.
  *
  * @TODO: This doesn't belong in a storage driver class. Move it to a
  * view or possible a static method in Jonah::?
  *
  * @return string  The rendered story listing.
  */
 public function renderChannel($channel_id, $tpl, $max = 10, $from = 0, $order = Jonah::ORDER_PUBLISHED)
 {
     $channel = $this->getChannel($channel_id);
     $templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah');
     $escape = !isset($templates[$tpl]['escape']) || !empty($templates[$tpl]['escape']);
     $template = new Horde_Template();
     if ($escape) {
         $channel['channel_name'] = htmlspecialchars($channel['channel_name']);
         $channel['channel_desc'] = htmlspecialchars($channel['channel_desc']);
     }
     $template->set('channel', $channel, true);
     /* Get one story more than requested to see if there are more stories. */
     if ($max !== null) {
         $stories = $this->getStories(array('channel_id' => $channel_id, 'published' => true, 'startnumber' => $from, 'limit' => $max), $order);
     } else {
         $stories = $this->getStories(array('channel_id' => $channel_id, 'published' => true), $order);
         $max = count($stories);
     }
     if (!$stories) {
         $template->set('error', _("No stories are currently available."), true);
         $template->set('stories', false, true);
         $template->set('image', false, true);
         $template->set('form', false, true);
     } else {
         /* Escape. */
         if ($escape) {
             array_walk($stories, array($this, '_escapeStories'));
         }
         /* Process story summaries. */
         array_walk($stories, array($this, '_escapeStoryDescriptions'));
         $template->set('error', false, true);
         $template->set('story_marker', Horde::img('story_marker.png'));
         $template->set('image', false, true);
         $template->set('form', false, true);
         if ($from) {
             $template->set('previous', max(0, $from - $max), true);
         } else {
             $template->set('previous', false, true);
         }
         if ($from && !empty($channel['channel_page_link'])) {
             $template->set('previous_link', str_replace(array('%25c', '%25n', '%c', '%n'), array('%c', '%n', $channel['channel_id'], max(0, $from - $max)), $channel['channel_page_link']), true);
         } else {
             $template->set('previous_link', false, true);
         }
         $more = count($stories) > $max;
         if ($more) {
             $template->set('next', $from + $max, true);
             array_pop($stories);
         } else {
             $template->set('next', false, true);
         }
         if ($more && !empty($channel['channel_page_link'])) {
             $template->set('next_link', str_replace(array('%25c', '%25n', '%c', '%n'), array('%c', '%n', $channel['channel_id'], $from + $max), $channel['channel_page_link']), true);
         } else {
             $template->set('next_link', false, true);
         }
         $template->set('stories', $stories, true);
     }
     return $template->parse($templates[$tpl]['template']);
 }