~landscape/zope3/ztk-1.1.3

« back to all changes in this revision

Viewing changes to src/zope/app/rotterdam/zope3.js

  • Committer: Sidnei da Silva
  • Date: 2010-07-05 21:07:01 UTC
  • Revision ID: sidnei.da.silva@canonical.com-20100705210701-zmqhqrbzad1mhzsl
- Reduce deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//----------------------------------------------------------------------------
2
 
// Copyright (c) 2005 Zope Corporation and Contributors.
3
 
// All Rights Reserved.
4
 
//
5
 
// This software is subject to the provisions of the Zope Public License,
6
 
// Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
7
 
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
8
 
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
9
 
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
10
 
// FOR A PARTICULAR PURPOSE.
11
 
//----------------------------------------------------------------------------
12
 
 
13
 
//----------------------------------------------------------------------------
14
 
// popup window with settings 
15
 
//----------------------------------------------------------------------------
16
 
function popup(page, name, settings) {
17
 
  win = window.open(page, name, settings);
18
 
  win.focus();
19
 
}
20
 
 
21
 
//----------------------------------------------------------------------------
22
 
// guess browser version, feel free to enhance it if needed.
23
 
//----------------------------------------------------------------------------
24
 
var ie = document.all != null;
25
 
var moz = !ie && document.getElementById != null && document.layers == null;
26
 
 
27
 
//----------------------------------------------------------------------------
28
 
// change the status (color) of the matrix table used in grant.html
29
 
//----------------------------------------------------------------------------
30
 
function changeMatrix(e) {
31
 
  var ele = e? e: window.event;
32
 
  var id = ele.getAttribute('id');
33
 
  var name = ele.getAttribute('name');
34
 
  if (moz) {
35
 
    var label = ele.parentNode;
36
 
    var center = label.parentNode;
37
 
    var td = center.parentNode;
38
 
  }
39
 
  else {
40
 
    var label = ele.parentElement;
41
 
    var center = label.parentElement;
42
 
    var td = center.parentElement;
43
 
  }
44
 
  resetMatrixCSS(name);
45
 
  if (td.className != "default") {
46
 
    td.className = "changed";
47
 
  }
48
 
}
49
 
 
50
 
function resetMatrixCSS(name) {
51
 
  var inputFields = document.getElementsByTagName('input');
52
 
  for (var i = 0; i < inputFields.length; i++) {
53
 
    var field = inputFields[i];
54
 
    if (field.getAttribute('name') == name) {
55
 
      if (moz) {
56
 
        td = field.parentNode.parentNode.parentNode;
57
 
      }
58
 
      else {
59
 
        td = field.parentElement.parentElement.parentElement;
60
 
      }
61
 
      if (td.className != "default") {
62
 
        td.className = "";
63
 
      }
64
 
    }
65
 
  }
66
 
}
67
 
 
68
 
 
69
 
//----------------------------------------------------------------------------
70
 
// toggle the status of all checkboxes that have class == "className"
71
 
//----------------------------------------------------------------------------
72
 
function updateCheckboxes(master, className) {
73
 
    newState = master.checked;
74
 
    objects = document.getElementsByTagName("input")
75
 
    count = objects.length;
76
 
    for(x = 0; x < count; x++) {
77
 
        obj = objects[x];
78
 
        if (obj.type == "checkbox") {
79
 
            var classes = obj.className.split(" ");
80
 
            for (var i = 0; i < classes.length; i++)
81
 
                if (classes[i] == className) {
82
 
                    obj.checked = newState;
83
 
                    break;
84
 
                }
85
 
        }
86
 
    }
87
 
}