Changeset 3422

Show
Ignore:
Timestamp:
01/10/06 05:16:17 (3 years ago)
Author:
matt
Message:

HTML and JS cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-header.php

    r3383 r3422  
    11<?php  
    22@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); 
    3 if (!isset($_GET["page"])) require_once('admin.php'); ?> 
     3if (!isset($_GET["page"])) require_once('admin.php'); 
     4if ( $list_js || $cat_js ) 
     5    $sack_js = true; 
     6if ( $editing ) { 
     7    $dbx_js = true; 
     8    $cat_js = true; 
     9
     10?> 
    411<?php get_admin_page_title(); ?> 
    512<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    613<html xmlns="http://www.w3.org/1999/xhtml"> 
    714<head> 
     15<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> 
    816<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; WordPress</title> 
    917<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  
    1218<script type="text/javascript"> 
    1319//<![CDATA[ 
    14  
    15 function addLoadEvent(func) { 
    16   if ( typeof wpOnload != 'function' ) { 
    17     wpOnload = func; 
    18   } else { 
    19     var oldonload = wpOnload; 
    20     wpOnload = function() { 
    21       oldonload(); 
    22       func(); 
    23     } 
    24   } 
    25 
    26  
    27 <?php if ( isset($xfn) ) : ?> 
    28  
    29 function 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  
    40 function meChecked() { 
    41   var undefined; 
    42   var eMe = document.getElementById('me'); 
    43   if (eMe == undefined) return false; 
    44   else return eMe.checked; 
    45 
    46  
    47 function upit() { 
    48     var isMe = meChecked(); //document.getElementById('me').checked; 
    49     var inputColl = GetElementsWithClassName('input', 'valinp'); 
    50     var results = document.getElementById('link_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  
    64 function 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  
    74 addLoadEvent(blurry); 
    75 <?php endif; ?> 
     20function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}} 
    7621//]]> 
    7722</script> 
    7823<script type="text/javascript" src="../wp-includes/js/fat.js"></script> 
     24<?php if ( $xfn_js ) { ?> 
     25<script type="text/javascript" src="xfn.js"></script> 
     26<?php } ?> 
     27<?php if ( $sack_js ) { ?> 
    7928<script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script> 
     29<?php } ?> 
     30<?php if ( $list_js ) { ?> 
    8031<script type="text/javascript" src="list-manipulation.js"></script> 
    81 <?php if ( isset( $editing ) ) : ?> 
    82 <?php if ( $editing && user_can_richedit() ) : ?> 
    83 <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?ver=20051211"></script> 
    84 <?php endif; ?> 
     32<?php } ?> 
     33<?php if ( $dbx_js ) { ?> 
    8534<script type="text/javascript" src="../wp-includes/js/dbx.js"></script> 
    8635<script type="text/javascript"> 
    8736//<![CDATA[ 
    88    addLoadEvent( function() { 
     37addLoadEvent( function() { 
    8938<?php switch ( $pagenow ) : case 'post.php' : ?> 
    90         var manager = new dbxManager('postmeta');       //session ID [/-_a-zA-Z0-9/] 
     39var manager = new dbxManager('postmeta'); 
    9140<?php break; case 'page-new.php' : ?> 
    92         var manager = new dbxManager('pagemeta');       //session ID [/-_a-zA-Z0-9/] 
     41var manager = new dbxManager('pagemeta'); 
    9342<?php break; endswitch; ?> 
    94    }); 
     43}); 
    9544//]]> 
    9645</script> 
    9746<script type="text/javascript" src="../wp-includes/js/dbx-key.js"></script> 
    98  
    99 <?php if ( current_user_can('manage_categories') ) : ?> 
    100 <style type="text/css"> 
    101 #newcat { width: 120px; margin-right: 5px; } 
    102 input#catadd {  background: #a4a4a4; 
    103     border-bottom: 1px solid #898989; 
    104     border-left: 1px solid #bcbcbc; 
    105     border-right: 1px solid #898989; 
    106     border-top: 1px solid #bcbcbc; 
    107     color: #fff; 
    108     font-size: 10px; 
    109     padding: 0; 
    110     margin: 0; 
    111     font-weight: bold; 
    112     height: 20px; 
    113     margin-bottom: 2px; 
    114     text-align: center; 
    115     width: 37px; } 
    116 #howto { 
    117     font-size: 11px; 
    118     margin: 0 5px; 
    119     display: block; 
    120 
    121 #jaxcat { 
    122     margin: 0; 
    123     padding: 0; 
    124 
    125 </style> 
    126 <script type="text/javascript"> 
    127 //<![CDATA[ 
    128 var ajaxCat = new sack(); 
    129 var newcat; 
    130   
    131 function newCatAddIn() { 
    132     if ( !document.getElementById('jaxcat') ) return false; 
    133     var ajaxcat = document.createElement('span'); 
    134     ajaxcat.id = 'ajaxcat'; 
    135  
    136     newcat = document.createElement('input'); 
    137     newcat.type = 'text'; 
    138     newcat.name = 'newcat'; 
    139     newcat.id = 'newcat'; 
    140     newcat.size = '16'; 
    141     newcat.setAttribute('autocomplete', 'off'); 
    142     newcat.onkeypress = ajaxNewCatKeyPress; 
    143  
    144     var newcatSub = document.createElement('input'); 
    145     newcatSub.type = 'button'; 
    146     newcatSub.name = 'Button'; 
    147     newcatSub.id = 'catadd'; 
    148     newcatSub.value = '<?php echo addslashes(__('Add')); ?>'; 
    149     newcatSub.onclick = ajaxNewCat; 
    150  
    151     ajaxcat.appendChild(newcat); 
    152     ajaxcat.appendChild(newcatSub); 
    153     document.getElementById('jaxcat').appendChild(ajaxcat); 
    154  
    155     howto = document.createElement('span'); 
    156     howto.innerHTML = '<?php echo addslashes(__('Separate multiple categories with commas.')); ?>'; 
    157     howto.id = 'howto'; 
    158     ajaxcat.appendChild(howto); 
    159 
    160  
    161 addLoadEvent(newCatAddIn); 
    162  
    163 function getResponseElement() { 
    164     var p = document.getElementById('ajaxcatresponse'); 
    165     if (!p) { 
    166         p = document.createElement('span'); 
    167         document.getElementById('jaxcat').appendChild(p); 
    168         p.id = 'ajaxcatresponse'; 
    169     } 
    170     return p; 
    171 
    172  
    173 function newCatLoading() { 
    174     var p = getResponseElement(); 
    175     p.innerHTML = '<?php echo addslashes(__('Sending Data...')); ?>'; 
    176 
    177  
    178 function newCatLoaded() { 
    179     var p = getResponseElement(); 
    180     p.innerHTML = '<?php echo addslashes(__('Data Sent...')); ?>'; 
    181 
    182  
    183 function newCatInteractive() { 
    184     var p = getResponseElement(); 
    185     p.innerHTML = '<?php echo addslashes(__('Processing Request...')); ?>'; 
    186 
    187  
    188 function newCatCompletion() { 
    189     var p = getResponseElement(); 
    190     var id    = 0; 
    191     var ids   = new Array(); 
    192     var names = new Array(); 
    193      
    194     ids   = myPload( ajaxCat.response ); 
    195     names = myPload( newcat.value ); 
    196     for ( i = 0; i < ids.length; i++ ) { 
    197         id = ids[i].replace(/[\n\r]+/g, ""); 
    198         if ( id == '-1' ) { 
    199             p.innerHTML = "<?php echo addslashes(__("You don't have permission to do that.")); ?>"; 
    200             return; 
    201         } 
    202         if ( id == '0' ) { 
    203             p.innerHTML = "<?php echo addslashes(__('That category name is invalid.  Try something else.')); ?>"; 
    204             return; 
    205         } 
    206          
    207         var exists = document.getElementById('category-' + id); 
    208          
    209         if (exists) { 
    210             var moveIt = exists.parentNode; 
    211             var container = moveIt.parentNode; 
    212             container.removeChild(moveIt); 
    213             container.insertBefore(moveIt, container.firstChild); 
    214             moveIt.id = 'new-category-' + id; 
    215             exists.checked = 'checked'; 
    216             var nowClass = moveIt.className; 
    217             moveIt.className = nowClass + ' fade'; 
    218             Fat.fade_all(); 
    219             moveIt.className = nowClass; 
    220         } else { 
    221             var catDiv = document.getElementById('categorychecklist'); 
    222             var newLabel = document.createElement('label'); 
    223             newLabel.setAttribute('for', 'category-' + id); 
    224             newLabel.id = 'new-category-' + id; 
    225             newLabel.className = 'selectit fade'; 
    226      
    227             var newCheck = document.createElement('input'); 
    228             newCheck.type = 'checkbox'; 
    229             newCheck.value = id; 
    230             newCheck.name = 'post_category[]'; 
    231             newCheck.id = 'category-' + id; 
    232             newLabel.appendChild(newCheck); 
    233      
    234             var newLabelText = document.createTextNode(' ' + names[i]); 
    235             newLabel.appendChild(newLabelText); 
    236      
    237             catDiv.insertBefore(newLabel, catDiv.firstChild); 
    238             newCheck.checked = 'checked'; 
    239      
    240             Fat.fade_all(); 
    241             newLabel.className = 'selectit'; 
    242         } 
    243         newcat.value = ''; 
    244     } 
    245     p.parentNode.removeChild(p); 
    246 //  var id = parseInt(ajaxCat.response, 10); 
    247 
    248  
    249 function ajaxNewCatKeyPress(e) { 
    250     if (!e) { 
    251         if (window.event) { 
    252             e = window.event; 
    253         } else { 
    254             return; 
    255         } 
    256     } 
    257     if (e.keyCode == 13) { 
    258         ajaxNewCat(); 
    259         e.returnValue = false; 
    260         e.cancelBubble = true; 
    261         return false; 
    262     } 
    263 
    264  
    265 function ajaxNewCat() { 
    266     var newcat = document.getElementById('newcat'); 
    267     var split_cats = new Array(1); 
    268     var catString = ''; 
    269  
    270     catString = 'ajaxnewcat=' + encodeURIComponent(newcat.value); 
    271     ajaxCat.requestFile = 'edit-form-ajax-cat.php'; 
    272     ajaxCat.method = 'GET'; 
    273     ajaxCat.onLoading = newCatLoading; 
    274     ajaxCat.onLoaded = newCatLoaded; 
    275     ajaxCat.onInteractive = newCatInteractive; 
    276     ajaxCat.onCompletion = newCatCompletion; 
    277     ajaxCat.runAJAX(catString); 
    278 
    279  
    280 function myPload( str ) { 
    281     var fixedExplode = new Array(); 
    282     var comma = new String(','); 
    283     var count = 0; 
    284     var currentElement = ''; 
    285  
    286     for( x=0; x < str.length; x++) { 
    287         andy = str.charAt(x); 
    288         if ( comma.indexOf(andy) != -1 ) { 
    289             currentElement = currentElement.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // trim 
    290             fixedExplode[count] = currentElement; 
    291             currentElement = ""; 
    292             count++; 
    293         } else { 
    294             currentElement += andy; 
    295         } 
    296     } 
    297  
    298     if ( currentElement != "" ) 
    299         fixedExplode[count] = currentElement; 
    300     return fixedExplode; 
    301 
    302 //]]> 
    303 </script> 
    304 <?php endif; ?> 
    305  
    306 <?php endif; ?> 
    307  
     47<?php } ?> 
     48<?php if ( $editing && user_can_richedit() ) { ?> 
     49<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?ver=20051211"></script> 
     50<?php } ?> 
     51<?php if ( $cat_js ) { ?> 
     52<script type="text/javascript" src="cat-js.php"></script> 
     53<?php } ?> 
    30854<?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') ) : ?> 
    30955<style type="text/css">* html { overflow-x: hidden; }</style> 
    31056<?php endif; ?> 
    311  
    31257<?php do_action('admin_head'); ?> 
    31358</head> 
    31459<body> 
    315  
    31660<div id="wphead"> 
    31761<h1><?php echo wptexturize(get_settings(('blogname'))); ?> <span>(<a href="<?php echo get_settings('home') . '/'; ?>"><?php _e('View site') ?> &raquo;</a>)</span></h1> 
    31862</div> 
    319  
    320 <div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_settings('siteurl') 
    321      ?>/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> 
     63<div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_settings('siteurl'); ?>/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> 
    32264 
    32365<?php 
  • trunk/wp-admin/admin.php

    r3337 r3422  
    4040    } 
    4141} 
     42 
     43$xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $editing = false; 
    4244 
    4345require(ABSPATH . '/wp-admin/menu.php'); 
  • trunk/wp-admin/categories.php

    r3070 r3422  
    44$title = __('Categories'); 
    55$parent_file = 'edit.php'; 
     6$list_js = true; 
    67 
    78$wpvarstoreset = array('action','cat'); 
  • trunk/wp-admin/edit-comments.php

    r3366 r3422  
    44$title = __('Edit Comments'); 
    55$parent_file = 'edit.php'; 
     6$list_js = true; 
    67 
    78require_once('admin-header.php'); 
  • trunk/wp-admin/edit-pages.php

    r3303 r3422  
    33$title = __('Pages'); 
    44$parent_file = 'edit.php'; 
     5$list_js = true; 
    56require_once('admin-header.php'); 
    67?> 
  • trunk/wp-admin/edit.php

    r3303 r3422  
    44$title = __('Posts'); 
    55$parent_file = 'edit.php'; 
     6$list_js = true; 
    67require_once('admin-header.php'); 
    78 
  • trunk/wp-admin/link-add.php

    r2893 r3422  
    2626} 
    2727 
    28 $xfn = true; 
     28$xfn_js = true; 
    2929require('admin-header.php'); 
    3030?> 
  • trunk/wp-admin/link-categories.php

    r3295 r3422  
    66$this_file='link-categories.php'; 
    77$parent_file = 'link-manager.php'; 
     8$list_js = true; 
    89 
    910$wpvarstoreset = array('action', 'cat', 'auto_toggle'); 
  • trunk/wp-admin/link-manager.php

    r3295 r3422  
    77$title = __('Manage Links'); 
    88$this_file = $parent_file = 'link-manager.php'; 
     9$list_js = true; 
    910 
    1011$wpvarstoreset = array('action','cat_id', 'linkurl', 'name', 'image', 
     
    180181 
    181182  case 'linkedit': { 
    182     $xfn = true; 
    183     include_once ('admin-header.php'); 
    184     if ( !current_user_can('manage_links') ) 
    185       die(__('You do not have sufficient permissions to edit the links for this blog.')); 
    186  
    187     $link_id = (int) $_GET['link_id']; 
    188   
     183    $xfn_js = true; 
     184   include_once ('admin-header.php'); 
     185   if ( !current_user_can('manage_links') ) 
     186       die(__('You do not have sufficient permissions to edit the links for this blog.')); 
     187     
     188   $link_id = (int) $_GET['link_id']; 
     189     
    189190    if ( !$link = get_link_to_edit($link_id) ) 
    190191        die( __('Link not found.') ); 
    191         
     192     
    192193    include('edit-link-form.php'); 
    193     break; 
     194   break; 
    194195  } // end linkedit 
    195196  case __("Show"): 
  • trunk/wp-admin/moderation.php

    r3295 r3422  
    44$title = __('Moderate comments'); 
    55$parent_file = 'edit.php'; 
     6$list_js = true; 
    67 
    78$wpvarstoreset = array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky'); 
  • trunk/wp-admin/options-general.php

    r3112 r3422  
    11<?php 
    2 require_once('admin.php'); 
     2require_once('./admin.php'); 
    33 
    44$title = __('General Options'); 
    55$parent_file = 'options-general.php'; 
    66 
    7 include('admin-header.php'); 
     7include('./admin-header.php'); 
    88?> 
    99  
    10 <div class="wrap">  
    11 <h2><?php _e('General Options') ?></h2>  
    12 <form name="form1" method="post" action="options.php">  
    13 <input type="hidden" name="action" value="update" />  
    14 <input type="hidden" name="page_options" value="blogname,blogdescription,siteurl,admin_email,users_can_register,gmt_offset,date_format,time_format,home,start_of_week,comment_registration,default_role" />  
    15 <table width="100%" cellspacing="2" cellpadding="5" class="editform">  
     10<div class="wrap"> 
     11<h2><?php _e('General Options') ?></h2> 
     12<form method="post" action="options.php">  
     13<table class="optiontable">  
    1614<tr valign="top">  
    17 <th width="33%" scope="row"><?php _e('Weblog title:') ?></th>  
     15<th scope="row"><?php _e('Weblog title:') ?></th>  
    1816<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" size="40" /></td>  
    1917</tr>  
     
    6361<fieldset class="options">  
    6462<legend><?php _e('Date and Time') ?></legend>  
    65 <table width="100%" cellspacing="2" cellpadding="5" class="editform">  
     63<table class="optiontable">  
    6664<tr>  
    67 <th scope="row" width="33%"><?php _e('<abbr title="Coordinated Universal Time">UTC</abbr> time is:') ?> </th>  
     65<th scope="row"><?php _e('<abbr title="Coordinated Universal Time">UTC</abbr> time is:') ?> </th>  
    6866<td><code><?php echo gmdate('Y-m-d g:i:s a'); ?></code></td>  
    6967</tr> 
     
    9997</select></td> 
    10098</tr> 
     99</table> 
     100</fieldset>  
    101101 
    102 </table> 
     102<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" /> 
     103<input type="hidden" name="action" value="update" />  
     104<input type="hidden" name="page_options" value="blogname,blogdescription,siteurl,admin_email,users_can_register,gmt_offset,date_format,time_format,home,start_of_week,comment_registration,default_role" />  
     105</p> 
     106</form> 
    103107 
    104 </fieldset>  
    105 <p class="submit"> 
    106 <input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" /> 
    107 </p> 
    108 </form>  
    109108</div>  
    110 <?php include("admin-footer.php") ?> 
     109 
     110<?php include('./admin-footer.php') ?> 
  • trunk/wp-admin/options-misc.php

    r3421 r3422  
    1515<fieldset class="options"> 
    1616<legend><?php _e('Uploading'); ?></legend> 
    17 <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
    18 <tr valign="top"><th scope="row"><?php _e('Store uploads in this folder'); ?>:</th> 
    19 <td
    20 <input name="fileupload_realpath" type="text" id="fileupload_realpath" class="code" value="<?php echo str_replace(ABSPATH, '', get_settings('fileupload_realpath')); ?>" size="40" /> 
     17<table class="editform optiontable"> 
     18<tr valign="top"> 
     19<th scope="row"><?php _e('Store uploads in this folder'); ?>:</th
     20<td><input name="fileupload_realpath" type="text" id="fileupload_realpath" class="code" value="<?php echo str_replace(ABSPATH, '', get_settings('fileupload_realpath')); ?>" size="40" /> 
    2121<br /> 
    2222<?php _e('Default is <code>wp-content/uploads</code>'); ?> 
    23 </td></tr> 
    24 <tr valign="top"><th scope="row" width="33%"> </th> 
     23</td> 
     24</tr> 
     25<tr> 
     26<td></td> 
    2527<td> 
    2628<label for="uploads_use_yearmonth_folders"> 
     
    2830<?php _e('Organize my uploads into month- and year-based folders'); ?> 
    2931</label> 
    30 </td></tr> 
     32</td> 
     33</tr> 
    3134</table> 
    3235</fieldset> 
  • trunk/wp-admin/wp-admin.css

    r3349 r3422  
    295295 
    296296.submit, .editform th, #postcustomsubmit { 
     297    text-align: right; 
     298} 
     299 
     300.optiontable { 
     301    width: 100%; 
     302} 
     303 
     304.optiontable td, .optiontable th { 
     305    padding: .5em; 
     306} 
     307 
     308.optiontable th { 
     309    width: 33%; 
    297310    text-align: right; 
    298311} 
     
    903916    filter: alpha(opacity=80); 
    904917} 
     918 
     919#newcat { width: 120px; margin-right: 5px; } 
     920input#catadd {  background: #a4a4a4; 
     921    border-bottom: 1px solid #898989; 
     922    border-left: 1px solid #bcbcbc; 
     923    border-right: 1px solid #898989; 
     924    border-top: 1px solid #bcbcbc; 
     925    color: #fff; 
     926    font-size: 10px; 
     927    padding: 0; 
     928    margin: 0; 
     929    font-weight: bold; 
     930    height: 20px; 
     931    margin-bottom: 2px; 
     932    text-align: center; 
     933    width: 37px; } 
     934#howto { 
     935    font-size: 11px; 
     936    margin: 0 5px; 
     937    display: block; 
     938} 
     939#jaxcat { 
     940    margin: 0; 
     941    padding: 0; 
     942}