diff --git a/htdocs/artefact/file/js/filebrowser.js b/htdocs/artefact/file/js/filebrowser.js
index bfdd82cd5ef04534c18f597785d33add380f0276..5e8423d3aa0c6fcf1fcf07f411d290f3b84482b9 100644
--- a/htdocs/artefact/file/js/filebrowser.js
+++ b/htdocs/artefact/file/js/filebrowser.js
@@ -707,7 +707,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
return;
}
- var pagemodalbody = $j('.modal-body');
+ var pagemodalbody = $j('#page-modal .modal-body');
var elem = $j('#' + self.id + '_filelist .img-modal-preview');
@@ -747,7 +747,11 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
e.preventDefault();
// if folder, or a link that goes somewhere exit out
- if(e.target.nodeName === 'A'){
+ if (e.target.nodeName === 'A') {
+ return;
+ }
+ // if an image preview link
+ if (jQuery(e.target).parent().hasClass('img-modal-preview')) {
return;
}
@@ -756,7 +760,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
// remove visual selection if this is for selecting 1 file
if (self.config.selectone) {
- for(j = 0; j < elem.length; j = j + 1){
+ for (j = 0; j < elem.length; j = j + 1) {
removeElementClass(elem[j], 'active');
}
}
diff --git a/htdocs/theme/raw/plugintype/artefact/file/templates/files.tpl b/htdocs/theme/raw/plugintype/artefact/file/templates/files.tpl
index 06dcd30a8d06c694f160ab4d99e9138acec69ebd..35ad10c56921d2aeaa0658c0160668a3b0b88093 100644
--- a/htdocs/theme/raw/plugintype/artefact/file/templates/files.tpl
+++ b/htdocs/theme/raw/plugintype/artefact/file/templates/files.tpl
@@ -29,5 +29,4 @@
{/if}
-{include file="pagemodal.tpl"}
{include file="footer.tpl"}
diff --git a/htdocs/theme/raw/plugintype/artefact/file/templates/form/filebrowser.tpl b/htdocs/theme/raw/plugintype/artefact/file/templates/form/filebrowser.tpl
index cffb57359243447c461e01b5b4c0be4a0419bfa9..45add105e4d5e2ce874679ee768a940fbfc5c5f3 100644
--- a/htdocs/theme/raw/plugintype/artefact/file/templates/form/filebrowser.tpl
+++ b/htdocs/theme/raw/plugintype/artefact/file/templates/form/filebrowser.tpl
@@ -181,6 +181,7 @@
{/if}
+ {include file="pagemodal.tpl"}
{if $tabs}
{/if}
diff --git a/htdocs/theme/raw/plugintype/artefact/file/templates/form/filelist.tpl b/htdocs/theme/raw/plugintype/artefact/file/templates/form/filelist.tpl
index 178ef0dab03613db90f5bafe472f10cb67f16c60..cf3dd4e60a4ce6e1bbf622aa13010e36155e531b 100644
--- a/htdocs/theme/raw/plugintype/artefact/file/templates/form/filelist.tpl
+++ b/htdocs/theme/raw/plugintype/artefact/file/templates/form/filelist.tpl
@@ -79,7 +79,7 @@
{elseif !$publishable}
{$displaytitle}
{else}
-
+
{$displaytitle}
{/if}
diff --git a/test/behat/features/admin/disable_external_resources.feature b/test/behat/features/admin/disable_external_resources.feature
index 9bd4369072744c1fc23827e32e058a288e7bf622..916cddd36f928dbefdda39746828d39b6e4bb867 100644
--- a/test/behat/features/admin/disable_external_resources.feature
+++ b/test/behat/features/admin/disable_external_resources.feature
@@ -30,7 +30,7 @@ Scenario: Enable/disable external resources in mahara pages
| Block title | Text block with an internal image |
And I click the "Insert/edit image" button in the editor
And I expand the section "Image"
- And I follow "Image2.png"
+ And I press "Select \"Image2.png\""
And I press "Submit"
And I press "Save"
diff --git a/test/behat/features/artefact/resume/resume_page.feature b/test/behat/features/artefact/resume/resume_page.feature
index 610d8d780aef5ae296665a348995458ff3247f3f..4899c46f7b8c4294fb2a62532b3f55bf95894ec8 100644
--- a/test/behat/features/artefact/resume/resume_page.feature
+++ b/test/behat/features/artefact/resume/resume_page.feature
@@ -172,7 +172,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
- And I press "Close"
+ And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
@@ -183,7 +183,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
- And I press "Close"
+ And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
@@ -194,7 +194,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
- And I press "Close"
+ And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
@@ -205,7 +205,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
- And I press "Close"
+ And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
@@ -216,7 +216,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
- And I press "Close"
+ And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"
@@ -227,7 +227,7 @@ Scenario: Editing admin resume page (Bug 1426983)
And I press "Add a file"
And I wait "1" seconds
And I attach the file "Image2.png" to "File"
- And I press "Close"
+ And I press "Close" in the "#editgoalsandskills_filebrowser_upload_browse" "css_element"
And I wait "1" seconds
And I press "Save"
And I should see "Saved successfully"