--- a/includes/clientside/static/editor.js Wed May 07 14:06:16 2008 -0400
+++ b/includes/clientside/static/editor.js Sun May 11 16:58:58 2008 -0400
@@ -71,7 +71,8 @@
tinymce_initted = true;
}
}
-}
+};
+
// Safari doesn't fire the init on demand so call it on page load
if ( is_Safari )
{
@@ -587,11 +588,11 @@
}
}
-function ajaxEditorSave(is_draft)
+function ajaxEditorSave(is_draft, text_override)
{
if ( !is_draft )
ajaxSetEditorLoading();
- var ta_content = $dynano('ajaxEditArea').getContent();
+ var ta_content = ( text_override ) ? text_override : $dynano('ajaxEditArea').getContent();
if ( !is_draft && ( ta_content == '' || ta_content == '<p></p>' || ta_content == '<p> </p>' ) )
{
@@ -701,13 +702,27 @@
document.getElementById('ajaxEditArea').needReset = true;
var img = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('img')[0];
var lbl = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('span')[0];
- img.src = scriptPath + '/images/mini-info.png';
- var d = new Date();
- var m = String(d.getMinutes());
- if ( m.length < 2 )
- m = '0' + m;
- var time = d.getHours() + ':' + m;
- lbl.innerHTML = $lang.get('editor_msg_draft_saved', { time: time });
+ if ( response.is_draft == 'delete' )
+ {
+ img.src = scriptPath + '/images/editor/savedraft.gif';
+ lbl.innerHTML = $lang.get('editor_btn_savedraft');
+
+ var dn = $dynano('ajax_edit_draft_notice').object;
+ if ( dn )
+ {
+ dn.parentNode.removeChild(dn);
+ }
+ }
+ else
+ {
+ img.src = scriptPath + '/images/mini-info.png';
+ var d = new Date();
+ var m = String(d.getMinutes());
+ if ( m.length < 2 )
+ m = '0' + m;
+ var time = d.getHours() + ':' + m;
+ lbl.innerHTML = $lang.get('editor_msg_draft_saved', { time: time });
+ }
}
else
{
@@ -736,6 +751,39 @@
}, true);
}
+// Delete the draft (this is a massive server-side hack)
+function ajaxEditorDeleteDraft()
+{
+ miniPromptMessage({
+ title: $lang.get('editor_msg_confirm_delete_draft_title'),
+ message: $lang.get('editor_msg_confirm_delete_draft_body'),
+ buttons: [
+ {
+ text: $lang.get('editor_btn_delete_draft'),
+ color: 'red',
+ style: {
+ fontWeight: 'bold'
+ },
+ onclick: function() {
+ ajaxEditorDeleteDraftReal();
+ miniPromptDestroy(this);
+ }
+ },
+ {
+ text: $lang.get('etc_cancel'),
+ onclick: function() {
+ miniPromptDestroy(this);
+ }
+ }
+ ]
+ });
+}
+
+function ajaxEditorDeleteDraftReal()
+{
+ return ajaxEditorSave(true, -1);
+}
+
function ajaxEditorGenPreview()
{
ajaxSetEditorLoading();