Exemple #1
0
    def view(self, db, token, action, id, view='calendar'):
        registry = openerp.modules.registry.RegistryManager.get(db)
        meeting_pool = registry.get('calendar.event')
        attendee_pool = registry.get('calendar.attendee')
        with registry.cursor() as cr:
            attendee_data = meeting_pool.get_attendee(cr, openerp.SUPERUSER_ID,
                                                      id)
            attendee = attendee_pool.search_read(
                cr, openerp.SUPERUSER_ID, [('access_token', '=', token)], [])

        if attendee:
            attendee_data['current_attendee'] = attendee[0]
        js = "\n        ".join(
            '<script type="text/javascript" src="%s"></script>' % i
            for i in webmain.manifest_list('js', db=db))
        css = "\n       ".join('<link rel="stylesheet" href="%s">' % i
                               for i in webmain.manifest_list('css', db=db))

        return webmain.html_template % {
            'js':
            js,
            'css':
            css,
            'modules':
            simplejson.dumps(webmain.module_boot(db)),
            'init':
            "s.calendar.event('%s', '%s', '%s', '%s' , '%s');" %
            (db, action, id, 'form', json.dumps(attendee_data)),
        }
Exemple #2
0
    def index(self, req, s_action=None, db=None, **kw):
        db, redir = db_monodb_redirect(req)
        if redir:
            return redirect_with_hash(req, redir)

        js = "\n        ".join(
            '<script type="text/javascript" src="%s"></script>' % i
            for i in manifest_list(req, 'js', db=db))
        css = "\n        ".join('<link rel="stylesheet" href="%s">' % i
                                for i in manifest_list(req, 'css', db=db))

        # Load the extra files
        js += "\n        ".join(
            '<script type="text/javascript" src="%s"></script>' % i
            for i in js_extras)
        css += "\n        ".join('<link rel="stylesheet" href="%s">' % i
                                 for i in css_extras)

        r = html_template % {
            'js': js,
            'css': css,
            'modules': simplejson.dumps(module_boot(req, db=db)),
            'init':
            'var wc = new s.web.WebClient();wc.appendTo($(document.body));'
        }
        return r
Exemple #3
0
    def a(self, debug=False, **k):

        if not request.session.uid:
            return login_redirect()

        js_list = manifest_list('js', db=request.db, debug=debug)
        css_list = manifest_list('css', db=request.db, debug=debug)

        js = "\n".join('<script type="text/javascript" src="%s"></script>' % i
                       for i in js_list)
        #css = "\n".join('<link rel="stylesheet" href="%s">' % i for i in css_list)
        r = html_template % {
            'js':
            js,
            #   'css': css,
            'modules':
            simplejson.dumps(module_boot(request.db)),
            'init':
            """
                     var wc = new s.web.WebClient();
                     wc.show_application = function(){
                         wc.action_manager.do_action("pos.ui");
                     };
                     wc.appendTo($(document.body));
                     """
        }
        return r
Exemple #4
0
 def template(self, req, mods="web,edi"):
     d = {}
     d["js"] = "\n".join(
         '<script type="text/javascript" src="%s"></script>' % i for i in webmain.manifest_list(req, mods, "js")
     )
     d["css"] = "\n".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list(req, mods, "css"))
     d["modules"] = simplejson.dumps(mods.split(","))
     return d
Exemple #5
0
 def import_url(self, req, url):
     modules = webmain.module_boot(req) + ['edi']
     modules_str = ','.join(modules)
     modules_json = simplejson.dumps(modules)
     js = "\n        ".join(
         '<script type="text/javascript" src="%s"></script>' % i
         for i in webmain.manifest_list(req, modules_str, 'js'))
     css = "\n        ".join(
         '<link rel="stylesheet" href="%s">' % i
         for i in webmain.manifest_list(req, modules_str, 'css'))
     return webmain.html_template % {
         'js': js,
         'css': css,
         'modules': modules_json,
         'init': 's.edi.edi_import("%s");' % url,
     }
Exemple #6
0
    def app(self, req, s_action=None, **kw):
        js = "\n        ".join(
            '<script type="text/javascript" src="%s"></script>' % i
            for i in manifest_list(req, None, 'js'))
        css = "\n        ".join('<link rel="stylesheet" href="%s">' % i
                                for i in manifest_list(req, None, 'css'))

        cookie = req.httprequest.cookies.get("instance0|session_id")
        session_id = cookie.replace("%22", "")
        template = html_template.replace(
            '<html',
            '<html manifest="/pos/manifest?session_id=%s"' % session_id)
        r = template % {
            'js': js,
            'css': css,
            'modules': simplejson.dumps(module_boot(req)),
            'init':
            'var wc = new s.web.WebClient();wc.appendTo($(document.body));'
        }
        return r
Exemple #7
0
 def import_url(self, req, url):
     modules = webmain.module_boot(req) + ['edi']
     modules_str = ','.join(modules)
     modules_json = simplejson.dumps(modules)
     js = "\n        ".join('<script type="text/javascript" src="%s"></script>' % i for i in webmain.manifest_list(req, modules_str, 'js'))
     css = "\n        ".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list(req, modules_str, 'css'))
     return webmain.html_template % {
         'js': js,
         'css': css,
         'modules': modules_json,
         'init': 's.edi.edi_import("%s");' % url,
     }
Exemple #8
0
    def import_url(self, url):
        # http://hostname:8069/edi/import_url?url=URIEncodedURL
        req = openerp.http.request
        modules = webmain.module_boot(req) + ['edi']
        modules_str = ','.join(modules)
        modules_json = simplejson.dumps(modules)
        js = "\n        ".join(
            '<script type="text/javascript" src="%s"></script>' % i
            for i in webmain.manifest_list(req, modules_str, 'js'))
        css = "\n        ".join(
            '<link rel="stylesheet" href="%s">' % i
            for i in webmain.manifest_list(req, modules_str, 'css'))

        # `url` may contain a full URL with a valid query string, we basically want to watch out for XML brackets and double-quotes
        safe_url = werkzeug.url_quote_plus(url, ':/?&;=')

        return webmain.html_template % {
            'js': js,
            'css': css,
            'modules': modules_json,
            'init': 's.edi.edi_import("%s");' % safe_url,
        }
Exemple #9
0
    def view(self, db, token, action, id, view="calendar"):
        registry = openerp.modules.registry.RegistryManager.get(db)
        meeting_pool = registry.get("calendar.event")
        attendee_pool = registry.get("calendar.attendee")
        with registry.cursor() as cr:
            attendee_data = meeting_pool.get_attendee(cr, openerp.SUPERUSER_ID, id)
            attendee = attendee_pool.search_read(cr, openerp.SUPERUSER_ID, [("access_token", "=", token)], [])

        if attendee:
            attendee_data["current_attendee"] = attendee[0]
        js = "\n        ".join(
            '<script type="text/javascript" src="%s"></script>' % i for i in webmain.manifest_list("js", db=db)
        )
        css = "\n       ".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list("css", db=db))

        return webmain.html_template % {
            "js": js,
            "css": css,
            "modules": simplejson.dumps(webmain.module_boot(db)),
            "init": "s.calendar.event('%s', '%s', '%s', '%s' , '%s');"
            % (db, action, id, "form", json.dumps(attendee_data)),
        }
Exemple #10
0
    def a(self, debug=False, **k):

        if not request.session.uid:
            return login_redirect()

        js_list = manifest_list('js',db=request.db, debug=debug)
        css_list =   manifest_list('css',db=request.db, debug=debug)
        
        js = "\n".join('<script type="text/javascript" src="%s"></script>' % i for i in js_list)
        #css = "\n".join('<link rel="stylesheet" href="%s">' % i for i in css_list)
        r = html_template % {
            'js': js,
         #   'css': css,
            'modules': simplejson.dumps(module_boot(request.db)),
            'init': """
                     var wc = new s.web.WebClient();
                     wc.show_application = function(){
                         wc.action_manager.do_action("pos.ui");
                     };
                     wc.appendTo($(document.body));
                     """
        }
        return r
    def app(self, req, s_action=None, **kw):
        js = "\n        ".join('<script type="text/javascript" src="%s"></script>' % i for i in manifest_list(req, None, 'js'))
        css = "\n        ".join('<link rel="stylesheet" href="%s">' % i for i in manifest_list(req, None, 'css'))

        cookie = req.httprequest.cookies.get("instance0|session_id")
        session_id = cookie.replace("%22","")
        template = html_template.replace('<html','<html manifest="/pos/manifest?session_id=%s"'%session_id)
        r = template % {
            'js': js,
            'css': css,
            'modules': simplejson.dumps(module_boot(req)),
            'init': 'var wc = new s.web.WebClient();wc.appendTo($(document.body));'
        }
        return r
Exemple #12
0
    def import_url(self, req, url):
        modules = webmain.module_boot(req) + ['edi']
        modules_str = ','.join(modules)
        modules_json = simplejson.dumps(modules)
        js = "\n        ".join('<script type="text/javascript" src="%s"></script>' % i for i in webmain.manifest_list(req, modules_str, 'js'))
        css = "\n        ".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list(req, modules_str, 'css'))

        # `url` may contain a full URL with a valid query string, we basically want to watch out for XML brackets and double-quotes 
        safe_url = urllib.quote_plus(url,':/?&;=')

        return webmain.html_template % {
            'js': js,
            'css': css,
            'modules': modules_json,
            'init': 's.edi.edi_import("%s");' % safe_url,
        }
Exemple #13
0
    def view(self, db, token, action, id, view='calendar'):
        registry = openerp.modules.registry.RegistryManager.get(db)
        meeting_pool = registry.get('calendar.event')
        attendee_pool = registry.get('calendar.attendee')
        with registry.cursor() as cr:
            attendee_data = meeting_pool.get_attendee(cr, openerp.SUPERUSER_ID, id);
            attendee = attendee_pool.search_read(cr, openerp.SUPERUSER_ID, [('access_token','=',token)],[])
        
        if attendee:
            attendee_data['current_attendee'] = attendee[0]
        js = "\n        ".join('<script type="text/javascript" src="%s"></script>' % i for i in webmain.manifest_list('js', db=db))
        css = "\n       ".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list('css',db=db))

        return webmain.html_template % {
            'js': js,
            'css': css,
            'modules': simplejson.dumps(webmain.module_boot(db)),
            'init': "s.calendar.event('%s', '%s', '%s', '%s' , '%s');" % (db, action, id, 'form', json.dumps(attendee_data)),
        }
Exemple #14
0
    def a(self, debug=False, **k):

        if not request.session.uid:
            return login_redirect()

        js_list = manifest_list('js',db=request.db, debug=debug)
        js =  "\n".join('<script type="text/javascript" src="%s"></script>' % i for i in js_list)
        modules =  simplejson.dumps(module_boot(request.db))
        init =  """
                 var wc = new s.web.WebClient();
                 wc.show_application = function(){
                     wc.action_manager.do_action("pos.ui");
                 };
                 wc.appendTo($(document.body));
                 """

        html = request.registry.get('ir.ui.view').render(request.cr, request.session.uid,'point_of_sale.index',{
            'js': js,
            'modules': modules,
            'init': init,
            })

        return html