Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// ---------------------
// VIEW FEATURES
// ---------------------
// Dynamically display a message in any view
function ff4j_displayMessage(msgType, msgInfo) {
$('#message').html(
'
' +
'' +
'' + msgInfo + '
');
}
// Toggle OFF a feature through AXAJ call
function ff4j_disable(flip) {
$.ajax({
type: 'GET',
url: $(location).attr('href'),
data : 'op=disable&uid=' + $(flip).attr('id'),
dataType : 'html',
success : function(code_html, statut){
ff4j_displayMessage("success", "Toggle OFF feature " + $(flip).attr('id') + "");
},
error : function(resultat, statut, erreur){
ff4j_displayMessage("error", statut + "-" + erreur);
$(flip).prop('checked', false);
},
complete : function(resultat, statut){
console.log("Toggle OFF feature " + $(flip).attr('id') + "");
}
});
}
// Toggle ON a feature through AXAJ call
function ff4j_enable(flip) {
$.ajax({
type: 'GET',
url: $(location).attr('href'),
data : 'op=enable&uid=' + $(flip).attr('id'),
dataType : 'html',
success : function(code_html, statut){
ff4j_displayMessage("success", "Toggle ON feature " + $(flip).attr('id') + "");
},
error : function(resultat, statut, erreur){
ff4j_displayMessage("error", statut + "-" + erreur);
$(flip).prop('checked', false);
},
complete : function(resultat, statut){
console.log("Toggle ON feature " + $(flip).attr('id') + "");
}
});
}
// Triggered by clic, toggle ON/OFF depending on state
function toggle(flip) {
if(!$(flip).is(':checked')) {
ff4j_disable(flip);
} else {
ff4j_enable(flip);
}
}
function confirmBeforeDeleteFeature(feature) {
/*
$('button[name="remove_levels"]').on('click', function(e){
var $form=$(this).closest('form');
e.preventDefault();
$('#confirm').modal({ backdrop: 'static', keyboard: false })
.one('click', '#delete', function (e) {
$form.trigger('submit');
});
});*/
}
// Display Custom Properties for current feature in the table
function showCustomProperties(uid) {
show('detailCustomP-' + uid);
show('linkhideCustomP-' + uid);
hide('linkCustomP-' + uid);
}
// Hide the list of customProperties
function hideCustomProperties(uid) {
hide('detailCustomP-' + uid);
hide('linkhideCustomP-' + uid);
show('linkCustomP-' + uid);
}
// Show target permissions for feature
function showFeaturePermissions(uid) {
show('detailPerm-' + uid);
show('linkhidePerm-' + uid);
hide('linkPerm-' + uid);
}
// Hide target permission
function hideFeaturePermissions(uid) {
hide('detailPerm-' + uid);
hide('linkhidePerm-' + uid);
show('linkPerm-' + uid);
}
// ---------------------
// MODAL DELETE FEATURE
// ---------------------
function ff4j_updateModalDeleteFeature(uid) {
console.log("ff4j_updateModalDeleteFeature");
console.log(uid)
$("#modalDeleteFeature #uid").val(uid);
}
function ff4j_updateModalDeleteProperty(uid) {
$("#modalDeleteProperty #name").val(uid);
}
// At Load, fill edit form with Data coming from REST Call
function ff4j_updateModalEditFeature(uid) {
var modalEdit = $("#modalEdit");
$.get('api/features/' + uid,
function(feature) {
modalEdit.find("#uid").val(feature.uid);
modalEdit.find("#desc").val(feature.description);
// Group
if (feature.group) {
$("#modalEdit #groupName").val(feature.group);
}
// Strategy
if (feature.flippingStrategy) {
$("#modalEdit #stratlist").show();
$("#modalEdit #strategy").val(feature.flippingStrategy.type);
var initParamsStr = '';
for (var key in feature.flippingStrategy.initParams) {
if (feature.flippingStrategy.initParams.hasOwnProperty(key)) {
if (initParamsStr.length > 0) {
initParamsStr+= ';';
}
initParamsStr+= (key + '=' + feature.flippingStrategy.initParams[key]);
}
}
$("#modalEdit #initParams").val(initParamsStr);
} else {
$("#modalEdit #stratlist").hide();
$("#modalEdit #strategy").val('');
$("#modalEdit #initParams").val('');
}
// Permissions
ff4j_drawPermissions(feature.uid);
// CustomProperties
ff4j_drawCustomProperties(feature.uid);
});
}
// Display the permissions as dynamically changed in modal
function ff4j_drawPermissions(uid) {
$("#modalEdit #permlist").hide();
$("#modalEdit #permission").val('Public');
$.get('api/features/' + uid,
function(feature) {
var htmlForFixedValueList = '';
if (feature.permissions) {
var permissions = feature.permissions;
var arrayLength = permissions.length;
if (arrayLength > 0) {
$("#modalEdit #permlist").show();
$("#modalEdit #permission").val('Define Permissions');
for (var i = 0; i < arrayLength; i++) {
htmlForFixedValueList+= '