Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
zerocrates committed Apr 5, 2017
2 parents d4b3c53 + 14378c4 commit a841cb1
Show file tree
Hide file tree
Showing 353 changed files with 6,510 additions and 5,326 deletions.
6 changes: 3 additions & 3 deletions .htaccess.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ - [L]

# Strip any trailing slashes from incoming requests
RewriteCond %{REQUEST_URI} ^(.+)/+$
Expand All @@ -18,9 +18,9 @@ RewriteRule .* %1 [R=307,L]
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
RewriteRule ^(.*)$ %{ENV:BASE}/index.php [L]

# Block access to all .ini files.
<FilesMatch "\.ini$">
Expand Down
52 changes: 25 additions & 27 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
<?php

return Symfony\CS\Config\Config::create()
return PhpCsFixer\Config::create()
->setUsingCache(true)
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers([
'-psr0',
'-elseif',
'-braces',
'include',
//'multiline_array_trailing_comma',
'namespace_no_leading_whitespace',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'object_operator',
'phpdoc_indent',
'phpdoc_no_empty_return',
'phpdoc_scalar',
'phpdoc_to_comment',
'phpdoc_trim',
'remove_leading_slash_use',
'remove_lines_between_uses',
'self_accessor',
'single_array_no_trailing_comma',
'spaces_cast',
'unused_use',
'whitespacy_lines',
//'ordered_use',
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => true,
'cast_spaces' => true,
'include' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_extra_consecutive_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'phpdoc_indent' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_scalar' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'self_accessor' => true,
'trailing_comma_in_multiline_array' => true,
])
->finder(
Symfony\CS\Finder\DefaultFinder::create()
->setFinder(
PhpCsFixer\Finder::create()
->exclude('application/asset')
->exclude('application/data/doctrine-proxies')
->exclude('application/data/media-types')
Expand Down
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@ language: php
php:
- 5.6
- 7.0
- 7.1

sudo: false

cache:
directories:
- $HOME/.composer/cache
- build/cache

install: ant init
before_install:
- nvm install node
- nvm use node

install:
- npm install
- ./node_modules/gulp/bin/gulp.js init

before_script:
- mysql -e "create database IF NOT EXISTS omeka_test;" -uroot
- sed -i 's/^host.*/host = "localhost"/' application/test/config/database.ini
- sed -i 's/^user.*/user = "root"/' application/test/config/database.ini
- sed -i 's/^dbname.*/dbname = "omeka_test"/' application/test/config/database.ini

script: ant test-all
script: ./node_modules/gulp/bin/gulp.js test
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ a collaboratively built pool of items, media, and their metadata.
* Linux
* Apache
* MySql 5.5.3+ and the MySQL driver for PDO
* PHP 5.5.2+ (the latest stable version preferred) and the PHP extensions for PDO
* PHP 5.6+ (the latest stable version preferred) and the PHP extensions for PDO

### Gotchas
* The default library for generating thumbnails is ImageMagick, at least version 6.7.5. Older versions will not correctly produce thumbnails. See local.config.php options below.
Expand All @@ -22,7 +22,9 @@ a collaboratively built pool of items, media, and their metadata.
1. Change into the Omeka S directory:
* `$ cd omeka-s`
1. Perform first-time setup:
* `$ ant init`
* `$ npm install`
* `$ npm install --global gulp-cli` (if you do not already have `gulp` installed)
* `$ gulp init`
1. Open `config/database.ini` and add your MySQL username, password, database
name, and host name. The user and database must be created before this step.
1. Make sure the `files/` directory is writable by Apache.
Expand All @@ -47,7 +49,7 @@ You can find Omeka-specific code under `application/`.
### Updating from GitHub

1. `git pull` as usual. Before the official release, latest code will be on branch 'develop'.
2. From the Omeka S root directory, run `ant install-deps` to make sure dependencies are up to date.
2. From the Omeka S root directory, run `gulp deps` to make sure dependencies are up to date.
3. Compare changes in `/config/local.config.php` and `/config/local.config.php.dist`. Some default configurations might have changed, so you might need to reconcile changes to the distributed configuration with your local configuration (e.g., a path to PHP specific to your server, dev mode settings, etc.)
4. In your web browser, go to your site and run any migrations that are needed.

Expand Down
12 changes: 6 additions & 6 deletions application/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Module extends AbstractModule
/**
* This Omeka version.
*/
const VERSION = '1.0.0-beta';
const VERSION = '1.0.0-beta3';

/**
* The vocabulary IRI used to define Omeka application data.
Expand Down Expand Up @@ -209,15 +209,15 @@ public function addTermDefinitionsToContext(ZendEvent $event)
public function navigationPageIsAllowed(ZendEvent $event)
{
$accepted = true;
$params = $event->getParams();
$acl = $params['acl'];
$page = $params['page'];
$params = $event->getParams();
$acl = $params['acl'];
$page = $params['page'];

if (!$acl) {
return $accepted;
}

$resource = $page->getResource();
$resource = $page->getResource();
$privilege = $page->getPrivilege();

if ($resource || $privilege) {
Expand Down Expand Up @@ -245,7 +245,7 @@ public function deleteMediaFiles(ZendEvent $event)

if ($media->hasThumbnails()) {
$fileManager->deleteThumbnails($media);
}
}
}

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

Large diffs are not rendered by default.

Binary file added application/asset/img/theme.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 19 additions & 25 deletions application/asset/js/color-picker.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
/**
* Validate color picker user input
*
* Sets the color to the sample div if valid. If invalid, marks the input as
* invalid. A valid color is a three- or six-digit hexadecimal form, or
* "transparent".
*
* @param Object input
*/
var validateColor = function(input) {
var sampleDiv = input.siblings('.color-picker-sample');
var color = input.val();
if ('' == color) {
input.css('background-color', '#ffffff');
sampleDiv.css('background-color', 'transparent');
} else if (color.match(/^#([0-9a-f]{3}){1,2}$/i) || 'transparent' == color) {
input.css('background-color', '#ffffff');
sampleDiv.css('background-color', color);
} else {
input.css('background-color', '#f1dada');
sampleDiv.css('background-color', 'transparent');
$(document).ready(function() {

/**
* Sets the color to the sample div if valid.
*
* Validation is handled by the "pattern" attribute.
*
* @param Object input
*/
var updateColorSample = function(input) {
var sampleDiv = input.siblings('.color-picker-sample');
var color = input.val();
if ('' !== color && input[0].checkValidity()) {
sampleDiv.css('background-color', color);
} else {
sampleDiv.css('background-color', 'transparent');
}
}
}

$(document).ready(function() {
$('.color-picker').each(function() {
validateColor($(this).children('input'));
updateColorSample($(this).children('input'));
});
$(document).on('keyup', '.color-picker > input', function(e) {
validateColor($(this));
updateColorSample($(this));
});
});
17 changes: 16 additions & 1 deletion application/asset/js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ var Omeka = {
$('.section.active, .section-nav li.active').removeClass('active');
section.addClass('active');
$('.section-nav a[href="' + sectionId + '"]').parent().addClass('active');
history.replaceState(null, document.title, sectionId);
if (!$('body').hasClass('no-section-hashes')) {
history.replaceState(null, document.title, sectionId);
}
this.reserveSidebarSpace();
if (!closedSection.is(section)) {
if (closedSection.length > 0) {
Expand Down Expand Up @@ -146,14 +148,23 @@ var Omeka = {
formsToCheck.each(function () {
var form = $(this);
var originalData = form.data('omekaFormOriginalData');
var hasFile = false;
if (form.data('omekaFormSubmitted')) {
return;
}

form.trigger('o:before-form-unload');

form.find('input[type=file]').each(function () {
if (this.files.length) {
hasFile = true;
return false;
}
});

if (form.data('omekaFormDirty')
|| (originalData && originalData !== form.serialize())
|| hasFile
) {
preventNav = true;
return false;
Expand Down Expand Up @@ -353,6 +364,10 @@ var Omeka = {

Omeka.warnIfUnsaved();
});

$('body').on('blur', 'input,textarea,select', function() {
$(this).addClass('touched');
});
});

}(window.jQuery, window, document));
7 changes: 3 additions & 4 deletions application/asset/js/resource-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@
});

$('input.value-language').on('keyup', function(e) {
var thisInput = $(this);
var languageTag = thisInput.val();
var languageTag = this.value;
// @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.
if ('' == languageTag
|| languageTag.match(/^(((en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((([A-Za-z]{2,3}(-([A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?))(-([A-Za-z]{4}))?(-([A-Za-z]{2}|[0-9]{3}))?(-([A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-([0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(x(-[A-Za-z0-9]{1,8})+))?)|(x(-[A-Za-z0-9]{1,8})+))$/)) {
thisInput.css('background-color', 'transparent');
this.setCustomValidity('');
} else {
thisInput.css('background-color', '#f1dada');
this.setCustomValidity(Omeka.jsTranslate('Please enter a valid language tag'));
}
});

Expand Down
17 changes: 17 additions & 0 deletions application/asset/js/site-theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$(document).ready(function() {
$('.selectable-themes .theme input').not('[disabled]').each(function () {
$(this).closest('.theme').addClass('active');
});
$('.selectable-themes .theme').not('.invalid').click(function() {
var theme = $(this);
if (theme.hasClass('active') && (theme.parents('#site-form').length == 0)) {
theme.removeClass('active');
theme.find('[name="o:theme"]').attr('disabled', true);
} else {
$('.selectable-themes .active.theme').removeClass('active');
$('[name="o:theme"]').attr('disabled', true);
theme.addClass('active');
theme.find('[name="o:theme"]').removeAttr('disabled');
}
});
});
Loading

0 comments on commit a841cb1

Please sign in to comment.