Make WordPress Core

Changeset 1856


Ignore:
Timestamp:
11/15/2004 08:52:34 PM (22 years ago)
Author:
saxmatt
Message:

Final XFN 1.1 fixes

Location:
trunk/wp-admin
Files:
2 edited

Legend:

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

    r1837 r1856  
    99<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
    1010
    11 <?php if (isset($xfn)) : ?>
     11<?php if ( isset($xfn) ) : ?>
    1212<script type="text/javascript">
    1313//<![CDATA[
    14 
    1514function GetElementsWithClassName(elementName, className) {
    1615        var allElements = document.getElementsByTagName(elementName);
    1716        var elemColl = new Array();
    1817        for (i = 0; i < allElements.length; i++) {
    19                 if (allElements[i].className == className) {
    20                         elemColl[elemColl.length] = allElements[i];
    21                 }
     18                 if (allElements[i].className == className) {
     19                          elemColl[elemColl.length] = allElements[i];
     20                 }
    2221        }
    2322        return elemColl;
    2423}
    2524
     25function meChecked() {
     26  var undefined;
     27  var eMe = document.getElementById('me');
     28  if (eMe == undefined) return false;
     29  else return eMe.checked;
     30}
     31
     32function upit() {
     33        var isMe = meChecked(); //document.getElementById('me').checked;
     34        var inputColl = GetElementsWithClassName('input', 'valinp');
     35        var results = document.getElementById('rel');
     36        var linkText, linkUrl, inputs = '';
     37        for (i = 0; i < inputColl.length; i++) {
     38                 inputColl[i].disabled = isMe;
     39                 inputColl[i].parentNode.className = isMe ? 'disabled' : '';
     40                 if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
     41                        inputs += inputColl[i].value + ' ';
     42                                }
     43                 }
     44        inputs = inputs.substr(0,inputs.length - 1);
     45        if (isMe) inputs='me';
     46        results.value = inputs;
     47        }
     48
    2649function blurry() {
    2750        if (!document.getElementById) return;
    28        
     51
    2952        var aInputs = document.getElementsByTagName('input');
    30        
    31         for (var i = 0; i < aInputs.length; i++) {     
    32                 aInputs[i].onclick = function() {
    33                         var inputColl = GetElementsWithClassName('input','valinp');
    34                         var rel = document.getElementById('rel');
    35                         var inputs = '';
    36                         for (i = 0; i < inputColl.length; i++) {
    37                                 if (inputColl[i].checked) {
    38                                 if (inputColl[i].value != '') inputs += inputColl[i].value + ' ';
    39                                 }
    40                         }
    41                         inputs = inputs.substr(0,inputs.length - 1);
    42                         if (rel != null) {
    43                                 rel.value = inputs;
    44                         }
    45                 }
    46                
    47                 aInputs[i].onkeyup = function() {
    48                         var inputColl = GetElementsWithClassName('input','valinp');
    49                         var rel = document.getElementById('rel');
    50                         var inputs = '';
    51                         for (i = 0; i < inputColl.length; i++) {
    52                                 if (inputColl[i].checked) {
    53                                         inputs += inputColl[i].value + ' ';
    54                                 }
    55                         }
    56                         inputs = inputs.substr(0,inputs.length - 1);
    57                         if (rel != null) {
    58                                 rel.value = inputs;
    59                         }
    60                 }
    61                
     53
     54        for (var i = 0; i < aInputs.length; i++) {             
     55                 aInputs[i].onclick = aInputs[i].onkeyup = upit;
    6256        }
    6357}
  • trunk/wp-admin/link-manager.php

    r1818 r1856  
    1010function xfn_check($class, $value = '', $type = 'check') {
    1111        global $link_rel;
    12         if ('' != $value && strstr($link_rel, $value)) {
     12        $rels = preg_split('/\s+/', $link_rel);
     13
     14        if ('' != $value && in_array($value, $rels) ) {
    1315                echo ' checked="checked"';
    1416        }
     17
    1518        if ('' == $value) {
    1619                if ('family' == $class && !strstr($link_rel, 'child') && !strstr($link_rel, 'parent') && !strstr($link_rel, 'sibling') && !strstr($link_rel, 'spouse') && !strstr($link_rel, 'kin')) echo ' checked="checked"';
    1720                if ('friendship' == $class && !strstr($link_rel, 'friend') && !strstr($link_rel, 'acquaintance') && !strstr($link_rel, 'contact') ) echo ' checked="checked"';
    1821                if ('geographical' == $class && !strstr($link_rel, 'co-resident') && !strstr($link_rel, 'neighbor') ) echo ' checked="checked"';
    19                 if ('identity' == $class && !strstr($link_rel, 'me') ) echo ' checked="checked"';
     22                if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
    2023        }
    2124}
    … …  
    332335            <tr>
    333336                <th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
    334                 <td><table cellpadding="3" cellspacing="5">
     337                <td>
     338                                        <table cellpadding="3" cellspacing="5">
     339                  <tr>
     340              <th scope="row"> <?php _e('identity') ?> </th>
     341              <td>
     342                <label for="me">
     343                <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
     344          <?php _e('another web address of mine') ?></label>
     345              </td>
     346            </tr>
    335347            <tr>
    336348              <th scope="row"> <?php _e('friendship') ?> </th>
    … …  
    419431              </td>
    420432            </tr>
    421             <tr>
    422               <th scope="row"> <?php _e('identity') ?> </th>
    423               <td>
    424                 <label for="label60">
    425                 <input class="valinp" type="checkbox" name="identity" value="me" id="label60" <?php xfn_check('identity', 'me'); ?> />
    426           <?php _e('me') ?></label>
    427               </td>
    428             </tr>
    429         </table></td>
     433        </table>
     434                  </td>
    430435                </tr>
    431436</table>
Note: See TracChangeset for help on using the changeset viewer.