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

Bitbucket commits-noreply at bitbucket.org
Thu Jun 23 14:55:27 UTC 2011


10 new changesets in ckanextiati:

http://bitbucket.org/okfn/ckanextiati/changeset/050790657fb7/
changeset:   050790657fb7
user:        amercader
date:        2011-06-20 13:09:06
summary:     Update API link to make it work with latest CKAN version
affected #:  1 file (322 bytes)

--- a/templates/package/read.html	Fri Jun 17 12:31:56 2011 +0100
+++ b/templates/package/read.html	Mon Jun 20 12:09:06 2011 +0100
@@ -28,7 +28,12 @@
         <p>Alternative metadata formats</p><ul class="clearfix"><li>
-            <a href="${h.url_for(controller='rest', register='package', action='show', id=c.pkg.name)}">JSON</a>
+                <py:if test="config.get('ckan.api_url')">
+                  <a href="${config.get('ckan.api_url') + h.url_for(controller='api', register='package', action='show', id=c.pkg.name)}">JSON</a>
+                </py:if>
+                <py:if test="not config.get('ckan.api_url')">
+                  <a href="${h.url_for(controller='api', register='package', action='show', id=c.pkg.name)}">JSON</a>
+                </py:if></li><li py:if="config.get('rdf_packages')"><a href="${config.get('rdf_packages') + c.pkg.name}">RDF</a>


http://bitbucket.org/okfn/ckanextiati/changeset/9ee9d1e0d0b2/
changeset:   9ee9d1e0d0b2
user:        amercader
date:        2011-06-20 13:57:47
summary:     Move resources to source to enable packaging. Also put theme in a plugin.
affected #:  107 files (833.8 KB)
Diff too large to display.
http://bitbucket.org/okfn/ckanextiati/changeset/53564f4ae842/
changeset:   53564f4ae842
user:        amercader
date:        2011-06-21 14:47:52
summary:     Show metadata, download and preview links on package results (action #21)
affected #:  5 files (2.6 KB)

--- a/ckanext/iati/public/css/ckan.master.css	Mon Jun 20 12:57:47 2011 +0100
+++ b/ckanext/iati/public/css/ckan.master.css	Tue Jun 21 13:47:52 2011 +0100
@@ -387,4 +387,3 @@
   font-style: italic;
 }
 
- at import url(extra.css);


--- a/ckanext/iati/public/css/iati.css	Mon Jun 20 12:57:47 2011 +0100
+++ b/ckanext/iati/public/css/iati.css	Tue Jun 21 13:47:52 2011 +0100
@@ -282,6 +282,11 @@
 	margin-bottom: 0.0em;
 }
 
+.package-result-links {
+    margin-top: 0.5em;
+    font-size: 0.9em;
+}
+
 .iati_preview {
 	display: none; 
 }


--- a/ckanext/iati/templates/_util_local.html	Mon Jun 20 12:57:47 2011 +0100
+++ b/ckanext/iati/templates/_util_local.html	Tue Jun 21 13:47:52 2011 +0100
@@ -5,132 +5,58 @@
   py:strip=""
   >
 
-  <!--! Herein can be found generic helper methods for a whole bunch of common
-        templating issues -->
-
-  <!--! plural(n, s, p): takes a number, a singular form and a plural form,
-        returning the appropriate form on the basis of the number specified -->
-  <py:def function="plural(num, s, p)" py:choose="num">
-    <py:when test="1">${s}</py:when>
-    <py:otherwise>${p}</py:otherwise>
-  </py:def>
-
-  <!--! nonempty(val, default): takes a variable string, and returns it or a
-        fallback 'default' string if it's blank -->
-  <py:def function="nonempty(val, default)" py:choose="val">
-    <py:when test="str(val).strip()">${val}</py:when>
-    <py:otherwise>${default}</py:otherwise>
-  </py:def>
-
-  <!--! List of tags: pass in a collection of tags and this renders the standard
-        tag listing -->
-  <ul py:def="tag_list(tags)" class="tags clearfix">
-    <li py:for="tag in tags">
-      ${h.link_to(tag.name, h.url_for(controller='tag', action='read', id=tag.name))}
-    </li>
-    <p py:if="not tags">No results</p>
-  </ul>
-
   <!--! List of packages: pass in a collection of tags and this renders the
         standard package listing -->
-  <ul py:def="package_list(packages)" class="packages">
+  <ul py:def="package_list_local(packages)" class="packages"><li py:for="package in packages"
         class="${'fullyopen' if (package.isopen() and package.resources) else None}"><div class="header"><span class="title">
 				${h.link_to(package.title or package.name, h.url_for(controller='package', action='read', id=package.name))}
 			</span>
-		</div>
-		<div class="extract">
-			${h.markdown_extract(package.notes)}
-		</div>
-		
-		${package_license_icon(package)}
-		<span class="name">
-		 	<b>${package.name}</b>
-		 	
-    		<py:if test="len(package.groups)">
-    		    · published by ${package.groups[0].title}
-    		</py:if>
-    		<py:if test="'country' in package.extras.keys()">
-    		    · ${h.country_name(package.extras.get('country'))}
-    		</py:if>
-    		<py:if test="'record_updated' in package.extras.keys()">
-    		    · updated ${package.extras.get('record_updated')}
-    		</py:if>
-		</span>
-		
-		<py:if test="package.license">
-		    <span class="license">
-		        ·
-			    ${package.license.title.split('::')[-1]}
-		    </span>
-		</py:if>
-        <!--ul py:if="package.tags" class="tags">
-          <li py:for="tag in package.tags">${tag.name}</li>
-        </ul-->
+			
+			<div class="search_meta">
+        <py:if test="package.resources">
+          <ul class="package_formats">
+            <py:for each="resource in package.resources">
+              <py:if test="resource.format and not resource.format == ''">
+                <li>${resource.format}</li>
+              </py:if>
+            </py:for>
+          </ul>
+        </py:if>
+        <ul class="openness">
+          <py:if test="package.isopen()">
+            <li>
+              <a href="http://opendefinition.org/okd/" title="This package satisfies the Open Definition.">
+                  <img src="http://assets.okfn.org/images/ok_buttons/od_80x15_blue.png" alt="[Open Data]" />
+              </a>
+            </li>
+            <li>
+              <a href="http://opendefinition.org/okd/" title="This package satisfies the Open Definition.">
+                  <img src="http://assets.okfn.org/images/ok_buttons/oc_80x15_blue.png" alt="[Open Content]" />
+              </a>
+            </li>
+          </py:if>
+          <py:if test="not package.isopen()">
+            <li>
+              <span class="closed">
+                ${h.icon('lock')} Not Openly Licensed
+              </span>
+            </li>
+          </py:if>
+        </ul>
+      </div>
+    </div>
+	<div class="package-result-links">
+        ${h.link_to('View Metadata', h.url_for(controller='package', action='read', id=package.name))} |
+        <py:if test="package.resources">
+            ${h.link_to('Download file', package.resources[0].url)} |
+            <py:if test="'iati:preview:%s' % package.resources[0].id in package.extras.keys()">
+                <a href="javascript:window.open('http://dev.yipl.com.np/iati/tools/public/api/activityviewer?xmlUrl=${package.resources[0].url}', 'preview', 'location=0,status=0,width=960,height=535')">Preview file</a>
+            </py:if>
+        </py:if>
+    </div></li>
-    <p py:if="not packages">No results</p></ul>
-
-  <!--! List of groups: pass in a collection of groups and this renders the
-        standard group listing -->
-  <table py:def="group_list(groups)" class="groups">
-    <tr><th>Title</th><th>Number of packages</th><th>Description</th></tr>
-    <py:for each="group in groups">
-    <tr>
-      <td><a href="${h.url_for(controller='group', action='read', id=group.name)}">${group.title}</a></td>
-      <td>${len(group.packages)}</td>
-      <td>${h.truncate(group.description, length=80, whole_word=True)}</td>
-    </tr>
-    </py:for>
-  </table>
-
-  <!--! Package openness icons -->
-  <img py:def="package_license_icon(package)"
-    src="/images/icons/door_${'open' if package.isopen() else 'grey'}.png"
-    title="License: ${package.license.title if hasattr(package.license, 'title') else '?'}"
-    alt="${'OPEN' if package.isopen() else 'CLOSED'}" />
-
-  <py:def function="package_resources_icon(package)" py:choose="">
-    <a py:when="package.resources"
-       href="${h.url_for(controller='package', action='read', id=package.name, anchor='resources')}">
-      <img src="${h.icon_url('arrow_down')}" title="View package resources" alt="DOWNLOAD" />
-    </a>
-
-    <img py:otherwise="" src="${h.icon_url('arrow_down_grey')}" title="No downloadable resources." alt="" />
-  </py:def>
-
-  <!--! Used by group listing -->
-  <py:def function="package_summary(pkg)">
-      <a href="${h.url_for(controller='package', action='read', id=pkg.name)}">
-         ${pkg.name} - ${pkg.title}
-      </a>
-  </py:def>
-
-  <div py:def="package_rating(pkg)" class="rating-group">
-    <py:choose test="">
-      <div py:when="c.num_ratings" class="inline-rating">
-        <ul class="stars default${'%i' % (c.current_rating or 0)}star">
-          <li class="${name}" py:for="number,name in enumerate(['one', 'two', 'three', 'four', 'five'])"></li>
-        </ul>
-        ${'%0.1f (%i rating%s)' % (c.current_rating, c.num_ratings, ('s' if c.num_ratings != 1 else ''))}
-      </div>
-      <py:otherwise>no ratings yet</py:otherwise>
-    </py:choose>
-
-    –
-    rate it now
-
-    <div class="inline-rating">
-    <ul class="stars default0star">
-      <py:for each="number,name in zip(range(1,6), ['one', 'two', 'three', 'four', 'five'])">
-      <li class="${name}">
-      <a href="${h.url_for(controller='package',action='rate',id=c.pkg.name,rating=number)}" title="${number} Star">${number}</a>
-      </li>
-      </py:for>
-    </ul>
-    </div>
-  </div><!--! /rating-group -->
-
 </html>


--- a/ckanext/iati/templates/layout_base.html	Mon Jun 20 12:57:47 2011 +0100
+++ b/ckanext/iati/templates/layout_base.html	Tue Jun 21 13:47:52 2011 +0100
@@ -39,7 +39,6 @@
 
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script><script src="http://assets.okfn.org/ext/jquery.cookie/jquery.cookie.min.js"></script>
-  <script type="text/javascript" src="/scripts/application.js"></script><script type="text/javascript">
   //<![CDATA[


--- a/ckanext/iati/templates/package/search.html	Mon Jun 20 12:57:47 2011 +0100
+++ b/ckanext/iati/templates/package/search.html	Tue Jun 21 13:47:52 2011 +0100
@@ -24,7 +24,7 @@
       <py:if test="c.q"><h4 i18n:msg="item_count"><strong>${c.page.item_count}</strong> packages found</h4></py:if>
-      ${package_list(c.page.items)}
+      ${package_list_local(c.page.items)}
       ${c.page.pager(q=c.q)}
 
   </div>


http://bitbucket.org/okfn/ckanextiati/changeset/ef9380190b50/
changeset:   ef9380190b50
user:        amercader
date:        2011-06-21 15:15:57
summary:     Open file preview via target=_blank, as opening via javascript gives problems in
Firefox. Also make the URL configurable.
affected #:  3 files (267 bytes)

--- a/README.txt	Tue Jun 21 13:47:52 2011 +0100
+++ b/README.txt	Tue Jun 21 14:15:57 2011 +0100
@@ -43,6 +43,9 @@
 # Approval message sender email: 
 iati.email = activation at iatiregistry.org 
 
+# File preview service URL (notice the token that will be replaced with the file URL):
+iati.preview_service = http://dev.yipl.com.np/iati/tools/public/api/activityviewer?xmlUrl=%s
+
 # Custom package and group form:
 package_form = iati_package
 group_form = iati_group


--- a/ckanext/iati/templates/_util_local.html	Tue Jun 21 13:47:52 2011 +0100
+++ b/ckanext/iati/templates/_util_local.html	Tue Jun 21 14:15:57 2011 +0100
@@ -51,9 +51,9 @@
 	<div class="package-result-links">
         ${h.link_to('View Metadata', h.url_for(controller='package', action='read', id=package.name))} |
         <py:if test="package.resources">
-            ${h.link_to('Download file', package.resources[0].url)} |
-            <py:if test="'iati:preview:%s' % package.resources[0].id in package.extras.keys()">
-                <a href="javascript:window.open('http://dev.yipl.com.np/iati/tools/public/api/activityviewer?xmlUrl=${package.resources[0].url}', 'preview', 'location=0,status=0,width=960,height=535')">Preview file</a>
+            ${h.link_to('Download file', package.resources[0].url,target='_blank')} |
+            <py:if test="'iati:preview:%s' % package.resources[0].id in package.extras.keys() and config.get('iati.preview_service','')">
+                ${h.link_to('Preview file',  config.get('iati.preview_service') % package.resources[0].url, target='_blank')}
             </py:if></py:if></div>


--- a/ckanext/iati/templates/package/read_core.html	Tue Jun 21 13:47:52 2011 +0100
+++ b/ckanext/iati/templates/package/read_core.html	Tue Jun 21 14:15:57 2011 +0100
@@ -42,8 +42,8 @@
           <tr><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: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 py:if="'iati:preview:%s' % res.id in c.pkg.extras.keys() and config.get('iati.preview_service','')">
+                ${h.link_to('preview',  config.get('iati.preview_service') % res.url, target='_blank')}
             </td></tr></py:for>


http://bitbucket.org/okfn/ckanextiati/changeset/3718600933e8/
changeset:   3718600933e8
user:        amercader
date:        2011-06-22 12:17:41
summary:     Preserve facets when doing a query and order lists alphabetically (actions #17 and #18)
affected #:  1 file (470 bytes)

--- a/ckanext/iati/templates/package/search_form.html	Tue Jun 21 14:15:57 2011 +0100
+++ b/ckanext/iati/templates/package/search_form.html	Wed Jun 22 11:17:41 2011 +0100
@@ -2,10 +2,25 @@
   <input type="search" class="search" name="q" value="${c.q}" /><?python
-    any = [('', 'Any')]
-    country_options = any + [(o, h.country_name(o) + " (%s)" % n) for o, n in c.facets.get('extras_country', {}).items()]
-    groups_options = any + [(o, h.group_title(o) + " (%s)" % n) for o, n in c.facets.get('groups', {}).items()]
-    types_options = any + [(o, o + " (%s)" % n) for o, n in c.facets.get('groups_types', {}).items()]
+    from ckan.lib.search import query_for, SearchError
+    from ckan.model import Package
+
+    global_query = query_for(Package)
+    global_query.run(facet_by=g.facets)
+    global_facets = global_query.facets
+
+    any = ('', 'Any')
+    country_options = [(o, h.country_name(o) + " (%s)" % n) for o, n in global_facets.get('extras_country', {}).items()]
+    groups_options = [(o, h.group_title(o) + " (%s)" % n) for o, n in global_facets.get('groups', {}).items()]
+    types_options = [(o, h.type_title(o) + " (%s)" % n) for o, n in global_facets.get('groups_types', {}).items()]
+
+    country_options.sort(key=lambda name: name[1])
+    country_options.insert(0,any)
+    groups_options.sort(key=lambda name: name[1])
+    groups_options.insert(0,any)
+    types_options.sort(key=lambda name: name[1])
+    types_options.insert(0,any)
+
   ?><table border="0" class="facets"><tr>


http://bitbucket.org/okfn/ckanextiati/changeset/905ef3ed8ef6/
changeset:   905ef3ed8ef6
user:        amercader
date:        2011-06-22 12:23:01
summary:     Use * to distinguish 'Any' from 'Not assigned'. The search for not assigned still does not work though
affected #:  3 files (271 bytes)

--- a/ckanext/iati/patch.py	Wed Jun 22 11:17:41 2011 +0100
+++ b/ckanext/iati/patch.py	Wed Jun 22 11:23:01 2011 +0100
@@ -25,7 +25,10 @@
 
 # TODO move this to helpers proper
 def country_name(code):
-    return dict(COUNTRIES).get(code, code)
+    if code == "":
+        return "(No country assigned)"
+    else:
+        return dict(COUNTRIES).get(code, code)
     
 def group_title(name):
     from ckan import model
@@ -33,7 +36,13 @@
     if group is not None:
         name = group.title
     return name
-    
+
+def type_title(name):
+    if name == "":
+        return "(No type assigned)"
+    else:
+        return name
+
 def am_authorized_with_publisher(c, action, domain_object=None):
     from ckan import model
     from ckan.authz import Authorizer
@@ -62,6 +71,7 @@
 h.am_authorized_with_publisher = am_authorized_with_publisher
 h.country_name = country_name
 h.group_title = group_title
+h.type_title = type_title
 h.publisher_record_fields = fields
 h.my_group = my_group
 h.my_group_license = my_group_license


--- a/ckanext/iati/templates/package/search_form.html	Wed Jun 22 11:17:41 2011 +0100
+++ b/ckanext/iati/templates/package/search_form.html	Wed Jun 22 11:23:01 2011 +0100
@@ -9,7 +9,7 @@
     global_query.run(facet_by=g.facets)
     global_facets = global_query.facets
 
-    any = ('', 'Any')
+    any = ('*', 'Any')
     country_options = [(o, h.country_name(o) + " (%s)" % n) for o, n in global_facets.get('extras_country', {}).items()]
     groups_options = [(o, h.group_title(o) + " (%s)" % n) for o, n in global_facets.get('groups', {}).items()]
     types_options = [(o, h.type_title(o) + " (%s)" % n) for o, n in global_facets.get('groups_types', {}).items()]
@@ -25,15 +25,15 @@
   <table border="0" class="facets"><tr><td>Source:</td>
-        <td>${h.select('groups_types', dict(c.fields).get('groups_types', '') if c.facets else '', types_options)}</td>
+        <td>${h.select('groups_types', dict(c.fields).get('groups_types', '*') if c.facets else '*', types_options)}</td></tr><tr><td>Publisher:</td>
-        <td>${h.select('groups', dict(c.fields).get('groups', '') if c.facets else '', groups_options)}</td>
+        <td>${h.select('groups', dict(c.fields).get('groups', '*') if c.facets else '*', groups_options)}</td></tr><tr><td>Country:</td>
-        <td>${h.select('extras_country', dict(c.fields).get('extras_country', '') if c.facets else '',  country_options)}</td>
+        <td>${h.select('extras_country', dict(c.fields).get('extras_country', '*') if c.facets else '*',  country_options)}</td></tr></table>
   


--- a/solr/schema.xml	Wed Jun 22 11:17:41 2011 +0100
+++ b/solr/schema.xml	Wed Jun 22 11:23:01 2011 +0100
@@ -51,6 +51,7 @@
         <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/><filter class="solr.LowerCaseFilterFactory"/><filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
+        <filter class="solr.ReversedWildcardFilterFactory" /></analyzer><analyzer type="query"><tokenizer class="solr.WhitespaceTokenizerFactory"/>


http://bitbucket.org/okfn/ckanextiati/changeset/5feebb3d4e8e/
changeset:   5feebb3d4e8e
user:        amercader
date:        2011-06-22 14:34:56
summary:     Open publisher information in a dialog (action #22)
affected #:  4 files (1.3 KB)

--- a/ckanext/iati/public/css/iati.css	Wed Jun 22 11:23:01 2011 +0100
+++ b/ckanext/iati/public/css/iati.css	Wed Jun 22 13:34:56 2011 +0100
@@ -302,3 +302,13 @@
 #minornavigation ul li {
 	float: right;
 }
+/*-------- jQuery UI --------*/
+.ui-widget-header{
+    border: 1px solid #BBE3F7;
+    background: white url("/images/header.png") 50% 50% repeat-x;
+}
+
+.ckan-dialog{
+    background-color: white !important; 
+}
+


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ckanext/iati/public/scripts/app.js	Wed Jun 22 13:34:56 2011 +0100
@@ -0,0 +1,16 @@
+var CKAN = CKAN || {}
+
+CKAN.IATI = function($){
+    return {
+        openGroupDetails: function(){
+            var div = $("#publisher-dialog");
+            div.empty();
+            div.html($("#publisher-info").html());
+            div.dialog({
+                "minWidth" : $("#content").width(),
+                "height": $(window).height() * 0.5,
+                "position": ["center","center"]
+            });
+        }
+    }
+}(jQuery)


--- a/ckanext/iati/templates/group/layout.html	Wed Jun 22 11:23:01 2011 +0100
+++ b/ckanext/iati/templates/group/layout.html	Wed Jun 22 13:34:56 2011 +0100
@@ -8,9 +8,11 @@
   
   <py:def function="optional_head()"><script src="/scripts/jquery.linkify-1.0-min.js"></script>
+  <script src="/scripts/app.js"></script><script>
     $(document).ready(function(){
       $('#publisher-info').linkify();
+      $('.view-full').click(CKAN.IATI.openGroupDetails);
     });
   </script><style>
@@ -22,9 +24,17 @@
     #publisher-info dl {
      margin: 0;
     }
+    #publisher-dialog .view-full{
+        display: none;
+    }
+    .view-full{
+        float: left;
+        margin-top: -20px;
+        margin-bottom: 20px;
+    }
   </style></py:def>
-
+  <div id="publisher-dialog" class="ckan-dialog"/><py:match path="primarysidebar"><div class="box"><h2>Groups section</h2>
@@ -40,7 +50,10 @@
     </div><div py:if="c.group" class="box" id="publisher-info">
+
       <h2>About this publisher</h2>
+
+      <a name="view-full" class="view-full" href="#">View in a larger window [+]</a><p><dl py:for="(field_id, field_title, description) in h.publisher_record_fields"><dt>${field_title}</dt>


--- a/ckanext/iati/templates/layout_base.html	Wed Jun 22 11:23:01 2011 +0100
+++ b/ckanext/iati/templates/layout_base.html	Wed Jun 22 13:34:56 2011 +0100
@@ -27,7 +27,7 @@
   <style type="text/css"> 
     @import url(http://openbiblio.net/wp-content/themes/twentyten/style.css);
   </style> 
-
+  <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/ui-lightness/jquery-ui.css" type="text/css" media="screen, print" /><link rel="stylesheet" href="/css/style.css" type="text/css" media="screen, print" /><link rel="stylesheet" href="/css/iati.css" type="text/css" media="screen, print" /><link rel="stylesheet" href="/fonts/fonts.css" type="text/css" media="screen, print" />
@@ -39,7 +39,7 @@
 
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script><script src="http://assets.okfn.org/ext/jquery.cookie/jquery.cookie.min.js"></script>
-
+  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script><script type="text/javascript">
   //<![CDATA[
     $(document).ready(function() {


http://bitbucket.org/okfn/ckanextiati/changeset/c534475846a3/
changeset:   c534475846a3
user:        amercader
date:        2011-06-23 13:42:53
summary:     Point form controllers to the old formalchemy controlers in ckan
affected #:  1 file (439 bytes)

--- a/ckanext/iati/theme.py	Wed Jun 22 13:34:56 2011 +0100
+++ b/ckanext/iati/theme.py	Thu Jun 23 12:42:53 2011 +0100
@@ -1,10 +1,18 @@
 import os
 
 from ckan.plugins import implements, SingletonPlugin
-from ckan.plugins import IConfigurer
+from ckan.plugins import IConfigurer,IRoutes
 
 class IatiThemeExtension(SingletonPlugin):
     implements(IConfigurer, inherit=True)
+    implements(IRoutes, inherit=True)
+    def before_map(self, map):
+        map.connect('/package/new', controller='package_formalchemy', action='new')
+        map.connect('/package/edit/{id}', controller='package_formalchemy', action='edit')
+        map.connect('/group/new', controller='group_formalchemy', action='new')
+        map.connect('/group/edit/{id}', controller='group_formalchemy', action='edit')
+
+        return map
 
     def update_config(self, config):
         here = os.path.dirname(__file__)


http://bitbucket.org/okfn/ckanextiati/changeset/13142aa4cad0/
changeset:   13142aa4cad0
branch:      preview-in-dialog
user:        amercader
date:        2011-06-23 13:44:03
summary:     Open preview files in dialogs (just in case)
affected #:  3 files (1.1 KB)

--- a/ckanext/iati/public/scripts/app.js	Thu Jun 23 12:42:53 2011 +0100
+++ b/ckanext/iati/public/scripts/app.js	Thu Jun 23 12:44:03 2011 +0100
@@ -2,6 +2,7 @@
 
 CKAN.IATI = function($){
     return {
+        previewURL: "",
         openGroupDetails: function(){
             var div = $("#publisher-dialog");
             div.empty();
@@ -11,6 +12,26 @@
                 "height": $(window).height() * 0.5,
                 "position": ["center","center"]
             });
+        },
+        openPreview: function(e){
+            e.preventDefault();
+            var previewURL = CKAN.IATI.previewURL;
+            var src = previewURL.replace('%s',$(this).attr('href'));
+            var div = $("#preview");
+            div.empty();
+            var iframe = $("<iframe></iframe>");
+            iframe.attr({
+                "src": src,
+                "width":"100%",
+                "height":"100%"
+            });
+            div.html(iframe);
+            div.dialog({
+                "minWidth" : 990,
+                "height": $(window).height() * 0.5,
+                "position": ["center","center"]
+            });
+           
         }
     }
 }(jQuery)


--- a/ckanext/iati/templates/_util_local.html	Thu Jun 23 12:42:53 2011 +0100
+++ b/ckanext/iati/templates/_util_local.html	Thu Jun 23 12:44:03 2011 +0100
@@ -53,7 +53,8 @@
         <py:if test="package.resources">
             ${h.link_to('Download file', package.resources[0].url,target='_blank')} |
             <py:if test="'iati:preview:%s' % package.resources[0].id in package.extras.keys() and config.get('iati.preview_service','')">
-                ${h.link_to('Preview file',  config.get('iati.preview_service') % package.resources[0].url, target='_blank')}
+                <!--${h.link_to('Preview file',  config.get('iati.preview_service') % package.resources[0].url, class='_blank')}-->
+                <a href="${package.resources[0].url}" class="preview">Preview file</a></py:if></py:if></div>


--- a/ckanext/iati/templates/package/search.html	Thu Jun 23 12:42:53 2011 +0100
+++ b/ckanext/iati/templates/package/search.html	Thu Jun 23 12:44:03 2011 +0100
@@ -7,7 +7,15 @@
 
   <xi:include href="facets.html" /><py:def function="page_title">Search - ${g.site_title}</py:def>
-
+  <py:def function="optional_head()">
+  <script src="/scripts/app.js"></script>
+  <script>
+    CKAN.IATI.previewURL = "${config.get('iati.preview_service','')}";
+    $(document).ready(function(){
+      $('.packages .preview').click(CKAN.IATI.openPreview);
+    });
+  </script>
+  </py:def><py:match path="primarysidebar"></py:match>
@@ -26,7 +34,7 @@
      </py:if>
       ${package_list_local(c.page.items)}
       ${c.page.pager(q=c.q)}
-
+    <div id="preview"></div></div><xi:include href="layout.html" /></html>


http://bitbucket.org/okfn/ckanextiati/changeset/1f0740ab3e9a/
changeset:   1f0740ab3e9a
user:        amercader
date:        2011-06-23 15:39:52
summary:     Remove top bar link
affected #:  1 file (356 bytes)

--- a/ckanext/iati/templates/layout_base.html	Thu Jun 23 12:42:53 2011 +0100
+++ b/ckanext/iati/templates/layout_base.html	Thu Jun 23 14:39:52 2011 +0100
@@ -118,13 +118,6 @@
             </li></ul></li>
-        <li><a href="/package?groups_types=Recipient">${_('Recipient data')}</a>
-          <ul class="children">
-            <li class="page_item" py:if="h.am_authorized_with_publisher(c, actions.PACKAGE_CREATE)">
-              ${h.subnav_link(c, _('Register'), controller='package', action='new', id=None)}
-            </li>
-          </ul>
-        </li><li>${h.nav_link(c, _('Groups'), controller='group', action='index', id=None)}
           <ul class="children"><li class="page_item" py:if="h.am_authorized(c, actions.GROUP_CREATE)">

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