From 51e8f84023b210218c846e0d9cfa7e2caf7b099b Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Wed, 13 Mar 2013 01:51:47 +0100 Subject: [PATCH 01/42] Added a new function islandora_user_access() to simplify access callbacks. This function will check the given object/datastream against the given permissions and required content models using the given user. If no user is given the user identified by the GET token will be used, if no token is present the global user will be used. --- islandora.module | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/islandora.module b/islandora.module index 94aedbe0..57ee5d9b 100644 --- a/islandora.module +++ b/islandora.module @@ -334,6 +334,88 @@ function islandora_forms($form_id) { return $forms; } +/** + * Checks whether the user can access the given object. + * + * Checks for repository access, object/datastream existance, namespace access, + * user permissions, content models. + * + * Will check the given user or the user repersented by the GET token parameter, + * failing that it will use the global user. + * + * @global $user + * + * @param mixed $object + * The FedoraObject or FedoraDatastream to test for accessibility, if NULL + * is given the object is assumed to not exist or be inaccessible. + * @param array $permissions + * The required user permissions. + * @param array $content_models + * The required content models. + * @param bool $access_any + * (optional) TRUE to grant access if any single requirement is met from both + * the permissions and content models parameters. FALSE if all requirements + * must be met from both the permissions and content model parameters. + * @param object $account + * (optional) The account to check, if not given check the GET parameters for + * a token to restore the user. If no GET parameter is present use currently + * logged in user. + * + * @return bool + * TRUE if the user is allowed to access this object/datastream, FALSE + * otherwise. + */ +function islandora_user_access($object, array $permissions, $content_models = array(), $access_any = TRUE, $account = NULL) { + module_load_include('inc', 'islandora', 'includes/utilities'); + $is_repository_accessible = &drupal_static(__FUNCTION__); + // If the repository is inaccessible then access always fails. + if (!isset($is_repository_accessible)) { + $is_repository_accessible = islandora_describe_repository(); + if (!$is_repository_accessible) { + // Only display the inaccessible message once. + islandora_display_repository_inaccessible_message(); + return FALSE; + } + } + if (!$is_repository_accessible || !is_object($object)) { + return FALSE; + } + // Determine the user account to test against. + if (!isset($account)) { + $token = filter_input(INPUT_GET, 'token', FILTER_SANITIZE_STRING); + if ($token) { + module_load_include('inc', 'islandora', 'includes/authtokens'); + $user = islandora_validate_object_token($object->id, $datastream->id, $token); + if ($user) { + $account = user_load($user->uid); + } + } + else { + global $user; + $account = $user; + } + } + // Determine what has been passed as $object. + if (is_subclass_of($object, 'FedoraObject')) { + $object = $object; + } + elseif (is_subclass_of($object, 'FedoraDatastream')) { + $datastream = $object; + $object = $datstream->parent; + } + // Check for access. + $accessible_namespace = islandora_namespace_accessible($object->id); + if ($access_any) { + $has_required_permissions = islandora_user_access_any($permissions, $account); + $has_required_content_models = empty($content_models) ? TRUE : count(array_intersect($object->models, $content_models)) > 0; + } + else { + $has_required_permissions = islandora_user_access_all($permissions, $account); + $has_required_content_models = count(array_diff($content_models, $object->models)) == 0; + } + return $accessible_namespace && $has_required_permissions && $has_required_content_models; +} + /** * Checks whether the user can access the given object. * From 6aa5226e58816e668a29e5bc30673d24bea4d17e Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Fri, 8 Mar 2013 15:25:20 +0100 Subject: [PATCH 02/42] Removed default ingest menu, ingest configuration can now take a object. Was not in use and excepting any parameters for the ingest process via GET was not very safe. Also the ingest configuration can now take an NewFedoraObject rather than building one from the configuration options. The old way is still supported for now though. --- includes/ingest.form.inc | 21 +++++++++-------- includes/ingest.menu.inc | 49 ---------------------------------------- 2 files changed, 12 insertions(+), 58 deletions(-) delete mode 100644 includes/ingest.menu.inc diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index 9434e9e4..ca6af592 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -96,15 +96,18 @@ function islandora_ingest_form_init_form_state_storage(array &$form_state, array */ function islandora_ingest_form_prepare_new_object(array $configuration) { module_load_include('inc', 'islandora', 'includes/utilities'); - // ID is more specific than namespace so it will take precedence. - $id = isset($configuration['namespace']) ? $configuration['namespace'] : 'islandora'; - $id = isset($configuration['id']) ? $configuration['id'] : $id; - $label = isset($configuration['label']) ? $configuration['label'] : 'New Object'; - $relationship_map = function($o) { - return array('relationship' => 'isMemberOfCollection', 'pid' => $o); - }; - $relationships = empty($configuration['collections']) ? array() : array_map($relationship_map, $configuration['collections']); - return islandora_prepare_new_object($id, $label, array(), array(), $relationships); + if (empty($configuration['object'])) { + // ID is more specific than namespace so it will take precedence. + $id = isset($configuration['namespace']) ? $configuration['namespace'] : 'islandora'; + $id = isset($configuration['id']) ? $configuration['id'] : $id; + $label = isset($configuration['label']) ? $configuration['label'] : 'New Object'; + $relationship_map = function($o) { + return array('relationship' => 'isMemberOfCollection', 'pid' => $o); + }; + $relationships = empty($configuration['collections']) ? array() : array_map($relationship_map, $configuration['collections']); + return islandora_prepare_new_object($id, $label, array(), array(), $relationships); + } + return $configuration['object']; } /** diff --git a/includes/ingest.menu.inc b/includes/ingest.menu.inc deleted file mode 100644 index a6f79891..00000000 --- a/includes/ingest.menu.inc +++ /dev/null @@ -1,49 +0,0 @@ -'; - // Redirect back to referer or top level collection. - drupal_goto($redirect); - } -} - -/** - * Fetches the ingest configuration from the $_GET parameters. - * - * Generic parameters as accepted by all ingest processes, other modules may - * add to this list. - * id -> The pid of the object to create. optional. - * models -> Comma delimited list of all the content models the created object - * should have. - * collections -> Comma delimited list of all the collections the created - * object should belong to. - * - * @return array - * The configuration options used to build the multi-paged ingest process. - */ -function islandora_ingest_get_configuration() { - $configuration = $_GET; - unset($configuration['q']); - $convert_to_array_keys = array_intersect(array('models', 'collections'), array_keys($configuration)); - foreach ($convert_to_array_keys as $key) { - $configuration[$key] = explode(',', $configuration[$key]); - } - return $configuration; -} From e7cc486d182a70ed1e1983d4011af85dd85e0d2f Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Wed, 13 Mar 2013 01:31:09 -0300 Subject: [PATCH 03/42] First try at getting travis building. --- .travis.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..ff5b51f5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,26 @@ +language: php +php: + - 5.3 +before_script: + - mysql -u root -e 'create database drupal;' + - mysql -u root -e "create database fedora;" + - mysql -u root -e "GRANT ALL PRIVILEGES ON fedora.* To 'fedora'@'localhost' IDENTIFIED BY 'fedora';" + - mysql -u root -e "GRANT ALL PRIVILEGES ON drupal.* To 'drupal'@'localhost' IDENTIFIED BY 'drupal';" + - git clone git://github.com/Islandora/islandora_tomcat.git + - cd islandora_tomcat + - export CATALINA_HOME='.' + - ./bin/startup.sh + - cd .. + - pyrus channel-discover pear.drush.org + - pyrus install drush/drush + - phpenv rehash + - drush dl --yes drupal + - cd drupal-* + - drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes + - drush en --yes simpletest + - drush cc all + - drush runserver --server=builtin 80 & + - sleep 4 + - drush vset --yes simpletest_verbose FALSE +script: + - drush test-run Syslog --xml --uri=http://127.0.0.1:8080 From ff0ed13e1f950fac62987e355d1ec8092e80861c Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Wed, 13 Mar 2013 02:52:53 -0300 Subject: [PATCH 04/42] Added a config for travis-ci This config will let islandora work with travis-ci. travis more travis This one should work. Test travis with apache. added sudo Added chown Fixed permissions... i hope.w Apache config back to non-apache Another try at a travis config Added some debug output woot Another update Added some debug data to sort out whats up with travis. more debug another More debug Perhaps this will finally work Revert "More debug" This reverts commit 508e993f4b02f7f3c9eb0d978514d0be89abbc78. Revert "another" This reverts commit cbf280eb4ebd22dda90788752787250a0ef71361. Revert "more debug" This reverts commit e6ce86ad77fdb89807c426adaa04a90a9955f343. Revert "Added some debug data to sort out whats up with travis." This reverts commit 5cb8e5b2f5dd20896f501a70167495b42d8f77f4. Holy jumping jesus it works. --- .travis.yml | 19 ++++++++++++++----- tests/travis.test_config.ini | 6 ++++++ 2 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 tests/travis.test_config.ini diff --git a/.travis.yml b/.travis.yml index ff5b51f5..fa7e5ca9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,35 @@ language: php php: - 5.3 -before_script: +before_install: - mysql -u root -e 'create database drupal;' - mysql -u root -e "create database fedora;" - mysql -u root -e "GRANT ALL PRIVILEGES ON fedora.* To 'fedora'@'localhost' IDENTIFIED BY 'fedora';" - mysql -u root -e "GRANT ALL PRIVILEGES ON drupal.* To 'drupal'@'localhost' IDENTIFIED BY 'drupal';" + - cd $HOME + - sudo apt-get update -qq + - sudo apt-get install -qq php5-cgi + - sudo apt-get install -qq php5-mysql + - git clone git://github.com/Islandora/tuque.git - git clone git://github.com/Islandora/islandora_tomcat.git - cd islandora_tomcat - export CATALINA_HOME='.' - ./bin/startup.sh - - cd .. + - cd $HOME - pyrus channel-discover pear.drush.org - pyrus install drush/drush - phpenv rehash - drush dl --yes drupal - cd drupal-* - drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes + - drush runserver 8081 > /dev/null & + - ln -s $TRAVIS_BUILD_DIR sites/all/modules/islandora + - mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini + - mkdir sites/all/libraries + - ln -s $HOME/tuque sites/all/libraries/tuque - drush en --yes simpletest + - drush en --user=1 --yes islandora - drush cc all - - drush runserver --server=builtin 80 & - sleep 4 - - drush vset --yes simpletest_verbose FALSE script: - - drush test-run Syslog --xml --uri=http://127.0.0.1:8080 + - drush test-run --uri=http://127.0.0.1:8081 Islandora diff --git a/tests/travis.test_config.ini b/tests/travis.test_config.ini new file mode 100644 index 00000000..61d63713 --- /dev/null +++ b/tests/travis.test_config.ini @@ -0,0 +1,6 @@ +[fedora] +fedora_url = "http://localhost:8080/fedora" +use_drupal_filter = TRUE +drupal_filter_file = "/home/travis/islandora_tomcat/fedora/server/config/filter-drupal.xml" +admin_user = "fedoraAdmin" +admin_pass = "fedoraAdmin" From d77c53492a7954f7daa7303728eea8698d338f24 Mon Sep 17 00:00:00 2001 From: Steve Osguthorpe Date: Mon, 18 Mar 2013 17:17:44 +0000 Subject: [PATCH 05/42] Created $keys variable to be passed by reference to stop PHP warning being shown. --- includes/ingest.form.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index 9434e9e4..5742f3be 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -144,7 +144,8 @@ function islandora_ingest_form_get_step(array &$form_state, $step_id = NULL) { function islandora_ingest_form_get_current_step_id(array &$form_state) { if (empty($form_state['islandora']['step_id'])) { $steps = islandora_ingest_form_get_steps($form_state); - return array_shift(array_keys($steps)); + $keys = array_keys($steps); + return array_shift($keys); } return $form_state['islandora']['step_id']; } From 736c809c2eed3106c44f333b2e1ddd7082c53967 Mon Sep 17 00:00:00 2001 From: William Panting Date: Tue, 19 Mar 2013 17:25:56 -0300 Subject: [PATCH 06/42] Revived islandora_hooks_test module to get hook tests working --- tests/islandora_hooks_test.info | 7 ++ tests/islandora_hooks_test.module | 152 ++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 tests/islandora_hooks_test.info create mode 100644 tests/islandora_hooks_test.module diff --git a/tests/islandora_hooks_test.info b/tests/islandora_hooks_test.info new file mode 100644 index 00000000..9d211978 --- /dev/null +++ b/tests/islandora_hooks_test.info @@ -0,0 +1,7 @@ +name = Islandora Hook testing +description = Tests Hooks. Do not enable. +core = 7.x +package = Testing +hidden = TRUE +dependencies[] = islandora +files[] = islandora_hooks_test.module diff --git a/tests/islandora_hooks_test.module b/tests/islandora_hooks_test.module new file mode 100644 index 00000000..315b88ee --- /dev/null +++ b/tests/islandora_hooks_test.module @@ -0,0 +1,152 @@ +id == 'test:testIngestedObjectHook') { + $_SESSION['islandora_hooks']['alter'][ISLANDORA_OBJECT_INGESTED_HOOK] = TRUE; + if ($object->label == 'block') { + $context['block'] = TRUE; + } + } + break; + + case 'modify': + if ($object->id == 'test:testModifiedObjectHook') { + $_SESSION['islandora_hooks']['alter'][ISLANDORA_OBJECT_MODIFIED_HOOK] = TRUE; + if (isset($context['params']['label']) && $context['params']['label'] == 'block') { + $context['block'] = TRUE; + } + } + elseif ($object->id == 'test:testPurgedObjectHook') { + $_SESSION['islandora_hooks']['alter'][ISLANDORA_OBJECT_PURGED_HOOK] = TRUE; + if (isset($context['params']['label']) && $context['params']['label'] == 'block') { + $context['block'] = TRUE; + } + elseif (isset($context['params']['label']) && $context['params']['label'] == 'delete') { + $context['delete'] = TRUE; + } + } + break; + + case 'purge': + if ($object->id == 'test:testPurgedObjectHook') { + $_SESSION['islandora_hooks']['alter'][ISLANDORA_OBJECT_PURGED_HOOK] = TRUE; + if ($object->label == 'block') { + $context['block'] = TRUE; + } + elseif ($object->label == 'delete') { + $context['delete'] = TRUE; + } + } + break; + } +} + +/** + * Implements hook_islandora_object_alter(). + */ +function islandora_hooks_test_islandora_datastream_alter(AbstractFedoraObject $object, AbstractFedoraDatastream $datastream, array &$context) { + switch ($context['action']) { + case 'ingest': + if ($object->id == 'test:testIngestedDatastreamHook') { + $_SESSION['islandora_hooks']['alter'][ISLANDORA_DATASTREAM_INGESTED_HOOK] = TRUE; + if ($datastream->label == 'block') { + $context['block'] = TRUE; + } + } + break; + + case 'modify': + if ($object->id == 'test:testModifiedDatastreamHook') { + $_SESSION['islandora_hooks']['alter'][ISLANDORA_DATASTREAM_MODIFIED_HOOK] = TRUE; + if (isset($context['params']['dsLabel']) && $context['params']['dsLabel'] == 'block') { + $context['block'] = TRUE; + } + } + elseif ($object->id == 'test:testPurgedDatastreamHook') { + $_SESSION['islandora_hooks']['alter'][ISLANDORA_DATASTREAM_PURGED_HOOK] = TRUE; + if (isset($context['params']['dsLabel']) && $context['params']['dsLabel'] == 'block') { + $context['block'] = TRUE; + } + elseif (isset($context['params']['dsLabel']) && $context['params']['dsLabel'] == 'delete') { + $context['delete'] = TRUE; + } + } + break; + + case 'purge': + if ($object->id == 'test:testPurgedDatastreamHook') { + $_SESSION['islandora_hooks']['alter'][ISLANDORA_DATASTREAM_PURGED_HOOK] = TRUE; + if ($datastream->label == 'block') { + $context['block'] = TRUE; + } + elseif ($datastream->label == 'delete') { + $context['delete'] = TRUE; + } + } + break; + } +} + +/** + * Implements hook_islandora_object_ingested(). + */ +function islandora_hooks_test_islandora_object_ingested(FedoraObject $object) { + if ($object->id == 'test:testIngestedObjectHook') { + $_SESSION['islandora_hooks']['hook'][ISLANDORA_OBJECT_INGESTED_HOOK] = TRUE; + } +} + +/** + * Implements hook_islandora_object_modified(). + */ +function islandora_hooks_test_islandora_object_modified(FedoraObject $object) { + if ($object->id == 'test:testModifiedObjectHook') { + $_SESSION['islandora_hooks']['hook'][ISLANDORA_OBJECT_MODIFIED_HOOK] = TRUE; + } +} + +/** + * Implements hook_islandora_object_purged(). + */ +function islandora_hooks_test_islandora_object_purged($pid) { + if ($pid == 'test:testPurgedObjectHook') { + $_SESSION['islandora_hooks']['hook'][ISLANDORA_OBJECT_PURGED_HOOK] = TRUE; + } +} + +/** + * Implements hook_islandora_datastream_ingested(). + */ +function islandora_hooks_test_islandora_datastream_ingested(FedoraObject $object, FedoraDatastream $datastream) { + if ($object->id == 'test:testIngestedDatastreamHook' && $datastream->id == "TEST") { + $_SESSION['islandora_hooks']['hook'][ISLANDORA_DATASTREAM_INGESTED_HOOK] = TRUE; + } +} + +/** + * Implements hook_islandora_datastream_modified(). + */ +function islandora_hooks_test_islandora_datastream_modified(FedoraObject $object, FedoraDatastream $datastream) { + if ($object->id == 'test:testModifiedDatastreamHook' && $datastream->id == "TEST") { + $_SESSION['islandora_hooks']['hook'][ISLANDORA_DATASTREAM_MODIFIED_HOOK] = TRUE; + } +} + +/** + * Implements hook_islandora_datastream_purged(). + */ +function islandora_hooks_test_islandora_datastream_purged(FedoraObject $object, $dsid) { + if ($object->id == 'test:testPurgedDatastreamHook' && $dsid == "TEST") { + $_SESSION['islandora_hooks']['hook'][ISLANDORA_DATASTREAM_PURGED_HOOK] = TRUE; + } +} From f5c1729cd2de266b2ed82d61a960385a6b80e340 Mon Sep 17 00:00:00 2001 From: William Panting Date: Fri, 22 Mar 2013 10:11:35 -0300 Subject: [PATCH 07/42] test setup docs --- tests/README.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/README.txt b/tests/README.txt index 797d788b..3e7fe11d 100644 --- a/tests/README.txt +++ b/tests/README.txt @@ -1,3 +1,4 @@ You can define your own configurations specific to your enviroment by copying default.test_config.ini to test_config.ini, making your changes in the copied -file. \ No newline at end of file +file. These test need write access to the system's $FEDORA_HOME/server/config +directory as they need to temporarily replace the filter-drupal.xml file. \ No newline at end of file From 822c9211a27671b9efae05c0fb9e124ca6dc2124 Mon Sep 17 00:00:00 2001 From: William Panting Date: Fri, 22 Mar 2013 10:28:11 -0300 Subject: [PATCH 08/42] need access to the filter file too --- tests/README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/README.txt b/tests/README.txt index 3e7fe11d..c03004ae 100644 --- a/tests/README.txt +++ b/tests/README.txt @@ -1,4 +1,4 @@ You can define your own configurations specific to your enviroment by copying default.test_config.ini to test_config.ini, making your changes in the copied file. These test need write access to the system's $FEDORA_HOME/server/config -directory as they need to temporarily replace the filter-drupal.xml file. \ No newline at end of file +directory as well as the filter-drupal.xml file. \ No newline at end of file From e8f5b8190a62533c9bbff335666121fd2afed191 Mon Sep 17 00:00:00 2001 From: Daniel Lamb Date: Wed, 27 Mar 2013 16:45:21 +0000 Subject: [PATCH 09/42] Buildfile and Doxyfile --- build.xml | 164 +++++++++++++++++++++---------------------------- build/Doxyfile | 3 + 2 files changed, 72 insertions(+), 95 deletions(-) diff --git a/build.xml b/build.xml index 854d3a0a..273f8ca8 100644 --- a/build.xml +++ b/build.xml @@ -1,110 +1,84 @@ - + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - + + + - - - - - - + + + + + + + + + + - - - - - - - + + + + + - - - - - - - - + + + + + - - - - - - - - + + + + + - - - - - - - - - - + + + + + - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - + + + + + diff --git a/build/Doxyfile b/build/Doxyfile index 1d4e3693..f41dc285 100644 --- a/build/Doxyfile +++ b/build/Doxyfile @@ -27,6 +27,9 @@ DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = Islandora 7.x +# Put the git hash here using sed before generating the documentation. +PROJECT_NUMBER = + # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location From 2c829f0241a289732efbc4ca56dfccc9bca61bd1 Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Tue, 26 Mar 2013 07:10:03 +0100 Subject: [PATCH 10/42] Cleaned up and moved grid/list display logic into islandora, since its now used in several modules. --- css/islandora.objects.css | 39 ++++++++++++++++++ islandora.module | 23 +++++++++++ theme/islandora-objects-grid.tpl.php | 17 ++++++++ theme/islandora-objects-list.tpl.php | 29 +++++++++++++ theme/islandora-objects.tpl.php | 15 +++++++ theme/theme.inc | 61 ++++++++++++++++++++++++++++ 6 files changed, 184 insertions(+) create mode 100644 css/islandora.objects.css create mode 100644 theme/islandora-objects-grid.tpl.php create mode 100644 theme/islandora-objects-list.tpl.php create mode 100644 theme/islandora-objects.tpl.php diff --git a/css/islandora.objects.css b/css/islandora.objects.css new file mode 100644 index 00000000..5e03d3f7 --- /dev/null +++ b/css/islandora.objects.css @@ -0,0 +1,39 @@ +/** + * @file + * Styles for rendering grids/lists of objects. + */ +.islandora-objects-display-switch { + float: right; +} +.islandora-objects-grid-item { + display: inline-block; + width: 20%; + min-width: 100px; + min-height: 180px; + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + margin: 1.5em 1.84%; + zoom: 1; + *display: inline; + _height: 180px; +} +.islandora-objects-list-item { + padding-bottom: 1.5em; + border-bottom: 1px solid #ddd; +} +.islandora-objects-list-item .islandora-object-thumb { + clear: left; + float: left; + padding: 3px 0 0; + text-align: center; + width: 100px; +} +.islandora-objects-list-item .islandora-object-caption, .islandora-objects-list-item .islandora-object-description { + margin: 0 0 0 130px; + padding-top: 2px; + padding-bottom: 2px; +} +.islandora-object-thumb img { + width: 100%; +} diff --git a/islandora.module b/islandora.module index 94aedbe0..f800cf6d 100644 --- a/islandora.module +++ b/islandora.module @@ -286,6 +286,29 @@ function islandora_theme() { 'file' => 'theme/theme.inc', 'variables' => array('object' => NULL, 'content' => array()), ), + // Render a bunch of objects as either a grid or a list. + 'islandora_objects' => array( + 'file' => 'theme/theme.inc', + 'template' => 'theme/islandora-objects', + 'variables' => array( + 'objects' => NULL, + 'display' => NULL, + 'page_size' => 20, + 'limit' => 10, + ), + ), + // Render a bunch of objects as a grid. + 'islandora_objects_grid' => array( + 'file' => 'theme/theme.inc', + 'template' => 'theme/islandora-objects-grid', + 'variables' => array('objects' => NULL), + ), + // Render a bunch of objects as a list. + 'islandora_objects_list' => array( + 'file' => 'theme/theme.inc', + 'template' => 'theme/islandora-objects-list', + 'variables' => array('objects' => NULL), + ), ); } diff --git a/theme/islandora-objects-grid.tpl.php b/theme/islandora-objects-grid.tpl.php new file mode 100644 index 00000000..e6d7e140 --- /dev/null +++ b/theme/islandora-objects-grid.tpl.php @@ -0,0 +1,17 @@ + +
+ +
+
+
+
+
+
+ +
diff --git a/theme/islandora-objects-list.tpl.php b/theme/islandora-objects-list.tpl.php new file mode 100644 index 00000000..67f5f02d --- /dev/null +++ b/theme/islandora-objects-list.tpl.php @@ -0,0 +1,29 @@ + +
+ + + +
+
+
+ +
+
+ + + +
+
+ +
+
+
+ + +
diff --git a/theme/islandora-objects.tpl.php b/theme/islandora-objects.tpl.php new file mode 100644 index 00000000..5b55eb88 --- /dev/null +++ b/theme/islandora-objects.tpl.php @@ -0,0 +1,15 @@ + +
+ + $display_links, 'attributes' => array('class' => array('links', 'inline')))); ?> + + + + +
diff --git a/theme/theme.inc b/theme/theme.inc index 87e44fc1..7c43deef 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -157,3 +157,64 @@ function islandora_preprocess_islandora_object_print(array &$variables) { function theme_islandora_object_print(array &$variables) { return drupal_render($variables['content']); } + +/** + * Implements hook_preprocess_theme(). + */ +function islandora_preprocess_islandora_objects(array &$variables) { + module_load_include('inc', 'islandora_paged_content', 'includes/utilities'); + $display = (empty($_GET['display'])) ? 'grid' : $_GET['display']; + $grid_display = $display == 'grid'; + $list_display = !$grid_display; + $query_params = drupal_get_query_parameters($_GET); + $variables['display_links'] = array( + array( + 'title' => t('Grid view'), + 'href' => url($_GET['q'], array('absolute' => TRUE)), + 'attributes' => array( + 'class' => $grid_display ? 'active' : '', + ), + 'query' => array('display' => 'grid') + $query_params, + ), + array( + 'title' => t('List view'), + 'href' => url($_GET['q'], array('absolute' => TRUE)), + 'attributes' => array( + 'class' => $list_display ? 'active' : '', + ), + 'query' => array('display' => 'list') + $query_params, + ), + ); + // Pager. + $objects = $variables['objects']; + $limit = $variables['limit']; + $page_size = $variables['page_size']; + $page = pager_default_initialize(count($objects), $limit); + $objects = array_slice($objects, $page * $limit, $limit); + $variables['pager'] = theme('pager', array('quantity' => 10)); + // Content. + $map_objects = function($o) { + $o = islandora_object_load($o); + $url = "islandora/object/{$o->id}"; + $link_options = array('html' => TRUE, 'attributes' => array('title' => $o->label)); + $img = theme_image(array('path' => url("$url/datastream/TN/view"), 'attributes' => array())); + $description = NULL; + $dc = DublinCore::importFromXMLString($o['DC']->content); + if ($dc) { + $dc = $dc->asArray(); + $description = $dc['dc:description']['value']; + } + return array( + 'label' => $o->label, + 'class' => drupal_strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $o->id)), + 'link' => l($o->label, $url, $link_options), + 'thumb' => l($img, $url, $link_options), + 'description' => $description, + ); + }; + $objects = array_map($map_objects, $objects); + $theme = $grid_display ? 'islandora_objects_grid' : 'islandora_objects_list'; + $variables['content'] = theme($theme, array('objects' => $objects)); + $module_path = drupal_get_path('module', 'islandora'); + drupal_add_css("$module_path/css/islandora.objects.css"); +} From 212e113700ab5ed1da4ca2e2dee92480bf17363e Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 28 Mar 2013 12:14:58 -0300 Subject: [PATCH 11/42] Updated travis config a bit --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fa7e5ca9..a93edb4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ before_install: - drush dl --yes drupal - cd drupal-* - drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes - - drush runserver 8081 > /dev/null & + - drush runserver localhost:8081 > /dev/null & - ln -s $TRAVIS_BUILD_DIR sites/all/modules/islandora - mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini - mkdir sites/all/libraries @@ -32,4 +32,4 @@ before_install: - drush cc all - sleep 4 script: - - drush test-run --uri=http://127.0.0.1:8081 Islandora + - sudo -u www-data drush test-run --uri=http://localhost:8081 Islandora From 1f915cad127373b3fe7e042cd514c6ad7437fe0a Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 28 Mar 2013 12:27:19 -0300 Subject: [PATCH 12/42] Another try at travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a93edb4b..8fae0457 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ before_install: - pyrus channel-discover pear.drush.org - pyrus install drush/drush - phpenv rehash + - sudo -u www-data phpenv rehash - drush dl --yes drupal - cd drupal-* - drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes From ff8a7aa301316872f515e551ee1444469d7856fd Mon Sep 17 00:00:00 2001 From: daitken Date: Thu, 28 Mar 2013 12:39:35 -0300 Subject: [PATCH 13/42] object_properties.form.inc grammar fixes --- includes/object_properties.form.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/object_properties.form.inc b/includes/object_properties.form.inc index 29875d28..0898db0c 100644 --- a/includes/object_properties.form.inc +++ b/includes/object_properties.form.inc @@ -30,7 +30,7 @@ function islandora_object_properties_form(array $form, array &$form_state, Fedor '#title' => t('Item Label'), '#default_value' => $object->label, '#required' => 'TRUE', - '#description' => t('A Human readable label'), + '#description' => t('A human-readable label'), // Double the normal length. '#size' => 120, // Max length for a Fedora Label. @@ -43,14 +43,14 @@ function islandora_object_properties_form(array $form, array &$form_state, Fedor '#title' => t('Owner'), '#default_value' => $object->owner, '#required' => FALSE, - '#description' => t('The owner id'), + '#description' => t('The owner\'s account name'), '#type' => 'textfield', ), 'object_state' => array( '#title' => t('State'), '#default_value' => $object->state, '#required' => TRUE, - '#description' => t('The items state one of active, inactive or deleted'), + '#description' => t('The object\'s state (active, inactive or deleted)'), '#type' => 'select', '#options' => array('A' => 'Active', 'I' => 'Inactive', 'D' => 'Deleted'), ), From 815e3dc9bb9442047662b207a4fd2975999e8d43 Mon Sep 17 00:00:00 2001 From: daitken Date: Thu, 28 Mar 2013 12:43:35 -0300 Subject: [PATCH 14/42] add_datastream.form.inc grammar fixes --- includes/add_datastream.form.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/add_datastream.form.inc b/includes/add_datastream.form.inc index fa94148f..d19d5757 100644 --- a/includes/add_datastream.form.inc +++ b/includes/add_datastream.form.inc @@ -39,7 +39,7 @@ function islandora_add_datastream_form(array $form, array &$form_state, FedoraOb '#collapsed' => FALSE, 'dsid' => array( '#title' => 'Datastream ID', - '#description' => t("An ID for this stream that is unique to this object. Must start with a letter and contain only alphanumeric characters and dashes and underscores. Datastreams that are defined by the content model don't currently exist: @unused_dsids.", array('@unused_dsids' => $unused_datastreams)), + '#description' => t("An ID for this stream that is unique to this object. Must start with a letter and contain only alphanumeric characters, dashes and underscores. The following datastreams are defined by this content model but don't currently exist: @unused_dsids.", array('@unused_dsids' => $unused_datastreams)), ), '#type' => 'textfield', '#size' => 64, @@ -57,7 +57,7 @@ function islandora_add_datastream_form(array $form, array &$form_state, FedoraOb '#required' => TRUE, '#size' => 64, '#maxlength' => 64, - '#description' => t('A Human readable label'), + '#description' => t('A human-readable label'), '#type' => 'textfield', '#element_validate' => array('islandora_add_datastream_form_field_does_not_contain_a_forward_slash'), ), From 2763f2b267f80d42a1c0d8e8bf1ac66c0c5369d8 Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Thu, 28 Mar 2013 12:44:35 -0300 Subject: [PATCH 15/42] Use build_hook_list so we get correct hook_names when altering. --- includes/tuque_wrapper.inc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index 8bd3c3e6..9904af60 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -35,10 +35,7 @@ $islandora_module_path = drupal_get_path('module', 'islandora'); * Allow modules to alter an object before a mutable event occurs. */ function islandora_alter_object(AbstractFedoraObject $object, array &$context) { - $types = array('islandora_object'); - foreach ($object->models as $model) { - $types[] = "{$model}_islandora_object"; - } + $types = islandora_build_hook_list('islandora_object', $object->models); drupal_alter($types, $object, $context); } @@ -46,11 +43,11 @@ function islandora_alter_object(AbstractFedoraObject $object, array &$context) { * Allow modules to alter a datastream before a mutable event occurs. */ function islandora_alter_datastream(AbstractFedoraObject $object, AbstractDatastream $datastream, array &$context) { - $types = array('islandora_datastream'); + $types = array(); foreach ($object->models as $model) { - $types[] = "{$model}_{$datastream->id}_islandora_datastream"; + $types[] = "{$model}_{$datastream->id}"; } - drupal_alter($types, $object, $datastream, $context); + drupal_alter(islandora_build_hook_list('islandora_datastream', $types), $object, $datastream, $context); } /** From ac50236252628003e5a8cb50d21a2fe75f489036 Mon Sep 17 00:00:00 2001 From: daitken Date: Thu, 28 Mar 2013 12:49:05 -0300 Subject: [PATCH 16/42] admin.form.inc grammar fixes --- includes/admin.form.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin.form.inc b/includes/admin.form.inc index d3bccd5a..a1f22652 100644 --- a/includes/admin.form.inc +++ b/includes/admin.form.inc @@ -146,7 +146,7 @@ function islandora_repository_admin(array $form, array &$form_state) { '#type' => 'textfield', '#title' => t('PID namespaces allowed in this Drupal install'), '#default_value' => variable_get('islandora_pids_allowed', 'default: demo: changeme: ilives: islandora-book: books: newspapers: '), - '#description' => t('A space separated list of PID namespaces that users are permitted to access from this Drupal installation.
This could be more than a simple namespace ie demo:mydemos.
islandora: is reserved and is always allowed.'), + '#description' => t('A list of PID namespaces, separated by spaces, that users are permitted to access from this Drupal installation.
This could be more than a simple namespace, e.g. demo:mydemos.
The namespace islandora: is reserved, and is always allowed.'), '#weight' => 0, ); } From af933e66ff97e3316b7f5cbaacdbdc24f564c1b6 Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Thu, 28 Mar 2013 12:52:55 -0300 Subject: [PATCH 17/42] Add module_loads just incase and more consistency. --- includes/tuque_wrapper.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index 9904af60..8e4e8a0f 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -35,14 +35,15 @@ $islandora_module_path = drupal_get_path('module', 'islandora'); * Allow modules to alter an object before a mutable event occurs. */ function islandora_alter_object(AbstractFedoraObject $object, array &$context) { - $types = islandora_build_hook_list('islandora_object', $object->models); - drupal_alter($types, $object, $context); + module_load_include('inc', 'islandora', 'includes/utilities'); + drupal_alter(islandora_build_hook_list('islandora_object', $object->models) ,$object, $context); } /** * Allow modules to alter a datastream before a mutable event occurs. */ function islandora_alter_datastream(AbstractFedoraObject $object, AbstractDatastream $datastream, array &$context) { + module_load_include('inc', 'islandora', 'includes/utilities'); $types = array(); foreach ($object->models as $model) { $types[] = "{$model}_{$datastream->id}"; From 8204d1f8fd8a8409701003a45fa4c77305ddedb0 Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Mon, 1 Apr 2013 16:33:49 +0200 Subject: [PATCH 18/42] Standards Compliance --- tests/islandora_manage_permissions.test | 64 ++++++++++++++----------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/tests/islandora_manage_permissions.test b/tests/islandora_manage_permissions.test index 76f43a6d..5e20b374 100644 --- a/tests/islandora_manage_permissions.test +++ b/tests/islandora_manage_permissions.test @@ -1,7 +1,17 @@ 'Islandora Manage Permissions', @@ -10,69 +20,65 @@ class IslandoraPermissionsTestCase extends IslandoraWebTestCase { ); } + /** + * Prepares enviroment for testing. + * + * @see IslandoraWebTestCase::setUp() + */ public function setUp() { parent::setUp(array('islandora')); } + /** + * Test manage permissions. + */ public function testManagePermissions() { - - - // permission FEDORA_VIEW_OBJECTS - // create a user with permission + // Test permission FEDORA_VIEW_OBJECTS. + // Create a user with permission. $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS)); - // log the user in + // Log the user in. $this->drupalLogin($user); $this->clickLink(t('Islandora Repository')); $this->assertNoLink('Manage', 'Manage tab is not on current page.'); - - - // permission FEDORA_VIEW_OBJECTS, FEDORA_MANAGE_PROPERTIES + + // Test permission FEDORA_VIEW_OBJECTS, FEDORA_MANAGE_PROPERTIES. $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_MANAGE_PROPERTIES)); - // log the user in $this->drupalLogin($user); $this->clickLink(t('Islandora Repository')); $this->assertLink('Manage', 0, 'Manage tab is on current page.'); $this->clickLink(t('Manage')); $this->assertLink('Properties', 0, 'Properties tab is on current page.'); $this->assertNoLink('Datastreams', 'Datastreams tab is not on current page.'); - $this->assertNoLink('Collection','Collection tab is not on current page.'); + $this->assertNoLink('Collection', 'Collection tab is not on current page.'); - - // permission FEDORA_VIEW_OBJECTS, FEDORA_ADD_DS + // Test permission FEDORA_VIEW_OBJECTS, FEDORA_ADD_DS. $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_ADD_DS)); - // log the user in $this->drupalLogin($user); $this->clickLink(t('Islandora Repository')); $this->assertLink('Manage', 0, 'Manage tab is on current page.'); $this->clickLink(t('Manage')); $this->assertLink('Datastreams', 0, 'Datastreams tab is on current page.'); $this->assertNoLink('Properties', 'Properties tab is not on current page.'); - $this->assertNoLink('Collection','Collection tab is not on current page.'); - - - // permission FEDORA_VIEW_OBJECTS, FEDORA_METADATA_EDIT + $this->assertNoLink('Collection', 'Collection tab is not on current page.'); + + // Test permission FEDORA_VIEW_OBJECTS, FEDORA_METADATA_EDIT. $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_METADATA_EDIT)); - // log the user in - $this->drupalLogin($user); + $this->drupalLogin($user); $this->clickLink(t('Islandora Repository')); $this->assertLink('Manage', 0, 'Manage tab is on current page.'); $this->clickLink(t('Manage')); $this->assertLink('Datastreams', 0, 'Datastreams tab is on current page.'); $this->assertNoLink('Properties', 'Properties tab is not on current page.'); - $this->assertNoLink('Collection','Collection tab is not on current page.'); - - - // permission FEDORA_VIEW_OBJECTS, FEDORA_PURGE + $this->assertNoLink('Collection', 'Collection tab is not on current page.'); + + // Test permission FEDORA_VIEW_OBJECTS, FEDORA_PURGE. $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_PURGE)); - // log the user in $this->drupalLogin($user); $this->clickLink(t('Islandora Repository')); $this->assertLink('Manage', 0, 'Manage tab is on current page.'); $this->clickLink(t('Manage')); $this->assertLink('Datastreams', 0, 'Datastreams tab is on current page.'); $this->assertNoLink('Properties', 'Properties tab is not on current page.'); - $this->assertNoLink('Collection','Collection tab is not on current page.'); - + $this->assertNoLink('Collection', 'Collection tab is not on current page.'); } - - } \ No newline at end of file +} From 68bbbe163e3e67fddb4adf26eb4fd02a31d1597b Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Mon, 1 Apr 2013 17:30:41 +0200 Subject: [PATCH 19/42] Added tests for islandora_user_access(). Caught a spelling mistake as part of the testing writing. --- islandora.module | 2 +- tests/islandora_manage_permissions.test | 52 +++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index 57ee5d9b..47fed2e6 100644 --- a/islandora.module +++ b/islandora.module @@ -401,7 +401,7 @@ function islandora_user_access($object, array $permissions, $content_models = ar } elseif (is_subclass_of($object, 'FedoraDatastream')) { $datastream = $object; - $object = $datstream->parent; + $object = $datastream->parent; } // Check for access. $accessible_namespace = islandora_namespace_accessible($object->id); diff --git a/tests/islandora_manage_permissions.test b/tests/islandora_manage_permissions.test index 5e20b374..72aebd89 100644 --- a/tests/islandora_manage_permissions.test +++ b/tests/islandora_manage_permissions.test @@ -81,4 +81,56 @@ class IslandoraPermissionsTestCase extends IslandoraWebTestCase { $this->assertNoLink('Properties', 'Properties tab is not on current page.'); $this->assertNoLink('Collection', 'Collection tab is not on current page.'); } + + /** + * Test generic access functions. + * + * Note that we can't test with the Global user as SimpleTest doesn't support + * it. Therefore we can't test the authtoken support. + */ + public function testAccessFunctions() { + $object = islandora_object_load(variable_get('islandora_repository_pid', 'islandora:root')); + // Test islandora_user_access(); + // Test no object/permissions. + $ret = islandora_user_access(NULL, array()); + $this->assertFalse($ret, 'User access denied when no object/permissions are provided.'); + // Test with object no permissions. + $ret = islandora_user_access($object, array()); + $this->assertFalse($ret, 'User access denied when no permissions are provided.'); + // Test access with matching permission. + $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS)); + $ret = islandora_user_access($object, array(FEDORA_VIEW_OBJECTS), array(), TRUE, $user); + $this->assertTrue($ret, 'User access granted when permissions match.'); + // Test access with matching permission but access any is FALSE. + $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS)); + $ret = islandora_user_access($object, array(FEDORA_VIEW_OBJECTS, FEDORA_PURGE), array(), FALSE, $user); + $this->assertFalse($ret, 'User access denied for matching permission but with access any set to FALSE.'); + // Test access with non-matching permission. + $user = $this->drupalCreateUser(array(FEDORA_PURGE)); + $ret = islandora_user_access($object, array(FEDORA_VIEW_OBJECTS), array(), TRUE, $user); + $this->assertFalse($ret, 'User access denied when permissions did not match.'); + // Test access with both permissions and content model. + $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS)); + $model = $object->models; + $model = reset($model); + $ret = islandora_user_access($object, array(FEDORA_VIEW_OBJECTS), array($model), TRUE, $user); + $this->assertTrue($ret, 'User access granted for matching permission and model.'); + // Test access with matching permissions and non-matching content model. + $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS)); + $ret = islandora_user_access($object, array(FEDORA_VIEW_OBJECTS), array('islandora:obviouslyNotACModel'), TRUE, $user); + $this->assertFalse($ret, 'User access denied for matching permission and non-matching model.'); + // Test access with all matching permissions and one matching model but + // access any is FALSE. + $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_PURGE)); + $model = $object->models; + $model = reset($model); + $ret = islandora_user_access($object, array(FEDORA_VIEW_OBJECTS, FEDORA_PURGE), array($model, 'islandora:obviouslyNotACModel'), FALSE, $user); + $this->assertFalse($ret, 'User access denied for all matching permissions and one matching model but with access any set to FALSE.'); + $ret = islandora_user_access($object, array(FEDORA_VIEW_OBJECTS, FEDORA_PURGE), array($model), FALSE, $user); + $this->assertTrue($ret, 'User access granted for all matching permissions and matching models with access any set to FALSE.'); + // Test passing in a Datastream. + $user = $this->drupalCreateUser(array(FEDORA_VIEW_OBJECTS, FEDORA_PURGE)); + $ret = islandora_user_access($object['DC'], array(FEDORA_VIEW_OBJECTS), array(), TRUE, $user); + $this->assertTrue($ret, 'User access granted for matching permissions, with a datastream given instead of an object.'); + } } From 90b9b6ceb602ac68b2c4daa9b0548d3321b09b55 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Tue, 2 Apr 2013 19:33:43 +0000 Subject: [PATCH 20/42] Some updates of tests for Travis --- tests/hooks.test | 2 +- tests/web_test_case.inc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/hooks.test b/tests/hooks.test index 0a667fee..bc3020f3 100644 --- a/tests/hooks.test +++ b/tests/hooks.test @@ -32,7 +32,7 @@ class IslandoraHooksTestCase extends IslandoraWebTestCase { * @see IslandoraWebTestCase::setUp() */ public function setUp() { - parent::setUp('islandora_hooks_test', 'devel'); + parent::setUp('islandora_hooks_test'); $this->repository = $this->admin->repository; $this->purgeTestObjects(); } diff --git a/tests/web_test_case.inc b/tests/web_test_case.inc index a513de43..3651e3db 100644 --- a/tests/web_test_case.inc +++ b/tests/web_test_case.inc @@ -18,6 +18,10 @@ class IslandoraWebTestCase extends DrupalWebTestCase { // Always enable islandora. $args[] = 'islandora'; parent::setUp($args); + // Its possible test are running before class autoloading + module_load_include('inc', 'islandora', 'includes/tuque'); + module_load_include('inc', 'islandora', 'includes/tuque_wrapper'); + $this->configuration = $this->getTestConfiguration(); if ($this->configuration['use_drupal_filter']) { $this->backUpDrupalFilter(); From b1e57b16d89d95af9abe96cc13dfc29103638927 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Tue, 2 Apr 2013 16:38:57 -0300 Subject: [PATCH 21/42] Another change to the travis-ci config --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8fae0457..c5284425 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ before_install: - sudo apt-get install -qq php5-cgi - sudo apt-get install -qq php5-mysql - git clone git://github.com/Islandora/tuque.git - - git clone git://github.com/Islandora/islandora_tomcat.git + - git clone -b 3.5 git://github.com/Islandora/islandora_tomcat.git - cd islandora_tomcat - export CATALINA_HOME='.' - ./bin/startup.sh @@ -23,7 +23,7 @@ before_install: - drush dl --yes drupal - cd drupal-* - drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes - - drush runserver localhost:8081 > /dev/null & + - drush runserver localhost:8081 &>/dev/null & - ln -s $TRAVIS_BUILD_DIR sites/all/modules/islandora - mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini - mkdir sites/all/libraries @@ -33,4 +33,4 @@ before_install: - drush cc all - sleep 4 script: - - sudo -u www-data drush test-run --uri=http://localhost:8081 Islandora + - drush test-run --uri=http://localhost:8081 Islandora From 12dcbb5b17340653c249c14b00e117ca642994a3 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Tue, 2 Apr 2013 16:44:01 -0300 Subject: [PATCH 22/42] Another travis config change --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c5284425..b1c550de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,6 @@ before_install: - pyrus channel-discover pear.drush.org - pyrus install drush/drush - phpenv rehash - - sudo -u www-data phpenv rehash - drush dl --yes drupal - cd drupal-* - drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes From 54acff362ba344c81c8897fca5830797af839afe Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Wed, 3 Apr 2013 12:06:11 -0300 Subject: [PATCH 23/42] Handle downloading of clips in core (ONTIME-1262). --- islandora.module | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/islandora.module b/islandora.module index 05a3a57b..43b363fe 100644 --- a/islandora.module +++ b/islandora.module @@ -245,6 +245,14 @@ function islandora_menu() { 'type' => MENU_SUGGESTED_ITEM, 'access arguments' => array(FEDORA_INGEST), ); + $items['islandora/object/%islandora_object/download_clip'] = array( + 'page callback' => 'islandora_download_clip', + 'page arguments' => array(2), + 'type' => MENU_CALLBACK, + 'access callback' => 'islandora_object_access_callback', + 'access arguments' => array(FEDORA_VIEW_OBJECTS, 2), + 'load arguments' => array(2), + ); return $items; } @@ -1073,3 +1081,25 @@ function islandora_print_object(FedoraObject $object) { drupal_set_title($object->label); return theme('islandora_object_print', array('object' => $object)); } + +/** + * Menu callback downloads the given clip. + */ +function islandora_download_clip(FedoraObject $object) { + if (isset($_GET['clip'])) { + $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on'; + $http_protocol = $is_https ? 'https' : 'http'; + $url = $http_protocol . '://' . $_SERVER['HTTP_HOST'] . $_GET['clip']; + $filename = $object->label; + header("Content-Disposition: attachment; filename=\"{$filename}.jpg\""); + header("Content-type: image/jpeg"); + header("Content-Transfer-Encoding: binary"); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_URL, $url); + $response = curl_exec ($ch); + curl_close($ch); + } + exit(); +} \ No newline at end of file From 0b0acd0759dc323b060872d1c5e341d6bdc321fc Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Wed, 3 Apr 2013 12:08:00 -0300 Subject: [PATCH 24/42] New line and codesniffer changes. --- islandora.module | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/islandora.module b/islandora.module index 43b363fe..c9ea373b 100644 --- a/islandora.module +++ b/islandora.module @@ -120,7 +120,7 @@ function islandora_menu() { FEDORA_METADATA_EDIT, FEDORA_ADD_DS, FEDORA_PURGE, - FEDORA_INGEST + FEDORA_INGEST, ), 2), ); @@ -1098,8 +1098,8 @@ function islandora_download_clip(FedoraObject $object) { curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_URL, $url); - $response = curl_exec ($ch); + $response = curl_exec($ch); curl_close($ch); } exit(); -} \ No newline at end of file +} From 13efc16b6a57720d9c07913a2c87174773a52920 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 15:31:53 -0300 Subject: [PATCH 25/42] Updated travis config again --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b1c550de..b0883342 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php php: - - 5.3 + - 5.3.3 before_install: - mysql -u root -e 'create database drupal;' - mysql -u root -e "create database fedora;" @@ -8,8 +8,6 @@ before_install: - mysql -u root -e "GRANT ALL PRIVILEGES ON drupal.* To 'drupal'@'localhost' IDENTIFIED BY 'drupal';" - cd $HOME - sudo apt-get update -qq - - sudo apt-get install -qq php5-cgi - - sudo apt-get install -qq php5-mysql - git clone git://github.com/Islandora/tuque.git - git clone -b 3.5 git://github.com/Islandora/islandora_tomcat.git - cd islandora_tomcat From 35117d4f3046d8e5fb63b87edbaf74951893ca2d Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 15:40:33 -0300 Subject: [PATCH 26/42] added another updated travis config --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b0883342..6455bb7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php php: - - 5.3.3 + - 5.4 before_install: - mysql -u root -e 'create database drupal;' - mysql -u root -e "create database fedora;" @@ -20,7 +20,7 @@ before_install: - drush dl --yes drupal - cd drupal-* - drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes - - drush runserver localhost:8081 &>/dev/null & + - drush runserver --server=builtin localhost:8081 &>/dev/null & - ln -s $TRAVIS_BUILD_DIR sites/all/modules/islandora - mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini - mkdir sites/all/libraries From 258688747606cefd664a704164ce51db37c927e3 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 15:54:45 -0300 Subject: [PATCH 27/42] Updated travis to build with different fedora versions --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6455bb7f..e9909ebe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,9 @@ language: php php: - 5.4 +env: + - FEDORA_VERSION="3.5" + - FEDORA_VERSION="3.6.2" before_install: - mysql -u root -e 'create database drupal;' - mysql -u root -e "create database fedora;" From 2ac9ce5507d3bee1d8911b8569641105ec5778b0 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 16:11:53 -0300 Subject: [PATCH 28/42] Updated travis to build with different fedora versions --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e9909ebe..ffd4d8df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ before_install: - cd $HOME - sudo apt-get update -qq - git clone git://github.com/Islandora/tuque.git - - git clone -b 3.5 git://github.com/Islandora/islandora_tomcat.git + - git clone -b $FEDORA_VERSION git://github.com/Islandora/islandora_tomcat.git - cd islandora_tomcat - export CATALINA_HOME='.' - ./bin/startup.sh From 64ff24a0853c4978e76f93f8e7744e30f9c73924 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 16:27:36 -0300 Subject: [PATCH 29/42] Updated travis to build with different fedora versions --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ffd4d8df..6626bf0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,15 @@ language: php php: + - 5.3.3 - 5.4 env: - FEDORA_VERSION="3.5" - - FEDORA_VERSION="3.6.2" before_install: - mysql -u root -e 'create database drupal;' - mysql -u root -e "create database fedora;" - mysql -u root -e "GRANT ALL PRIVILEGES ON fedora.* To 'fedora'@'localhost' IDENTIFIED BY 'fedora';" - mysql -u root -e "GRANT ALL PRIVILEGES ON drupal.* To 'drupal'@'localhost' IDENTIFIED BY 'drupal';" - cd $HOME - - sudo apt-get update -qq - git clone git://github.com/Islandora/tuque.git - git clone -b $FEDORA_VERSION git://github.com/Islandora/islandora_tomcat.git - cd islandora_tomcat @@ -23,7 +22,7 @@ before_install: - drush dl --yes drupal - cd drupal-* - drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes - - drush runserver --server=builtin localhost:8081 &>/dev/null & + - drush runserver localhost:8081 &>/dev/null & - ln -s $TRAVIS_BUILD_DIR sites/all/modules/islandora - mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini - mkdir sites/all/libraries From 031d1579ad71771ef415dbf260a6ddb561974c88 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 16:53:37 -0300 Subject: [PATCH 30/42] Updated travis to build with different fedora versions --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6626bf0e..277a591b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ before_install: - drush dl --yes drupal - cd drupal-* - drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes - - drush runserver localhost:8081 &>/dev/null & + - drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/dev/null & - ln -s $TRAVIS_BUILD_DIR sites/all/modules/islandora - mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini - mkdir sites/all/libraries From 80aa8ed756df0dfb020f496eae5ddaadb566394f Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 17:15:18 -0300 Subject: [PATCH 31/42] moved travis setup to a script --- .travis.yml | 27 +-------------------------- tests/travis_setup.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 26 deletions(-) create mode 100755 tests/travis_setup.sh diff --git a/.travis.yml b/.travis.yml index 277a591b..1adb38a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,31 +5,6 @@ php: env: - FEDORA_VERSION="3.5" before_install: - - mysql -u root -e 'create database drupal;' - - mysql -u root -e "create database fedora;" - - mysql -u root -e "GRANT ALL PRIVILEGES ON fedora.* To 'fedora'@'localhost' IDENTIFIED BY 'fedora';" - - mysql -u root -e "GRANT ALL PRIVILEGES ON drupal.* To 'drupal'@'localhost' IDENTIFIED BY 'drupal';" - - cd $HOME - - git clone git://github.com/Islandora/tuque.git - - git clone -b $FEDORA_VERSION git://github.com/Islandora/islandora_tomcat.git - - cd islandora_tomcat - - export CATALINA_HOME='.' - - ./bin/startup.sh - - cd $HOME - - pyrus channel-discover pear.drush.org - - pyrus install drush/drush - - phpenv rehash - - drush dl --yes drupal - - cd drupal-* - - drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes - - drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/dev/null & - - ln -s $TRAVIS_BUILD_DIR sites/all/modules/islandora - - mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini - - mkdir sites/all/libraries - - ln -s $HOME/tuque sites/all/libraries/tuque - - drush en --yes simpletest - - drush en --user=1 --yes islandora - - drush cc all - - sleep 4 + - $TRAVIS_BUILD_DIR/test/setup_travis.sh script: - drush test-run --uri=http://localhost:8081 Islandora diff --git a/tests/travis_setup.sh b/tests/travis_setup.sh new file mode 100755 index 00000000..936aea0d --- /dev/null +++ b/tests/travis_setup.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +mysql -u root -e 'create database drupal;' +mysql -u root -e "create database fedora;" +mysql -u root -e "GRANT ALL PRIVILEGES ON fedora.* To 'fedora'@'localhost' IDENTIFIED BY 'fedora';" +mysql -u root -e "GRANT ALL PRIVILEGES ON drupal.* To 'drupal'@'localhost' IDENTIFIED BY 'drupal';" +cd $HOME +git clone git://github.com/Islandora/tuque.git +git clone -b $FEDORA_VERSION git://github.com/Islandora/islandora_tomcat.git +cd islandora_tomcat +export CATALINA_HOME='.' +./bin/startup.sh +cd $HOME +pyrus channel-discover pear.drush.org +pyrus install drush/drush +phpenv rehash +drush dl --yes drupal +cd drupal-* +drush si standard --db-url=mysql://drupal:drupal@localhost/drupal --yes +drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/dev/null & +ln -s $TRAVIS_BUILD_DIR sites/all/modules/islandora +mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini +mkdir sites/all/libraries +ln -s $HOME/tuque sites/all/libraries/tuque +drush en --yes simpletest +drush en --user=1 --yes islandora +drush cc all +sleep 4 From f4c758684b977b672b84152a6f1913039265ff7f Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 17:18:24 -0300 Subject: [PATCH 32/42] Minor mistake from previous travis config --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1adb38a4..acc9a0dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,6 @@ php: env: - FEDORA_VERSION="3.5" before_install: - - $TRAVIS_BUILD_DIR/test/setup_travis.sh + - $TRAVIS_BUILD_DIR/tests/setup_travis.sh script: - drush test-run --uri=http://localhost:8081 Islandora From 3b5e7cda938c3adb2171816cb79605ea94d80bf5 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 17:20:42 -0300 Subject: [PATCH 33/42] Another dumb path error --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index acc9a0dc..dcd11c3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,6 @@ php: env: - FEDORA_VERSION="3.5" before_install: - - $TRAVIS_BUILD_DIR/tests/setup_travis.sh + - $TRAVIS_BUILD_DIR/tests/travis_setup.sh script: - drush test-run --uri=http://localhost:8081 Islandora From 6e49122ad090a815663227c85c37092d943e77ca Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 17:27:15 -0300 Subject: [PATCH 34/42] should work again --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index dcd11c3e..99d605b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,6 @@ env: - FEDORA_VERSION="3.5" before_install: - $TRAVIS_BUILD_DIR/tests/travis_setup.sh + - cd drupal-* script: - drush test-run --uri=http://localhost:8081 Islandora From 28b66eaf8e5a33e040c520c49a7d853320f3c390 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 17:34:35 -0300 Subject: [PATCH 35/42] another update for paths --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 99d605b4..96872f5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,6 @@ env: - FEDORA_VERSION="3.5" before_install: - $TRAVIS_BUILD_DIR/tests/travis_setup.sh - - cd drupal-* + - cd $HOME/drupal-* script: - drush test-run --uri=http://localhost:8081 Islandora From 9d714e1c81ab7e67040514d73f79dbadcd687cff Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 17:56:16 -0300 Subject: [PATCH 36/42] Added some branch exclusions. Renamed readme. --- .travis.yml | 3 +++ README.txt => README.md | 0 2 files changed, 3 insertions(+) rename README.txt => README.md (100%) diff --git a/.travis.yml b/.travis.yml index 96872f5c..e5ced01d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ language: php php: - 5.3.3 - 5.4 +branches: + only: + - 7.x env: - FEDORA_VERSION="3.5" before_install: diff --git a/README.txt b/README.md similarity index 100% rename from README.txt rename to README.md From a501d8a6495caf7ba15a58cb79b44539a3008448 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 19:41:47 -0300 Subject: [PATCH 37/42] Added Jenkins status to readme --- README.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ce276d7b..dceaec0e 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,10 @@ -CONTENTS OF THIS FILE ---------------------- - - * summary - * requirements - * installation - * configuration - * customization - * troubleshooting - * faq - * contact - * sponsors +BUILD STATUS +------------ +Current build status: +[![Build Status](https://travis-ci.org/Islandora/islandora.png?branch=7.x)](https://travis-ci.org/Islandora/islandora) +CI Server: +http://jenkins.discoverygarden.ca:8080 SUMMARY ------- From 092133272e6c910936db36b1e7e4411a28f0a9e6 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 20:09:18 -0300 Subject: [PATCH 38/42] Added codesniffer to travisci When code is pushed it is now failed if it fails codesniffer. Also pushed a number of coding standards fixes so that this commit will build correctly. --- .travis.yml | 3 ++- includes/object_properties.form.inc | 4 ++-- includes/tuque_wrapper.inc | 2 +- islandora.install | 5 +++-- islandora.module | 2 +- tests/travis_setup.sh | 3 +++ tests/web_test_case.inc | 3 ++- theme/islandora-objects.tpl.php | 8 +++++++- 8 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index e5ced01d..dc0a8794 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,5 +10,6 @@ env: before_install: - $TRAVIS_BUILD_DIR/tests/travis_setup.sh - cd $HOME/drupal-* -script: +script: + - drush dcs sites/all/modules/islandora - drush test-run --uri=http://localhost:8081 Islandora diff --git a/includes/object_properties.form.inc b/includes/object_properties.form.inc index 0898db0c..c9de5e8f 100644 --- a/includes/object_properties.form.inc +++ b/includes/object_properties.form.inc @@ -43,14 +43,14 @@ function islandora_object_properties_form(array $form, array &$form_state, Fedor '#title' => t('Owner'), '#default_value' => $object->owner, '#required' => FALSE, - '#description' => t('The owner\'s account name'), + '#description' => t("The owner's account name"), '#type' => 'textfield', ), 'object_state' => array( '#title' => t('State'), '#default_value' => $object->state, '#required' => TRUE, - '#description' => t('The object\'s state (active, inactive or deleted)'), + '#description' => t("The object's state (active, inactive or deleted)"), '#type' => 'select', '#options' => array('A' => 'Active', 'I' => 'Inactive', 'D' => 'Deleted'), ), diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index 8e4e8a0f..4d989e9f 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -36,7 +36,7 @@ $islandora_module_path = drupal_get_path('module', 'islandora'); */ function islandora_alter_object(AbstractFedoraObject $object, array &$context) { module_load_include('inc', 'islandora', 'includes/utilities'); - drupal_alter(islandora_build_hook_list('islandora_object', $object->models) ,$object, $context); + drupal_alter(islandora_build_hook_list('islandora_object', $object->models), $object, $context); } /** diff --git a/islandora.install b/islandora.install index 9a1825b5..caff7d75 100644 --- a/islandora.install +++ b/islandora.install @@ -10,13 +10,14 @@ */ function islandora_requirements($phase) { $requirements = array(); - // Ensure translations don't break at install time + + // Ensure translations don't break at install time. $t = get_t(); if (!class_exists('XSLTProcessor', FALSE)) { $requirements['islandora_xsltprocessor']['title'] = $t('Islandora XSLTProcessor Prerequisite'); $requirements['islandora_xsltprocessor']['value'] = $t('Not installed'); - $link = l($t('PHP XSL extension'), 'http://us2.php.net/manual/en/book.xsl.php', array('attributes' => array('target'=>'_blank'))); + $link = l($t('PHP XSL extension'), 'http://us2.php.net/manual/en/book.xsl.php', array('attributes' => array('target' => '_blank'))); $requirements['islandora_xsltprocessor']['description'] = $t('The !xsllink is required. Check your installed PHP extensions and php.ini file.', array('!xsllink' => $link)); $requirements['islandora_xsltprocessor']['severity'] = REQUIREMENT_ERROR; } diff --git a/islandora.module b/islandora.module index 05a3a57b..981189bc 100644 --- a/islandora.module +++ b/islandora.module @@ -120,7 +120,7 @@ function islandora_menu() { FEDORA_METADATA_EDIT, FEDORA_ADD_DS, FEDORA_PURGE, - FEDORA_INGEST + FEDORA_INGEST, ), 2), ); diff --git a/tests/travis_setup.sh b/tests/travis_setup.sh index 936aea0d..abbaccd2 100755 --- a/tests/travis_setup.sh +++ b/tests/travis_setup.sh @@ -13,6 +13,7 @@ export CATALINA_HOME='.' cd $HOME pyrus channel-discover pear.drush.org pyrus install drush/drush +pyrus install pear/PHP_CodeSniffer phpenv rehash drush dl --yes drupal cd drupal-* @@ -22,6 +23,8 @@ ln -s $TRAVIS_BUILD_DIR sites/all/modules/islandora mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini mkdir sites/all/libraries ln -s $HOME/tuque sites/all/libraries/tuque +drush dl --yes coder +drush en --yes coder_review drush en --yes simpletest drush en --user=1 --yes islandora drush cc all diff --git a/tests/web_test_case.inc b/tests/web_test_case.inc index 3651e3db..8a5b9a00 100644 --- a/tests/web_test_case.inc +++ b/tests/web_test_case.inc @@ -18,7 +18,8 @@ class IslandoraWebTestCase extends DrupalWebTestCase { // Always enable islandora. $args[] = 'islandora'; parent::setUp($args); - // Its possible test are running before class autoloading + + // Its possible test are running before class autoloading. module_load_include('inc', 'islandora', 'includes/tuque'); module_load_include('inc', 'islandora', 'includes/tuque_wrapper'); diff --git a/theme/islandora-objects.tpl.php b/theme/islandora-objects.tpl.php index 5b55eb88..f1893ef6 100644 --- a/theme/islandora-objects.tpl.php +++ b/theme/islandora-objects.tpl.php @@ -7,7 +7,13 @@ ?>
- $display_links, 'attributes' => array('class' => array('links', 'inline')))); ?> + $display_links, + 'attributes' => array('class' => array('links', 'inline')), + ) + ); + ?> From b9d0eaebb09a171e82eca34a9d174e63aa93447c Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 20:15:17 -0300 Subject: [PATCH 39/42] Added a lint to travis. Just in case. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index dc0a8794..124d7ce9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,5 +11,6 @@ before_install: - $TRAVIS_BUILD_DIR/tests/travis_setup.sh - cd $HOME/drupal-* script: + - ant lint - drush dcs sites/all/modules/islandora - drush test-run --uri=http://localhost:8081 Islandora From d67c95f90174876700121d3b56aea8062c65a29f Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 4 Apr 2013 20:22:27 -0300 Subject: [PATCH 40/42] Fixed ant path issue --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 124d7ce9..0c5fe32a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,6 @@ before_install: - $TRAVIS_BUILD_DIR/tests/travis_setup.sh - cd $HOME/drupal-* script: - - ant lint + - ant -buildfile sites/all/modules/islandora/build.xml lint - drush dcs sites/all/modules/islandora - drush test-run --uri=http://localhost:8081 Islandora From a55d03c12a20a3943876c6ea68d91ffd2208156d Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Fri, 5 Apr 2013 10:03:54 -0300 Subject: [PATCH 41/42] Update README.md Removed 8080 from the jenkins URL. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dceaec0e..fd2663b7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Current build status: [![Build Status](https://travis-ci.org/Islandora/islandora.png?branch=7.x)](https://travis-ci.org/Islandora/islandora) CI Server: -http://jenkins.discoverygarden.ca:8080 +http://jenkins.discoverygarden.ca SUMMARY ------- From 82fa859e3ba62a73330281c96a07092f52ddceff Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Fri, 5 Apr 2013 12:57:58 -0300 Subject: [PATCH 42/42] Coding style fixes. --- islandora.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/islandora.module b/islandora.module index c9ea373b..64c81628 100644 --- a/islandora.module +++ b/islandora.module @@ -1077,7 +1077,7 @@ function islandora_entity_property_info() { * @return array * A renderable array. */ -function islandora_print_object(FedoraObject $object) { +function islandora_print_object(AbstractObject $object) { drupal_set_title($object->label); return theme('islandora_object_print', array('object' => $object)); } @@ -1085,7 +1085,7 @@ function islandora_print_object(FedoraObject $object) { /** * Menu callback downloads the given clip. */ -function islandora_download_clip(FedoraObject $object) { +function islandora_download_clip(AbstractObject $object) { if (isset($_GET['clip'])) { $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on'; $http_protocol = $is_https ? 'https' : 'http';