diff --git a/css/islandora.admin.css b/css/islandora.admin.css index 1cd1976d..c7e51b28 100644 --- a/css/islandora.admin.css +++ b/css/islandora.admin.css @@ -13,5 +13,11 @@ .islandora-solution-pack-fieldset table th, .islandora-solution-pack-fieldset table td { - width: 33%; + width: 30%; +} + +.islandora-solution-pack-fieldset table th:first-child, +.islandora-solution-pack-fieldset table td:first-child +{ + width: 10%; } \ No newline at end of file diff --git a/includes/solution_packs.inc b/includes/solution_packs.inc index c0305f88..e07e76e7 100644 --- a/includes/solution_packs.inc +++ b/includes/solution_packs.inc @@ -140,6 +140,13 @@ function islandora_solution_pack_form(array $form, array &$form_state, $solution ); $status_severities = array_keys($status_info); $solution_pack_status_severity = array_search('up_to_date', $status_severities); + + // Prepair for tableselect. + $header = array( + 'label' => t('Label'), + 'pid' => t('PID'), + 'status' => t('Status')); + $object_info = array(); foreach ($objects as $object) { $object_status = islandora_check_object_status($object); @@ -158,6 +165,7 @@ function islandora_solution_pack_form(array $form, array &$form_state, $solution } $solution_pack_status = $status_severities[$solution_pack_status_severity]; $solution_pack_status_info = $status_info[$solution_pack_status]; + $form = array( 'solution_pack' => array( '#type' => 'fieldset', @@ -190,9 +198,13 @@ function islandora_solution_pack_form(array $form, array &$form_state, $solution '#suffix' => '', ), 'table' => array( - '#type' => 'item', - '#tree' => TRUE, - '#theme' => 'islandora_solution_pack_table', + '#type' => 'tableselect', + '#header' => $header, + '#options' => $object_info, + ), + 'tablevalue' => array( + '#type' => 'hidden', + '#value' => json_encode($object_info), ), 'submit' => array( '#type' => 'submit', @@ -202,24 +214,6 @@ function islandora_solution_pack_form(array $form, array &$form_state, $solution ), ), ); - foreach ($object_info as $object) { - $pid = $object['pid']; - $form['solution_pack']['table']['label'][$pid] = array( - '#type' => 'item', - '#markup' => $object['label'], - ); - $form['solution_pack']['table']['pid'][$pid] = array( - '#type' => 'item', - '#markup' => $pid, - ); - $form['solution_pack']['table']['status'][$pid] = array( - '#type' => 'item', - '#markup' => $object['status'], - ); - $form['solution_pack']['table']['check'][$pid] = array( - '#type' => 'checkbox', - ); - } return $form; } @@ -233,10 +227,11 @@ function islandora_solution_pack_form(array $form, array &$form_state, $solution */ function islandora_solution_pack_form_submit(array $form, array &$form_state) { $not_checked = array(); - if (isset($form_state['values']['table']['check'])) { - foreach ($form_state['values']['table']['check'] as $key => $value) { + $object_info = json_decode($form_state['values']['tablevalue']); + if (isset($form_state['values']['table'])) { + foreach ($form_state['values']['table'] as $key => $value) { if ($value === 0) { - $not_checked[] = $key; + $not_checked[] = $object_info[$key]->pid; } } } @@ -839,33 +834,6 @@ function islandora_get_viewer_callback($viewer_id = NULL) { } return FALSE; } - -/** - * Implements theme_hook(). - */ -function theme_islandora_solution_pack_table($variables) { - $form = $variables['form']; - $rows = array(); - foreach ($form['label'] as $key => $element) { - if (is_array($element) && element_child($key)) { - $row = array(); - $row[] = array('data' => drupal_render($form['label'][$key])); - $row[] = array('data' => drupal_render($form['pid'][$key])); - $row[] = array('data' => drupal_render($form['status'][$key])); - $row[] = array('data' => drupal_render($form['check'][$key])); - $rows[] = array('data' => $row); - } - } - $header = array(t('Label'), t('PID'), t('Status'), ''); - - $output = ''; - $output .= theme('table', array( - 'header' => $header, - 'rows' => $rows, - 'attributes' => array('id' => 'islandora-viewers-table'), - )); - return $output; -} /** * @} End of "defgroup viewer-functions". */