~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to swat2/scripting/client/regedit.js

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
        client side js functions for registry editing
3
 
 
4
 
        Copyright Andrew Tridgell 2005
5
 
        released under the GNU GPL Version 3 or later
6
 
*/
7
 
 
8
 
 
9
 
/*
10
 
  callback from the key enumeration call
11
 
*/
12
 
function __folder_keys(fParent, list) 
13
 
{
14
 
        var i;
15
 
        if (fParent.working == 1) {
16
 
                fParent.working = 0;
17
 
                fParent.removeAll();
18
 
        }
19
 
        for (i=0;i<list.length;i++) {
20
 
                var fChild;
21
 
                fChild = new QxTreeFolder(list[i]);
22
 
                fParent.add(fChild);
23
 
                fChild.binding = fParent.binding;
24
 
                if (fParent.reg_path == '\\') {
25
 
                        fChild.reg_path = list[i];
26
 
                } else {
27
 
                        fChild.reg_path = fParent.reg_path + '\\' + list[i];
28
 
                }
29
 
                fChild.working = 1;
30
 
                fChild.add(new QxTreeFolder('Working ...'));
31
 
                fChild.addEventListener("click", function() { 
32
 
                        var el = this; __folder_click(el); 
33
 
                });
34
 
        }
35
 
        fParent.setOpen(1);
36
 
}
37
 
 
38
 
/*
39
 
  callback from the key enumeration call
40
 
*/
41
 
function __folder_values(fParent, list) 
42
 
{
43
 
        var i;
44
 
        if (list.length == 0) {
45
 
                return;
46
 
        }
47
 
        if (fParent.working == 1) {
48
 
                fParent.working = 0;
49
 
                fParent.removeAll();
50
 
        }
51
 
        for (i=0;i<list.length;i++) {
52
 
                var fChild;
53
 
                fChild = new QxTreeFile(list[i].name);
54
 
                fChild.parent = fParent;
55
 
                fChild.details = list[i];
56
 
                fParent.add(fChild);
57
 
        }
58
 
        fParent.setOpen(1);
59
 
}
60
 
 
61
 
/*
62
 
  called when someone clicks on a folder
63
 
*/
64
 
function __folder_click(node) 
65
 
{
66
 
        if (!node.populated) {
67
 
                node.populated = true;
68
 
                server_call_url("/scripting/server/regedit.esp", 'enum_keys', 
69
 
                                function(list) { __folder_keys(node, list); }, 
70
 
                                node.binding, node.reg_path);
71
 
                server_call_url("/scripting/server/regedit.esp", 'enum_values', 
72
 
                                function(list) { __folder_values(node, list); }, 
73
 
                                node.binding, node.reg_path);
74
 
        }
75
 
}
76
 
 
77
 
/* return a registry tree for the given server */
78
 
function __registry_tree(binding) 
79
 
{
80
 
        var tree = new QxTree("registry: " + binding);
81
 
        tree.binding = binding;
82
 
        tree.reg_path = "\\";
83
 
        tree.populated = false;
84
 
        with(tree) {
85
 
                setBackgroundColor(255);
86
 
                setBorder(QxBorder.presets.inset);
87
 
                setOverflow("scroll");
88
 
                setStyleProperty("padding", "2px");
89
 
                setWidth("50%");
90
 
                setHeight("90%");
91
 
                setTop("10%");
92
 
        }
93
 
        tree.addEventListener("click", function() { 
94
 
                var el = this; __folder_click(el); 
95
 
        });
96
 
        return tree;
97
 
}
98
 
 
99
 
/*
100
 
  the table of values
101
 
*/
102
 
function __values_table()
103
 
{
104
 
        var headings = new Array("Name", "Type", "Size", "Value");
105
 
        var table = document.createElement('table');
106
 
        table.border = "1";
107
 
        var body = document.createElement('tbody');
108
 
        table.appendChild(body);
109
 
        var th = document.createElement('th');
110
 
        for (var i=0;i<headings.length;i++) {
111
 
                var td = document.createElement('td');
112
 
                td.appendChild(document.createTextNode(headings[i]));
113
 
                th.appendChild(td);
114
 
        }
115
 
        body.appendChild(th);
116
 
        return table;
117
 
}
118
 
 
119
 
/*
120
 
  create a registry editing widget and return it as a object
121
 
*/
122
 
function regedit_widget(binding) 
123
 
{
124
 
        var fieldSet = new QxFieldSet();
125
 
 
126
 
        fieldSet.binding = binding;
127
 
 
128
 
        with(fieldSet) {
129
 
                setWidth("100%");
130
 
                setHeight("100%");
131
 
        };
132
 
 
133
 
        var gl = new QxGridLayout("auto,auto,auto,auto,auto", "50%,50%");
134
 
        gl.setEdge(0);
135
 
        gl.setCellPaddingTop(3);
136
 
        gl.setCellPaddingBottom(3);
137
 
 
138
 
        var t = __registry_tree(fieldSet.binding);
139
 
 
140
 
        function change_binding(e) {
141
 
                fieldSet.binding = e.getNewValue();
142
 
                srv_printf("changed binding to %s\\n", fieldSet.binding);
143
 
                gl.remove(t);
144
 
                t = __registry_tree(fieldSet.binding);
145
 
                gl.add(t, { row : 2, col : 1 });
146
 
        }
147
 
 
148
 
        var b = new QxTextField(fieldSet.binding);
149
 
        b.addEventListener("changeText", change_binding);
150
 
 
151
 
        var values = new __values_table();
152
 
 
153
 
        gl.add(b,      { row : 1, col : 1 });
154
 
        gl.add(t,      { row : 2, col : 1 });
155
 
//      gl.add(values, { row : 2, col : 2 });
156
 
        
157
 
        fieldSet.add(gl);
158
 
 
159
 
        return fieldSet;
160
 
};