Support for hidden custom fields (custom fields that start with _)

git-svn-id: https://develop.svn.wordpress.org/trunk@1935 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2004-12-09 04:12:20 +00:00
parent 5411566910
commit 1c6a2d83f5
4 changed files with 62 additions and 34 deletions

View File

@ -259,6 +259,7 @@ function list_meta($meta) {
global $post_ID;
// Exit if no meta
if (!$meta) return;
$count = 0;
?>
<table id='meta-list' cellpadding="3">
<tr>
@ -269,9 +270,12 @@ function list_meta($meta) {
<?php
foreach ($meta as $entry) {
$style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
++$count;
if ( $count % 2 ) $style = 'alternate';
else $style = '';
if ( '_' == $entry['meta_key']{0} ) $style .= ' hidden';
echo "
<tr $style>
<tr class='$style'>
<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>
<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>
<td align='center' width='10%'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='" . __('Update') ."' /></td>
@ -326,11 +330,11 @@ function meta_form() {
<?php endif; ?>
</td>
<td><input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" /></td>
<td><textarea id="metavalue" name="metavalue" rows="3" cols="25" tabindex="7"></textarea></td>
<td><textarea id="metavalue" name="metavalue" rows="3" cols="25" tabindex="8"></textarea></td>
</tr>
</table>
<p class="submit"><input type="submit" name="updatemeta" tabindex="7" value="<?php _e('Add Custom Field &raquo;') ?>" /></p>
<p class="submit"><input type="submit" name="updatemeta" tabindex="9" value="<?php _e('Add Custom Field &raquo;') ?>" /></p>
<?php
}
@ -801,7 +805,9 @@ function get_real_file_to_edit($file) {
return $real_file;
}
$wp_file_descriptions = array('index.php' => __('Main Template'),
$wp_file_descriptions =
array(
'index.php' => __('Main Template'),
'wp-layout.css' => __('Stylesheet'),
'style.css' => __('Stylesheet'),
'wp-comments.php' => __('Comments Template'),
@ -821,7 +827,6 @@ $wp_file_descriptions = array('index.php' => __('Main Template'),
'single.php' => __('Post Template'),
'404.php' => __('404 Template'),
'my-hacks.php' => __('my-hacks.php (legacy hacks support)'),
'.htaccess' => __('.htaccess (for rewrite rules)')
);

View File

@ -8,9 +8,27 @@
<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) ) : ?>
<script type="text/javascript">
//<![CDATA[
function customToggleLink() {
// TODO: Only show link if there's a hidden row
document.write('<small>(<a href="javascript:;" id="customtoggle" onclick="toggleHidden()"><?php _e('Show hidden'); ?></a>)</small>');
// TODO: Rotate link to say "show" or "hide"
// TODO: Use DOM
}
function toggleHidden() {
var allElements = document.getElementsByTagName('tr');
for (i = 0; i < allElements.length; i++) {
if ( allElements[i].className.indexOf('hidden') != -1 ) {
allElements[i].className = allElements[i].className.replace('hidden', '');
}
}
}
<?php if ( isset($xfn) ) : ?>
function GetElementsWithClassName(elementName, className) {
var allElements = document.getElementsByTagName(elementName);
var elemColl = new Array();
@ -57,9 +75,10 @@ function blurry() {
}
window.onload = blurry;
<?php endif; ?>
//]]>
</script>
<?php endif; ?>
<?php do_action('admin_head', ''); ?>
</head>

View File

@ -122,7 +122,7 @@ edCanvas = document.getElementById('content');
</fieldset>
<fieldset id="postcustom">
<legend><?php _e('Custom Fields') ?></legend>
<legend><?php _e('Custom Fields') ?> <script type="text/javascript">customToggleLink();</script></legend>
<div id="postcustomstuff">
<?php
if($metadata = has_meta($post_ID)) {

View File

@ -153,6 +153,10 @@ textarea, input, select {
padding: 1px;
}
.hidden {
display: none;
}
.post-categories {
display: inline;
margin: 0;