[IMP] posbox: add a homepage to the root controller on the posbox that explains what...
authorFrédéric van der Essen <fva@openerp.com>
Fri, 21 Mar 2014 13:46:23 +0000 (14:46 +0100)
committerFrédéric van der Essen <fva@openerp.com>
Fri, 21 Mar 2014 13:46:23 +0000 (14:46 +0100)
bzr revid: fva@openerp.com-20140321134623-eaj56nrh8hkagvym

addons/hw_posbox_homepage/__init__.py [new file with mode: 0644]
addons/hw_posbox_homepage/__openerp__.py [new file with mode: 0644]
addons/hw_posbox_homepage/controllers/__init__.py [new file with mode: 0644]
addons/hw_posbox_homepage/controllers/main.py [new file with mode: 0644]

diff --git a/addons/hw_posbox_homepage/__init__.py b/addons/hw_posbox_homepage/__init__.py
new file mode 100644 (file)
index 0000000..a208bc1
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
+#
+##############################################################################
+
+import controllers
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/hw_posbox_homepage/__openerp__.py b/addons/hw_posbox_homepage/__openerp__.py
new file mode 100644 (file)
index 0000000..7c0cac0
--- /dev/null
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+    'name': 'PosBox Homepage',
+    'version': '1.0',
+    'category': 'Hardware Drivers',
+    'sequence': 6,
+    'summary': 'A homepage for the PosBox',
+    'description': """
+PosBox Homepage
+===============
+
+This module overrides openerp web interface to display a simple
+Homepage that explains what's the posbox and show the status,
+and where to find documentation.
+
+If you activate this module, you won't be able to access the 
+regular openerp interface anymore. 
+
+""",
+    'author': 'OpenERP SA',
+    'depends': ['hw_proxy'],
+    'installable': False,
+    'auto_install': False,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hw_posbox_homepage/controllers/__init__.py b/addons/hw_posbox_homepage/controllers/__init__.py
new file mode 100644 (file)
index 0000000..b5f0bcc
--- /dev/null
@@ -0,0 +1,3 @@
+import main
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/hw_posbox_homepage/controllers/main.py b/addons/hw_posbox_homepage/controllers/main.py
new file mode 100644 (file)
index 0000000..bab94be
--- /dev/null
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+import logging
+import os
+import time
+from os import listdir
+
+import openerp
+from openerp import http
+from openerp.http import request
+from openerp.tools.translate import _
+
+_logger = logging.getLogger(__name__)
+
+index_template = """
+<!DOCTYPE HTML>
+<html>
+    <head>
+        <title>OpenERP's PosBox</title>
+        <style>
+        body {
+            width: 480px;
+            margin: 60px auto;
+            font-family: sans-serif;
+            text-align: justify;
+            color: #6B6B6B;
+        }
+        </style>
+    </head>
+    <body>
+        <h1>Your PosBox is up and running</h1>
+        <p>
+        The PosBox is an hardware adapter that allows you to use 
+        receipt printers and barcode scanners with OpenERP's Point of
+        Sale, <b>version 8.0 or later</b>. You can start an <a href='https://www.openerp.com/start'>online free trial</a>,
+        or <a href='https://www.openerp.com/start?download'>download and install</a> it yourself.
+        </p>
+        <p>
+        For more information on how to setup the Point of Sale with
+        the PosBox, please refer to <a href='/hw_proxy/static/doc/manual.pdf'>the manual</a>
+        </p>
+        <p>
+        To see the status of the connected hardware, please refer 
+        to the <a href='/hw_proxy/status'>hardware status page</a>
+        </p>
+        <p>
+        The PosBox software installed on this posbox is <b>version 6</b>, 
+        the posbox version number is independent from OpenERP. You can upgrade
+        the software on the <a href='/hw_proxy/upgrade/'>upgrade page</a>
+        </p>
+        <p>For any other question, please contact the OpenERP support at <a href='mailto:support@openerp.com'>support@openerp.com</a>
+        </p>
+    </body>
+</html>
+
+"""
+
+
+class PosboxHomepage(openerp.addons.web.controllers.main.Home):
+    @http.route('/', type='http', auth='none', website=True)
+    def index(self):
+        #return request.render('hw_posbox_homepage.index',mimetype='text/html')
+        return index_template
+