forked from Wavyzz/dolibarr
Fix option MAIN_USE_JQUERY_JEDITABLE
This commit is contained in:
@@ -124,3 +124,11 @@ PARSEDOWN
|
||||
$shortage = 4 - $len % 4;
|
||||
|
||||
|
||||
|
||||
JEDITABLE.JS
|
||||
------------
|
||||
|
||||
* <button type="submit" /> => <button class="button" type="submit" />
|
||||
* <button type="cancel" /> => <button class="button" type="cancel" />
|
||||
|
||||
|
||||
|
||||
@@ -94,8 +94,9 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
|
||||
}
|
||||
else $newelement = $element;
|
||||
|
||||
$_POST['action']='update'; // Hack so restrictarea can test permission on write too
|
||||
$_POST['action']='update'; // Hack so restrictarea will test permissions on write too
|
||||
$feature = $newelement;
|
||||
$feature2 = $subelement;
|
||||
$object_id = $fk_element;
|
||||
if ($feature == 'expedition' || $feature == 'shipping')
|
||||
{
|
||||
@@ -103,10 +104,18 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
|
||||
$object_id = 0;
|
||||
}
|
||||
if ($feature == 'shipping') $feature = 'commande';
|
||||
if ($feature == 'payment') { $feature = 'facture'; }
|
||||
if ($feature == 'payment_supplier') { $feature = 'fournisseur'; $feature2 = 'facture'; }
|
||||
//var_dump(GETPOST('action','aZ09'));
|
||||
//var_dump($newelement.'-'.$subelement."-".$feature."-".$object_id);
|
||||
$check_access = restrictedArea($user, $feature, $object_id, '', $subelement);
|
||||
$check_access = restrictedArea($user, $feature, $object_id, '', $feature2);
|
||||
//var_dump($user->rights);
|
||||
/*
|
||||
if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->create) || ! empty($user->rights->$newelement->write)
|
||||
|| (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write)))
|
||||
|| ($element == 'payment' && $user->rights->facture->paiement)
|
||||
|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer))
|
||||
*/
|
||||
|
||||
if ($check_access)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2011-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
// Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
// Copyright (C) 2011-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@@ -26,6 +26,50 @@ $(document).ready(function() {
|
||||
var table_element = $('#jeditable_table_element').html();
|
||||
var fk_element = $('#jeditable_fk_element').html();
|
||||
|
||||
|
||||
if ($('.editval_string').length > 0) {
|
||||
$('.editval_string').editable(urlSaveInPlace, {
|
||||
type : 'text',
|
||||
id : 'field',
|
||||
width : withInPlace, /* Size of string area in px ? */
|
||||
tooltip : tooltipInPlace,
|
||||
placeholder : placeholderInPlace,
|
||||
cancel : cancelInPlace,
|
||||
submit : submitInPlace,
|
||||
indicator : indicatorInPlace,
|
||||
submitdata : function(result, settings) {
|
||||
return getParameters(this, 'string');
|
||||
},
|
||||
callback : function(result, settings) {
|
||||
getResult(this, result);
|
||||
},
|
||||
onreset : function(result, settings) {
|
||||
getDefault(settings);
|
||||
}
|
||||
});
|
||||
$('.editkey_string').hover(
|
||||
function () {
|
||||
console.log("We are hover (entry) an editkey_string");
|
||||
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
|
||||
},
|
||||
function () {
|
||||
console.log("We are no more hover an editkey_string");
|
||||
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
|
||||
}
|
||||
);
|
||||
$('.editkey_string').click(function() {
|
||||
console.log("We click on the edit field");
|
||||
$('#viewval_' + $(this).attr('id')).click();
|
||||
$('#viewval_' + $(this).attr('id')).hide();
|
||||
$('#editval_' + $(this).attr('id')).show().click();
|
||||
});
|
||||
$('.viewval_string.active').click(function() {
|
||||
console.log("We click on the viewed value");
|
||||
$('#viewval_' + $(this).attr('id').substr(8)).hide();
|
||||
$('#editval_' + $(this).attr('id').substr(8)).show().click();
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.editval_textarea').length > 0) {
|
||||
$('.editval_textarea').editable(urlSaveInPlace, {
|
||||
type : 'textarea',
|
||||
@@ -127,49 +171,6 @@ $(document).ready(function() {
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.editval_string').length > 0) {
|
||||
$('.editval_string').editable(urlSaveInPlace, {
|
||||
type : 'text',
|
||||
id : 'field',
|
||||
width : withInPlace, /* Size of string area in px ? */
|
||||
tooltip : tooltipInPlace,
|
||||
placeholder : placeholderInPlace,
|
||||
cancel : cancelInPlace,
|
||||
submit : submitInPlace,
|
||||
indicator : indicatorInPlace,
|
||||
submitdata : function(result, settings) {
|
||||
return getParameters(this, 'string');
|
||||
},
|
||||
callback : function(result, settings) {
|
||||
getResult(this, result);
|
||||
},
|
||||
onreset : function(result, settings) {
|
||||
getDefault(settings);
|
||||
}
|
||||
});
|
||||
$('.editkey_string').hover(
|
||||
function () {
|
||||
console.log("We are hover (entry) an editkey_string");
|
||||
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
|
||||
},
|
||||
function () {
|
||||
console.log("We are no more hover an editkey_string");
|
||||
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
|
||||
}
|
||||
);
|
||||
$('.editkey_string').click(function() {
|
||||
$( '#viewval_' + $(this).attr('id') ).click();
|
||||
});
|
||||
$('.viewval_string.active').click(function() {
|
||||
$('#viewval_' + $(this).attr('id').substr(8)).hide();
|
||||
$('#editval_' + $(this).attr('id').substr(8)).show().click();
|
||||
});
|
||||
$('.editkey_string').click(function() {
|
||||
$('#viewval_' + $(this).attr('id')).hide();
|
||||
$('#editval_' + $(this).attr('id')).show().click();
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.editval_numeric').length > 0) {
|
||||
$('.editval_numeric').editable(urlSaveInPlace, {
|
||||
type : 'text',
|
||||
|
||||
@@ -424,7 +424,7 @@
|
||||
});
|
||||
/* otherwise use button with given string as text */
|
||||
} else {
|
||||
var submit = $('<button type="submit" />');
|
||||
var submit = $('<button class="button" type="submit" />');
|
||||
submit.html(settings.submit);
|
||||
}
|
||||
$(this).append(submit);
|
||||
@@ -435,7 +435,7 @@
|
||||
var cancel = $(settings.cancel);
|
||||
/* otherwise use button with given string as text */
|
||||
} else {
|
||||
var cancel = $('<button type="cancel" />');
|
||||
var cancel = $('<button class="button" type="cancel" />');
|
||||
cancel.html(settings.cancel);
|
||||
}
|
||||
$(this).append(cancel);
|
||||
|
||||
@@ -1244,7 +1244,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! defined('DISABLE_JQUERY_JEDITABLE'))
|
||||
{
|
||||
print '<!-- JS to manage editInPlace feature -->'."\n";
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||
print '<script type="text/javascript">'."\n";
|
||||
|
||||
Reference in New Issue
Block a user