/** */ public function init() { global $page_output; $page_output->addScriptFile('dragdrop2.js'); $page_output->addScriptFile('redbox.js', 'horde'); $page_output->addScriptFile('tooltips.js', 'horde'); $page_output->addScriptFile('colorpicker.js', 'horde'); $page_output->addScriptPackage('Horde_Core_Script_Package_Datejs'); $page_output->addScriptFile('kronolith.js'); Horde_Core_Ui_JsCalendar::init(array('short_weekdays' => true)); $page_output->addInlineJsVars(array('var Kronolith' => $this->_addBaseVars()), array('top' => true)); $page_output->header(array('body_class' => 'horde-ajax', 'growler_log' => true)); }
/** */ public function init() { global $page_output; $page_output->addScriptFile('redbox.js', 'horde'); $page_output->addScriptFile('tooltips.js', 'horde'); $page_output->addScriptPackage('Horde_Core_Script_Package_Datejs'); $page_output->addScriptFile('quickfinder.js', 'horde'); if ($GLOBALS['browser']->isBrowser('msie')) { $page_output->addScriptFile('excanvas/excanvas.min.js', 'horde'); } $page_output->addScriptFile('flotr2/flotr2.js', 'horde'); $page_output->addScriptFile('hermes.js'); Horde_Core_Ui_JsCalendar::init(array('short_weekdays' => true)); $page_output->addInlineJsVars(array('var Hermes' => $this->_addBaseVars()), array('top' => true)); $page_output->header(array('body_class' => 'horde-ajax', 'growler_log' => true)); }
/** */ public function display(Horde_Core_Prefs_Ui $ui) { global $browser, $conf, $injector, $page_output, $prefs; $page_output->addScriptPackage('IMP_Script_Package_Imp'); $p_css = new Horde_Themes_Element('prefs.css'); $page_output->addStylesheet($p_css->fs, $p_css->uri); $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/prefs')); $view->addHelper('Horde_Core_View_Helper_Help'); if (!Horde::isConnectionSecure()) { $view->notsecure = true; } else { $pgp_url = IMP_Basic_Pgp::url(); $view->has_key = $prefs->getValue('pgp_public_key') && $prefs->getValue('pgp_private_key'); if ($view->has_key) { $view->viewpublic = Horde::link($pgp_url->copy()->add('actionID', 'view_personal_public_key'), _("View Personal Public Key"), null, 'view_key'); $view->infopublic = Horde::link($pgp_url->copy()->add('actionID', 'info_personal_public_key'), _("Information on Personal Public Key"), null, 'info_key'); $view->sendkey = Horde::link($ui->selfUrl(array('special' => true, 'token' => true))->add('send_pgp_key', 1), _("Send Key to Public Keyserver")); if ($injector->getInstance('IMP_Pgp')->getPassphrase('personal')) { $view->passphrase = Horde::link($ui->selfUrl(array('special' => true, 'token' => true))->add('unset_pgp_passphrase', 1), _("Unload Passphrase")) . _("Unload Passphrase"); } else { $imple = $injector->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_PassphraseDialog', array('params' => array('reload' => $ui->selfUrl()->setRaw(true)), 'type' => 'pgpPersonal')); $view->passphrase = Horde::link('#', _("Enter Passphrase"), null, null, null, null, null, array('id' => $imple->getDomId())) . _("Enter Passphrase"); } $view->viewprivate = Horde::link($pgp_url->copy()->add('actionID', 'view_personal_private_key'), _("View Personal Private Key"), null, 'view_key'); $view->infoprivate = Horde::link($pgp_url->copy()->add('actionID', 'info_personal_private_key'), _("Information on Personal Private Key"), null, 'info_key'); $page_output->addInlineScript(array('$("delete_pgp_privkey").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")) . ')) { e.stop(); } })'), true); } else { $page_output->addScriptFile('prefs/pgp.js'); Horde_Core_Ui_JsCalendar::init(); $page_output->addInlineJsVars(array('ImpPgp.months' => Horde_Core_Ui_JsCalendar::months())); $imp_identity = $injector->getInstance('IMP_Identity'); $view->fullname = $imp_identity->getFullname(); $view->fromaddr = $imp_identity->getFromAddress()->bare_address; if (!empty($conf['pgp']['keylength'])) { $view->create_pgp_keypair = true; $page_output->addInlineScript(array('$("create_pgp_key").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Key generation may take a long time to complete. Continue with key generation?")) . ')) { e.stop(); } })'), true); } if ($browser->allowFileUploads()) { $view->import_pgp_private = true; $page_output->addInlineScript(array('$("import_pgp_personal").observe("click", function(e) { ' . Horde::popupJs($pgp_url, array('params' => array('actionID' => 'import_personal_key', 'reload' => base64_encode($ui->selfUrl()->setRaw(true))), 'height' => 300, 'width' => 750, 'urlencode' => true)) . '; e.stop(); })'), true); } } } return $view->render('pgpprivatekey'); }
/** * Output the necessary javascript code to allow display of the calendar * widget. * * @param array $params Configuration parameters for the widget: * <pre> * 'click_month' - (boolean) If true, the month is clickable. * DEFAULT: false * 'click_week' - (boolean) If true, will display a clickable week. * DEFAULT: false * 'click_year' - (boolean) If true, the year is clickable. * DEFAULT: false * 'full_weekdays' - (boolean) Add full weekday localized list to * javascript object. * DEFAULT: false * 'short_weekdays' - (boolean) Display only the first letter of * weekdays? * DEFAULT: false * </pre> */ public static function init(array $params = array()) { if (self::$_initRun) { return; } self::$_initRun = true; $params = array_merge(array('click_month' => false, 'click_week' => false, 'click_year' => false, 'full_weekdays' => false, 'short_weekdays' => false), $params); $weekdays = self::weekdays(); if ($params['short_weekdays']) { foreach ($weekdays as &$day) { $day = Horde_String::substr($day, 0, 1); } } $js = array('-Horde_Calendar.click_month' => intval($params['click_month']), '-Horde_Calendar.click_week' => intval($params['click_week']), '-Horde_Calendar.click_year' => intval($params['click_year']), '-Horde_Calendar.firstDayOfWeek' => intval($GLOBALS['prefs']->getValue('first_week_day')), 'Horde_Calendar.months' => self::months(), 'Horde_Calendar.weekdays' => $weekdays); if ($params['full_weekdays']) { $js['Horde_Calendar.fullweekdays'] = self::fullWeekdays(); } $page_output = $GLOBALS['injector']->getInstance('Horde_PageOutput'); $page_output->addScriptFile('calendar.js', 'horde'); $page_output->addInlineJsVars($js); }
/** */ public function menu($menu) { global $browser, $conf, $notification, $page_output, $registry, $session; /* Check here for guest calendars so that we don't get multiple * messages after redirects, etc. */ if (!$registry->getAuth() && !count(Kronolith::listCalendars())) { $notification->push(_("No calendars are available to guests.")); } if ($browser->hasFeature('dom')) { Horde_Core_Ui_JsCalendar::init(array('click_month' => true, 'click_week' => true, 'click_year' => true, 'full_weekdays' => true)); $page_output->addScriptFile('goto.js'); $page_output->addInlineJsVars(array('KronolithGoto.dayurl' => strval(Horde::url('day.php')), 'KronolithGoto.monthurl' => strval(Horde::url('month.php')), 'KronolithGoto.weekurl' => strval(Horde::url('week.php')), 'KronolithGoto.yearurl' => strval(Horde::url('year.php')))); $menu->add(new Horde_Url(''), _("_Goto"), 'kronolith-icon-goto', null, '', null, 'kgotomenu'); } $menu->add(Horde::url('search.php'), _("_Search"), 'kronolith-icon-search'); /* Import/Export. */ if ($conf['menu']['import_export'] && !Kronolith::showAjaxView()) { $menu->add(Horde::url('data.php'), _("_Import/Export"), 'horde-data'); } if (strlen($session->get('kronolith', 'display_cal'))) { $menu->add(Horde::selfUrl(true)->add('display_cal', ''), $registry->getAuth() ? _("Return to my calendars") : _("Return to calendars"), 'kronolith-icon-back', null, null, null, '__noselection'); } }
$date = Horde_Util::getFormData('date', date('Ymd')) . '000600'; $event->start = new Horde_Date($date); if ($prefs->getValue('twentyFour')) { $event->start->hour = 12; } } $event->end = new Horde_Date($event->start); if (Horde_Util::getFormData('allday')) { $event->end->mday++; } else { // Default to a 1 hour duration. $event->end->hour++; } $month = $event->start->month; $year = $event->start->year; $buttons = array('<input type="submit" class="horde-default" name="save" value="' . _("Save Event") . '" />'); $url = Horde_Util::getFormData('url'); if (isset($url)) { $cancelurl = new Horde_Url($url); } else { $cancelurl = Horde::url('month.php', true)->add('month', $month); } $calendars = Kronolith::listCalendars(Horde_Perms::EDIT | Kronolith::PERMS_DELEGATE, true); Horde_Core_Ui_JsCalendar::init(array('full_weekdays' => true)); $page_output->addScriptFile('edit.js'); $page_output->addScriptFile('popup.js', 'horde'); $page_output->header(array('title' => _("Add a new event"))); require KRONOLITH_TEMPLATES . '/javascript_defs.php'; $notification->notify(array('listeners' => 'status')); require KRONOLITH_TEMPLATES . '/edit/edit.inc'; $page_output->footer();
/** * URL Parameters: * <pre> * - criteria_form: (string) JSON representation of the search query. * - edit_query: (integer) If true, edit a search query (contained in * 'mailbox' parameter). * - edit_query_filter: (string) The name of the filter being edited. * - edit_query_vfolder: (string) The name of the virtual folder being * edited. * - mailbox: (string) Mailbox parameter. * - mailbox_list: (array) A list of mailboxes to process (base64url * encoded) If empty, uses 'mailbox' parameter. * - mboxes_form: (string) JSON representation of the list of mailboxes * for the query. Hash containing 2 keys: mbox & * subfolder. Both values are base64url encoded. * - search_label: (string) The label to use when saving the search. * - search_type: (string) The type of saved search ('filter', * 'vfolder'). If empty, the search should not be saved. * - subfolder: (boolean) If set, search mailbox will default to * subfolder search. * </pre> */ protected function _init() { global $injector, $notification, $page_output, $prefs, $registry; /* Define the criteria list. */ $criteria = array('from' => array('label' => _("From"), 'type' => 'header'), 'recip' => array('label' => _("Recipients (To/Cc/Bcc)"), 'type' => 'header'), 'to' => array('label' => _("To"), 'type' => 'header'), 'cc' => array('label' => _("Cc"), 'type' => 'header'), 'bcc' => array('label' => _("Bcc"), 'type' => 'header'), 'subject' => array('label' => _("Subject"), 'type' => 'header'), 'customhdr' => array('label' => _("Custom Header"), 'type' => 'customhdr'), 'body' => array('label' => _("Body"), 'type' => 'text'), 'text' => array('label' => _("Entire Message"), 'type' => 'text'), 'date_range' => array('label' => _("Date"), 'type' => 'date'), 'older' => array('label' => _("Older Than"), 'type' => 'within'), 'younger' => array('label' => _("Younger Than"), 'type' => 'within'), 'size_smaller' => array('label' => _("Size (KB) <"), 'type' => 'size'), 'size_larger' => array('label' => _("Size (KB) >"), 'type' => 'size')); $filters = array('bulk' => array('label' => _("Bulk Messages"), 'type' => 'filter'), 'attach' => array('label' => _("Contains Attachment(s)"), 'type' => 'filter'), 'mailinglist' => array('label' => _("Mailing List Messages"), 'type' => 'filter'), 'personal' => array('label' => _("Personal Messages"), 'type' => 'filter')); /* Define some constants. */ $constants = array('within' => array('d' => IMP_Search_Element_Within::INTERVAL_DAYS, 'm' => IMP_Search_Element_Within::INTERVAL_MONTHS, 'y' => IMP_Search_Element_Within::INTERVAL_YEARS)); if (isset($this->vars->mailbox_list)) { if (is_array($this->vars->mailbox_list)) { $default_mailbox = IMP_Mailbox::get('INBOX'); $search_mailbox = IMP_Mailbox::formFrom($this->vars->mailbox_list); } else { $default_mailbox = IMP_Mailbox::formFrom($this->vars->mailbox_list); $search_mailbox = array($default_mailbox); } } elseif (isset($this->vars->mailbox)) { $default_mailbox = IMP_Mailbox::formFrom($this->vars->mailbox); $search_mailbox = array($default_mailbox); } else { $default_mailbox = IMP_Mailbox::get('INBOX'); $search_mailbox = array($default_mailbox); } /* Check that searching is allowed. */ if (!$injector->getInstance('IMP_Factory_Imap')->create()->access(IMP_Imap::ACCESS_SEARCH)) { $default_mailbox->url('mailbox')->redirect(); } $imp_flags = $injector->getInstance('IMP_Flags'); $imp_search = $injector->getInstance('IMP_Search'); $dynamic_view = $registry->getView() == Horde_Registry::VIEW_DYNAMIC; $js_vars = array(); /* Generate the search query if 'criteria_form' is present in the form * data. */ if ($this->vars->criteria_form) { $c_list = array(); foreach (json_decode($this->vars->criteria_form) as $val) { switch ($val->t) { case 'from': case 'to': case 'cc': case 'bcc': case 'subject': $c_list[] = new IMP_Search_Element_Header($val->v, $val->t, $val->n); break; case 'recip': $c_list[] = new IMP_Search_Element_Recipient($val->v, $val->n); break; case 'customhdr': $c_list[] = new IMP_Search_Element_Header($val->v->s, $val->v->h, $val->n); break; case 'body': case 'text': $c_list[] = new IMP_Search_Element_Text($val->v, $val->t == 'body', $val->n); break; case 'date_range': $c_list[] = new IMP_Search_Element_Daterange($val->b ? new DateTime($val->b) : 0, $val->e ? new DateTime($val->e) : 0, $val->n); break; case 'older': case 'younger': $c_list[] = new IMP_Search_Element_Within($val->v->v, $constants['within'][$val->v->l], $val->t == 'older'); break; case 'size_smaller': case 'size_larger': $c_list[] = new IMP_Search_Element_Size($val->v, $val->t == 'size_larger'); break; case 'or': $c_list[] = new IMP_Search_Element_Or(); break; case 'bulk': $c_list[] = new IMP_Search_Element_Bulk($val->n); break; case 'attach': $c_list[] = new IMP_Search_Element_Attachment($val->n); break; case 'mailinglist': $c_list[] = new IMP_Search_Element_Mailinglist($val->n); break; case 'personal': $c_list[] = new IMP_Search_Element_Personal($val->n); break; case 'flag': /* Flag search. */ $formdata = $imp_flags->parseFormId(rawurldecode($val->v)); $c_list[] = new IMP_Search_Element_Flag($formdata['flag'], $formdata['set'] && !$val->n); break; } } $redirect_dynamic = true; $redirect_target = false; switch ($this->vars->search_type) { case 'filter': $q_ob = $imp_search->createQuery($c_list, array('id' => IMP_Mailbox::formFrom($this->vars->edit_query_filter), 'label' => $this->vars->search_label, 'type' => IMP_Search::CREATE_FILTER)); if ($this->vars->edit_query_filter) { $notification->push(sprintf(_("Filter \"%s\" edited successfully."), $this->vars->search_label), 'horde.success'); $redirect_dynamic = false; $redirect_target = 'prefs'; } else { $notification->push(sprintf(_("Filter \"%s\" created succesfully."), $this->vars->search_label), 'horde.success'); } break; case 'vfolder': $form = json_decode($this->vars->mboxes_form); $q_ob = $imp_search->createQuery($c_list, array('id' => IMP_Mailbox::formFrom($this->vars->edit_query_vfolder), 'label' => $this->vars->search_label, 'mboxes' => IMP_Mailbox::formFrom($form->mbox), 'subfolders' => IMP_Mailbox::formFrom($form->subfolder), 'type' => IMP_Search::CREATE_VFOLDER)); if ($this->vars->edit_query_vfolder) { $notification->push(sprintf(_("Virtual Folder \"%s\" edited successfully."), $this->vars->search_label), 'horde.success'); $redirect_target = 'prefs'; } else { $notification->push(sprintf(_("Virtual Folder \"%s\" created succesfully."), $this->vars->search_label), 'horde.success'); $redirect_target = 'mailbox'; } break; default: $form = json_decode($this->vars->mboxes_form); $q_ob = $imp_search->createQuery($c_list, array('mboxes' => IMP_Mailbox::formFrom($form->mbox), 'subfolders' => IMP_Mailbox::formFrom($form->subfolder))); $redirect_target = 'mailbox'; break; } /* Redirect to the mailbox page. */ if ($redirect_target) { if ($dynamic_view && $redirect_dynamic) { echo '<html><head>' . Horde::wrapInlineScript(array('window.parent.DimpBase.go("mbox", "' . $q_ob->mbox_ob->form_to . '")')) . '</head></html>'; exit; } switch ($redirect_target) { case 'mailbox': $q_ob->mbox_ob->url('mailbox')->redirect(); break; case 'prefs': $registry->getServiceLink('prefs', 'imp')->add('group', 'searches')->redirect(); break; } exit; } } /* Prepare the search view. */ $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/search')); $view->addHelper('Text'); $view->addHelper('Tag'); $view->addHelper('FormTag'); $view->action = self::url(); /* Determine if we are editing a search query. */ $q_ob = $default_mailbox->getSearchOb(); if ($this->vars->edit_query && $default_mailbox->search) { if ($default_mailbox->vfolder) { if (!$default_mailbox->editvfolder) { $notification->push(_("Built-in Virtual Folders cannot be edited."), 'horde.error'); $registry->getServiceLink('prefs', 'imp')->add('group', 'searches')->redirect(); } $view->edit_query = true; $view->edit_query_vfolder = $default_mailbox->form_to; } elseif ($imp_search->isFilter($q_ob)) { if (!$imp_search->isFilter($q_ob, true)) { $notification->push(_("Built-in Filters cannot be edited."), 'horde.error'); $registry->getServiceLink('prefs', 'imp')->add('group', 'searches')->redirect(); } $view->edit_query = true; $view->edit_query_filter = $default_mailbox->form_to; } if ($view->edit_query) { $view->search_label = $q_ob->label; $js_vars['ImpSearch.prefsurl'] = strval($registry->getServiceLink('prefs', 'imp')->add('group', 'searches')->setRaw(true)); } } else { /* Process list of recent searches. */ $iterator = IMP_Search_IteratorFilter::create(IMP_Search_IteratorFilter::QUERY); $rs = array(); foreach ($iterator as $val) { $rs[$val->formid] = array('c' => $val->criteria, 'f' => array('m' => IMP_Mailbox::formTo($val->all ? array(IMP_Search_Query::ALLSEARCH) : array_map('strval', $val->mbox_list)), 's' => IMP_Mailbox::formTo(array_map('strval', $val->subfolder_list))), 'l' => Horde_String::truncate($val->querytext)); } if (!empty($rs)) { $js_vars['ImpSearch.i_recent'] = $rs; } $s_mboxes = IMP_Mailbox::formTo($search_mailbox); $js_vars['ImpSearch.i_mboxes'] = array('m' => $this->vars->subfolder ? array() : $s_mboxes, 's' => $this->vars->subfolder ? $s_mboxes : array()); } if ($default_mailbox->search) { $js_vars['ImpSearch.i_criteria'] = $q_ob->criteria; $js_vars['ImpSearch.i_mboxes'] = array('m' => IMP_Mailbox::formTo($q_ob->all ? array(IMP_Search_Query::ALLSEARCH) : $q_ob->mbox_list), 's' => IMP_Mailbox::formTo($q_ob->subfolder_list)); } /* Create the criteria list. */ $c_list = $types = array(); foreach ($criteria as $key => $val) { $c_list[] = array('l' => $val['label'], 'v' => $key); $types[$key] = $val['type']; } $view->clist = $c_list; /* Create the filter list. These are all-or-nothing searches. */ $f_list = array(); foreach ($filters as $key => $val) { $f_list[] = array('l' => $val['label'], 'v' => $key); $types[$key] = 'filter'; } $view->filterlist = $f_list; /* Create the flag list. */ $flist = $imp_flags->getList(array('imap' => true, 'mailbox' => $default_mailbox)); $flag_set = array(); foreach ($flist as $val) { $flag_set[] = array('l' => $val->label, 'v' => rawurlencode($val->form_set)); $types[rawurlencode($val->form_set)] = 'flag'; } $view->flist = $flag_set; /* Generate master mailbox list. */ $mbox_list = array(); if (!$view->edit_query_filter) { $js_vars['ImpSearch.allsearch'] = IMP_Mailbox::formTo(IMP_Search_Query::ALLSEARCH); $ob = $injector->getInstance('IMP_Search_Ui')->getSearchMboxList(); $mbox_list = $ob->mbox_list; $view->subscribe = $prefs->getValue('subscribe'); $view->tree = $ob->tree->getTree(); } /* Prepare the topbar. */ if (!$dynamic_view) { $injector->getInstance('Horde_View_Topbar')->subinfo = $injector->getInstance('IMP_View_Subinfo')->render(); } Horde_Core_Ui_JsCalendar::init(); $page_output->addScriptFile('hordecore.js', 'horde'); $page_output->addScriptFile('horde.js', 'horde'); $page_output->addScriptFile('search.js'); $page_output->addInlineJsVars(array_merge($js_vars, array('ImpSearch.data' => array('constants' => $constants, 'dynamic_view' => $dynamic_view, 'inbox' => IMP_Mailbox::get('INBOX')->form_to, 'mbox_list' => $mbox_list, 'months' => Horde_Core_Ui_JsCalendar::months(), 'searchmbox' => $default_mailbox->form_to, 'types' => $types), 'ImpSearch.text' => array('and' => _("and"), 'customhdr' => _("Custom Header:"), 'datereset' => _("Date Reset"), 'dateselection' => _("Date Selection"), 'flag' => _("Flag:"), 'loading' => _("Loading..."), 'need_criteria' => _("Please select at least one search criteria."), 'need_date' => _("Need at least one date in the date range search."), 'need_mbox' => _("Please select at least one mailbox to search."), 'need_label' => _("Saved searches require a label."), 'not_match' => _("Do NOT Match"), 'or' => _("OR"), 'search_all' => _("Search All Mailboxes"), 'search_term' => _("Search Term:"), 'subfolder_search' => _("Search all subfolders?"), 'to' => _("to")))), array('onload' => true)); if ($dynamic_view) { if (!$this->vars->edit_query) { $view->return_mailbox_val = sprintf(_("Return to %s"), $default_mailbox->display_html); } $page_output->topbar = $page_output->sidebar = false; $this->header_params = array('html_id' => 'htmlAllowScroll'); } $this->title = _("Search"); $this->output = $view->render('search'); }
public function html($active = true) { if (!$this->_event) { echo '<h3>' . _("Event not found") . '</h3>'; exit; } if (is_string($this->_event)) { echo '<h3>' . $this->_event . '</h3>'; exit; } $identity = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create(); if ($this->_event->hasPermission(Horde_Perms::EDIT)) { $calendar_id = $this->_event->calendarType . '_' . $this->_event->calendar; } else { $calendar_id = 'internal_' . Kronolith::getDefaultCalendar(Horde_Perms::EDIT); } if (!$this->_event->hasPermission(Horde_Perms::EDIT)) { try { $calendar_id .= '\\' . $this->_event->getShare()->get('owner'); } catch (Exception $e) { } } $GLOBALS['session']->set('kronolith', 'attendees', $this->_event->attendees); $GLOBALS['session']->set('kronolith', 'resources', $this->_event->getResources()); if ($datetime = Horde_Util::getFormData('datetime')) { $datetime = new Horde_Date($datetime); $month = $datetime->month; $year = $datetime->year; } else { $month = Horde_Util::getFormData('month', date('n')); $year = Horde_Util::getFormData('year', date('Y')); } $url = Horde_Util::getFormData('url'); $perms = Horde_Perms::EDIT; if ($this->_event->creator == $GLOBALS['registry']->getAuth()) { $perms |= Kronolith::PERMS_DELEGATE; } $calendars = Kronolith::listCalendars($perms, true); $buttons = array(); if (!$this->_event->hasPermission(Horde_Perms::EDIT) && ($GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_events') === true || $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())) { $buttons[] = '<input type="submit" class="horde-create" name="saveAsNew" value="' . _("Save As New") . '" />'; } else { if ($this->_event->hasPermission(Horde_Perms::EDIT)) { $buttons[] = '<input type="submit" class="horde-default" name="save" value="' . _("Save Event") . '" />'; } if ($this->_event->initialized) { if (!$this->_event->recurs() && ($GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_events') === true || $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())) { $buttons[] = '<input type="submit" class="horde-create" name="saveAsNew" value="' . _("Save As New") . '" />'; } } } if (isset($url)) { $cancelurl = new Horde_Url($url); } else { $cancelurl = Horde::url('month.php', true)->add(array('month' => $month, 'year' => $year)); } $event =& $this->_event; $tags = implode(',', array_values($event->tags)); Horde_Core_Ui_JsCalendar::init(array('full_weekdays' => true)); global $page_output; $page_output->addScriptFile('hordecore.js', 'horde'); $page_output->addScriptFile('edit.js'); $page_output->addScriptFile('popup.js', 'horde'); echo '<div id="EditEvent"' . ($active ? '' : ' style="display:none"') . '>'; require KRONOLITH_TEMPLATES . '/edit/edit.inc'; echo '</div>'; if ($active && $GLOBALS['browser']->hasFeature('dom')) { if ($this->_event->hasPermission(Horde_Perms::READ)) { $view = new Kronolith_View_Event($this->_event); $view->html(false); } if ($this->_event->hasPermission(Horde_Perms::DELETE)) { $delete = new Kronolith_View_DeleteEvent($this->_event); $delete->html(false); } } }
protected function _renderVarInput_monthdayyear($form, &$var, &$vars) { $date = $var->type->getDateParts($var->getValue($vars)); var_dump($date); $html = sprintf('<input type="text" name="%s" id="%s" size="10"%s>', htmlspecialchars($var->getVarName()), $this->_genID($var->getVarNamee(), false), $this->_getActionScripts($form, $var)); if ($var->type->getProperty('picker') && $GLOBALS['browser']->hasFeature('javascript')) { $js = "document.observe('Horde_Calendar:select', " . "function(e) {" . "var elt = e.element();" . "elt.up().previous('SELECT[name\$=\"[month]\"]').setValue(e.memo.getMonth() + 1);" . "elt.up().previous('SELECT[name\$=\"[day]\"]').setValue(e.memo.getDate());" . "elt.up().previous('SELECT[name\$=\"[year]\"]').setValue(e.memo.getFullYear());" . "});\n"; $GLOBALS['injector']->getInstance('Horde_PageOutput')->addInlineScript($js, true); Horde_Core_Ui_JsCalendar::init(); $imgId = $this->_genID($var->getVarName(), false) . 'goto'; $html .= Horde::link('#', Horde_Core_Translation::t("Select a date"), '', '', 'Horde_Calendar.open(\'' . $imgId . '\', null)') . Horde::img('calendar.png', Horde_Core_Translation::t("Calendar"), 'id="' . $imgId . '"') . "</a>\n"; } return $html; }
protected function _renderVarInput_monthdayyear($form, &$var, &$vars) { try { $date = $var->type->getDateParts($var->getValue($vars)); } catch (Horde_Date_Exception $e) { return $this->_renderVarInput_basic($form, $var, $vars); } $GLOBALS['injector']->getInstance('Horde_PageOutput')->addInlineScript("document.observe('Horde_Calendar:select', " . "function(e) {" . "var elt = e.element();" . "elt.up().previous('SELECT[name\$=\"[month]\"]').setValue(e.memo.getMonth() + 1);" . "elt.up().previous('SELECT[name\$=\"[day]\"]').setValue(e.memo.getDate());" . "elt.up().previous('SELECT[name\$=\"[year]\"]').setValue(e.memo.getFullYear());" . "});", true); $dates = array('month' => array('' => Horde_Core_Translation::t("MM"), '1' => Horde_Core_Translation::t("January"), '2' => Horde_Core_Translation::t("February"), '3' => Horde_Core_Translation::t("March"), '4' => Horde_Core_Translation::t("April"), '5' => Horde_Core_Translation::t("May"), '6' => Horde_Core_Translation::t("June"), '7' => Horde_Core_Translation::t("July"), '8' => Horde_Core_Translation::t("August"), '9' => Horde_Core_Translation::t("September"), '10' => Horde_Core_Translation::t("October"), '11' => Horde_Core_Translation::t("November"), '12' => Horde_Core_Translation::t("December"))); $dates['day'] = array('' => Horde_Core_Translation::t("DD")); for ($i = 1; $i <= 31; $i++) { $dates['day'][$i] = $i; } $dates['year'] = array('' => Horde_Core_Translation::t("YYYY")); if ($var->type->getProperty('start_year') > $var->type->getProperty('end_year')) { for ($i = $var->type->getProperty('start_year'); $i >= $var->type->getProperty('end_year'); $i--) { $dates['year'][$i] = $i; } } else { for ($i = $var->type->getProperty('start_year'); $i <= $var->type->getProperty('end_year'); $i++) { $dates['year'][$i] = $i; } } // TODO: use NLS to get the order right for the Rest Of The // World. $html = ''; $date_parts = array('month', 'day', 'year'); foreach ($date_parts as $part) { $html .= sprintf('<select name="%s" id="%s"%s>%s</select>', htmlspecialchars($var->getVarName() . '[' . $part . ']'), $this->_genID($var->getVarName(), false) . $part, $this->_getActionScripts($form, $var), $this->selectOptions($dates[$part], $date[$part])); } if ($var->type->getProperty('picker') && $GLOBALS['browser']->hasFeature('javascript')) { Horde_Core_Ui_JsCalendar::init(); $imgId = $this->_genID($var->getVarName(), false) . 'goto'; $html .= Horde::link('#', Horde_Core_Translation::t("Select a date"), '', '', 'Horde_Calendar.open(\'' . $imgId . '\', null)') . Horde_Themes_Image::tag('calendar.png', array('alt' => Horde_Core_Translation::t("Calendar"), 'attr' => array('id' => $imgId))) . "</a>\n"; } return $html; }
protected function _renderVarInput_NagStart($form, $var, $vars) { $var->type->getInfo($vars, $var, $task_start); $start_dt = $task_start == 0 ? $_SERVER['REQUEST_TIME'] + 604800 : $task_start; $on = $task_start > 0; /* Set up the radio buttons. */ $html = sprintf('<input id="start_date_none" name="start_date" type="radio" class="radio" value="none"%s /> %s <br /> <input id="start_date_specified" name="start_date" type="radio" class="radio" value="specified"%s /> <label for="start_date_specified" class="hidden">%s</label> <label for="start_date" class="hidden">%s</label> <input type="text" name="start[date]" id="start_date" size="10" value="%s">', $on ? '' : ' checked="checked"', Horde::label('start_date_none', _("No delay")), $on ? ' checked="checked"' : '', _("Start date specified."), _("Date"), htmlspecialchars(strftime($GLOBALS['prefs']->getValue('time_format_mini'), $start_dt))); if ($GLOBALS['browser']->hasFeature('javascript')) { Horde_Core_Ui_JsCalendar::init(array('full_weekdays' => true)); $GLOBALS['page_output']->addScriptFile('calendar.js'); $html .= ' <span id="start_wday"></span>' . Horde::img('calendar.png', _("Calendar"), 'id="startimg"'); } return $html; }