From: Michael M Slusarz Date: Fri, 30 Jul 2010 18:10:36 +0000 (-0600) Subject: use Horde_Url methods in turba X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=33eb148eb32339607b0ea6684f55013beda5be6c;p=horde.git use Horde_Url methods in turba --- diff --git a/turba/contact.php b/turba/contact.php index 2948bd516..42ab9d96a 100644 --- a/turba/contact.php +++ b/turba/contact.php @@ -94,7 +94,7 @@ if ($own_source == $source && $own_id == $contact->getValue('__key')) { } else { $own_icon = ''; $own_link = '' - . Horde::link(Horde_Util::addParameter($url, array('action' => 'mark_own'))) + . $url->copy()->add('action', 'mark_own')->link() . _("Mark this as your own contact") . ''; } diff --git a/turba/lib/Block/tree_menu.php b/turba/lib/Block/tree_menu.php index 0b123787f..2f7869426 100644 --- a/turba/lib/Block/tree_menu.php +++ b/turba/lib/Block/tree_menu.php @@ -36,7 +36,7 @@ class Horde_Block_turba_tree_menu extends Horde_Block false, array('icon' => 'new.png', 'icondir' => $icondir, - 'url' => Horde_Util::addParameter($add, array('source' => $addressbook)))); + 'url' => $add->copy()->add('source', $addressbook))); } } @@ -49,7 +49,7 @@ class Horde_Block_turba_tree_menu extends Horde_Block false, array('icon' => 'browse.png', 'icondir' => $icondir, - 'url' => Horde_Util::addParameter($browse, array('source' => $addressbook)))); + 'url' => $browse->copy()->add('source', $addressbook))); } } diff --git a/turba/lib/Driver.php b/turba/lib/Driver.php index 1c59de2f8..ce912ca47 100644 --- a/turba/lib/Driver.php +++ b/turba/lib/Driver.php @@ -658,7 +658,7 @@ class Turba_Driver 'recurrence' => array('type' => Horde_Date_Recurrence::RECUR_YEARLY_DATE, 'interval' => 1), 'params' => array('source' => $this->name, 'key' => $key), - 'link' => Horde_Util::addParameter(Horde::applicationUrl('contact.php', true), array('source' => $this->name, 'key' => $key), null, false)); + 'link' => Horde::applicationUrl('contact.php', true)->add(array('source' => $this->name, 'key' => $key))->setRaw(true)); } return $t_objects; diff --git a/turba/lib/Form/EditContactGroup.php b/turba/lib/Form/EditContactGroup.php index 77f417275..a443caa8c 100644 --- a/turba/lib/Form/EditContactGroup.php +++ b/turba/lib/Form/EditContactGroup.php @@ -53,42 +53,42 @@ class Turba_Form_EditContactGroup extends Turba_Form_EditContact $this->getInfo($this->_vars, $info); - $next_page = Horde::applicationUrl('edit.php', true); - $next_page = Horde_Util::addParameter($next_page, - array('source' => $info['source'], - 'original_source' => $info['original_source'], - 'objectkeys' => $info['objectkeys'], - 'url' => $info['url'], - 'actionID' => 'groupedit'), - null, false); + $next_page = Horde::applicationUrl('edit.php', true)->add(array( + 'source' => $info['source'], + 'original_source' => $info['original_source'], + 'objectkeys' => $info['objectkeys'], + 'url' => $info['url'], + 'actionID' => 'groupedit' + ); + $objectkey = array_search($info['source'] . ':' . $info['key'], $info['objectkeys']); $submitbutton = $this->_vars->get('submitbutton'); if ($submitbutton == _("Finish")) { $next_page = Horde::url('browse.php', true); if ($info['original_source'] == '**search') { - $next_page = Horde_Util::addParameter($next_page, 'key', $info['original_source'], false); + $next_page->add('key', $info['original_source']); } else { - $next_page = Horde_Util::addParameter($next_page, 'source', $info['original_source'], false); + $next_page->add('source', $info['original_source']); } } elseif ($submitbutton == _("Previous") && $info['source'] . ':' . $info['key'] != $info['objectkeys'][0]) { /* Previous contact */ list(, $previous_key) = explode(':', $info['objectkeys'][$objectkey - 1]); - $next_page = Horde_Util::addParameter($next_page, 'key', $previous_key, false); + $next_page->add('key', $previous_key); if ($this->getOpenSection()) { - $next_page = Horde_Util::addParameter($next_page, '__formOpenSection', $this->getOpenSection(), false); + $next_page->add('__formOpenSection', $this->getOpenSection()); } } elseif ($submitbutton == _("Next") && $info['source'] . ':' . $info['key'] != $info['objectkeys'][count($info['objectkeys']) - 1]) { /* Next contact */ list(, $next_key) = explode(':', $info['objectkeys'][$objectkey + 1]); - $next_page = Horde_Util::addParameter($next_page, 'key', $next_key, false); + $next_page->add('key', $next_key); if ($this->getOpenSection()) { - $next_page = Horde_Util::addParameter($next_page, '__formOpenSection', $this->getOpenSection(), false); + $next_page->add('__formOpenSection', $this->getOpenSection()); } } - header('Location: ' . $next_page); + header('Location: ' . $next_page->setRaw(true)); exit; } diff --git a/turba/lib/Object.php b/turba/lib/Object.php index 8851f10b8..b6f0a17b0 100644 --- a/turba/lib/Object.php +++ b/turba/lib/Object.php @@ -314,14 +314,16 @@ class Turba_Object { */ function url($view = null, $full = false) { - $url = Horde_Util::addParameter('contact.php', - array('source' => $this->driver->name, - 'key' => $this->getValue('__key'))); + $url = Horde::applicationUrl('contact.php', $full)->add(array( + 'source' => $this->driver->name, + 'key' => $this->getValue('__key') + )); + if (!is_null($view)) { - $url = Horde_Util::addParameter($url, 'view', $view); + $url->add('view', $view); } - return Horde::applicationUrl($url, $full); + return $url; } /** @@ -433,9 +435,7 @@ class Turba_Object { // Let's see if we can view this one, too. if ($viewer && !is_a($viewer, 'Horde_Mime_Viewer_default')) { - $url = Horde::applicationUrl('view.php'); - $url_params['actionID'] = 'view_file'; - $url = Horde_Util::addParameter($url, $url_params); + $url = Horde::applicationUrl('view.php')->add('actionID', 'view_file'); $link = Horde::link($url, $file['name'], null, '_blank') . $file['name'] . ''; } else { $link = $file['name']; diff --git a/turba/lib/Object/Group.php b/turba/lib/Object/Group.php index 4f6dbe79d..4e9b914ff 100644 --- a/turba/lib/Object/Group.php +++ b/turba/lib/Object/Group.php @@ -37,10 +37,10 @@ class Turba_Object_Group extends Turba_Object { */ function url($view = null, $full = false) { - $url = Horde_Util::addParameter('browse.php', - array('source' => $this->getSource(), - 'key' => $this->getValue('__key'))); - return Horde::applicationUrl($url, $full); + return Horde::applicationUrl('browse.php', $full)->add(array( + 'source' => $this->getSource(), + 'key' => $this->getValue('__key') + )); } /** diff --git a/turba/lib/View/List.php b/turba/lib/View/List.php index 1ac2c8f35..04dff4416 100644 --- a/turba/lib/View/List.php +++ b/turba/lib/View/List.php @@ -174,10 +174,10 @@ class Turba_View_List { } list($addToList, $addToListSources) = $this->getAddSources(); - $viewurl = urldecode(Horde_Util::addParameter( - 'browse.php', - array('key' => Horde_Util::getFormData('key'), - 'url' => Horde::selfUrl(true, false, true)))); + $viewurl = Horde::applicationUrl('browse.php')->add(array( + 'key' => Horde_Util::getFormData('key'), + 'url' => Horde::selfUrl(true, false, true) + )); if ($this->type == 'search') { $page = Horde_Util::getFormData('page', 0); @@ -214,7 +214,7 @@ class Turba_View_List { 'val' => Horde_Util::getFormData('val'), 'source' => Horde_Util::getFormData('source', $default_source) )); - $viewurl = urldecode(Horde_Util::addParameter('search.php', $params)); + $viewurl = Horde::applicationUrl('search.php')-add($params); $vars = Horde_Variables::getDefaultVariables(); $pager = new Horde_Core_Ui_Pager('page', $vars, diff --git a/turba/search.php b/turba/search.php index 8bbb8c8e2..9b5384b5b 100644 --- a/turba/search.php +++ b/turba/search.php @@ -159,9 +159,8 @@ if (is_a($driver, 'PEAR_Error')) { } $notification->push(sprintf(_("Successfully created virtual address book \"%s\""), $vname), 'horde.success'); - $url = Horde::applicationURL('browse.php', true); - $url = Horde_Util::addParameter($url, array('source' => $vid, null, false)); - header('Location: ' . $url); + $url = Horde::applicationURL('browse.php', true)->add('source', $vid);; + header('Location: ' . $url->setRaw(true)); exit; } diff --git a/turba/templates/addressbook_list.php b/turba/templates/addressbook_list.php index a980e6f30..1b26efe00 100644 --- a/turba/templates/addressbook_list.php +++ b/turba/templates/addressbook_list.php @@ -26,13 +26,13 @@ - "> + "> get('name')) ?> - "> + "> add('share', $addressbook->getName())->link(array('title' => _("Change Permissions"), 'target' => '_blank', 'onclick' => Horde::popupJs($perms_url_base, array('params' => array('share' => $addressbook->getName()), 'urlencode' => true)) . 'return false;')) . $perms_img . '';?> - "> + "> diff --git a/turba/templates/browse/actions.inc b/turba/templates/browse/actions.inc index 96dee8f51..7676038ab 100644 --- a/turba/templates/browse/actions.inc +++ b/turba/templates/browse/actions.inc @@ -46,9 +46,9 @@ $browse_link = Horde::applicationUrl('browse.php'); if ($this->getType() == 'directory' && !empty($cfgSources[$default_source]['map']['__type'])) { - printf(_("Show %s"), Horde::widget(Horde_Util::addParameter($browse_link, 'show', 'lists'), _("Show Lists"), 'widget', '', '', _("_Lists")) . ', ' . - Horde::widget(Horde_Util::addParameter($browse_link, 'show', 'contacts'), _("Show Contacts"), 'widget', '', '', _("_Contacts")) . ', ' . - Horde::widget(Horde_Util::addParameter($browse_link, 'show', 'all'), _("Show Both"), 'widget', '', '', _("Both"))); + printf(_("Show %s"), Horde::widget($browse_link->copy()->add('show', 'lists'), _("Show Lists"), 'widget', '', '', _("_Lists")) . ', ' . + Horde::widget($browse_link->copy()->add('show', 'contacts'), _("Show Contacts"), 'widget', '', '', _("_Contacts")) . ', ' . + Horde::widget($browse_link->copy()->add('show', 'all'), _("Show Both"), 'widget', '', '', _("Both"))); } ?> diff --git a/turba/templates/browse/column_headers.inc b/turba/templates/browse/column_headers.inc index b543be7c3..5e2a60af3 100644 --- a/turba/templates/browse/column_headers.inc +++ b/turba/templates/browse/column_headers.inc @@ -23,13 +23,13 @@ isSortColumn($i)): ?> getColumnSortDirection($i); ?> - getColumnSortImage($i) ?> + getColumnSortImage($i) ?> - + getSortOrderDescription(), $columnlabel) ?> - getColumnSortImage($i, $sorttitle) ?> - " href=" $i, 'sortdir' => 0)) ?>"> + getColumnSortImage($i, $sorttitle) ?> + " href="copy()->add(array('sortby' => $i, 'sortdir' => 0)) ?>"> diff --git a/turba/templates/browse/row.inc b/turba/templates/browse/row.inc index e2a31d7f5..cff32f8d1 100644 --- a/turba/templates/browse/row.inc +++ b/turba/templates/browse/row.inc @@ -19,9 +19,10 @@ if ($own_source == $ob->getSource() && $own_id == $ob->getValue('__key')) { $edit_url = $vcard_url = ' '; if ($ob->hasValue('__key')) { - $vcard_url = Horde_Util::addParameter('vcard.php', - array('source' => $ob->getSource(), - 'key' => $ob->getValue('__key'))); + $vcard_url = Horde::applicationUrl('vcard.php')->add(array( + 'source' => $ob->getSource(), + 'key' => $ob->getValue('__key') + )); $vcard_url = Horde::link(Horde::applicationUrl($vcard_url), _("Download vCard")) . Horde::img('mime/vcard.png', _("Download vCard")) @@ -29,12 +30,12 @@ if ($ob->hasValue('__key')) { $cell = Horde::link($ob->url()) . $link_text . ''; if ($ob->hasPermission(Horde_Perms::EDIT)) { - $edit_url = Horde_Util::addParameter( - 'contact.php', - array('view' => 'EditContact', - 'source' => $ob->getSource(), - 'key' => $ob->getValue('__key'), - 'url' => Horde::selfUrl(true, false, true))); + $edit_url = Horde::applicationUrl('contact.php')->add(array( + 'view' => 'EditContact', + 'source' => $ob->getSource(), + 'key' => $ob->getValue('__key'), + 'url' => Horde::selfUrl(true, false, true) + )); $edit_url = Horde::link(Horde::applicationUrl($edit_url), _("Edit")) . Horde::img('edit.png', _("Edit")) . ''; diff --git a/turba/templates/list/alphaPager.inc b/turba/templates/list/alphaPager.inc index 5eeac3f7d..f96579e40 100644 --- a/turba/templates/list/alphaPager.inc +++ b/turba/templates/list/alphaPager.inc @@ -6,17 +6,14 @@ $currentPage = Horde_String::upper($page); if ($currentPage == '*') { echo '(' . _("All") . ') '; } else { - echo Horde::link(Horde::applicationUrl(Horde_Util::addParameter($viewurl, array('page' => '*', - 'show' => $show)))) . _("All") . ' '; + Horde::applicationUrl($viewurl)->add(array('page' => '*', 'show' => $show))->link() . _("All") . ' '; } for ($i = 65; $i < 91; $i++) { $a = chr($i); if ($currentPage == $a) { echo '(' . $a . ') '; } else { - $link = Horde_Util::addParameter($viewurl, array('page' => $a, - 'show' => $show)); - echo Horde::link(Horde::applicationUrl($link)) . $a . ' '; + echo Horde::applicationUrl($viewurl)->add(array('page' => $a, 'show' => $show))->link() . $a . ' '; } } ?>