Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31055
Modified Files:
NEWS serendipity_editor.js serendipity_functions.inc.php
Log Message:
fixed internet explorer bugs with restored multiple categories and link
insertion
Index: serendipity_editor.js
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_editor.js,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- serendipity_editor.js 12 May 2004 14:35:20 -0000 1.11
+++ serendipity_editor.js 14 Jul 2004 10:21:05 -0000 1.12
@@ -17,16 +17,22 @@
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
+
if (selEnd==1 || selEnd==2) {
selEnd=selLength;
}
return (txtarea.value).substring(selStart, selEnd);
}
+function getIESelection(txtarea) {
+ return document.selection.createRange().text;
+}
+
function mozWrap(txtarea, lft, rgt) {
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
+
if (selEnd==1 || selEnd==2) selEnd=selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
@@ -34,16 +40,18 @@
txtarea.value = s1 + lft + s2 + rgt + s3;
}
-function IEWrap(lft, rgt) {
+function IEWrap(txtarea, lft, rgt) {
strSelection = document.selection.createRange().text;
if (strSelection != "") {
document.selection.createRange().text = lft + strSelection + rgt;
+ } else {
+ txtarea.value = txtarea.value + lft + rgt;
}
}
function wrapSelection(txtarea, lft, rgt) {
if (document.all) {
- IEWrap(lft, rgt);
+ IEWrap(txtarea, lft, rgt);
} else if (document.getElementById) {
mozWrap(txtarea, lft, rgt);
}
@@ -52,14 +60,15 @@
function wrapSelectionWithLink(txtarea) {
var my_link = prompt("Enter URL:","http://");
- if (getMozSelection(txtarea) == "") {
- var my_desc = prompt("Enter Description");
+ if (document.all && getIESelection(txtarea) == "" ||
+ document.getElementById && getMozSelection(txtarea) == "") {
+ var my_desc = prompt("Enter Description", '');
}
if (my_link != null) {
lft = "<a href=\"" + my_link + "\">";
if (my_desc != null && my_desc != "") {
- rgt = my_desc +"</a>";
+ rgt = my_desc + "</a>";
} else {
rgt = "</a>";
}
@@ -110,7 +119,7 @@
}
function serendipity_insLink (area) {
- var loc = prompt('Enter Location: ');
+ var loc = prompt('Enter URL Location: ');
var text = prompt('Enter Description: ');
if (!loc) {
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.329
retrieving revision 1.330
diff -u -d -r1.329 -r1.330
--- serendipity_functions.inc.php 14 Jul 2004 08:11:21 -0000 1.329
+++ serendipity_functions.inc.php 14 Jul 2004 10:21:05 -0000 1.330
@@ -2572,6 +2572,7 @@
$draftD = '';
$draftP = '';
+ $categoryselector_expanded = false;
if (isset($entry['isdraft']) && $entry['isdraft'] == 'true') {
$draftD = ' selected="selected"';
@@ -2589,13 +2590,24 @@
}
$n = "\n";
- $cat_list = '<select id="categoryselector" name="serendipity[categories][]" style="vertical-align: middle;" multiple="multple">' . $n;
+ $cat_list = '<select id="categoryselector" name="serendipity[categories][]" style="vertical-align: middle;" multiple="multiple">' . $n;
$cat_list .= ' <option value="0">[' . NO_CATEGORY . ']</option>' . $n;
$selected = array();
if (is_array($entry['categories'])) {
- foreach ($entry['categories'] as $cat)
+ if (count($entry['categories']) > 1) {
+ $categoryselector_expanded = true;
+ }
+
+ foreach ($entry['categories'] as $cat) {
$selected[] = $cat['categoryid'];
+ }
}
+
+ if (count($selected) > 1 ||
+ (isset($serendipity['POST']['categories']) && is_array($serendipity['POST']['categories']) && sizeof($serendipity['POST']['categories']) > 1)) {
+ $categoryselector_expanded = true;
+ }
+
if (is_array($cats = serendipity_fetchCategories())) {
$cat_list .= serendipity_generateCategoryList($cats, ($selected == array() ? array(0) : $selected), 1);
}
@@ -2727,7 +2739,7 @@
}
}
- selector_toggle['categoryselector'] = '<?php echo ((isset($serendipity['POST']['categories']) && is_array($serendipity['POST']['categories']) && sizeof($serendipity['POST']['categories']) > 1) ? 'on' : 'off'); ?>';
+ selector_toggle['categoryselector'] = '<?php echo ($categoryselector_expanded ? 'on' : 'off'); ?>';
showItem('categoryselector');
</script>
</td>
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -d -r1.171 -r1.172
--- NEWS 13 Jul 2004 16:25:26 -0000 1.171
+++ NEWS 14 Jul 2004 10:21:05 -0000 1.172
@@ -3,7 +3,13 @@
Version 0.7 ()
------------------------------------------------------------------------
- * Added Bitflux Livesearch Javascript as plugin
+ * Fixed link insertion in non-WYSIWYG-mode for Internet Explorer
+ (garvinhicking)
+
+ * Fixed retrieving multiple stored categories for InternetExplorer
+ when editing existing entry (garvinhicking)
+
+ * Added Bitflux Livesearch Javascript as plugin
(serendipity_event_livesearch). It will immediately search your
articlebase and offer an autocomplete dropdown to the quicksearch
box. (chregu, garvinhicking)
|