Changeset 1195
- Timestamp:
- 04/28/2004 02:23:46 AM (22 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 3 edited
-
admin-functions.php (modified) (4 diffs)
-
edit-form-advanced.php (modified) (2 diffs)
-
wp-admin.css (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r1143 r1195 217 217 global $post_ID; 218 218 // Exit if no meta 219 if (!$meta) return; 220 221 222 print " 223 <table id='meta-list'> 224 <tr> 225 <th>Key</th> 226 <th>Value</th> 227 <th> </th> 228 </tr>\n"; 219 if (!$meta) return; 220 ?> 221 <table id='meta-list' width='98%'> 222 <tr> 223 <th><?php _e('Key') ?></th> 224 <th><?php _e('Value') ?></th> 225 <th colspan='2'><?php _e('Action') ?></th> 226 </tr> 227 <?php 229 228 230 229 foreach ($meta as $entry) { 231 // TBD: Still need to add edit/del logic... 232 print " 233 <tr> 234 <td>{$entry['meta_key']}</td> 235 <td>{$entry['meta_value']}</td> 236 <td><a href=\"?action=deletemeta&meta_id={$entry['meta_id']}&post={$entry['post_id']}\">Delete</a></td> 237 </tr>\n"; 238 } 239 print " 240 </table>\n"; 230 $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; 231 echo " 232 <tr $style> 233 <td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' value='{$entry['meta_key']}' /></td> 234 <td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='40'>{$entry['meta_value']}</textarea></td> 235 <td align='center'><input name='updatemeta' type='submit' id='updatemeta' tabindex='6' value='" . __('Update') ."' /></td> 236 <td align='center'><input name='deletemeta[{$entry['meta_id']}]' type='submit' id='deletemeta' tabindex='6' value='" . __('Delete') ."' /></td> 237 </tr> 238 "; 239 } 240 echo " 241 </table> 242 "; 241 243 } 242 244 … … 257 259 $keys = get_meta_keys(); 258 260 ?> 259 <h4><?php _e('Add new custom data to this post:') ?></h4> 260 <div id="postcustomkeys"> 261 <p><?php _e('Select existing key or enter new key') ?></p> 262 <?php 263 if ($keys) { 264 ?> 265 <select id="metakeyselect" name="metakeyselect"> 261 <h3><?php _e('Add new custom data to this post:') ?></h3> 262 <table width="100%" cellspacing="3" cellpadding="3"> 263 <tr> 264 <th colspan="2"><?php _e('Key') ?></th> 265 <th><?php _e('Value') ?></th> 266 <th></th> 267 </tr> 268 <tr valign="top"> 269 <td align="right"><select id="metakeyselect" name="metakeyselect"> 266 270 <option value="#NONE#">- Select -</option> 267 271 <?php 268 272 foreach($keys as $key) { 269 echo " <option value='$key'>$key</option>\n";273 echo "\n\t<option value='$key'>$key</option>"; 270 274 } 271 275 ?> 272 </select> 273 <?php 274 } // if ($keys) 275 ?> 276 <input type="text" id="metakeyinput" name="metakeyinput" /> 277 </div> 278 <div id="postcustomvals"> 279 <p><?php _e('Custom Value') ?></p> 280 281 <textarea id="metavalue" name="metavalue" rows="3" cols="25"></textarea> 282 </div> 283 <br style="clear: both;" /> 284 <div id="postcustomsubmit"> 285 <input type="submit" id="save" name="save" value="<?php _e('Add Custom') ?>"> 286 </div> 276 </select> or </td><td><input type="text" id="metakeyinput" name="metakeyinput" /></td> 277 <td><textarea id="metavalue" name="metavalue" rows="3" cols="25"></textarea></td> 278 <td></td> 279 </tr> 280 281 </table> 282 <p class="submit"><input type="submit" id="save" name="save" value="<?php _e('Add Custom Fields »') ?>"></p> 287 283 <?php 288 284 } … … 291 287 global $wpdb, $tablepostmeta; 292 288 293 $metakeyselect = trim($_POST['metakeyselect']);294 $metakeyinput = trim($_POST['metakeyinput']);295 $metavalue = trim($_POST['metavalue']);289 $metakeyselect = $wpdb->escape( stripslashes( trim($_POST['metakeyselect']) ) ); 290 $metakeyinput = $wpdb->escape( stripslashes( trim($_POST['metakeyinput']) ) ); 291 $metavalue = $wpdb->escape( stripslashes( trim($_POST['metavalue']) ) ); 296 292 297 293 if (!empty($metavalue) && ((('#NONE#' != $metakeyselect) && !empty($metakeyselect)) || !empty($metakeyinput))) { … … 315 311 function del_meta($mid) { 316 312 global $wpdb, $tablepostmeta; 317 313 318 314 $result = $wpdb->query("DELETE FROM $tablepostmeta WHERE meta_id = '$mid'"); 319 315 } -
trunk/wp-admin/edit-form-advanced.php
r1148 r1195 140 140 } 141 141 ?> 142 <fieldset id="postcustom">143 <legend><?php _e('Post Custom') ?></legend>144 <?php145 if($metadata = has_meta($post_ID)) {146 ?>147 <?php148 list_meta($metadata);149 ?>150 <?php151 }152 meta_form();153 ?>154 </fieldset>155 142 156 143 <?php echo $form_pingback ?> … … 180 167 touch_time(($action == 'edit')); 181 168 } 182 if ('edit' == $action) echo "183 <p><a href='post.php?action=delete&post=$post_ID' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), addslashes($edited_post_title)) . "')\">" . __('Delete this post') . "</a></p>";184 169 ?> 185 170 <fieldset id="postcustom"> 171 <legend><?php _e('Custom Fields') ?></legend> 172 <?php 173 if($metadata = has_meta($post_ID)) { 174 ?> 175 <?php 176 list_meta($metadata); 177 ?> 178 <?php 179 } 180 meta_form(); 181 ?> 182 </fieldset> 186 183 </div> 187 184 </form> 188 185 <?php if ('edit' == $action) echo " 186 <p><a class='delete' href='post.php?action=delete&post=$post_ID' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), addslashes($edited_post_title)) . "')\">" . __('Delete this post') . "</a></p>"; 187 ?> 189 188 </div> -
trunk/wp-admin/wp-admin.css
r1194 r1195 330 330 margin: 0.25em; 331 331 padding: 0.25em; 332 width: 30em;332 width: 98%; 333 333 } 334 334 … … 338 338 339 339 #postcustom table { 340 background-color: #eee;341 340 border: 1px solid #ccc; 342 color: #000; 343 margin-bottom: 1em; 344 padding: 0px; 341 margin: .5em; 345 342 width: 100%; 343 344 } 345 346 #postcustom table input, #postcustom table textarea { 347 width: 97%; 346 348 } 347 349 348 350 #postcustom td, #postcustom th { 349 351 color: #000; 350 margin: 1px; 351 padding: 0.2em; 352 } 353 354 #postcustomkeys { 355 float: left; 356 width: 49%; 357 } 358 359 #postcustomkeys input, #postcustom select, #postcustom textarea { 360 width: 95%; 361 } 352 margin: 0.2em; 353 padding: .3em; 354 } 355 356 #postcustom #updatemeta, #postcustom #deletemeta { 357 width: 90%; 358 margin: auto; 359 } 360 362 361 fieldset legend a { 363 362 border-bottom: none;
Note: See TracChangeset
for help on using the changeset viewer.