Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into feature/mimetype…
Browse files Browse the repository at this point in the history
…_xml_zip
  • Loading branch information
Daniel-KM committed Apr 19, 2020
2 parents f02110a + 6f65c25 commit 1660f29
Show file tree
Hide file tree
Showing 565 changed files with 20,381 additions and 10,619 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/modules/
/themes/
/application/test/config/database.ini
/application/asset/css/font-awesome/
/vendor/
/node_modules/
.sass-cache
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
language: php

dist: bionic

php:
- 7.1
- 7.2
- 7.3
- 7.4

services:
- mysql
Expand Down
8 changes: 4 additions & 4 deletions application/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

use Omeka\Api\Adapter\FulltextSearchableInterface;
use Omeka\Module\AbstractModule;
use Zend\EventManager\Event as ZendEvent;
use Zend\EventManager\SharedEventManagerInterface;
use Laminas\EventManager\Event as ZendEvent;
use Laminas\EventManager\SharedEventManagerInterface;

/**
* The Omeka module.
Expand All @@ -14,7 +14,7 @@ class Module extends AbstractModule
/**
* This Omeka version.
*/
const VERSION = '2.0.2';
const VERSION = '2.9.3-alpha';

/**
* The vocabulary IRI used to define Omeka application data.
Expand All @@ -38,7 +38,7 @@ public function getConfig()
public function attachListeners(SharedEventManagerInterface $sharedEventManager)
{
$sharedEventManager->attach(
'Zend\View\Helper\Navigation\AbstractHelper',
'Laminas\View\Helper\Navigation\AbstractHelper',
'isAllowed',
[$this, 'navigationPageIsAllowed']
);
Expand Down
1 change: 1 addition & 0 deletions application/asset/css/page-blocks.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion application/asset/css/style.css

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions application/asset/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,96 @@ var Omeka = {
}
},

initializeSelector : function(tableId, selectorId) {
var table = $(tableId);
var existingRowData = table.data('existing-rows');
var rowTemplate = $($.parseHTML(table.data('rowTemplate')));
var selector = $(selectorId);
var totalCount = $(selectorId).find('.selector-total-count');

var parentToggle = function(e) {
e.stopPropagation();
if ($(this).children('li')) {
$(this).toggleClass('show');
}
}

var appendRow = function(id) {
if (table.find(".resource-id[value='" + id + "']").length) {
return;
}
var tableRow = rowTemplate.clone();
var selectorRow = selector.find('[data-resource-id="' + id + '"]');
tableRow.find('.resource-id').val(id);
tableRow.find('.data-value').each(function() {
var tableRowCell = $(this);
var tableRowKey = tableRowCell.data('row-key');
var tableRowValue = selectorRow.data(tableRowKey);
tableRowCell.text(tableRowValue);
});
selectorRow.addClass('added');
table.append(tableRow).removeClass('empty').trigger('appendRow');
updateSiteCount(id);
}

var updateSiteCount = function(id) {
var resource = $('[data-resource-id="' + id + '"]');
var resourceParent = resource.parents('.selector-parent');
var childCount = resourceParent.find('.selector-child-count').first();
if (resource.hasClass('added')) {
var newTotalCount = parseInt(totalCount.text()) - 1;
var newChildCount = parseInt(childCount.text()) - 1;
} else {
var newTotalCount = parseInt(totalCount.text()) + 1;
var newChildCount = parseInt(childCount.text()) + 1;
}
totalCount.text(newTotalCount);
childCount.text(newChildCount);
if (newTotalCount == 0) {
selector.find('.resources-available').addClass('empty');
} else {
selector.find('.resources-available').removeClass('empty');
}
if (newChildCount == 0) {
resourceParent.addClass('empty');
} else {
resourceParent.removeClass('empty');
}
}

if (existingRowData.length > 0) {
$.each(existingRowData, function() {
appendRow(this.id);
});
table.removeClass('empty');
}

// Add the selected resource to the edit panel.
$(selectorId + ' .selector-child').on('click', function(e) {
e.stopPropagation();
var selectorRow = $(this);
var selectorParent = selectorRow.parents('.selector-parent');
selectorParent.unbind('click');
appendRow(selectorRow.data('resource-id'));
selectorParent.bind('click', parentToggle);
Omeka.scrollTo(table.find('.resource-row:last-child'));
});

// Remove an item set from the edit panel.
table.on('click', '.o-icon-delete', function(e) {
e.preventDefault();
var row = $(this).closest('.resource-row');
var resourceId = row.find('.resource-id').val();
selector.find('[data-resource-id="' + resourceId + '"]').removeClass('added');
updateSiteCount(resourceId);
row.remove();
if ($('.resource-row').length < 1) {
table.addClass('empty');
}
});
},


// @see http://stackoverflow.com/questions/7035825/regular-expression-for-a-language-tag-as-defined-by-bcp47
// Removes `|[A-Za-z]{4}|[A-Za-z]{5,8}` from the "language" portion becuase,
// while in the spec, it does not represent current usage.
Expand Down
51 changes: 0 additions & 51 deletions application/asset/js/item-manage-item-sets.js

This file was deleted.

58 changes: 41 additions & 17 deletions application/asset/js/resource-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@
$('#select-item a').on('o:resource-selected', function (e) {
var value = $('.value.selecting-resource');
var valueObj = $('.resource-details').data('resource-values');
var namePrefix = value.data('name-prefix');

$(document).trigger('o:prepare-value', ['resource', value, valueObj, namePrefix]);
$(document).trigger('o:prepare-value', ['resource', value, valueObj]);
Omeka.closeSidebar($('#select-resource'));
});

Expand All @@ -117,8 +116,7 @@
field.find('.values').append(value);
}
var valueObj = $(this).data('resource-values');
var namePrefix = value.data('name-prefix');
$(document).trigger('o:prepare-value', ['resource', value, valueObj, namePrefix]);
$(document).trigger('o:prepare-value', ['resource', value, valueObj]);
});
});

Expand Down Expand Up @@ -189,11 +187,46 @@
e.preventDefault();
alert(errors.join("\n"));
}

$('#values-json').val(JSON.stringify(collectValues()));
});

initPage();
});

var collectValues = function () {
var values = {};
$('#properties').children().each(function () {
var propertyValues = [];
var property = $(this);
var propertyTerm = property.data('propertyTerm');
var propertyId = property.data('propertyId');
property.find('.values > .value').each(function () {
var valueData = {}
var value = $(this);
if (value.hasClass('delete')) {
return;
}
valueData['property_id'] = propertyId;
valueData['type'] = value.data('dataType');
valueData['is_public'] = value.find('input.is_public').val();
value.find(':input[data-value-key]').each(function () {
var input = $(this);
valueKey = input.data('valueKey');
if (!valueKey || input.prop('disabled')) {
return;
}
valueData[valueKey] = input.val();
});
propertyValues.push(valueData);
});
if (propertyValues.length) {
values[propertyTerm] = propertyValues;
}
});
return values;
};

/**
* Make a new value.
*/
Expand Down Expand Up @@ -223,39 +256,30 @@
}
// Prepare the value node.
var count = field.find('.value').length;
var namePrefix = field.data('property-term') + '[' + count + ']';
var valueLabelID = 'property-' + field.data('property-id') + '-label';
value.data('name-prefix', namePrefix);
value.find('input.property')
.attr('name', namePrefix + '[property_id]')
.val(field.data('property-id'));
value.find('input.type')
.attr('name', namePrefix + '[type]')
.val(type);
value.find('input.is_public')
.attr('name', namePrefix + '[is_public]')
.val(isPublic ? 1 : 0);
value.find('span.label')
.attr('id', valueLabelID);
value.find('textarea.input-value')
.attr('aria-labelledby', valueLabelID);
value.attr('aria-labelledby', valueLabelID);
$(document).trigger('o:prepare-value', [type, value, valueObj, namePrefix]);
$(document).trigger('o:prepare-value', [type, value, valueObj]);

return value;
};

/**
* Prepare the markup for the default data types.
*/
$(document).on('o:prepare-value', function(e, type, value, valueObj, namePrefix) {
$(document).on('o:prepare-value', function(e, type, value, valueObj) {
// Prepare simple single-value form inputs using data-value-key
value.find(':input').each(function () {
valueKey = $(this).data('valueKey');
var valueKey = $(this).data('valueKey');
if (!valueKey) {
return;
}
$(this).attr('name', namePrefix + '[' + valueKey + ']')
$(this).removeAttr('name')
.val(valueObj ? valueObj[valueKey] : null);
});

Expand Down
66 changes: 0 additions & 66 deletions application/asset/js/site-item-sets.js

This file was deleted.

Loading

0 comments on commit 1660f29

Please sign in to comment.