Skip to content

Commit

Permalink
Flask: initial comit with SQLAlchemy and Bootstrap
Browse files Browse the repository at this point in the history
* WebMessage: First module ported to Flask/Jinja2/WTForms/SQLAlchemy.
  Introduced tests for database independency using Flask-Test and
  SQLAlchemy. It includes example of dynamic menu loading latest
  messages and showing unread message counter.

* WebSearch: Initial implementation of new search UI using facets and
  search box autocompletion for several fields. The implementation is
  still using old Invenio search API and record formating. New AJAX tabs
  were introduced for record pages. They are using new javascript
  history API and there is a correct fallback link when the javascript
  is turned off.

* WebComment: Creates demo comments tree and review overview for record
  tabs.

* WebAccess: Reimplements some SQL queries in SQLAlchemy.

* WebStyle: Creates unified general page header and footer. There is
  also new page look and feel using Twitter-Bootstrap user interface.

* WebSession: Implements simple login method using Flask.
  • Loading branch information
jirikuncar committed Nov 3, 2012
1 parent 3880f2e commit 1ee2c0c
Show file tree
Hide file tree
Showing 122 changed files with 9,245 additions and 1,321 deletions.
8 changes: 8 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ Contents
python-dateutil python-rdflib \
python-gnuplot python-magic pdftk html2text giflib-tools \
pstotext netpbm python-pypdf python-chardet python-lxml
python-sqlalchemy python-sqlalchemy-ext \
python-flask

You also need to install following packages from PyPi
by running:

$ sudo pip install fixture Flask-Assets Flask-Cache \
Flask-SQLAlchemy Flask-Testing wtforms Flask-WTF

You may also want to install some of the following packages,
if you have them available on your concrete architecture:
Expand Down
68 changes: 68 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ $(top_srcdir)/.version:
dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version

# Bootstrap version
BOOTSTRAPV = 2.0.4

check-upgrade:
$(PYTHON) $(top_srcdir)/modules/miscutil/lib/inveniocfg_upgrader.py $(top_srcdir) --upgrade-check

check-custom-templates:
$(PYTHON) $(top_srcdir)/modules/webstyle/lib/template.py --check-custom-templates $(top_srcdir)

kwalitee-check:
@$(PYTHON) $(top_srcdir)/modules/miscutil/lib/kwalitee.py --stats $(top_srcdir)

Expand Down Expand Up @@ -275,6 +281,68 @@ install-mediaelement:
@echo "** MediaElement.js was successfully installed. **"
@echo "***********************************************************"

install-bootstrap:
@echo "***********************************************************"
@echo "** Installing Twitter Bootstrap, please wait... **"
@echo "***********************************************************"
rm -rf /tmp/invenio-bootstrap
mkdir /tmp/invenio-bootstrap
(cd /tmp/invenio-bootstrap && \
wget -O bootstrap.zip 'http://invenio-software.org/download/bootstrap/bootstrap-${BOOTSTRAPV}.zip' && \
unzip -u bootstrap.zip && \
cp bootstrap/css/bootstrap-responsive.css ${prefix}/var/www/css/bootstrap-responsive.css && \
cp bootstrap/css/bootstrap-responsive.min.css ${prefix}/var/www/css/bootstrap-responsive.min.css && \
cp bootstrap/css/bootstrap.css ${prefix}/var/www/css/bootstrap.css && \
cp bootstrap/css/bootstrap.min.css ${prefix}/var/www/css/bootstrap.min.css && \
cp bootstrap/img/glyphicons-halflings-white.png ${prefix}/var/www/img/glyphicons-halflings-white.png && \
cp bootstrap/img/glyphicons-halflings.png ${prefix}/var/www/img/glyphicons-halflings.png && \
cp bootstrap/js/bootstrap.js ${prefix}/var/www/js/jquery/bootstrap.js && \
cp bootstrap/js/bootstrap.min.js ${prefix}/var/www/js/jquery/bootstrap.min.js && \
rm -fr /tmp/invenio-bootstrap )
@echo "***********************************************************"
@echo "** The Twitter Bootstrap was successfully installed. **"
@echo "***********************************************************"

uninstall-bootstrap:
rm ${prefix}/var/www/css/bootstrap-responsive.css && \
rm ${prefix}/var/www/css/bootstrap-responsive.min.css && \
rm ${prefix}/var/www/css/bootstrap.css && \
rm ${prefix}/var/www/css/bootstrap.min.css && \
rm ${prefix}/var/www/img/glyphicons-halflings-white.png && \
rm ${prefix}/var/www/img/glyphicons-halflings.png && \
rm ${prefix}/var/www/js/jquery/bootstrap.js && \
rm ${prefix}/var/www/js/jquery/bootstrap.min.js
@echo "***********************************************************"
@echo "** The Twitter Bootstrap was successfully uninstalled. **"
@echo "***********************************************************"

install-jquery-tokeninput:
@echo "***********************************************************"
@echo "** Installing JQuery Tokeninput, please wait... **"
@echo "***********************************************************"
rm -rf /tmp/jquery-tokeninput
mkdir /tmp/jquery-tokeninput
(cd /tmp/jquery-tokeninput && \
wget -O jquery-tokeninput.zip 'https://github.com/loopj/jquery-tokeninput/zipball/jquery-tokeninput-1.6.0' && \
unzip -u jquery-tokeninput.zip && \
cp loopj-jquery-tokeninput-201d2d1/styles/token-input-facebook.css ${prefix}/var/www/css/token-input-facebook.css && \
cp loopj-jquery-tokeninput-201d2d1/styles/token-input-mac.css ${prefix}/var/www/css/token-input-mac.css && \
cp loopj-jquery-tokeninput-201d2d1/styles/token-input.css ${prefix}/var/www/css/token-input.css && \
cp loopj-jquery-tokeninput-201d2d1/src/jquery.tokeninput.js ${prefix}/var/www/js/jquery/jquery.tokeninput.js && \
rm -fr /tmp/jquery-tokeninput )
@echo "***********************************************************"
@echo "** The JQuery Tokeninput was successfully installed. **"
@echo "***********************************************************"

uninstall-jquery-tokeninput:
rm ${prefix}/var/www/css/token-input-facebook.css && \
rm ${prefix}/var/www/css/token-input-mac.css && \
rm ${prefix}/var/www/css/token-input.css && \
rm ${prefix}/var/www/js/jquery/jquery.tokeninput.js
@echo "***********************************************************"
@echo "** The JQuery Tokeninput was successfully uninstalled. **"
@echo "***********************************************************"

uninstall-pdfa-helper-files:
rm -f ${prefix}/etc/websubmit/file_converter_templates/ISOCoatedsb.icc
@echo "***********************************************************"
Expand Down
7 changes: 7 additions & 0 deletions config/invenio.conf
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ CFG_OPENAIRE_SITE = 0
## (this isn't a development site.)
CFG_DEVEL_SITE = 0

## CFG_FLASK_CACHE_TYPE -- do we want to enable any cache engine?
## 'null', 'redis' or your own e.g. 'invenio.cache.my_cache_engine'
## NOTE: If you disable cache engine it WILL affect some
## functionality such as 'search facets'.
CFG_FLASK_CACHE_TYPE = null


################################
## Part 2: Web page style ##
################################
Expand Down
31 changes: 22 additions & 9 deletions configure-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"""

## minimally recommended/required versions:
cfg_min_python_version = "2.4"
cfg_max_python_version = "2.9.9999"
cfg_min_mysqldb_version = "1.2.1_p2"
CFG_MIN_PYTHON_VERSION = (2, 4)
CFG_MAX_PYTHON_VERSION = (2, 9, 9999)
CFG_MIN_MYSQLDB_VERSION = "1.2.1_p2"

## 0) import modules needed for this testing:
import string
Expand All @@ -49,7 +49,7 @@ def wait_for_user(msg):
return

## 1) check Python version:
if sys.version < cfg_min_python_version:
if sys.version_info < CFG_MIN_PYTHON_VERSION:
error_messages.append(
"""
*******************************************************
Expand All @@ -65,10 +65,11 @@ def wait_for_user(msg):
** **
** Please upgrade your Python before continuing. **
*******************************************************
""" % (string.replace(sys.version, "\n", ""), cfg_min_python_version)
""" % (string.replace(sys.version, "\n", ""),
'.'.join(CFG_MIN_PYTHON_VERSION))
)

if sys.version > cfg_max_python_version:
if sys.version_info > CFG_MAX_PYTHON_VERSION:
error_messages.append(
"""
*******************************************************
Expand All @@ -85,7 +86,8 @@ def wait_for_user(msg):
** **
** Installation aborted. **
*******************************************************
""" % (string.replace(sys.version, "\n", ""), cfg_max_python_version)
""" % (string.replace(sys.version, "\n", ""),
'.'.join(CFG_MAX_PYTHON_VERSION))
)

## 2) check for required modules:
Expand Down Expand Up @@ -113,6 +115,17 @@ def wait_for_user(msg):
import urllib
import zlib
import wsgiref
import sqlalchemy
import werkzeug
import jinja2
import flask
import fixture
import flask.ext.assets
import flaskext.cache
import flask.ext.sqlalchemy
import flask.ext.testing
import wtforms
import flask.ext.wtf
except ImportError, msg:
error_messages.append("""
*************************************************
Expand Down Expand Up @@ -324,7 +337,7 @@ def wait_for_user(msg):


## 4) check for versions of some important modules:
if MySQLdb.__version__ < cfg_min_mysqldb_version:
if MySQLdb.__version__ < CFG_MIN_MYSQLDB_VERSION:
error_messages.append(
"""
*****************************************************
Expand All @@ -335,7 +348,7 @@ def wait_for_user(msg):
** before continuing. Please see the INSTALL file **
** for more details. **
*****************************************************
""" % (MySQLdb.__version__, cfg_min_mysqldb_version)
""" % (MySQLdb.__version__, CFG_MIN_MYSQLDB_VERSION)
)

try:
Expand Down
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ AC_CONFIG_FILES([config.nice \
modules/webaccess/bin/Makefile \
modules/webaccess/bin/authaction \
modules/webaccess/bin/webaccessadmin \
modules/webaccess/etc/Makefile \
modules/webaccess/etc/templates/Makefile \
modules/webaccess/doc/Makefile \
modules/webaccess/doc/admin/Makefile \
modules/webaccess/doc/hacking/Makefile \
Expand All @@ -824,6 +826,8 @@ AC_CONFIG_FILES([config.nice \
modules/webcomment/doc/Makefile \
modules/webcomment/doc/admin/Makefile \
modules/webcomment/doc/hacking/Makefile \
modules/webcomment/etc/Makefile \
modules/webcomment/etc/templates/Makefile \
modules/webcomment/lib/Makefile \
modules/webcomment/web/Makefile \
modules/webcomment/web/admin/Makefile \
Expand Down Expand Up @@ -862,12 +866,16 @@ AC_CONFIG_FILES([config.nice \
modules/websearch/doc/Makefile \
modules/websearch/doc/admin/Makefile \
modules/websearch/doc/hacking/Makefile \
modules/websearch/etc/Makefile \
modules/websearch/etc/templates/Makefile \
modules/websearch/lib/Makefile \
modules/websearch/web/Makefile \
modules/websearch/web/admin/Makefile \
modules/websession/Makefile \
modules/websession/bin/Makefile \
modules/websession/bin/inveniogc \
modules/websession/etc/Makefile \
modules/websession/etc/templates/Makefile \
modules/websession/doc/Makefile \
modules/websession/doc/admin/Makefile \
modules/websession/doc/hacking/Makefile \
Expand Down
Loading

0 comments on commit 1ee2c0c

Please sign in to comment.