[bugzilla-gnome-org-extensions] Add a Bugzilla extension



commit 0201e1c2bb89a6411fa6f7227cc46940fd309a99
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sun Sep 27 15:49:27 2009 -0400

    Add a Bugzilla extension
    
    Add a Bugzilla extension to integrate Splinter closely into Bugzilla.
    It adds:
    
     - A template to display Splinter with Bugzilla headers and footers
     - Hooks to add review links to review comments and to the attachments
       section of edit_bug.cgi
     - A section in the Bugzilla parameters for splinter.
    
    Most of the content of index.html is moved into index.html.body, which
    is included (by Makefile rules) into index.html and into the
    splinter.html template.
    
    config.js no longer exists as a file; in the proxy case, config.js is
    generated on-the-fly by splinter_proxy.py. In the Bugzilla extension
    case, the config.js content is emitted by the splinter.html template.
    
    The format of the standalone version of Splinter has been changed to be
    compatible with the Bugzilla-template version: the header is a single
    line with "Title   Subtitle    Information" and the margin is now added
    in a <div/> that encloses all the non-header content.

 Makefile                                           |   64 ++++++++++++++++
 README                                             |   31 +++++---
 extension/code/bug-format_comment.pl               |   44 +++++++++++
 extension/code/config-add_panels.pl                |   26 +++++++
 extension/code/page-before_template.pl             |   43 +++++++++++
 extension/info.pl                                  |    6 ++
 extension/lib/ConfigSplinter.pm                    |   44 +++++++++++
 .../template/en/attachment/list-action.html.tmpl   |   28 +++++++
 .../en/default/admin/params/splinter.html.tmpl     |   38 ++++++++++
 .../en/default/pages/splinter.html.tmpl.in         |   44 +++++++++++
 js/splinter.js                                     |   14 ++--
 proxy/README                                       |    2 -
 proxy/splinter_proxy.py                            |   37 ++++++----
 web/config.js.example                              |   22 ------
 web/index.html                                     |   78 --------------------
 web/index.html.body                                |   53 +++++++++++++
 web/index.html.in                                  |   28 +++++++
 web/splinter.css                                   |   43 +++++++----
 18 files changed, 497 insertions(+), 148 deletions(-)
---
diff --git a/Makefile b/Makefile
index 5b70cfc..256d796 100644
--- a/Makefile
+++ b/Makefile
@@ -30,9 +30,73 @@ CLEAN_FILES =                                        \
        jstest                                  \
        web/splinter.flat.js
 
+WEB_FILES =                                    \
+       web/index.html                          \
+       web/jquery.min.js                       \
+       web/splinter.css                        \
+       web/splinter.flat.js
+
+EXTENSION_FILES =                                                      \
+       extension/code/bug-format_comment.pl                            \
+       extension/code/config-add_panels.pl                             \
+       extension/code/page-before_template.pl                          \
+       extension/info.pl                                               \
+       extension/lib/ConfigSplinter.pm                                 \
+       extension/template/en/attachment/list-action.html.tmpl          \
+       extension/template/en/default/admin/params/splinter.html.tmpl   \
+       extension/template/en/default/pages/splinter.html.tmpl
+
 web/splinter.flat.js: $(JS_FILES) flattener.py
        python flattener.py js/splinter.js > $@ || rm -f $@
 
+define SUBSTITUTE_BODY
+perl -ne 'BEGIN {                              \
+    local $$/;                                 \
+    open F, "web/index.html.body";             \
+    $$body = <F>;                              \
+    close(F);                                  \
+}                                              \
+                                               \
+if (/\ \@BODY\ \@/) {                          \
+    print $$body;                              \
+} else {                                       \
+    print;                                     \
+}'
+endef
+
+extension/template/en/default/pages/splinter.html.tmpl: 
extension/template/en/default/pages/splinter.html.tmpl.in web/index.html.body
+       $(SUBSTITUTE_BODY) $< > $@ || rm $@
+
+web/index.html: web/index.html.in web/index.html.body
+       $(SUBSTITUTE_BODY) $< > $@ || rm $@
+
+install: $(WEB_FILES) $(EXTENSION_FILES)
+       @BUGZILLA_ROOT="$(BUGZILLA_ROOT)";                                                                    
                  \
+       BUGZILLA_ROOT=$${BUGZILLA_ROOT:-`git config splinter.bugzilla-root`} ;                                
                  \
+       [ "$$BUGZILLA_ROOT" = "" ] && echo >&2 "Usage: make install BUGZILLA_ROOT=<path to bugzilla>" && exit 
1 ;               \
+       webservergroup=`sed -n '{ s/$$webservergroup *= *'[\'\"]'\(.*\)'[\'\"]' *; */\1/ p }' 
$$BUGZILLA_ROOT/localconfig` ;    \
+       [ "$$webservergroup" = "" ] && echo >&2 "Can't find webservergroup in $$BUGZILLA_ROOT/localconfig" && 
exit 1 ;          \
+       echo "Removing old install" ;                                                                         
                  \
+       rm -rf $$BUGZILLA_ROOT/extensions/splinter ;                                                          
                  \
+       ensuredir() {                                                                                         
                  \
+               if [ -d `dirname $$1` ] ; then : ; else                                                       
                  \
+                       ensuredir `dirname $$1` ;                                                             
                  \
+                       install -g $$webservergroup -m 0750 -d `dirname $$1` || exit 1 ;                      
                  \
+               fi                                                                                            
                  \
+       } ;                                                                                                   
                  \
+       installone() {                                                                                        
                  \
+               d=`dirname $$2` ;                                                                             
                  \
+               echo "Installing $$1 => $$d" ;                                                                
                  \
+               ensuredir $$2 ;                                                                               
                  \
+               install -g $$webservergroup -m 0640 $$1 $$2 || exit 1 ;                                       
                  \
+       } ;                                                                                                   
                  \
+       for i in $(EXTENSION_FILES) ; do                                                                      
                  \
+               installone $$i $$BUGZILLA_ROOT/extensions/splinter/$${i#extension/} ;                         
                  \
+       done ;                                                                                                
                  \
+       for i in $(WEB_FILES) ; do                                                                            
                  \
+               installone $$i $$BUGZILLA_ROOT/extensions/splinter/$$i ;                                      
                  \
+       done
+
 check: jstest
        ./jstest $(TESTS)
 
diff --git a/README b/README
index d26dbfa..2363dee 100644
--- a/README
+++ b/README
@@ -24,14 +24,20 @@ Installation
 You can run Splinter locally for yourself with the splinter_proxy.py
 tool - see proxy/README for installation.
 
-The basic idea of a hosted install is to install Splinter onto the
-same server as as Bugzilla. Set up aliases or mod_rewrite so that
-/review/ is mapped onto the web/ directory of the location you
-installed Splinter.
+To add it to a Bugzilla installation, simply run:
 
-There will eventually be a small Bugzilla extension to add links from
-review comments and from the attachments list to the Splinter 
-review page.
+ make install BUGZILLA_ROOT=/path/to/bugzilla/installation
+
+You'll need to do this as root or as another user with permissions
+to change ownership of files to the web server group.
+
+By default, Splinter will have the URL /page.cgi?id=splinter.html, which
+is ugly and leaks implementation details that may change. This URL can
+be changed from the "Splinter Patch Review" section of "Parameters" in
+the Bugzilla Adminstration pages. If you change it (the recommendation is
+to use /review), you'll have to use mod_rewrite or other web server
+configuration to forward the pretty URL to the right place. The
+parameter description includes instructions for mod_rewrite.
 
 Why the name
 ============
@@ -52,6 +58,11 @@ By Owen Taylor <otaylor fishsoup net>
 
 Copyright 2009, Red Hat, Inc.
 
-Licensed either under the terms of the Mozilla Public License, version
-1.1 or later, or under the GNU General Public License, version 2 or
-later.
+All of Splinter other than the extension/ directory is licensed either
+under the terms of the Mozilla Public License, version 1.1 or later,
+or under the GNU General Public License, version 2 or later.
+
+The code and content in the extension/ directory contains code derived
+from the Bugzilla Example Plugin and Bugzilla and is Copyright 2009,
+Red Hat Inc. and others, and licensed under the terms of the
+Mozilla Public License, version 1.1 or later.
diff --git a/extension/code/bug-format_comment.pl b/extension/code/bug-format_comment.pl
new file mode 100644
index 0000000..f826e33
--- /dev/null
+++ b/extension/code/bug-format_comment.pl
@@ -0,0 +1,44 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Splinter Bugzilla Extension.
+#
+# The Initial Developer of the Original Code is Red Hat, Inc.
+# Portions created by Red Hat, Inc. are Copyright (C) 2009
+# Red Hat Inc. All Rights Reserved.
+#
+# Contributor(s):
+#   Owen Taylor <otaylor fishsoup net>
+
+use strict;
+use warnings;
+use Bugzilla;
+use Bugzilla::Template;
+
+my $REVIEW_RE = qr/Review\s+of\s+attachment\s+(\d+)\s*:/;
+
+my $bug = Bugzilla->hook_args->{'bug'};
+my $regexes = Bugzilla->hook_args->{'regexes'};
+my $text = Bugzilla->hook_args->{'text'};
+
+if ($$text =~ $REVIEW_RE) {
+    my $base = Bugzilla->params->{'splinter_base'};
+    my $bug_id = $bug->id;
+    if ($base =~ /\?/)
+        my $review_link = "<a href='$base&bug=$bug_id&attachment=$1'>Review</a>";
+    else
+        my $review_link = "<a href='$base?bug=$bug_id&attachment=$1'>Review</a>";
+    my $attach_link = Bugzilla::Template::get_attachment_link($1, "attachment $1");
+
+    push(@$regexes, { match => $REVIEW_RE,
+                      replace => "$review_link of $attach_link:"});
+}
diff --git a/extension/code/config-add_panels.pl b/extension/code/config-add_panels.pl
new file mode 100644
index 0000000..dc46704
--- /dev/null
+++ b/extension/code/config-add_panels.pl
@@ -0,0 +1,26 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Example Plugin.
+#
+# The Initial Developer of the Original Code is Canonical Ltd.
+# Portions created by Canonical Ltd. are Copyright (C) 2008 
+# Canonical Ltd. All Rights Reserved.
+#
+# Contributor(s): Bradley Baetz <bbaetz acm org>
+#                 Owen Taylor <otaylor redhat com>
+
+use strict;
+use warnings;
+use Bugzilla;
+my $modules = Bugzilla->hook_args->{panel_modules};
+$modules->{Splinter} = "extensions::splinter::lib::ConfigSplinter";
diff --git a/extension/code/page-before_template.pl b/extension/code/page-before_template.pl
new file mode 100644
index 0000000..8f0e7d0
--- /dev/null
+++ b/extension/code/page-before_template.pl
@@ -0,0 +1,43 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Splinter Bugzilla Extension.
+#
+# The Initial Developer of the Original Code is Red Hat, Inc.
+# Portions created by Red Hat, Inc. are Copyright (C) 2009
+# Red Hat Inc. All Rights Reserved.
+#
+# Contributor(s):
+#   Owen Taylor <otaylor fishsoup net>
+
+use strict;
+use warnings;
+use Bugzilla;
+
+my $REVIEW_RE = qr/Review\s+of\s+attachment\s+(\d+)\s*:/;
+
+my $page_id = Bugzilla->hook_args->{'page_id'};
+my $vars = Bugzilla->hook_args->{'vars'};
+
+if ($page_id eq "splinter.html") {
+    # We do this in a way that is safe if the Bugzilla instance doesn't
+    # have an attachments.status field (which is a bugzilla.gnome.org
+    # addition)
+    my $field_object = new Bugzilla::Field({ name => 'attachments.status' });
+    my $statuses;
+    if ($field_object) {
+        $statuses = [map { $_->name } @{ $field_object->legal_values }];
+    } else {
+        $statuses = [];
+    }
+    $vars->{'attachment_statuses'} = $statuses;
+}
diff --git a/extension/info.pl b/extension/info.pl
new file mode 100644
index 0000000..deedf16
--- /dev/null
+++ b/extension/info.pl
@@ -0,0 +1,6 @@
+use strict;
+no warnings qw(void); # Avoid "useless use of a constant in void context"
+{
+    version => 1,
+    name    => 'Splinter',
+};
diff --git a/extension/lib/ConfigSplinter.pm b/extension/lib/ConfigSplinter.pm
new file mode 100644
index 0000000..9039e9f
--- /dev/null
+++ b/extension/lib/ConfigSplinter.pm
@@ -0,0 +1,44 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Example Plugin.
+#
+# The Initial Developer of the Original Code is Canonical Ltd.
+# Portions created by Canonical Ltd. are Copyright (C) 2008
+# Canonical Ltd. All Rights Reserved.
+#
+# Contributor(s): Max Kanat-Alexander <mkanat bugzilla org>
+#                 Bradley Baetz <bbaetz acm org>
+#                 Owen Taylor <otaylor redhat com>
+
+package extensions::splinter::lib::ConfigSplinter;
+use strict;
+use warnings;
+
+use Bugzilla::Config::Common;
+
+$extensions::splinter::lib::ConfigSplinter::sortkey = 30;
+
+sub get_param_list {
+    my ($class) = @_;
+
+    my @param_list = (
+    {
+        name => 'splinter_base',
+        type => 't',
+        default => '/page.cgi?id=splinter.html',
+    },
+    );
+    return @param_list;
+}
+
+1;
diff --git a/extension/template/en/attachment/list-action.html.tmpl 
b/extension/template/en/attachment/list-action.html.tmpl
new file mode 100644
index 0000000..325502d
--- /dev/null
+++ b/extension/template/en/attachment/list-action.html.tmpl
@@ -0,0 +1,28 @@
+[%#
+  # The contents of this file are subject to the Mozilla Public
+  # License Version 1.1 (the "License"); you may not use this file
+  # except in compliance with the License. You may obtain a copy of
+  # the License at http://www.mozilla.org/MPL/
+  #
+  # Software distributed under the License is distributed on an "AS
+  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  # implied. See the License for the specific language governing
+  # rights and limitations under the License.
+  #
+  # The Original Code is the Splinter Bugzilla Extension.
+  #
+  # The Initial Developer of the Original Code is Red Hat, Inc.
+  # Portions created by Red Hat, Inc. are Copyright (C) 2008
+  # Red Hat, Inc. All Rights Reserved.
+  #
+  # Contributor(s): Owen Taylor <otaylor redhat com>
+  #%]
+
+[% IF attachment.ispatch %]
+&#x0020; |
+  [% IF Param("splinter_base").search('\?') %]
+    <a href='[% Param("splinter_base") %]&bug=[% bugid %]&attachment=[% attachment.id %]'>Review</a>
+  [% ELSE %]
+    <a href='[% Param("splinter_base") %]?bug=[% bugid %]&attachment=[% attachment.id %]'>Review</a>
+  [% END %]
+[% END %]
diff --git a/extension/template/en/default/admin/params/splinter.html.tmpl 
b/extension/template/en/default/admin/params/splinter.html.tmpl
new file mode 100644
index 0000000..834c0c7
--- /dev/null
+++ b/extension/template/en/default/admin/params/splinter.html.tmpl
@@ -0,0 +1,38 @@
+[%#
+  # The contents of this file are subject to the Mozilla Public
+  # License Version 1.1 (the "License"); you may not use this file
+  # except in compliance with the License. You may obtain a copy of
+  # the License at http://www.mozilla.org/MPL/
+  #
+  # Software distributed under the License is distributed on an "AS
+  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  # implied. See the License for the specific language governing
+  # rights and limitations under the License.
+  #
+  # The Original Code is the Bugzilla Example Plugin.
+  #
+  # The Initial Developer of the Original Code is Canonical Ltd.
+  # Portions created by Canonical Ltd. are Copyright (C) 2008
+  # Canonical Ltd. All Rights Reserved.
+  #
+  # Contributor(s): Bradley Baetz <bbaetz acm org>
+  #                 Owen Taylor <otaylor redhat com>
+  #%]
+[%
+    title = "Splinter Patch Review"
+    desc = "Configure Splinter"
+%]
+
+[% param_descs = {
+  splinter_base => "This is the base URL for the Splinter patch review page; " _
+                   "the default value '/page.cgi?id=splinter.html' works without " _
+                   "further configuration, however you may want to internally forward " _
+                   "/review to that URL in your web server's configuration and then change " _
+                   "this parameter. For example, withr the Apache HTTP server you can add " _
+                   "the following lines to the .htaccess for Bugzilla: " _
+                   "<pre>" _
+                   "RewriteEngine On\n" _
+                   "RewriteRule ^review(\?(.*))? page.cgi?id=splinter.html&amp;&#x0024;2 [L]" _
+                   "</pre>"
+ }
+%]
diff --git a/extension/template/en/default/pages/splinter.html.tmpl.in 
b/extension/template/en/default/pages/splinter.html.tmpl.in
new file mode 100644
index 0000000..b665422
--- /dev/null
+++ b/extension/template/en/default/pages/splinter.html.tmpl.in
@@ -0,0 +1,44 @@
+[%#
+  # The contents of this file are subject to the Mozilla Public
+  # License Version 1.1 (the "License"); you may not use this file
+  # except in compliance with the License. You may obtain a copy of
+  # the License at http://www.mozilla.org/MPL/
+  #
+  # Software distributed under the License is distributed on an "AS
+  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  # implied. See the License for the specific language governing
+  # rights and limitations under the License.
+  #
+  # The Original Code is the Splinter Bugzilla Extension.
+  #
+  # The Initial Developer of the Original Code is Red Hat, Inc.
+  # Portions created by Red Hat, Inc. are Copyright (C) 2008
+  # Red Hat, Inc. All Rights Reserved.
+  #
+  # Contributor(s): Owen Taylor <otaylor redhat com>
+  #%]
+
+[% PROCESS global/header.html.tmpl
+  title = "Patch Review"
+  header = "Patch Review"
+  style_urls = [ "/extensions/splinter/web/splinter.css" ]
+  javascript_urls = [ "/extensions/splinter/web/jquery.min.js",
+                      "/extensions/splinter/web/config.js",
+                      "/extensions/splinter/web/splinter.flat.js" ]
+  subheader = "&nbsp;"
+  header_addl_info = "&nbsp;"
+%]
+<script type="text/javascript">
+  configAttachmentStatuses = [
+  [% FOREACH status = attachment_statuses %]
+  '[% status FILTER js %]',
+  [% END %]
+  ];
+  configBugzillaUrl = '/';
+  configBase = '[% Param('splinter_base') FILTER js %]';
+  $(function() { init(); });
+</script>
+
+@@BODY@@
+
+[% PROCESS global/footer.html.tmpl %]
diff --git a/js/splinter.js b/js/splinter.js
index 8b346af..6ffe659 100644
--- a/js/splinter.js
+++ b/js/splinter.js
@@ -494,14 +494,13 @@ function start(xml) {
 
     $("#loading").hide();
     $("#attachmentInfo").show();
-    $("#controls").show();
+    $("#intro").show();
     $("#files").show();
 
     $("#bugLink").attr('href', newPageUrl(theBug.id));
 
-    $("#attachmentId").text(theAttachment.id);
-    $("#attachmentDesc").text(theAttachment.description);
-    $("#attachmentDate").text(Utils.formatDate(theAttachment.date));
+    $("#subtitle").text("Attachment " + theAttachment.id + " - " + theAttachment.description);
+    $("#information").text(Utils.formatDate(theAttachment.date));
 
     for (i = 0; i < configAttachmentStatuses.length; i++) {
         $("<option></option")
@@ -584,7 +583,7 @@ function start(xml) {
 function gotBug(xml) {
     theBug = Bug.Bug.fromDOM(xml);
 
-    $("#headers").show();
+    $("#bugInfo").show();
     showNote();
 
     $("#bugId").text(theBug.id);
@@ -619,9 +618,10 @@ function isDigits(str) {
 }
 
 function newPageUrl(newBugId, newAttachmentId) {
-    var newUrl = "/index.html";
+    var newUrl = configBase;
     if (newBugId != null) {
-        newUrl += "?bug=" + escape("" + newBugId);
+        newUrl += (newUrl.indexOf("?") < 0) ? "?" : "&";
+        newUrl += "bug=" + escape("" + newBugId);
         if (newAttachmentId != null)
             newUrl += "&attachment=" + escape("" + newAttachmentId);
     }
diff --git a/proxy/README b/proxy/README
index 251a6b8..3ca7503 100644
--- a/proxy/README
+++ b/proxy/README
@@ -29,8 +29,6 @@ login access to you should be OK.
 
 Usage
 =====
-* Copy config.js.example in the $(topdir)/web to config.js; you
-  probably won't need to edit it.
 * Copy config.py.example to config.py
 * Replace 'bugzilla.example.com' with your server, and edit
   bugzilla_login, and bugzilla_password appropriately.
diff --git a/proxy/splinter_proxy.py b/proxy/splinter_proxy.py
index c15b68a..adf7c7d 100755
--- a/proxy/splinter_proxy.py
+++ b/proxy/splinter_proxy.py
@@ -354,24 +354,33 @@ def login():
         print >>sys.stderr, "Can't log in to %s: %s" % (current_config['bugzilla_url'],
                                                         e.args[1])
 
-def read_config_js():
-    try:
-        f = open("../web/config.js")
-    except IOError:
-        print >>sys.stderr, "web/config.js doesn't exist; you need to create it from config.js.example"
-        sys.exit(1)
-
-    content = f.read()
-    f.close()
-
-    content = content.replace('@@BUGZILLA_URL@@',  current_config['bugzilla_url'])
+def make_config_js():
     if 'bugzilla_login' in current_config and 'bugzilla_login' in current_config:
         note = ''
     else:
         note = 'This is a read-only demo instance of Splinter; you will not be able to publish your reviews'
-    content = content.replace('@@NOTE@@',  note)
 
-    return content
+    # configAttachmentStatuses is just hardcoded here to the values for bugzilla.gnome.org
+    # which is the only Bugzilla instance I'm aware of using attachment statuses. It
+    # could be added to config.py if needed.
+    return """\
+configBugzillaUrl = '%(bugzilla_url)s';
+configNote = '%(note)s';
+
+configAttachmentStatuses = [
+    'none',
+    'accepted-commit_now',
+    'needs-work',
+    'accepted-commit_after_freeze',
+    'committed',
+    'rejected',
+    'reviewed'
+];
+""" % {
+        'bugzilla_url': current_config['bugzilla_url'],
+        'have_extension': have_extension_value,
+        'note': note
+      }
 
 def redirect_to_log(log_file):
     outf = os.open(log_file, os.O_WRONLY | os.O_CREAT | os.O_APPEND)
@@ -447,7 +456,7 @@ if not config_name in config.configs:
 
 current_config = config.configs[config_name]
 
-config_js_content = read_config_js()
+config_js_content = make_config_js()
 
 if 'bugzilla_login' in current_config and 'bugzilla_login' in current_config:
     if 'proxy_bind' in current_config and current_config['proxy_bind'] != '127.0.0.1':
diff --git a/web/index.html.body b/web/index.html.body
new file mode 100644
index 0000000..f45b0d9
--- /dev/null
+++ b/web/index.html.body
@@ -0,0 +1,53 @@
+<div id="error" style="display: none;"> </div>
+<div id="loading">Loading....</div>
+<div id="bugInfo" style="display: none;">
+  <a id="bugLink">Bug <span id="bugId"></span></a> -
+  <span id="bugShortDesc"></span> -
+  <span id="bugReporter"></span> -
+  <span id="bugCreationDate"></span>
+</div>
+<div id="enterBug" style="display: none;">
+  Bug to review:
+  <input id="enterBugInput" />
+  <input id="enterBugGo" type="button" value="Go" />
+  <div id="chooseReview" style="display: none;">
+     Drafts and published reviews:
+    <table>
+      <tbody>
+      </tbody>
+    </table>
+  </div>
+</div>
+<div id="chooseAttachment" style="display: none;">
+  Choose patch attachment to review:
+  <table>
+    <tbody>
+    </tbody>
+  </table>
+  <a id="originalBugLink">Go to bug</a>
+</div>
+<div id="intro" style="display: none;">
+  <div id="patchIntro">
+  </div>
+  <div id="oldReviews">
+  </div>
+  <div id="restored" style="display: none;">
+    Restored from draft; last edited <span id="restoredLastModified"></span>
+  </div>
+  <div>
+    <div>Overall Comment:</div>
+    <textarea id="myComment"></textarea>
+    <div>
+    </div>
+    <div id="buttonBox">
+      <span id="attachmentStatusSpan">Patch Status:
+       <select id="attachmentStatus"> </select>
+      </span>
+      <input id="publishButton" type="button" value="Publish" />
+      <input id="cancelButton" type="button" value="Cancel" />
+    </div>
+    <div class="clear"></div>
+  </div>
+</div>
+<div id="files" style="display: none;"></div>
+<div id="saveDraftNotice" style="display: none;"></div>
diff --git a/web/index.html.in b/web/index.html.in
new file mode 100644
index 0000000..37daa57
--- /dev/null
+++ b/web/index.html.in
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+  <head>
+    <title>Patch Review</title>
+    <link rel="stylesheet" href="splinter.css" type="text/css" />
+    <script src="jquery.min.js" type="text/javascript"></script>
+    <script src="config.js" type="text/javascript"></script>
+    <script src="splinter.flat.js" type="text/javascript"></script>
+    <script type="text/javascript">
+      $(function() { init(); });
+    </script>
+  </head>
+  <body>
+    <div id="splinterHeaders">
+      <table><tr>
+       <td id="title">Patch Review</td>
+       <td id="subtitle"></td>
+       <td id="information"></td>
+      </tr></table>
+    </div>
+    <div id="note" style="display: none;"></div>
+    <div id="splinterBody">
+      @@BODY@@
+    </div>
+  </body>
+</html>
diff --git a/web/splinter.css b/web/splinter.css
index b51735e..993d891 100644
--- a/web/splinter.css
+++ b/web/splinter.css
@@ -2,21 +2,33 @@ body {
     margin: 0px;
 }
 
-#loading {
-    padding: 0.5em;
-}
-
-#headers {
+#splinterHeaders {
     background: black;
     color: white;
     font-size: 90%;
     padding: 0.5em;
 }
 
-#headers a {
+#splinterHeaders a {
     color: white;
 }
 
+#splinterHeaders table {
+    width: 100%;
+}
+
+#splinterHeaders #subtitle {
+    text-align: center;
+}
+
+#splinterHeaders #information {
+    text-align: right;
+}
+
+#splinterBody {
+    margin: 1em;
+}
+
 #note {
     background: #ffee88;
     padding: 0.5em;
@@ -24,15 +36,10 @@ body {
 
 #error {
     border: 1px solid black;
-    margin: 0.5em;
     padding: 0.5em;
     color: #bb0000;
 }
 
-#enterBug {
-    padding: 0.5em;
-}
-
 #chooseReview {
     margin-top: 1em;
 }
@@ -41,8 +48,12 @@ body {
     font-weight: bold;
 }
 
-#chooseAttachment {
+#bugInfo {
+    margin-top: 0.5em;
+    margin-bottom: 1em;
+    background: #eeeeee;
     padding: 0.5em;
+    -moz-border-radius: 0.5em;
 }
 
 #chooseAttachment table {
@@ -57,8 +68,9 @@ body {
     text-decoration: line-through ;
 }
 
-#controls {
-    padding: 0.5em;
+#intro {
+    margin-top: 0.5em;
+    margin-bottom: 0.5em;
 }
 
 #patchIntro {
@@ -141,7 +153,8 @@ body {
 
 #files {
    position: relative;
-   padding: 0.5em;
+   margin-top: 0.5em;
+   margin-bottom: 0.5em;
 }
 
 .file-label {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]