Commit af028885 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug1670900: cant upload image"

parents 6957a254 7445e00a
......@@ -44,7 +44,10 @@ var FileBrowser = (function($) {
};
this.submitform = function () {
$(self.form).triggerHandler('submit');
// for some reason tinymce throws error when use native submit..
// introducing custom event and catching it in pieform solves the problem...
// TODO: fileuploader should be refactored in a nicer way
$(self.form).triggerHandler('onsubmit');
self.form.submit();
};
......
......@@ -181,10 +181,8 @@ tinymce.PluginManager.add('imagebrowser', function(editor) {
jQuery(browser).removeClass('hidden');
(function($) {
// configblock.javascript might use MochiKit so $ must have its default value
eval(configblock.data.javascript);
})(getElement);
// execute additional js for the config block
eval(configblock.data.javascript);
if (deletebutton.length) {
deletebutton.focus();
......
......@@ -185,7 +185,7 @@ function pieform_element_filebrowser(Pieform $form, $element) {
$_PIEFORM_FILEBROWSERS[$prefix]['views_js'] = $initjs;
$initjs .= "jQuery({$prefix}.init);";
$initjs .= "jQuery(window).load({$prefix}.init);";
$initjs .= "upload_max_filesize = '" . get_real_size(ini_get('upload_max_filesize')) . "';";
if ($form->is_submitted() && $form->has_errors()) {
// need to reapply bootstrap file browser stuff
......
......@@ -147,6 +147,9 @@ var Pieform = (function($) {
}
$('#' + self.data.name).on('submit', self.processForm);
// this is custom event that is triggered by filebrowser.js on form submit
$('#' + self.data.name).on('onsubmit', self.processForm);
self.connectSubmitButtons();
// Hook for pieform elements that need to execute Javascript
......
......@@ -223,6 +223,7 @@ function smarty($javascript = array(), $headers = array(), $pagestrings = array(
if (!$found_tinymce) {
$found_tinymce = $check[$key];
$javascript_array[] = $wwwroot . 'artefact/file/js/filebrowser.js';
$javascript_array[] = $jsroot . 'switchbox.js';
$javascript_array[] = $jsroot . 'tinymce/tinymce.js';
$stylesheets = array_merge($stylesheets, array_reverse(array_values($THEME->get_url('style/tinymceskin.css', true))));
$content_css = json_encode($THEME->get_url('style/tinymce.css'));
......
......@@ -76,19 +76,19 @@
<span class="state-label on" role="presentation" aria-hidden="true" tabindex="-1">{str tag=switchbox.on section=pieforms}</span>
<span class="state-label off" role="presentation" aria-hidden="true" tabindex="-1">{str tag=switchbox.off section=pieforms}<span>
</label>
</div>
</div>
<script type="application/javascript">Switchbox.computeWidth("{$prefix}_edit_allowcomments");</script>
</div>
<div>
<div class="submitcancel form-group">
<input type="submit" class="submit btn btn-primary" name="{$prefix}_update[{$fileinfo->id}]" id="{$prefix}_edit_artefact" value="{str tag=savechanges section=artefact.file}" />
<input type="submit" class="cancel" name="{$prefix}_canceledit" id="{$prefix}_edit_cancel" value="{str tag=cancel}" />
<script type="application/javascript">Switchbox.computeWidth("{$prefix}_edit_allowcomments");</script>
</div>
<div>
<div id="{$prefix}_edit_messages">
<div class="submitcancel form-group">
<input type="submit" class="submit btn btn-primary" name="{$prefix}_update[{$fileinfo->id}]" id="{$prefix}_edit_artefact" value="{str tag=savechanges section=artefact.file}" />
<input type="submit" class="cancel" name="{$prefix}_canceledit" id="{$prefix}_edit_cancel" value="{str tag=cancel}" />
</div>
<div>
<div id="{$prefix}_edit_messages">
</div>
</div>
</div>
</div>
</td>
</tr>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment