[ckan-changes] commit/ckan: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Sun Oct 23 16:12:31 UTC 2011


2 new commits in ckan:


https://bitbucket.org/okfn/ckan/changeset/0590a1ed6271/
changeset:   0590a1ed6271
branch:      release-v1.5
user:        thejimmyg
date:        2011-10-23 18:11:01
summary:     [Packaging] Adding Solr support and pyenvs for 1.5b and CKAN workshop
affected #:  8 files

diff -r ed9e82e69c5f91781985e0e8e3d7ee1e4e38dfd0 -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 LICENSE.txt
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,117 @@
+License
++++++++
+
+CKAN - Data Catalogue Software
+Copyright (C) 2007 Open Knowledge Foundation
+
+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/>.
+
+
+Note
+====
+
+CKAN is sometimes packaged directly with other software (listed in
+requires/lucid_conflict.txt). In these cases, we are required to list the
+licenses of the packaged softare too. They are all AGPL compatible and read as
+follows in the next sections.
+
+WebHelpers
+----------
+
+Portions of WebHelpers covered by the following license::
+
+Copyright (c) 2005, the Lawrence Journal-World
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    1. Redistributions of source code must retain the above copyright notice, 
+       this list of conditions and the following disclaimer.
+    
+    2. Redistributions in binary form must reproduce the above copyright 
+       notice, this list of conditions and the following disclaimer in the
+       documentation and/or other materials provided with the distribution.
+
+    3. Neither the name of Django nor the names of its contributors may be used
+       to endorse or promote products derived from this software without
+       specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Genshi
+------
+
+Copyright © 2006-2007 Edgewall Software
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+   3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Migrate
+-------
+
+Open Source Initiative OSI - The MIT License:Licensing
+[OSI Approved License]
+
+The MIT License
+
+Copyright (c) <year><copyright holders>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+SQLAlchemy
+----------
+
+This is the MIT license: http://www.opensource.org/licenses/mit-license.php
+
+Copyright (c) 2005-2011 Michael Bayer and contributors. SQLAlchemy is a trademark of Michael Bayer.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+


diff -r ed9e82e69c5f91781985e0e8e3d7ee1e4e38dfd0 -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 MANIFEST.in
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,8 +1,9 @@
 include ckan/config/deployment.ini_tmpl
 recursive-include ckan/public *
 recursive-include ckan/config *.ini
+recursive-include ckan/config *.xml
 recursive-include ckan/templates *
 recursive-include ckan *.ini
 prune .hg
 include CHANGELOG.txt
-include ckan/migration/migrate.cfg
\ No newline at end of file
+include ckan/migration/migrate.cfg


diff -r ed9e82e69c5f91781985e0e8e3d7ee1e4e38dfd0 -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 ckan/config/deployment.ini_tmpl
--- a/ckan/config/deployment.ini_tmpl
+++ b/ckan/config/deployment.ini_tmpl
@@ -143,6 +143,8 @@
 ## Favicon (default is the CKAN software favicon)
 ckan.favicon = http://assets.okfn.org/p/ckan/img/ckan.ico
 
+## Solr support
+#solr_url = http://127.0.0.1:8983/solr
 
 ## An 'id' for the site (using, for example, when creating entries in a common search index) 
 ## If not specified derived from the site_url


diff -r ed9e82e69c5f91781985e0e8e3d7ee1e4e38dfd0 -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 ckan_deb/DEBIAN/control.template
--- a/ckan_deb/DEBIAN/control.template
+++ b/ckan_deb/DEBIAN/control.template
@@ -5,7 +5,7 @@
 Maintainer: James Gardner <james.gardner at okfn.org>
 Section: main/web
 Priority: extra
-Depends: python-ckan, postgresql-8.4, apache2, libapache2-mod-wsgi, python-apachemiddleware, python-virtualenv, python-pip
+Depends: python-ckan, postgresql-8.4, apache2, libapache2-mod-wsgi, python-virtualenv, python-pip, solr-jetty
 Homepage: http://ckan.org
 Description: ckan
  Common files useful for managing CKAN installations


diff -r ed9e82e69c5f91781985e0e8e3d7ee1e4e38dfd0 -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 ckan_deb/usr/bin/ckan-create-instance
--- a/ckan_deb/usr/bin/ckan-create-instance
+++ b/ckan_deb/usr/bin/ckan-create-instance
@@ -43,6 +43,8 @@
 echo "Ensuring users and groups are set up correctly ..."
 ckan_ensure_users_and_groups ${INSTANCE}
 
+chown ckan${INSTANCE}:ckan${INSTANCE} /etc/ckan/${INSTANCE}/install_settings.sh
+
 echo "Ensuring directories exist for ${INSTANCE} CKAN INSTANCE ..."
 ckan_make_ckan_directories ${INSTANCE}
 
@@ -75,6 +77,17 @@
 echo "Setting the password of the ${INSTANCE} user in PostgreSQL"
 ckan_add_or_replace_database_user ${INSTANCE} ${CKAN_DB_PASSWORD}
 
+# Solr support
+echo "Setting up Solr ..."
+sed \
+    -e "s,NO_START=1,NO_START=0," \
+    -e "s,#JETTY_HOST=\$(uname -n),JETTY_HOST=127.0.0.1," \
+    -e "s,#JETTY_PORT=8080,JETTY_PORT=8983," \
+    -i /etc/default/jetty
+mv /usr/share/solr/conf/schema.xml /usr/share/solr/conf/schema.xml.`date --utc "+%Y-%m-%d_%T"`.bak 
+ln -s /usr/lib/pymodules/python2.6/ckan/config/schema.xml /usr/share/solr/conf/schema.xml
+service jetty start
+
 # Create the config file
 echo "Creating/overwriting the config for CKAN ... "
 # We use the actual password in PostgreSQL in case any non-sense has gone on
@@ -121,7 +134,7 @@
 # Install the new crontab
 echo "Enabling crontab for the ckan${INSTANCE} user ..."
 PACKAGED_CRONJOB="/tmp/${INSTANCE}-cronjob"
-cat <<EOF > ${PACKAGED_CRONJOB}
+cat << EOF > ${PACKAGED_CRONJOB}
 # WARNING:  Do not edit these cron tabs, they will be overwritten any time 
 #           the ckan INSTANCE package is upgraded
 # QUESTION: Should email reports be sent to root?


diff -r ed9e82e69c5f91781985e0e8e3d7ee1e4e38dfd0 -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 ckan_deb/usr/lib/ckan/common.sh
--- a/ckan_deb/usr/lib/ckan/common.sh
+++ b/ckan_deb/usr/lib/ckan/common.sh
@@ -45,12 +45,12 @@
     INSTANCE=$1
     COMMAND_OUTPUT=`cat /etc/group | grep "ckan${INSTANCE}:"`
     if ! [[ "$COMMAND_OUTPUT" =~ "ckan${INSTANCE}:" ]] ; then
-        echo "Crating the 'ckan${INSTANCE}' group ..." 
+        echo "Creating the 'ckan${INSTANCE}' group ..." 
         sudo groupadd --system "ckan${INSTANCE}"
     fi
     COMMAND_OUTPUT=`cat /etc/passwd | grep "ckan${INSTANCE}:"`
     if ! [[ "$COMMAND_OUTPUT" =~ "ckan${INSTANCE}:" ]] ; then
-        echo "Crating the 'ckan${INSTANCE}' user ..." 
+        echo "Creating the 'ckan${INSTANCE}' user ..." 
         sudo useradd  --system  --gid "ckan${INSTANCE}" --home /var/lib/ckan/${INSTANCE} -M  --shell /usr/sbin/nologin ckan${INSTANCE}
     fi
 }
@@ -84,6 +84,7 @@
             cp -n /usr/share/pyshared/ckan/config/who.ini /etc/ckan/${INSTANCE}/who.ini
             sed -e "s,%(here)s,/var/lib/ckan/${INSTANCE}," \
                 -i /etc/ckan/${INSTANCE}/who.ini
+            chown ckan${INSTANCE}:ckan${INSTANCE} /etc/ckan/${INSTANCE}/who.ini
         fi
     fi
 }
@@ -109,7 +110,11 @@
             -e "s,^\(sqlalchemy.url\)[ =].*,\1 = postgresql://${INSTANCE}:${password}@localhost/${INSTANCE}," \
             -e "s,ckan\.site_logo,\#ckan.site_logo," \
             -e "s,ckan\.log,/var/log/ckan/${INSTANCE}/${INSTANCE}.log," \
+            -e "s,ckan\.site_id,${INSTANCE}," \
+            -e "s,ckan\.site_description,${INSTANCE}," \
+            -e "s,#solr_url = http://127.0.0.1:8983/solr,solr_url = http://127.0.0.1:8983/solr," \
             -i /etc/ckan/${INSTANCE}/${INSTANCE}.ini
+        sudo chown ckan${INSTANCE}:ckan${INSTANCE} /etc/ckan/${INSTANCE}/${INSTANCE}.ini
     fi
 }
 
@@ -147,6 +152,7 @@
         if ! [[ "$COMMAND_OUTPUT" =~ ${INSTANCE} ]] ; then
             echo "Creating the database ..."
             sudo -u postgres createdb -O ${INSTANCE} ${INSTANCE}
+            paster --plugin=ckan db init --config=/etc/ckan/${INSTANCE}/${INSTANCE}.ini
         fi
     fi
 }
@@ -161,7 +167,11 @@
         INSTANCE=$1
         if [ ! -f "/var/lib/ckan/${INSTANCE}/wsgi.py" ]
         then
-            sudo virtualenv --setuptools /var/lib/ckan/${INSTANCE}/pyenv
+            sudo mkdir /var/lib/ckan/${INSTANCE}/pyenv
+            sudo chown -R ckan${INSTANCE}:ckan${INSTANCE} /var/lib/ckan/${INSTANCE}/pyenv
+            sudo -u ckan${INSTANCE} virtualenv --setuptools /var/lib/ckan/${INSTANCE}/pyenv
+            echo "Attempting to install Pip 1.0 from pypi.python.org into pyenv to be used for extensions ..."
+            sudo -u ckan${INSTANCE} /var/lib/ckan/${INSTANCE}/pyenv/bin/easy_install pip -U "pip>=1.0" "pip<=1.0.99"
             cat <<- EOF > /var/lib/ckan/${INSTANCE}/wsgi.py
 	import os
 	instance_dir = '/var/lib/ckan/${INSTANCE}'
@@ -235,6 +245,10 @@
     # pass authorization info on (needed for rest api)
     WSGIPassAuthorization On
 
+    # Deploy as a daemon (avoids conflicts between CKAN instances)
+    # WSGIDaemonProcess ${INSTANCE} display-name=${INSTANCE} processes=4 threads=15 maximum-requests=10000
+    # WSGIProcessGroup ${INSTANCE}
+
     ErrorLog /var/log/apache2/${INSTANCE}.error.log
     CustomLog /var/log/apache2/${INSTANCE}.custom.log combined
 EOF


diff -r ed9e82e69c5f91781985e0e8e3d7ee1e4e38dfd0 -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 requires/lucid_missing.txt
--- a/requires/lucid_missing.txt
+++ b/requires/lucid_missing.txt
@@ -8,17 +8,17 @@
 # vdm>=0.9,<0.9.99
 -e hg+https://bitbucket.org/okfn/vdm@vdm-0.9#egg=vdm
 # markupsafe==0.9.2 required by webhelpers==1.2 required by formalchemy with SQLAlchemy 0.6
--e git+https://github.com/mitsuhiko/markupsafe.git@0.9.2#egg=markupsafe
+markupsafe==0.9.2
 # autoneg>=0.5
 -e git+https://github.com/wwaites/autoneg.git@b4c727b164f411cc9d60#egg=autoneg
 # flup>=0.5
 -e hg+http://hg.saddi.com/flup@301a58656bfb#egg=flup
 # solrpy == 0.9.4
-solrpy==0.9.4
-# All the conflicting dependencies from the lucid_conflict.txt file
--e hg+https://bitbucket.org/okfn/ckan-deps@6287665a1965#egg=ckan-deps
+#solrpy==0.9.4
 # FormAlchemy
--e git+https://github.com/FormAlchemy/formalchemy.git@1.3.9#egg=formalchemy
+formalchemy==1.3.9
+# Apachemiddleware
+-e hg+https://hg.3aims.com/public/ApacheMiddleware@tip#egg=apachemiddleware
 
 # NOTE: Developers, our build script for the Debian packages relies on the 
 #       requirements above being specified as editable resources with their


diff -r ed9e82e69c5f91781985e0e8e3d7ee1e4e38dfd0 -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 setup.py
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,6 @@
     install_requires=[
     ],
     extras_require = {
-        'solr': ['solrpy==0.9.4'],
     },
     packages=find_packages(exclude=['ez_setup']),
     include_package_data=True,



https://bitbucket.org/okfn/ckan/changeset/834fd3c220c8/
changeset:   834fd3c220c8
branch:      release-v1.5
user:        thejimmyg
date:        2011-10-23 18:12:18
summary:     [merge]
affected #:  15 files

diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/lib/app_globals.py
--- a/ckan/lib/app_globals.py
+++ b/ckan/lib/app_globals.py
@@ -21,6 +21,7 @@
                                   'http://assets.okfn.org/p/ckan/img/ckan.ico')
         self.site_logo = config.get('ckan.site_logo', '')
         self.site_url = config.get('ckan.site_url', '')
+        self.site_url_nice = self.site_url.replace('http://','').replace('www.','')
         self.site_description = config.get('ckan.site_description', '')
         
         self.facets = config.get('search.facets', 'groups tags res_format license').split()


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/lib/dictization/model_dictize.py
--- a/ckan/lib/dictization/model_dictize.py
+++ b/ckan/lib/dictization/model_dictize.py
@@ -186,6 +186,7 @@
     del result_dict['password']
     
     result_dict['display_name'] = user.display_name
+    result_dict['email_hash'] = user.email_hash
     result_dict['number_of_edits'] = user.number_of_edits()
     result_dict['number_administered_packages'] = user.number_administered_packages()
 


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/lib/helpers.py
--- a/ckan/lib/helpers.py
+++ b/ckan/lib/helpers.py
@@ -215,6 +215,12 @@
 def icon(name, alt=None):
     return literal('<img src="%s" height="16px" width="16px" alt="%s" /> ' % (icon_url(name), alt))
 
+def gravatar(email_hash, size=100):
+    return literal('''<a href="http://gravatar.com" target="_blank">
+      <img src="http://gravatar.com/avatar/%s?s=%d&d=mm" />
+    </a>''' % (email_hash, size))
+
+
 class Page(paginate.Page):
     
     # Curry the pager method of the webhelpers.paginate.Page class, so we have


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/model/user.py
--- a/ckan/model/user.py
+++ b/ckan/model/user.py
@@ -49,6 +49,14 @@
         if self.fullname is not None and len(self.fullname.strip()) > 0:
             return self.fullname
         return self.name
+
+    @property
+    def email_hash(self):
+        import hashlib
+        e = ''
+        if self.email:
+            e = self.email.strip().lower()
+        return hashlib.md5(e).hexdigest()
         
     def get_reference_preferred_for_uri(self):
         '''Returns a reference (e.g. name, id, openid) for this user


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/public/css/style.css
--- a/ckan/public/css/style.css
+++ b/ckan/public/css/style.css
@@ -554,6 +554,14 @@
   border-right: 1px solid #ccc; 
 }
 
+.gravatar {
+  border: 1px solid #777;
+  padding: 1px;
+  width: 120px;
+  height: 120px;
+  margin: 0 auto 10px auto;
+}
+
 /* ===================== */
 /* = Stateful stuff    = */
 /* ===================== */
@@ -1222,6 +1230,32 @@
   color: #000;
 }
 
+.top-bar {
+  width: 100%;
+  /* Old background was a little less intrusive */
+  background: #fcba63;
+  background: #b22;
+  text-align: center;
+  padding: 0;
+  border-bottom: 1px solid #faa;
+  font-weight: bold;
+}
+.top-bar-text {
+  line-height: 30px;
+  color: #fff;
+}
+.top-bar-text a {
+  color: #fff;
+  text-decoration: underline;
+}
+.top-bar button.js-kill-button {
+  float: right;
+  margin-right: 20px;
+  margin-top: 3px;
+  padding: 2px 8px;
+}
+
+
 /* ============================= */
 /* = Inline resource edit form = */
 /* ============================= */


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/public/scripts/application.js
--- a/ckan/public/scripts/application.js
+++ b/ckan/public/scripts/application.js
@@ -1,5 +1,7 @@
 (function ($) {
   $(document).ready(function () {
+    CKAN.Utils.isLoggedIn = Boolean($.cookie("ckan_display_name"));
+
     CKAN.Utils.setupUserAutocomplete($('input.autocomplete-user'));
     CKAN.Utils.setupAuthzGroupAutocomplete($('input.autocomplete-authzgroup'));
     CKAN.Utils.setupPackageAutocomplete($('input.autocomplete-dataset'));
@@ -18,20 +20,27 @@
       client: client
     };
 
+    var isFrontPage = $('body.index.home').length > 0;
     var isDatasetView = $('body.package.read').length > 0;
+    var isDatasetNew = $('body.package.new').length > 0;
+    var isGroupNew = $('body.group.new').length > 0;
+
+    // Two main entrance-points to the site:
+    if (!CKAN.Utils.isLoggedIn && (isFrontPage || isDatasetView)) {
+      CKAN.Utils.setupTopBar($('.top-bar'));
+    }
+
     if (isDatasetView) {
       var _dataset = new CKAN.Model.Dataset(preload_dataset);
       CKANEXT.DATAPREVIEW.setupDataPreview(_dataset);
     }
 
-    var isDatasetNew = $('body.package.new').length > 0;
     if (isDatasetNew) {
       // Set up magic URL slug editor
       CKAN.Utils.setupUrlEditor('package');
       $('#save').val(CKAN.Strings.addDataset);
       $("#title").focus();
     }
-    var isGroupNew = $('body.group.new').length > 0;
     if (isGroupNew) {
       // Set up magic URL slug editor
       CKAN.Utils.setupUrlEditor('group');
@@ -83,8 +92,16 @@
     var messageDiv = $('<div />').html(msg).addClass(category).hide();
     $('.flash-messages').append(messageDiv);
     messageDiv.show(1200);
+  };
 
-  };
+  // Animate the appearance of an element by expanding its height
+  my.animateHeight = function(element, animTime) {
+    if (!animTime) animTime = 350;
+    element.show();
+    var finalHeight = element.height();
+    element.height(0);
+    element.animate({height:finalHeight}, animTime);
+  }
 
   my.bindInputChanges = function(input, callback) {
     input.keyup(callback);
@@ -93,6 +110,24 @@
     input.change(callback);
   };
 
+  my.setupTopBar = function(topBar) {
+
+    var cookieName = 'ckan_killtopbar';
+    var delay = 600;
+    var animTime = 600;
+    var isKilled = ($.cookie(cookieName)!=null);
+    if (isKilled) return;
+
+    // Show the top bar after a short timeout
+    setTimeout("CKAN.Utils.animateHeight($('.top-bar'),"+animTime+")",delay);
+
+    // Bind to the close button
+    topBar.find('.js-kill-button').live('click', function() {
+      $.cookie(cookieName, 'true', { expires: 365 });
+      topBar.hide();
+    });
+  };
+
   my.setupUrlEditor = function(slugType,readOnly) {
     // Page elements to hook onto
     var titleInput = $('.js-title');


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/templates/layout_base.html
--- a/ckan/templates/layout_base.html
+++ b/ckan/templates/layout_base.html
@@ -46,6 +46,10 @@
 
 <body class="${request.environ.get('pylons.routes_dict', {}).get('action')} 
              ${request.environ.get('pylons.routes_dict', {}).get('controller').split(':')[-1]}">
+   <div class="top-bar" style="display: none;">
+     <span class="top-bar-text">First time at ${g.site_title}? Visit our <a href="${h.url_for(controller='home', action='about')}">About page</a> to find out more.</span>
+     <button class="pretty-button danger js-kill-button">x</button>
+  </div><div id="wrap"><div class="header outer"><header class="container">


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/templates/package/read.html
--- a/ckan/templates/package/read.html
+++ b/ckan/templates/package/read.html
@@ -18,13 +18,6 @@
   
   <py:match path="primarysidebar">
   
-    <li class="widget-container boxed widget_text" py:if="not c.hide_welcome_message">
-      <h3>First time at ${g.site_title}?</h3>        
-      <p>
-          ${g.site_title} is a catalogue for data. ${h.subnav_link(c, _('Click here to find out more ...'), controller='home', action='about', id=None)}
-      </p>
-    </li>
-
     <li class="widget-container widget_text"><ul class="property-list"><li py:if="c.pkg.url">


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/templates/user/layout.html
--- a/ckan/templates/user/layout.html
+++ b/ckan/templates/user/layout.html
@@ -6,11 +6,26 @@
   ><py:match path="minornavigation">
-    <ul class="tabbed" py:if="c.is_myself">
-      <li py:attrs="{'class':'current-tab'} if c.action=='read' else {}"><a href="${h.url_for(controller='user', action='read')}">My Profile</a></li>
-      <li py:attrs="{'class':'current-tab'} if c.action=='edit' else {}"><a href="${h.url_for(controller='user', action='edit')}">Edit Profile</a></li>
-      <li><a href="${h.url_for('/user/logout')}">Log out</a></li>
-    </ul>
+    <py:if test="c.is_myself">
+      <ul class="tabbed">
+        <li py:attrs="{'class':'current-tab'} if c.action=='read' else {}"><a href="${h.url_for(controller='user', action='read')}">My Profile</a></li>
+        <li py:attrs="{'class':'current-tab'} if c.action=='edit' else {}"><a href="${h.url_for(controller='user', action='edit')}">Edit Profile</a></li>
+        <li><a href="${h.url_for('/user/logout')}">Log out</a></li>
+      </ul>
+    </py:if>
+    <py:if test="not c.is_myself">
+      <py:if test="c.id">
+        <ul class="tabbed">
+          <li py:attrs="{'class':'current-tab'} if c.action=='read' else {}"><a href="${h.url_for(controller='user', action='read')}">View Profile</a></li>
+        </ul>
+      </py:if>
+      <py:if test="not c.id">
+        <ul class="tabbed">
+          <li py:attrs="{'class':'current-tab'} if c.action=='login' else {}"><a href="${h.url_for(controller='user', action='login')}">Login</a></li>
+          <li py:attrs="{'class':'current-tab'} if c.action=='register' else {}"><a href="${h.url_for('register')}">Register Account</a></li>
+        </ul>
+      </py:if>
+    </py:if></py:match>
   
 


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/templates/user/login.html
--- a/ckan/templates/user/login.html
+++ b/ckan/templates/user/login.html
@@ -34,10 +34,9 @@
         <input type="hidden" name="remember" value="1576800000" /><br/></fieldset>
-      ${h.submit('s', _('Login'))} — 
+      <input name="s" id="s" type="submit" class="pretty-button primary" value="Sign In"/>
+      — 
       <a href="${h.url_for('reset')}">Forgot your password?</a>
-      —
-      ${h.link_to(_('Not yet registered?'), h.url_for(action='register'))}
     </form><br/><!-- Simple OpenID Selector -->
@@ -66,7 +65,7 @@
         </p></div></fieldset>
-      <input id="openid_submit" type="submit" value="Sign in"/>
+      <input id="openid_submit" type="submit" class="pretty-button primary" value="Sign in with OpenID"/></form></div><xi:include href="layout.html" />


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/templates/user/logout.html
--- a/ckan/templates/user/logout.html
+++ b/ckan/templates/user/logout.html
@@ -4,8 +4,10 @@
   
   <py:def function="page_title">Logout - User</py:def>
 
+  <py:def function="page_title">Logout</py:def>
+  <py:def function="page_heading">Logout from ${g.site_title}</py:def>
+
   <div py:match="content">
-    <h2>Logout</h2><p>You have logged out successfully.</p></div>
 


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/templates/user/new_user_form.html
--- a/ckan/templates/user/new_user_form.html
+++ b/ckan/templates/user/new_user_form.html
@@ -45,5 +45,5 @@
         </dd></dl>
-  <input id="save" name="save" type="submit" value="Register now »" />
+  <input id="save" name="save" type="submit" class="pretty-button primary" value="Register now »" /></form>


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/templates/user/read.html
--- a/ckan/templates/user/read.html
+++ b/ckan/templates/user/read.html
@@ -7,6 +7,9 @@
   <py:def function="body_class">user-view</py:def><py:match path="primarysidebar">
+    <div class="gravatar">
+      ${h.gravatar(c.user_dict['email_hash'],120)}
+    </div><li class="widget-container widget_text" py:if="not c.hide_welcome_message"><h3>Activity</h3><ul>


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/templates/user/request_reset.html
--- a/ckan/templates/user/request_reset.html
+++ b/ckan/templates/user/request_reset.html
@@ -14,7 +14,7 @@
         <input name="user" value="" /><br/></fieldset><div>
-        ${h.submit('reset', _('Reset password'))}
+        <input type="submit" id="reset" name="reset" class="pretty-button primary" value="Reset Password" /></div></form></div>


diff -r 0590a1ed6271f10c1b0e00fcd7f9bf4f9494fad1 -r 834fd3c220c89f97b5d3a3206ddd3bf15c824b23 ckan/tests/lib/test_helpers.py
--- a/ckan/tests/lib/test_helpers.py
+++ b/ckan/tests/lib/test_helpers.py
@@ -50,3 +50,15 @@
         two_months_ago_str = h.datetime_to_date_str(two_months_ago)
         res = h.time_ago_in_words_from_str(two_months_ago_str)
         assert_equal(res, '2 months')
+
+    def test_gravatar(self):
+        email = 'zephod at gmail.com'
+        expected =['<a href="http://gravatar.com" target="_blank">', '<img src="http://gravatar.com/avatar/7856421db6a63efa5b248909c472fbd2?s=200&d=mm" />', '</a>']
+        # Hash the email address
+        import hashlib
+        email_hash = hashlib.md5(email).hexdigest()
+        res = h.gravatar(email_hash, 200)
+        for e in expected:
+            assert e in res, e
+
+

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list