Author: gjm
Date: Thu Dec 12 16:37:31 2013
New Revision: 1550449

URL: http://svn.apache.org/r1550449
Log:
adds the ability to pass fields set in the qct form to the newticket page - 
towards #617, patch from antony

Modified:
    bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py
    bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js

Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py?rev=1550449&r1=1550448&r2=1550449&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py 
(original)
+++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py Thu 
Dec 12 16:37:31 2013
@@ -50,13 +50,29 @@ class ProductTicketModule(TicketModule):
     def process_request(self, req):
         """Override for TicketModule process_request"""
         ticketid = req.args.get('id')
-        productid = req.args.get('productid','')
+        productid = req.args.get('productid', '')
+        qct_product = req.args.get('product')  # From QCT form
         if not ticketid:
             # if /newticket is executed in global scope (from QCT), redirect
             # the request to /products/<first_product_in_DB>/newticket
-            if not productid and not isinstance(self.env, ProductEnvironment):
+            #
+            # If here from "More fields" link then pass along QCT form fields.
+            # If product arg present then redirect to
+            # /products/<qct_product>/newticket .
+
+            if not productid and not qct_product and not isinstance(self.env,
+                    ProductEnvironment):
                 products = Product.select(self.env, {'fields': ['prefix']})
-                req.redirect(req.href.products(products[0].prefix, 
'newticket'))
+                req.redirect(req.href.products(products[0].prefix, 'newticket',
+                                               req.args))
+            elif qct_product:
+                # Most likely arrived here via the QCT "More fields" link.
+                # Use <qct_product> to redirect to the appropriate product
+                # scope
+
+                req.args.pop('product')  # don't reenter block on redirect.
+                req.redirect(req.href.products(qct_product, 'newticket',
+                                               req.args))
             return self._process_newticket_request(req)
 
         if req.path_info in ('/newticket', '/products'):

Modified: bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js?rev=1550449&r1=1550448&r2=1550449&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js (original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js Thu Dec 12 
16:37:31 2013
@@ -93,6 +93,17 @@ $( function () {
         content : function () { return qct_info.msg; }
       });
 
+    /** 
+     * Pass QCT form fields to full ticket form when "More fields" is clicked
+     */
+    $('#qct-more').click(function(e) {
+        e.preventDefault();
+        var href = $(this).attr('href');
+        var params = $('#qct-form').serialize();
+        params = params.replace(/field_/g, ''); // map to newticket querystring
+        window.location = href + '?' + params;
+    });
+
     $('body').on('click.close', '#qct-alert-close', 
         function (e) { qct_alert_close() });
 


Reply via email to