Make WordPress Core

Ticket #1789: admin-header.php

File admin-header.php, 8.2 KB (added by skeltoac, 20 years ago)
Line 
1<?php 
2@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
3if (!isset($_GET["page"])) require_once('admin.php'); ?>
4<?php get_admin_page_title(); ?>
5<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6<html xmlns="http://www.w3.org/1999/xhtml">
7<head>
8<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; WordPress</title>
9<link rel="stylesheet" href="<?php echo get_settings('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
10<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
11
12<script type="text/javascript">
13//<![CDATA[
14
15function addLoadEvent(func) {
16  var oldonload = window.onload;
17  if (typeof window.onload != 'function') {
18    window.onload = func;
19  } else {
20    window.onload = function() {
21      oldonload();
22      func();
23    }
24  }
25}
26
27<?php if ( isset($xfn) ) : ?>
28
29function GetElementsWithClassName(elementName, className) {
30        var allElements = document.getElementsByTagName(elementName);
31        var elemColl = new Array();
32        for (i = 0; i < allElements.length; i++) {
33                if (allElements[i].className == className) {
34                        elemColl[elemColl.length] = allElements[i];
35                }
36        }
37        return elemColl;
38}
39
40function meChecked() {
41  var undefined;
42  var eMe = document.getElementById('me');
43  if (eMe == undefined) return false;
44  else return eMe.checked;
45}
46
47function upit() {
48        var isMe = meChecked(); //document.getElementById('me').checked;
49        var inputColl = GetElementsWithClassName('input', 'valinp');
50        var results = document.getElementById('rel');
51        var linkText, linkUrl, inputs = '';
52        for (i = 0; i < inputColl.length; i++) {
53                 inputColl[i].disabled = isMe;
54                 inputColl[i].parentNode.className = isMe ? 'disabled' : '';
55                 if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
56                        inputs += inputColl[i].value + ' ';
57                                }
58                 }
59        inputs = inputs.substr(0,inputs.length - 1);
60        if (isMe) inputs='me';
61        results.value = inputs;
62        }
63
64function blurry() {
65        if (!document.getElementById) return;
66
67        var aInputs = document.getElementsByTagName('input');
68
69        for (var i = 0; i < aInputs.length; i++) {             
70                 aInputs[i].onclick = aInputs[i].onkeyup = upit;
71        }
72}
73
74addLoadEvent(blurry);
75<?php endif; ?>
76//]]>
77</script>
78<script type="text/javascript" src="../wp-includes/js/fat.js"></script>
79<script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script>
80<script type="text/javascript" src="list-manipulation.js"></script>
81<?php if ( isset( $editing ) ) : ?>
82<?php if ( 'true' == get_user_option('rich_editing') ) :?>
83<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php"></script>
84<script type="text/javascript">
85tinyMCE.init({
86        mode : "specific_textareas",
87        textarea_trigger : "title",
88        width : "100%",
89        theme : "advanced",
90        theme_advanced_buttons1 : "bold,italic,strikethrough,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,image,emotions,separator,wordpress,separator,undo,redo,code",
91        theme_advanced_buttons2 : "",
92        theme_advanced_buttons3 : "",
93        theme_advanced_toolbar_location : "top",
94        theme_advanced_toolbar_align : "left",
95        theme_advanced_path_location : "bottom",
96        theme_advanced_resizing : true,
97        browsers : "msie,gecko",
98        dialog_type : "modal",
99        theme_advanced_resize_horizontal : false,
100        entity_encoding : "raw",
101        relative_urls : false,
102        remove_script_host : false,
103        valid_elements : "a[href|title],strong/b,em/i,strike,u,p[class|align],ol,ul,li,br,img[class|src|alt|title|width|height|align],sub,sup,blockquote,table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],div[dir|class|align],span[class|align],pre[class],address,h1[class|align],h2[class|align],h3[class|align],h4[class|align],h5[class|align],h6[class|align],hr",
104        plugins : "contextmenu,wordpress"
105        <?php do_action('mce_options'); ?>
106});
107</script>
108<?php endif; ?>
109<script type="text/javascript" src="../wp-includes/js/dbx.js"></script>
110<script type="text/javascript" src="../wp-includes/js/dbx-key.js"></script>
111
112<?php if ( current_user_can('manage_categories') ) : ?>
113<script type="text/javascript">
114var ajaxCat = new sack();
115var newcat;
116 
117function newCatAddIn() {
118        var ajaxcat = document.createElement('p');
119        ajaxcat.id = 'ajaxcat';
120
121        newcat = document.createElement('input');
122        newcat.type = 'text';
123        newcat.name = 'newcat';
124        newcat.id = 'newcat';
125        newcat.size = '16';
126        newcat.setAttribute('autocomplete', 'off');
127        newcat.onkeypress = ajaxNewCatKeyPress;
128
129        var newcatSub = document.createElement('input');
130        newcatSub.type = 'button';
131        newcatSub.name = 'Button';
132        newcatSub.value = '+';
133        newcat.onkeypress = ajaxNewCatKeyPress;
134
135        ajaxcat.appendChild(newcat);
136        ajaxcat.appendChild(newcatSub);
137        document.getElementById('categorychecklist').parentNode.appendChild(ajaxcat);
138}
139
140addLoadEvent(newCatAddIn);
141
142function getResponseElement() {
143        var p = document.getElementById('ajaxcatresponse');
144        if (!p) {
145                p = document.createElement('p');
146                document.getElementById('categorydiv').appendChild(p);
147                p.id = 'ajaxcatresponse';
148        }
149        return p;
150}
151
152function newCatLoading() {
153        var p = getResponseElement();
154        p.innerHTML = 'Sending Data...';
155}
156
157function newCatLoaded() {
158        var p = getResponseElement();
159        p.innerHTML = 'Data Sent...';
160}
161
162function newCatInteractive() {
163        var p = getResponseElement();
164        p.innerHTML = 'Processing Data...';
165}
166
167function newCatCompletion() {
168        var p = getResponseElement();
169        var id = parseInt(ajaxCat.response, 10);
170        if ( id == '-1' ) {
171                p.innerHTML = "You don't have permission to do that.";
172                return;
173        }
174        if ( id == '0' ) {
175                p.innerHTML = "That category name is invalid.  Try something else.";
176                return;
177        }
178        p.parentNode.removeChild(p);
179        var exists = document.getElementById('category-' + id);
180        if (exists) {
181                var moveIt = exists.parentNode;
182                var container = moveIt.parentNode;
183                container.removeChild(moveIt);
184                container.insertBefore(moveIt, container.firstChild);
185                moveIt.id = 'new-category-' + id;
186                exists.checked = 'checked';
187                var nowClass = moveIt.className;
188                moveIt.className = nowClass + ' fade';
189                Fat.fade_all();
190                moveIt.className = nowClass;
191        } else {
192                var catDiv = document.getElementById('categorychecklist');
193                var newLabel = document.createElement('label');
194                newLabel.setAttribute('for', 'category-' + id);
195                newLabel.id = 'new-category-' + id;
196                newLabel.className = 'selectit fade';
197
198                var newCheck = document.createElement('input');
199                newCheck.type = 'checkbox';
200                newCheck.value = id;
201                newCheck.name = 'post_category[]';
202                newCheck.id = 'category-' + id;
203                newLabel.appendChild(newCheck);
204
205                var newLabelText = document.createTextNode(' ' + newcat.value);
206                newLabel.appendChild(newLabelText);
207
208                catDiv.insertBefore(newLabel, catDiv.firstChild);
209                newCheck.checked = 'checked';
210
211                Fat.fade_all();
212                newLabel.className = 'selectit';
213        }
214        newcat.value = '';
215}
216
217function ajaxNewCatKeyPress(e) {
218        if (!e) {
219                if (window.event) {
220                        e = window.event;
221                } else {
222                        return;
223                }
224        }
225        if (e.keyCode == 13) {
226                ajaxNewCat();
227                e.returnValue = false;
228                e.cancelBubble = true;
229                return false;
230        }
231}
232
233function ajaxNewCat() {
234        var newcat = document.getElementById('newcat');
235        var catString = 'ajaxnewcat=' + encodeURIComponent(newcat.value);
236        ajaxCat.requestFile = 'edit-form-ajax-cat.php';
237        ajaxCat.method = 'GET';
238        ajaxCat.onLoading = newCatLoading;
239        ajaxCat.onLoaded = newCatLoaded;
240        ajaxCat.onInteractive = newCatInteractive;
241        ajaxCat.onCompletion = newCatCompletion;
242        ajaxCat.runAJAX(catString);
243}
244</script>
245<?php endif; ?>
246
247<?php endif; ?>
248
249<?php do_action('admin_head'); ?>
250</head>
251<body>
252
253<div id="wphead">
254<h1><?php echo wptexturize(get_settings(('blogname'))); ?> <span>(<a href="<?php echo get_settings('home') . '/'; ?>"><?php _e('View site') ?> &raquo;</a>)</span></h1>
255</div>
256
257<div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_settings('siteurl')
258         ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php _e('Sign Out'); ?></a>, <a href="profile.php"><?php _e('My Account'); ?></a>] </p></div>
259
260<?php
261require(ABSPATH . '/wp-admin/menu-header.php');
262
263if ( $parent_file == 'options-personal.php' ) {
264        require(ABSPATH . '/wp-admin/options-head.php');
265}
266?>