Author: Michael Slusarz (slusarz@horde.org)
Inheritance: extends Horde_Themes_Element
Esempio n. 1
0
 /**
  */
 protected 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++;
     }
     $dates = isset($this->_params['phase']) && $this->_params['phase'] == 'next' ? array_slice(array_keys($phases), $lastNew + 4, 4) : array_slice(array_keys($phases), $lastNew, 4);
     $location = isset($this->_params['hemisphere']) && $this->_params['hemisphere'] == 'northern' ? _("Northern Hemisphere") : _("Southern Hemisphere");
     $html = '<table width="100%" height="100%" cellspacing="0">' . '<tr><td colspan="4" class="control"><strong>' . $location . '</strong></td></tr>' . '<tr height="100%"><td width="25%" align="center">' . Horde_Themes_Image::tag('block/moon/newmoon.png', array('alt' => _("New Moon"))) . '<br />' . strftime($GLOBALS['prefs']->getValue('date_format_mini'), $dates[0]) . '</td>';
     $html .= '<td width="25%" align="center">';
     if (isset($this->_params['hemisphere']) && $this->_params['hemisphere'] == 'northern') {
         $html .= Horde_Themes_Image::tag('block/moon/lastquarter.png', array('alt' => _("First Quarter")));
     } else {
         $html .= Horde_Themes_Image::tag('block/moon/firstquarter.png', array('alt' => _("First Quarter")));
     }
     $html .= '<br />' . strftime($GLOBALS['prefs']->getValue('date_format_mini'), $dates[1]) . '</td>';
     $html .= '<td width="25%" align="center">' . Horde_Themes_Image::tag('block/moon/fullmoon.png', array('alt' => _("Full Moon"))) . '<br />' . strftime($GLOBALS['prefs']->getValue('date_format_mini'), $dates[2]) . '</td>';
     $html .= '<td width="25%" align="center">';
     if (isset($this->_params['hemisphere']) && $this->_params['hemisphere'] == 'northern') {
         $html .= Horde_Themes_Image::tag('block/moon/firstquarter.png', array('alt' => _("Last Quarter")));
     } else {
         $html .= Horde_Themes_Image::tag('block/moon/lastquarter.png', array('alt' => _("Last Quarter")));
     }
     $html .= '<br />' . strftime($GLOBALS['prefs']->getValue('date_format_mini'), $dates[3]) . '</td></tr></table>';
     return $html;
 }
Esempio n. 2
0
 /**
  */
 protected function _content()
 {
     global $page_output;
     $name = strval(new Horde_Support_Randomid());
     $page_output->addScriptFile('vatid.js', 'horde');
     $page_output->addInlineScript(array('$("' . $name . '").observe("submit", HordeBlockVatid.onSubmit.bindAsEventListener(HordeBlockVatid))'), true);
     return '<form style="padding:2px" action="' . $this->_ajaxUpdateUrl() . '" id="' . $name . '">' . Horde_Util::formInput() . Horde::label('vatid', _("VAT identification number:")) . '<br /><input type="text" length="14" name="vatid" />' . '<br /><input type="submit" id="vatbutton" value="' . _("Check") . '" class="horde-default" /> ' . Horde_Themes_Image::tag('loading.gif', array('alt' => _("Checking"), 'attr' => array('style' => 'display:none'))) . '<div class="vatidResults"></div>' . '</form>';
 }
Esempio n. 3
0
 /**
  * Generate a flag image tag.
  *
  * @param string $host  The hostname.
  *
  * @return string  An HTML IMG tag (or empty if host is not found).
  */
 public static function generateFlagImageByHost($host)
 {
     if (($data = self::getFlagImageObByHost($host)) === false) {
         return '';
     }
     $img = Horde_Themes_Image::tag($data['ob'], array('alt' => $data['name'], 'attr' => array('title' => $data['name'])));
     return $img ? $img : '[' . $data['name'] . ']';
 }
Esempio n. 4
0
 /**
  * Render tag field.
  */
 protected function _renderVarInput_TurbaTags($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_Themes_Image::tag('loading.gif', array('alt' => _("Loading..."))));
     $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('Turba_Ajax_Imple_TagAutoCompleter', array('id' => $varname));
     return $html;
 }
Esempio n. 5
0
 /**
  */
 protected function _content()
 {
     $cloud = new Horde_Core_Ui_TagCloud();
     foreach ($this->_getTags() as $tag) {
         $cloud->addElement($tag['tag_name'], '#', $tag['count'], null, 'doSearch(\'' . $tag['tag_name'] . '\'); return false;');
     }
     Horde::startBuffer();
     include HORDE_TEMPLATES . '/block/cloud.inc';
     return Horde::endBuffer() . '<div>&nbsp;' . Horde_Themes_Image::tag('loading.gif', array('attr' => array('id' => 'cloudloadingimg', 'style' => 'display:none;'))) . '</div>' . $cloud->buildHTML() . '<div id="cloudsearch"></div>';
 }
Esempio n. 6
0
 /**
  */
 protected function _init()
 {
     global $browser, $injector, $page_output, $registry;
     $page_output->addScriptFile('base.js');
     $page_output->addScriptFile('passphrase.js');
     $page_output->addScriptFile('viewport.js');
     $page_output->addScriptFile('external/CustomElements.js');
     $page_output->addScriptFile('external/time-elements.js');
     $page_output->addScriptFile('external/tinycon.js');
     $page_output->addScriptFile('dragdrop2.js', 'horde');
     $page_output->addScriptFile('form_ghost.js', 'horde');
     $page_output->addScriptFile('jstorage.js', 'horde');
     $page_output->addScriptFile('slider2.js', 'horde');
     $page_output->addScriptFile('toggle_quotes.js', 'horde');
     $page_output->addScriptPackage('Horde_Core_Script_Package_Dialog');
     $page_output->addScriptPackage('IMP_Script_Package_Imp');
     $page_output->addThemeStylesheet('mailbox.css');
     $page_output->addThemeStylesheet('message_view.css');
     $imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
     if ($imp_imap->access(IMP_Imap::ACCESS_FLAGS)) {
         $page_output->addScriptFile('colorpicker.js', 'horde');
         $this->view->picker_img = Horde_Themes_Image::tag('colorpicker.png', array('alt' => _("Color Picker")));
     }
     if ($imp_imap->access(IMP_Imap::ACCESS_REMOTE)) {
         $page_output->addScriptFile('external/base64.js');
     }
     $this->_addMailboxVars();
     $this->view->show_innocent = !empty($imp_imap->config->innocent_params);
     $this->view->show_search = $imp_imap->access(IMP_Imap::ACCESS_SEARCH);
     $this->view->show_spam = !empty($imp_imap->config->spam_params);
     $impSubinfo = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/dynamic'));
     $impSubinfo->addHelper('Text');
     $impSubinfo->quota = (bool) $imp_imap->config->quota;
     $topbar = $injector->getInstance('Horde_View_Topbar');
     $topbar->search = $this->view->show_search;
     $topbar->searchMenu = true;
     $topbar->subinfo = $impSubinfo->render('mailbox_subinfo');
     $page_output->topbar = true;
     $blank = new Horde_Url();
     $impSidebar = new Horde_View(array('templatePath' => array($registry->get('templates', 'horde') . '/sidebar', IMP_TEMPLATES . '/dynamic')));
     $impSidebar->addHelper('Text');
     $impSidebar->containers = array(array('id' => 'imp-specialmboxes'));
     if ($imp_imap->isImap()) {
         $impSidebar->containers[] = array('rows' => array(array('id' => 'folderopts_link', 'cssClass' => 'folderoptsImg', 'link' => $blank->link() . _("Folder Actions") . '</a>'), array('id' => 'dropbase', 'style' => 'display:none', 'cssClass' => 'folderImg', 'link' => $blank->link() . _("Move to Base Level") . '</a>')));
         $impSidebar->containers[] = array('id' => 'imp-normalmboxes');
     }
     $sidebar = $injector->getInstance('Horde_View_Sidebar');
     $sidebar->newLink = $blank->link(array('id' => 'composelink', 'class' => 'icon'));
     $sidebar->newText = _("New Message");
     $sidebar->content = $impSidebar->render('sidebar');
     $this->view->sidebar = $sidebar->render();
     $this->view->max_fsize = intval($browser->allowFileUploads());
     $page_output->noDnsPrefetch();
     $this->_pages[] = 'mailbox';
 }
Esempio n. 7
0
 public static function AddIcons(&$p_recordSet, $p_iconFile, $p_altText, $p_fieldName, $p_conditionFilter)
 {
     /* Please note that inclusion occurs if EVERY field of the record included in
        p_conditionFilter match the provided value */
     $v_icon = Horde_Themes_Image::tag($p_iconFile, array('alt' => $p_altText));
     foreach ($p_recordSet as &$v_record) {
         $v_isIncluded = true;
         foreach ($p_conditionFilter as $v_fieldName => $v_fieldValue) {
             if ($v_record[$v_fieldName] !== $v_fieldValue) {
                 $v_isIncluded = false;
             }
         }
         $v_record[$p_fieldName] = $v_isIncluded ? $v_icon : NULL;
     }
 }
Esempio n. 8
0
 /**
  * AJAX action: Return Turba minisearch information.
  *
  * Variables used:
  *   - abooks: (array) UIDs of source addressbook.
  *   - search: (string) Search string.
  *
  * @return object  HTML search output in the 'html' parameter.
  */
 public function minisearch()
 {
     global $attributes, $injector, $registry;
     $ob = new stdClass();
     $results = array();
     $search = trim($this->vars->search);
     if (!is_null($search)) {
         foreach (Horde_Serialize::unserialize($this->vars->abooks, Horde_Serialize::JSON) as $val) {
             try {
                 $res = $injector->getInstance('Turba_Factory_Driver')->create($val)->search(array('name' => $search));
                 while ($ob = $res->next()) {
                     if ($ob->isGroup()) {
                         continue;
                     }
                     foreach ($ob->getAttributes() as $k => $v) {
                         if (!empty($attributes[$k]['type']) && $attributes[$k]['type'] == 'email') {
                             if (!empty($v)) {
                                 try {
                                     $mail_link = $registry->call('mail/compose', array(array('to' => $v)));
                                 } catch (Horde_Exception $e) {
                                     $mail_link = 'mailto:' . urlencode($v);
                                 }
                             }
                             $link = empty($v) ? htmlspecialchars($ob->getValue('name')) : htmlspecialchars($ob->getValue('name') . ' <' . $v . '>');
                             $results[] = '<li class="linedRow">' . Horde::link(Horde::url($ob->url()), _("View Contact"), '', '_parent') . Horde_Themes_Image::tag('contact.png', array('alt' => _("View Contact"))) . '</a> ' . (!empty($v) ? '<a href="' . $mail_link . '">' : '') . $link . (!empty($v) ? '</a>' : '') . '</li>';
                             break;
                         }
                     }
                 }
             } catch (Turba_Exception $e) {
             }
         }
     }
     if (count($results)) {
         $ob->html = '<ul>' . implode('', $results) . '</ul>';
     } elseif (!is_null($search)) {
         $ob->html = _("No contacts found");
     }
     return $ob;
 }
Esempio n. 9
0
 /**
  * Create code needed for source selection.
  *
  * @param array $data  Data items:
  * <pre>
  * 'mainlabel' - (string) Main label.
  * 'no_up' - (boolean) [OPTIONAL] Disable movement of selected items
  *           up/down.
  * 'selectlabel' - (array) Selected label.
  * 'sourcelabel' - (string) [OPTIONAL] Source selection label.
  * 'sources' - (array) List of sources - keys are source names. Each
  *             source is an array with the entries: 'label', 'selected' and
  *             'unselected'.
  * 'unselectlabel' - (array) Unselected label.
  * </pre>
  *
  * @return string  HTML UI code.
  */
 public static function source($data)
 {
     $t = $GLOBALS['injector']->createInstance('Horde_Template');
     $t->set('mainlabel', $data['mainlabel']);
     $t->set('selectlabel', $data['selectlabel']);
     $t->set('unselectlabel', $data['unselectlabel']);
     $sources = $labels = array();
     foreach ($data['sources'] as $key => $val) {
         $selected = $unselected = array();
         foreach ($val['selected'] as $key2 => $val2) {
             $selected[] = array('l' => $val2, 'v' => $key2);
         }
         foreach ($val['unselected'] as $key2 => $val2) {
             $unselected[] = array('l' => $val2, 'v' => $key2);
         }
         $sources[$key] = array($selected, $unselected);
         $labels[] = array('key' => $key, 'label' => $val['label']);
     }
     if (count($sources) == 1) {
         $val = reset($sources);
         $t->set('selected', $val[0]);
         $t->set('unselected', $val[1]);
     } else {
         $t->set('source_select', true);
         $t->set('sources', $labels);
         $t->set('sourcelabel', $data['sourcelabel']);
         $js = array();
         foreach ($sources as $key => $val) {
             $js[] = array('selected' => $val[0], 'source' => $key, 'unselected' => $val[1]);
         }
         $GLOBALS['injector']->getInstance('Horde_PageOutput')->addInlineJsVars(array('HordeSourceSelectPrefs.source_list' => $js));
     }
     $t->set('addimg', Horde_Themes_Image::tag($GLOBALS['registry']->nlsconfig->curr_rtl ? 'lhand.png' : 'rhand.png', array('alt' => Horde_Core_Translation::t("Add source"))));
     $t->set('removeimg', Horde_Themes_Image::tag($GLOBALS['registry']->nlsconfig->curr_rtl ? 'rhand.png' : 'lhand.png', array('alt' => Horde_Core_Translation::t("Remove source"))));
     if (empty($data['no_up'])) {
         $t->set('upimg', Horde_Themes_Image::tag('nav/up.png', array('alt' => Horde_Core_Translation::t("Move up"))));
         $t->set('downimg', Horde_Themes_Image::tag('nav/down.png', array('alt' => Horde_Core_Translation::t("Move down"))));
     }
     return $t->fetch($GLOBALS['registry']->get('templates', 'horde') . '/prefs/source.html');
 }
Esempio n. 10
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>';
 }
Esempio n. 11
0
File: Flag.php Progetto: horde/horde
 /**
  */
 public function display(Horde_Core_Prefs_Ui $ui)
 {
     global $injector, $page_output, $prefs;
     if (!$ui->nobuttons) {
         $page_output->addScriptFile('hordecore.js', 'horde');
         $page_output->addScriptFile('colorpicker.js', 'horde');
         $page_output->addScriptFile('prefs/flag.js');
     }
     $p_css = new Horde_Themes_Element('prefs.css');
     $page_output->addStylesheet($p_css->fs, $p_css->uri);
     $page_output->addInlineJsVars(array('ImpFlagPrefs.new_prompt' => _("Please enter the label for the new flag:"), 'ImpFlagPrefs.confirm_delete' => _("Are you sure you want to delete this flag?")));
     $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/prefs'));
     $view->addHelper('FormTag');
     $view->addHelper('Tag');
     $view->locked = $prefs->isLocked('msgflags');
     $view->picker_img = Horde_Themes_Image::tag('colorpicker.png', array('alt' => _("Color Picker")));
     $out = array();
     $flaglist = $injector->getInstance('IMP_Flags')->getList();
     foreach ($flaglist as $val) {
         $hash = $val->hash;
         $bgid = 'bg_' . $hash;
         $color = $val->bgdefault ? '' : $val->bgcolor;
         $tmp = array();
         if ($val instanceof IMP_Flag_User) {
             $tmp['label'] = htmlspecialchars($val->label);
             $tmp['label_name'] = 'label_' . $hash;
             $tmp['user'] = true;
         } else {
             $tmp['icon'] = $val->span;
             $tmp['label'] = Horde::label($bgid, $val->label);
         }
         $tmp['color'] = $color;
         $tmp['colorid'] = $bgid;
         $tmp['colorstyle'] = 'color:' . $val->fgcolor . ';' . (strlen($color) ? 'background-color:' . $color . ';' : '');
         $out[] = $tmp;
     }
     $view->flags = $out;
     return $view->render('flags');
 }
Esempio n. 12
0
 /**
  */
 protected function _content()
 {
     if (empty($this->_params['location'])) {
         throw new Horde_Exception(_("No location is set."));
     }
     // Set the timezone variable, if available.
     $GLOBALS['registry']->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/Nls/Coordinates.php';
     }
     foreach ($coordinates as $country) {
         if (array_key_exists($this->_params['location'], $country)) {
             $location = $country[$this->_params['location']];
             break;
         }
     }
     return '<table width="100%" height="100%" cellspacing="0"><tr>' . '<td colspan="2" class="control"><strong>' . $location . '</strong></td></tr><tr height="100%">' . '<td width="50%" align="center">' . Horde_Themes_Image::tag('block/sunrise/sunrise.png', array('alt' => _("Sun Rise"))) . '<br />' . $rise . '</td>' . '<td width="50%" align="center">' . Horde_Themes_Image::tag('block/sunrise/sunset.png', array('alt' => _("Sun Set"))) . '<br />' . $set . '</td>' . '</tr></table>';
 }
Esempio n. 13
0
              <?php 
        }
        ?>
           </tr>
           <?php 
        $futureDays++;
        ?>
         <?php 
    }
    ?>
      </table>
      <!-- Logo -->
      <?php 
    if ($this->logo) {
        ?>
        <div class="rightAlign"><?php 
        echo _("Weather data provided by") . ' ' . Horde::link(Horde::externalUrl($this->link), $this->title, '', '_blank', '', $this->title) . Horde_Themes_Image::tag($this->logo);
        ?>
</a></div>
      <?php 
    } else {
        ?>
        <div class="rightAlign"><?php 
        echo _("Weather data provided by") . ' ' . Horde::link(Horde::externalUrl($this->link), $this->title, '', '_blank', '', $this->title) . '<em>' . $this->title;
        ?>
</em></a></div>
      <?php 
    }
    ?>
  <?php 
}
Esempio n. 14
0
 /**
  * Get summary info for a MIME ID.
  *
  * @param string $id     The MIME ID.
  * @param integer $mask  A bitmask indicating what information to return:
  * <pre>
  * Always output:
  *   'type' = MIME type
  *
  * IMP_Contents::SUMMARY_BYTES
  *   Output: parts = 'bytes'
  *
  * IMP_Contents::SUMMARY_SIZE
  *   Output: parts = 'size'
  *
  * IMP_Contents::SUMMARY_ICON
  * IMP_Contents::SUMMARY_ICON_RAW
  *   Output: parts = 'icon'
  *
  * IMP_Contents::SUMMARY_DESCRIP
  *   Output: parts = 'description_raw'
  *
  * IMP_Contents::SUMMARY_DESCRIP_LINK
  *   Output: parts = 'description'
  *
  * IMP_Contents::SUMMARY_DOWNLOAD
  *   Output: parts = 'download', 'download_url'
  *
  * IMP_Contents::SUMMARY_IMAGE_SAVE
  *   Output: parts = 'img_save'
  *
  * IMP_Contents::SUMMARY_PRINT
  * IMP_Contents::SUMMARY_PRINT_STUB
  *   Output: parts = 'print'
  *
  * IMP_Contents::SUMMARY_STRIP
  *   Output: parts = 'strip'
  * </pre>
  *
  * @return array  An array with the requested information.
  */
 public function getSummary($id, $mask = 0)
 {
     $autodetect_link = false;
     $param_array = array();
     $this->_buildMessage();
     $part = array('bytes' => null, 'download' => null, 'download_url' => null, 'id' => $id, 'img_save' => null, 'size' => null, 'strip' => null);
     $mime_part = $this->getMimePart($id, array('nocontents' => true));
     if (!$mime_part) {
         return $part;
     }
     $mime_type = $mime_part->getType();
     /* If this is an attachment that has no specific MIME type info, see
      * if we can guess a rendering type. */
     if (in_array($mime_type, array('application/octet-stream', 'application/base64'))) {
         $mime_type = Horde_Mime_Magic::filenameToMIME($mime_part->getName());
         if ($mime_type == $mime_part->getType()) {
             $autodetect_link = true;
         } else {
             $mime_part = clone $mime_part;
             $mime_part->setType($mime_type);
             $param_array['ctype'] = $mime_type;
         }
     }
     $part['type'] = $mime_type;
     /* Is this part an attachment? */
     $is_atc = $mime_part->isAttachment();
     /* Get bytes/size information. */
     if ($mask & self::SUMMARY_BYTES || $mask & self::SUMMARY_SIZE) {
         $part['bytes'] = $size = $mime_part->getBytes();
         $part['size'] = $size > 1048576 ? sprintf(_("%s MB"), IMP::numberFormat($size / 1048576, 1)) : sprintf(_("%s KB"), max(round($size / 1024), 1));
     }
     /* Get part's icon. */
     if ($mask & self::SUMMARY_ICON || $mask & self::SUMMARY_ICON_RAW) {
         $part['icon'] = $GLOBALS['injector']->getInstance('IMP_Factory_MimeViewer')->getIcon($mime_type);
         if ($mask & self::SUMMARY_ICON) {
             $part['icon'] = Horde_Themes_Image::tag($part['icon'], array('attr' => array('title' => $mime_type)));
         }
     } else {
         $part['icon'] = null;
     }
     /* Get part's description. */
     $description = $this->getPartName($mime_part, true);
     if ($mask & self::SUMMARY_DESCRIP_LINK) {
         if (($can_d = $this->canDisplay($mime_part, self::RENDER_FULL)) || $autodetect_link) {
             $part['description'] = $this->linkViewJS($mime_part, 'view_attach', htmlspecialchars($description), array('jstext' => sprintf(_("View %s"), $description), 'params' => array_filter(array_merge($param_array, array('autodetect' => !$can_d)))));
         } else {
             $part['description'] = htmlspecialchars($description);
         }
     }
     if ($mask & self::SUMMARY_DESCRIP) {
         $part['description_raw'] = $description;
     }
     /* Download column. */
     if ($is_atc && $mask & self::SUMMARY_DOWNLOAD) {
         $part['download'] = $this->linkView($mime_part, 'download_attach', '', array('attr' => array('download' => $mime_part->getName(true) ?: $mime_part->getPrimaryType()), 'class' => 'iconImg downloadAtc', 'jstext' => _("Download")));
         $part['download_url'] = $this->urlView($mime_part, 'download_attach');
     }
     /* Display the image save link if the required registry calls are
      * present. */
     if ($mask & self::SUMMARY_IMAGE_SAVE && $GLOBALS['registry']->hasMethod('images/selectGalleries') && $mime_part->getPrimaryType() == 'image') {
         $part['img_save'] = Horde::link('#', _("Save Image in Gallery"), 'iconImg saveImgAtc', null, Horde::popupJs(IMP_Basic_Saveimage::url(), array('params' => array('muid' => strval($this->getIndicesOb()), 'id' => $id), 'height' => 200, 'width' => 450, 'urlencode' => true)) . 'return false;') . '</a>';
     }
     /* Add print link? */
     if (($mask & self::SUMMARY_PRINT || $mask & self::SUMMARY_PRINT_STUB) && $this->canDisplay($id, self::RENDER_FULL)) {
         $part['print'] = $mask & self::SUMMARY_PRINT ? $this->linkViewJS($mime_part, 'print_attach', '', array('css' => 'iconImg printAtc', 'jstext' => _("Print"), 'onload' => 'IMP_JS.printWindow', 'params' => $param_array)) : Horde::link('#', _("Print"), 'iconImg printAtc', null, null, null, null, array('mimeid' => $id)) . '</a>';
     }
     /* Strip Attachment? Allow stripping of base parts other than the
      * base multipart and the base text (body) part. */
     if ($mask & self::SUMMARY_STRIP && $id != 0 && intval($id) != 1 && strpos($id, '.') === false) {
         $part['strip'] = Horde::link(Horde::selfUrlParams()->add(array('actionID' => 'strip_attachment', 'imapid' => $id, 'muid' => strval($this->getIndicesOb()), 'token' => $GLOBALS['session']->getToken())), _("Strip Attachment"), 'iconImg deleteImg stripAtc', null, null, null, null, array('mimeid' => $id)) . '</a>';
     }
     return $part;
 }
Esempio n. 15
0
File: Ui.php Progetto: horde/horde
 /**
  * Create a permission editing form.
  *
  * @param Horde_Perms_Permission $permission  TODO
  */
 public function setupEditForm($permission)
 {
     /* Initialise form if required. */
     $this->_formInit();
     $this->_form->setButtons(Horde_Core_Translation::t("Update"), true);
     $this->_vars->set('perm_id', $this->_perms->getPermissionId($permission));
     $this->_form->addHidden('', 'perm_id', 'text', false);
     /* Get permission configuration. */
     $this->_type = $permission->get('type');
     $params = $this->_corePerms->getParams($permission->getName());
     /* Default permissions. */
     $perm_val = $permission->getDefaultPermissions();
     $this->_form->setSection('default', Horde_Core_Translation::t("All Authenticated Users"), Horde_Themes_Image::tag('perms.png'), false);
     /* We MUST use 'deflt' for the variable name because 'default' is a
      * reserved word in JavaScript. */
     if ($this->_type == 'matrix') {
         /* Set up the columns for the permissions matrix. */
         $cols = Horde_Perms::getPermsArray();
         /* Define a single matrix row for default perms. */
         $matrix = array(Horde_Perms::integerToArray($perm_val));
         $this->_form->addVariable('', 'deflt', 'matrix', false, false, null, array($cols, array(0 => ''), $matrix));
     } else {
         $var = $this->_form->addVariable('', 'deflt', $this->_type, false, false, null, $params);
         $var->setDefault($perm_val);
     }
     /* Guest permissions. */
     $perm_val = $permission->getGuestPermissions();
     $this->_form->setSection('guest', Horde_Core_Translation::t("Guest Permissions"), '', false);
     if ($this->_type == 'matrix') {
         /* Define a single matrix row for guest perms. */
         $matrix = array(Horde_Perms::integerToArray($perm_val));
         $this->_form->addVariable('', 'guest', 'matrix', false, false, null, array($cols, array(0 => ''), $matrix));
     } else {
         $var = $this->_form->addVariable('', 'guest', $this->_type, false, false, null, $params);
         $var->setDefault($perm_val);
     }
     /* Object creator permissions. */
     $perm_val = $permission->getCreatorPermissions();
     $this->_form->setSection('creator', Horde_Core_Translation::t("Creator Permissions"), Horde_Themes_Image::tag('user.png'), false);
     if ($this->_type == 'matrix') {
         /* Define a single matrix row for creator perms. */
         $matrix = array(Horde_Perms::integerToArray($perm_val));
         $this->_form->addVariable('', 'creator', 'matrix', false, false, null, array($cols, array(0 => ''), $matrix));
     } else {
         $var = $this->_form->addVariable('', 'creator', $this->_type, false, false, null, $params);
         $var->setDefault($perm_val);
     }
     /* Users permissions. */
     $perm_val = $permission->getUserPermissions();
     $this->_form->setSection('users', Horde_Core_Translation::t("Individual Users"), Horde_Themes_Image::tag('user.png'), false);
     $auth = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Auth')->create();
     $user_list = array();
     if ($auth->hasCapability('list')) {
         /* The auth driver has list capabilities so set up an array which
          * the matrix field type will recognise to set up an enum box for
          * adding new users to the permissions matrix. */
         $new_users = array();
         try {
             $user_list = $auth->listNames();
             foreach ($user_list as $user => $name) {
                 if (!isset($perm_val[$user])) {
                     $new_users[$user] = $name;
                 }
             }
         } catch (Horde_Auth_Exception $e) {
             $new_users = true;
         }
     } else {
         /* No list capabilities, setting to true so that the matrix field
          * type will offer a text input box for adding new users. */
         $new_users = true;
     }
     if ($this->_type == 'matrix') {
         /* Set up the matrix array, breaking up each permission integer
          * into an array.  The keys of this array will be the row
          * headers. */
         $rows = array();
         $matrix = array();
         foreach ($perm_val as $u_id => $u_perms) {
             $rows[$u_id] = isset($user_list[$u_id]) ? $user_list[$u_id] : $u_id;
             $matrix[$u_id] = Horde_Perms::integerToArray($u_perms);
         }
         $this->_form->addVariable('', 'u', 'matrix', false, false, null, array($cols, $rows, $matrix, $new_users));
     } else {
         if ($new_users) {
             if (is_array($new_users)) {
                 $u_n = Horde_Util::getFormData('u_n');
                 $u_n = empty($u_n['u']) ? null : $u_n['u'];
                 $user_html = '<select name="u_n[u]"><option value="">' . Horde_Core_Translation::t("-- select --") . '</option>';
                 foreach ($new_users as $new_user => $name) {
                     $user_html .= '<option value="' . $new_user . '"';
                     $user_html .= $u_n == $new_user ? ' selected="selected"' : '';
                     $user_html .= '>' . htmlspecialchars($name) . '</option>';
                 }
                 $user_html .= '</select>';
             } else {
                 $user_html = '<input type="text" name="u_n[u]" />';
             }
             $this->_form->addVariable($user_html, 'u_n[v]', $this->_type, false, false, null, $params);
         }
         foreach ($perm_val as $u_id => $u_perms) {
             $var = $this->_form->addVariable($u_id, 'u_v[' . $u_id . ']', $this->_type, false, false, null, $params);
             $var->setDefault($u_perms);
         }
     }
     /* Groups permissions. */
     $perm_val = $permission->getGroupPermissions();
     $this->_form->setSection('groups', Horde_Core_Translation::t("Groups"), Horde_Themes_Image::tag('group.png'), false);
     try {
         $group_list = $GLOBALS['injector']->getInstance('Horde_Group')->listAll();
     } catch (Horde_Group_Exception $e) {
         $GLOBALS['notification']->push($e);
         $group_list = array();
     }
     if (!empty($group_list)) {
         /* There is an available list of groups so set up an array which
          * the matrix field type will recognise to set up an enum box for
          * adding new groups to the permissions matrix. */
         $new_groups = array();
         foreach ($group_list as $groupId => $group) {
             if (!isset($perm_val[$groupId])) {
                 $new_groups[$groupId] = $group;
             }
         }
     } else {
         /* Do not offer a text box to add new groups. */
         $new_groups = false;
     }
     if ($this->_type == 'matrix') {
         /* Set up the matrix array, break up each permission integer into
          * an array. The keys of this array will be the row headers. */
         $rows = array();
         $matrix = array();
         foreach ($perm_val as $g_id => $g_perms) {
             $rows[$g_id] = isset($group_list[$g_id]) ? $group_list[$g_id] : $g_id;
             $matrix[$g_id] = Horde_Perms::integerToArray($g_perms);
         }
         $this->_form->addVariable('', 'g', 'matrix', false, false, null, array($cols, $rows, $matrix, $new_groups));
     } else {
         if ($new_groups) {
             if (is_array($new_groups)) {
                 $g_n = Horde_Util::getFormData('g_n');
                 $g_n = empty($g_n['g']) ? null : $g_n['g'];
                 $group_html = '<select name="g_n[g]"><option value="">' . Horde_Core_Translation::t("-- select --") . '</option>';
                 foreach ($new_groups as $groupId => $group) {
                     $group_html .= '<option value="' . $groupId . '"';
                     $group_html .= $g_n == $groupId ? ' selected="selected"' : '';
                     $group_html .= '>' . htmlspecialchars($group) . '</option>';
                 }
                 $group_html .= '</select>';
             } else {
                 $group_html = '<input type="text" name="g_n[g]" />';
             }
             $this->_form->addVariable($group_html, 'g_n[v]', $this->_type, false, false, null, $params);
         }
         foreach ($perm_val as $g_id => $g_perms) {
             $var = $this->_form->addVariable(isset($group_list[$g_id]) ? $group_list[$g_id] : $g_id, 'g_v[' . $g_id . ']', $this->_type, false, false, null, $params);
             $var->setDefault($g_perms);
         }
     }
     /* Set form title. */
     $this->_form->setTitle(sprintf(Horde_Core_Translation::t("Edit permissions for \"%s\""), $this->_corePerms->getTitle($permission->getName())));
 }
Esempio n. 16
0
    /**
     * The content to go in this block.
     *
     * @return string   The content.
     */
    protected function _content()
    {
        global $page_output;
        $instance = hash('md5', mt_rand());
        $endpoint = Horde::url('services/facebook/', true);
        $html = '';
        // Init facebook driver, exit early if no prefs exist
        $facebook = $this->_facebook;
        if (!$facebook->auth->getSessionKey()) {
            return sprintf(_("You are not connected to your Facebook account. You should check your Facebook settings in your %s."), $GLOBALS['registry']->getServiceLink('prefs', 'horde')->add('group', 'facebook')->link() . _("preferences") . '</a>');
        }
        // Add the client javascript / initialize it
        $page_output->addThemeStylesheet('facebook.css');
        $page_output->addScriptFile('facebookclient.js');
        $script = <<<EOT
            var Horde = window.Horde || {};
            Horde['{$instance}_facebook'] = new Horde_Facebook({
               spinner: '{$instance}_loading',
               endpoint: '{$endpoint}',
               content: '{$instance}_fbcontent',
               status: '{$instance}_currentStatus',
               getmore: '{$instance}_getmore',
               'input': '{$instance}_newStatus',
               'button': '{$instance}_button',
               instance: '{$instance}',
               'filter': '{$this->_params['filter']}',
               'count': '{$this->_params['count']}'
            });
EOT;
        $page_output->addInlineScript($script);
        // Start building the block UI.
        $html .= '<div style="padding: 8px 8px 0 8px">';
        try {
            $fbperms = $facebook->users->getAppPermissions();
            if (!empty($fbperms[Horde_Service_Facebook_Auth::EXTEND_PERMS_PUBLISHSTREAM])) {
                $html .= '<input style="width:98%;margin-top:4px;margin-bottom:4px;" type="text" class="fbinput" id="' . $instance . '_newStatus" name="newStatus" />' . '<div><a class="horde-default" href="#" id="' . $instance . '_button">' . _("Post") . '</a></div>' . Horde_Themes_Image::tag('loading.gif', array('attr' => array('id' => $instance . '_loading', 'style' => 'display:none;')));
            }
        } catch (Horde_Service_Facebook_Exception $e) {
            $prefs = $GLOBALS['registry']->getServiceLink('prefs');
            $html .= sprintf(_("There was an error making the request: %s"), $e->getMessage());
            $html .= sprintf(_("You can also check your Facebook settings in your %s."), $prefs->add('group', 'facebook')->link() . _("preferences") . '</a>');
            return $html;
        }
        $html .= '</div>';
        // Close the node that wraps the status
        // Build the stream feed.
        $html .= '<br /><div id="' . $instance . '_fbcontent" style="height:' . (empty($this->_params['height']) ? 300 : $this->_params['height']) . 'px;overflow-y:auto;overflow-x:hidden;"></div><br />';
        $html .= '<div class="hordeSmGetmore"><input type="button" id="' . $instance . '_getmore" class="horde-default"  value="' . _("Get More") . '"></div>';
        $html .= '</div>';
        return $html;
    }
Esempio n. 17
0
 /**
  * Generates the HTML link that will pop up a help window for the
  * requested topic.
  *
  * @param string $module  The name of the current Horde module.
  * @param string $topic   The help topic to be displayed.
  *
  * @return string  The HTML to create the help link.
  */
 public static function link($module, $topic)
 {
     if (!$GLOBALS['registry']->showService('help')) {
         return '';
     }
     $url = $GLOBALS['registry']->getServiceLink('help', $module)->add('topic', $topic);
     return $url->link(array('title' => Horde_Core_Translation::t("Help"), 'class' => 'helplink', 'target' => 'hordehelpwin', 'onclick' => Horde::popupJs($url, array('urlencode' => true)) . 'return false;')) . Horde_Themes_Image::tag('help.png', array('alt' => Horde_Core_Translation::t("Help"))) . '</a>';
 }
Esempio n. 18
0
 /**
  */
 protected function _content()
 {
     global $registry, $conf;
     $params = array_merge((array) $conf['accounts']['params'], array('user' => $registry->getAuth()));
     switch ($conf['accounts']['driver']) {
         case 'null':
             $mydriver = new Horde_Block_Account_Base($params);
             break;
         case 'localhost':
         case 'finger':
             //case 'kolab':
             $class = 'Horde_Block_Account_' . Horde_String::ucfirst($conf['accounts']['driver']);
             $mydriver = new $class($params);
             break;
         case 'ldap':
             $params = Horde::getDriverConfig('accounts', 'ldap');
             $params['ldap'] = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Ldap')->create('horde', 'accounts');
             $params['user'] = $registry->getAuth($params['strip'] ? 'bare' : null);
             $mydriver = new Horde_Block_Account_Ldap($params);
             break;
         default:
             return '';
     }
     try {
         // Check for password status.
         $status = $mydriver->checkPasswordStatus();
         $table = array(_("User Name") => $mydriver->getUsername());
         if ($fullname = $mydriver->getFullname()) {
             $table[_("Full Name")] = $fullname;
         }
         if ($home = $mydriver->getHome()) {
             $table[_("Home Directory")] = $home;
         }
         if ($shell = $mydriver->getShell()) {
             $table[_("Default Shell")] = $shell;
         }
         if ($quota = $mydriver->getQuota()) {
             $table[_("Quota")] = sprintf(_("%.2fMB used of %.2fMB allowed (%.2f%%)"), $quota['used'] / (1024 * 1024.0), $quota['limit'] / (1024 * 1024.0), $quota['used'] * 100.0 / $quota['limit']);
         }
         if ($lastchange = $mydriver->getPasswordChange()) {
             $table[_("Last Password Change")] = $lastchange;
         }
     } catch (Horde_Exception $e) {
         return $e->getMessage();
     }
     $output = '<table class="item" width="100%" cellspacing="1">';
     if ($status) {
         $output .= '<tr><td colspan="2"><p class="notice">' . Horde_Themes_Image::tag('alerts/warning.png', array('alt' => _("Warning"))) . '&nbsp;&nbsp;' . $status . '</p></td></tr>';
     }
     foreach ($table as $key => $value) {
         $output .= "<tr class=\"text\"><td>{$key}</td><td>{$value}</td></tr>\n";
     }
     $output .= "</table>\n";
     if (!$registry->isInactive('forwards') && $registry->hasMethod('summary', 'forwards')) {
         try {
             $summary = $registry->callByPackage('forwards', 'summary');
             $output .= '<br />' . $summary . "\n";
         } catch (Exception $e) {
         }
     }
     if (!$registry->isInactive('vacation') && $registry->hasMethod('summary', 'vacation')) {
         try {
             $summary = $registry->callByPackage('vacation', 'summary');
             $output .= '<br />' . $summary . "\n";
         } catch (Exception $e) {
         }
     }
     return $output;
 }
Esempio n. 19
0
 /**
  * Wrapper around the Horde_Themes_Image::tag() method.
  *
  * @see Horde_Themes_Image::tag()
  */
 public function hordeImage($src, $alt = '', $attr = '')
 {
     return Horde_Themes_Image::tag($src, array('alt' => $alt, 'attr' => $attr));
 }
Esempio n. 20
0
 /**
  * Renders the tabs.
  *
  * @param string $active_tab  If specified, the name of the active tab. If
  *                            not, the active tab is determined
  *                            automatically.
  * @param string $class       The CSS class of the tabset.
  */
 public function render($active_tab = null, $class = 'tabset')
 {
     $html = "<div class=\"{$class}\"><ul>\n";
     $active = $_SERVER['PHP_SELF'] . $this->_vars->get($this->_name);
     foreach ($this->_tabs as $tab) {
         $link = $this->_addPreserved($tab['link']);
         if (!is_null($this->_name) && !is_null($tab['tabname'])) {
             $link->add($this->_name, $tab['tabname']);
         }
         $classes = array();
         if (isset($tab['class'])) {
             $classes[] = $tab['class'];
         }
         if (!is_null($active_tab) && (string) $active_tab == (string) $tab['tabname'] || $active == $tab['link'] . $tab['tabname']) {
             $classes[] = 'horde-active';
         }
         $class = $classes ? ' class="' . implode(' ', $classes) . '"' : '';
         $id = '';
         if (!empty($tab['id'])) {
             $id = ' id="' . htmlspecialchars($tab['id']) . '"';
         }
         if (!isset($tab['target'])) {
             $tab['target'] = '';
         }
         if (!isset($tab['onclick'])) {
             $tab['onclick'] = '';
         }
         $accesskey = Horde::getAccessKey($tab['title']);
         if (!empty($tab['img'])) {
             $img = Horde_Themes_Image::tag($tab['img']);
         } else {
             $img = '';
         }
         $html .= '<li' . $class . $id . '>' . $link->link(array('target' => $tab['target'], 'onclick' => $tab['onclick'], 'accesskey' => $accesskey)) . $img . Horde::highlightAccessKey(str_replace(' ', '&nbsp;', $tab['title']), $accesskey) . "</a> </li>\n";
     }
     return $html . "</ul></div><br class=\"clear\" />\n";
 }
Esempio n. 21
0
 /**
  * Return the HTML image tag needed to display an emoticon.
  *
  * @param string $icon  The emoticon name.
  *
  * @return string  The HTML image code.
  */
 public function getIcon($icon)
 {
     return Horde_Themes_Image::tag('emoticons/' . $this->getIcons($icon) . '.png', array('alt' => $icon, 'attr' => array('align' => 'middle', 'title' => $icon)));
 }
Esempio n. 22
0
 /**
  */
 public function dataurlCallback($uri)
 {
     /* Limit data to 16 KB in stylesheets. */
     return Horde_Themes_Image::base64ImgData($uri, 16384);
 }
Esempio n. 23
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 />';
        }
    }
}
Esempio n. 24
0
 /**
  */
 protected function _initPages()
 {
     global $injector, $session;
     $this->view->list = array();
     $filters = Ingo_Storage_FilterIterator_Match::create($injector->getInstance('Ingo_Factory_Storage')->create(), $session->get('ingo', 'script_categories'));
     foreach ($filters as $val) {
         // Skip disabled rules.
         if ($val->disable) {
             continue;
         }
         switch (get_class($val)) {
             case 'Ingo_Rule_System_Blacklist':
                 $img = 'blacklist.png';
                 break;
             case 'Ingo_Rule_System_Whitelist':
                 $img = 'whitelist.png';
                 break;
             case 'Ingo_Rule_System_Vacation':
                 $img = 'vacation.png';
                 break;
             case 'Ingo_Rule_System_Forward':
                 $img = 'forward.png';
                 break;
             case 'Ingo_Rule_System_Spam':
                 $img = 'spam.png';
                 break;
             default:
                 $img = null;
                 break;
         }
         $url = new Horde_Core_Smartmobile_Url();
         $url->add('uid', $val->uid);
         $url->setAnchor('rule');
         $this->view->list[] = array('img' => is_null($img) ? null : Horde_Themes_Image::tag($img, array('attr' => array('class' => 'ui-li-icon'))), 'name' => $val->name, 'url' => $url);
     }
 }
Esempio n. 25
0
 /**
  * Returns a link to display and download 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 vfsDisplayUrl($file)
 {
     global $registry;
     $mime_part = new Horde_Mime_Part();
     $mime_part->setType(Horde_Mime_Magic::extToMime($file['type']));
     $viewer = $GLOBALS['injector']->getInstance('Horde_Core_Factory_MimeViewer')->create($mime_part);
     // We can always download files.
     $url_params = array('actionID' => 'download_file', 'file' => $file['name'], 'type' => $file['type'], 'source' => $this->driver->getName(), 'key' => $this->getValue('__key'));
     $dl = Horde::link($registry->downloadUrl($file['name'], $url_params), $file['name']) . Horde_Themes_Image::tag('download.png', array('alt' => _("Download"))) . '</a>';
     // Let's see if we can view this one, too.
     if ($viewer && !$viewer instanceof Horde_Mime_Viewer_Default) {
         $url = Horde::url('view.php')->add($url_params)->add('actionID', 'view_file');
         $link = Horde::link($url, $file['name'], null, '_blank') . $file['name'] . '</a>';
     } else {
         $link = $file['name'];
     }
     return $link . ' ' . $dl;
 }
Esempio n. 26
0
    echo $this->instance;
    ?>
">
  <input type="button" id="button<?php 
    echo $this->instance;
    ?>
" class="horde-default" value="<?php 
    echo _("Change Location");
    ?>
" />
  <span style="display:none;" id="location<?php 
    echo $this->instance;
    ?>
_loading_img">
    <?php 
    echo Horde_Themes_Image::tag('loading.gif');
    ?>
  </span>
</div>
<?php 
}
?>

<div>
 <?php 
if (is_array($this->location)) {
    ?>
     <?php 
    echo sprintf(_("Several locations possible with the parameter: %s"), $this->requested_location);
    ?>
<br />
Esempio n. 27
0
 /**
  */
 protected function _initPages()
 {
     global $injector, $session;
     $this->view->list = array();
     $filters = $injector->getInstance('Ingo_Factory_Storage')->create()->retrieve(Ingo_Storage::ACTION_FILTERS)->getFilterList();
     $s_categories = $session->get('ingo', 'script_categories');
     foreach ($filters as $key => $val) {
         // For now, skip non-display categories and disabled rules.
         if (!empty($val['disable']) || !in_array($val['action'], $s_categories)) {
             continue;
         }
         switch ($val['action']) {
             case Ingo_Storage::ACTION_BLACKLIST:
                 $img = 'blacklist.png';
                 $name = _("Blacklist");
                 break;
             case Ingo_Storage::ACTION_WHITELIST:
                 $img = 'whitelist.png';
                 $name = _("Whitelist");
                 break;
             case Ingo_Storage::ACTION_VACATION:
                 $img = 'vacation.png';
                 $name = _("Vacation");
                 break;
             case Ingo_Storage::ACTION_FORWARD:
                 $img = 'forward.png';
                 $name = _("Forward");
                 break;
             case Ingo_Storage::ACTION_SPAM:
                 $img = 'spam.png';
                 $name = _("Spam Filter");
                 break;
             default:
                 $img = null;
                 $name = $val['name'];
                 break;
         }
         $url = new Horde_Core_Smartmobile_Url();
         $url->add('rulenum', $key);
         $url->setAnchor('rule');
         $this->view->list[] = array('img' => is_null($img) ? null : Horde_Themes_Image::tag($img, array('attr' => array('class' => 'ui-li-icon'))), 'name' => $name, 'url' => $url);
     }
 }
Esempio n. 28
0
 /**
  * Generate RFC 2397-compliant image data strings.
  *
  * @deprecated  Use Horde_Themes_Image::base64ImgData()
  *
  * @param mixed $in       URI or Horde_Themes_Image object containing
  *                        image data.
  * @param integer $limit  Sets a hard size limit for image data; if
  *                        exceeded, will not string encode.
  *
  * @return string  The string to use in the image 'src' attribute; either
  *                 the image data if the browser supports, or the URI
  *                 if not.
  */
 public static function base64ImgData($in, $limit = null)
 {
     return Horde_Themes_Image::base64ImgData($in, $limit);
 }
Esempio n. 29
0
 protected function _handlevEvent($key, array $components, $mime_part)
 {
     global $notification, $registry;
     try {
         $guid = $components[$key]->getAttribute('UID');
     } catch (Horde_Icalendar_Exception $e) {
         /* If required UID parameter doesn't exist, make one
          * up so the user can at least add the event to the
          * calendar. */
         $guid = strval(new Horde_Support_Guid());
     }
     // Check if this is an update.
     try {
         $registry->call('calendar/export', array($guid, 'text/calendar'));
         $success = true;
     } catch (Horde_Exception $e) {
         $success = false;
     }
     // Try to update in calendar.
     if ($success && $registry->hasMethod('calendar/replace')) {
         try {
             $registry->call('calendar/replace', array($guid, $components[$key], $mime_part->getType()));
             $url = Horde::url($registry->link('calendar/show', array('uid' => $guid)));
             $notification->push(_("The event was updated in your calendar.") . '&nbsp;' . Horde::link($url, _("View event"), null, '_blank') . Horde_Themes_Image::tag('mime/icalendar.png', array('alt' => _("View event"))) . '</a>', 'horde.success', array('content.raw'));
             return true;
         } catch (Horde_Exception $e) {
             // Could be a missing permission.
             $notification->push(sprintf(_("There was an error updating the event: %s Trying to import the event instead."), $e->getMessage()), 'horde.warning');
         }
     }
     if ($registry->hasMethod('calendar/import')) {
         // Import into calendar.
         try {
             $guid = $registry->call('calendar/import', array($components[$key], $mime_part->getType()));
             $url = Horde::url($registry->link('calendar/show', array('uid' => $guid)));
             $notification->push(_("The event was added to your calendar.") . '&nbsp;' . Horde::link($url, _("View event"), null, '_blank') . Horde_Themes_Image::tag('mime/icalendar.png', array('alt' => _("View event"))) . '</a>', 'horde.success', array('content.raw'));
             return true;
         } catch (Horde_Exception $e) {
             $notification->push(sprintf(_("There was an error importing the event: %s"), $e->getMessage()), 'horde.error');
         }
     }
     $notification->push(_("This action is not supported."), 'horde.warning');
     return false;
 }
Esempio n. 30
0
            $id = $alarm = null;
        }
    }
}
$view = new Horde_View(array('templatePath' => HORDE_TEMPLATES . '/admin/alarms'));
$view->addHelper('Text');
if ($horde_alarm instanceof Horde_Alarm_Null) {
    $view->alarms = array();
    $view->error = _("Alarms have been disabled in the configuration");
} else {
    try {
        $alarms = $horde_alarm->globalAlarms();
        $url = Horde::url('admin/alarms.php');
        foreach ($alarms as &$alarm) {
            $url->add('alarm', $alarm['id']);
            $alarm['edit_link'] = $url->link() . htmlspecialchars($alarm['title']) . '</a>';
            $alarm['delete_link'] = $url->copy()->add('delete', 1)->link(array('title' => sprintf(_("Delete \"%s\""), $alarm['title']), 'onclick' => 'return confirm(\'' . addslashes(sprintf(_("Are you sure you want to delete '%s'?"), $alarm['title'])) . '\')')) . Horde_Themes_Image::tag('delete.png') . '</a>';
        }
        $view->alarms = $alarms;
    } catch (Horde_Alarm_Exception $e) {
        $view->alarms = array();
        $view->error = sprintf(_("Listing alarms failed: %s"), $e->getMessage());
    }
}
$page_output->header(array('title' => _("Alarms")));
require HORDE_TEMPLATES . '/admin/menu.inc';
echo $view->render('list');
if (!$horde_alarm instanceof Horde_Alarm_Null) {
    $form->renderActive();
}
$page_output->footer();