[php-blog-cvs] r430 - in trunk: . deployment docs
A reliable, secure & extensible PHP blog | Not mainstream since 2002
Brought to you by:
garvinhicking,
jhermanns
From: Garvin H. at B. <gar...@ma...> - 2005-08-23 11:03:40
|
Author: garvinhicking Date: 2005-08-23 13:03:09 +0200 (Tue, 23 Aug 2005) New Revision: 430 Modified: trunk/deployment/serendipity_editor.js trunk/docs/NEWS trunk/serendipity_admin_image_selector.php trunk/serendipity_editor.js Log: MAke image manager remember settings and return content at cursor position Modified: trunk/deployment/serendipity_editor.js =================================================================== --- trunk/deployment/serendipity_editor.js 2005-08-23 09:52:32 UTC (rev 429) +++ trunk/deployment/serendipity_editor.js 2005-08-23 11:03:09 UTC (rev 430) @@ -143,7 +143,7 @@ function serendipity_imageSelector_addToBody (str, textarea) { - document.forms['serendipityEntry']['serendipity['+ textarea +']'].value += str; + wrapSelection(document.forms['serendipityEntry']['serendipity['+ textarea +']'], str, ''); document.forms['serendipityEntry']['serendipity['+ textarea +']'].focus(); } Modified: trunk/docs/NEWS =================================================================== --- trunk/docs/NEWS 2005-08-23 09:52:32 UTC (rev 429) +++ trunk/docs/NEWS 2005-08-23 11:03:09 UTC (rev 430) @@ -3,6 +3,10 @@ Version 0.9 () ------------------------------------------------------------------------ + * Make media insertion dialog remember settings (via Cookies) and + insert return of the media database on cursor position. + (garvinhicking) + * Admin comment panels shows comments with their content and escaped HTML instead of stripping all HTML. Only summary, if longer than 200 characters will have stripped HTML because of otherwise invalid markup. (garvinhicking) Modified: trunk/serendipity_admin_image_selector.php =================================================================== --- trunk/serendipity_admin_image_selector.php 2005-08-23 09:52:32 UTC (rev 429) +++ trunk/serendipity_admin_image_selector.php 2005-08-23 11:03:09 UTC (rev 430) @@ -22,6 +22,20 @@ $serendipity['GET']['step'] = (isset($serendipity['POST']['step']) ? $serendipity['POST']['step'] : ''); } +function ifRemember($name, $value, $isDefault = false, $att = 'checked') { + global $serendipity; + + if (!is_array($serendipity['COOKIE']) && !$isDefault) { + return false; + } + + if ((!is_array($serendipity['COOKIE']) && $isDefault) || + (!isset($serendipity['COOKIE']['serendipity_' . $name]) && $isDefault) || + (isset($serendipity['COOKIE']['serendipity_' . $name]) && $serendipity['COOKIE']['serendipity_' . $name] == $value)) { + + return " $att=\"$att\" "; + } +} ?> <html> <head> @@ -37,6 +51,23 @@ expire.setTime(today.getTime() + (60*60*24*30)); document.cookie = 'serendipity[' + name + ']='+escape(value) + ';expires=' + expire.toGMTString(); } + + function rememberOptions() { + el = document.getElementById('imageForm'); + for (i = 0; i < el.elements.length; i++) { + elname = new String(el.elements[i].name); + elname = elname.replace(/\[/g, '_'); + elname = elname.replace(/\]/g, ''); + + if (el.elements[i].type == 'radio') { + if (el.elements[i].checked) { + SetCookie(elname, el.elements[i].value); + } + } else if (typeof(el.elements[i].options) == 'object') { + SetCookie(elname, el.elements[i].options[el.elements[i].selectedIndex].value); + } + } + } </script> <body id="serendipityAdminBodyImageSelector"> @@ -123,7 +154,7 @@ <img align="right" src="<?php echo $imgsrc; ?>"> <h1><?php printf(YOU_CHOSE, $file['name']); ?></h1> <p> - <form action="#" method="GET" name="serendipity[selForm]" onSubmit="serendipity_imageSelector_done()"> + <form action="#" method="GET" id="imageForm" name="serendipity[selForm]" onsubmit="serendipity_imageSelector_done()"> <div> <?php serendipity_plugin_api::hook_event('frontend_image_selector_hiddenfields', $file); ?> <input type="hidden" name="imgThumbWidth" value="<?php echo $thumbWidth; ?>" /> @@ -142,24 +173,24 @@ <b><?php echo IMAGE_SIZE; ?>:</b> <br /> - <input id="radio_link_no" type="radio" name="serendipity[linkThumbnail]" value="no" checked="checked" /><label for="radio_link_no"><?php echo I_WANT_THUMB; ?></label><br /> - <input id="radio_link_yes" type="radio" name="serendipity[linkThumbnail]" value="yes" /><label for="radio_link_yes"><?php echo I_WANT_BIG_IMAGE; ?></label><br /> + <input id="radio_link_no" type="radio" name="serendipity[linkThumbnail]" value="no" <?php echo ifRemember('linkThumbnail', 'no', true); ?> /><label for="radio_link_no"><?php echo I_WANT_THUMB; ?></label><br /> + <input id="radio_link_yes" type="radio" name="serendipity[linkThumbnail]" value="yes" <?php echo ifRemember('linkThumbnail', 'yes'); ?> /><label for="radio_link_yes"><?php echo I_WANT_BIG_IMAGE; ?></label><br /> <?php serendipity_plugin_api::hook_event('frontend_image_selector_imagesize', $file); ?> <br /> <?php if (empty($serendipity['GET']['filename_only']) || $serendipity['GET']['filename_only'] != 'true') { ?> <b><?php echo IMAGE_ALIGNMENT; ?>:</b> <br /> - <input type="radio" name="serendipity[align]" value="" /> <img src="<?php echo serendipity_getTemplateFile('img/img_align_top.png') ?>" vspace="5" /><br /> - <input type="radio" name="serendipity[align]" value="left" checked="checked" /> <img src="<?php echo serendipity_getTemplateFile('img/img_align_left.png') ?>" vspace="5" /><br /> - <input type="radio" name="serendipity[align]" value="right" /> <img src="<?php echo serendipity_getTemplateFile('img/img_align_right.png') ?>" vspace="5" /><br /> + <input type="radio" name="serendipity[align]" <?php echo ifRemember('align', ''); ?> value="" /> <img src="<?php echo serendipity_getTemplateFile('img/img_align_top.png') ?>" vspace="5" /><br /> + <input type="radio" name="serendipity[align]" <?php echo ifRemember('align', 'left', true); ?> value="left" /> <img src="<?php echo serendipity_getTemplateFile('img/img_align_left.png') ?>" vspace="5" /><br /> + <input type="radio" name="serendipity[align]" <?php echo ifRemember('align', 'right'); ?> value="right" /> <img src="<?php echo serendipity_getTemplateFile('img/img_align_right.png') ?>" vspace="5" /><br /> <?php serendipity_plugin_api::hook_event('frontend_image_selector_imagealign', $file); ?> <br /> <b><?php echo IMAGE_AS_A_LINK; ?>:</b> <br /> - <input id="radio_islink_yes" type="radio" name="serendipity[isLink]" checked="checked" /><label for="radio_islink_yes"> <?php echo I_WANT_NO_LINK; ?></label><br /> - <input id="radio_islink_no" type="radio" name="serendipity[isLink]" /><label for="radio_islink_no"> <?php echo I_WANT_IT_TO_LINK; ?></label> + <input id="radio_islink_yes" type="radio" name="serendipity[isLink]" value="yes" <?php echo ifRemember('isLink', 'yes', true); ?> /><label for="radio_islink_yes"> <?php echo I_WANT_NO_LINK; ?></label><br /> + <input id="radio_islink_no" type="radio" name="serendipity[isLink]" value="no" <?php echo ifRemember('isLink', 'no'); ?> /><label for="radio_islink_no"> <?php echo I_WANT_IT_TO_LINK; ?></label> <?php if ($file['hotlink']) { ?> <input type="text" name="serendipity[url]" size="30" value="<?php echo $file['path']; ?>" /><br /> <?php } else { ?> @@ -178,7 +209,7 @@ <?php serendipity_plugin_api::hook_event('frontend_image_selector_more', $file); ?> <input type="button" value="<?php echo BACK; ?>" onclick="history.go(-1);" /> - <input type="button" value="<?php echo DONE; ?>" onclick="<?php echo $file['finishJSFunction']; ?>" /> + <input type="button" value="<?php echo DONE; ?>" onclick="rememberOptions(); <?php echo $file['finishJSFunction']; ?>" /> <?php serendipity_plugin_api::hook_event('frontend_image_selector_submit', $file); ?> </div> </form> @@ -244,4 +275,3 @@ <?php /* vim: set sts=4 ts=4 expandtab : */ -?> Modified: trunk/serendipity_editor.js =================================================================== --- trunk/serendipity_editor.js 2005-08-23 09:52:32 UTC (rev 429) +++ trunk/serendipity_editor.js 2005-08-23 11:03:09 UTC (rev 430) @@ -144,7 +144,7 @@ function serendipity_imageSelector_addToBody (str, textarea) { - document.forms['serendipityEntry']['serendipity['+ textarea +']'].value += str; + wrapSelection(document.forms['serendipityEntry']['serendipity['+ textarea +']'], str, ''); document.forms['serendipityEntry']['serendipity['+ textarea +']'].focus(); } @@ -219,6 +219,7 @@ if (self.opener.editorref) { self.opener.editorref.surroundHTML(block, ''); } else { + self.opener.serendipity_imageSelector_addToBody(block, textarea); } |