Fixed errors in VC

This commit is contained in:
Daniel Barbero Martin 2020-01-10 13:48:07 +01:00
parent f34387b24e
commit d4b92a6913
4 changed files with 92 additions and 52 deletions

View File

@ -1920,6 +1920,10 @@ function load_modal(settings) {
};
}
if (settings.beforeClose == undefined) {
settings.beforeClose = function() {};
}
settings.target.html("Loading modal...");
settings.target
.dialog({
@ -1989,7 +1993,6 @@ function load_modal(settings) {
text: settings.modal.ok,
click: function() {
if (AJAX_RUNNING) return;
if (settings.onsubmit != undefined) {
if (settings.onsubmit.preaction != undefined) {
settings.onsubmit.preaction();
@ -2107,7 +2110,7 @@ function load_modal(settings) {
}
},
error: function(data) {
console.log(data);
//console.log(data);
AJAX_RUNNING = 0;
}
});
@ -2140,7 +2143,8 @@ function load_modal(settings) {
if (id_modal_target != undefined) {
$(id_modal_target).remove();
}
}
},
beforeClose: settings.beforeClose()
});
},
error: function(data) {

View File

@ -1344,7 +1344,7 @@ function cleanupDOM() {
$("#modalVCItemForm").empty();
}
/* Defined in operations/visual_console/view.php */
/* global $, load_modal */
/* global $, load_modal, tinyMCE */
function createOrUpdateVisualConsoleItem(
visualConsole,
asyncTaskManager,
@ -1415,7 +1415,23 @@ function createOrUpdateVisualConsoleItem(
},
onsubmit: {
page: "include/rest-api/index",
method: "processForm"
method: "processForm",
preaction: function() {
if (
tinyMCE != undefined &&
tinyMCE.editors.length > 0 &&
item.itemProps.type != 12 &&
item.itemProps.type != 13
) {
// Content tiny.
var label = tinyMCE.activeEditor.getContent();
$("#textarea_label").val(label);
}
}
},
beforeClose: function() {
tinyMCE.remove("#textarea_label");
tinyMCE.execCommand("mceRemoveControl", true, "textarea_label");
}
});

View File

@ -1899,7 +1899,6 @@ class Item extends CachedModel
switch ($values['tabSelected']) {
case 'label':
// Label.
// TODO tinyMCE.
$inputs[] = ['label' => __('Label')];
$inputs[] = [
@ -1913,6 +1912,25 @@ class Item extends CachedModel
'return' => true,
],
];
// Label Position.
$fields = [
'down' => __('Bottom'),
'up' => __('Top'),
'right' => __('Right'),
'left' => __('Left'),
];
$inputs[] = [
'label' => __('Label position'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'labelPosition',
'selected' => $values['labelPosition'],
'return' => true,
],
];
break;
case 'general':
@ -2401,8 +2419,10 @@ class Item extends CachedModel
*
* @return string Html images.
*/
static function imagesElementsVC(string $image, ?bool $only=false):string
{
public static function imagesElementsVC(
string $image,
?bool $only=false
):string {
$type_image = [''];
if ($only === false) {
$type_image = [

View File

@ -92,7 +92,7 @@ class View extends \HTML
'img' => 'pencil.png',
],
];
} else if ($type === LINE_ITEM) {
} else if ($type === LINE_ITEM || $type === BOX_ITEM) {
$tabs = [
[
'name' => __('Specific settings'),
@ -126,12 +126,13 @@ class View extends \HTML
});
},
load: function( event, ui ) {
console.log(event);
console.log(ui);
tinymce.init({
var active = $( "#html-tabs" ).tabs( "option", "active" );
if (active === 0 && tinyMCE.editors.length == 0) {
// Initialice.
tinyMCE.init({
selector: "#textarea_label",
theme: "advanced",
//content_css: baseUrl + "include/styles/pandora.css",
content_css: "'.ui_get_full_url(false, false, false, false).'include/styles/pandora.css",
theme_advanced_font_sizes:
"4pt=.visual_font_size_4pt, " +
"6pt=.visual_font_size_6pt, " +
@ -161,6 +162,7 @@ class View extends \HTML
theme_advanced_buttons3: "",
theme_advanced_statusbar_location: "none"
});
}
},
active: 2
});';
@ -255,6 +257,7 @@ class View extends \HTML
// Page Label for each item.
$data['label'] = \get_parameter('label');
$data['labelPosition'] = \get_parameter('labelPosition');
// Page general for each item.
$tabGeneral = (bool) \get_parameter('tabGeneral', false);
@ -353,18 +356,10 @@ class View extends \HTML
$data['moduleId'] = \get_parameter('moduleId');
break;
case LABEL:
// Nothing. no specific items.
break;
case ICON:
$data['imageSrc'] = \get_parameter('imageSrc');
break;
case SERVICE:
// TODO:Enterprise item. It may not exist.
break;
case GROUP_ITEM:
$data['imageSrc'] = \get_parameter('imageSrc');
$data['showStatistics'] = \get_parameter_switch(
@ -423,6 +418,11 @@ class View extends \HTML
// TODO:XXX.
break;
case SERVICE:
// TODO:Enterprise item. It may not exist.
break;
case LABEL:
default:
// Not posible.
break;