/[drupal]/contributions/modules/acidfree/acidfree.js
ViewVC logotype

Contents of /contributions/modules/acidfree/acidfree.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download) (as text)
Mon Nov 13 18:14:39 2006 UTC (3 years ago) by vhmauery
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5, DRUPAL-6--1
Changes since 1.5: +10 -8 lines
File MIME type: text/javascript
fixed default theme so it looks okay (still need a new theme)
album thumbnails - fixed and random - via user selection
protect acidfree root from changing parent
fixed pager issues with element pager - had pid=ppp problems
fixed titles/breadcrumbs to match page
fixed get_thumb_path/get_thumb_url to work properly
changed call from theme_image to image_display so images get resized if needed
fixed acidfree javascript to work on album contents view
fixed list view to display albums properly
1 /* $Id: acidfree.js,v 1.5 2006/09/14 22:09:01 vhmauery Exp $ */
2
3 /*
4 Acidfree Photo Albums for Drupal
5 Copyright (C) 2005 Vernon Mauery
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22 /**
23 * @file
24 * this contains the javascript needed for acidfree to work nicely
25 */
26
27 function set_thumb(base_url, select, id, count) {
28 var img_base = base_url+'/acidfree/thumbnail/';
29 var path;
30 var img = document.getElementById('acidfree-thumb'+id);
31 if (select.selectedIndex == 0) {
32 path = img_base+select.options[Math.floor((Math.random()*count)+1)].value;
33 } else {
34 path = img_base+select.options[select.selectedIndex].value;
35 }
36 img.src = path;
37 }
38
39 function last_resized(large, small, thumb, last) {
40 if (document.getElementById('edit-acidfree_large_dim').value != large ||
41 document.getElementById('edit-acidfree_small_dim').value != small ||
42 document.getElementById('edit-acidfree_thumb_dim').value != thumb) {
43 document.getElementById('edit-acidfree_last_resized').value = 0;
44 alert('last_resized = 0');
45 } else {
46 document.getElementById('edit-acidfree_last_resized').value = last;
47 alert('last_resized = '+last);
48 }
49 }
50
51 function select_nodes(select) {
52 var form = select.form;
53 var i;
54 var sel = select.options[select.selectedIndex].value;
55 for (i=0; i<form.length; i++) {
56 if (form.elements[i].type == 'checkbox') {
57 // edit-nodes-0-checked
58 var regex=/^edit-nodes-[0-9]+-checked/;
59 if (regex.test(form.elements[i].id)) {
60 if (sel == 'all')
61 form.elements[i].checked = true;
62 else if (sel == 'none')
63 form.elements[i].checked = false;
64 else if (sel == 'invert')
65 form.elements[i].checked ^= true;
66 }
67 }
68 }
69 }
70
71 function set_title(file) {
72 var title = document.getElementById('edit-title');
73 if (title.value == '') {
74 var t = file.toString();
75 title.value = t.replace(/.*[\/\\](.*)\..*/i, '$1');
76 }
77 }
78
79 function update_parent_selects(sel) {
80 var form = sel.form;
81 var i;
82 var regex=/^edit-parent-[0-9]+/;
83 for (i=0; i<form.length; i++) {
84 if (form.elements[i] == sel)
85 continue;
86 if (regex.test(form.elements[i].id)) {
87 form.elements[i].selectedIndex = sel.selectedIndex;
88 }
89 }
90 }
91
92 function toggle_album_select(chkbox) {
93 var sel = document.getElementById('edit-acidfree_block_2_random_albums');
94 if (chkbox.checked == true) {
95 sel.disabled = true;
96 } else {
97 sel.disabled = false;
98 }
99 }
100 function set_filename(file) {
101 var filename = document.getElementById(file.id+'name');
102 var t = file.value.toString();
103 filename.value = t.replace(/.*[\/\\](.*)/i, '$1');
104 }

  ViewVC Help
Powered by ViewVC 1.1.2