edit-form.php now included in bookmarklet.php, added #postdiv selector

git-svn-id: http://svn.automattic.com/wordpress/trunk@694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
michelvaldrighi 2004-01-03 00:13:11 +00:00
parent c78da3f9ac
commit e6075fcd0e
5 changed files with 81 additions and 198 deletions

View File

@ -3,10 +3,6 @@
// accepts 'post_title' and 'content' as vars passed in. Add-on from Alex King
function selected($selected, $current) {
if ($selected == $current) echo ' selected="selected"';
}
$mode = 'bookmarklet';
$standalone = 1;
@ -30,11 +26,48 @@ window.close()
} else {
$popuptitle = stripslashes($popuptitle);
$text = stripslashes($text);
/* big funky fixes for browsers' javascript bugs */
if (($is_macIE) && (!isset($IEMac_bookmarklet_fix))) {
$popuptitle = preg_replace($wp_macIE_correction["in"],$wp_macIE_correction["out"],$popuptitle);
$text = preg_replace($wp_macIE_correction["in"],$wp_macIE_correction["out"],$text);
}
if (($is_winIE) && (!isset($IEWin_bookmarklet_fix))) {
$popuptitle = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $popuptitle);
$text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text);
}
if (($is_gecko) && (!isset($Gecko_bookmarklet_fix))) {
$popuptitle = preg_replace($wp_gecko_correction["in"],$wp_gecko_correction["out"],$popuptitle);
$text = preg_replace($wp_gecko_correction["in"],$wp_gecko_correction["out"],$text);
}
$post_title = $_REQUEST['post_title'];
if (!empty($post_title)) {
$post_title = stripslashes($post_title);
} else {
$post_title = $popuptitle;
}
$content = $_REQUEST['content'];
if (!empty($content)) {
$content = stripslashes($content);
} else {
$content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
}
/* /big funky fixes */
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WordPress > Bookmarklet</title>
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $admin_area_charset ?>" />
<script type="text/javascript" language="javascript">
<!--
function launchupload() {
@ -45,14 +78,8 @@ function launchupload() {
</script>
<style type="text/css">
<!--
body {
}
textarea,input,select {
background-color: transparent;
background-color: #cccccc;
filter: alpha(opacity:80);
-moz-opacity: .8;
#wpbookmarklet textarea,input,select {
border-width: 1px;
border-color: #cccccc;
border-style: solid;
@ -60,196 +87,37 @@ textarea,input,select {
margin: 1px;
}
.checkbox {
#wpbookmarklet .checkbox {
background-color: #ffffff;
border-width: 0px;
padding: 0px;
margin: 0px;
}
textarea {
#wpbookmarklet textarea {
font-family: Verdana, Geneva, Arial, Helvetica;
font-size: 0.9em;
}
#wpbookmarklet .wrap {
border: 0px;
}
#wpbookmarklet #postdiv {
margin-bottom: 0.5em;
}
#wpbookmarklet #titlediv {
margin-bottom: 1em;
}
-->
</style>
</head>
<body>
<form name="post" action="post.php" method="POST">
<input type="hidden" name="action" value="post" />
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="mode" value="bookmarklet" />
<body id="wpbookmarklet">
<h1 id="wphead"><a href="http://wordpress.org" rel="external">WordPress</a></h1>
<div align="right">
<?php
$popuptitle = stripslashes($popuptitle);
$text = stripslashes($text);
/* big funky fixes for browsers' javascript bugs */
if (($is_macIE) && (!isset($IEMac_bookmarklet_fix))) {
$popuptitle = preg_replace($wp_macIE_correction["in"],$wp_macIE_correction["out"],$popuptitle);
$text = preg_replace($wp_macIE_correction["in"],$wp_macIE_correction["out"],$text);
}
if (($is_winIE) && (!isset($IEWin_bookmarklet_fix))) {
$popuptitle = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $popuptitle);
$text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text);
}
if (($is_gecko) && (!isset($Gecko_bookmarklet_fix))) {
$popuptitle = preg_replace($wp_gecko_correction["in"],$wp_gecko_correction["out"],$popuptitle);
$text = preg_replace($wp_gecko_correction["in"],$wp_gecko_correction["out"],$text);
}
$post_title = $_REQUEST['post_title'];
if (!empty($post_title)) {
$post_title = stripslashes($post_title);
} else {
$post_title = $popuptitle;
}
$content = $_REQUEST['content'];
if (!empty($content)) {
$content = stripslashes($content);
} else {
$content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
}
/* /big funky fixes */
?>
<table width="100%" cellpadding="8" cellspacing="0" width="415">
<tr>
<td width="40">&nbsp;</td>
<td align="left" width="415">
<table cellspacing="0" cellpadding="0">
<td height="50" width="250" align="left" valign="bottom"><label>Title<br />
<input type="text" name="post_title" size="20" tabindex="1" style="width: 215px;" value="<?php echo $post_title; ?>" /></label></td>
<td width="165" align="left" valign="bottom"><b>Category</b><br /><?php dropdown_categories(); ?></td>
</table>
</td>
</tr>
<tr height="40">
<td width="40">&nbsp;</td>
<td align="left" width="415">
<table cellspacing="0" cellpadding="0">
<td height="50" width="150" align="left" valign="bottom">
<label for="post_status">Post Status:</label>&nbsp;<br />
<select name="post_status" id="post_status">
<option value="publish"<?php selected($post_status, 'publish'); ?>>Publish</option>
<option value="draft"<?php selected($post_status, 'draft'); ?>>Draft</option>
<option value="private"<?php selected($post_status, 'private'); ?>>Private</option>
</select>
</td>
<td height="50" width="250" align="left" valign="bottom">
<label for="comment_status">Comments:</label>&nbsp;<br />
<select name="comment_status" id="comment_status">
<option value="open"<?php selected($comment_status, 'open'); ?>>Open</option>
<option value="closed"<?php selected($comment_status, 'closed'); ?>>Closed</option>
</select>
</td>
</table>
</td>
</tr>
<tr height="40">
<td width="40">&nbsp;</td>
<td align="left" width="415">
<table cellspacing="0" cellpadding="0">
<td height="50" width="100" align="left" valign="bottom">
<label for="ping_status">Pings:</label><br />
<select name="ping_status" id="ping_status">
<option value="open"<?php selected($ping_status, 'open'); ?>>Open</option>
<option value="closed"<?php selected($ping_status, 'open'); ?>>Closed</option>
</select>
</td>
<td height="50" width="250" align="left" valign="bottom">
<label for="post_password">Post Password:</label><br />
<input name="post_password" type="text" id="post_password" value="<?php echo $post_password ?>" />
</td>
</table>
</td>
</tr>
<tr height="40">
<td width="40">&nbsp;</td>
<td width="415" align="left" height="40">
<table width="415" cellpadding="0" cellspacing="0">
<td align="left" valign="bottom"><b>Post</b></td>
<td align="right" valign="bottom"><?php if ($use_quicktags) include("quicktags.php"); ?></td>
</table>
<?php
if ((preg_match("/Nav/",$HTTP_USER_AGENT)) || (preg_match("/Mozilla\/4\.7/",$HTTP_USER_AGENT))) {
$rows="6";
} else {
$rows="8";
} ?>
<?php
// stuff to fix textism.com's WEIRD characters conflict with javascript on IE5Mac
preg_match("/\%u[1-9A-F][1-9A-F][1-9A-F][1-9A-F]/is", $text, $stufftofix);
// ... and so on. currently coding the fix
?>
<textarea rows="<?php echo $rows ?>" cols="48" style="width:415px;" name="content" id="content" tabindex="2" class="postform"><?php echo $content ?></textarea><br />
<?php
if ($use_quicktags) {
?>
<script language="JavaScript">
<!--
edCanvas = document.getElementById('content');
//-->
</script>
<?php
}
?>
<table cellpadding="0" cellspacing="0">
<td align="left" width="90"></td>
<?php if ($pingback) { ?>
<td align="left">
<input type="checkbox" class="checkbox" name="post_pingback" value="1" checked="checked" tabindex="7" id="pingback" /><label for="pingback"> PingBack</label>
</td>
<?php } ?>
</table>
<?php if (0 /*$use_preview*/) { ?>
<input type="button" value="preview" onClick="preview(this.form);" class="search" tabindex="8" />
<?php } ?>
<input type="submit" name="submit" value="Blog this !" class="search" tabindex="3" />
<?php if ( ($use_fileupload) && ($user_level >= $fileupload_minlevel) && ((ereg(" ".$user_login." ", $fileupload_allowedusers)) || (trim($fileupload_allowedusers)=="")) ) { ?>
<input type="button" value="upload a file" onClick="launchupload();" class="search" />
<?php } ?>
<script language="JavaScript" type="text/javascript">
<!--
window.focus();
//document.blog.post_content.focus();
//-->
</script>
</td>
</tr>
<?php if ($trackback) { ?>
<tr>
<td width="40">&nbsp;</td>
<td width="415" align="left" height="40">
<label for="trackback"><strong>TrackBack</strong> an <acronym title="Uniform Resource Locator">URL</acronym>:</label> (Separate multiple URLs with commas.)<br />
<input type="text" name="trackback" style="width: 415px" />
</td>
</tr>
<?php } ?>
</table>
</div>
</form>
</div>
<?php require('edit-form.php'); ?>
</body>
</html><?php

View File

@ -92,7 +92,7 @@ window.onload = focusit;
<div><textarea rows="2" cols="40" name="excerpt" tabindex="4" id="excerpt"><?php echo $excerpt ?></textarea></div>
</fieldset>
<fieldset>
<fieldset id="postdiv">
<legend><a href="http://wordpress.org/docs/reference/post/#post" title="Help with post field">Post</a></legend>
<div id="quicktags">
<?php

View File

@ -25,7 +25,7 @@ if ($use_pingback) {
}
if ($use_trackback) {
$form_trackback = '<p><label for="trackback"><a href="http://wordpress.org/docs/reference/post/#trackback" title="Help on trackbacks"><strong>TrackBack</strong> an <acronym title="Uniform Resource Locator">URL</acronym></a>:</label> (Separate multiple <acronym title="Uniform Resource Locator">URL</acronym>s with spaces.)<br />
<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" /></p>';
<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>';
if ('' != $pinged) {
$form_trackback .= '<p>Already pinged:</p><ul>';
$already_pinged = explode("\n", trim($pinged));
@ -44,6 +44,12 @@ $saveasdraft = '';
?>
<form name="post" action="post.php" method="post" id="post">
<?php
if ('bookmarklet' == $mode) {
echo '<input type="hidden" name="mode" value="bookmarklet" />';
}
?>
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
@ -73,11 +79,11 @@ window.onload = focusit;
</fieldset>
<br />
<fieldset style="clear:both">
<fieldset id="postdiv">
<legend><a href="http://wordpress.org/docs/reference/post/#post" title="Help with post field">Post</a></legend>
<div id="quicktags">
<?php
if ($use_quicktags) {
if ($use_quicktags && 'bookmarklet' != $mode) {
echo '<a href="http://wordpress.org/docs/reference/post/#quicktags" title="Help with quicktags">Quicktags</a>: ';
include('quicktags.php');
}
@ -108,7 +114,9 @@ edCanvas = document.getElementById('content');
<p><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" />
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="Save as Private" />
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" />
<input name="advanced" type="submit" id="advancededit" tabindex="7" value="Advanced Editing &raquo;" />
<?php if ('bookmarklet' != $mode) {
echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="Advanced Editing &raquo;" />';
} ?>
<input name="referredby" type="hidden" id="referredby" value="<?php echo $HTTP_SERVER_VARS['HTTP_REFERER']; ?>" />
</p>

View File

@ -677,15 +677,18 @@ switch($action) {
<h3>WordPress bookmarklet</h3>
<p>You can drag the following link to your links bar or add it to your bookmarks and when you "Press it" it will open up a popup window with information and a link to the site you're currently browsing so you can make a quick post about it. Try it out:</p>
<p>
<?php
<?php
$bookmarklet_height= ($use_trackback) ? 460 : 420;
if ($is_NS4 || $is_gecko) {
?>
<a href="javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('<?php echo $siteurl ?>/wp-admin/bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'WordPress bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));">Press It
<a href="javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('<?php echo $siteurl ?>/wp-admin/bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'WordPress bookmarklet','scrollbars=no,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));">Press It
- <?php echo $blogname ?></a>
<?php
} else if ($is_winIE) {
?>
<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo $siteurl ?>/wp-admin/bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();">Press it
<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo $siteurl ?>/wp-admin/bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'bookmarklet','scrollbars=no,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();">Press it
- <?php echo $blogname ?></a>
<script type="text/javascript" language="JavaScript">
<!--
@ -701,12 +704,12 @@ function oneclickbookmarklet(blah) {
<?php
} else if ($is_opera) {
?>
<a href="javascript:void(window.open('<?php echo $siteurl ?>/wp-admin/bookmarklet.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));">Press it
<a href="javascript:void(window.open('<?php echo $siteurl ?>/wp-admin/bookmarklet.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=no,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));">Press it
- <?php echo $blogname ?></a>
<?php
} else if ($is_macIE) {
?>
<a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo $siteurl ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();">Press it
<a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo $siteurl ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=no,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();">Press it
- <?php echo $blogname ?></a>
<?php
}

View File

@ -263,6 +263,10 @@ textarea, input, select {
clear: both;
}
#postdiv {
clear: both;
}
#poststatusdiv, #commentstatusdiv, #pingstatusdiv {
width: 6.5em;
}