From: Michael M Slusarz Date: Thu, 4 Mar 2010 19:18:27 +0000 (-0700) Subject: Remove Horde_Util::closeWindowJS() X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6d97c196be61e3bca4413767f7b6f4d12b62fefd;p=horde.git Remove Horde_Util::closeWindowJS() --- diff --git a/ansel/edit_dates.php b/ansel/edit_dates.php index bc84c09da..c8f43b5d9 100644 --- a/ansel/edit_dates.php +++ b/ansel/edit_dates.php @@ -21,7 +21,10 @@ if (!empty($gallery_id)) { $gallery = $ansel_storage->getGallery($gallery_id); if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) { $notification->push(_("You are not allowed to edit these photos."), 'horde.error'); - Horde_Util::closeWindowJS('window.opener.location.href = window.opener.location.href; window.close();'); + echo Horde::wrapInlineScript(array( + 'window.opener.location.href = window.opener.location.href;', + 'window.close();' + )); exit; } } @@ -29,7 +32,10 @@ if (!empty($gallery_id)) { /* Make sure we have at least one image */ if (!count($images)) { echo $notification->push(_("You must select at least on photo to edit."), 'horde.error'); - Horde_Util::closeWindowJS('window.opener.location.href = window.opener.location.href; window.close();'); + echo Horde::wrapInlineScript(array( + 'window.opener.location.href = window.opener.location.href;', + 'window.close();' + )); exit; } @@ -56,14 +62,20 @@ if ($actionID == 'edit_dates') { ++$count; } else { $notification->push(sprintf(_("There was an error editing the dates: %s"), $image->getMessage()), 'horde.error'); - Horde_Util::closeWindowJS('window.opener.location.href = window.opener.location.href; window.close();'); + echo Horde::wrapInlineScript(array( + 'window.opener.location.href = window.opener.location.href;', + 'window.close();' + )); exit; } } $notification->push(sprintf(_("Successfully modified the date on %d photos."), $count), 'horde.success'); - Horde_Util::closeWindowJS('window.opener.location.href = window.opener.location.href; window.close();'); + echo Horde::wrapInlineScript(array( + 'window.opener.location.href = window.opener.location.href;', + 'window.close();' + )); exit; } diff --git a/ansel/image.php b/ansel/image.php index ba9fc8f9b..69dd7405f 100644 --- a/ansel/image.php +++ b/ansel/image.php @@ -260,9 +260,15 @@ case 'save': /* Return to the image view. */ header('Location: ' . $imageurl); } elseif ($actionID == 'saveclose') { - Horde_Util::closeWindowJS('window.opener.location.href = window.opener.location.href; window.close();'); + echo Horde::wrapInlineScript(array( + 'window.opener.location.href = window.opener.location.href;', + 'window.close();' + )); } else { - Horde_Util::closeWindowJS('window.opener.location.href = \'' . $imageurl . '\'; window.close();'); + echo Horde::wrapInlineScript(array( + 'window.opener.location.href = "' . $imageurl . '";', + 'window.close();' + )); } exit; } @@ -478,9 +484,10 @@ case 'previewcustomwatermark': 'actionID' => 'previewwatermark'), $date)); - $url = Horde::applicationUrl($imageurl); - $url = str_replace('&', '&', $url); - Horde_Util::closeWindowJS('window.opener.location.href = "' . $url . '";'); + echo Horde::wrapInlineScript(array( + 'window.opener.location.href = "' . Horde::applicationUrl($imageurl)->setRaw(true) . '";', + 'window.close();' + )); exit; case 'previewgrayscale': diff --git a/ansel/img/ecard.php b/ansel/img/ecard.php index 861e24f21..14a62efaf 100644 --- a/ansel/img/ecard.php +++ b/ansel/img/ecard.php @@ -87,7 +87,7 @@ case 'send': if (is_a($result, 'PEAR_Error')) { $notification->push(sprintf(_("There was an error sending your message: %s"), $result->getMessage()), 'horde.error'); } else { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); exit; } } diff --git a/folks/perms.php b/folks/perms.php index 187f16789..8a901b22b 100644 --- a/folks/perms.php +++ b/folks/perms.php @@ -207,7 +207,7 @@ case 'editform': $notification->push($result, 'horde.error'); } else { if (Horde_Util::getFormData('save_and_finish')) { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); exit; } $notification->push(sprintf(_("Updated \"%s\"."), $share->get('name')), 'horde.success'); diff --git a/framework/Util/lib/Horde/Util.php b/framework/Util/lib/Horde/Util.php index b8ab56deb..0f88af70b 100644 --- a/framework/Util/lib/Horde/Util.php +++ b/framework/Util/lib/Horde/Util.php @@ -706,19 +706,6 @@ class Horde_Util } /** - * Outputs javascript code to close the current window. - * - * @param string $code Any additional javascript code to run before - * closing the window. - */ - static public function closeWindowJS($code = '') - { - echo "\n"; - } - - /** * Caches the result of extension_loaded() calls. * * @param string $ext The extension name. diff --git a/gollem/edit.php b/gollem/edit.php index bd9121f0d..85846f190 100644 --- a/gollem/edit.php +++ b/gollem/edit.php @@ -21,7 +21,7 @@ $filename = Horde_Util::getFormData('file'); $type = Horde_Util::getFormData('type'); if ($driver != $GLOBALS['gollem_be']['driver']) { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); exit; } @@ -35,18 +35,24 @@ case 'save_file': } else { $message = sprintf(_("%s successfully saved."), $filename); } - Horde_Util::closeWindowJS('alert(\'' . addslashes($message) . '\');'); + echo Horde::wrapInlineScript(array( + 'alert("' . addslashes($message) . '");', + 'window.close();' + )); exit; case 'edit_file': $data = $gollem_vfs->read($filedir, $filename); if (is_a($data, 'PEAR_Error')) { - Horde_Util::closeWindowJS('alert(\'' . addslashes(sprintf(_("Access denied to %s"), $filename)) . '\');'); + echo Horde::wrapInlineScript(array( + 'alert("' . addslashes(sprintf(_("Access denied to %s"), $filename)) . '");', + 'window.close();' + )); exit; } $mime_type = Horde_Mime_Magic::extToMIME($type); if (strpos($mime_type, 'text/') !== 0) { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); } if ($mime_type == 'text/html') { $editor = Horde_Editor::singleton('ckeditor', array('id' => 'content')); @@ -58,4 +64,4 @@ case 'edit_file': exit; } -Horde_Util::closeWindowJS(); +wcho Horde::wrapInlineScript(array('window.close();')); diff --git a/horde/services/shares/edit.php b/horde/services/shares/edit.php index 0fa50b968..ae7dbd612 100644 --- a/horde/services/shares/edit.php +++ b/horde/services/shares/edit.php @@ -243,7 +243,7 @@ case 'editform': $notification->push($result, 'horde.error'); } else { if (Horde_Util::getFormData('save_and_finish')) { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); exit; } $notification->push(sprintf(_("Updated \"%s\"."), $share->get('name')), 'horde.success'); diff --git a/imp/compose.php b/imp/compose.php index cfa57c1fd..3270f7222 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -327,7 +327,7 @@ case 'redirect_send': $notification->push(_("Message redirected successfully."), 'horde.success'); $imp_ui->popupSuccess(); } else { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); } } else { if ($prefs->getValue('compose_confirm')) { @@ -382,7 +382,7 @@ case 'send_message': if ($isPopup) { if ($prefs->getValue('close_draft')) { $imp_compose->destroy(); - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); exit; } else { $notification->push($result, 'horde.success'); @@ -462,7 +462,7 @@ case 'send_message': } $imp_ui->popupSuccess(); } else { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); } } else { if ($prefs->getValue('compose_confirm') && $sent) { @@ -485,7 +485,7 @@ case 'fwd_digest': case 'cancel_compose': $imp_compose->destroy(false); if ($isPopup) { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); } else { header('Location: ' . $imp_ui->mailboxReturnUrl(false)); } diff --git a/imp/lib/Crypt/Pgp.php b/imp/lib/Crypt/Pgp.php index c995eee65..b8f940f84 100644 --- a/imp/lib/Crypt/Pgp.php +++ b/imp/lib/Crypt/Pgp.php @@ -679,7 +679,11 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp $cacheSess = Horde_SessionObjects::singleton(); $href = $cacheSess->query($reload); $cacheSess->prune($reload); - Horde_Util::closeWindowJS('opener.focus();opener.location.href="' . $href . '";'); + echo Horde::wrapInlineScript(array( + 'opener.focus();'. + 'opener.location.href="' . $href . '";', + 'window.close();' + )); } } diff --git a/imp/lib/Crypt/Smime.php b/imp/lib/Crypt/Smime.php index f2bcb1303..b094c3cc9 100644 --- a/imp/lib/Crypt/Smime.php +++ b/imp/lib/Crypt/Smime.php @@ -514,7 +514,11 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime $cacheSess = Horde_SessionObjects::singleton(); $href = $cacheSess->query($reload); $cacheSess->prune($reload); - Horde_Util::closeWindowJS('opener.focus();opener.location.href="' . $href . '";'); + echo Horde::wrapInlineScript(array( + 'opener.focus();', + 'opener.location.href="' . $href . '";', + 'window.close();' + )); } } diff --git a/imp/pgp.php b/imp/pgp.php index 74102917d..751cc8aa2 100644 --- a/imp/pgp.php +++ b/imp/pgp.php @@ -198,7 +198,7 @@ case 'save_attachment_public_key': /* Add the public key to the storage system. */ try { $imp_pgp->addPublicKey($mime_part->getContents()); - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); } catch (Horde_Exception $e) { $notification->push($e, $key_info->getCode()); } diff --git a/imp/saveimage.php b/imp/saveimage.php index 8fc09a858..94ab97136 100644 --- a/imp/saveimage.php +++ b/imp/saveimage.php @@ -34,7 +34,7 @@ case 'save_image': $notification->push($e); break; } - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); exit; } diff --git a/imp/smime.php b/imp/smime.php index c8737d1e5..4d14fd065 100644 --- a/imp/smime.php +++ b/imp/smime.php @@ -112,7 +112,7 @@ case 'save_attachment_public_key': /* Add the public key to the storage system. */ try { $imp_smime->addPublicKey($mime_part); - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); } catch (Horde_Exception $e) { $notification->push(_("No Certificate found"), 'horde.error'); } diff --git a/kronolith/attendees.php b/kronolith/attendees.php index 398c73949..57215c4d8 100644 --- a/kronolith/attendees.php +++ b/kronolith/attendees.php @@ -62,7 +62,7 @@ case 'add': } if (Horde_Util::getFormData('addNewClose')) { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); exit; } break; @@ -144,7 +144,7 @@ case 'changeresp': case 'dismiss': // Close the attendee window. if ($browser->hasFeature('javascript')) { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); exit; } diff --git a/kronolith/contacts.php b/kronolith/contacts.php index 7db6ce116..2a64ed181 100644 --- a/kronolith/contacts.php +++ b/kronolith/contacts.php @@ -10,7 +10,7 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); if (!Horde_Auth::getAuth()) { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); exit; } diff --git a/kronolith/perms.php b/kronolith/perms.php index 0914b3f29..661ee19c6 100644 --- a/kronolith/perms.php +++ b/kronolith/perms.php @@ -254,7 +254,7 @@ case 'editform': $notification->push($result, 'horde.error'); } else { if (Horde_Util::getFormData('save_and_finish')) { - Horde_Util::closeWindowJS(); + echo Horde::wrapInlineScript(array('window.close();')); exit; } $notification->push(sprintf(_("Updated \"%s\"."), $share->get('name')), 'horde.success');