| 1 | function checkAll(form) { |
|---|
| 2 | for (var i=0;i<form.elements.length;i++) { |
|---|
| 3 | var e = form.elements[i]; |
|---|
| 4 | if ( (e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled) && (e.name.substr(0,14) != 'allow_comments')) { |
|---|
| 5 | e.checked = form.allbox.checked; |
|---|
| 6 | } |
|---|
| 7 | } |
|---|
| 8 | } |
|---|
| 9 | |
|---|
| 10 | function checkToggle(form) { |
|---|
| 11 | for (var i=0;i<form.elements.length;i++) { |
|---|
| 12 | var e = form.elements[i]; |
|---|
| 13 | if ( (e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled) && (e.name.substr(0,14) != 'allow_comments')) { |
|---|
| 14 | if (e.checked == true) { |
|---|
| 15 | e.checked = false; |
|---|
| 16 | } else { |
|---|
| 17 | e.checked = true; |
|---|
| 18 | } |
|---|
| 19 | } |
|---|
| 20 | } |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | function ThumbPreviewPopup(page) { |
|---|
| 24 | var winl = (screen.width-400)/2; |
|---|
| 25 | var wint = (screen.height-400)/2; |
|---|
| 26 | var settings ='height='+'400'+','; |
|---|
| 27 | settings +='width='+'410'+','; |
|---|
| 28 | settings +='top='+wint+','; |
|---|
| 29 | settings +='left='+winl+','; |
|---|
| 30 | settings +='scrollbars=no,'; |
|---|
| 31 | settings +='location=no,'; |
|---|
| 32 | settings +='menubar=no,'; |
|---|
| 33 | settings +='toolbar=no,'; |
|---|
| 34 | settings +='resizable=yes'; |
|---|
| 35 | OpenWin = this.open(page, "Preview", settings); |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | function focus_first_input() { |
|---|
| 39 | fields = document.getElementsByTagName('input'); |
|---|
| 40 | if (fields.length > 0) { |
|---|
| 41 | fields[0].focus(); |
|---|
| 42 | } |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | function updateThumbPreview(selectObj) { |
|---|
| 46 | var thumb = selectObj.options[selectObj.selectedIndex].style.backgroundImage; |
|---|
| 47 | selectObj.style.backgroundImage = thumb; |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | var importThumbCounter = 0; |
|---|
| 51 | |
|---|
| 52 | function onImportThumbComplete(request) { |
|---|
| 53 | var picDic = 'pic_' + importThumbs[importThumbCounter]; |
|---|
| 54 | Element.update(picDic,request.responseText); |
|---|
| 55 | var progress = (importThumbCounter + 1)/ importThumbs.length * 100; |
|---|
| 56 | Element.update('progress',Math.round(progress) + '%'); |
|---|
| 57 | if (importThumbCounter < importThumbs.length) { |
|---|
| 58 | importThumbCounter++; |
|---|
| 59 | requestImportThumb(); |
|---|
| 60 | } |
|---|
| 61 | }; |
|---|
| 62 | |
|---|
| 63 | function requestImportThumb() { |
|---|
| 64 | new Ajax.Request('plog-thumb.php', {method: 'get', onComplete: onImportThumbComplete, parameters: 'img=' + importThumbs[importThumbCounter]}); |
|---|
| 65 | }; |
|---|
| 66 | |
|---|
| 67 | function checkArchive(fileInput) { |
|---|
| 68 | |
|---|
| 69 | // check the extension of the chosen file, if it is a zip file |
|---|
| 70 | // we want to disable the caption and description fields because |
|---|
| 71 | // these are going to be set on the import page. |
|---|
| 72 | |
|---|
| 73 | var filePath = fileInput.value; |
|---|
| 74 | var fileParts = new Array(); |
|---|
| 75 | |
|---|
| 76 | fileParts = filePath.split('.'); |
|---|
| 77 | var fileExtension = fileParts[fileParts.length-1]; |
|---|
| 78 | |
|---|
| 79 | if (fileExtension.toLowerCase() == 'zip') { |
|---|
| 80 | document.getElementById('caption').disabled = true; |
|---|
| 81 | document.getElementById('description').disabled = true; |
|---|
| 82 | document.getElementById('caption').style.background = "#fafafa"; |
|---|
| 83 | document.getElementById('description').style.background = "#fafafa"; |
|---|
| 84 | } else { |
|---|
| 85 | document.getElementById('caption').disabled = false; |
|---|
| 86 | document.getElementById('description').disabled = false; |
|---|
| 87 | document.getElementById('caption').style.background = "#ffffff"; |
|---|
| 88 | document.getElementById('description').style.background = "#ffffff"; |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | } |
|---|
| 92 | |
|---|
| 93 | function toggle(obj) { |
|---|
| 94 | var objarray = obj.split(', '); |
|---|
| 95 | while (objarray.length > 0) { |
|---|
| 96 | var el = document.getElementById(objarray.shift()); |
|---|
| 97 | if ( el.style.display != 'none' ) { |
|---|
| 98 | el.style.display = 'none'; |
|---|
| 99 | } else { |
|---|
| 100 | el.style.display = ''; |
|---|
| 101 | } |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | }; |
|---|