Browse Source

Merge pull request #377 from jordandukart/7.x-fixes

Fix a collding array key, code style.
pull/371/merge
Jonathan Green 11 years ago
parent
commit
73e09a9d0d
  1. 74
      includes/add_datastream.form.inc
  2. 9
      includes/datastream.inc
  3. 2
      includes/datastream.version.inc
  4. 27
      includes/ingest.form.inc
  5. 3
      includes/object.entity_controller.inc
  6. 2
      includes/utilities.inc
  7. 12
      tests/islandora_ingest_test.module
  8. 12
      theme/theme.inc

74
includes/add_datastream.form.inc

@ -32,7 +32,7 @@ function islandora_add_datastream_form(array $form, array &$form_state, Abstract
'#attributes' => array(
'enctype' => 'multipart/form-data',
),
'dsid' => array(
'dsid_fieldset' => array(
'#type' => 'fieldset',
'#title' => 'Add a datastream',
'#collapsible' => FALSE,
@ -40,44 +40,44 @@ function islandora_add_datastream_form(array $form, array &$form_state, Abstract
'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, dashes and underscores. The following datastreams are defined by this content model but don't currently exist: <b>@unused_dsids</b>.", array('@unused_dsids' => $unused_datastreams)),
'#type' => 'textfield',
'#size' => 64,
'#maxlength' => 64,
'#required' => TRUE,
'#element_validate' => array(
'islandora_add_datastream_form_field_is_not_an_existing_datastream_id',
'islandora_add_datastream_form_field_starts_with_a_letter',
'islandora_add_datastream_form_field_is_valid_dsid',
),
'#autocomplete_path' => "islandora/object/{$object->id}/manage/datastreams/add/autocomplete",
),
'#type' => 'textfield',
'#size' => 64,
'#maxlength' => 64,
'#required' => TRUE,
'#element_validate' => array(
'islandora_add_datastream_form_field_is_not_an_existing_datastream_id',
'islandora_add_datastream_form_field_starts_with_a_letter',
'islandora_add_datastream_form_field_is_valid_dsid',
'label' => array(
'#title' => 'Datastream Label',
'#required' => TRUE,
'#size' => 64,
'#maxlength' => 64,
'#description' => t('A human-readable label'),
'#type' => 'textfield',
'#element_validate' => array('islandora_add_datastream_form_field_does_not_contain_a_forward_slash'),
),
'#autocomplete_path' => "islandora/object/{$object->id}/manage/datastreams/add/autocomplete",
),
'label' => array(
'#title' => 'Datastream Label',
'#required' => TRUE,
'#size' => 64,
'#maxlength' => 64,
'#description' => t('A human-readable label'),
'#type' => 'textfield',
'#element_validate' => array('islandora_add_datastream_form_field_does_not_contain_a_forward_slash'),
),
'file' => array(
'#type' => 'managed_file',
'#required' => TRUE,
'#title' => t('Upload Document'),
'#size' => 48,
'#description' => t('Select a file to upload.<br/>Files must be less than <b>@size MB.</b>', array('@size' => $upload_size)),
'#default_value' => isset($form_state['values']['files']) ? $form_state['values']['files'] : NULL,
'#upload_location' => 'temporary://',
'#upload_validators' => array(
'file_validate_extensions' => array(NULL),
// Assume its specified in MB.
'file_validate_size' => array($upload_size * 1024 * 1024),
'file' => array(
'#type' => 'managed_file',
'#required' => TRUE,
'#title' => t('Upload Document'),
'#size' => 48,
'#description' => t('Select a file to upload.<br/>Files must be less than <b>@size MB.</b>', array('@size' => $upload_size)),
'#default_value' => isset($form_state['values']['files']) ? $form_state['values']['files'] : NULL,
'#upload_location' => 'temporary://',
'#upload_validators' => array(
'file_validate_extensions' => array(NULL),
// Assume its specified in MB.
'file_validate_size' => array($upload_size * 1024 * 1024),
),
),
'submit' => array(
'#type' => 'submit',
'#value' => t('Add Datastream'),
),
),
'submit' => array(
'#type' => 'submit',
'#value' => t('Add Datastream'),
),
);
}
@ -148,7 +148,7 @@ function islandora_add_datastream_form_field_does_not_contain_a_forward_slash(ar
}
/**
* Checks if the given datastream requires the upload to be a certian MIME type.
* Checks if the given datastream requires the upload to be a certain MIME type.
*
* @param array $form
* The Drupal form.

9
includes/datastream.inc

@ -112,6 +112,9 @@ function islandora_datastream_get_url(AbstractDatastream $datastream, $type = 'd
*
* @param AbstractDatastream $datastream
* The datastream to generated the url to.
*
* @return string
* Markup containing the link to the confirm form to delete the datastream.
*/
function islandora_datastream_get_delete_link(AbstractDatastream $datastream) {
$message = islandora_deprecated('7.x-1.2', 'Use the "islandora_datastream_delete_link" theme implementation.');
@ -127,6 +130,9 @@ function islandora_datastream_get_delete_link(AbstractDatastream $datastream) {
*
* @param AbstractDatastream $datastream
* The datastream to generated the url to.
*
* @return string
* Markup containing the link to edit the datastream.
*/
function islandora_datastream_edit_get_link(AbstractDatastream $datastream) {
$message = islandora_deprecated('7.x-1.2', 'Use the "islandora_datastream_edit_link" theme implementation.');
@ -169,6 +175,9 @@ function islandora_edit_datastream(AbstractDatastream $datastream) {
*
* @param array $edit_registry
* A list of 'islandora_edit_datastream_registry' values.
*
* @return array
* A Drupal renderable array containing the "edit" markup.
*/
function islandora_edit_datastream_registry_render(array $edit_registry) {
$markup = '';

2
includes/datastream.version.inc

@ -65,6 +65,8 @@ function islandora_datastream_version_table($datastream) {
* The Drupal form state.
* @param AbstractDatastream $datastream
* The datastream to be deleted.
* @param string $version
* The version number of the datastream we are trying to delete.
*
* @return array
* The drupal form definition.

27
includes/ingest.form.inc

@ -186,10 +186,10 @@ function islandora_ingest_form_get_step(array &$form_state, $step_id = NULL) {
*
* @param array $form_state
* The Drupal form state.
* @param string $step
* @param array $step
* The step relative to the result, if not provided the current step is used.
*
* @return string
* @return array|null
* The next step if found, NULL otherwise.
*/
function islandora_ingest_form_get_next_step(array &$form_state, array $step = NULL) {
@ -205,10 +205,10 @@ function islandora_ingest_form_get_next_step(array &$form_state, array $step = N
*
* @param array $form_state
* The Drupal form state.
* @param string $step
* @param array $step
* The step relative to the result, if not provided the current step is used.
*
* @return string
* @return array|null
* The next step if found, NULL otherwise.
*/
function islandora_ingest_form_get_previous_step(array &$form_state, array $step = NULL) {
@ -329,6 +329,9 @@ function islandora_ingest_form_decrement_step(array &$form_state) {
* The Drupal form.
* @param array $form_state
* The Drupal form state.
* @param string $step_id
* The ID of the step relative to the result, if not provided the current
* step_id is used.
*
* @return array
* The form definition of the current step.
@ -363,6 +366,8 @@ function islandora_ingest_form_execute_step(array $form, array &$form_state, $st
* The Drupal form.
* @param array $form_state
* The Drupal form state.
* @param array $step
* The step we are executing.
*
* @return array
* The form definition of the given step.
@ -391,6 +396,8 @@ function islandora_ingest_form_execute_form_step(array $form, array &$form_state
* The Drupal form.
* @param array $form_state
* The Drupal form state.
* @param array $step
* The step that execution begins from.
*/
function islandora_ingest_form_execute_consecutive_callback_steps(array $form, array &$form_state, array $step) {
do {
@ -409,6 +416,8 @@ function islandora_ingest_form_execute_consecutive_callback_steps(array $form, a
* The Drupal form.
* @param array $form_state
* The Drupal form state.
* @param array $step
* The step currently being executed.
*/
function islandora_ingest_form_execute_callback_step(array $form, array &$form_state, array $step) {
$args = array(&$form_state);
@ -425,6 +434,8 @@ function islandora_ingest_form_execute_callback_step(array $form, array &$form_s
* The Drupal form.
* @param array $form_state
* The Drupal form state.
* @param array $step
* The step that execution begins from.
*/
function islandora_ingest_form_undo_consecutive_callback_steps(array $form, array &$form_state, array $step) {
do {
@ -443,6 +454,8 @@ function islandora_ingest_form_undo_consecutive_callback_steps(array $form, arra
* The Drupal form.
* @param array $form_state
* The Drupal form state.
* @param array $step
* The step which the undo callback is being called on.
*/
function islandora_ingest_form_undo_callback_step(array $form, array &$form_state, array $step) {
$args = array(&$form_state);
@ -457,11 +470,13 @@ function islandora_ingest_form_undo_callback_step(array $form, array &$form_stat
* The Drupal form.
* @param array $form_state
* The Drupal form state.
* @param array $step
* An array defining a ingest step.
*
* @return array
* The stepified Drupal form definition for the given step.
*/
function islandora_ingest_form_stepify(array $form, array &$form_state, $step) {
function islandora_ingest_form_stepify(array $form, array &$form_state, array $step) {
$first_form_step = islandora_ingest_form_on_first_form_step($form_state);
$last_form_step = islandora_ingest_form_on_last_form_step($form_state);
$form['form_step_id'] = array(
@ -692,6 +707,8 @@ function islandora_ingest_form_ingest_button(array &$form_state) {
*
* Attempts to ingest every object built by the previous steps.
*
* @param array $form
* The Drupal form.
* @param array $form_state
* The Drupal form state.
*/

3
includes/object.entity_controller.inc

@ -24,6 +24,9 @@ class IslandoraObjectEntityController implements DrupalEntityControllerInterface
* The ID's of the entities.
* @param array $conditions
* The conditions to apply.
*
* @return array
* An array of loaded objects.
*/
public function load($ids = array(), $conditions = array()) {
if (!empty($conditions)) {

2
includes/utilities.inc

@ -14,6 +14,8 @@
*
* @param int $bytes
* Size in bytes to convert
* @param int $precision
* The amount of decimal precision to show.
*
* @return string
* Human readable size.

12
tests/islandora_ingest_test.module

@ -87,7 +87,11 @@ function islandora_ingest_test_test_testcmodel2_islandora_ingest_steps(array &$f
* The Drupal form definition.
*/
function islandora_ingest_test_set_label_form(array $form, array &$form_state) {
$models = array('test:nomorestepscmodel', 'test:testcmodel', 'test:testcmodel2');
$models = array(
'test:nomorestepscmodel',
'test:testcmodel',
'test:testcmodel2',
);
$model = isset($form_state['values']['model']) ? $form_state['values']['model'] : reset($models);
$shared_storage = &islandora_ingest_form_get_shared_storage($form_state);
$shared_storage['models'] = array($model);
@ -139,8 +143,7 @@ function islandora_ingest_test_set_label_form_submit(array $form, array &$form_s
* Test the First content model.
*/
function islandora_ingest_test_testcmodel_form(array $form, array &$form_state) {
return array(
);
return array();
}
/**
@ -154,8 +157,7 @@ function islandora_ingest_test_testcmodel_form_submit(array $form, array &$form_
* Test the second content model.
*/
function islandora_ingest_test_testcmodel2_form(array $form, array &$form_state) {
return array(
);
return array();
}
/**

12
theme/theme.inc

@ -251,6 +251,9 @@ function islandora_preprocess_islandora_objects(array &$variables) {
* @param array $vars
* An array containing:
* - datastream: An AbstractDatastream for which to generate a download link.
*
* @return string
* Markup containing the download url if the user has access, empty otherwise.
*/
function theme_islandora_datastream_download_link(array $vars) {
$datastream = $vars['datastream'];
@ -270,6 +273,9 @@ function theme_islandora_datastream_download_link(array $vars) {
* - datastream: An AbstractDatastream for which to generate a view link.
* - label: (Optional) The label for the link.
* - version: (Optional) The version of the datstream to link to.
*
* @return string
* Markup containing the link to the datastream or the label if inaccessible.
*/
function theme_islandora_datastream_view_link(array $vars) {
$datastream = $vars['datastream'];
@ -304,6 +310,9 @@ function theme_islandora_datastream_view_link(array $vars) {
* An array containing:
* - datastream: An AbstractDatastream for which to generate a delete link.
* - version: (optional) the version of the datastream to delete.
*
* @return string
* Markup containing the url to delete a datastream, or empty if inaccessible.
*/
function theme_islandora_datastream_delete_link(array $vars) {
$datastream = $vars['datastream'];
@ -336,6 +345,9 @@ function theme_islandora_datastream_delete_link(array $vars) {
* @param array $vars
* An array containing:
* - datastream: An AbstractDatastream for which to generate a edit link.
*
* @return string
* Markup containing the url to edit a datastream, or empty if inaccessible.
*/
function theme_islandora_datastream_edit_link(array $vars) {
$datastream = $vars['datastream'];

Loading…
Cancel
Save