Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ATM-Consulting/dolibarr_module_up…
Browse files Browse the repository at this point in the history
…buttons
  • Loading branch information
atm-arnaud committed Dec 22, 2017
2 parents 0bea886 + 4d90f5c commit 0fad96d
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.nbprocjet
.nbproject
.buildpath
.project
.settings/
10 changes: 5 additions & 5 deletions admin/upbuttons_setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,21 @@
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";


/*
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("ParamLabel").'</td>';
print '<td>'.$langs->trans("UseAllButton").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_CONSTNAME">';
print $form->selectyesno("CONSTNAME",$conf->global->CONSTNAME,1);
print '<input type="hidden" name="action" value="set_UPBUTTON_USE_ALL_MODE">';
print $form->selectyesno("UPBUTTON_USE_ALL_MODE",$conf->global->UPBUTTON_USE_ALL_MODE,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';

*/
print '</table>';

llxFooter();
Expand Down
8 changes: 7 additions & 1 deletion core/modules/modUpbuttons.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function __construct($db)
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Description of module Upbuttons";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = '1.0';
$this->version = '1.0.1';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
Expand Down Expand Up @@ -182,6 +182,12 @@ function __construct($db)
$this->rights[$r][4] = 'useit'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;

$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'UseAllButton'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'UseAllButton'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;


// Main menu entries
$this->menu = array(); // List of menus to add
Expand Down
Binary file added img/all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/all.xcf
Binary file not shown.
68 changes: 62 additions & 6 deletions js/upbuttons.js.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
<?php

header('Content-Type: application/javascript');

require '../config.php';

if(empty($user->rights->upbuttons->useit)) exit;


?>$(document).ready(function() {
var $el = $('div.tabsAction');
var $el = $('div.tabsAction').first();

<?php
if(!empty($user->rights->upbuttons->UseAllButton)) {
echo '$("body").append("'.addslashes('<a href="javascript:;" id="justOneButton" style="display:none;">'.img_picto('','all@upbuttons').'</a>').'");';
}
?>


function scrollButtonsToUp() {
var scrollTop = $(window).scrollTop();
var scrollLeft = $(window).scrollLeft();
var wHeight = $( window ).height();

if(scrollTop + wHeight < originalElementTop ) {
var wWidth = $( window ).width();

if((scrollTop + wHeight < originalElementTop) || (scrollLeft + wWidth < originalElementLeft)) {
//console.log("tabsAction not in screen ");

$el.css({
Expand All @@ -28,11 +39,47 @@ function scrollButtonsToUp() {
});

$el.addClass('upbuttonsdiv');

$('#justOneButton').click(function() {

if($el.is(":visible")) {
$el.hide();
$(this).css('bottom', 20);

}
else {
$el.show();
$(this).css('bottom', $el.height() + 10);

}
});


<?php
if(!empty($user->rights->upbuttons->UseAllButton)) {
?>
$el.hide();
$('#justOneButton').css({
position:"fixed"
,bottom:'20px'
,right:'20px'
,'margin':'0 0 0 0'
,'opacity':0.7
}).show();

<?php
}
else {
null;
}
?>
}
else{
//console.log("tabsAction in screen ");
$el.removeAttr('style');
$el.removeClass('upbuttonsdiv');
$el.show();
$('#justOneButton').hide();
}
}

Expand All @@ -41,11 +88,20 @@ function scrollButtonsToUp() {

if (editline_subtotal == -1 && ($el.length == 1 && ($el.find('.button').length>0 || $el.find('.butAction').length>0)))
{
var originalElementTop = $el.offset().top;

var originalElementTop = $el.offset().top;
var originalElementLeft = $el.offset().left;

if(originalElementTop <= 0) {
window.setTimeout(function() { originalElementTop = $el.offset().top;originalElementLeft = $el.offset().left; scrollButtonsToUp(); },100);
}
$( window ).resize(function() {
scrollButtonsToUp();
});

$(window).on('scroll', function() {
scrollButtonsToUp();
scrollButtonsToUp();
});

scrollButtonsToUp();
}

Expand Down
3 changes: 2 additions & 1 deletion langs/fr_FR/upbuttons.lang
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Module104830Desc = Module affichant en flottant les boutons d'actions d'une fich
ATMAbout = Ce module a été développé par <a href="http://www.atm-consulting.fr" target="_blank">ATM Consulting</a><br>Vous pouvez retrouver la documentation sur notre <a href="http://wiki.atm-consulting.fr/index.php/Accueil" target="_blank">wiki</a><br><br>Pour toute question technique ou retour, contactez-nous sur <a href="mailto:support@atm-consulting.fr">support@atm-consulting.fr</a><br><br>Pour toute question commerciale, contactez-nous sur <a href="mailto:contact@atm-consulting.fr">contact@atm-consulting.fr</a> ou au +33 9 77 19 50 70<br><br>Retrouvez nos autres modules sur <a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=atm&submit_search=Rechercher" target="_blank">Dolistore</a>

UpbuttonsSetup = Configuration du module Upbuttons
UpbuttonsAbout = A propos du module Upbuttons
UpbuttonsAbout = A propos du module Upbuttons
UseAllButton=Utilise le mode un seul bouton
7 changes: 7 additions & 0 deletions langs/it_IT/upbuttons.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Module104830Name = Upbuttons
Module104830Desc = Mostra i bottoni d'azione senza necessità di scorrere la pagina

ATMAbout = Questo modulo è stato sviluppato da <a href="http://www.atm-consulting.fr" target="_blank">ATM Consulting</a><br>Ulteriore documentazione disponibile nel <a href="http://wiki.atm-consulting.fr/index.php/Accueil" target="_blank">wiki</a><br><br>Per domande e feedback contattateci a <a href="mailto:support@atm-consulting.fr">support@atm-consulting.fr</a><br><br>Per questioni commerciali contattateci a<a href="mailto:contact@atm-consulting.fr">contact@atm-consulting.fr</a> or at +33 9 77 19 50 70<br><br>Scoprite altri moduli sul <a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=atm&submit_search=Rechercher" target="_blank">Dolistore</a>

UpbuttonsSetup = Upbuttons impostazioni modulo
UpbuttonsAbout = A proposito Upbuttons

0 comments on commit 0fad96d

Please sign in to comment.