diff options
| author | wjames5 <will@tekimaki.com> | 2008-06-22 05:35:06 +0000 |
|---|---|---|
| committer | wjames5 <will@tekimaki.com> | 2008-06-22 05:35:06 +0000 |
| commit | 40ee8cdfd9c7c7fb9d6f47d425e290af7ede869b (patch) | |
| tree | 3fe18353f3f891be16ac16de52bb72d26c09a16d /scripts | |
| parent | bee5768d885107b3b920b5d23f9ea4b35ad469e0 (diff) | |
| download | liberty-40ee8cdfd9c7c7fb9d6f47d425e290af7ede869b.tar.gz liberty-40ee8cdfd9c7c7fb9d6f47d425e290af7ede869b.tar.bz2 liberty-40ee8cdfd9c7c7fb9d6f47d425e290af7ede869b.zip | |
submit title as some content requires it in verify, also a number of other minor bug fixes - ajax attachments now works again
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/LibertyAttachment.js | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/scripts/LibertyAttachment.js b/scripts/LibertyAttachment.js index b046022..c3219a4 100644 --- a/scripts/LibertyAttachment.js +++ b/scripts/LibertyAttachment.js @@ -6,18 +6,24 @@ LibertyAttachment = { if (LibertyAttachment.uploader_under_way) { alert(waitmsg); }else{ - LibertyAttachment.uploader_under_way = 1; - BitAjax.showSpinner(); - var old_target = file.form.target; - file.form.target = frmid; - var old_action = file.form.action; - // var action_item = document.getElementById(actionid); - // action_item.value = old_action; - file.form.action=action; - file.form.submit(); - file.form.target = old_target; - file.form.action = old_action; - // action_item.value = ''; + var t = document.forms.editpageform.title.value; + if ( MochiKit.Base.isEmpty(t) ){ + alert( "Please enter a title for your new content before attempting to upload a file." ); + }else{ + $('la_title').value = t; + LibertyAttachment.uploader_under_way = 1; + BitAjax.showSpinner(); + var old_target = file.form.target; + file.form.target = frmid; + var old_action = file.form.action; + // var action_item = document.getElementById(actionid); + // action_item.value = old_action; + file.form.action=action; + file.form.submit(); + file.form.target = old_target; + file.form.action = old_action; + // action_item.value = ''; + } } }, @@ -36,12 +42,15 @@ LibertyAttachment = { return; } - // - for( n=0; n<document.forms.length; n++ ){ - if ( typeof( document.forms[n].content_id != "undefined" ) ){ - document.forms[n].content_id.value = d.getElementById("new_content_id").value; - } + var form = document.forms.editpageform; + var cid = d.getElementById("upload_content_id").value; + if ( typeof( form.content_id ) == "undefined" ){ + var i = INPUT( {'name':'content_id', 'type':'hidden', 'value':cid}, null ); + form.insertBefore( i, form.firstChild ); + }else{ + form.content_id.value = cid; } + $('la_content_id').value = cid; var errMsg = "<div>Sorry, there was a problem retrieving results.</div>"; var divO = document.getElementById(divid); |
