[ckan-changes] [okfn/ckan] f3d836: Merge branch 'master' of https://github.com/okfn/c...

GitHub noreply at github.com
Mon Apr 30 09:43:14 UTC 2012


  Branch: refs/heads/master
  Home:   https://github.com/okfn/ckan
  Commit: f3d836753b4c2ae915319729872f16b8404763e4
      https://github.com/okfn/ckan/commit/f3d836753b4c2ae915319729872f16b8404763e4
  Author: Ross Jones <rossdjones at gmail.com>
  Date:   2012-04-30 (Mon, 30 Apr 2012)

  Changed paths:
    M ckan/logic/converters.py
    M ckan/templates/_snippet/data-api-help.html
    M ckan/templates/js_strings.html
    M ckanext/multilingual/plugin.py
    M doc/solr-setup.rst

  Log Message:
  -----------
  Merge branch 'master' of https://github.com/okfn/ckan


diff --git a/ckan/logic/converters.py b/ckan/logic/converters.py
index 6b927ae..18a67df 100644
--- a/ckan/logic/converters.py
+++ b/ckan/logic/converters.py
@@ -77,7 +77,8 @@ def callable(key, data, errors, context):
         for k in data.keys():
             if k[0] == 'tags':
                 if data[k].get('vocabulary_id') == v.id:
-                    tags.append(data[k]['name'])
+                    name = data[k].get('display_name', data[k]['name'])
+                    tags.append(name)
         data[key] = tags
     return callable
 
diff --git a/ckan/templates/_snippet/data-api-help.html b/ckan/templates/_snippet/data-api-help.html
index a387417..16349df 100644
--- a/ckan/templates/_snippet/data-api-help.html
+++ b/ckan/templates/_snippet/data-api-help.html
@@ -17,7 +17,7 @@
 <div class="modal-body">
   <p><strong>Access resource data via a web API with powerful query
     support</strong>. Further information in the <a
-    href="http://docs.ckan.org/en/latest/storage/datastore.html" target="_blank">main
+    href="http://docs.ckan.org/en/latest/using-data-api.html" target="_blank">main
     CKAN Data API and DataStore documentation</a>.</p>
 
   <div class="accordion-group">
diff --git a/ckan/templates/js_strings.html b/ckan/templates/js_strings.html
index 76a0d7e..a22ea2f 100644
--- a/ckan/templates/js_strings.html
+++ b/ckan/templates/js_strings.html
@@ -13,61 +13,62 @@
   /*
    * Used in application.js.
    */
-  CKAN.Strings.checking = "${_('Checking...')}";
-  CKAN.Strings.urlIsTooShort = "${_('Type at least two characters...')}";
-  CKAN.Strings.urlIsUnchanged = "${_('This is the current URL.')}";
-  CKAN.Strings.urlIsAvailable = "${_('This URL is available!')}";
-  CKAN.Strings.urlIsNotAvailable = "${_('This URL is already used, please use a different one.')}";
-  CKAN.Strings.failedToSave = "${_('Failed to save, possibly due to invalid data ')}";
-  CKAN.Strings.addDataset = "${_('Add Dataset')}";
-  CKAN.Strings.addGroup = "${_('Add Group')}";
-  CKAN.Strings.youHaveUnsavedChanges = "${_("You have unsaved changes. Make sure to click 'Save Changes' below before leaving this page.")}";
-  CKAN.Strings.loading = "${_('Loading...')}";
-  CKAN.Strings.noNameBrackets = "${_('(no name)')}";
-  CKAN.Strings.deleteThisResourceQuestion = "${_('Delete the resource \'%name%\'?')}";
-  CKAN.Strings.previewNotAvailableForDataType = "${_('Preview not available for data type: ')}";
-  CKAN.Strings.failedToGetCredentialsForUpload = "${_('Failed to get credentials for storage upload. Upload cannot proceed')}";
-  CKAN.Strings.checkingUploadPermissions = "${_('Checking upload permissions ...')}";
-  CKAN.Strings.uploadingFile = "${_('Uploading file ...')}";
-  CKAN.Strings.dataFile = "${_('Data File')}";
-  CKAN.Strings.api = "${_('API')}";
-  CKAN.Strings.visualization = "${_('Visualization')}";
-  CKAN.Strings.image = "${_('Image')}";
-  CKAN.Strings.metadata = "${_('Metadata')}";
-  CKAN.Strings.documentation = "${_('Documentation')}";
-  CKAN.Strings.code = "${_('Code')}";
-  CKAN.Strings.example = "${_('Example')}";
+  CKAN.Strings = ${
+    h.json.dumps(dict(
+      checking = _('Checking...'),
+      urlIsTooShort = _('Type at least two characters...'),
+      urlIsUnchanged = _('This is the current URL.'),
+      urlIsAvailable = _('This URL is available!'),
+      urlIsNotAvailable = _('This URL is already used, please use a different one.'),
+      failedToSave = _('Failed to save, possibly due to invalid data '),
+      addDataset = _('Add Dataset'),
+      addGroup = _('Add Group'),
+      youHaveUnsavedChanges = _("You have unsaved changes. Make sure to click 'Save Changes' below before leaving this page."),
+      loading = _('Loading...'),
+      noNameBrackets = _('(no name)'),
+      deleteThisResourceQuestion = _('Delete the resource \'%name%\'?'),
+      previewNotAvailableForDataType = _('Preview not available for data type: '),
+      failedToGetCredentialsForUpload = _('Failed to get credentials for storage upload. Upload cannot proceed'),
+      checkingUploadPermissions = _('Checking upload permissions ...'),
+      uploadingFile = _('Uploading file ...'),
+      dataFile = _('Data File'),
+      api = _('API'),
+      visualization = _('Visualization'),
+      image = _('Image'),
+      metadata = _('Metadata'),
+      documentation = _('Documentation'),
+      code = _('Code'),
+      example = _('Example'),
+
+      upload = _('Upload'),
+      cancel = _('Cancel'),
+      name = _('Name'),
+      description = _('Description'),
+      url = _('Url'),
+      format = _('Format'),
+      resourceType = _('Resource Type'),
+      datastoreEnabled = _('DataStore enabled'),
+      sizeBracketsBytes = _('Size (Bytes)'),
+      mimetype = _('Mimetype'),
+      created = _('Created'),
+      lastModified = _('Last Modified'),
+      mimetypeInner = _('Mimetype (Inner)'),
+      hash = _('Hash'),
+      id = _('ID'),
+      doneEditing = _('Done'),
+      resourceHasUnsavedChanges = _('This resource has unsaved changes.'),
+      edit = _('Edit'),
+      preview = _('Preview'),
+      resourceFormatPlaceholder = _('e.g. csv, html, xls, rdf, ...'),
+      unknown = _('Unknown'),
+      extraFields = _('Extra Fields'),
+      addExtraField = _('Add Extra Field'),
+      deleteResource = _('Delete Resource'),
+      youCanUseMarkdown = _('You can use %aMarkdown formatting%b here.'),
+      shouldADataStoreBeEnabled = _('Should a %aDataStore table and Data API%b be enabled for this resource?'),
+      datesAreInISO = _('Dates are in %aISO Format%b — eg. %c2012-12-25%d or %c2010-05-31T14:30%d.'),
+      dataFileUploaded = _('Data File (Uploaded)')
+    ), indent=4)}
 
-  /*
-   * Used in templates.js.
-   */
-  CKAN.Strings.upload = "${_('Upload')}";
-  CKAN.Strings.cancel = "${_('Cancel')}";
-  CKAN.Strings.name = "${_('Name')}";
-  CKAN.Strings.description = "${_('Description')}";
-  CKAN.Strings.url = "${_('Url')}";
-  CKAN.Strings.format = "${_('Format')}";
-  CKAN.Strings.resourceType = "${_('Resource Type')}";
-  CKAN.Strings.datastoreEnabled = "${_('DataStore enabled')}";
-  CKAN.Strings.sizeBracketsBytes = "${_('Size (Bytes)')}";
-  CKAN.Strings.mimetype = "${_('Mimetype')}";
-  CKAN.Strings.created = "${_('Created')}";
-  CKAN.Strings.lastModified = "${_('Last Modified')}";
-  CKAN.Strings.mimetypeInner = "${_('Mimetype (Inner)')}";
-  CKAN.Strings.hash = "${_('Hash')}";
-  CKAN.Strings.id = "${_('ID')}";
-  CKAN.Strings.doneEditing = "${_('Done')}";
-  CKAN.Strings.resourceHasUnsavedChanges = "${_('This resource has unsaved changes.')}";
-  CKAN.Strings.edit = "${_('Edit')}";
-  CKAN.Strings.preview = "${_('Preview')}";
-  CKAN.Strings.resourceFormatPlaceholder = "${_('e.g. csv, html, xls, rdf, ...')}";
-  CKAN.Strings.unknown = "${_('Unknown')}";
-  CKAN.Strings.extraFields = "${_('Extra Fields')}";
-  CKAN.Strings.addExtraField = "${_('Add Extra Field')}";
-  CKAN.Strings.deleteResource = "${_('Delete Resource')}";
-  CKAN.Strings.youCanUseMarkdown = "${_('You can use %aMarkdown formatting%b here.')}";
-  CKAN.Strings.shouldADataStoreBeEnabled = "${_('Should a %aDataStore table and Data API%b be enabled for this resource?')}";
-  CKAN.Strings.datesAreInISO = "${_('Dates are in %aISO Format%b — eg. %c2012-12-25%d or %c2010-05-31T14:30%d.')}";
-  CKAN.Strings.dataFileUploaded = "${_('Data File (Uploaded)')}";
 </script>
 
diff --git a/ckanext/multilingual/plugin.py b/ckanext/multilingual/plugin.py
index a4696bd..c050f57 100644
--- a/ckanext/multilingual/plugin.py
+++ b/ckanext/multilingual/plugin.py
@@ -75,7 +75,7 @@ def translate_data_dict(data_dict):
                 translated_flattened[key] = fallback_translations.get(
                         value, value)
 
-        elif isinstance(value, int):
+        elif isinstance(value, (int, dict)):
             translated_flattened[key] = value
 
         else:
diff --git a/doc/solr-setup.rst b/doc/solr-setup.rst
index 3c158b2..395da67 100644
--- a/doc/solr-setup.rst
+++ b/doc/solr-setup.rst
@@ -50,13 +50,12 @@ and the admin site::
 
  http://localhost:8983/solr/admin
 
-.. note:: If you get the message `Could not start Jetty servlet engine because no Java Development Kit (JDK) was found.` then you will have to edit /etc/profile and add this line to the end such as this to the end (adjusting the path for your machine's jdk install):
+.. note:: If you get the message ``Could not start Jetty servlet engine because no Java Development Kit (JDK) was found.`` then you will have to edit the ``JAVA_HOME`` setting in ``/etc/default/jetty`` (adjusting the path for your machine's JDK install):
 
     ``JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64/``
 
 Now run::
 
-       export JAVA_HOME
        sudo service jetty start
 
 


================================================================
  Commit: 3e6e195550725f1801d3eb31f61ba9bf768219f0
      https://github.com/okfn/ckan/commit/3e6e195550725f1801d3eb31f61ba9bf768219f0
  Author: Ross Jones <rossdjones at gmail.com>
  Date:   2012-04-30 (Mon, 30 Apr 2012)

  Changed paths:
    M ckan/templates/package/layout.html

  Log Message:
  -----------
  Moving links about


diff --git a/ckan/templates/package/layout.html b/ckan/templates/package/layout.html
index 5015093..3646d0f 100644
--- a/ckan/templates/package/layout.html
+++ b/ckan/templates/package/layout.html
@@ -34,18 +34,20 @@
         </li>
       </py:otherwise>
       </py:choose>
-      <li class="${'active' if c.action=='history' else ''}">${h.subnav_link(h.icon('page_stack') + _('History'), controller='package', action='history', id=c.pkg.name)}</li>
-
       <li class="${'active' if c.action=='related' else ''}">${h.subnav_link(h.icon('package') + _('Related') + ' (%s)' % c.related_count, controller='related', action='list', id=c.pkg.name)}</li>
 
+
       <py:if test="h.check_access('package_update',{'id':c.pkg.id})">
         <li class="divider">|</li>
+      </py:if>
+      <li class="${'active' if c.action=='history' else ''}">${h.subnav_link(h.icon('page_stack') + _('History'), controller='package', action='history', id=c.pkg.name)}</li>
+
+      <py:if test="h.check_access('package_update',{'id':c.pkg.id})">
         <li class="${'active' if c.action=='edit' else ''}">
           ${h.subnav_link(h.icon('package_edit') + _('Settings'), controller='package', action='edit', id=c.pkg.name)}
         </li>
       </py:if>
 
-
       <li class="${'active' if c.action=='authz' else ''}" py:if="h.check_access('package_edit_permissions',{'id':c.pkg.id})">
         ${h.subnav_link(h.icon('lock') + _('Authorization'), controller='package', action='authz', id=c.pkg.name)}
       </li>


================================================================
  Commit: 681d544290ce8eaab8b6ec63cfbdcf350b44eb3d
      https://github.com/okfn/ckan/commit/681d544290ce8eaab8b6ec63cfbdcf350b44eb3d
  Author: Ross Jones <rossdjones at gmail.com>
  Date:   2012-04-30 (Mon, 30 Apr 2012)

  Changed paths:
    M ckanext/organizations/forms.py
    M ckanext/organizations/templates/organization_package_form.html

  Log Message:
  -----------
  Update to fix organization dataset form and resource upload


diff --git a/ckanext/organizations/forms.py b/ckanext/organizations/forms.py
index c14e5e1..de60afb 100644
--- a/ckanext/organizations/forms.py
+++ b/ckanext/organizations/forms.py
@@ -221,9 +221,9 @@ def package_form(self):
     def db_to_form_schema(self):
         '''This is an interface to manipulate data from the database
         into a format suitable for the form (optional)'''
-        schema = default_package_schema()
-        schema['groups']['capacity'] = [ ignore_missing, unicode ]
-        return schema
+        #schema = default_package_schema()
+        #schema['groups']['capacity'] = [ ignore_missing, unicode ]
+        #return schema
 
     def form_to_db_schema(self):
         schema = default_package_schema()
diff --git a/ckanext/organizations/templates/organization_package_form.html b/ckanext/organizations/templates/organization_package_form.html
index 82a4404..e5cd0ec 100644
--- a/ckanext/organizations/templates/organization_package_form.html
+++ b/ckanext/organizations/templates/organization_package_form.html
@@ -143,6 +143,49 @@
   <div class="instructions">
     <p>Upload or link data files, APIs and other materials related to your dataset.</p>
   </div>
+  <div class="row">
+    <div class="span4">
+      <ul class="resource-list resource-list-edit drag-drop-list">
+      </ul>
+      <ul class="resource-list resource-list-add">
+        <li><a href="#" class="js-resource-add">${h.icon('page_white_add')}New resource...</a></li>
+      </ul>
+    </div>
+    <div class="span8">
+      <div style="display: none;" class="resource-panel">
+        <button class="btn btn-danger resource-panel-close">x</button>
+        <div class="resource-details resource-add">
+          <ul class="nav nav-tabs">
+            <li><a data-toggle="tab" href="#link-file">Link to a file</a></li>
+            <li><a data-toggle="tab" href="#link-api">Link to an API</a></li>
+            <li><a data-toggle="tab" href="#upload-file">Upload a file</a></li>
+          </ul>
+          <div class="tab-content">
+            <div class="tab-pane" id="link-file">
+              <div class="form-inline js-add-url-form">
+                <label class="field_opt" for="url">File URL</label>
+                <input name="add-resource-url" type="text" class="input-small" placeholder="http://mydataset.com/file.csv"/>
+                <input name="add-resource-save" type="submit" class="btn btn-primary" value="Add" />
+              </div>
+            </div>
+            <div class="tab-pane" id="link-api">
+              <div class="form-inline js-add-api-form">
+                <label class="field_opt" for="url">API URL</label>
+                <input name="add-resource-url" type="text" class="input-small" placeholder="http://mydataset.com/api/"/>
+                <input name="add-resource-save" type="submit" class="btn btn-primary" value="Add" />
+              </div>
+            </div>
+            <div class="tab-pane" id="upload-file">
+              <div class="js-add-upload-form">
+              </div>
+              <div class="alert alert-block" style="display: none;"></div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+
   <div class="js-resource-edit-barebones">
     <!-- The resource editor deletes these fields and replaces them with a dynamic editor.
          They are required for the form to render correctly when not in resource-edit mode. -->
@@ -152,22 +195,6 @@
       </py:for>
     </py:for>
   </div>
-  <ul class="resource-list resource-list-edit drag-drop-list">
-  </ul>
-  <ul class="resource-list resource-list-add">
-    <li><a href="#" class="js-resource-add">${h.icon('page_white_add')}New resource...</a></li>
-  </ul>
-  <div style="display: none;" class="resource-panel">
-    <button class="btn btn-danger resource-panel-close">x</button>
-    <div class="resource-details resource-add">
-      <ul class="button-row">
-        <li><h4>Add a resource:</h4></li>
-        <li><button class="btn js-link-file">Link to a file</button></li>
-        <li><button class="btn js-link-api">Link to an API</button></li>
-        <li class="js-upload-file ckan-logged-in" style="display: none;"><button class="btn js-upload-file">Upload a file</button></li>
-      </ul>
-    </div>
-  </div>
 </fieldset>
 
 <fieldset class="tab-pane fade" id='further-information'>


================================================================
Compare: https://github.com/okfn/ckan/compare/071b966...681d544


More information about the ckan-changes mailing list