~veger/ubuntu/precise/samba/fix-for-902339

« back to all changes in this revision

Viewing changes to swat2/scripting/common.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
 
        js functions and code common to all pages
3
 
*/
4
 
 
5
 
/* define some global variables for this request */
6
 
global.page = new Object();
7
 
 
8
 
/* fill in some defaults */
9
 
global.page.title = "Samba Web Administration Tool";
10
 
 
11
 
libinclude("base.js");
12
 
 
13
 
/* to cope with browsers that don't support cookies we append the sessionid
14
 
   to the URI */
15
 
global.SESSIONURI = "";
16
 
if (request['COOKIE_SUPPORT'] != "True") {
17
 
        global.SESSIONURI="?SwatSessionId=" + request['SESSION_ID'];
18
 
}
19
 
 
20
 
/*
21
 
  possibly adjust a local URI to have the session id appended
22
 
  used for browsers that don't support cookies
23
 
*/
24
 
function session_uri(uri) {
25
 
        return uri + global.SESSIONURI;
26
 
}
27
 
 
28
 
/*
29
 
  like printf, but to the web page
30
 
*/
31
 
function writef()
32
 
{
33
 
        write(vsprintf(arguments));
34
 
}
35
 
 
36
 
/*
37
 
  like writef with a <br>
38
 
*/
39
 
function writefln()
40
 
{
41
 
        write(vsprintf(arguments));
42
 
        write("<br/>\n");
43
 
}
44
 
 
45
 
 
46
 
/* if the browser was too dumb to set the HOST header, then
47
 
   set it now */
48
 
if (headers['HOST'] == undefined) {
49
 
        headers['HOST'] = server['SERVER_HOST'] + ":" + server['SERVER_PORT'];
50
 
}
51
 
 
52
 
/*
53
 
  show the page header. page types include "plain" and "column" 
54
 
*/
55
 
function page_header(pagetype, title, menu) {
56
 
        global.page.pagetype = pagetype;
57
 
        global.page.title = title;
58
 
        global.page.menu = menu;
59
 
        include("/scripting/header_" + pagetype + ".esp");
60
 
}
61
 
 
62
 
/*
63
 
  show the page footer, getting the page type from page.pagetype
64
 
  set in page_header()
65
 
*/
66
 
function page_footer() {
67
 
        include("/scripting/footer_" + global.page.pagetype + ".esp");
68
 
}
69
 
 
70
 
 
71
 
/*
72
 
  display a table element
73
 
*/
74
 
function table_element(i, o) {
75
 
        write("<tr><td>" + i + "</td><td>");
76
 
        if (typeof(o[i]) == "object") {
77
 
                var j, first;
78
 
                first = true;
79
 
                for (j in o[i]) {
80
 
                        if (first == false) {
81
 
                                write("<br />");
82
 
                        }
83
 
                        write(o[i][j]);
84
 
                        first = false;
85
 
                }
86
 
        } else {
87
 
                write(o[i]);
88
 
        }
89
 
        write("</td></tr>\n");
90
 
}
91
 
 
92
 
/*
93
 
  display a ejs object as a table. The header is optional
94
 
*/
95
 
function simple_table(v) {
96
 
        if (v.length == 0) {
97
 
                return;
98
 
        }
99
 
        write("<table class=\"data\">\n");
100
 
        var r;
101
 
        for (r in v) {
102
 
                table_element(r, v);
103
 
        }
104
 
        write("</table>\n");
105
 
}
106
 
 
107
 
/*
108
 
  display an array of objects, with the header for each element from the given 
109
 
  attribute
110
 
*/
111
 
function multi_table(array, header) {
112
 
        var i, n;
113
 
        write("<table class=\"data\">\n");
114
 
        for (i=0;i<array.length;i++) {
115
 
                var r, v = array[i];
116
 
                write('<tr><th colspan="2">' + v[header] + "</th></tr>\n");
117
 
                for (r in v) {
118
 
                        if (r != header) {
119
 
                            table_element(r, v);
120
 
                        }
121
 
                }
122
 
        }
123
 
        write("</table>\n");
124
 
}
125