summaryrefslogtreecommitdiffstats
path: root/wp-content
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-06-11 12:46:02 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-06-11 12:46:02 +0000
commit49b78829f4c04b8a507d66ebc0af4dd35e0682f2 (patch)
tree1a39d906d383206ad3e5f1284320f217cac90b87 /wp-content
parente049a1659cef89ed767db70d70ab5ae40c60584d (diff)
downloadwordpress-mu-49b78829f4c04b8a507d66ebc0af4dd35e0682f2.tar.gz
wordpress-mu-49b78829f4c04b8a507d66ebc0af4dd35e0682f2.tar.xz
wordpress-mu-49b78829f4c04b8a507d66ebc0af4dd35e0682f2.zip
Added dashboard switcher plugin, fixes #310
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@997 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-content')
-rw-r--r--wp-content/mu-plugins/dashboardswitcher.php88
1 files changed, 88 insertions, 0 deletions
diff --git a/wp-content/mu-plugins/dashboardswitcher.php b/wp-content/mu-plugins/dashboardswitcher.php
new file mode 100644
index 0000000..74263b0
--- /dev/null
+++ b/wp-content/mu-plugins/dashboardswitcher.php
@@ -0,0 +1,88 @@
+<?php
+
+function switcher_css() {
+?>
+<style type="text/css">
+#switchermenu a {
+ font-size: 20px;
+ padding: 0 1.5em 0 10px;
+ display: block;
+ color: #c3def1;
+}
+
+#switchermenu a:hover {
+ background: #1a70b4;
+ color: #fff;
+}
+
+#switchermenu li {
+ margin: 0;
+ padding: 2px;
+}
+
+#switchermenu {
+ display: none;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ border-top: 1px solid #1a70b4;
+ border-left: 1px solid #1a70b4;
+ position: absolute;
+ left: 0;
+ top: 1em;
+ background: #14568a;
+ z-index: 1;
+}
+</style>
+<?php
+ wp_enqueue_script('interface');
+?>
+<script type="text/javascript">
+jQuery( function($) {
+var switchTime;
+var w = false;
+var h = $( '#blog-title' )
+ .css({
+ background: 'transparent url( images/bullet_arrow_down.gif ) no-repeat scroll 100% .2em;',
+ padding: '0 25px 2px 5px',
+ cursor: 'pointer',
+ border: '1px solid #14568a',
+ })
+ .parent().css( { position: 'relative' }).end()
+ .append( $('#switchermenu') )
+ .hover( function() {
+ $(this).css({ border: '1px solid #1a70b4'});
+ switchTime = window.setTimeout( function() {
+ $('#switchermenu').fadeIn('fast').css( 'top', h ).find('a').width( w = w ? w : $('#switchermenu').width() );
+ }, 300 );
+ }, function() {
+ window.clearTimeout( switchTime );
+ $(this).css({ border: '1px solid #14568a' }) ;
+ $('#switchermenu').hide();
+ })
+ .height() - 3;
+});
+</script>
+<?php
+}
+add_action( "admin_head", "switcher_css" );
+
+function add_switcher() {
+ global $current_user;
+ $out = '<h1><span id="blog-title">' . wptexturize(get_bloginfo(("name"))) . '</span><span id="viewsite">(<a href="' . get_option("home") . "/" . '">' . __("View site &raquo;") . '</a>)</span></h1>';
+ $out .= '<ul id="switchermenu">';
+ $blogs = get_blogs_of_user($current_user->ID);
+ if ( ! empty($blogs) ) foreach ( $blogs as $blog ) {
+ $out .= '<li><a href="http://' . $blog->domain . $blog->path . 'wp-admin/">' . $blog->blogname . '</a></li>';
+ }
+ $out .= "</ul>";
+ ?>
+ <script type="text/javascript">
+ document.getElementById('wphead').innerHTML = '<?php echo $out ?>'
+ </script>
+ <?php
+}
+add_action( 'admin_footer', 'add_switcher' );
+
+?>