From: Michael M Slusarz Date: Fri, 3 Sep 2010 23:19:00 +0000 (-0600) Subject: Use Horde::addInlineJsVars() X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6717b87acee9b8f9b42b638d7b952428021ad80f;p=horde.git Use Horde::addInlineJsVars() --- diff --git a/framework/Core/lib/Horde/Core/Prefs/Ui/Widgets.php b/framework/Core/lib/Horde/Core/Prefs/Ui/Widgets.php index 1dc73058a..f8f98c15b 100644 --- a/framework/Core/lib/Horde/Core/Prefs/Ui/Widgets.php +++ b/framework/Core/lib/Horde/Core/Prefs/Ui/Widgets.php @@ -82,8 +82,8 @@ class Horde_Core_Prefs_Ui_Widgets 'unselected' => $val[1] ); } - Horde::addInlineScript(array( - 'HordeSourceSelectPrefs.source_list = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + Horde::addInlineJsVars(array( + 'HordeSourceSelectPrefs.source_list' => $js )); } @@ -222,9 +222,9 @@ class Horde_Core_Prefs_Ui_Widgets ); } - Horde::addInlineScript(array( - 'HordeAddressbooksPrefs.fields = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), - 'HordeAddressbooksPrefs.nonetext = ' . Horde_Serialize::serialize(_("No address book selected."), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + Horde::addInlineJsVars(array( + 'HordeAddressbooksPrefs.fields' => $js, + 'HordeAddressbooksPrefs.nonetext' => _("No address book selected.") )); } @@ -282,8 +282,8 @@ class Horde_Core_Prefs_Ui_Widgets { $pref = $data['pref']; - Horde::addInlineScript(array( - 'HordeAlarmPrefs.pref = ' . Horde_Serialize::serialize($pref, Horde_Serialize::JSON) + Horde::addInlineJsVars(array( + 'HordeAlarmPrefs.pref' => $pref )); $alarm_pref = unserialize($GLOBALS['prefs']->getValue($pref)); diff --git a/framework/Core/lib/Horde/Core/Ui/JsCalendar.php b/framework/Core/lib/Horde/Core/Ui/JsCalendar.php index 21900559b..46503b07f 100644 --- a/framework/Core/lib/Horde/Core/Ui/JsCalendar.php +++ b/framework/Core/lib/Horde/Core/Ui/JsCalendar.php @@ -64,20 +64,20 @@ class Horde_Core_Ui_JsCalendar } } - Horde::addScriptFile('calendar.js', 'horde'); - Horde::addInlineScript(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 = ' . Horde_Serialize::serialize(self::months(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), - 'Horde_Calendar.weekdays = ' . Horde_Serialize::serialize($weekdays, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + $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']) { - Horde::addInlineScript(array( - 'Horde_Calendar.fullweekdays = ' . Horde_Serialize::serialize(self::fullWeekdays(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) - )); + $js['Horde_Calendar.fullweekdays'] = self::fullWeekdays(); } + + Horde::addScriptFile('calendar.js', 'horde'); + Horde::addInlineJsVars($js); } /** diff --git a/framework/Core/lib/Horde/Core/Ui/VarRenderer/Html.php b/framework/Core/lib/Horde/Core/Ui/VarRenderer/Html.php index 89e7703d6..bcbc917f0 100644 --- a/framework/Core/lib/Horde/Core/Ui/VarRenderer/Html.php +++ b/framework/Core/lib/Horde/Core/Ui/VarRenderer/Html.php @@ -310,8 +310,8 @@ class Horde_Core_Ui_VarRenderer_Html extends Horde_Core_Ui_VarRenderer ); } - Horde::addInlineScript(array( - 'Horde_Html_Helper.iconlist = ' . Horde_Serialize::serialize($icon_list, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + Horde::addInlineJsVars(array( + 'Horde_Html_Helper.iconlist' => $icon_list )); $html .= Horde::link('#', _("Emoticons"), '', '', 'Horde_Html_Helper.open(\'emoticons\', \'' . $var->getVarName() . '\'); return false;') . Horde::img('emoticons/smile.png', _("Emoticons"), 'id="' . $imgId . '"') . ''; diff --git a/framework/Core/lib/Horde/Script/Files.php b/framework/Core/lib/Horde/Script/Files.php index 8b808da81..e28968bd5 100644 --- a/framework/Core/lib/Horde/Script/Files.php +++ b/framework/Core/lib/Horde/Script/Files.php @@ -109,7 +109,9 @@ class Horde_Script_Files // Add localized string for popup.js if (($file == 'popup.js') && ($app == 'horde')) { - Horde::addInlineScript('Horde.popup_block_text=' . Horde_Serialize::serialize(_("A popup window could not be opened. Your browser may be blocking popups."), Horde_Serialize::JSON), 'dom'); + Horde::addInlineJsVars(array( + 'Horde.popup_block_text' => _("A popup window could not be opened. Your browser may be blocking popups.") + )); } if ($file[0] == '/') { diff --git a/framework/Model/lib/Horde/Form/VarRenderer/Xhtml.php b/framework/Model/lib/Horde/Form/VarRenderer/Xhtml.php index 319582666..856519b9a 100644 --- a/framework/Model/lib/Horde/Form/VarRenderer/Xhtml.php +++ b/framework/Model/lib/Horde/Form/VarRenderer/Xhtml.php @@ -174,8 +174,8 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer ); } - Horde::addInlineScript(array( - 'Horde_Html_Helper.iconlist = ' . Horde_Serialize::serialize($icon_list, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + Horde::addInlineJsVars(array( + 'Horde_Html_Helper.iconlist' => $icon_list )); $html .= Horde::link('#', _("Emoticons"), '', '', 'Horde_Html_Helper.open(\'emoticons\', \'' . $var->getVarName() . '\'); return false;') diff --git a/horde/admin/activesync.php b/horde/admin/activesync.php index be6165141..befb78650 100644 --- a/horde/admin/activesync.php +++ b/horde/admin/activesync.php @@ -64,8 +64,8 @@ foreach ($devices as $key => $val) { } Horde::addScriptFile('activesyncadmin.js'); -Horde::addInlineScript(array( - 'HordeActiveSyncAdmin.devices = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $registry->getCharset()) +Horde::addInlineJsVars(array( + 'HordeActiveSyncAdmin.devices' => $js )); $title = _("ActiveSync Device Administration"); diff --git a/horde/admin/user.php b/horde/admin/user.php index c4a16a34c..ef5f6b17b 100644 --- a/horde/admin/user.php +++ b/horde/admin/user.php @@ -216,8 +216,8 @@ case 'removequeued': Horde::addScriptFile('stripe.js', 'horde'); if (isset($update_form) && $auth->hasCapability('list')) { Horde::addScriptFile('userupdate.js', 'horde'); - Horde::addInlineScript(array( - 'HordeAdminUserUpdate.pass_error = ' . Horde_Serialize::serialize(_("Passwords must match."), Horde_Serialize::JSON, $registry->getCharset()) + Horde::addInlineJsVars(array( + 'HordeAdminUserUpdate.pass_error' => _("Passwords must match.") )); } diff --git a/horde/lib/Prefs/Ui.php b/horde/lib/Prefs/Ui.php index 1cb1f7625..e54d8ce67 100644 --- a/horde/lib/Prefs/Ui.php +++ b/horde/lib/Prefs/Ui.php @@ -221,8 +221,8 @@ class Horde_Prefs_Ui { Horde::addScriptFile('categoryprefs.js', 'horde'); Horde::addScriptFile('colorpicker.js', 'horde'); - Horde::addInlineScript(array( - 'HordeAlarmPrefs.category_text = ' . Horde_Serialize::serialize(_("Enter a name for the new category:"), Horde_Serialize::JSON) + Horde::addInlineJsVars(array( + 'HordeAlarmPrefs.category_text' => _("Enter a name for the new category:") )); $cManager = new Horde_Prefs_CategoryManager(); @@ -312,9 +312,8 @@ class Horde_Prefs_Ui ); } - Horde::addInlineScript(array( - 'HordeRpcPrefs.servers = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON) - + Horde::addInlineJsVars(array( + 'HordeRpcPrefs.servers' => $js )); $t = $GLOBALS['injector']->createInstance('Horde_Template'); @@ -392,8 +391,8 @@ class Horde_Prefs_Ui } Horde::addScriptFile('activesyncprefs.js', 'horde'); - Horde::addInlineScript(array( - 'HordeActiveSyncPrefs.devices = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + Horde::addInlineJsVars(array( + 'HordeActiveSyncPrefs.devices' => $js )); $t = $GLOBALS['injector']->createInstance('Horde_Template'); diff --git a/horde/login.php b/horde/login.php index 1afb7f667..bdba79707 100644 --- a/horde/login.php +++ b/horde/login.php @@ -83,8 +83,8 @@ $loginparams = array( ) ); $js_code = array( - 'HordeLogin.user_error = ' . Horde_Serialize::serialize(_("Please enter a username."), Horde_Serialize::JSON), - 'HordeLogin.pass_error = ' . Horde_Serialize::serialize(_("Please enter a password."), Horde_Serialize::JSON) + 'HordeLogin.user_error' => _("Please enter a username."), + 'HordeLogin.pass_error' => _("Please enter a password.") ); $js_files = array( array('login.js', 'horde') @@ -332,11 +332,8 @@ if (!empty($js_files)) { } } +Horde::addInlineJsVars($js_code); + require $registry->get('templates', 'horde') . '/common-header.inc'; require $registry->get('templates', 'horde') . '/login/login.inc'; - -if (!empty($js_code)) { - echo Horde::wrapInlineScript(array(implode(';', $js_code))); -} - require $registry->get('templates', 'horde') . '/common-footer.inc'; diff --git a/horde/services/sidebar.php b/horde/services/sidebar.php index 09ffc90d5..1a148f74e 100644 --- a/horde/services/sidebar.php +++ b/horde/services/sidebar.php @@ -36,12 +36,12 @@ if (!Horde_Util::getFormData('ajaxui') && $show_sidebar = !isset($_COOKIE['horde_sidebar_expanded']) || $_COOKIE['horde_sidebar_expanded']; $width = intval($prefs->getValue('sidebar_width')); - Horde::addInlineScript(array( - 'HordeSidebar.domain = ' . Horde_Serialize::serialize($conf['cookie']['domain'], Horde_Serialize::JSON, $charset), - 'HordeSidebar.path = ' . Horde_Serialize::serialize($conf['cookie']['path'], Horde_Serialize::JSON, $charset), - 'HordeSidebar.refresh = ' . intval($prefs->getValue('menu_refresh_time')), - 'HordeSidebar.url = ' . Horde_Serialize::serialize(strval($ajax_url), Horde_Serialize::JSON, $charset), - 'HordeSidebar.width = ' . $width + Horde::addInlineJsVars(array( + 'HordeSidebar.domain' => $conf['cookie']['domain'], + 'HordeSidebar.path' => $conf['cookie']['path'], + '-HordeSidebar.refresh' => intval($prefs->getValue('menu_refresh_time')), + 'HordeSidebar.url' => strval($ajax_url), + '-HordeSidebar.width' => $width )); require $registry->get('templates', 'horde') . '/sidebar/sidebar.inc'; diff --git a/imp/compose.php b/imp/compose.php index 88ed766b4..93af2b853 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -689,7 +689,7 @@ $js_code = array( /* Create javascript identities array. */ if (!$redirect) { - $js_code[] = $imp_ui->identityJs(); + $js_code = array_merge($js_code, $imp_ui->identityJs()); } /* Set up the base template now. */ diff --git a/imp/folders.php b/imp/folders.php index 3ac41d3b9..95e8aecae 100644 --- a/imp/folders.php +++ b/imp/folders.php @@ -37,8 +37,8 @@ $vars = Horde_Variables::getDefaultVariables(); $folders_url = Horde::selfUrl(); /* This JS define is required by all folder pages. */ -Horde::addInlineScript(array( - 'ImpFolders.folders_url = ' . Horde_Serialize::serialize(strval($folders_url), Horde_Serialize::JSON, $charset) +Horde::addInlineJsVars(array( + 'ImpFolders.folders_url' => strval($folders_url) )); /* Initialize the IMP_Folder object. */ @@ -425,11 +425,11 @@ if (!empty($imaptree->recent)) { IMP::newmailAlerts($imaptree->recent); } -Horde::addInlineScript(array( - 'ImpFolders.ajax = ' . Horde_Serialize::serialize(Horde::getServiceLink('ajax', 'imp')->url, Horde_Serialize::JSON, $charset), - 'ImpFolders.displayNames = ' . Horde_Serialize::serialize($displayNames, Horde_Serialize::JSON, $charset), - 'ImpFolders.fullNames = ' . Horde_Serialize::serialize($fullNames, Horde_Serialize::JSON, $charset), - 'ImpFolders.mbox_expand = ' . intval($prefs->getValue('nav_expanded') == 2) +Horde::addInlineJsVars(array( + 'ImpFolders.ajax' => Horde::getServiceLink('ajax', 'imp')->url, + 'ImpFolders.displayNames' => $displayNames, + 'ImpFolders.fullNames' => $fullNames, + '-ImpFolders.mbox_expand' => intval($prefs->getValue('nav_expanded') == 2) )); $title = _("Folder Navigator"); diff --git a/imp/lib/Ajax/Imple/ContactAutoCompleter.php b/imp/lib/Ajax/Imple/ContactAutoCompleter.php index 5763af4ed..0acbecf18 100644 --- a/imp/lib/Ajax/Imple/ContactAutoCompleter.php +++ b/imp/lib/Ajax/Imple/ContactAutoCompleter.php @@ -66,7 +66,11 @@ class IMP_Ajax_Imple_ContactAutoCompleter extends Horde_Core_Ajax_Imple_AutoComp if (!isset($addrlist)) { $addrlist = IMP_Compose::getAddressList(); } - Horde::addInlineScript('if (!window.IMP) window.IMP = {}; IMP.ac_list = '. Horde_Serialize::serialize($addrlist, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())); + Horde::addInlineScript(array_merge(array( + 'if (!window.IMP) window.IMP = {}' + ), Horde::addInlineJsVars(array( + 'IMP.ac_list' => $addrlist + ), true))); self::$_listOutput = true; } diff --git a/imp/lib/Application.php b/imp/lib/Application.php index b451b4114..33c268646 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -236,7 +236,7 @@ class IMP_Application extends Horde_Registry_Application /* Show selection of alternate views. */ $js_code = array( - 'ImpLogin.server_key_error=' . Horde_Serialize::serialize(_("Please choose a mail server."), Horde_Serialize::JSON) + 'ImpLogin.server_key_error' => _("Please choose a mail server.") ); if (!empty($GLOBALS['conf']['user']['select_view'])) { if (!($view_cookie = Horde_Util::getFormData('imp_select_view'))) { @@ -245,7 +245,7 @@ class IMP_Application extends Horde_Registry_Application : ($GLOBALS['browser']->isMobile() ? 'mimp' : 'imp'); } - $js_code[] = 'ImpLogin.dimp_sel=' . intval($view_cookie == 'dimp'); + $js_code['-ImpLogin.dimp_sel'] = intval($view_cookie == 'dimp'); $params['imp_select_view'] = array( 'label' => _("Mode"), @@ -269,7 +269,7 @@ class IMP_Application extends Horde_Registry_Application } return array( - 'js_code' => $js_code, + 'js_code' => Horde::addInlineJsVars($js_code, true), 'js_files' => array( array('login.js', 'imp') ), diff --git a/imp/lib/Prefs/Ui.php b/imp/lib/Prefs/Ui.php index 5cb44ec19..6a6da5fc0 100644 --- a/imp/lib/Prefs/Ui.php +++ b/imp/lib/Prefs/Ui.php @@ -258,8 +258,8 @@ class IMP_Prefs_Ui if (!empty($code)) { Horde::addScriptFile('folderprefs.js', 'imp'); - Horde::addInlineScript(array( - 'ImpFolderPrefs.folders = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + Horde::addInlineJsVars(array( + 'ImpFolderPrefs.folders' => $code )); } break; @@ -590,8 +590,8 @@ class IMP_Prefs_Ui { $ui->nobuttons = true; - Horde::addInlineScript(array( - 'ImpAccountsPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this account?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + Horde::addInlineHsVars(array( + 'ImpAccountsPrefs.confirm_delete' => _("Are you sure you want to delete this account?") )); $t = $GLOBALS['injector']->createInstance('Horde_Template'); @@ -927,9 +927,9 @@ class IMP_Prefs_Ui */ protected function _flagManagement() { - Horde::addInlineScript(array( - 'ImpFlagPrefs.new_prompt = ' . Horde_Serialize::serialize(_("Please enter the label for the new flag:"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), - 'ImpFlagPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this flag?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + Horde::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?") )); $msgflags_locked = $GLOBALS['prefs']->isLocked('msgflags'); @@ -1264,11 +1264,9 @@ class IMP_Prefs_Ui $js[$key] = $identity->getValue('sent_mail_folder', $key); }; - Horde::addInlineScript(array( - 'ImpFolderPrefs.folders = ' . Horde_Serialize::serialize(array( - 'sent_mail_folder' => _("Create a new sent-mail folder") - ), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), - 'ImpFolderPrefs.sentmail = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + Horde::addInlineJsVars(array( + 'ImpFolderPrefs.folders' => array('sent_mail_folder' => _("Create a new sent-mail folder")), + 'ImpFolderPrefs.sentmail' => $js )); $t = $GLOBALS['injector']->createInstance('Horde_Template'); @@ -1485,8 +1483,8 @@ class IMP_Prefs_Ui $js[$key] = $identity->getValue('signature_html', $key); }; - Horde::addInlineScript(array( - 'ImpHtmlSignaturePrefs.sigs = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + Horde::addInlineJsVars(array( + 'ImpHtmlSignaturePrefs.sigs' => $js )); $t = $GLOBALS['injector']->createInstance('Horde_Template'); diff --git a/imp/lib/Ui/Compose.php b/imp/lib/Ui/Compose.php index 98ccb67b8..d4550158b 100644 --- a/imp/lib/Ui/Compose.php +++ b/imp/lib/Ui/Compose.php @@ -298,6 +298,7 @@ class IMP_Ui_Compose } /** + * @return array See Horde::addInlineJsVars(). */ public function identityJs() { @@ -325,7 +326,9 @@ class IMP_Ui_Compose ); } - return 'IMP_Compose_Base.identities = ' . Horde_Serialize::serialize($identities, Horde_Serialize::JSON); + return Horde::addInlineJsVars(array( + 'IMP_Compose_Base.identities' => $identities + ), true); } /** diff --git a/imp/lib/Views/Compose.php b/imp/lib/Views/Compose.php index 308db6925..701b9c44e 100644 --- a/imp/lib/Views/Compose.php +++ b/imp/lib/Views/Compose.php @@ -55,7 +55,7 @@ class IMP_Views_Compose /* Generate identities list. */ $imp_ui = $GLOBALS['injector']->getInstance('IMP_Ui_Compose'); - $result['js'][] = $imp_ui->identityJs(); + $result['js'] = array_merge($result['js'], $imp_ui->identityJs()); if ($composeCache && $imp_compose->numberOfAttachments()) { @@ -110,10 +110,14 @@ class IMP_Views_Compose } $flist[] = $tmp; } - $result['js'][] = 'DIMP.conf_compose.flist = ' . Horde_Serialize::serialize($flist, Horde_Serialize::JSON); + $result['js'] = array_merge($result['js'], Horde::addInlineJsVars(array( + 'DIMP.conf_compose.flist' => $flist + ), true)); } } else { - $result['js'][] = 'DIMP.conf_compose.redirect = 1'; + $result['js'] = array_merge($result['js'], Horde::addInlineJsVars(array( + '-DIMP.conf_compose.redirect' => 1 + ), true)); $redirect = true; } diff --git a/imp/message-dimp.php b/imp/message-dimp.php index d485764dd..c88c7eafa 100644 --- a/imp/message-dimp.php +++ b/imp/message-dimp.php @@ -22,14 +22,14 @@ if (!$vars->uid || !$vars->folder) { } $imp_ui = new IMP_Ui_Message(); -$js_onload = $js_out = array(); +$js_onload = $js_vars = array(); $readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly($vars->folder); switch ($vars->actionID) { case 'strip_attachment': try { $indices = $injector->getInstance('IMP_Message')->stripPart(new IMP_Indices($vars->folder, $vars->uid), $vars->id); - $js_out[] = 'DimpFullmessage.strip = 1'; + $js_vars['-DimpFullmessage.strip'] = 1; list(,$vars->uid) = $indices->getSingle(); $notification->push(_("Attachment successfully stripped."), 'horde.success'); } catch (IMP_Exception $e) { @@ -64,9 +64,10 @@ $scripts = array( foreach (array('from', 'to', 'cc', 'bcc', 'replyTo', 'log', 'uid', 'mailbox') as $val) { if (!empty($show_msg_result[$val])) { - $js_out[] = 'DimpFullmessage.' . $val . ' = ' . Horde_Serialize::serialize($show_msg_result[$val], Horde_Serialize::JSON); + $js_vars['DimpFullmessage.' . $val] = $show_msg_result[$val]; } } +$js_out = Horde::addInlineJsVars($js_vars, true); /* Determine if compose mode is disabled. */ $disable_compose = !IMP::canCompose(); diff --git a/imp/message.php b/imp/message.php index 06167a6bf..80990f88f 100644 --- a/imp/message.php +++ b/imp/message.php @@ -468,8 +468,8 @@ if (!$readonly) { } else { $a_template->set('delete', Horde::widget($self_link->copy()->add('actionID', 'delete_message'), _("Delete"), 'widget', '', '', _("_Delete"), true)); if ($use_pop) { - Horde::addInlineScript(array( - 'ImpMessage.pop3delete = ' . Horde_Serialize::serialize(_("Are you sure you want to PERMANENTLY delete these messages?"), Horde_Serialize::JSON, $registry->getCharset()) + Horde::addInlineJsVars(array( + 'ImpMessage.pop3delete' => _("Are you sure you want to PERMANENTLY delete these messages?") )); } } @@ -618,8 +618,8 @@ if (count($inlineout['display_ids']) > 2) { $a_template->set('download_all', Horde::widget($imp_contents->urlView($imp_contents->getMIMEMessage(), 'download_all'), _("Download All Attachments (in .zip file)"), 'widget', '', '', _("Download All Attachments (in .zip file)"), true)); if ($strip_atc) { $a_template->set('strip_all', Horde::widget(Horde::selfUrl(true)->remove(array('actionID'))->add(array('actionID' => 'strip_all', 'message_token' => $message_token)), _("Strip All Attachments"), 'widget stripAllAtc', '', '', _("Strip All Attachments"), true)); - Horde::addInlineScript(array( - 'ImpMessage.stripatc = ' . Horde_Serialize::serialize(_("Are you sure you want to PERMANENTLY delete all attachments?"), Horde_Serialize::JSON, $registry->getCharset()) + Horde::addInlineJsVars(array( + 'ImpMessage.stripatc' => _("Are you sure you want to PERMANENTLY delete all attachments?") )); } diff --git a/imp/search.php b/imp/search.php index 26336baf4..9a59f04ff 100644 --- a/imp/search.php +++ b/imp/search.php @@ -44,6 +44,7 @@ $vars = Horde_Variables::getDefaultVariables(); $charset = $registry->getCharset(); $dimp_view = ($_SESSION['imp']['view'] == 'dimp'); +$js_load = array(); $search_fields = $imp_search->searchFields(); $search_mailbox = isset($vars->search_mailbox) ? $vars->search_mailbox @@ -172,9 +173,9 @@ $js_data = array( 'types' => $types ); -Horde::addInlineScript(array( - 'ImpSearch.data = ' . Horde_Serialize::serialize($js_data, Horde_Serialize::JSON, $charset), - 'ImpSearch.text = ' . Horde_Serialize::serialize($gettext_strings, Horde_Serialize::JSON, $charset) +Horde::addInlineJsVars(array( + 'ImpSearch.data' => $js_data, + 'ImpSearch.text' => $gettext_strings, )); Horde::addInlineScript($js_load, 'dom'); diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 7e9bc7a1b..79a069476 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -2955,11 +2955,11 @@ class Kronolith 'full_weekdays' => true )); Horde::addScriptFile('goto.js', 'kronolith'); - Horde::addInlineScript(array( - 'KronolithGoto.dayurl = ' . Horde_Serialize::serialize(strval(Horde::url('day.php')), Horde_Serialize::JSON, $registry->getCharset()), - 'KronolithGoto.monthurl = ' . Horde_Serialize::serialize(strval(Horde::url('month.php')), Horde_Serialize::JSON, $registry->getCharset()), - 'KronolithGoto.weekurl = ' . Horde_Serialize::serialize(strval(Horde::url('week.php')), Horde_Serialize::JSON, $registry->getCharset()), - 'KronolithGoto.yearurl = ' . Horde_Serialize::serialize(strval(Horde::url('year.php')), Horde_Serialize::JSON, $registry->getCharset()), + Horde::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"), 'goto.png', null, '', null, 'kgotomenu'); } diff --git a/turba/lib/Turba.php b/turba/lib/Turba.php index 65c20c9ee..9a46681af 100644 --- a/turba/lib/Turba.php +++ b/turba/lib/Turba.php @@ -638,22 +638,15 @@ class Turba { */ public function addBrowseJs() { - $js = array(); - $js_text = array( - 'confirmdelete' => _("Are you sure that you want to delete %s?"), - 'contact1' => _("You must select at least one contact first."), - 'contact2' => ("You must select a target contact list."), - 'contact3' => _("Please name the new contact list:"), - 'copymove' => _("You must select a target address book."), - 'submit' => _("Are you sure that you want to delete the selected contacts?"), - ); - - foreach ($js_text as $key => $val) { - $js[] = 'TurbaBrowse.' . $key . ' = ' . Horde_Serialize::serialize($val, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); - } - Horde::addScriptFile('browse.js', 'turba'); - Horde::addInlineScript($js); + Horde::addInlineJsVars(array( + 'TurbaBrowse.confirmdelete' => _("Are you sure that you want to delete %s?"), + 'TurbaBrowse.contact1' => _("You must select at least one contact first."), + 'TurbaBrowse.contact2' => ("You must select a target contact list."), + 'TurbaBrowse.contact3' => _("Please name the new contact list:"), + 'TurbaBrowse.copymove' => _("You must select a target address book."), + 'TurbaBrowse.submit' => _("Are you sure that you want to delete the selected contacts?") + )); } }