Browse Source

Merge pull request #438 from yqjiang/7.x-checkbox-left

move the check box to left.
pull/440/head
philsogaDGI 11 years ago
parent
commit
9fa206abe5
  1. 8
      css/islandora.admin.css
  2. 70
      includes/solution_packs.inc

8
css/islandora.admin.css

@ -13,5 +13,11 @@
.islandora-solution-pack-fieldset table th, .islandora-solution-pack-fieldset table th,
.islandora-solution-pack-fieldset table td .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%;
} }

70
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); $status_severities = array_keys($status_info);
$solution_pack_status_severity = array_search('up_to_date', $status_severities); $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(); $object_info = array();
foreach ($objects as $object) { foreach ($objects as $object) {
$object_status = islandora_check_object_status($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 = $status_severities[$solution_pack_status_severity];
$solution_pack_status_info = $status_info[$solution_pack_status]; $solution_pack_status_info = $status_info[$solution_pack_status];
$form = array( $form = array(
'solution_pack' => array( 'solution_pack' => array(
'#type' => 'fieldset', '#type' => 'fieldset',
@ -190,9 +198,13 @@ function islandora_solution_pack_form(array $form, array &$form_state, $solution
'#suffix' => '</div>', '#suffix' => '</div>',
), ),
'table' => array( 'table' => array(
'#type' => 'item', '#type' => 'tableselect',
'#tree' => TRUE, '#header' => $header,
'#theme' => 'islandora_solution_pack_table', '#options' => $object_info,
),
'tablevalue' => array(
'#type' => 'hidden',
'#value' => json_encode($object_info),
), ),
'submit' => array( 'submit' => array(
'#type' => 'submit', '#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; 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) { function islandora_solution_pack_form_submit(array $form, array &$form_state) {
$not_checked = array(); $not_checked = array();
if (isset($form_state['values']['table']['check'])) { $object_info = json_decode($form_state['values']['tablevalue']);
foreach ($form_state['values']['table']['check'] as $key => $value) { if (isset($form_state['values']['table'])) {
foreach ($form_state['values']['table'] as $key => $value) {
if ($value === 0) { 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; 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". * @} End of "defgroup viewer-functions".
*/ */

Loading…
Cancel
Save