noscript support for uploading. fixes #2078

git-svn-id: http://svn.automattic.com/wordpress/trunk@3307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-12-14 08:29:43 +00:00
parent 47889e8cea
commit 0df81fe574
3 changed files with 51 additions and 20 deletions

View File

@ -1847,15 +1847,15 @@ function the_attachment_links($id = false) {
$icon = get_attachment_icon($post->ID); $icon = get_attachment_icon($post->ID);
?> ?>
<?php _e('Text linked to file') ?><br/> <p><?php _e('Text linked to file') ?><br />
<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> <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></p>
<?php _e('Text linked to subpost') ?><br/> <p><?php _e('Text linked to subpost') ?><br />
<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> <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></p>
<?php if ( $icon ) : ?> <?php if ( $icon ) : ?>
<?php _e('Thumbnail linked to file') ?><br/> <p><?php _e('Thumbnail linked to file') ?><br />
<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><img src="<?php echo $thumb ?>" class="attachmentthumb" alt="<?php echo $post->post_title ?>" /></a></textarea> <textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo $icon ?></a></textarea></p>
<?php _e('Thumbnail linked to subpost') ?><br/> <p><?php _e('Thumbnail linked to subpost') ?><br />
<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" class="attachmentlink"><img src="<?php echo $icon ?>" class="attachmentthumb" alt="<?php echo $post->post_title ?>" /></a></textarea> <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></p>
<?php endif; ?> <?php endif; ?>
<?php <?php
} }

View File

@ -26,6 +26,10 @@ $post = (int) $post;
$images_width = 1; $images_width = 1;
switch($action) { switch($action) {
case 'links':
// Do not pass GO.
break;
case 'delete': case 'delete':
if ( !current_user_can('edit_post', (int) $attachment) ) if ( !current_user_can('edit_post', (int) $attachment) )
@ -200,6 +204,10 @@ var icon = new Array();
add_post_meta($ID, '_wp_attachment_metadata', $meta); add_post_meta($ID, '_wp_attachment_metadata', $meta);
} }
$attachment = array_merge($attachment, $meta); $attachment = array_merge($attachment, $meta);
$noscript = "<noscript>
<div class='caption'><a href=\"".basename(__FILE__)."?action=links&amp;attachment={$ID}&amp;post={$post}&amp;all={$all}&amp;start={$start}\">Choose Links</a></div>
</noscript>
";
$send_delete_cancel = "<a onclick=\"sendToEditor({$ID});return false;\" href=\"javascript:void()\">$__send_to_editor</a> $send_delete_cancel = "<a onclick=\"sendToEditor({$ID});return false;\" href=\"javascript:void()\">$__send_to_editor</a>
<a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&amp;attachment={$ID}&amp;all=$all&amp;start=$start&amp;post=$post\">$__delete</a> <a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&amp;attachment={$ID}&amp;all=$all&amp;start=$start&amp;post=$post\">$__delete</a>
<a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a> <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
@ -233,6 +241,7 @@ imgb[{$ID}] = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$image['po
<div id='div{$ID}' class='imagewrap' onclick=\"doPopup({$ID});\"> <div id='div{$ID}' class='imagewrap' onclick=\"doPopup({$ID});\">
<img id=\"image{$ID}\" src=\"$src\" alt=\"{$image['post_title']}\" $height_width /> <img id=\"image{$ID}\" src=\"$src\" alt=\"{$image['post_title']}\" $height_width />
</div> </div>
{$noscript}
</div> </div>
"; ";
$popups .= "<div id='popup{$ID}' class='popup'> $popups .= "<div id='popup{$ID}' class='popup'>
@ -256,6 +265,7 @@ icon[{$ID}] = '{$icon}';
<div id='div{$ID}' class='otherwrap usingtext' onmousedown=\"selectLink({$ID})\" onclick=\"doPopup({$ID});return false;\"> <div id='div{$ID}' class='otherwrap usingtext' onmousedown=\"selectLink({$ID})\" onclick=\"doPopup({$ID});return false;\">
<a id=\"{$ID}\" href=\"{$attachment['guid']}\" onmousedown=\"selectLink({$ID});\" onclick=\"return false;\">{$attachment['post_title']}</a> <a id=\"{$ID}\" href=\"{$attachment['guid']}\" onmousedown=\"selectLink({$ID});\" onclick=\"return false;\">{$attachment['post_title']}</a>
</div> </div>
{$noscript}
</div> </div>
"; ";
$popups .= "<div id='popup{$ID}' class='popup'> $popups .= "<div id='popup{$ID}' class='popup'>
@ -398,6 +408,11 @@ function sendToEditor(n) {
} }
</script> </script>
<style type="text/css"> <style type="text/css">
<?php if ( $action == 'links' ) : ?>
* html { overflow-x: hidden; }
<?php else : ?>
* html { overflow-y: hidden; }
<?php endif; ?>
body { body {
font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana; font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;
border: none; border: none;
@ -418,8 +433,6 @@ form {
clear: both; clear: both;
margin: 0px; margin: 0px;
padding: 15px 15px; padding: 15px 15px;
height: 96px;
/* white-space: nowrap;*/
width: <?php echo $images_width; ?>px; width: <?php echo $images_width; ?>px;
} }
#images img { #images img {
@ -427,22 +440,19 @@ form {
} }
<?php echo $style; ?> <?php echo $style; ?>
.attwrap, .attwrap * { .attwrap, .attwrap * {
overflow: none;
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
border: 0px; border: 0px;
} }
.imagewrap { .imagewrap {
margin-right: 5px; margin-right: 5px;
height: 96px;
overflow: hidden; overflow: hidden;
float: left; width: 128px;
} }
.otherwrap { .otherwrap {
margin-right: 5px; margin-right: 5px;
/* overflow: hidden;*/ overflow: hidden;
background-color: #f9fcfe; background-color: #f9fcfe;
float: left;
} }
.otherwrap a { .otherwrap a {
display: block; display: block;
@ -454,17 +464,17 @@ form {
padding: 0px; padding: 0px;
height: 96px; height: 96px;
text-align: center; text-align: center;
width: 128px;
} }
.usingicon a { .usingicon a {
width: 128px;
} }
.usingtext { .usingtext {
padding: 3px; padding: 3px;
height: 90px; height: 90px;
text-align: left; text-align: left;
width: 122px;
} }
.usingtext a { .usingtext a {
width: 122px;
} }
.filetype { .filetype {
font-size: 80%; font-size: 80%;
@ -547,7 +557,6 @@ th {
padding: 1px; padding: 1px;
position: absolute; position: absolute;
width: 114px; width: 114px;
/* height: 92px;*/
display: none; display: none;
background-color: rgb(240, 240, 238); background-color: rgb(240, 240, 238);
border-top: 2px solid #fff; border-top: 2px solid #fff;
@ -574,6 +583,9 @@ th {
background-color: #fff; background-color: #fff;
color: #000; color: #000;
} }
.caption {
text-align: center;
}
#submit { #submit {
margin: 1px; margin: 1px;
width: 99%; width: 99%;
@ -593,6 +605,21 @@ th {
border-left-color: #999; border-left-color: #999;
border-top-color: #999; border-top-color: #999;
} }
.zerosize {
width: 0px;
height: 0px;
overflow: hidden;
position: absolute;
}
#links {
margin: 3px 8px;
line-height: 2em;
}
#links textarea {
width: 95%;
height: 4.5em;
}
</style> </style>
</head> </head>
<body> <body>
@ -605,7 +632,7 @@ th {
<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> <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>
<?php } ?> <?php } ?>
<li> </li> <li> </li>
<?php if ( $action != 'upload' ) { ?> <?php if ( $action == 'view' ) { ?>
<?php if ( false !== $back ) : ?> <?php if ( false !== $back ) : ?>
<li class="spacer"><a href="<?php echo basename(__FILE__); ?>?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=0" title="<?php _e('First'); ?>">|&laquo;</a></li> <li class="spacer"><a href="<?php echo basename(__FILE__); ?>?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=0" title="<?php _e('First'); ?>">|&laquo;</a></li>
<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> <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>
@ -664,6 +691,10 @@ th {
</table> </table>
</div> </div>
</form> </form>
<?php elseif ( $action == 'links' ) : ?>
<div id="links">
<?php the_attachment_links($attachment); ?>
</div>
<?php endif; ?> <?php endif; ?>
</body> </body>
</html> </html>

View File

@ -160,7 +160,7 @@ textarea, input, select {
margin-bottom: 16px; margin-bottom: 16px;
height: 15em; height: 15em;
width: 100%; width: 100%;
overflow-y: hidden; /* overflow-y: hidden;*/
} }
form#upload th { form#upload th {