some cleaning, removed config.html for admin
[moodle.git] / blog / blog.js
CommitLineData
4a173181 1<!--//
2function del(baseurl, id, userid) {
3
4 if(confirm("Do you really want to delete that blog entry?")) {
5 document.location = baseurl+"/edit.php?act=del&postid="+id+"&userid="+userid;
6 }
7}
8
9function openPrev() {
10 //dh - added try{}catch{} statements to allow the function to continue along even
11 //if some of the elements it is expecting are not present in the original form
12
13 preview = window.open('', 'preview', 'width=640,height=480,scrollbars=yes,status=yes,resizable=yes');
14 document.prev.elements['format'].value = document.entry.format.selectedIndex;
15 document.prev.elements['etitle'].value = document.entry.elements['etitle'].value;
16// alert('title = '+document.entry.elements['etitle'].value);
17
18 if (window.frames.length > 0) {
19 // editor is loaded
20 document.prev.elements['body'].value = document.all ? frames[0].document.body.innerHTML : frames[1].document.body.innerHTML;
21 try {
22 document.prev.elements['extendedbody'].value = document.all ? frames[1].document.body.innerHTML : frames[0].document.body.innerHTML;
23 } catch(e) {
24 ; //ignore failure
25 }
26 } else {
27 // standard webforms
28 document.prev.elements['body'].value = document.entry.elements['body'].value;
29 try {
30 document.prev.elements['extendedbody'].value = document.entry.elements['extendedbody'].value;
31 } catch(e) {
32 ; //ignore failure
33 }
34 }
35
36 try {
37 var sourceSelect = document.entry.elements['categoryid[]'];
38 var targetSelect = document.prev.elements['categoryid[]'];
39
40 for (i=0; i < sourceSelect.length; i++) {
41 if (sourceSelect.options[i].selected == true) {
42 targetSelect.options[i].selected = true;
43 } else {
44 targetSelect.options[i].selected = false;
45 }
46 }
47 } catch(e) {
48 ; //ignore failure
49 }
50 document.prev.submit();
51}
52//-->