mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°2735 - Continue rework of the dashlet id generation: Dashlet could not be added in the Designer
This commit is contained in:
@@ -1249,8 +1249,7 @@ $('#dashboard_editor .ui-layout-center').runtimedashboard({
|
||||
submit_parameters: {operation: 'save_dashboard', file: '$sFile', extra_params: $sJSExtraParams, reload_url: '$sReloadURL'},
|
||||
render_to: '$sUrl',
|
||||
render_parameters: {operation: 'render_dashboard', file: '$sFile', extra_params: $sJSExtraParams, reload_url: '$sReloadURL'},
|
||||
new_dashlet_parameters: {operation: 'new_dashlet'},
|
||||
new_dashletid_parameters: {operation: 'new_dashlet_id'}
|
||||
new_dashlet_parameters: {operation: 'new_dashlet'}
|
||||
});
|
||||
|
||||
dashboard_prop_size = GetUserPreference('dashboard_prop_size', 350);
|
||||
|
||||
@@ -24,7 +24,10 @@ $(function()
|
||||
render_to: 'index.php',
|
||||
render_parameters: {},
|
||||
new_dashlet_parameters: {},
|
||||
new_dashletid_parameters: {}
|
||||
new_dashletid_endpoint: GetAbsoluteUrlAppRoot() + 'pages/ajax.render.php',
|
||||
new_dashletid_parameters: {
|
||||
operation: 'new_dashlet_id'
|
||||
}
|
||||
},
|
||||
|
||||
// the constructor
|
||||
@@ -141,13 +144,29 @@ $(function()
|
||||
}
|
||||
});
|
||||
},
|
||||
// We need a unique dashlet id, we will get it using an ajax query
|
||||
_get_dashletid_ajax: function(options, sTempDashletId)
|
||||
{
|
||||
var me = this;
|
||||
var $container = options.container;
|
||||
var oParams = this.options.new_dashletid_parameters;
|
||||
oParams.dashboardid = me.options.dashboard_id;
|
||||
oParams.iRow = $container.closest("tr").data("dashboard-row-index");
|
||||
oParams.iCol = $container.data("dashboard-column-index");
|
||||
oParams.dashletid = sTempDashletId;
|
||||
|
||||
$.post(this.options.new_dashletid_endpoint, oParams, function(data) {
|
||||
var sFinalDashletId = data;
|
||||
me.add_dashlet_prepare(options, sFinalDashletId);
|
||||
});
|
||||
},
|
||||
add_dashlet: function(options)
|
||||
{
|
||||
var $container = options.container,
|
||||
iNumberOfExistingDashletsInDashboard = $container.closest("table").find("div.dashlet").length,
|
||||
sTempDashletId = iNumberOfExistingDashletsInDashboard+1;
|
||||
|
||||
this.get_dashletid_ajax(options, sTempDashletId);
|
||||
this._get_dashletid_ajax(options, sTempDashletId);
|
||||
},
|
||||
add_dashlet_prepare: function(options, sFinalDashletId)
|
||||
{
|
||||
@@ -216,8 +235,7 @@ $(function()
|
||||
submit_parameters: {},
|
||||
render_to: 'index.php',
|
||||
render_parameters: {},
|
||||
new_dashlet_parameters: {},
|
||||
new_dashletid_parameters: {}
|
||||
new_dashlet_parameters: {}
|
||||
},
|
||||
|
||||
// the constructor
|
||||
@@ -315,22 +333,6 @@ $(function()
|
||||
}
|
||||
});
|
||||
},
|
||||
// We need a unique dashlet id, we will get it using an ajax query
|
||||
get_dashletid_ajax: function(options, sTempDashletId)
|
||||
{
|
||||
var me = this;
|
||||
var $container = options.container;
|
||||
var oParams = this.options.new_dashletid_parameters;
|
||||
oParams.dashboardid = me.options.dashboard_id;
|
||||
oParams.iRow = $container.closest("tr").data("dashboard-row-index");
|
||||
oParams.iCol = $container.data("dashboard-column-index");
|
||||
oParams.dashletid = sTempDashletId;
|
||||
|
||||
$.post(this.options.render_to, oParams, function(data) {
|
||||
sFinalDashletId = data;
|
||||
me.add_dashlet_prepare(options, sFinalDashletId);
|
||||
});
|
||||
},
|
||||
add_dashlet_ajax: function(options, sDashletId)
|
||||
{
|
||||
var oParams = this.options.new_dashlet_parameters;
|
||||
|
||||
Reference in New Issue
Block a user