Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Islandora/islandora_solution_pack_newspaper
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2c3b008abfeb78290e32f3af1d1f09d418ab29f7
Choose a base ref
..
head repository: Islandora/islandora_solution_pack_newspaper
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c679f4b87188c871b0dd73182448b85161443e0d
Choose a head ref
Showing with 15 additions and 13 deletions.
  1. +7 −0 includes/admin.form.inc
  2. +1 −9 includes/ajax_handler.inc
  3. +1 −1 islandora_newspaper.module
  4. +6 −3 theme/theme.inc
7 changes: 7 additions & 0 deletions includes/admin.form.inc
Original file line number Diff line number Diff line change
@@ -47,6 +47,13 @@ function islandora_newspaper_admin_settings_form(array $form, array &$form_state
'#size' => 30,
);

$form['islandora_newspaper_use_ajax_loader'] = array(
'#type' => 'checkbox',
'#title' => t('Use AJAX to populate the year of issues for Newspaper view.'),
'#description' => t('When enabled, this should improve performance when a given Newspaper has many issues.'),
'#default_value' => variable_get('islandora_newspaper_use_ajax_loader', 0),
);

module_load_include('inc', 'islandora', 'includes/solution_packs');
$form += islandora_viewers_form('islandora_newspaper_issue_viewers', array('application/pdf'), 'islandora:newspaperIssueCModel');
$form['issue_viewers'] = $form['viewers'];
10 changes: 1 addition & 9 deletions includes/ajax_handler.inc
Original file line number Diff line number Diff line change
@@ -5,14 +5,6 @@
* AJAX handler functions for the Islandora Newspaper Solution pack module.
*/

/**
* Returns the markup for a given newspaper issue for the year.
*
* @param AbstractObject $islandora_object
* The newspaper issue object.
* @param string $year
* The year of the issue to fetch the markup.
*/
function islandora_newspaper_ajax_get_year($islandora_object, $year) {
module_load_include('inc', 'islandora_newspaper', 'includes/utilities');
$issues = islandora_newspaper_get_issues($islandora_object);
@@ -35,7 +27,7 @@ function islandora_newspaper_ajax_get_year($islandora_object, $year) {
'#title' => $month_name,
'#type' => 'fieldset',
'#attributes' => array(
'class' => array('collapsible', 'month'),
'class' => array('collapsible', 'month'),
),
);
foreach ($days as $day => $issues) {
2 changes: 1 addition & 1 deletion islandora_newspaper.module
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ function islandora_newspaper_menu() {
'access callback' => 'islandora_newspaper_issue_page_access',
'access arguments' => array(2),
),
// To return issue year markup via AJAX call.
// PHP helper function to return page image size for METS editor via AJAX call.
'islandora/object/%islandora_object/newspaper/get_year/%' => array(
'page callback' => 'islandora_newspaper_ajax_get_year',
'page arguments' => array(2, 5),
9 changes: 6 additions & 3 deletions theme/theme.inc
Original file line number Diff line number Diff line change
@@ -22,11 +22,13 @@ function template_preprocess_islandora_newspaper(array &$variables) {
$object = $variables['object'];
$issues = islandora_newspaper_get_issues($object);
$grouped_issues = islandora_newspaper_group_issues($issues);
$hidden_pid = (variable_get('islandora_newspaper_use_ajax_loader', 0) > 0 ?
'<span id="hidden-pid" style="display:none">' .
$object->id . '</span>' : '');
$output = array(
'controls' => array(
'#theme' => 'links',
'#prefix' => '<span id="hidden-pid" style="display:none">' .
$object->id . '</span>',
'#prefix' => $hidden_pid,
'#attributes' => array(
'class' => array('links', 'inline'),
),
@@ -57,6 +59,7 @@ function template_preprocess_islandora_newspaper(array &$variables) {
);
$tabs = &$output['tabs'];
$first_pane_done = FALSE;
$load_all = (variable_get('islandora_newspaper_use_ajax_loader', 0) < 1);
ksort($grouped_issues);
foreach ($grouped_issues as $year => $months) {
$tabs[$year] = array(
@@ -75,7 +78,7 @@ function template_preprocess_islandora_newspaper(array &$variables) {
'class' => array('collapsible', 'collapsed', 'month'),
),
);
if (!$first_pane_done) {
if (!$first_pane_done || $load_all) {
foreach ($days as $day => $issues) {
foreach ($issues as $issue) {
$tabs[$year][$month][$day][] = array(