Skip to content

Commit 8469aa4

Browse files
committed
Bug fix and cleanup
Remove unused files Fix issue with "Save & Stay" then "Save & Exit"
1 parent b7c345c commit 8469aa4

File tree

5 files changed

+27
-69
lines changed

5 files changed

+27
-69
lines changed

.gitattributes

Lines changed: 0 additions & 4 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

EM.code-workspace

Lines changed: 0 additions & 18 deletions
This file was deleted.

InstanceTable.php

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ protected function setTaggedFields() {
195195
$recordData = REDCap::getData('array', $this->record, $matches[1], $this->event_id, null, false, false, false, null, false); // export raw
196196
$join_val = $recordData[1]['repeat_instances'][$this->event_id][$this->instrument][$this->repeat_instance][$matches[1]];
197197
if (preg_match("/".self::ACTION_TAG_DST."='?((\w+_arm_\d+[a-z]?:)?\w+)'?\s?/", $fieldDetails['field_annotation'], $matches)) {
198-
$filter = "[" . $matches[1] ."]='" .$join_val."'";
198+
$filter = $this->escape("[" . $matches[1] ."]='" .$join_val."'");
199199
}
200200
}
201201

@@ -891,6 +891,16 @@ protected function popupViewTweaks() {
891891
window.opener.refreshTables();
892892
dataEntrySubmit(this);
893893
});
894+
$('#submit-btn-savecontinue') // Save & Stay - preserve &extmod_instance_table=1 in url when reload
895+
.attr('name', 'submit-btn-savecontinue')
896+
.removeAttr('onclick')
897+
.click(function(event) {
898+
var redirectUrl = window.location.href.replace('&extmod_instance_table_add_new=1','');
899+
event.preventDefault();
900+
window.opener.refreshTables();
901+
dataEntrySubmit(this);
902+
window.setTimeout($.redirectUrl, 500, redirectUrl);
903+
});
894904
$('#submit-btn-savenextinstance')// Save & Next Instance (not necessarily a new instance)
895905
.attr('name', 'submit-btn-savenextinstance')
896906
.removeAttr('onclick')
@@ -908,14 +918,14 @@ protected function popupViewTweaks() {
908918
window.opener.refreshTables();
909919
window.close();
910920
});
911-
<?php
912-
if ( isset($_GET['extmod_instance_table_add_new'])) {
913-
?>
914-
$('button[name=submit-btn-deleteform]').css("display", "none");
915-
<?php
916-
} else {
917-
?>
918-
$('button[name=submit-btn-deleteform]')
921+
<?php
922+
if ( isset($_GET['extmod_instance_table_add_new'])) {
923+
?>
924+
$('button[name=submit-btn-deleteform]').css("display", "none");
925+
<?php
926+
} else {
927+
?>
928+
$('button[name=submit-btn-deleteform]')
919929
.removeAttr('onclick')
920930
.click(function(event) {
921931
$('#form').append('<input type="hidden" name="extmod_closerec_home" value="<?=$record?>">');
@@ -932,19 +942,19 @@ function(){
932942
);
933943
return false;
934944
});
935-
<?php
936-
}
937-
if (isset($_GET['__reqmsg'])) {
938-
?>
939-
setTimeout(function() {
945+
<?php
946+
}
947+
if (isset($_GET['__reqmsg'])) {
948+
?>
949+
setTimeout(function() {
940950
$('div[aria-describedby="reqPopup"]').find('div.ui-dialog-buttonpane').find('button').not(':last').hide(); // .css('visibility', 'visible'); // required fields message show only "OK" button, not ignore & leave
941951
}, 100);
942-
<?php
952+
<?php
943953
}
944-
?>
954+
?>
945955
});
946956
</script>
947-
<?php
957+
<?php
948958
}
949959

950960
/**

0 commit comments

Comments
 (0)