Final XFN 1.1 fixes

git-svn-id: http://svn.automattic.com/wordpress/trunk@1856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-11-15 20:52:34 +00:00
parent 258b2b65e9
commit 6f80cf6b6a
2 changed files with 49 additions and 50 deletions

View File

@ -8,57 +8,51 @@
<link rel="shortcut icon" href="../wp-images/wp-favicon.png" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
<?php if (isset($xfn)) : ?>
<?php if ( isset($xfn) ) : ?>
<script type="text/javascript">
//<![CDATA[
function GetElementsWithClassName(elementName, className) {
var allElements = document.getElementsByTagName(elementName);
var elemColl = new Array();
for (i = 0; i < allElements.length; i++) {
if (allElements[i].className == className) {
elemColl[elemColl.length] = allElements[i];
}
if (allElements[i].className == className) {
elemColl[elemColl.length] = allElements[i];
}
}
return elemColl;
}
function meChecked() {
var undefined;
var eMe = document.getElementById('me');
if (eMe == undefined) return false;
else return eMe.checked;
}
function upit() {
var isMe = meChecked(); //document.getElementById('me').checked;
var inputColl = GetElementsWithClassName('input', 'valinp');
var results = document.getElementById('rel');
var linkText, linkUrl, inputs = '';
for (i = 0; i < inputColl.length; i++) {
inputColl[i].disabled = isMe;
inputColl[i].parentNode.className = isMe ? 'disabled' : '';
if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
inputs += inputColl[i].value + ' ';
}
}
inputs = inputs.substr(0,inputs.length - 1);
if (isMe) inputs='me';
results.value = inputs;
}
function blurry() {
if (!document.getElementById) return;
var aInputs = document.getElementsByTagName('input');
for (var i = 0; i < aInputs.length; i++) {
aInputs[i].onclick = function() {
var inputColl = GetElementsWithClassName('input','valinp');
var rel = document.getElementById('rel');
var inputs = '';
for (i = 0; i < inputColl.length; i++) {
if (inputColl[i].checked) {
if (inputColl[i].value != '') inputs += inputColl[i].value + ' ';
}
}
inputs = inputs.substr(0,inputs.length - 1);
if (rel != null) {
rel.value = inputs;
}
}
aInputs[i].onkeyup = function() {
var inputColl = GetElementsWithClassName('input','valinp');
var rel = document.getElementById('rel');
var inputs = '';
for (i = 0; i < inputColl.length; i++) {
if (inputColl[i].checked) {
inputs += inputColl[i].value + ' ';
}
}
inputs = inputs.substr(0,inputs.length - 1);
if (rel != null) {
rel.value = inputs;
}
}
for (var i = 0; i < aInputs.length; i++) {
aInputs[i].onclick = aInputs[i].onkeyup = upit;
}
}

View File

@ -9,14 +9,17 @@ $this_file = $parent_file = 'link-manager.php';
function xfn_check($class, $value = '', $type = 'check') {
global $link_rel;
if ('' != $value && strstr($link_rel, $value)) {
$rels = preg_split('/\s+/', $link_rel);
if ('' != $value && in_array($value, $rels) ) {
echo ' checked="checked"';
}
if ('' == $value) {
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"';
if ('friendship' == $class && !strstr($link_rel, 'friend') && !strstr($link_rel, 'acquaintance') && !strstr($link_rel, 'contact') ) echo ' checked="checked"';
if ('geographical' == $class && !strstr($link_rel, 'co-resident') && !strstr($link_rel, 'neighbor') ) echo ' checked="checked"';
if ('identity' == $class && !strstr($link_rel, 'me') ) echo ' checked="checked"';
if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
}
}
@ -331,7 +334,16 @@ switch ($action) {
</tr>
<tr>
<th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
<td><table cellpadding="3" cellspacing="5">
<td>
<table cellpadding="3" cellspacing="5">
<tr>
<th scope="row"> <?php _e('identity') ?> </th>
<td>
<label for="me">
<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
<?php _e('another web address of mine') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('friendship') ?> </th>
<td>
@ -418,15 +430,8 @@ switch ($action) {
<?php _e('sweetheart') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('identity') ?> </th>
<td>
<label for="label60">
<input class="valinp" type="checkbox" name="identity" value="me" id="label60" <?php xfn_check('identity', 'me'); ?> />
<?php _e('me') ?></label>
</td>
</tr>
</table></td>
</table>
</td>
</tr>
</table>
</fieldset>