Changeset 4355
- Timestamp:
- 10/07/2006 06:31:39 PM (20 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 5 edited
-
admin-functions.php (modified) (1 diff)
-
upload-functions.php (modified) (9 diffs)
-
upload-js.php (modified) (8 diffs)
-
upload.css (modified) (4 diffs)
-
wp-admin.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r4325 r4355 1970 1970 1971 1971 $icon = get_attachment_icon($post->ID); 1972 1972 $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true ); 1973 $thumb = isset($attachment_data['thumb']); 1973 1974 ?> 1974 1975 <form id="the-attachment-links"> 1975 1976 <table> 1977 <col /> 1978 <col class="widefat" /> 1976 1979 <tr> 1977 <th scope="row"><?php _e('Text linked to file') ?></th> 1978 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo basename($post->guid) ?></a></textarea></td> 1979 </tr> 1980 <tr> 1981 <th scope="row"><?php _e('Text linked to subpost') ?></th> 1982 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $post->post_title ?></a></textarea></td> 1980 <th scope="row"><?php _e('URL') ?></th> 1981 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><?php echo $post->guid ?></textarea></td> 1983 1982 </tr> 1984 1983 <?php if ( $icon ) : ?> 1985 1984 <tr> 1986 <th scope="row"><?php _e('Thumbnail linked to file')?></th>1987 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo $icon ?></a></textarea></td>1985 <th scope="row"><?php $thumb ? _e('Thumbnail linked to file') : _e('Image linked to file'); ?></th> 1986 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid; ?>" id="<?php echo $post->ID ?>"><?php echo $icon ?></a></textarea></td> 1988 1987 </tr> 1989 1988 <tr> 1990 <th scope="row"><?php _e('Thumbnail linked to subpost')?></th>1989 <th scope="row"><?php $thumb ? _e('Thumbnail linked to page') : _e('Image linked to file'); ?></th> 1991 1990 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $icon ?></a></textarea></td> 1991 </tr> 1992 <?php else : ?> 1993 <tr> 1994 <th scope="row"><?php _e('Link to file') ?></th> 1995 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo basename($post->guid); ?></a></textarea></td> 1996 </tr> 1997 <tr> 1998 <th scope="row"><?php _e('Link to page') ?></th> 1999 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php the_title(); ?></a></textarea></td> 1992 2000 </tr> 1993 2001 <?php endif; ?> -
trunk/wp-admin/upload-functions.php
r4353 r4355 17 17 $image_src = explode('"', $image_src); 18 18 $image_src = $image_src[1]; 19 $ thumb_src= wp_make_link_relative($image_src);19 $image_rel = wp_make_link_relative($image_src); 20 20 $class = 'image'; 21 $innerHTML = ' ' . str_replace($image_src, $thumb_src, $innerHTML); 21 $innerHTML = ' ' . str_replace($image_src, $image_rel, $innerHTML); 22 $image_base = str_replace($image_rel, '', $image_src); 22 23 } 23 24 24 $src = wp_make_link_relative( get_the_guid() ); 25 $src_base = get_the_guid(); 26 $src = wp_make_link_relative( $src_base ); 27 $src_base = str_replace($src, '', $src_base); 25 28 26 29 $r = ''; … … 34 37 $r .= "\n\t\t<div class='upload-file-data'>\n\t\t\t<p>\n"; 35 38 $r .= "\t\t\t\t<input type='hidden' name='attachment-url-$id' id='attachment-url-$id' value='$src' />\n"; 36 37 if ( $image_src ) 38 $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-$id' id='attachment-thumb-url-$id' value='$thumb_src' />\n"; 39 $r .= "\t\t\t\t<input type='hidden' name='attachment-url-base-$id' id='attachment-url-base-$id' value='$src_base' />\n"; 40 41 if ( isset($attachment_data['thumb']) ) { 42 $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-$id' id='attachment-thumb-url-$id' value='$image_rel' />\n"; 43 $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-base-$id' id='attachment-thumb-url-base-$id' value='$image_base' />\n"; 44 } elseif ( $image_rel ) 45 $r .= "\t\t\t\t<input type='hidden' name='attachment-is-image-$id' id='attachment-is-image-$id' value='1' />\n"; 39 46 if ( isset($width) ) { 40 47 $r .= "\t\t\t\t<input type='hidden' name='attachment-width-$id' id='attachment-width-$id' value='$width' />\n"; … … 49 56 50 57 function wp_upload_view() { 51 global $style, $post_id ;58 global $style, $post_id, $style; 52 59 $id = get_the_ID(); 53 60 $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true ); … … 55 62 <div id="upload-file"> 56 63 <div id="file-title"> 57 <h2><?php if ( !isset($attachment_data['width']) )64 <h2><?php if ( !isset($attachment_data['width']) && 'inline' != $style ) 58 65 echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>"; 59 66 the_title(); 60 if ( !isset($attachment_data['width']) )67 if ( !isset($attachment_data['width']) && 'inline' != $style ) 61 68 echo '</a>'; 62 69 ?></h2> … … 72 79 73 80 <div id="upload-file-view" class="alignleft"> 74 <?php if ( isset($attachment_data['width']) )81 <?php if ( isset($attachment_data['width']) && 'inline' != $style ) 75 82 echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>"; 76 83 echo wp_upload_display( array(171, 128) ); 77 if ( isset($attachment_data['width']) )84 if ( isset($attachment_data['width']) && 'inline' != $style ) 78 85 echo '</a>'; ?> 79 86 </div> 80 87 <?php the_attachment_links( $id ); ?> 81 88 </div> 82 <?php 89 <?php echo "<form action='' id='browse-form'><input type='hidden' id='nonce-value' value='" . wp_create_nonce( 'inlineuploading' ) . "' /></form>\n"; 83 90 } 84 91 … … 95 102 ?> 96 103 <div id="file-title"> 97 <h2><?php if ( !isset($attachment_data['width']) )104 <h2><?php if ( !isset($attachment_data['width']) && 'inline' != $style ) 98 105 echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>"; 99 106 the_title(); 100 if ( !isset($attachment_data['width']) )107 if ( !isset($attachment_data['width']) && 'inline' != $style ) 101 108 echo '</a>'; 102 109 ?></h2> … … 112 119 113 120 <div id="upload-file-view" class="alignleft"> 114 <?php if ( isset($attachment_data['width']) )121 <?php if ( isset($attachment_data['width']) && 'inline' != $style ) 115 122 echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>"; 116 123 echo wp_upload_display( array(171, 128) ); 117 if ( isset($attachment_data['width']) )124 if ( isset($attachment_data['width']) && 'inline' != $style ) 118 125 echo '</a>'; ?> 119 126 </div> 120 127 <?php endif; ?> 121 <table> 122 <?php if ( !$id ): ?>128 <table><col /><col class="widefat" /> 129 <?php if ( $id ): ?> 123 130 <tr> 124 <th scope="row"><label for="upload"><?php _e('File:'); ?></label></th> 131 <th scope="row"><label for="url"><?php _e('URL'); ?></label></th> 132 <td><input type="text" id="url" class="readonly" value="<?php the_guid(); ?>" readonly="readonly" /></td> 133 </tr> 134 <?php else : ?> 135 <tr> 136 <th scope="row"><label for="upload"><?php _e('File'); ?></label></th> 125 137 <td><input type="file" id="upload" name="image" /></td> 126 138 </tr> 127 139 <?php endif; ?> 128 140 <tr> 129 <th scope="row"><label for="post_title"><?php _e('Title :'); ?></label></th>141 <th scope="row"><label for="post_title"><?php _e('Title'); ?></label></th> 130 142 <td><input type="text" id="post_title" name="post_title" value="<?php echo $attachment->post_title; ?>" /></td> 131 143 </tr> 132 144 <tr> 133 <th scope="row"><label for="post_content"><?php _e('Description :'); ?></label></th>145 <th scope="row"><label for="post_content"><?php _e('Description'); ?></label></th> 134 146 <td><textarea name="post_content" id="post_content"><?php echo $attachment->post_content; ?></textarea></td> 135 147 </tr> 136 <tr id="buttons"> 137 <th></th> 138 <td> 148 <tr id="buttons" class="submit"> 149 <td colspan='2'> 150 <?php if ( $id ) : ?> 151 <input type="submit" name="delete" id="delete" class="delete alignleft" value="<?php _e('Delete File'); ?>" /> 152 <?php endif; ?> 139 153 <input type="hidden" name="from_tab" value="<?php echo $tab; ?>" /> 140 154 <input type="hidden" name="action" value="<?php echo $id ? 'save' : 'upload'; ?>" /> … … 147 161 <div class="submit"> 148 162 <input type="submit" value="<?php $id ? _e('Save') : _e('Upload'); ?> »" /> 149 <?php if ( $id ) : ?>150 <input type="submit" name="delete" class="delete" value="<?php _e('Delete'); ?>" />151 <?php endif; ?>152 163 </div> 153 164 </td> … … 353 364 if ( 'inline' == @$_GET['style'] ) { 354 365 echo "<style type='text/css'>\n"; 355 echo "\tbody { height: 1 4em; overflow: hidden; }\n";366 echo "\tbody { height: 15em; overflow: hidden; }\n"; 356 367 echo "\t#upload-content { overflow-y: auto; }\n"; 357 368 echo "\t#upload-file { position: absolute; }\n"; -
trunk/wp-admin/upload-js.php
r4349 r4355 38 38 return; 39 39 var thumbEl = $('attachment-thumb-url-' + id); 40 if ( thumbEl ) 40 this.currentImage.isImage = true; 41 if ( thumbEl ) { 41 42 this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value ); 42 else 43 this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value ); 44 } else { 43 45 this.currentImage.thumb = false; 46 var isImageEl = $('attachment-is-image-' + id); 47 if ( !isImageEl ) 48 this.currentImage.isImage = false; 49 } 44 50 this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value ); 51 this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + id).value ); 45 52 this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value ); 46 53 this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value ); … … 66 73 params.ID = ''; 67 74 params.action = ''; 68 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files' class='back'>« Back</a>";75 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files' class='back'>« Back</a>"; 69 76 } else { 70 77 h += "<a href='#' onclick='theFileList.cancelView()' title='Browse your files' class='back'>« Back</a>"; 71 78 } 72 79 h += "<div id='file-title'>" 73 if ( !this.currentImage. thumb)74 h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";80 if ( !this.currentImage.isImage ) 81 h += "<h2><a href='" + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>" + this.currentImage.title + "</a></h2>"; 75 82 else 76 83 h += "<h2>" + this.currentImage.title + "</h2>"; … … 80 87 h += '</div>' 81 88 h += "<div id='upload-file-view' class='alignleft'>"; 82 if ( this.currentImage.thumb ) 83 h += "<a href='" + this.currentImage.src + "' title='Direct link to file'><img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' /></a>"; 84 else 89 if ( this.currentImage.isImage ) { 90 h += "<a href='" + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>"; 91 h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 92 h += "</a>"; 93 } else 85 94 h += ' '; 86 95 h += "</div>"; … … 120 129 if ( this.postID ) 121 130 action += '&post_id=' + this.postID; 131 122 132 h += "<form id='upload-file' method='post' action='" + action + "'>"; 123 133 if ( this.ID ) { … … 130 140 } 131 141 h += "<div id='file-title'>" 132 if ( !this.currentImage. thumb)133 h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";142 if ( !this.currentImage.isImage ) 143 h += "<h2><a href='" + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>" + this.currentImage.title + "</a></h2>"; 134 144 else 135 145 h += "<h2>" + this.currentImage.title + "</h2>"; … … 139 149 h += '</div>' 140 150 h += "<div id='upload-file-view' class='alignleft'>"; 141 if ( this.currentImage.thumb ) 142 h += "<a href='" + this.currentImage.src + "' title='Direct link to file'><img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' /></a>"; 143 else 151 if ( this.currentImage.isImage ) { 152 h += "<a href='" + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>"; 153 h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 154 h += "</a>"; 155 } else 144 156 h += ' '; 145 157 h += "</div>"; 146 158 147 159 148 h += "<table><tr>" 149 h += "<th scope='row'><label for='post_title'>Title:</label></th>"; 160 h += "<table><col /><col class='widefat' /><tr>" 161 h += "<th scope='row'><label for='url'>URL</label></th>"; 162 h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.src + "' readonly='readonly' /></td>"; 163 h += "</tr><tr>"; 164 h += "<th scope='row'><label for='post_title'>Title</label></th>"; 150 165 h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>"; 151 166 h += "</tr><tr>"; 152 h += "<th scope='row'><label for='post_content'>Description :</label></th>";167 h += "<th scope='row'><label for='post_content'>Description</label></th>"; 153 168 h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>"; 154 h += "</tr><tr id='buttons' ><th><input type='button' name='delete' class='delete button' value='Delete' onclick='theFileList.deleteFile(" + id + ");' /></th><td>";169 h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='Delete File' onclick='theFileList.deleteFile(" + id + ");' />"; 155 170 h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />"; 156 171 h += "<input type='hidden' name='action' id='action-value' value='save' />"; 157 172 h += "<input type='hidden' name='ID' value='" + id + "' />"; 158 173 h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />"; 159 h += "<div class='submit'><input type='submit' value='Save »' /> ";160 h += "</ div></td></tr></table></form>";174 h += "<div class='submit'><input type='submit' value='Save »' /></div>"; 175 h += "</td></tr></table></form>"; 161 176 162 177 new Insertion.Top('upload-content', h); … … 203 218 if ( displayEl ) 204 219 display = displayEl.value; 220 else if ( this.currentImage.isImage ) 221 display = 'full'; 205 222 206 223 if ( 'none' != link ) 207 h += "<a href='" + ( 'file' == link ? this.currentImage.src : this.currentImage.page) + "' title='" + this.currentImage.title + "'>";224 h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment" ) ) + "' title='" + this.currentImage.title + "'>"; 208 225 if ( display ) 209 h += "<img src='" + ( 'thumb' == display ? this.currentImage.thumb : this.currentImage.src) + "' alt='" + this.currentImage.title + "' />";226 h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />"; 210 227 else 211 228 h += this.currentImage.title; … … 221 238 else 222 239 win.edInsertContent(win.edCanvas, h); 223 this.cancelView(); 240 if ( !this.ID ) 241 this.cancelView(); 224 242 return false; 225 243 }, -
trunk/wp-admin/upload.css
r4349 r4355 58 58 top: 0; 59 59 left: 0; 60 width: 45em;60 width: 95%; 61 61 height: 100%; 62 62 background: #f9fcfe; 63 63 } 64 #upload-file th { 64 65 #uupload-file th { 65 66 width: 8em; 66 67 } … … 68 69 form#upload-file input, form#upload-file textarea, div#upload-content.upload table { width: 100%; } 69 70 70 form#upload-file div.submit input { width: auto; }71 form#upload-file .submit input { width: auto; } 71 72 72 73 #upload-file-view { padding: 0 0 0 75px; } … … 135 136 #upload-files a.file-link img { vertical-align: middle; } 136 137 137 #the-attachment-links { float: right; }138 139 138 #the-attachment-links textarea { 140 139 font-size: 10px; … … 174 173 width: 300px; 175 174 } 175 176 input.readonly { background-color: #ddd; } -
trunk/wp-admin/wp-admin.css
r4352 r4355 207 207 padding: 0px; 208 208 margin-bottom: 16px; 209 height: 1 6em;209 height: 17em; 210 210 width: 100%; 211 211 /* overflow-y: hidden;*/
Note: See TracChangeset
for help on using the changeset viewer.