|
@@ -202,7 +202,7 @@ function core_login(element){
|
|
|
var data = form.toJson(true);
|
|
|
data.redirect = form.attr('data-redirect');
|
|
|
data.url = form.attr('data-url');
|
|
|
- data.action = 'login';
|
|
|
+ data.action = 'core_login';
|
|
|
|
|
|
isProcessing = true;
|
|
|
$.action(data
|
|
@@ -221,7 +221,7 @@ function core_login(element){
|
|
|
|
|
|
function core_logout(url){
|
|
|
$.action({
|
|
|
- action:'logout',
|
|
|
+ action:'core_logout',
|
|
|
url: url
|
|
|
},function(r){
|
|
|
localStorage.setItem('configuration',JSON.stringify({'inactivityDelay' : null}));
|
|
@@ -252,7 +252,7 @@ function init_setting(parameter){
|
|
|
|
|
|
switch(parameter.section){
|
|
|
case 'plugin':
|
|
|
- search_plugin();
|
|
|
+ core_plugin_search();
|
|
|
|
|
|
$('.section-plugin').on('change', 'input.toggle', function(){
|
|
|
var input = $(this);
|
|
@@ -269,27 +269,29 @@ function init_setting(parameter){
|
|
|
.prepend(label);
|
|
|
|
|
|
$.action({
|
|
|
- action : 'change_plugin_state',
|
|
|
+ action : 'core_plugin_state_save',
|
|
|
plugin : input.closest('li').attr('data-id'),
|
|
|
state: value ? 1 : 0
|
|
|
}, function(r){
|
|
|
-
|
|
|
+ core_plugin_firm_show();
|
|
|
}, function(r){
|
|
|
button.text(value?'Activer':'Désactiver')
|
|
|
.toggleClass('text-success text-muted')
|
|
|
.prepend(label);
|
|
|
input.prop('checked',!value);
|
|
|
+ core_plugin_firm_show();
|
|
|
});
|
|
|
+
|
|
|
});
|
|
|
break;
|
|
|
case 'user':
|
|
|
- search_user();
|
|
|
+ core_user_search();
|
|
|
break;
|
|
|
case 'firmPlugin':
|
|
|
- search_firm_plugin();
|
|
|
+ core_firm_plugin_search();
|
|
|
break;
|
|
|
case 'userfirmrank':
|
|
|
- search_userfirmrank();
|
|
|
+ core_userfirmrank_search();
|
|
|
break;
|
|
|
case 'log':
|
|
|
$('#logs').sortable_table({
|
|
@@ -298,25 +300,25 @@ function init_setting(parameter){
|
|
|
break;
|
|
|
|
|
|
case 'rank':
|
|
|
- search_rank();
|
|
|
+ core_rank_search();
|
|
|
break;
|
|
|
|
|
|
- case 'dictionnary':
|
|
|
- search_dictionnary();
|
|
|
+ case 'dictionary':
|
|
|
+ core_dictionary_search();
|
|
|
$('#label').blur(function(){
|
|
|
if($('#label').val() != '' && $('#slug').val() == ''){
|
|
|
$('#slug').off('click');
|
|
|
- dictionnary_slug_proposal($('#label'), $('#parent'));
|
|
|
+ core_dictionary_slug_proposal($('#label'), $('#parent'));
|
|
|
}
|
|
|
});
|
|
|
$('#slug').off('click');
|
|
|
$('#slug').on('click', function(){
|
|
|
if($('#label').val() != '' && $('#slug').val() == '')
|
|
|
- dictionnary_slug_proposal($('#label'), $('#parent'));
|
|
|
+ core_dictionary_slug_proposal($('#label'), $('#parent'));
|
|
|
});
|
|
|
break;
|
|
|
case 'right':
|
|
|
- search_right();
|
|
|
+ core_right_search();
|
|
|
break;
|
|
|
default:
|
|
|
if(parameter.section!= null){
|
|
@@ -370,7 +372,7 @@ function search_log(exportMode, callback){
|
|
|
|
|
|
isProcessing = true;
|
|
|
$('#logs').fill({
|
|
|
- action:'search_log',
|
|
|
+ action:'core_search_log',
|
|
|
filters: box.filters(),
|
|
|
sort: $('#logs').sortable_table('get'),
|
|
|
export: !exportMode ? false : exportMode,
|
|
@@ -384,17 +386,17 @@ function search_log(exportMode, callback){
|
|
|
|
|
|
/** USER FIRM RANK**/
|
|
|
// SEARCH
|
|
|
-function search_userfirmrank(callback){
|
|
|
+function core_userfirmrank_search(callback){
|
|
|
$('#userfirmranks').fill({
|
|
|
firm : $('#firm').val(),
|
|
|
- action:'search_userfirmrank'
|
|
|
+ action:'core_userfirmrank_search'
|
|
|
},function(){
|
|
|
if(callback!=null) callback();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// SAVE
|
|
|
-function save_userfirmrank(element){
|
|
|
+function core_user_savefirmrank(element){
|
|
|
if(isProcessing) return;
|
|
|
var button = $(element);
|
|
|
var data = $.getForm('#userfirmrankForm');
|
|
@@ -418,17 +420,17 @@ function save_userfirmrank(element){
|
|
|
$('#firm').val($("#firm option:first").val());
|
|
|
$('#rank').val($("#rank option:first").val());
|
|
|
isProcessing = false;
|
|
|
- search_userfirmrank();
|
|
|
+ core_userfirmrank_search();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// EDIT
|
|
|
-function edit_userfirmrank(element){
|
|
|
+function core_userfirmrank_edit(element){
|
|
|
var form = $('#userfirmrankForm');
|
|
|
var line = $(element).closest('tr');
|
|
|
|
|
|
$.action({
|
|
|
- action:'edit_userfirmrank',
|
|
|
+ action:'core_userfirmrank_edit',
|
|
|
id:line.attr('data-id')
|
|
|
},function(r){
|
|
|
$.setForm(form,r);
|
|
@@ -439,14 +441,14 @@ function edit_userfirmrank(element){
|
|
|
}
|
|
|
|
|
|
// DELETE
|
|
|
-function delete_userfirmrank(element){
|
|
|
+function core_userfirmrank_delete(element){
|
|
|
if(isProcessing) return;
|
|
|
if(!confirm('Êtes vous sûr de vouloir supprimer ce lien Établissement / Utilisateur / Rang ?')) return;
|
|
|
var line = $(element).closest('tr');
|
|
|
|
|
|
isProcessing = true;
|
|
|
$.action({
|
|
|
- action : 'delete_userfirmrank',
|
|
|
+ action : 'core_userfirmrank_delete',
|
|
|
id : line.attr('data-id')
|
|
|
},function(r){
|
|
|
isProcessing = false;
|
|
@@ -519,9 +521,9 @@ function core_firm_delete(element){
|
|
|
|
|
|
/** FIRM PLUGINS **/
|
|
|
// SEARCH
|
|
|
-function search_right(callback){
|
|
|
+function core_right_search(callback){
|
|
|
$('#rights').fill({
|
|
|
- action: 'search_right',
|
|
|
+ action: 'core_right_search',
|
|
|
targetUid: $('#targetUid').attr('data-rank'),
|
|
|
firm: $('#firm').val()
|
|
|
},function(r){
|
|
@@ -531,10 +533,10 @@ function search_right(callback){
|
|
|
}
|
|
|
|
|
|
// TOGGLE RIGHT
|
|
|
-function toggle_right(element){
|
|
|
+function core_right_toggle(element){
|
|
|
var line = $(element).closest('tr');
|
|
|
$.action({
|
|
|
- action:'toggle_right',
|
|
|
+ action:'core_right_toggle',
|
|
|
targetUid:$('#targetUid').attr('data-rank'),
|
|
|
targetScope: 'rank',
|
|
|
firm:$('#firm').val(),
|
|
@@ -545,9 +547,9 @@ function toggle_right(element){
|
|
|
}
|
|
|
|
|
|
// SEARCH
|
|
|
-function search_firm_plugin(callback){
|
|
|
+function core_firm_plugin_search(callback){
|
|
|
$('#firmplugins').fill({
|
|
|
- action: 'search_firm_plugin',
|
|
|
+ action: 'core_firm_plugin_search',
|
|
|
firm: $('#firm').val()
|
|
|
},function(r){
|
|
|
update_checkboxes(r);
|
|
@@ -556,11 +558,12 @@ function search_firm_plugin(callback){
|
|
|
}
|
|
|
|
|
|
// ENABLE/DISABLE
|
|
|
-function toggle_firm_plugin(element){
|
|
|
- var line = $(element).closest('tr');
|
|
|
+function core_firm_plugin_save(element){
|
|
|
+ var line = $(element).closest('.item');
|
|
|
+
|
|
|
$.action({
|
|
|
- action:'toggle_firm_plugin',
|
|
|
- firm :$('#firm').val(),
|
|
|
+ action:'core_firm_plugin_save',
|
|
|
+ firm :$(element).closest('.firm-item').attr('data-id'),
|
|
|
state : $(element).prop('checked')?1:0,
|
|
|
plugin: line.attr('data-id')
|
|
|
});
|
|
@@ -590,16 +593,16 @@ function firm_logo_delete(element){
|
|
|
|
|
|
/** USER **/
|
|
|
// SEARCH
|
|
|
-function search_user(callback){
|
|
|
+function core_user_search(callback){
|
|
|
$('#users').fill({
|
|
|
- action: 'search_user'
|
|
|
+ action: 'core_user_search'
|
|
|
},function(){
|
|
|
if(callback!=null) callback();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// SAVE
|
|
|
-function save_user(){
|
|
|
+function core_user_save(){
|
|
|
var form = $('#userFormAdmin');
|
|
|
var data = $.getForm(form);
|
|
|
data.id = form.attr('data-id');
|
|
@@ -610,15 +613,15 @@ function save_user(){
|
|
|
$('input',form).val('');
|
|
|
form.attr('data-id','');
|
|
|
init_components(form);
|
|
|
- search_user();
|
|
|
+ core_user_search();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// EDIT
|
|
|
-function edit_user(element){
|
|
|
+function core_user_edit(element){
|
|
|
var line = $(element).closest('tr');
|
|
|
$.action({
|
|
|
- action: 'edit_user',
|
|
|
+ action: 'core_user_edit',
|
|
|
login: line.attr('data-user')
|
|
|
},function(r){
|
|
|
$.setForm('#userFormAdmin',r);
|
|
@@ -632,11 +635,11 @@ function edit_user(element){
|
|
|
|
|
|
|
|
|
// DELETE
|
|
|
-function delete_user(element){
|
|
|
+function core_user_delete(element){
|
|
|
if(!confirm('Êtes vous sûr de vouloir supprimer cet utilisateur ?')) return;
|
|
|
var line = $(element).closest('tr');
|
|
|
$.action({
|
|
|
- action : 'delete_user',
|
|
|
+ action : 'core_user_delete',
|
|
|
login : line.attr('data-user')
|
|
|
},function(r){
|
|
|
$.message('info','Utilisateur supprimé');
|
|
@@ -649,14 +652,14 @@ function delete_user(element){
|
|
|
|
|
|
|
|
|
/* ACCOUNT **/
|
|
|
-function account_lost_password(element){
|
|
|
+function core_account_lost_password(element){
|
|
|
if(isProcessing) return;
|
|
|
var btn = $(element);
|
|
|
btn.addClass('btn-preloader').attr('disabled', true);
|
|
|
|
|
|
isProcessing = true;
|
|
|
$.action({
|
|
|
- action: 'account_lost_password',
|
|
|
+ action: 'core_account_lost_password',
|
|
|
mail : $('#mail').val()
|
|
|
}, function(r){
|
|
|
isProcessing = false;
|
|
@@ -668,11 +671,11 @@ function account_lost_password(element){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function account_save(element){
|
|
|
+function core_account_save(element){
|
|
|
var data = $('#user-form').toJson();
|
|
|
data.login = $('#login').val();
|
|
|
data.avatar = $('#avatar')[0].files[0];
|
|
|
- data.action = 'account_save';
|
|
|
+ data.action = 'core_account_save';
|
|
|
|
|
|
$.action(data, function(r){
|
|
|
$('.password-field input').val('');
|
|
@@ -681,9 +684,9 @@ function account_save(element){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function account_api_save(element){
|
|
|
+function core_account_api_save(element){
|
|
|
var data = $('#account-api-form').toJson();
|
|
|
- data.action = 'account_api_save';
|
|
|
+ data.action = 'core_account_api_save';
|
|
|
|
|
|
$.action(data, function(r){
|
|
|
$.message('success','Enregistré');
|
|
@@ -691,12 +694,12 @@ function account_api_save(element){
|
|
|
}
|
|
|
|
|
|
// SUPPRIME AVATAR USER
|
|
|
-function account_avatar_delete(element){
|
|
|
+function core_account_avatar_delete(element){
|
|
|
if(!confirm('Êtes vous sûr de vouloir supprimer l\'image ?')) return;
|
|
|
var imageComposer = $(element).parent().find("input[data-type='image']");
|
|
|
|
|
|
$.action({
|
|
|
- action: 'account_avatar_delete',
|
|
|
+ action: 'core_account_avatar_delete',
|
|
|
login: $('#login').val()
|
|
|
}, function(r){
|
|
|
imageComposer.wrap('<form>').closest('form').get(0).reset();
|
|
@@ -708,41 +711,41 @@ function account_avatar_delete(element){
|
|
|
|
|
|
/** RANKS **/
|
|
|
// SEARCH
|
|
|
-function search_rank(callback){
|
|
|
+function core_rank_search(callback){
|
|
|
$('#ranks').fill({
|
|
|
- action: 'search_rank'
|
|
|
+ action: 'core_rank_search'
|
|
|
},function(){
|
|
|
if(callback!=null) callback();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// SAVE
|
|
|
-function save_rank(){
|
|
|
+function core_rank_save(){
|
|
|
var data = $.getForm('#rankForm');
|
|
|
data.id = $('#rankForm').attr('data-id');
|
|
|
$.action(data,function(r){
|
|
|
$.message('success','Rang enregistré');
|
|
|
$('#rankForm input').val('');
|
|
|
$('#rankForm').attr('data-id','');
|
|
|
- search_rank();
|
|
|
+ core_rank_search();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// EDIT
|
|
|
-function edit_rank(element){
|
|
|
+function core_rank_edit(element){
|
|
|
var line = $(element).closest('tr');
|
|
|
- $.action({action:'edit_rank',id:line.attr('data-id')},function(r){
|
|
|
+ $.action({action:'core_rank_edit',id:line.attr('data-id')},function(r){
|
|
|
$.setForm('#rankForm',r);
|
|
|
$('#rankForm').attr('data-id',r.id);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// DELETE
|
|
|
-function delete_rank(element){
|
|
|
+function core_rank_delete(element){
|
|
|
if(!confirm('Êtes vous sûr de vouloir supprimer ce rang ?')) return;
|
|
|
var line = $(element).closest('tr');
|
|
|
$.action({
|
|
|
- action : 'delete_rank',
|
|
|
+ action : 'core_rank_delete',
|
|
|
id : line.attr('data-id')
|
|
|
},function(r){
|
|
|
$.message('info','Rang supprimé');
|
|
@@ -753,14 +756,14 @@ function delete_rank(element){
|
|
|
|
|
|
/** DICTIONNARY **/
|
|
|
// SEARCH
|
|
|
-function search_dictionnary(callback){
|
|
|
+function core_dictionary_search(callback){
|
|
|
var parentValue = $('#parent').val();
|
|
|
parentValue != "" ? $('#prev-button').removeClass('hidden') : $('#prev-button').addClass('hidden');
|
|
|
$('#dictionnaries').fill({
|
|
|
- action:'search_dictionnary',
|
|
|
+ action:'core_dictionary_search',
|
|
|
parent : parentValue
|
|
|
},function(r){
|
|
|
- reset_inputs($('#dictionnaryForm'), false, true);
|
|
|
+ reset_inputs($('#dictionaryForm'), false, true);
|
|
|
if(callback!=null) callback();
|
|
|
var tpl = $('#parent').find('option[value="{{id}}"]');
|
|
|
if(!tpl.parent('span').length) tpl.wrap('<span>').addClass('hidden');
|
|
@@ -768,36 +771,36 @@ function search_dictionnary(callback){
|
|
|
}
|
|
|
|
|
|
// SAVE
|
|
|
-function save_dictionnary(){
|
|
|
- var data = $.getForm('#dictionnaryForm');
|
|
|
- data.id = $('#dictionnaryForm').attr('data-id');
|
|
|
+function core_dictionary_save(){
|
|
|
+ var data = $.getForm('#dictionaryForm');
|
|
|
+ data.id = $('#dictionaryForm').attr('data-id');
|
|
|
data.parent = $('#parent').val();
|
|
|
$.action(data,function(r){
|
|
|
$.message('success','Liste enregistrée');
|
|
|
- $('#dictionnaryForm input').val('');
|
|
|
- $('#dictionnaryForm').attr('data-id','');
|
|
|
- search_dictionnary();
|
|
|
+ $('#dictionaryForm input').val('');
|
|
|
+ $('#dictionaryForm').attr('data-id','');
|
|
|
+ core_dictionary_search();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// EDIT
|
|
|
-function edit_dictionnary(element){
|
|
|
+function core_dictionary_edit(element){
|
|
|
var line = $(element).closest('tr');
|
|
|
$.action({
|
|
|
- action: 'edit_dictionnary',
|
|
|
+ action: 'core_dictionary_edit',
|
|
|
id: line.attr('data-id')
|
|
|
},function(r){
|
|
|
- $.setForm('#dictionnaryForm',r);
|
|
|
- $('#dictionnaryForm').attr('data-id',r.id);
|
|
|
+ $.setForm('#dictionaryForm',r);
|
|
|
+ $('#dictionaryForm').attr('data-id',r.id);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// DELETE
|
|
|
-function delete_dictionnary(element){
|
|
|
+function core_dictionary_delete(element){
|
|
|
if(!confirm('Êtes-vous sûr de vouloir supprimer cette liste ?')) return;
|
|
|
var line = $(element).closest('tr');
|
|
|
$.action({
|
|
|
- action: 'delete_dictionnary',
|
|
|
+ action: 'core_dictionary_delete',
|
|
|
id: line.attr('data-id')
|
|
|
},function(r){
|
|
|
line.remove();
|
|
@@ -806,13 +809,13 @@ function delete_dictionnary(element){
|
|
|
}
|
|
|
|
|
|
// Remplissage de la liste (select) --> Dans les settings
|
|
|
-function get_dictionnary_items(elem, elemToFill){
|
|
|
+function get_dictionary_items(elem, elemToFill){
|
|
|
var parent = $(elem).closest('tr');
|
|
|
var id = $(parent).attr('data-id');
|
|
|
var parentId = $(parent).attr('data-parent');
|
|
|
|
|
|
$(elemToFill).fill({
|
|
|
- action:'search_dictionnary',
|
|
|
+ action:'core_dictionary_search',
|
|
|
parent : parentId.toString()
|
|
|
},function(){
|
|
|
$(elemToFill).val(id).change();
|
|
@@ -820,8 +823,8 @@ function get_dictionnary_items(elem, elemToFill){
|
|
|
}
|
|
|
|
|
|
// Ajout de sous-liste --> Dans les settings
|
|
|
-function add_sub_dictionnary(elem){
|
|
|
- reset_inputs($('#dictionnaryForm'), false, true);
|
|
|
+function add_sub_dictionary(elem){
|
|
|
+ reset_inputs($('#dictionaryForm'), false, true);
|
|
|
|
|
|
var parent = $(elem).closest('tr');
|
|
|
var id = $(parent).attr('data-id');
|
|
@@ -830,19 +833,19 @@ function add_sub_dictionnary(elem){
|
|
|
if ($("#parent option[value='"+id+"']").length > 0)
|
|
|
$('#parent').val(id).change();
|
|
|
else {
|
|
|
- get_dictionnary_items(elem, "#parent");
|
|
|
+ get_dictionary_items(elem, "#parent");
|
|
|
$('code').addClass('hidden');
|
|
|
}
|
|
|
$('#prev-button').removeClass('hidden');
|
|
|
}
|
|
|
|
|
|
// Récupération éléments de la liste précédente --> Dans les settings
|
|
|
-function previous_list_dictionnary(elem){
|
|
|
+function previous_list_dictionary(elem){
|
|
|
var selected = $('#parent > option:selected').val();
|
|
|
- reset_inputs($('#dictionnaryForm'), false, true);
|
|
|
+ reset_inputs($('#dictionaryForm'), false, true);
|
|
|
|
|
|
$.action({
|
|
|
- action: 'get_parent_dictionnary',
|
|
|
+ action: 'core_dictionary_get_parent',
|
|
|
selected: selected
|
|
|
}, function(r){
|
|
|
var data = r.rows[0];
|
|
@@ -860,12 +863,12 @@ function previous_list_dictionnary(elem){
|
|
|
else
|
|
|
$('#parent').append("<option value='"+value.id+"'>"+value.label+"</option>");
|
|
|
});
|
|
|
- search_dictionnary();
|
|
|
+ core_dictionary_search();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-// Récupération des sous-listes pour les champ de type "dictionnary" --> Où le module est appelé
|
|
|
-function get_sub_dictionnary(elem, name, currentDepth){
|
|
|
+// Récupération des sous-listes pour les champ de type "dictionary" --> Où le module est appelé
|
|
|
+function get_sub_dictionary(elem, name, currentDepth){
|
|
|
var input = $(elem);
|
|
|
var data = input.data();
|
|
|
data.output = data.output ? data.output : 'id';
|
|
@@ -875,7 +878,7 @@ function get_sub_dictionnary(elem, name, currentDepth){
|
|
|
var fieldName = name == '' ? input.attr('name') : name;
|
|
|
|
|
|
currentDepth -= currentDepth != 1 ? input.nextAll('select').length : 0;
|
|
|
- if(input.closest('span.dictionnary-container').length != 0){
|
|
|
+ if(input.closest('span.dictionary-container').length != 0){
|
|
|
var id = input.nextAll().last().attr('id');
|
|
|
input.attr('id', id).nextAll().remove();
|
|
|
}
|
|
@@ -885,16 +888,16 @@ function get_sub_dictionnary(elem, name, currentDepth){
|
|
|
currentDepth += 1;
|
|
|
|
|
|
$.action({
|
|
|
- action: 'search_dictionnary',
|
|
|
+ action: 'core_dictionary_search',
|
|
|
parent: selectValue
|
|
|
}, function(r){
|
|
|
var option = '';
|
|
|
- if(input.closest('span.dictionnary-container').length == 0) input.wrap('<span class="dictionnary-container"></span>');
|
|
|
- var newSelect = clone_input_dictionnary(input, selectValue, fieldName);
|
|
|
- var currentDepth = input.closest('span.dictionnary-container').children('select').length;
|
|
|
+ if(input.closest('span.dictionary-container').length == 0) input.wrap('<span class="dictionary-container"></span>');
|
|
|
+ var newSelect = clone_input_dictionary(input, selectValue, fieldName);
|
|
|
+ var currentDepth = input.closest('span.dictionary-container').children('select').length;
|
|
|
|
|
|
if (input.attr('data-disable-label') != "" && optSubLabel != "" && optSubLabel != "null") input.after('<label class="label-select">'+optSubLabel+'</label>');
|
|
|
- newSelect.attr('onchange', 'get_sub_dictionnary(this, "'+fieldName+'", '+currentDepth+');');
|
|
|
+ newSelect.attr('onchange', 'get_sub_dictionary(this, "'+fieldName+'", '+currentDepth+');');
|
|
|
newSelect.append('<option value=""> - </option>');
|
|
|
|
|
|
$.each(r.rows, function(index, value){
|
|
@@ -912,14 +915,14 @@ function get_selected_values(elem, select){
|
|
|
var input = $(elem);
|
|
|
var data = input.data();
|
|
|
data.output = data.output ? data.output : 'id';
|
|
|
- if(input.closest('span.dictionnary-container').length == 0) input.wrap('<span class="dictionnary-container"></span>');
|
|
|
+ if(input.closest('span.dictionary-container').length == 0) input.wrap('<span class="dictionary-container"></span>');
|
|
|
var fieldName = input.attr('name');
|
|
|
- var currentDepth = 1+input.closest('span.dictionnary-container').children('select').length;
|
|
|
+ var currentDepth = 1+input.closest('span.dictionary-container').children('select').length;
|
|
|
var optSubLabel = select.sublistlabel;
|
|
|
var option = '';
|
|
|
|
|
|
if ( select.childs && select.childs.length > 0) {
|
|
|
- var newSelect = clone_input_dictionnary(input, select.id, fieldName);
|
|
|
+ var newSelect = clone_input_dictionary(input, select.id, fieldName);
|
|
|
|
|
|
if (newSelect.attr('data-disable-label') != "" && optSubLabel != "" && optSubLabel != "null" && optSubLabel != undefined) input.after('<label class="label-select">'+optSubLabel+'</label>');
|
|
|
newSelect.append('<option value=""> - </option>');
|
|
@@ -933,14 +936,14 @@ function get_selected_values(elem, select){
|
|
|
selected = "selected";
|
|
|
}
|
|
|
|
|
|
- newSelect.attr('onchange', 'get_sub_dictionnary(this,"'+fieldName+'", '+currentDepth+');');
|
|
|
+ newSelect.attr('onchange', 'get_sub_dictionary(this,"'+fieldName+'", '+currentDepth+');');
|
|
|
option += '<option value="'+value[data.output]+'" data-parent="'+value.parent+'" data-sublabel="'+value.sublistlabel+'" '+selected+'>'+value.label+'</option>';
|
|
|
});
|
|
|
if(newSelect) newSelect.append(option);
|
|
|
}
|
|
|
|
|
|
-// Clone du select de type "dictionnary"
|
|
|
-function clone_input_dictionnary(input, id, name){
|
|
|
+// Clone du select de type "dictionary"
|
|
|
+function clone_input_dictionary(input, id, name){
|
|
|
var newSelect = input.clone();
|
|
|
input.removeAttr('id').after(newSelect).after(' ');
|
|
|
newSelect.removeAttr("data-type").removeAttr('name').removeAttr('data-value');
|
|
@@ -950,12 +953,12 @@ function clone_input_dictionnary(input, id, name){
|
|
|
}
|
|
|
|
|
|
//Rafraîchit la table de la liste donnée
|
|
|
-//En lien avec le composant dictionnary_table
|
|
|
-function dictionnary_table_refresh(elem){
|
|
|
- var id = $(elem).attr('data-dictionnary');
|
|
|
+//En lien avec le composant dictionary_table
|
|
|
+function dictionary_table_refresh(elem){
|
|
|
+ var id = $(elem).attr('data-dictionary');
|
|
|
var table = $(elem).find('table:eq(0)');
|
|
|
$.action({
|
|
|
- action: 'dictionnary_table_search',
|
|
|
+ action: 'core_dictionary_table_search',
|
|
|
id: id
|
|
|
},function(r){
|
|
|
table.find('tbody tr:visible').remove();
|
|
@@ -969,10 +972,10 @@ function dictionnary_table_refresh(elem){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function dictionnary_slug_proposal(element, parent){
|
|
|
+function core_dictionary_slug_proposal(element, parent){
|
|
|
var line = $(element).closest('tr');
|
|
|
$.action({
|
|
|
- action : 'dictionnary_slug_proposal',
|
|
|
+ action : 'core_dictionary_slug_proposal',
|
|
|
id : line.attr('data-id'),
|
|
|
label : $(element).val(),
|
|
|
parent : $(parent).val()
|
|
@@ -983,17 +986,27 @@ function dictionnary_slug_proposal(element, parent){
|
|
|
|
|
|
/** PLUGINS **/
|
|
|
// SEARCH
|
|
|
-function search_plugin(callback){
|
|
|
+function core_plugin_search(callback){
|
|
|
var list = $('#plugins');
|
|
|
|
|
|
list.fill({
|
|
|
- action:'search_plugin'
|
|
|
+ action:'core_plugin_search'
|
|
|
},function(){
|
|
|
init_tooltips(list);
|
|
|
+ core_plugin_firm_show();
|
|
|
+ $('.firm-toggle').each(function(i,element){
|
|
|
+ $(element).prop('checked',$(element).attr('data-value')=='1');
|
|
|
+ });
|
|
|
if(callback!=null) callback();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function core_plugin_firm_show(){
|
|
|
+ $('#plugins .item').each(function(i,element){
|
|
|
+ $('.plugin-firm-block',element).toggleClass('hidden',!$('input.toggle',element).prop('checked'));
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
// RÉCUPÉRATION PARAMÈTRE URL
|
|
|
var get_url_parameter = function get_url_parameter(sParam, string) {
|
|
|
var sPageURL = !string ? decodeURIComponent(window.location.search.substring(1)) : string;
|
|
@@ -1031,7 +1044,7 @@ function dropzone_delete_file(element){
|
|
|
|
|
|
/* GENERAL SETTINGS */
|
|
|
//Sauvegarde de la configuration générale
|
|
|
-function general_settings_save(){
|
|
|
+function core_general_settings_save(){
|
|
|
var data = $('#general-settings').toJson();
|
|
|
data.password_format = $('#password-format-form').attr('data-format');
|
|
|
|
|
@@ -1039,10 +1052,10 @@ function general_settings_save(){
|
|
|
$.message('success', 'Configuration enregistrée');
|
|
|
});
|
|
|
}
|
|
|
-function general_reset_password_delay(){
|
|
|
+function core_general_password_reset_delay(){
|
|
|
if(!confirm('Êtes-vous sûr de vouloir forcer tous les utilisateurs à réinitialiser leurs mot de passe ?')) return;
|
|
|
$.action({
|
|
|
- action: 'general_reset_password_delay'
|
|
|
+ action: 'core_general_password_reset_delay'
|
|
|
}, function(r){
|
|
|
$.message('success', 'Validé');
|
|
|
});
|
|
@@ -1062,7 +1075,7 @@ function toggle_maintenance(){
|
|
|
checkbox.is(':checked') ? checkbox.removeAttr('checked').prop('checked', false) : checkbox.attr('checked', true).prop('checked', true);
|
|
|
return;
|
|
|
}
|
|
|
- general_settings_save();
|
|
|
+ core_general_settings_save();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1688,12 +1701,12 @@ function core_right_delete(element){
|
|
|
}
|
|
|
|
|
|
// History
|
|
|
-function history_search(callback){
|
|
|
+function core_history_search(callback){
|
|
|
var panel = $('.history-panel');
|
|
|
|
|
|
$('.comments-loader', panel).removeClass('hidden');
|
|
|
$('.comments', panel).fill({
|
|
|
- action: 'history_search',
|
|
|
+ action: 'core_history_search',
|
|
|
keyword: $('.comment-keyword').val(),
|
|
|
uid: panel.attr('data-uid'),
|
|
|
scope: panel.attr('data-scope'),
|
|
@@ -1743,7 +1756,7 @@ function history_edit(element){
|
|
|
$('.trumbowyg-editor',commentElement).focus();
|
|
|
}
|
|
|
|
|
|
-function history_save(element){
|
|
|
+function core_history_save(element){
|
|
|
var comment = $(element);
|
|
|
var commentElement = $('.history-content', comment);
|
|
|
|
|
@@ -1763,7 +1776,7 @@ function history_save(element){
|
|
|
var importance = importanceElement.prop('checked') ? 'important' : 'normal';
|
|
|
|
|
|
$.action({
|
|
|
- action: 'history_save',
|
|
|
+ action: 'core_history_save',
|
|
|
id: comment.attr('data-id'),
|
|
|
sort: comment.attr('data-sort'),
|
|
|
replaceSort:replaceSort,
|
|
@@ -1788,35 +1801,35 @@ function history_save(element){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function history_importance(element){
|
|
|
+function core_history_importance_save(element){
|
|
|
var importance = $(element).prop('checked') ? 'important' : 'normal';
|
|
|
var comment = $(element).closest('.comment');
|
|
|
var id = $(element).closest('.history-panel').attr('data-uid');
|
|
|
$.action({
|
|
|
- action: 'history_importance',
|
|
|
+ action: 'core_history_importance_save',
|
|
|
id: comment.attr('data-id'),
|
|
|
importance : importance
|
|
|
},function(r){
|
|
|
comment.attr('data-importance', importance);
|
|
|
- history_importance_count(id);
|
|
|
+ core_history_importance_save_count(id);
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function history_delete(element){
|
|
|
+function core_history_delete(element){
|
|
|
if(!confirm('Êtes-vous sûr de vouloir supprimer ce commentaire ?')) return;
|
|
|
var comment = $(element).closest('.comment');
|
|
|
var id = $(element).closest('.history-panel').attr('data-uid');
|
|
|
$.action({
|
|
|
- action: 'history_delete',
|
|
|
+ action: 'core_history_delete',
|
|
|
id: comment.attr('data-id')
|
|
|
},function(r){
|
|
|
comment.remove();
|
|
|
- history_importance_count(id);
|
|
|
+ core_history_importance_save_count(id);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function history_importance_count(uid){
|
|
|
+function core_history_importance_save_count(uid){
|
|
|
var count = $('.history-importance input:checked').length;
|
|
|
var historyNotification = $('a[data-uid="'+uid+'"] .history-notification');
|
|
|
if(count == 0){
|