From 9702d81692079ebf60e5e974c766d467db3d6163 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 15 May 2008 22:57:14 +0000 Subject: [PATCH] Support for Google Gears managed offline storage. Props azaozz. see #6965 git-svn-id: https://develop.svn.wordpress.org/trunk@7938 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/gears-manifest.php | 168 ++++++++++++++++++++++++++++++++++ wp-admin/index.php | 28 ++++++ wp-admin/js/wp-gears.js | 82 +++++++++++++++++ wp-admin/wp-admin.css | 20 ++++ wp-includes/script-loader.php | 6 ++ 5 files changed, 304 insertions(+) create mode 100644 wp-admin/gears-manifest.php create mode 100644 wp-admin/js/wp-gears.js diff --git a/wp-admin/gears-manifest.php b/wp-admin/gears-manifest.php new file mode 100644 index 0000000000..53320e39d9 --- /dev/null +++ b/wp-admin/gears-manifest.php @@ -0,0 +1,168 @@ +scripts as $script ) { + if ( empty($script->src) || strpos($script->src, 'tiny_mce_config.php') ) continue; + $src = str_replace( '/wp-admin/', '', $script->src ); + $src = str_replace( '/wp-includes/', '../wp-includes/', $src ); + $default_js .= '{ "url" : "' . $src . '?ver=' . $script->ver . '" },' . "\n"; + $version .= $script->ver; +} + +$version = md5($version); + +nocache_headers(); +header( 'Content-Type: application/x-javascript; charset=UTF-8' ); // application/json text/plain ? +?> +{ +"betaManifestVersion" : 1, +"version" : "_20080511", +"entries" : [ + + +{ "url" : "wp-admin.css?version=2.6-bleeding" }, +{ "url" : "rtl.css?version=2.6-bleeding" }, +{ "url" : "../wp-includes/js/thickbox/thickbox.css?ver=20080430" }, +{ "url" : "css/colors-classic-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/colors-classic.css?version=2.6-bleeding" }, +{ "url" : "css/colors-fresh-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/colors-fresh.css?version=2.6-bleeding" }, +{ "url" : "css/dashboard-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/dashboard.css?version=2.6-bleeding" }, +{ "url" : "css/global.css?version=2.6-bleeding" }, +{ "url" : "css/global-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/ie-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/ie.css?version=2.6-bleeding" }, +{ "url" : "css/install-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/install.css?version=2.6-bleeding" }, +{ "url" : "css/login-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/login.css?version=2.6-bleeding" }, +{ "url" : "css/media-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/media.css?version=2.6-bleeding" }, +{ "url" : "css/theme-editor-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/theme-editor.css?version=2.6-bleeding" }, +{ "url" : "css/upload-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/widgets-rtl.css?version=2.6-bleeding" }, +{ "url" : "css/widgets.css?version=2.6-bleeding" }, + +{ "url" : "images/align-center.png" }, +{ "url" : "images/align-left.png" }, +{ "url" : "images/align-none.png" }, +{ "url" : "images/align-right.png" }, +{ "url" : "images/bubble_bg.gif" }, +{ "url" : "images/comment-grey-bubble.png" }, +{ "url" : "images/comment-pill.gif" }, +{ "url" : "images/comment-stalk-classic.gif" }, +{ "url" : "images/comment-stalk-fresh.gif" }, +{ "url" : "images/comment-stalk-rtl.gif" }, +{ "url" : "images/date-button.gif" }, +{ "url" : "images/fade-butt.png" }, +{ "url" : "images/logo-ghost.png" }, +{ "url" : "images/logo-login.gif" }, +{ "url" : "images/media-button-gallery.gif" }, +{ "url" : "images/media-button-image.gif" }, +{ "url" : "images/media-button-music.gif" }, +{ "url" : "images/media-button-other.gif" }, +{ "url" : "images/media-button-video.gif" }, +{ "url" : "images/media-buttons.gif" }, +{ "url" : "images/tail.gif" }, +{ "url" : "images/toggle-arrow-rtl.gif" }, +{ "url" : "images/toggle-arrow.gif" }, +{ "url" : "images/wordpress-logo.png" }, +{ "url" : "images/xit.gif" }, +{ "url" : "../wp-includes/images/crystal/archive.png" }, +{ "url" : "../wp-includes/images/crystal/audio.png" }, +{ "url" : "../wp-includes/images/crystal/code.png" }, +{ "url" : "../wp-includes/images/crystal/default.png" }, +{ "url" : "../wp-includes/images/crystal/document.png" }, +{ "url" : "../wp-includes/images/crystal/interactive.png" }, +{ "url" : "../wp-includes/images/crystal/text.png" }, +{ "url" : "../wp-includes/images/crystal/video.png" }, +{ "url" : "../wp-includes/images/crystal/spreadsheet.png" }, +{ "url" : "../wp-includes/images/rss.png" }, +{ "url" : "../wp-includes/js/thickbox/loadingAnimation.gif" }, +{ "url" : "../wp-includes/js/thickbox/tb-close.png" }, +{ "url" : "../wp-includes/js/swfupload/swfupload_f9.swf" }, + +{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/utils/mctabs.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/utils/validate.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/utils/form_utils.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/utils/editable_selects.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pasteword.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pastetext.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/js/media.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/color_picker.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/charmap.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/image.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?v=307" }, + +{ "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/image.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/link.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/color_picker.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/charmap.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/media.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/paste/pasteword.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/paste/blank.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?v=307" }, +{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?v=307" }, + +{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css?v=307" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/css/content.css?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/css/content.css?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/css/content.css?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?v=307" }, +{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?v=307" }, +{ "url" : "../wp-includes/js/tinymce/wordpress.css?v=307" }, + +{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/icons.gif" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/fm.gif" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/sflogo.png" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif" }, +{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flash.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flv_player.swf" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/img/quicktime.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/img/realmedia.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/img/shockwave.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/media/img/trans.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" } +]} diff --git a/wp-admin/index.php b/wp-admin/index.php index d09b812e0c..0432f520bb 100644 --- a/wp-admin/index.php +++ b/wp-admin/index.php @@ -32,6 +32,7 @@ function index_css() { add_action( 'admin_head', 'index_css' ); wp_enqueue_script( 'jquery' ); +wp_enqueue_script( 'wp-gears' ); $title = __('Dashboard'); $parent_file = 'index.php'; @@ -117,6 +118,33 @@ if ( $can_switch_themes = current_user_can( 'switch_themes' ) )

+gearsinfobox) ) { + update_usermeta($current_user->ID, 'gearsinfobox', '1'); ?> + +
+

+

+

+

+ +
+ + +


+

+

+ + + + + diff --git a/wp-admin/js/wp-gears.js b/wp-admin/js/wp-gears.js new file mode 100644 index 0000000000..7a1fea81c0 --- /dev/null +++ b/wp-admin/js/wp-gears.js @@ -0,0 +1,82 @@ + +wpGears = { + + init : function() { + if ( 'undefined' != typeof google && google.gears ) { + try { + localServer = google.gears.factory.create("beta.localserver"); + this.createStore(); + } catch(e) { // silence if canceled + this.message(); + } + } + }, + + createStore : function() { + if ( 'undefined' == typeof google || ! google.gears ) return; + + store = localServer.createManagedStore(this.storeName()); + store.manifestUrl = "gears-manifest.php"; + store.checkForUpdate(); + this.message(); + }, + + removeStore : function() { + if ( 'undefined' == typeof google || ! google.gears ) return; + + localServer.removeManagedStore(this.storeName()); + this.message(); + }, + + storeName : function() { + var name = window.location.protocol + window.location.host; + + name = name.replace(/[\/\\:*"?<>|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name + name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars + + return name; + }, + + message : function() { + var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), num = t.I('gears-upd-number'), wait = t.I('gears-wait'); + + if ( ! msg1 ) return; + + if ( 'undefined' != typeof store ) { + msg1.style.display = msg2.style.display = 'none'; + msg3.style.display = 'block'; + + store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);}; + store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);}; + store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);}; + } else if ( 'undefined' != typeof google && google.gears ) { + msg1.style.display = 'none'; + msg2.style.display = 'block'; + } + }, + + I : function(id) { + return document.getElementById(id); + } +} + +addLoadEvent( function(){wpGears.init()} ); + +function gearsInit() { + if ( 'undefined' != typeof google && google.gears ) return; + + var gf = false; + if ( 'undefined' != typeof GearsFactory ) { // Firefox + gf = new GearsFactory(); + } else { // IE + try { + gf = new ActiveXObject('Gears.Factory'); + } catch (e) {} + } + + if ( ! gf ) return; + if ( 'undefined' == typeof google ) google = {}; + if ( ! google.gears ) google.gears = { factory : gf }; +} + +gearsInit(); diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index b1c9a33a79..e785afdace 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -1518,3 +1518,23 @@ fieldset { padding: 0; margin: 0; } + +.info-box { + top: 120px; + left: 50%; + margin-left: -200px; + height: 300px; + width: 400px; + border: 5px solid #ddd; + background: #f8f8f8; + position: absolute; + padding: 15px 15px 10px; + z-index: 1000; +} + +.info-box .submit { + position: absolute; + bottom: 15px; + width: 400px; + padding: 20px 0 5px; +} diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 9a7bf5a81a..5317c5478a 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -199,6 +199,12 @@ class WP_Scripts { $this->localize( 'word-count', 'wordCountL10n', array( 'count' => __('Word count: %d') )); + + $this->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20080511' ); + $this->localize( 'wp-gears', 'wpGearsL10n', array( + 'updateCompleted' => __('Update completed.'), + 'error' => __('Error:') + )); } }