[ckan-changes] commit/ckanextiati: 4 new changesets

Bitbucket commits-noreply at bitbucket.org
Wed Jun 8 13:34:35 UTC 2011


4 new changesets in ckanextiati:

http://bitbucket.org/okfn/ckanextiati/changeset/5bc0b9caf9af/
changeset:   5bc0b9caf9af
user:        sebbacon
date:        2011-06-08 09:54:55
summary:     new home page
affected #:  37 files (1.1 MB)
Diff too large to display.
http://bitbucket.org/okfn/ckanextiati/changeset/7b27f4b3966b/
changeset:   7b27f4b3966b
user:        sebbacon
date:        2011-06-08 10:09:25
summary:     introduce third party file previewer
affected #:  2 files (303 bytes)

--- a/templates/package/read.html	Wed Jun 08 08:54:55 2011 +0100
+++ b/templates/package/read.html	Wed Jun 08 09:09:25 2011 +0100
@@ -3,7 +3,7 @@
   xmlns:xi="http://www.w3.org/2001/XInclude"
   py:strip="">
 
-  <py:def function="page_title">${c.pkg.title or c.pkg.name} - Data Packages</py:def>
+  <py:def function="page_title">${c.pkg.title or c.pkg.name} - IATI Files</py:def><py:match path="primarysidebar"><div class="box">


--- a/templates/package/read_core.html	Wed Jun 08 08:54:55 2011 +0100
+++ b/templates/package/read_core.html	Wed Jun 08 09:09:25 2011 +0100
@@ -43,7 +43,7 @@
             <td><a href="${res.url}" target="_blank">Download</a></td><td>${res.format}</td><td py:if="'iati:preview:%s' % res.id in c.pkg.extras.keys()">
-                <a href="javascript:{$('.iati_preview').not('#iati_preview_${res.id}').hide(); $('#iati_preview_${res.id}').toggle();}">preview</a>
+                <a href="javascript:window.open('http://dev.yipl.com.np/iati/tools/public/api/activityviewer?xmlUrl=${res.url}', 'preview', 'location=0,status=0,width=960,height=535')">preview</a></td></tr></py:for>
@@ -51,15 +51,6 @@
       <table py:otherwise=""><tr><th>Resources</th><td>None given for this package.</td></tr></table></py:choose>
       
-      <py:for each="(key, value) in c.pkg.extras.items()">
-        <py:if test="key.startswith('iati:preview:')">
-          <div id="iati_preview_${key.split('iati:preview:')[-1]}" class="iati_preview">
-            <h4>Record preview</h4>
-            ${h.literal(value if value else " ")}
-          </div>
-        </py:if>
-      </py:for>
-    
     <py:def function="details_item(label, value)"><tr py:if="value is not None and len(value) > 0"><td class="package-label">


http://bitbucket.org/okfn/ckanextiati/changeset/4eefd28df680/
changeset:   4eefd28df680
user:        sebbacon
date:        2011-06-08 11:13:55
summary:     update publisher (groups) page with lots of new extras
affected #:  7 files (4.9 KB)

--- a/ckanext/iati/forms/group.py	Wed Jun 08 09:09:25 2011 +0100
+++ b/ckanext/iati/forms/group.py	Wed Jun 08 10:13:55 2011 +0100
@@ -9,62 +9,48 @@
 import ckan.forms.common as common
 import ckan.forms.group as group
 from ckan.forms.common import ExtrasField, PackageNameField, SelectExtraField
-from ckan.forms.common import TextExtraField
+from ckan.forms.common import TextAreaExtraField
 from ckan.lib.helpers import literal
 
+from group_schema import fields
+
+
 __all__ = ['get_group_dict', 'edit_group_dict']
 
 
-
 def build_group_form(is_admin=False, with_packages=False):
-    
     PUBLISHER_TYPES = [_("Donor"),
                        _("Recipient"),
                        _("Community")]
-
-    publisher_record_fields = (('publisher_contact',
-                               'Contact',
-                               'Email or URL for publisher'),
-                               ('publisher_description',
-                               'Description',
-                               "General description of Publisher's role and activities"),
-                               ('publisher_agencies',
-                               'Organisations / agencies covered',
-                               'Whose activities does this publisher publish?'),
-                               ('publisher_timeliness',
-                               'Timeliness of Data',
-                               'How up do date is the data when published?'),
-                               ('publisher_frequency',
-                               'Frequency of publication',
-                               'How often is IATI data refreshed?  Monthly/Quarterly?'),
-                               )
-    
+    publisher_record_fields = fields
     builder = FormBuilder(model.Group)
-    builder.set_field_text('name', 'Unique Name (required)', 
+    builder.set_field_text('name', 'Unique Name (required)',
             literal("<br/><strong>Unique identifier</strong> for group.<br/>2+ chars, lowercase, using only 'a-z0-9' and '-_'"))
     builder.set_field_option('name', 'validate', common.group_name_validator)
-    builder.set_field_option('state', 'dropdown', {'options':model.State.all})
-    builder.add_field(SelectExtraField('type', options=PUBLISHER_TYPES, allow_empty=False))
+    builder.set_field_option('state', 'dropdown', {'options': model.State.all})
+    builder.add_field(SelectExtraField('type',
+                                       options=PUBLISHER_TYPES,
+                                       allow_empty=False))
     builder.set_field_text('type', 'Type')
     for name, title, description in publisher_record_fields:
-        builder.add_field(TextExtraField(name))
+        builder.add_field(TextAreaExtraField(name))
         builder.set_field_text(name, title, description)
-
-    displayed_fields = ['name', 'title', 'type',] + [x[0] for x in publisher_record_fields]
-    
+    displayed_fields = ['name', 'title', 'type'] +\
+                       [x[0] for x in publisher_record_fields]
     from ckan.authz import Authorizer
     from ckan.lib.base import c
     if Authorizer.is_sysadmin(c.user):
         displayed_fields.append('state')
 
-    
     if with_packages:
         builder.add_field(group.PackagesField('packages'))
         displayed_fields.append('packages')
     builder.set_displayed_fields(OrderedDict([('Details', displayed_fields)]))
     builder.set_label_prettifier(common.prettify)
-    return builder  
+    return builder
+
 
 def get_group_fieldset(is_admin=False, combined=False):
-    return build_group_form(is_admin=is_admin, with_packages=combined).get_fieldset()
-   
+    return build_group_form(is_admin=is_admin,
+                            with_packages=combined).get_fieldset()
+


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ckanext/iati/forms/group_schema.py	Wed Jun 08 10:13:55 2011 +0100
@@ -0,0 +1,44 @@
+fields = (('publisher_contact',
+           'Contact',
+           'Email or URL for publisher'),
+          ('publisher_description',
+           'Description',
+           "General description of Publisher's role and activities"),
+          ('publisher_agencies',
+           'Organisations / agencies covered',
+           'Whose activities does this publisher publish?'),
+          ('publisher_timeliness',
+           'Timeliness of Data',
+           'How up do date is the data when published?'),
+          ('publisher_frequency',
+           'Frequency of publication',
+           'How often is IATI data refreshed?  Monthly/Quarterly?'),
+          ('publisher_units',
+           'Units of Aid',
+           'A description of any hierarchical reporting units used and how they are applied'),
+          ('publisher_segmentation',
+           'Segmentation of Published Data',
+           'Is IATI data published by country, regions?'),
+          ('publisher_refs',
+           'Data Definitions and References',
+           "Links to guides, explanations, codelists on the publisher's own site that clarify their data"),
+          ('publisher_field_exclusions',
+           'Field Exclusions',
+           'What fields does the publisher never use - and for what reason'),
+          ('publisher_record_exclusions',
+           'Record Exclusions',
+           "What are the policies for excluding particular activities, or parts of an activity's data?"),     
+          ('publisher_thresholds',
+           'Thresholds',
+           'What are the thresholds below which data or whole activities are not published?'),
+          ('publisher_constraints',
+           'Other Constraints',
+           'Other policies that restrict full compliance with the standard'),
+          ('publisher_data_quality',
+           'Data Quality',
+           "Publisher's comment on the status and accuracyof the data - audited/verified, operational/sub to change, etc"),
+          ('publisher_ui',
+           'User Interface',
+           "Link to publisher's own public user activity interface"),
+          )
+publisher_record_fields = fields


--- a/ckanext/iati/patch.py	Wed Jun 08 09:09:25 2011 +0100
+++ b/ckanext/iati/patch.py	Wed Jun 08 10:13:55 2011 +0100
@@ -4,6 +4,8 @@
 
 from ckan.model import Package
 
+from ckanext.iati.forms.group_schema import fields
+
 log = logging.getLogger(__name__)
 
 ######### 
@@ -44,5 +46,6 @@
 h.am_authorized_with_publisher = am_authorized_with_publisher
 h.country_name = country_name
 h.group_title = group_title
+h.publisher_record_fields = fields
 
 


--- a/public/css/overrides.css	Wed Jun 08 09:09:25 2011 +0100
+++ b/public/css/overrides.css	Wed Jun 08 10:13:55 2011 +0100
@@ -277,4 +277,4 @@
   margin-bottom:-45px;
   z-index:999;
   text-align:center;
-}
\ No newline at end of file
+}


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public/scripts/jquery.linkify-1.0-min.js	Wed Jun 08 10:13:55 2011 +0100
@@ -0,0 +1,3 @@
+// encoding: utf-8
+// $.fn.linkify 1.0 - MIT/GPL Licensed - More info: http://github.com/maranomynet/linkify/
+(function(b){var x=/(^|["'(\s]|<)(www\..+?\..+?)((?:[:?]|\.+)?(?:\s|$)|>|[)"',])/g,y=/(^|["'(\s]|<)((?:(?:https?|ftp):\/\/|mailto:).+?)((?:[:?]|\.+)?(?:\s|$)|>|[)"',])/g,z=function(h){return h.replace(x,'$1<a href="<``>://$2">$2</a>$3').replace(y,'$1<a href="$2">$2</a>$3').replace(/"<``>/g,'"http')},s=b.fn.linkify=function(c){if(!b.isPlainObject(c)){c={use:(typeof c=='string')?c:undefined,handleLinks:b.isFunction(c)?c:arguments[1]}}var d=c.use,k=s.plugins||{},l=[z],f,m=[],n=c.handleLinks;if(d==undefined||d=='*'){for(var i in k){l.push(k[i])}}else{d=b.isArray(d)?d:b.trim(d).split(/ *, */);var o,i;for(var p=0,A=d.length;p<A;p++){i=d[p];o=k[i];if(o){l.push(o)}}}this.each(function(){var h=this.childNodes,t=h.length;while(t--){var e=h[t];if(e.nodeType==3){var a=e.nodeValue;if(a.length>1&&/\S/.test(a)){var q,r;f=f||b('<div/>')[0];f.innerHTML='';f.appendChild(e.cloneNode(false));var u=f.childNodes;for(var v=0,g;(g=l[v]);v++){var w=u.length,j;while(w--){j=u[w];if(j.nodeType==3){a=j.nodeValue;if(a.length>1&&/\S/.test(a)){r=a;a=a.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');a=b.isFunction(g)?g(a):a.replace(g.re,g.tmpl);q=q||r!=a;r!=a&&b(j).after(a).remove()}}}}a=f.innerHTML;if(n){a=b('<div/>').html(a);m=m.concat(a.find('a').toArray().reverse());a=a.contents()}q&&b(e).after(a).remove()}}else if(e.nodeType==1&&!/^(a|button|textarea)$/i.test(e.tagName)){arguments.callee.call(e)}}});n&&n(b(m.reverse()));return this};s.plugins={mailto:{re:/(^|["'(\s]|<)([^"'(\s&]+?@.+\.[a-z]{2,7})(([:?]|\.+)?(\s|$)|>|[)"',])/gi,tmpl:'$1<a href="mailto:$2">$2</a>$3'}}})(jQuery);


--- a/templates/group/layout.html	Wed Jun 08 09:09:25 2011 +0100
+++ b/templates/group/layout.html	Wed Jun 08 10:13:55 2011 +0100
@@ -5,6 +5,25 @@
   xmlns:xi="http://www.w3.org/2001/XInclude"
   py:strip=""
   >
+  
+  <py:def function="optional_head()">
+  <script src="/scripts/jquery.linkify-1.0-min.js"></script>
+  <script>
+    $(document).ready(function(){
+      $('#publisher-info').linkify();
+    });
+  </script>
+  <style>
+    form#group-edit input[type=text],
+    form#group-edit textarea {
+     width: 100%;
+    }
+    #publisher-info dd,
+    #publisher-info dl {
+     margin: 0;
+    }
+  </style>
+  </py:def><py:match path="primarysidebar"><div class="box">
@@ -20,18 +39,12 @@
       
     </div>
 
-    <div class="box">
+    <div class="box" id="publisher-info"><h2>About this publisher</h2><p>
-	<dl>
-	  <dt>Contact</dt>
-	  <dd>${c.group.extras.get('publisher_contact', 'n/a')}</dd>
-	  <dt>Description</dt>
-	  <dd>${c.group.extras.get('publisher_description', 'n/a')}</dd>
-	  <dt>Organisations / agencies covered</dt>
-	  <dd>${c.group.extras.get('publisher_agencies', 'n/a')}</dd>
-	  <dt>Timeliness of data</dt>
-	  <dd>${c.group.extras.get('publisher_timeliness', 'n/a')}</dd>
+	<dl py:for="(field_id, field_title, description) in h.publisher_record_fields">
+	  <dt>${field_title}</dt>
+	  <dd>${c.group.extras.get(field_id, 'n/a').strip() or 'n/a'}</dd></dl></p>
       


--- a/templates/layout_base.html	Wed Jun 08 09:09:25 2011 +0100
+++ b/templates/layout_base.html	Wed Jun 08 10:13:55 2011 +0100
@@ -42,7 +42,6 @@
     $(document).ready(function() {
         var ckan_user = $.cookie("ckan_display_name");
         if (ckan_user) {
-            ckan_user = eval(ckan_user); // get rid of spurious quotes
             $("#ckan_user_name")[0].innerHTML = ckan_user;
             $(".ckan_logged_out").hide();
             $(".ckan_logged_in").show();
@@ -192,7 +191,7 @@
   <script src='http://www.google-analytics.com/ga.js' type='text/javascript'></script><script type="text/javascript">
   try {
-  var pageTracker = _gat._getTracker("UA-8271754-2");
+  var pageTracker = _gat._getTracker("UA-6109435-12");
   pageTracker._setDomainName(".ckan.net");
   pageTracker._trackPageview();
   } catch(err) {}


http://bitbucket.org/okfn/ckanextiati/changeset/deaee51567ee/
changeset:   deaee51567ee
user:        sebbacon
date:        2011-06-08 15:33:13
summary:     set default license on package (based on group license; new analytics code
affected #:  4 files (1.5 KB)

--- a/ckanext/iati/forms/group.py	Wed Jun 08 10:13:55 2011 +0100
+++ b/ckanext/iati/forms/group.py	Wed Jun 08 14:33:13 2011 +0100
@@ -32,10 +32,15 @@
                                        options=PUBLISHER_TYPES,
                                        allow_empty=False))
     builder.set_field_text('type', 'Type')
+    
+    builder.add_field(SelectExtraField('license_id',
+                                       options=[('', None)] + model.Package.get_license_options()))
+    builder.set_field_text('license_id', _('License'))
+
     for name, title, description in publisher_record_fields:
         builder.add_field(TextAreaExtraField(name))
         builder.set_field_text(name, title, description)
-    displayed_fields = ['name', 'title', 'type'] +\
+    displayed_fields = ['name', 'title', 'type', 'license_id'] +\
                        [x[0] for x in publisher_record_fields]
     from ckan.authz import Authorizer
     from ckan.lib.base import c


--- a/ckanext/iati/forms/package.py	Wed Jun 08 10:13:55 2011 +0100
+++ b/ckanext/iati/forms/package.py	Wed Jun 08 14:33:13 2011 +0100
@@ -1,4 +1,3 @@
-# -*- coding: UTF-8 -*-
 import formalchemy
 from formalchemy import helpers as h
 from sqlalchemy.util import OrderedDict
@@ -49,7 +48,7 @@
         def _serialized_value(self):
             param_val = self.params.get(self.name, u'')
             return [v.strip()for v in param_val.split(',') if len(v.strip())]
-            
+
         def deserialize(self):
             return self._serialized_value()
 
@@ -186,9 +185,9 @@
     
     #Licence    
     builder.set_field_text('license_id', _('License'))
-    
+
     #Resource format    
-    #Resource URL    
+    #Resource URL     
     #Resource ID    
     #  -- do we have an ID? 
     


--- a/ckanext/iati/patch.py	Wed Jun 08 10:13:55 2011 +0100
+++ b/ckanext/iati/patch.py	Wed Jun 08 14:33:13 2011 +0100
@@ -1,7 +1,10 @@
 import logging
+import re
+
 from forms.countries import COUNTRIES
 import ckan.lib.helpers as h
-
+import ckan.authz as authz
+from ckan.lib.base import *
 from ckan.model import Package
 
 from ckanext.iati.forms.group_schema import fields
@@ -41,11 +44,24 @@
     if q.count() < 1:
         return False
     return True
-    
+
+def my_group():
+    authzgroups = model.User.by_name(c.user).authorization_groups
+    authzgroup = authzgroups and authzgroups[0]
+    if authzgroup:
+        group_id = re.match(r"group-(.*)-authz", authzgroup.name).group(1)
+        group = model.Session.query(model.Group).filter_by(id=group_id).first()
+        return group
+
+def my_group_license():
+    group = my_group()
+    return group and group.extras.get('license_id', '')
+
 
 h.am_authorized_with_publisher = am_authorized_with_publisher
 h.country_name = country_name
 h.group_title = group_title
 h.publisher_record_fields = fields
+h.my_group = my_group
+h.my_group_license = my_group_license
 
-


--- a/templates/layout_base.html	Wed Jun 08 10:13:55 2011 +0100
+++ b/templates/layout_base.html	Wed Jun 08 14:33:13 2011 +0100
@@ -39,6 +39,7 @@
   <script type="text/javascript" src="/scripts/application.js"></script><script type="text/javascript">
+  //<![CDATA[
     $(document).ready(function() {
         var ckan_user = $.cookie("ckan_display_name");
         if (ckan_user) {
@@ -47,6 +48,14 @@
             $(".ckan_logged_in").show();
         }
     });
+
+    $(document).ready(function(){
+      var license_selector = $('#package-edit dd select[id*="license_id"]')
+      if (license_selector && !license_selector.val()) {
+        license_selector.val("${h.my_group_license()}")
+       }
+    });
+  //]]></script><py:if test="defined('optional_head')">
     ${optional_head()}
@@ -197,7 +206,22 @@
   } catch(err) {}
   </script><!-- /Google Analytics -->
+  <!-- Start of Woopra Code -->
+  <script type="text/javascript">
+  var woo_settings = {idle_timeout:'300000', domain:'iatiregistry.org'};
+  (function(){
+  var wsc = document.createElement('script');
+  wsc.src = document.location.protocol+'//static.woopra.com/js/woopra.js';
+  wsc.type = 'text/javascript';
+  wsc.async = true;
+  var ssc = document.getElementsByTagName('script')[0];
+  ssc.parentNode.insertBefore(wsc, ssc);
+  })();
+  </script>
+<!-- End of Woopra Code -->
+
 </py:if>
+
 ${getattr(g, 'template_footer_end', '')}
 </body></html>

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

--

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