Make WordPress Core


Ignore:
Timestamp:
07/23/2008 09:20:53 PM (18 years ago)
Author:
azaozz
Message:

crazyhorse: changed the media uploader according to the wireframes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/crazyhorse/wp-admin/includes/media.php

    r8335 r8422  
    6868function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
    6969
    70         // CAPTIONS_OFF is temporary. Do not use it.
    71         if ( empty($alt) || ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ) return $html;
     70        if ( empty($alt) ) return $html;
    7271        $id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
    7372
     
    179178        return $id;
    180179}
    181 
    182180
    183181// wrap iframe content (produced by $content_func) in a doctype, html head/body etc
     
    250248        check_admin_referer('media-form');
    251249
    252         if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
    253                 $post = $_post = get_post($attachment_id, ARRAY_A);
    254                 if ( isset($attachment['post_content']) )
    255                         $post['post_content'] = $attachment['post_content'];
    256                 if ( isset($attachment['post_title']) )
    257                         $post['post_title'] = $attachment['post_title'];
    258                 if ( isset($attachment['post_excerpt']) )
    259                         $post['post_excerpt'] = $attachment['post_excerpt'];
    260                 if ( isset($attachment['menu_order']) )
    261                         $post['menu_order'] = $attachment['menu_order'];
    262 
    263                 $post = apply_filters('attachment_fields_to_save', $post, $attachment);
    264 
    265                 if ( isset($post['errors']) ) {
    266                         $errors[$attachment_id] = $post['errors'];
    267                         unset($post['errors']);
    268                 }
    269 
    270                 if ( $post != $_post )
    271                         wp_update_post($post);
    272 
    273                 foreach ( get_attachment_taxonomies($post) as $t )
    274                         if ( isset($attachment[$t]) )
    275                                 wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
    276         }
     250        if ( !empty($_POST['attachments']) )
     251                foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
     252                        $post = $_post = get_post($attachment_id, ARRAY_A);
     253                        if ( isset($attachment['post_content']) )
     254                                $post['post_content'] = $attachment['post_content'];
     255                        if ( isset($attachment['post_title']) )
     256                                $post['post_title'] = $attachment['post_title'];
     257                        if ( isset($attachment['post_excerpt']) )
     258                                $post['post_excerpt'] = $attachment['post_excerpt'];
     259                        if ( isset($attachment['menu_order']) )
     260                                $post['menu_order'] = $attachment['menu_order'];
     261
     262                        $post = apply_filters('attachment_fields_to_save', $post, $attachment);
     263
     264                        if ( isset($post['errors']) ) {
     265                                $errors[$attachment_id] = $post['errors'];
     266                                unset($post['errors']);
     267                        }
     268
     269                        if ( $post != $_post )
     270                                wp_update_post($post);
     271
     272                        foreach ( get_attachment_taxonomies($post) as $t )
     273                                if ( isset($attachment[$t]) )
     274                                        wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
     275                }
    277276
    278277        if ( isset($_POST['insert-gallery']) )
     
    296295}
    297296
     297// crazyhorse
    298298function media_upload_image() {
     299
    299300        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    300301                // Upload File button was clicked
     302                if ( $_FILES['async-upload']['name'] == '' )
     303                        return wp_iframe( 'media_error_nofile' );
     304
    301305                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
    302306                unset($_FILES);
     
    335339        }
    336340
    337         return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
     341        return wp_iframe( 'media_edit_single_form', $id );
    338342}
    339343
     
    507511}
    508512
     513// crazyhorse
    509514function image_attachment_fields_to_edit($form_fields, $post) {
    510515        if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
    511516                $form_fields['post_title']['required'] = true;
    512517
    513                 // CAPTIONS_OFF is temporary. Do not use it.
    514                 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
    515                         $form_fields['post_excerpt']['label'] = __('Alternate Text');
    516                         $form_fields['post_excerpt']['helps'][] = __('Alt text for the image, e.g. "The Mona Lisa"');
    517                 } else {
    518                         $form_fields['post_excerpt']['label'] = __('Caption');
    519                         $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
    520                 }
    521 
    522                 $form_fields['post_content']['label'] = __('Description');
    523 
    524                 $thumb = wp_get_attachment_thumb_url($post->ID);
     518                $form_fields['post_excerpt']['label'] = __('Caption');
     519                $form_fields['post_excerpt']['helps'][] = __('Alternate text (e.g. Blue skies)');
     520
     521//              $form_fields['post_content']['label'] = __('Description');
     522
     523//              $thumb = wp_get_attachment_thumb_url($post->ID);
    525524
    526525                $form_fields['align'] = array(
     
    537536                                <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n",
    538537                );
     538/*
    539539                $form_fields['image-size'] = array(
    540540                        'label' => __('Size'),
     
    548548                                <label for='image-size-full-$post->ID'>" . __('Full size') . "</label>",
    549549                );
     550*/
    550551        }
    551552        return $form_fields;
     
    597598add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3);
    598599
     600// crazyhorse
    599601function get_attachment_fields_to_edit($post, $errors = null) {
    600602        if ( is_int($post) )
     
    605607        $edit_post = sanitize_post($post, 'edit');
    606608        $file = wp_get_attachment_url($post->ID);
    607         $link = get_attachment_link($post->ID);
    608 
    609         // CAPTIONS_OFF is temporary. Do not use it.
    610         if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF )
    611                 $alt = __('Alternate Text');
    612         else
    613                 $alt = __('Caption');
     609//      $link = get_attachment_link($post->ID);
    614610
    615611        $form_fields = array(
    616612                'post_title'   => array(
    617613                        'label'      => __('Title'),
    618                         'value'      => $edit_post->post_title,
     614                        'value'      => $edit_post->post_title
    619615                ),
    620616                'post_excerpt' => array(
    621                         'label'      => $alt,
    622                         'value'      => $edit_post->post_excerpt,
     617                        'label'      => __('Caption'),
     618                        'value'      => $edit_post->post_excerpt
    623619                ),
     620/*
    624621                'post_content' => array(
    625622                        'label'      => __('Description'),
     
    627624                        'input'      => 'textarea',
    628625                ),
     626*/
    629627                'url'          => array(
    630                         'label'      => __('Link URL'),
    631                         'input'      => 'html',
    632                         'html'       => "
    633                                 <input type='text' name='attachments[$post->ID][url]' value='" . attribute_escape($file) . "' /><br />
    634                                 <button type='button' class='button url-$post->ID' value=''>" . __('None') . "</button>
    635                                 <button type='button' class='button url-$post->ID' value='" . attribute_escape($file) . "'>" . __('File URL') . "</button>
    636                                 <button type='button' class='button url-$post->ID' value='" . attribute_escape($link) . "'>" . __('Post URL') . "</button>
    637                                 <script type='text/javascript'>
    638                                 jQuery('button.url-$post->ID').bind('click', function(){jQuery(this).siblings('input').val(this.value);});
    639                                 </script>\n",
    640                         'helps'      => __('Enter a link URL or click above for presets.'),
    641                 ),
     628                        'label'      => __('Path'),
     629                        'value'      => attribute_escape($file)
     630                )
     631/*
    642632        'menu_order'   => array(
    643633                        'label'      => __('Order'),
    644634                        'value'      => $edit_post->menu_order
    645                 ),
     635                ),*/
    646636        );
    647 
     637/*
    648638        foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
    649639                $t = (array) get_taxonomy($taxonomy);
     
    665655                $form_fields[$taxonomy] = $t;
    666656        }
    667 
     657*/
    668658        // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
    669659        // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
     
    675665}
    676666
    677 function get_media_items( $post_id, $errors ) {
     667// crazyhorse
     668function get_media_items( $post_id ) {
    678669        if ( $post_id ) {
    679670                $post = get_post($post_id);
     
    691682                return '';
    692683
     684        $ins = isset($_REQUEST['ins']) ? 1 : 0;
     685
    693686        foreach ( $attachments as $id => $attachment )
    694                 if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
    695                         $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div><div class='filename'></div>$item\n</div>";
     687                if ( $item = get_media_item_link( $id, $ins ) )
     688                        $output .= $item;
     689
     690                //      $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div>$item\n</div>";
    696691
    697692        return $output;
     693}
     694
     695// crazyhorse
     696function get_media_item_link( $attachment_id, $ins ) {
     697
     698        if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
     699                $thumb_url = $thumb_url[0];
     700        else
     701                return false;
     702
     703        $post = get_post($attachment_id);
     704        $mime = $post->post_mime_type;
     705
     706        if ( false !== strpos($mime, 'image') ) $type = 'image';
     707        elseif ( false !== strpos($mime, 'audio') ) $type = 'audio';
     708        elseif ( false !== strpos($mime, 'video') ) $type = 'video';
     709        else $type = 'file';
     710
     711        $ins = $ins ? '&amp;ins=1' : '';
     712        $filename = basename($post->guid);
     713        $title = attribute_escape($post->post_title);
     714        $link = 'media-upload.php?att_id='.$attachment_id.'&amp;tab=single&amp;type='.$type.$ins;
     715
     716        $item = '<div class="filelink">
     717                <a href="'.$link.'">
     718                <img class="thumbnail" src="'.$thumb_url.'" alt="'.$title.'" title="'.$title.'" /></a>
     719                <p class="filelink-caption">'.$filename.'</p></div>'."\n";
     720
     721
     722        return $item;
     723}
     724
     725// crazyhorse
     726function media_edit_single_form($attachment_id = 0) {
     727        global $redir_tab;
     728
     729        $redir_tab = 'gallery';
     730        $ins = isset($_REQUEST['ins']) ? true : false;
     731
     732        if ( ! $attachment_id )
     733           $attachment_id = (int) $_REQUEST['att_id'];
     734
     735        $class = '';
     736        if ( isset($_REQUEST['type']) )
     737                $class = ' class="type-'.$_REQUEST['type'].'"';
     738
     739        $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
     740        $form_action_url = admin_url("media-upload.php?type=single&tab=gallery&post_id=$post_id");
     741
     742        $post = get_post($attachment_id);
     743        $filename = basename($post->guid);
     744
     745        media_upload_header();
     746?>
     747
     748<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
     749<?php wp_nonce_field('media-form'); ?>
     750
     751<div id="att-info"><p<?php echo $class; ?>>
     752<?php echo $filename; ?> &nbsp;
     753(<a href="<?php echo wp_nonce_url("post.php?action=delete-post&amp;post=$attachment_id", 'delete-post_' . $attachment_id); ?>" class="del-link" onclick="return confirm('<?php echo js_escape( __("You are about to delete this file\n  'Cancel' to stop, 'OK' to delete.")); ?>');"><?php _e('Remove'); ?></a> | <a href="media-upload.php?tab=gallery<?php if ( $ins ) echo '&amp;ins=1'; ?>"><?php _e('Change'); ?></a>)
     754</p></div>
     755
     756<?php echo media_edit_single($attachment_id); ?>
     757
     758<p class="ml-submit">
     759<?php if ( $ins ) { ?>
     760   <input type="submit" class="button" name="send[<?php echo $attachment_id; ?>]" value="<?php echo attribute_escape( __( 'Insert into Post' ) ) ?>" />
     761   <input type="hidden" name="ins" value="1" />
     762<?php } ?>
     763
     764<input type="submit" class="button-link button" name="save" value="<?php echo attribute_escape( __( 'Save and Add Another' ) ); ?>" />
     765
     766<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
     767<input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" />
     768<input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" />
     769</p>
     770</form>
     771<?php
     772}
     773
     774// crazyhorse
     775function media_edit_single($attachment_id = null) {
     776        global $post_mime_types;
     777
     778        $post = get_post($attachment_id);
     779
     780        $filename = basename($post->guid);
     781        $title_label = __('Title');
     782        $title = attribute_escape($post->post_title);
     783
     784        if ( isset($post_mime_types) ) {
     785                $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
     786                $type = array_shift($keys);
     787                $type = "<input type='hidden' id='type-of-$attachment_id' value='" . attribute_escape( $type ) . "' />";
     788        }
     789
     790        $form_fields = get_attachment_fields_to_edit($post);
     791
     792        $defaults = array(
     793                'input'      => 'text',
     794                'required'   => false,
     795                'value'      => '',
     796                'extra_rows' => array(),
     797        );
     798
     799        $hidden_fields = array();
     800
     801        $item = "<table class='slidetoggle describe $class'>
     802                <thead class='media-item-info'>";
     803
     804        foreach ( $form_fields as $id => $field ) {
     805                if ( $id{0} == '_' )
     806                        continue;
     807
     808                if ( !empty($field['tr']) ) {
     809                        $item .= $field['tr'];
     810                        continue;
     811                }
     812
     813                $field = array_merge($defaults, $field);
     814                $name = "attachments[$attachment_id][$id]";
     815
     816                if ( $field['input'] == 'hidden' ) {
     817                        $hidden_fields[$name] = $field['value'];
     818                        continue;
     819                }
     820
     821                $required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : '';
     822                $aria_required = $field['required'] ? " aria-required='true' " : '';
     823                $class  = $id;
     824                $class .= $field['required'] ? ' form-required' : '';
     825
     826                $item .= "\t\t<tr class='$class'>\n\t\t\t<th valign='top' scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}</span><span class='alignright'>$required</span><br class='clear' /></label></th>\n\t\t\t<td class='field'>";
     827                if ( !empty($field[$field['input']]) )
     828                        $item .= $field[$field['input']];
     829                elseif ( $field['input'] == 'textarea' ) {
     830                        $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . $aria_required . "</textarea>";
     831                } else {
     832                        $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>";
     833                }
     834                if ( !empty($field['helps']) )
     835                        $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>';
     836                $item .= "</td>\n\t\t</tr>\n";
     837
     838                $extra_rows = array();
     839
     840                if ( !empty($field['errors']) )
     841                        foreach ( array_unique((array) $field['errors']) as $error )
     842                                $extra_rows['error'][] = $error;
     843
     844                if ( !empty($field['extra_rows']) )
     845                        foreach ( $field['extra_rows'] as $class => $rows )
     846                                foreach ( (array) $rows as $html )
     847                                        $extra_rows[$class][] = $html;
     848
     849                foreach ( $extra_rows as $class => $rows )
     850                        foreach ( $rows as $html )
     851                                $item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
     852        }
     853
     854        if ( !empty($form_fields['_final']) )
     855                $item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
     856        $item .= "\t</tbody>\n";
     857        $item .= "\t</table>\n";
     858
     859        foreach ( $hidden_fields as $name => $value )
     860                $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n";
     861
     862        return $item;
     863
    698864}
    699865
     
    8651031        ?>
    8661032        <script type="text/javascript">post_id = <?php echo intval($_REQUEST['post_id']); ?>;</script>
    867         <div id="media-upload-header">
    868         <?php the_media_upload_tabs(); ?>
    869         </div>
    8701033        <?php
    8711034}
     
    10221185                if ( f.alt.value ) {
    10231186                        alt = f.alt.value.replace(/['"<>]+/g, '');
    1024 <?php if ( ! defined('CAPTIONS_OFF') || true != CAPTIONS_OFF ) { // CAPTIONS_OFF is temporary. Do not use it. ?>
    10251187                        caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
    1026 <?php } ?>
    10271188                }
    10281189
     
    11321293}
    11331294
     1295// crazyhorse
    11341296function media_upload_library_form($errors) {
    11351297        global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
     
    11371299        media_upload_header();
    11381300
    1139         $post_id = intval($_REQUEST['post_id']);
    1140 
    1141         $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id");
     1301        $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
     1302
     1303        $form_action_url = admin_url("media-upload.php?type=single&tab=library&post_id=$post_id");
    11421304
    11431305        $_GET['paged'] = intval($_GET['paged']);
     
    11471309        if ( $start < 1 )
    11481310                $start = 0;
    1149         add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 10';" ) );
     1311        add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 8';" ) );
    11501312
    11511313        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
    1152 
     1314        $ins = isset($_REQUEST['ins']) ? '<input type="hidden" name="ins" value="1" />' : '';
    11531315?>
    11541316
    1155 <form id="filter" action="" method="get">
    1156 <input type="hidden" name="type" value="<?php echo attribute_escape( $type ); ?>" />
    1157 <input type="hidden" name="tab" value="<?php echo attribute_escape( $tab ); ?>" />
    1158 <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
    1159 <input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" />
    1160 
    1161 <div id="search-filter">
    1162         <label class="hidden" for="post-search-input"><?php _e('Search Media');?>:</label>
    1163         <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
    1164         <input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" />
     1317<div id="html-upload-ui">
     1318        <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate">
     1319        <input type="file" name="async-upload" id="async-upload" />
     1320        <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" />
     1321
     1322        <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
     1323        <?php echo $ins; ?>
     1324        <?php wp_nonce_field('media-form'); ?>
     1325        </form>
    11651326</div>
    11661327
    1167 <ul class="subsubsub">
    1168 <?php
    1169 $type_links = array();
    1170 $_num_posts = (array) wp_count_attachments();
    1171 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
    1172 foreach ( $matches as $_type => $reals )
    1173         foreach ( $reals as $real )
    1174                 $num_posts[$_type] += $_num_posts[$real];
    1175 // If available type specified by media button clicked, filter by that type
    1176 if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
    1177         $_GET['post_mime_type'] = $type;
    1178         list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
    1179 }
    1180 if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
    1181         $class = ' class="current"';
    1182 $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>";
    1183 foreach ( $post_mime_types as $mime_type => $label ) {
    1184         $class = '';
    1185 
    1186         if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
    1187                 continue;
    1188 
    1189         if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
    1190                 $class = ' class="current"';
    1191 
    1192         $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
    1193 }
    1194 echo implode(' | </li>', $type_links) . '</li>';
    1195 unset($type_links);
    1196 ?>
    1197 </ul>
     1328<div id="html-upload-help"><?php _e('Or select from your Media Library'); ?></div>
    11981329
    11991330<div class="tablenav">
    1200 
    12011331<?php
    12021332$page_links = paginate_links( array(
     
    12101340        echo "<div class='tablenav-pages'>$page_links</div>";
    12111341?>
    1212 
    1213 <div class="alignleft">
    1214 <?php
    1215 
    1216 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
    1217 
    1218 $arc_result = $wpdb->get_results( $arc_query );
    1219 
    1220 $month_count = count($arc_result);
    1221 
    1222 if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
    1223 <select name='m'>
    1224 <option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
    1225 <?php
    1226 foreach ($arc_result as $arc_row) {
    1227         if ( $arc_row->yyear == 0 )
    1228                 continue;
    1229         $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
    1230 
    1231         if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
    1232                 $default = ' selected="selected"';
    1233         else
    1234                 $default = '';
    1235 
    1236         echo "<option$default value='" . attribute_escape( $arc_row->yyear . $arc_row->mmonth ) . "'>";
    1237         echo wp_specialchars( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );
    1238         echo "</option>\n";
    1239 }
    1240 ?>
    1241 </select>
    1242 <?php } ?>
    1243 
    1244 <input type="submit" id="post-query-submit" value="<?php echo attribute_escape( __( 'Filter &#187;' ) ); ?>" class="button-secondary" />
    1245 
    12461342</div>
    12471343
     1344<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="library-form">
     1345
     1346<?php wp_nonce_field('media-form'); ?>
     1347
     1348<div id="media-items">
     1349<?php echo get_media_items(null, $errors); ?>
    12481350<br class="clear" />
    12491351</div>
    12501352</form>
    1251 
    1252 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="library-form">
    1253 
    1254 <?php wp_nonce_field('media-form'); ?>
    1255 <?php //media_upload_form( $errors ); ?>
    1256 
    1257 <script type="text/javascript">
    1258 <!--
    1259 jQuery(function($){
    1260         var preloaded = $(".media-item.preloaded");
    1261         if ( preloaded.length > 0 ) {
    1262                 preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
    1263                 updateMediaForm();
    1264         }
    1265 });
    1266 -->
    1267 </script>
    1268 
    1269 <div id="media-items">
    1270 <?php echo get_media_items(null, $errors); ?>
    1271 </div>
    1272 <p class="ml-submit">
    1273 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
    1274 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
    1275 </p>
    1276 </form>
    12771353<?php
    12781354}
     1355
     1356function media_error_nofile() { ?>
     1357        <div style="text-align:center;"><h3>Please choose a file to upload</h3>
     1358        <p><button onclick="history.back();" class="button">Go Back</button></p></div>
     1359<?php }
    12791360
    12801361function type_form_image() {
     
    12961377                        <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td>
    12971378                </tr>
    1298 ';
    1299         // CAPTIONS_OFF is temporary. Do not use it.
    1300         if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
    1301                 $form .= '
    1302                 <tr>
    1303                         <th valign="top" scope="row" class="label">
    1304                                 <span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span>
    1305                         </th>
    1306                         <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
    1307                         <p class="help">' . __('Alt text for the image, e.g. "The Mona Lisa"') . '</p></td>
    1308                 </tr>
    1309 ';
    1310 
    1311         } else {
    1312                 $form .= '
     1379
    13131380                <tr>
    13141381                        <th valign="top" scope="row" class="label">
     
    13181385                        <p class="help">' . __('Also used as alternate text for the image') . '</p></td>
    13191386                </tr>
    1320 ';
    1321         }
    1322                 $form .= '
     1387
    13231388                <tr class="align">
    13241389                        <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
Note: See TracChangeset for help on using the changeset viewer.