Make WordPress Core

Changeset 3225


Ignore:
Timestamp:
11/28/2005 11:13:35 PM (19 years ago)
Author:
ryan
Message:

Inling uploading updates from skeltoac.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/inline-uploading.php

    r3181 r3225  
    66    die(__('You do not have permission to edit posts.'));
    77
    8 $wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment', 'flickrtag');
     8$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment');
    99
    1010for ($i=0; $i<count($wpvarstoreset); $i += 1) {
     
    3838case 'delete':
    3939
     40if ( !current_user_can('edit_post', (int) $attachment) )   
     41    die(printf(__('You are not allowed to delete this attachment. %sGo back</a>'), '<a href="'.basename(__FILE__)."?post=$post&amp;all=$all&amp;action=upload\">") );
     42
    4043wp_delete_attachment($attachment);
    4144
     
    6972$id = wp_insert_attachment($attachment, $file, $post);
    7073
    71 // Generate the attachment's postmeta.
    72 $imagesize = getimagesize($file);
    73 $imagedata['width'] = $imagesize['0'];
    74 $imagedata['height'] = $imagesize['1'];
    75 list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']);
    76 $imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'";
    77 $imagedata['file'] = $file;
    78 $imagedata['thumb'] = "thumb-$filename";
    79 
    80 add_post_meta($id, '_wp_attachment_metadata', $imagedata);
    81 
    82 if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
    83     if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
    84         $error = wp_create_thumbnail($file, 128);
    85     elseif ( $imagedata['height'] > 96 )
    86         $error = wp_create_thumbnail($file, 96);
     74if ( preg_match('!^image/!', $attachment['post_mime_type']) ) {
     75    // Generate the attachment's postmeta.
     76    $imagesize = getimagesize($file);
     77    $imagedata['width'] = $imagesize['0'];
     78    $imagedata['height'] = $imagesize['1'];
     79    list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']);
     80    $imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'";
     81    $imagedata['file'] = $file;
     82    $imagedata['thumb'] = "thumb-$filename";
     83
     84    add_post_meta($id, '_wp_attachment_metadata', $imagedata);
     85
     86    if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
     87        if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
     88            $error = wp_create_thumbnail($file, 128);
     89        elseif ( $imagedata['height'] > 96 )
     90            $error = wp_create_thumbnail($file, 96);
     91    }
     92} else {
     93    add_post_meta($id, '_wp_attachment_metadata', array());
    8794}
    8895
     
    109116}
    110117
     118if (! current_user_can('edit_others_posts') )
     119    $and_user = "AND post_author = " . $user_ID;
     120
    111121if ( $last )
    112     $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment' AND left(post_mime_type, 5) = 'image' $and_post") - $num;
     122    $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment' $and_user $and_post") - $num;
    113123else
    114124    $start = (int) $start;
     
    120130    $sort = "post_date_gmt DESC";
    121131
    122 $images = $wpdb->get_results("SELECT ID, post_date, post_title, guid FROM $wpdb->posts WHERE post_status = 'attachment' AND left(post_mime_type, 5) = 'image' $and_post ORDER BY $sort LIMIT $start, $double", ARRAY_A);
    123 
    124 if ( count($images) == 0 ) {
     132$attachments = $wpdb->get_results("SELECT ID, post_date, post_title, post_mime_type, guid FROM $wpdb->posts WHERE post_status = 'attachment' $and_type $and_post $and_user ORDER BY $sort LIMIT $start, $double", ARRAY_A);
     133
     134if ( count($attachments) == 0 ) {
    125135    header("Location: ".basename(__FILE__)."?post=$post&action=upload");
    126136    die;
    127 } elseif ( count($images) > $num ) {
    128     $next = $start + count($images) - $num;
     137} elseif ( count($attachments) > $num ) {
     138    $next = $start + count($attachments) - $num;
    129139} else {
    130140    $next = false;
     
    140150
    141151$uwidth_sum = 0;
    142 $images_html = '';
    143 $images_style = '';
    144 $images_script = '';
    145 if ( count($images) > 0 ) {
    146     $images = array_slice( $images, 0, $num );
     152$html = '';
     153$style = '';
     154$script = '';
     155if ( count($attachments) > 0 ) {
     156    $attachments = array_slice( $attachments, 0, $num );
    147157    $__delete = __('Delete');
    148     $__attachment_on = __('Link to Page');
    149     $__attachment_off = __('Link to Image');
    150     $__thumbnail_on = __('Use Thumbnail');
    151     $__thumbnail_off = __('Use Full Image');
     158    $__not_linked = __('Not Linked');
     159    $__linked_to_page = __('Linked to Page');
     160    $__linked_to_image = __('Linked to Image');
     161    $__using_thumbnail = __('Using Thumbnail');
     162    $__using_original = __('Using Original');
    152163    $__no_thumbnail = __('<del>No Thumbnail</del>');
    153164    $__close = __('Close Options');
    154     $__confirmdelete = __('Delete this photo from the server?');
     165    $__confirmdelete = __('Delete this file from the server?');
    155166    $__nothumb = __('There is no thumbnail associated with this photo.');
    156     $images_script .= "attachmenton = '$__attachment_on';\nattachmentoff = '$__attachment_off';\n";
    157     $images_script .= "thumbnailon = '$__thumbnail_on';\nthumbnailoff = '$__thumbnail_off';\n";
    158     foreach ( $images as $key => $image ) {
    159         $attachment_ID = $image['ID'];
    160         $meta = get_post_meta($attachment_ID, '_wp_attachment_metadata', true);
     167    $script .= "notlinked = '$__not_linked';
     168linkedtoimage = '$__linked_to_image';
     169linkedtopage = '$__linked_to_page';
     170usingthumbnail = '$__using_thumbnail';
     171usingoriginal = '$__using_original';
     172";
     173    foreach ( $attachments as $key => $attachment ) {
     174        $ID = $attachment['ID'];
     175        $meta = get_post_meta($ID, '_wp_attachment_metadata', true);
    161176        if (!is_array($meta)) {
    162             $meta = get_post_meta($attachment_ID, 'imagedata', true); // Try 1.6 Alpha meta key
     177            $meta = get_post_meta($ID, 'imagedata', true); // Try 1.6 Alpha meta key
    163178            if (!is_array($meta)) {
    164                 continue;
     179                $meta = array();
     180            }
     181            add_post_meta($ID, '_wp_attachment_metadata', $meta);
     182        }
     183        $attachment = array_merge($attachment, $meta);
     184        $delete_cancel = "<a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&amp;attachment={$ID}&amp;all=$all&amp;start=$start&amp;post=$post\">$__delete</a>
     185        <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
     186";
     187        $uwidth_sum += 128;
     188        if ( preg_match('!^image/!', $attachment['post_mime_type'] ) ) {
     189            $image = & $attachment;
     190            if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) {
     191                $src = str_replace(basename($image['guid']), $image['thumb'], $image['guid']);
     192                $script .= "src{$ID}a = '$src';
     193src{$ID}b = '{$image['guid']}';
     194";
     195                $thumb = 'true';
     196                $thumbtext = $__using_thumbnail;
    165197            } else {
    166                 add_post_meta($attachment_ID, '_wp_attachment_metadata', $meta);
     198                $src = $image['guid'];
     199                $thumb = 'false';
     200                $thumbtext = $__no_thumbnail;
    167201            }
    168         }
    169         $image = array_merge($image, $meta);
    170         if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) {
    171             $src = str_replace(basename($image['guid']), '', $image['guid']) . $image['thumb'];
    172             $images_script .= "src".$attachment_ID."a = '$src';\nsrc".$attachment_ID."b = '".$image['guid']."';\n";
    173             $thumb = 'true';
    174             $thumbtext = $__thumbnail_on;
    175         } else {
    176             $src = $image['guid'];
    177             $thumb = 'false';
    178             $thumbtext = $__no_thumbnail;
    179         }
    180         list($image['uwidth'], $image['uheight']) = get_udims($image['width'], $image['height']);
    181         $height_width = 'height="'.$image['uheight'].'" width="'.$image['uwidth'].'"';
    182         $uwidth_sum += 128;
    183         $xpadding = (128 - $image['uwidth']) / 2;
    184         $ypadding = (96 - $image['uheight']) / 2;
    185         $images_style .= "#target{$attachment_ID} img { padding: {$ypadding}px {$xpadding}px; }\n";
    186         $href = get_attachment_link($attachment_ID);
    187         $images_script .= "href{$attachment_ID}a = '$href';\nhref{$attachment_ID}b = '{$image['guid']}';\n";
    188         $images_html .= "
    189 <div id='target{$attachment_ID}' class='imagewrap left'>
    190     <div id='popup{$attachment_ID}' class='popup'>
    191         <a id=\"L{$attachment_ID}\" onclick=\"toggleLink({$attachment_ID});return false;\" href=\"javascript:void();\">$__attachment_on</a>
    192         <a id=\"I{$attachment_ID}\" onclick=\"if($thumb)toggleImage({$attachment_ID});else alert('$__nothumb');return false;\" href=\"javascript:void();\">$thumbtext</a>
    193         <a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&amp;attachment={$attachment_ID}&amp;all=$all&amp;start=$start&amp;post=$post\">$__delete</a>
    194         <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
     202            list($image['uwidth'], $image['uheight']) = get_udims($image['width'], $image['height']);
     203            $height_width = 'height="'.$image['uheight'].'" width="'.$image['uwidth'].'"';
     204            $xpadding = (128 - $image['uwidth']) / 2;
     205            $ypadding = (96 - $image['uheight']) / 2;
     206            $style .= "#target{$ID} img { padding: {$ypadding}px {$xpadding}px; }\n";
     207            $href = get_attachment_link($ID);
     208            $script .= "a{$ID}a = '<a id=\"{$ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$image['post_title']}\">';
     209a{$ID}b = '<a class=\"imagelink\" href=\"{$image['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$image['post_title']}\">';
     210img{$ID}a = '<img id=\"image{$ID}\" src=\"$src\" alt=\"{$image['post_title']}\" $height_width />';
     211img{$ID}b = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$image['post_title']}\" $height_width />';
     212";
     213            $html .= "<div id='target{$ID}' class='attwrap left'>
     214    <div id='popup{$ID}' class='popup'>
     215        <a id=\"I{$ID}\" onclick=\"if($thumb)toggleImage({$ID});else alert('$__nothumb');return false;\" href=\"javascript:void()\">$thumbtext</a>
     216        <a id=\"L{$ID}\" onclick=\"toggleLink({$ID});return false;\" href=\"javascript:void()\">$__not_linked</a>
     217        {$delete_cancel}
    195218    </div>
    196     <a id=\"{$attachment_ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"imagePopup({$attachment_ID});return false;\" title=\"{$image['post_title']}\">       
    197         <img id=\"image{$attachment_ID}\" src=\"$src\" alt=\"{$attachment_ID}\" $height_width />
    198     </a>
     219    <div id='div{$ID}' class='imagewrap' onclick=\"doPopup({$ID});\">
     220        <img id=\"image{$ID}\" src=\"$src\" alt=\"{$image['post_title']}\" $height_width />
     221    </div>
    199222</div>
    200223";
    201     }
    202 }
    203 
    204 $images_width = $uwidth_sum + ( count($images) * 5 ) + 30;
     224        } else {
     225            $html .= "<div id='target{$ID}' class='attwrap left'>
     226    <div id='popup{$ID}' class='popup'>
     227        <div class='filetype'>File Type: ".str_replace('/',"/\n",$attachment['post_mime_type'])."</div>
     228        {$delete_cancel}
     229    </div>
     230    <div id='div{$ID}' class='otherwrap' onmousedown=\"selectLink({$ID})\" onclick=\"doPopup({$ID});return false;\">
     231        <a id=\"{$ID}\" href=\"{$attachment['guid']}\" onmousedown=\"selectLink({$ID});\" onclick=\"return false;\">{$attachment['post_title']}</a>
     232    </div>
     233</div>
     234";
     235        }
     236    }
     237}
     238
     239$images_width = $uwidth_sum + ( count($images) * 6 ) + 35;
    205240
    206241break;
     
    218253<script type="text/javascript">
    219254/* Define any variables we'll need, such as alternate URLs. */
    220 <?php echo $images_script; ?>
    221 
    222 function validateImageName() {
    223 /* This is more for convenience than security. Server-side validation is very thorough.*/
    224 obj = document.getElementById('upload');
    225 r = /.jpg$|.gif$|.png$/i;
    226 if ( obj.value.match(r) )
    227 return true;
    228 alert('Please select a JPG, PNG or GIF file.');
    229 return false;
    230 }
     255<?php echo $script; ?>
     256
    231257function cancelUpload() {
    232 o = document.getElementById('uploadForm');
    233 o.method = 'GET';
    234 o.action.value = 'view';
    235 o.submit();
    236 }
    237 function imagePopup(i) {
    238 if ( popup )
    239 popup.style.display = 'none';
    240 target = document.getElementById('target'+i);
    241 popup = document.getElementById('popup'+i);
    242 //popup.style.top = (target.offsetTop + 3) + 'px';
    243 popup.style.left = (target.offsetLeft) + 'px';
    244 popup.style.display = 'block';
     258    o = document.getElementById('uploadForm');
     259    o.method = 'GET';
     260    o.action.value = 'view';
     261    o.submit();
     262}
     263function doPopup(i) {
     264    if ( popup )
     265    popup.style.display = 'none';
     266    target = document.getElementById('target'+i);
     267    popup = document.getElementById('popup'+i);
     268    popup.style.left = (target.offsetLeft) + 'px';
     269    popup.style.display = 'block';
    245270}
    246271function init() {
    247 popup = false;
     272    popup = false;
     273}
     274function selectLink(n) {
     275    o=document.getElementById('div'+n);
     276    r = document.body.createTextRange();
     277    if ( typeof r != 'undefined' ) {
     278        r.moveToElementText(o);
     279        r.select();
     280    }
    248281}
    249282function toggleLink(n) {
    250     o=document.getElementById(n);
    251     oi=document.getElementById('L'+n);
    252     if ( oi.innerHTML == attachmenton ) {
    253         o.href = eval('href'+n+'b');
    254         oi.innerHTML = attachmentoff;
     283    od=document.getElementById('div'+n);
     284    ol=document.getElementById('L'+n);
     285    oi=document.getElementById('I'+n);
     286    if ( oi.innerHTML == usingthumbnail ) {
     287        img = eval('img'+n+'a');
    255288    } else {
    256         o.href = eval('href'+n+'a');
    257         oi.innerHTML = attachmenton;
     289        img = eval('img'+n+'b');
     290    }
     291    if ( ol.innerHTML == notlinked ) {
     292        od.innerHTML = eval('a'+n+'b')+img+'</a>';
     293        ol.innerHTML = linkedtoimage;
     294    } else if ( ol.innerHTML == linkedtoimage ) {
     295        od.innerHTML = eval('a'+n+'a')+img+'</a>';
     296        ol.innerHTML = linkedtopage;
     297    } else {
     298        od.innerHTML = img;
     299        ol.innerHTML = notlinked;
    258300    }
    259301}
     
    261303    o = document.getElementById('image'+n);
    262304    oi = document.getElementById('I'+n);
    263     if ( oi.innerHTML == thumbnailon ) {
     305    if ( oi.innerHTML == usingthumbnail ) {
    264306        o.src = eval('src'+n+'b');
    265         oi.innerHTML = thumbnailoff;
     307        oi.innerHTML = usingoriginal;
    266308    } else {
    267309        o.src = eval('src'+n+'a');
    268         oi.innerHTML = thumbnailon;
     310        oi.innerHTML = usingthumbnail;
    269311    }
    270312}
     
    279321}
    280322form {
    281     margin: 6px 2px 0px 6px;
     323    margin: 3px 2px 0px 6px;
    282324}
    283325#wrap {
    284326    clear: both;
    285     margin: 0px;
    286327    padding: 0px;
    287     height: 133px;
    288328    width: 100%;
    289     overflow: auto;
    290329}
    291330#images {
    292331    clear: both;
    293332    margin: 0px;
    294     padding: 5px 15px;
     333    padding: 3px 15px;
    295334    height: 96px;
    296     white-space: nowrap;
     335/*  white-space: nowrap;*/
    297336    width: <?php echo $images_width; ?>px;
    298337}
     
    300339    background-color: rgb(209, 226, 239);
    301340}
    302 <?php echo $images_style; ?>
     341<?php echo $style; ?>
     342.attwrap, .attwrap * {
     343    overflow: none;
     344    margin: 0px;
     345    padding: 0px;
     346    border: 0px;
     347}
    303348.imagewrap {
    304349    margin-right: 5px;
    305350    height: 96px;
    306351    overflow: hidden;
    307 }
    308 .imagewrap * {
    309     margin: 0px;
    310     padding: 0px;
    311     border: 0px;
    312 }
    313 .imagewrap a, .imagewrap a img, .imagewrap a:hover img, .imagewrap a:visited img, .imagewrap a:active img {
     352    float: left;
     353}
     354.otherwrap {
     355    margin-right: 5px;
     356    height: 90px;
     357    overflow: hidden;
     358    background-color: #f9fcfe;
     359    float: left;
     360    padding: 3px;
     361}
     362.otherwrap a {
     363    display: block;
     364    width: 122px;
     365}
     366.otherwrap a, .otherwrap a:hover, .otherwrap a:active, .otherwrap a:visited {
     367    color: blue;
     368}
     369.filetype {
     370    font-size: 80%;
     371    border-bottom: 3px double #89a
     372}
     373.imagewrap, .imagewrap img, .imagewrap a, .imagewrap a img, .imagewrap a:hover img, .imagewrap a:visited img, .imagewrap a:active img {
    314374    text-decoration: none;
    315     float: left;
    316     text-align: center;
    317375}
    318376
    319377#upload-menu {
    320378    background: #fff;
    321     margin: 0;
     379    margin: 0px;
    322380    padding: 0;
    323381    list-style: none;
    324382    height: 2em;
    325383    border-bottom: 1px solid #448abd;
     384    width: 100%;
    326385}
    327386
    328387#upload-menu li {
    329388    float: left;
    330     margin: 0 0 0 1em;
     389    margin: 0 0 0 .75em;
    331390}
    332391
     
    342401    background: #dfe8f1;
    343402    border-right: 2px solid #448abd;
    344    
    345403}
    346404
     
    371429    margin-left: 40px;
    372430}
    373 
    374431#title, #descr {
    375     width: 80%;
    376     margin-top: 2px;
     432    width: 100%;
     433    margin-top: 1px;
    377434}
    378435#descr {
    379     height: 35px;
     436    height: 36px;
    380437}
    381438#buttons {
    382     width: 98%;
    383439    margin-top: 2px;
    384440    text-align: right;
     
    392448    display: none;
    393449    background-color: rgb(223, 232, 241);
     450    text-align: center;
     451}
     452.imagewrap .popup {
    394453    opacity: .90;
    395454    filter:alpha(opacity=90);
    396     text-align: center;
     455}
     456.otherwrap .popup {
     457    padding-top: 20px;
    397458}
    398459.popup a, .popup a:visited, .popup a:active {
     
    411472<body onload="init()">
    412473<ul id="upload-menu">
    413 <li<?php echo $current_1; ?>><a href="<?php echo basename(__FILE__); ?>?action=upload&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>"><?php _e('Upload Image'); ?></a></li>
     474<li<?php echo $current_1; ?>><a href="<?php echo basename(__FILE__); ?>?action=upload&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>"><?php _e('Upload'); ?></a></li>
    414475<?php if ( $attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post'") ) { ?>
    415 <li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&amp;post=<?php echo $post; ?>"><?php _e('Attached Images'); ?></a></li>
     476<li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&amp;post=<?php echo $post; ?>"><?php _e('Browse'); ?></a></li>
    416477<?php } ?>
    417 <?php if ($wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment' AND left(post_mime_type, 5) = 'image'")) { ?>
    418 <li<?php echo $current_3; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&amp;post=<?php echo $post; ?>&amp;all=true"><?php _e('All Images'); ?></a></li>
     478<?php if ($wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment'")) { ?>
     479<li<?php echo $current_3; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&amp;post=<?php echo $post; ?>&amp;all=true"><?php _e('Browse All'); ?></a></li>
    419480<?php } ?>
    420481<li> </li>
     
    424485<li><a href="<?php echo basename(__FILE__); ?>?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=<?php echo $back; ?>"">&laquo; <?php _e('Back'); ?></a></li>
    425486<?php else : ?>
    426 <li class="inactive spacer">|&lt;</li>
    427 <li class="inactive">&lt;&lt;</li>
     487<li class="inactive spacer">|&laquo;</li>
     488<li class="inactive">&laquo; <?php _e('Back'); ?></li>
    428489<?php endif; ?>
    429490<?php if ( false !== $next ) : ?>
     
    431492<li><a href="<?php echo basename(__FILE__); ?>?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;last=true" title="<?php _e('Last'); ?>">&raquo;|</a></li>
    432493<?php else : ?>
    433 <li class="inactive">&gt;&gt;</li>
    434 <li class="inactive">&gt;|</li>
     494<li class="inactive"><?php _e('Next'); ?> &raquo;</li>
     495<li class="inactive">&raquo;|</li>
    435496<?php endif; ?>
    436497<?php } // endif not upload?>
    437498</ul>
    438499<?php if ( $action == 'view' ) : ?>
    439 <span class="left tip"><?php _e('You can drag and drop these photos into your post. Click on the thumbnail for more options.'); ?></span>
    440 <span class="right tip"></span>
    441500<div id="wrap">
     501<div class="tip"><?php _e('You can drag and drop these items into your post. Click on one for more options.'); ?></div>
    442502<div id="images">
    443 <?php echo $images_html; ?>
     503<?php echo $html; ?>
    444504</div>
    445505</div>
    446506<?php elseif ( $action == 'upload' ) : ?>
    447507<div class="tip"></div>
    448 <form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo basename(__FILE__); ?>" onsubmit="return validateImageName()">
    449 <table style="width: 100%">
     508<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo basename(__FILE__); ?>">
     509<table style="width:99%;">
    450510<tr>
    451 <th scope="row" style="width: 6em; text-align: right;"><label for="upload"><?php _e('Image:'); ?></label></th>
    452 <td><input type="file" id="upload" name="image" onchange="validateImageName()" /></td>
     511<th scope="row" style="width: 4.5em;text-align: right;"><label for="upload"><?php _e('File:'); ?></label></th>
     512<td><input type="file" id="upload" name="image" /></td>
    453513</tr>
    454514<tr>
     
    460520<td><input type="textarea" name="descr" id="descr" value="" /></td>
    461521</tr>
    462 </table>
    463 <p class="submit">
     522<tr id="buttons">
     523<th></th>
     524<td>
    464525<input type="hidden" name="action" value="save" />
    465526<input type="hidden" name="post" value="<?php echo $post; ?>" />
     
    467528<input type="submit" value="<?php _e('Upload'); ?>" />
    468529<input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" />
    469 </p>
     530</td>
     531</tr>
     532</table>
    470533</div>
    471534</form>
Note: See TracChangeset for help on using the changeset viewer.