source: trunk/plog-admin/js/plogger.js @ 590

Revision 590, 3.0 KB checked in by sidtheduck, 19 months ago (diff)

Large commit based on work with Kim Parsell and myself
Should be ready for a release candidate after this commit.
Items worked on:

  • Large overhaul for code cleanup and syntax standardization
  • Security fixes for folder permissions on all server environments (now all directories should be set to 0755 and all files set to 0644)
  • Works compeletely with safe_mode restrictions using FTP commands
  • Beginnings of plugin usage (no architecture yet, but start of code standardization and addon code)
  • Fixing comments and adding security
  • More error messages
  • Minor fixes to upgrade and install process
  • Should fix tickets #188, #206, #194, #195, #197, #201, #203, #204, #89, #174, #200
  • Many other minor edits that I can't remember now (hopefully future commits will be much smaller and deal with individual issues, enhancements, or bugs)
Line 
1function 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
10function 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
23function 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
38function focus_first_input() {
39        fields = document.getElementsByTagName('input');
40        if (fields.length > 0) {
41                fields[0].focus();
42        }
43}
44
45function updateThumbPreview(selectObj) {
46        var thumb = selectObj.options[selectObj.selectedIndex].style.backgroundImage;
47        selectObj.style.backgroundImage = thumb;
48}
49
50var importThumbCounter = 0;
51
52function 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
63function requestImportThumb() {
64        new Ajax.Request('plog-thumb.php', {method: 'get', onComplete: onImportThumbComplete, parameters: 'img=' + importThumbs[importThumbCounter]});
65};
66
67function 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
93function 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};
Note: See TracBrowser for help on using the repository browser.