From 4a592c1a457a5ceda0452e385ccb7a4efdd46960 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Mon, 20 Mar 2017 17:20:22 -0300 Subject: [PATCH 1/3] ISLANDORA-1943 Update the datastream table so that it doesn't end up with missing collumns if you don't have certain permissions. --- theme/theme.inc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/theme/theme.inc b/theme/theme.inc index a7441a936..60e6b3437 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -53,13 +53,20 @@ function islandora_preprocess_islandora_default_edit(array &$variables) { 'class' => 'datastream-size', 'data' => islandora_datastream_get_human_readable_size($ds), ); + if (user_access(ISLANDORA_VIEW_DATASTREAM_HISTORY)) { + if (islandora_datastream_access(ISLANDORA_VIEW_DATASTREAM_HISTORY, $ds)) { + $row[] = array( + 'class' => 'datastream-versions', + 'data' => theme('islandora_datastream_version_link', array( + 'datastream' => $ds, + )), + ); + } + else { + $row[] = array(); + } + } if (islandora_datastream_access(ISLANDORA_VIEW_DATASTREAM_HISTORY, $ds)) { - $row[] = array( - 'class' => 'datastream-versions', - 'data' => theme('islandora_datastream_version_link', array( - 'datastream' => $ds, - )), - ); // Add new datastream content as the lastest version. $row[] = array( 'class' => 'datastream-replace', @@ -68,6 +75,9 @@ function islandora_preprocess_islandora_default_edit(array &$variables) { )), ); } + else { + $row[] = array(); + } $row[] = array( 'class' => 'datastream-download', 'data' => theme('islandora_datastream_download_link', array( From aa7566ab10dbe1c64a3d73871d0377b061ddb8a1 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Thu, 6 Apr 2017 20:18:43 -0300 Subject: [PATCH 2/3] Update theme.inc Updates based on @jordandukart code review. --- theme/theme.inc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/theme/theme.inc b/theme/theme.inc index 60e6b3437..27a37e5a5 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -53,18 +53,16 @@ function islandora_preprocess_islandora_default_edit(array &$variables) { 'class' => 'datastream-size', 'data' => islandora_datastream_get_human_readable_size($ds), ); - if (user_access(ISLANDORA_VIEW_DATASTREAM_HISTORY)) { - if (islandora_datastream_access(ISLANDORA_VIEW_DATASTREAM_HISTORY, $ds)) { - $row[] = array( - 'class' => 'datastream-versions', - 'data' => theme('islandora_datastream_version_link', array( - 'datastream' => $ds, - )), - ); - } - else { - $row[] = array(); - } + if (islandora_datastream_access(ISLANDORA_VIEW_DATASTREAM_HISTORY, $ds)) { + $row[] = array( + 'class' => 'datastream-versions', + 'data' => theme('islandora_datastream_version_link', array( + 'datastream' => $ds, + )), + ); + } + else if (user_access(ISLANDORA_VIEW_DATASTREAM_HISTORY)) { + $row[] = array(); } if (islandora_datastream_access(ISLANDORA_VIEW_DATASTREAM_HISTORY, $ds)) { // Add new datastream content as the lastest version. From 55619f12b1b3930291437f4e4fa46ffd9d046ad8 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Fri, 7 Apr 2017 10:27:13 -0300 Subject: [PATCH 3/3] Fixing coder warning. --- theme/theme.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/theme.inc b/theme/theme.inc index 27a37e5a5..4405c288e 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -61,7 +61,7 @@ function islandora_preprocess_islandora_default_edit(array &$variables) { )), ); } - else if (user_access(ISLANDORA_VIEW_DATASTREAM_HISTORY)) { + elseif (user_access(ISLANDORA_VIEW_DATASTREAM_HISTORY)) { $row[] = array(); } if (islandora_datastream_access(ISLANDORA_VIEW_DATASTREAM_HISTORY, $ds)) {