Browse Source

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

Fix a collding array key, code style.
pull/371/merge
Jonathan Green 12 years ago
parent
commit
73e09a9d0d
  1. 6
      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

6
includes/add_datastream.form.inc

@ -32,7 +32,7 @@ function islandora_add_datastream_form(array $form, array &$form_state, Abstract
'#attributes' => array( '#attributes' => array(
'enctype' => 'multipart/form-data', 'enctype' => 'multipart/form-data',
), ),
'dsid' => array( 'dsid_fieldset' => array(
'#type' => 'fieldset', '#type' => 'fieldset',
'#title' => 'Add a datastream', '#title' => 'Add a datastream',
'#collapsible' => FALSE, '#collapsible' => FALSE,
@ -40,7 +40,6 @@ function islandora_add_datastream_form(array $form, array &$form_state, Abstract
'dsid' => array( 'dsid' => array(
'#title' => 'Datastream ID', '#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)), '#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', '#type' => 'textfield',
'#size' => 64, '#size' => 64,
'#maxlength' => 64, '#maxlength' => 64,
@ -79,6 +78,7 @@ function islandora_add_datastream_form(array $form, array &$form_state, Abstract
'#type' => 'submit', '#type' => 'submit',
'#value' => t('Add Datastream'), '#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 * @param array $form
* The Drupal form. * The Drupal form.

9
includes/datastream.inc

@ -112,6 +112,9 @@ function islandora_datastream_get_url(AbstractDatastream $datastream, $type = 'd
* *
* @param AbstractDatastream $datastream * @param AbstractDatastream $datastream
* The datastream to generated the url to. * 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) { function islandora_datastream_get_delete_link(AbstractDatastream $datastream) {
$message = islandora_deprecated('7.x-1.2', 'Use the "islandora_datastream_delete_link" theme implementation.'); $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 * @param AbstractDatastream $datastream
* The datastream to generated the url to. * 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) { function islandora_datastream_edit_get_link(AbstractDatastream $datastream) {
$message = islandora_deprecated('7.x-1.2', 'Use the "islandora_datastream_edit_link" theme implementation.'); $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 * @param array $edit_registry
* A list of 'islandora_edit_datastream_registry' values. * 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) { function islandora_edit_datastream_registry_render(array $edit_registry) {
$markup = ''; $markup = '';

2
includes/datastream.version.inc

@ -65,6 +65,8 @@ function islandora_datastream_version_table($datastream) {
* The Drupal form state. * The Drupal form state.
* @param AbstractDatastream $datastream * @param AbstractDatastream $datastream
* The datastream to be deleted. * The datastream to be deleted.
* @param string $version
* The version number of the datastream we are trying to delete.
* *
* @return array * @return array
* The drupal form definition. * 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 * @param array $form_state
* The Drupal 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. * 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. * The next step if found, NULL otherwise.
*/ */
function islandora_ingest_form_get_next_step(array &$form_state, array $step = NULL) { 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 * @param array $form_state
* The Drupal 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. * 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. * The next step if found, NULL otherwise.
*/ */
function islandora_ingest_form_get_previous_step(array &$form_state, array $step = NULL) { 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. * The Drupal form.
* @param array $form_state * @param array $form_state
* The Drupal 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 * @return array
* The form definition of the current step. * 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. * The Drupal form.
* @param array $form_state * @param array $form_state
* The Drupal form state. * The Drupal form state.
* @param array $step
* The step we are executing.
* *
* @return array * @return array
* The form definition of the given step. * 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. * The Drupal form.
* @param array $form_state * @param array $form_state
* The Drupal 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) { function islandora_ingest_form_execute_consecutive_callback_steps(array $form, array &$form_state, array $step) {
do { do {
@ -409,6 +416,8 @@ function islandora_ingest_form_execute_consecutive_callback_steps(array $form, a
* The Drupal form. * The Drupal form.
* @param array $form_state * @param array $form_state
* The Drupal 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) { function islandora_ingest_form_execute_callback_step(array $form, array &$form_state, array $step) {
$args = array(&$form_state); $args = array(&$form_state);
@ -425,6 +434,8 @@ function islandora_ingest_form_execute_callback_step(array $form, array &$form_s
* The Drupal form. * The Drupal form.
* @param array $form_state * @param array $form_state
* The Drupal 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) { function islandora_ingest_form_undo_consecutive_callback_steps(array $form, array &$form_state, array $step) {
do { do {
@ -443,6 +454,8 @@ function islandora_ingest_form_undo_consecutive_callback_steps(array $form, arra
* The Drupal form. * The Drupal form.
* @param array $form_state * @param array $form_state
* The Drupal 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) { function islandora_ingest_form_undo_callback_step(array $form, array &$form_state, array $step) {
$args = array(&$form_state); $args = array(&$form_state);
@ -457,11 +470,13 @@ function islandora_ingest_form_undo_callback_step(array $form, array &$form_stat
* The Drupal form. * The Drupal form.
* @param array $form_state * @param array $form_state
* The Drupal form state. * The Drupal form state.
* @param array $step
* An array defining a ingest step.
* *
* @return array * @return array
* The stepified Drupal form definition for the given step. * 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); $first_form_step = islandora_ingest_form_on_first_form_step($form_state);
$last_form_step = islandora_ingest_form_on_last_form_step($form_state); $last_form_step = islandora_ingest_form_on_last_form_step($form_state);
$form['form_step_id'] = array( $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. * Attempts to ingest every object built by the previous steps.
* *
* @param array $form
* The Drupal form.
* @param array $form_state * @param array $form_state
* The Drupal 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. * The ID's of the entities.
* @param array $conditions * @param array $conditions
* The conditions to apply. * The conditions to apply.
*
* @return array
* An array of loaded objects.
*/ */
public function load($ids = array(), $conditions = array()) { public function load($ids = array(), $conditions = array()) {
if (!empty($conditions)) { if (!empty($conditions)) {

2
includes/utilities.inc

@ -14,6 +14,8 @@
* *
* @param int $bytes * @param int $bytes
* Size in bytes to convert * Size in bytes to convert
* @param int $precision
* The amount of decimal precision to show.
* *
* @return string * @return string
* Human readable size. * 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. * The Drupal form definition.
*/ */
function islandora_ingest_test_set_label_form(array $form, array &$form_state) { 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); $model = isset($form_state['values']['model']) ? $form_state['values']['model'] : reset($models);
$shared_storage = &islandora_ingest_form_get_shared_storage($form_state); $shared_storage = &islandora_ingest_form_get_shared_storage($form_state);
$shared_storage['models'] = array($model); $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. * Test the First content model.
*/ */
function islandora_ingest_test_testcmodel_form(array $form, array &$form_state) { 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. * Test the second content model.
*/ */
function islandora_ingest_test_testcmodel2_form(array $form, array &$form_state) { 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 * @param array $vars
* An array containing: * An array containing:
* - datastream: An AbstractDatastream for which to generate a download link. * - 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) { function theme_islandora_datastream_download_link(array $vars) {
$datastream = $vars['datastream']; $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. * - datastream: An AbstractDatastream for which to generate a view link.
* - label: (Optional) The label for the link. * - label: (Optional) The label for the link.
* - version: (Optional) The version of the datstream to link to. * - 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) { function theme_islandora_datastream_view_link(array $vars) {
$datastream = $vars['datastream']; $datastream = $vars['datastream'];
@ -304,6 +310,9 @@ function theme_islandora_datastream_view_link(array $vars) {
* An array containing: * An array containing:
* - datastream: An AbstractDatastream for which to generate a delete link. * - datastream: An AbstractDatastream for which to generate a delete link.
* - version: (optional) the version of the datastream to delete. * - 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) { function theme_islandora_datastream_delete_link(array $vars) {
$datastream = $vars['datastream']; $datastream = $vars['datastream'];
@ -336,6 +345,9 @@ function theme_islandora_datastream_delete_link(array $vars) {
* @param array $vars * @param array $vars
* An array containing: * An array containing:
* - datastream: An AbstractDatastream for which to generate a edit link. * - 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) { function theme_islandora_datastream_edit_link(array $vars) {
$datastream = $vars['datastream']; $datastream = $vars['datastream'];

Loading…
Cancel
Save