-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Daniel-KM/open_taxonomy
Open taxonomy
- Loading branch information
Showing
5 changed files
with
220 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
Taxonomy (plugin for Omeka) | ||
=========================== | ||
|
||
[Taxonomy] is a plugin for [Omeka] that allows to create vocabularies and to | ||
assign them to elements to fill. | ||
|
||
Unlike [Simple Vocab], the taxonomies contain a code and a value. This is | ||
specially important to simplify the share and to respect standards, for example | ||
for the list of countries [ISO 3166-1]. Even if the code is saved, it is not | ||
viewable, because the true value is always displayed automatically. | ||
|
||
New terms can be added by the admin, and, if allowed, by the user directly in | ||
the main forms for items `admin/items/edit` and collections `admin/collections/edit`. | ||
|
||
|
||
Installation | ||
------------ | ||
|
||
Install first [Element Types]. | ||
|
||
Uncompress files and rename plugin folder "Taxonomy". | ||
|
||
Then install it like any other Omeka plugin. | ||
|
||
|
||
Troubleshooting | ||
--------------- | ||
|
||
See online issues on the [plugin issues] page on GitHub. | ||
|
||
|
||
License | ||
------- | ||
|
||
This plugin is published under [GNU/GPL v3]. | ||
|
||
This program is free software; you can redistribute it and/or modify it under | ||
the terms of the GNU 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 General Public License for more | ||
details. | ||
|
||
You should have received a copy of the GNU General Public License along with | ||
this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
||
|
||
Contact | ||
------- | ||
|
||
Current maintainers of the plugin: | ||
* Julian Maurice (see [jajm]) | ||
|
||
|
||
Copyright | ||
--------- | ||
|
||
* Copyright Julian Maurice for Biblibre, 2015 | ||
* Copyright Daniel Berthereau, 2016 | ||
|
||
|
||
[Taxonomy]: https://github.com/biblibre/omeka-plugin-Taxonomy | ||
[Omeka]: https://omeka.org | ||
[Simple Vocab]: https://github.com/omeka/plugin-SimpleVocab | ||
[ISO 3166-1]: http://www.iso.org/iso/country_codes/country_codes | ||
[Element Types]: https://github.com/biblibre/omeka-plugin-ElementTypes | ||
[plugin issues]: https://github.com/biblibre/omeka-plugin-Taxonomy/issues | ||
[GNU/GPL v3]: https://www.gnu.org/licenses/gpl-3.0.html | ||
[jajm]: https://github.com/jajm | ||
[Daniel-KM]: https://github.com/Daniel-KM "Daniel Berthereau" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
jQuery(document).bind("omeka:elementformload", function() { | ||
jQuery("select.taxonomy-open").each(function() { | ||
jQuery(this).change(function() { | ||
var val = jQuery(this).val(); | ||
if (val == 'insert_new_term') { | ||
jQuery(this).next('input.taxonomy-open').show(); | ||
jQuery(this).parent().find('button.taxonomy-open').show(); | ||
} else { | ||
jQuery(this).next('input.taxonomy-open').hide(); | ||
jQuery(this).parent().find('button.taxonomy-open').hide(); | ||
} | ||
}).change(); | ||
|
||
jQuery("button.taxonomy-open").click(function(){ | ||
var field = jQuery(this).parent().find('input.taxonomy-open'); | ||
var val = field.val().trim(); | ||
if (val.length == 0) { | ||
return; | ||
} | ||
var select = jQuery(this).parent().find('select.taxonomy-open'); | ||
var exists = false; | ||
select.find('option').each(function(){ | ||
if (this.value == val) { | ||
exists = true; | ||
return false; | ||
} | ||
}); | ||
if (!exists) { | ||
var insertNewTerm = select.children("option[value='insert_new_term']")[0].outerHTML; | ||
select.children("option[value='insert_new_term']").remove(); | ||
select.append('<option value="' + val + '">' + val + '</option>'); | ||
select.append(insertNewTerm); | ||
} | ||
select.val(val); | ||
field.val('').hide(); | ||
jQuery(this).hide(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div class="field"> | ||
<div class="two columns alpha"> | ||
<?php echo $this->formLabel('taxonomy_id', __('Taxonomy')); ?> | ||
</div> | ||
<div class="inputs five columns omega"> | ||
<?php echo $this->formSelect( | ||
'taxonomy_id', | ||
isset($options['taxonomy_id']) ? $options['taxonomy_id'] : '', | ||
null, | ||
$taxonomy_options | ||
); | ||
?> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
<div class="two columns alpha"> | ||
<?php echo $this->formLabel('open',__('Open')); ?> | ||
</div> | ||
<div class="inputs five columns omega"> | ||
<?php echo $this->formCheckbox('open', true, | ||
array('checked' => isset($options['open']) ? $options['open'] : 0)); | ||
?> | ||
<p class="explanation"> | ||
<?php echo __('If checked, the user will be able to add a new term via the form.'); ?> | ||
</p> | ||
</div> | ||
</div> |