Skip to content
Snippets Groups Projects
Commit 0bdb9aac authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix condition of usage of ckeditor

parent 9570e03b
No related branches found
No related tags found
No related merge requests found
...@@ -135,14 +135,17 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt ...@@ -135,14 +135,17 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
}); });
} }
if (ui.item.textarea) { if (ui.item.textarea) {
$.each(ui.item.textarea, function(key, value) { $.each(ui.item.textarea, function(key, value) {';
if (typeof CKEDITOR == "object") { if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) {
CKEDITOR.instances[key].setData(value); $script.= ' // We use CKEditor
CKEDITOR.instances[key].focus(); CKEDITOR.instances[key].setData(value);
} else { CKEDITOR.instances[key].focus();';
$("#" + key).html(value); } else {
$("#" + key).focus(); $script.= ' // We use a simple textarea
} $("#" + key).html(value);
$("#" + key).focus();';
}
$script.='
}); });
} }
} }
......
...@@ -211,7 +211,6 @@ if (! empty($conf->margin->enabled)) { ...@@ -211,7 +211,6 @@ if (! empty($conf->margin->enabled)) {
<?php } ?> <?php } ?>
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
...@@ -220,11 +219,13 @@ $(document).ready(function() { ...@@ -220,11 +219,13 @@ $(document).ready(function() {
$('#idprod').change(function() { $('#idprod').change(function() {
if ($(this).val().length > 0) if ($(this).val().length > 0)
{ {
if (typeof CKEDITOR == 'object') { <?php if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
// We use CKEditor
CKEDITOR.instances['product_desc'].focus(); CKEDITOR.instances['product_desc'].focus();
} else { <?php } else { ?>
// We use a simple textarea
$('#product_desc').focus(); $('#product_desc').focus();
} <?php } ?>
} else { } else {
$('#update_desc_checkbox').removeAttr('checked').trigger('change'); $('#update_desc_checkbox').removeAttr('checked').trigger('change');
...@@ -336,19 +337,21 @@ $(document).ready(function() { ...@@ -336,19 +337,21 @@ $(document).ready(function() {
var origin_desc = $('#origin_desc_cache').val(); var origin_desc = $('#origin_desc_cache').val();
if (typeof CKEDITOR == 'object') { <?php if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
// We use CKEditor
var freecontent = CKEDITOR.instances['product_desc'].getData(); var freecontent = CKEDITOR.instances['product_desc'].getData();
if (origin_desc.length > 0) if (origin_desc.length > 0)
var content = origin_desc + '<br />' + freecontent; var content = origin_desc + '<br />' + freecontent;
else else
var content = freecontent; var content = freecontent;
} else { <?php } else { ?>
// We use a simple textarea
var freecontent = $('#product_desc').html(); var freecontent = $('#product_desc').html();
if (origin_desc.length > 0) if (origin_desc.length > 0)
var content = origin_desc + '\r\n' + freecontent; var content = origin_desc + '\r\n' + freecontent;
else else
var content = freecontent; var content = freecontent;
} <?php } ?>
$('#free_desc_cache').val(freecontent); $('#free_desc_cache').val(freecontent);
...@@ -356,11 +359,13 @@ $(document).ready(function() { ...@@ -356,11 +359,13 @@ $(document).ready(function() {
var content = $('#free_desc_cache').val(); var content = $('#free_desc_cache').val();
} }
if (typeof CKEDITOR == 'object') { <?php if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
// We use CKEditor
CKEDITOR.instances['product_desc'].setData(content); CKEDITOR.instances['product_desc'].setData(content);
} else { <?php } else { ?>
// We use a simple textarea
$('#product_desc').html(content); $('#product_desc').html(content);
} <?php } ?>
}); });
$('#price_ht').focusin(function() { $('#price_ht').focusin(function() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment