dolibarr 24.0.0-beta
btn.inc.php
1<?php
2/* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
3 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18if (!defined('ISLOADEDBYSTEELSHEET')) {
19 die('Must be call by steelsheet');
20}
36'
37@phan-var-force string $butactionbg
38@phan-var-force string $colorbackhmenu1
39@phan-var-force string $colortextlink
40@phan-var-force int<0,1> $dol_optimize_smallscreen
41@phan-var-force string $fontlist
42@phan-var-force string $fontsize
43@phan-var-force string $left
44@phan-var-force int<0,max> $nbtopmenuentries
45@phan-var-force string $right
46@phan-var-force string $textbutaction
47';
48?>
49
50/* IDE Hack <style type="text/css"> */
51
52:root {
53 --btncolortext:rgb(<?php print $colortextlink; ?>);
54 --btncolorbg: #fbfbfb;
55 --btncolorborderhover: none;
56 --btncolorborder: #FFF;
57 --butactiondeletebg: rgb(234,228,225);
58 --butactioncancelbg: #bbb;
59 --butactionbg: rgb(<?php print $butactionbg; ?>);
60 --textbutaction: rgb(<?php print $textbutaction; ?>);
61}
62
63<?php
64if (getDolGlobalString('THEME_DARKMODEENABLED')) {
65 print "/* For dark mode */\n";
66 if (getDolGlobalInt('THEME_DARKMODEENABLED') != 2) {
67 print "@media (prefers-color-scheme: dark) {"; // To test, click on the 3 dots menu, then Other options then Display then emulate prefer-color-schemes
68 } else {
69 print "@media not print {";
70 }
71 print "
72 :root {
73
74 --btncolortext: ;
75 --btncolorbg: rgb(26,27,27);
76 --btncolorborderhover: #ffffff;
77 --btncolorborder: #2b2c2e;
78 --butactiondeletebg: rgb(252,84,91);
79 --butactioncancelbg: #888;
80 --butactionbg: rgb(173,140,79);
81 --textbutaction: rgb(255,255,255);
82
83 }\n";
84 print "}";
85}
86?>
87
88/* ============================================================================== */
89/* Buttons for actions */
90/* ============================================================================== */
91
92
93div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete,
94div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete,
95div.tabsAction > div.divButAction > span.butAction,
96div.tabsAction > div.divButAction > span.butActionDelete,
97div.tabsAction > div.divButAction > span.butActionRefused,
98div.tabsAction > div.divButAction > a.butAction,
99div.tabsAction > div.divButAction > a.butActionDelete,
100div.tabsAction > div.divButAction > a.butActionRefused {
101 margin-bottom: 1.4em !important;
102 margin-right: 0px !important;
103}
104div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused {
105 margin-bottom: 0 !important;
106}
107
108span.butAction, span.butActionDelete {
109 cursor: pointer;
110}
111.paginationafterarrows .butAction {
112 font-size: 0.9em;
113}
114
115.butAction {
116 background: var(--butactionbg);
117 color: var(--textbutaction) !important;
118 /* background: rgb(230, 232, 239); */
119}
120.butActionRefused, .butAction, .butActionDelete {
121 border-radius: 3px;
122}
123:not(.center) > .butActionRefused:last-child, :not(.center) > .butAction:last-child, :not(.center) > .butActionDelete:last-child {
124 margin-<?php echo $right; ?>: 0px !important;
125}
126.butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active {
127 text-decoration: none;
128 text-transform: uppercase;
129 font-weight: bold;
130 line-height: 1.8em;
131
132 margin: 0em <?php echo($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
133 padding: 0.6em <?php echo($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
134 display: inline-block;
135 text-align: center;
136 cursor: pointer;
137 color: #444;
138}
139.butActionNew, .butActionNewRefused, .butActionNew:link, .butActionNew:visited, .butActionNew:hover, .butActionNew:active {
140 text-decoration: none;
141 text-transform: uppercase;
142 font-weight: normal;
143
144 margin: 0em 0.3em 0 0.3em !important;
145 padding: 0.2em <?php echo($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em 0.3em;
146 font-family: <?php print $fontlist ?>;
147 display: inline-block;
148 /* text-align: center; New button are on right of screen */
149 cursor: pointer;
150}
151
152.button {
153 border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
154 display: inline-block;
155 padding: 0.4em <?php echo($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em;
156 margin: 0em <?php echo($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em;
157 line-height: 20px;
158 text-align: center;
159 vertical-align: middle;
160 cursor: pointer;
161 color: #333333 !important;
162 text-decoration: none !important;
163 text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
164 background-color: #f5f5f5;
165 background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
166 background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
167 background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
168 background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
169 background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
170 background-repeat: repeat-x;
171 border-color: #e6e6e6 #e6e6e6 #bfbfbf;
172 border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
173 border: 1px solid #bbbbbb;
174 border-bottom-color: #a2a2a2;
175 border-radius: 2px;
176 box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
177}
178.butActionNew, .butActionNewRefused, .butActionNew:link, .butActionNew:visited, .butActionNew:hover, .butActionNew:active {
179 text-decoration: none;
180 /* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */
181 display: inline-block;
182 padding: 0.2em <?php echo($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em;
183 margin: 0em <?php echo($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em;
184 line-height: 20px;
185 /* text-align: center; New button are on right of screen */
186 vertical-align: middle;
187 cursor: pointer;
188 border-radius: 2px;
189}
190a.butActionNew>span.fa-plus-circle { padding-left: 6px; font-size: 1.5em; }
191a.butActionNewRefused>span.fa-plus-circle { padding-left: 6px; font-size: 1.5em; }
192
193.tableforfieldcreate a.butActionNew>span.fa-plus-circle, .tableforfieldcreate a.butActionNew>span.fa-plus-circle:hover,
194.tableforfieldedit a.butActionNew>span.fa-plus-circle, .tableforfieldedit a.butActionNew>span.fa-plus-circle:hover,
195span.butActionNew>span.fa-plus-circle, span.butActionNew>span.fa-plus-circle:hover,
196a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover,
197span.butActionNewRefused>span.fa-plus-circle, span.butActionNewRefused>span.fa-plus-circle:hover,
198a.butActionNew>span.fa-list-alt, a.butActionNew>span.fa-list-alt:hover,
199span.butActionNew>span.fa-list-alt, span.butActionNew>span.fa-list-alt:hover,
200a.butActionNewRefused>span.fa-list-alt, a.butActionNewRefused>span.fa-list-alt:hover,
201span.butActionNewRefused>span.fa-list-alt, span.butActionNewRefused>span.fa-list-alt:hover
202{
203 font-size: 1em;
204 padding-left: 0px;
205}
206
207.button {
208 color: #ffffff !important;
209 text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
210 background-color: #006dcc;
211 background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
212 background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
213 background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
214 background-image: -o-linear-gradient(top, #0088cc, #0044cc);
215 background-image: linear-gradient(to bottom, #0088cc, #0044cc);
216 background-repeat: repeat-x;
217 border-color: #0044cc #0044cc #002a80;
218 border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
219}
221 color: #666 !important;
222 text-shadow: none;
223 border-color: #555;
224 cursor: not-allowed;
225
226 background-color: #f5f5f5;
227 background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
228 background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
229 background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
230 background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
231 background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
232 background-repeat: repeat-x
233}
234
235button.ui-button {
236 padding-top: 5px;
237}
238
239a.butActionNew>span.fa, a.butActionNew>span.fa:hover,
240span.butActionNew>span.fa, span.butActionNew>span.fa:hover,
241a.butActionNewRefused>span.fa, a.butActionNewRefused>span.fa:hover,
242span.butActionNewRefused>span.fa, span.butActionNewRefused>span.fa:hover
243{
244 padding-<?php echo $left; ?>: 6px;
245 font-size: 1.5em;
246 border: none;
247 box-shadow: none;
248}
249
250.butAction:hover {
251 box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), inset 0px 0px 200px rgba(60,60,60,0.1);
252}
253.butActionNew:hover {
254 text-decoration: underline;
255 box-shadow: unset !important;
256}
257
258.butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete {
259 background: var(--butactiondeletebg);
260 color: #633 !important;
261}
262.button.button-cancel, .button.button-cancel:link, .button.button-cancel:visited, .button.button-cancel:hover, .button.button-cancel:active, .button.button-cancel {
263 background: var(--butactioncancelbg) !important;
264 color: #888 !important;
265}
266
267.butActionDelete:hover {
268 box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
269}
270.button.button-cancel:hover {
271 box-shadow: 0px 0px 4px 1px rgba(50, 50, 50, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
272}
273
274.butActionRefused {
275 text-decoration: none !important;
276 text-transform: uppercase;
277 font-weight: bold !important;
278
279 white-space: nowrap !important;
280 cursor: not-allowed !important;
281 margin: 0em <?php echo($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
282 padding: 0.6em <?php echo($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
283 font-family: <?php print $fontlist ?> !important;
284 display: inline-block;
285 text-align: center;
286 cursor: pointer;
287 color: #999 !important;
288
289 border: 1px solid #ccc;
290 box-sizing: border-box;
291 -moz-box-sizing: border-box;
292 -webkit-box-sizing: border-box;
293}
294.butActionNewRefused, .butActionNewRefused:link, .butActionNewRefused:visited, .butActionNewRefused:hover, .butActionNewRefused:active {
295 text-decoration: none !important;
296 text-transform: uppercase;
297 font-weight: normal !important;
298
299 white-space: nowrap !important;
300 cursor: not-allowed !important;
301 margin: 0em <?php echo($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em;
302 padding: 0.2em <?php echo($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em;
303 font-family: <?php print $fontlist ?> !important;
304 display: inline-block;
305 /* text-align: center; New button are on right of screen */
306 cursor: pointer;
307 color: #999 !important;
308 padding-top: 0.2em;
309 box-shadow: none !important;
310}
311
312.butActionTransparent {
313 color: #222 ! important;
314 background-color: transparent ! important;
315}
316
317.butActionLogin {
318 background-color: rgb(<?php echo $colorbackhmenu1; ?>);
319}
320
321
322/*
323TITLE BUTTON
324 */
325
326div.pagination li:first-child a.btnTitle, div.pagination li.paginationafterarrows a.btnTitle,
327table.table-fiche-title tr.titre td.col-center div.nowraponall a.btnTitle,
328table.table-fiche-title tr.titre td.col-right a.btnTitle {
329 margin-<?php echo $left; ?>: 10px;
330}
331
332.btnTitle, a.btnTitle {
333 display: inline-block;
334 padding: 4px 12px;
335 font-size: 14px;
336 font-weight: 400;
337 line-height: 1.4;
338 text-align: center;
339 white-space: nowrap;
340 vertical-align: middle;
341 -ms-touch-action: manipulation;
342 touch-action: manipulation;
343 cursor: pointer;
344 -webkit-user-select: none;
345 -moz-user-select: none;
346 -ms-user-select: none;
347 user-select: none;
348 box-shadow: none;
349 text-decoration: none;
350 position: relative;
351 margin: 0 0 0 10px;
352 text-align: center;
353 color: var(--btncolortext);
354 font-size: 12px;
355 font-weight: 300;
356 /* background-color: #fbfbfb; */
357 border: 1px solid transparent;
358}
359/* *:not(.paginationafterarrows) > .btnTitle, *:not(.paginationafterarrows) > a.btnTitle { */
360.btnTitle, a.btnTitle {
361 min-width: 60px;
362}
363
364a.btnTitle.btnTitleSelected {
365 border: 1px solid #ccc;
366 border-radius: 3px;
367}
368
369.btnTitle > .btnTitle-icon{
370
371}
372
373.btnTitle > .btnTitle-label{
374 color: #666666;
375}
376
377.btnTitle:hover, a.btnTitle:hover {
378 border-radius: 3px;
379 position: relative;
380 margin: 0 0 0 10px;
381 text-align: center;
382 color: #000;
383 background-color: #eee;
384 font-size: 12px;
385 text-decoration: none;
386 box-shadow: none;
387}
388
389.btnTitle.refused, a.btnTitle.refused, .btnTitle.refused:hover, a.btnTitle.refused:hover {
390 color: #8a8a8a;
391 cursor: not-allowed;
392 background-color: #fbfbfb;
393 background: repeating-linear-gradient( 45deg, #ffffff, #f1f1f1 4px, #f1f1f1 4px, #f1f1f1 4px );
394}
395
396.btnTitle:hover .btnTitle-label{
397 color:var(--btncolorborderhover);
398}
399div.pagination .btnTitle:hover .btnTitle-label{
400 color: rgb(<?php print $colortextlink; ?>);
401}
402
403.btnTitle.refused .btnTitle-label, .btnTitle.refused:hover .btnTitle-label{
404 color: #8a8a8a;
405}
406
407.btnTitle>.fa {
408 font-size: 2em;
409 display: block;
410}
411
412.paginationafterarrows a.btnTitlePlus, .titre_right a.btnTitlePlus {
413 /* border: 1px solid var(--btncolorborder); */
414 border: unset;
415 background-color: unset;
416}
417.paginationafterarrows a.btnTitlePlus:hover, .titre_right a.btnTitlePlus:hover {
418 border-color: #ddd;
419}
420
421/* The buttonplus is growing on hover (don't know why). This is to avoid to have the cell growing too */
422.btnTitlePlus:hover {
423 /* max-width: 24px; */ /* max width is a problem when the button has a text under */
424 max-height: 42px;
425}
426
427/* nboftopmenuentries = <?php echo $nbtopmenuentries ?> ?> */
428/* rule to reduce top menu - 1st reduction: Reduce width of top menu icons */
429@media only screen and (max-width: <?php echo getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC1', round($nbtopmenuentries * 90, 0) + 340); ?>px) /* reduction 1 */
430{
431 .btnTitle, a.btnTitle {
432 min-width: 40px;
433 }
434}
435
436/* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */
437@media only screen and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC2') ? round($nbtopmenuentries * 69, 0) + 130 : getDolGlobalInt('THEME_ELDY_WITDHOFFSET_FOR_REDUC2'); ?>px) /* reduction 2 */
438{
439 .butAction, .butActionRefused, .butActionDelete {
440 font-size: 0.95em;
441 }
442}
443
444/* rule to reduce top menu - 3rd reduction: The menu for user is on left */
445@media only screen and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3') ? round($nbtopmenuentries * 47, 0) + 130 : getDolGlobalInt('THEME_ELDY_WITDHOFFSET_FOR_REDUC3'); ?>px) /* reduction 3 */
446{
447 .butAction, .butActionRefused, .butActionDelete {
448 font-size: 0.9em;
449 }
450}
451
452/* smartphone */
453@media only screen and (max-width: 767px)
454{
455 .butAction, .butActionRefused, .butActionDelete {
456 font-size: 0.85em;
457 }
458
459 /* for small screen, we reduce the min with of button */
460 .btnTitle, a.btnTitle {
461 display: inline-block;
462 padding: 4px 4px 4px 4px;
463 min-width: unset; /* if we unset the min-width here, we must also unset the font-size on .paginationafterarrows a.btnTitlePlus:hover span:before to avoid page content move */
464 }
465 .paginationafterarrows a.btnTitlePlus:hover span:before, .titre_right a.btnTitlePlus:hover span:before {
466 font-size: unset !important;
467 }
468}
469
470
471<?php if (getDolGlobalString('MAIN_BUTTON_HIDE_UNAUTHORIZED') && (!$user->admin)) { ?>
472.butActionRefused, .butActionNewRefused, .btnTitle.refused {
473 display: none !important;
474}
475<?php } ?>
476
477
478/*
479 * BTN LINK
480 */
481
482.btn-link{
483 margin-right: 5px;
484 border: 1px solid #ddd;
485 color: #333;
486 padding: 5px 10px;
487 border-radius:1em;
488 text-decoration: none !important;
489}
490
491.btn-link:hover{
492 background-color: #ddd;
493 border: 1px solid #ddd;
494}
495
496
497
498/*
499 * BUTTON With Low emphasis
500 */
501
502button.btn-low-emphasis{
503 text-align: center;
504 display: inline-block;
505 border: none;
506 outline: none;
507 cursor: pointer;
508 margin: 0;
509 padding: 0;
510 width: auto;
511 min-width: 1.5em;
512 min-height: 1.5em;
513 line-height: 1.5em;
514
515 overflow: visible;
516 background: transparent;
517 background-position: center; /* used for hover ripple effect */
518 background-size: 0%;
519 color: var(--colortextlink, inherit);
520 font: inherit;
521 line-height: normal;
522
523 /* Corrects font smoothing for webkit */
524 -webkit-font-smoothing: inherit;
525 -moz-osx-font-smoothing: inherit;
526
527 /* Corrects inability to style clickable input types in iOS */
528 -webkit-appearance: none;
529
530
531 transition: background 0.8s;/* used for hover ripple effect */
532 background: transparent radial-gradient(circle, transparent 1%, hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1) 1%, transparent 10%) center/15000%;
533}
534
535button.btn-low-emphasis.--btn-icon{
536 border-radius: 100%;
537}
538
539button.btn-low-emphasis :is(.fa, .fas){
540 color: var(--colortextlink, inherit);
541 opacity: 0.4;
542}
543
544button.btn-low-emphasis:is(:focus,:hover) :is(.fa, .fas){
545 opacity: 0.8;
546}
547
548button.btn-low-emphasis.--btn-icon:active {
549 background-color: hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1);
550 background-size: 100%;
551 transition: background 0s;/* used for hover ripple effect */
552}
553
554
555input.button-save, input.button-cancel {
556 min-width: 110px;
557 margin-left: 8px !important;
558 margin-right: 8px !important;
559}
560
561/* smartphone */
562
563@media only screen and (max-width: 767px)
564{
565 input.button-save, input.button-cancel {
566 min-width: 90px;
567 margin-left: 4px !important;
568 margin-right: 4px !important;
569 }
570}
print $object position
Definition edit.php:206
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
multi select button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
treeview li table
No Email.
a disabled
editval_textarea active
$fontlist
Definition style.css.php:75
$conf db user
Active Directory does not allow anonymous connections.
Definition repair.php:134