dolibarr 24.0.2
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 $left
43@phan-var-force int<0,max> $nbtopmenuentries
44@phan-var-force string $right
45@phan-var-force string $textbutaction
46';
47?>
48
49/* IDE Hack <style type="text/css"> */
50
51:root {
52 --btncolortext: rgb(<?php print $colortextlink; ?>);
53 --btncolorbg: #fbfbfb;
54 --btncolorborderhover: none;
55 --btncolorborder: #FFF;
56 --butactiondeletebg: rgb(234,228,225);
57 --butactioncancelbg: #e3e3e3;
58 --butactionbg: rgb(<?php print $butactionbg; ?>);
59 --textbutaction: rgb(<?php print $textbutaction; ?>);
60}
61
62<?php
63if (getDolGlobalInt('THEME_DARKMODEENABLED')) {
64 print "/* For dark mode */\n";
65 if (getDolGlobalInt('THEME_DARKMODEENABLED') != 2) {
66 print "@media (prefers-color-scheme: dark) {"; // To test, click on the 3 dots menu, then Other options then Display then emulate prefer-color-schemes
67 } else {
68 print "@media not print {";
69 }
70 print "
71 :root {
72
73 --btncolortext: ;
74 --btncolorbg: rgb(26,27,27);
75 --btncolorborderhover: #ffffff;
76 --btncolorborder: #2b2c2e;
77 --butactiondeletebg: rgb(252,84,91);
78 --butactionbg: rgb(173,140,79);
79 --textbutaction: rgb(255,255,255);
80
81 }\n";
82 print "}";
83}
84?>
85
86
87/* ============================================================================== */
88/* Buttons for actions */
89/* ============================================================================== */
90
91
92div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete,
93div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete,
94div.tabsAction > div.divButAction > span.butAction,
95div.tabsAction > div.divButAction > span.butActionDelete,
96div.tabsAction > div.divButAction > span.butActionRefused,
97div.tabsAction > div.divButAction > a.butAction,
98div.tabsAction > div.divButAction > a.butActionDelete,
99div.tabsAction > div.divButAction > a.butActionRefused,
100div.tabsAction > .dropdown > .dropdown-toggle {
101 margin-bottom: 1.4em !important;
102 margin-right: 0px !important;
103 /* box-shadow: 1px 1px 5px #d0d0d0; */
104}
105
106.divButAction {
107 padding: 0 !important;
108 margin: 0 !important;
109}
110div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused {
111 margin-bottom: 0 !important;
112}
113
114span.butAction, span.butActionDelete {
115 cursor: pointer;
116}
117.paginationafterarrows .butAction {
118 font-size: 0.9em;
119}
120.butAction {
121 background: var(--butactionbg);
122 color: var(--textbutaction) !important;
123 /* background: rgb(230, 232, 239); */
124}
125.butActionRefused, .butAction, .butActionDelete {
126 border-radius: 3px;
127}
128:not(.center) > .butActionRefused:last-child, :not(.center) > .butAction:last-child, :not(.center) > .butActionDelete:last-child {
129 margin-<?php echo $right; ?>: 0px !important;
130}
131.butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active,
132.divButAction
133 {
134 text-decoration: none;
135 text-transform: uppercase;
136 font-weight: bold;
137
138 margin: 0em <?php echo($dol_optimize_smallscreen ? '0.6' : '1'); ?>em;
139 padding: 0.6em <?php echo($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
140 display: inline-block;
141 text-align: center;
142 cursor: pointer;
143 color: #444;
144 border: 1px solid transparent; /* So for buttonRefused with a border, it will not have any flash effect */
145
146 /* border: 1px solid #aaa; */
147 /* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */
148
149 /*border-top-right-radius: 0 !important;
150 border-bottom-right-radius: 0 !important;
151 border-top-left-radius: 0 !important;
152 border-bottom-left-radius: 0 !important;*/
153}
154.butActionNew, .butActionNewRefused, .butActionNew:link, .butActionNew:visited, .butActionNew:hover, .butActionNew:active {
155 text-decoration: none;
156 text-transform: uppercase;
157 font-weight: normal;
158
159 margin: 0em 0.3em 0 0.3em !important;
160 padding: 0.2em <?php echo($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em 0.3em;
161 font-family: <?php print $fontlist ?>;
162 display: inline-block;
163 /* text-align: center; New button are on right of screen */
164 cursor: pointer;
165}
166
167.tableforfieldcreate a.butActionNew>span.fa-plus-circle, .tableforfieldcreate a.butActionNew>span.fa-plus-circle:hover,
168.tableforfieldedit a.butActionNew>span.fa-plus-circle, .tableforfieldedit a.butActionNew>span.fa-plus-circle:hover,
169span.butActionNew>span.fa-plus-circle, span.butActionNew>span.fa-plus-circle:hover,
170a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover,
171span.butActionNewRefused>span.fa-plus-circle, span.butActionNewRefused>span.fa-plus-circle:hover,
172a.butActionNew>span.fa-list-alt, a.butActionNew>span.fa-list-alt:hover,
173span.butActionNew>span.fa-list-alt, span.butActionNew>span.fa-list-alt:hover,
174a.butActionNewRefused>span.fa-list-alt, a.butActionNewRefused>span.fa-list-alt:hover,
175span.butActionNewRefused>span.fa-list-alt, span.butActionNewRefused>span.fa-list-alt:hover
176{
177 font-size: 1em;
178 padding-left: 0px;
179}
180
181a.butActionNew>span.fa, a.butActionNew>span.fa:hover,
182span.butActionNew>span.fa, span.butActionNew>span.fa:hover,
183a.butActionNewRefused>span.fa, a.butActionNewRefused>span.fa:hover,
184span.butActionNewRefused>span.fa, span.butActionNewRefused>span.fa:hover
185{
186 padding-<?php echo $left; ?>: 6px;
187 font-size: 1.5em;
188 border: none;
189 box-shadow: none;
190 webkit-box-shadow: none;
191}
192
193.butAction:hover, .dropdown-holder.open > .butAction {
195 box-shadow: 0px 0px 6px rgba(50,50,50,0.4), inset 0px 0px 200px rgba(0,0,0,0.3); /* fix hover feedback : use "inset" background to easily darken background */
196}
197.butActionNew:hover {
198 text-decoration: underline;
199 box-shadow: unset !important;
200}
201
202.butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete {
203 background: var(--butactiondeletebg) !important;
204 /* border: 1px solid #633; */
205 color: #633 !important;
206}
207.button.button-cancel:not(.buttongen), .button.button-cancel:link:not(.buttongen), .button.button-cancel:visited:not(.buttongen), .button.button-cancel:hover:not(.buttongen), .button.button-cancel:active:not(.buttongen), .button.button-cancel:not(.buttongen) {
208 background: var(--butactioncancelbg) !important;
209 border: none;
210 color: #333 !important;
211}
212
213.butActionDelete:hover {
214 box-shadow: 0px 0px 4px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
215}
216.button.button-cancel:hover:not(.buttongen) {
217 box-shadow: 0px 0px 4px 1px rgba(50, 50, 50, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
218}
219
220
221/*
222.butActionDelete#action-delete::before {
223 content: "\f1f8";
224 font-family: "<?php echo getDolGlobalString('MAIN_FONTAWESOME_FAMILY', 'Font Awesome 5 Free'); ?>";
225 font-weight: 600;
226 width: 20px;
227 visibility: visible;
228}
229.butActionDelete#action-delete span.textbutton {
230 display: none;
231}
232*/
233
234.butActionRefused {
235 /* pointer-events: none; Removed as this break the use of title */
236 cursor: default;
237 opacity: 0.8;
238 box-shadow: none;
239
240 text-decoration: none !important;
241 text-transform: uppercase;
242 font-weight: bold !important;
243
244 cursor: not-allowed !important;
245 font-family: <?php print $fontlist ?> !important;
246 display: inline-block;
247 text-align: center;
248 cursor: pointer;
249 box-sizing: border-box;
250 -moz-box-sizing: border-box;
251 -webkit-box-sizing: border-box;
252 color: #999 !important;
253
254 border: 1px solid #ccc;
255}
256.butActionNewRefused, .butActionNewRefused:link, .butActionNewRefused:visited, .butActionNewRefused:hover, .butActionNewRefused:active {
257 text-decoration: none !important;
258 text-transform: uppercase;
259 font-weight: normal !important;
260
261 white-space: nowrap !important;
262 cursor: not-allowed !important;
263 margin: 0em <?php echo($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em;
264 padding: 0.2em <?php echo($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em;
265 font-family: <?php print $fontlist ?> !important;
266 display: inline-block;
267 /* text-align: center; New button are on right of screen */
268 cursor: pointer;
269 color: #999 !important;
270 padding-top: 0.2em;
271 box-shadow: none !important;
272}
273
274.butActionTransparent {
275 color: #222 ! important;
276 background-color: transparent ! important;
277}
278
279.butActionLogin, .butActionLogin:link, .butActionLogin:visited, .butActionLogin:hover, .butActionLogin:active {
280 background-color: rgb(<?php echo $colorbackhmenu1; ?>);
281 padding: 1em 1em;
282}
283
284
285/*
286TITLE BUTTON
287 */
288
289.btnTitle, a.btnTitle {
290 display: inline-block;
291 padding: 6px;
292 font-weight: 400;
293 /* line-height: 1; */
294 text-align: center;
295 white-space: nowrap;
296 vertical-align: middle;
297 -ms-touch-action: manipulation;
298 touch-action: manipulation;
299 cursor: pointer;
300 -webkit-user-select: none;
301 -moz-user-select: none;
302 -ms-user-select: none;
303 user-select: none;
304 box-shadow: var(--btncolorbg);
305 text-decoration: none;
306 position: relative;
307 /* margin: 0 0 0 8px; */
308 min-width: 60px;
309 text-align: center;
310 color: var(--btncolortext);
311 font-size: 12px;
312 font-weight: 300;
313 /* background-color: var(--btncolorbg); */
314 border: 1px solid transparent;
315}
316
317a.btnTitle.btnTitleSelected {
318 border: 1px solid #ccc;
319 border-radius: 3px;
320}
321
322.btnTitle > .btnTitle-icon{
323
324}
325
326.btnTitle > .btnTitle-label{
327 color: #666666;
328}
329
330.btnTitle:hover, a.btnTitle:hover {
331 border: 1px solid #bbb;
332 border-radius: 3px;
333 position: relative;
334 text-align: center;
335 font-size: 12px;
336 text-decoration: none;
337 box-shadow: none;
338}
339/* The buttonplus is growing on hover (don't know why). This is to avoid to have the cell growing too */
340.btnTitlePlus:hover {
341 /* max-width: 24px; */ /* max width is a problem when the button has a text under */
342 max-height: 42px;
343}
344
345.btnTitle.refused, a.btnTitle.refused, .btnTitle.refused:hover, a.btnTitle.refused:hover {
346 color: #8a8a8a;
347 cursor: not-allowed;
348 background-color: #fbfbfb;
349 background: repeating-linear-gradient( 45deg, #ffffff, #f1f1f1 4px, #f1f1f1 4px, #f1f1f1 4px );
350}
351
352.btnTitle:hover .btnTitle-label {
353 color: var(--btncolorborderhover);
354}
355.btnTitle.reposition:not(.btnTitleSelected) {
356 background-color: unset;
357 border: 1px solid transparent;
358}
359
360.btnTitle.refused .btnTitle-label, .btnTitle.refused:hover .btnTitle-label {
361 color: #8a8a8a;
362}
363
364.btnTitle>.fa {
365 font-size: 2em;
366 display: block;
367}
368
369div.pagination li:first-child a.btnTitle, div.pagination li.paginationafterarrows a.btnTitle,
370table.table-fiche-title tr.toptitle td.col-center div.nowraponall a.btnTitle,
371table.table-fiche-title tr.titre td.col-center div.nowraponall a.btnTitle,
372table.table-fiche-title tr.toptitle td.col-right a.btnTitle,
373table.table-fiche-title tr.titre td.col-right a.btnTitle {
374 margin-<?php echo $left; ?>: 10px;
375}
376
377.button-title-separator{
378 display: inline-block;
379 clear: both;
380 width: 20px;
381}
382
383.imgforviewmode {
384 color: #aaa;
385}
386
387
388/* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */
389@media only screen and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC2') ? round($nbtopmenuentries * 69, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */
390{
391 .butAction, .butActionRefused, .butActionDelete {
392 font-size: 0.95em;
393 }
394}
395
396/* rule to reduce top menu - 3rd reduction: The menu for user is on left */
397@media only screen and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3') ? round($nbtopmenuentries * 47, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) /* reduction 3 */
398{
399 .butAction, .butActionRefused, .butActionDelete {
400 font-size: 0.9em;
401 }
402}
403
404/* smartphone */
405
406@media only screen and (max-width: 767px)
407{
408 .butAction, .butActionRefused, .butActionDelete {
409 font-size: 0.85em;
410 }
411
412 /* for small screen, we reduce the min with of button */
413 .btnTitle, a.btnTitle {
414 display: inline-block;
415 padding: 4px 4px 4px 4px;
416 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 */
417 }
418 .paginationafterarrows a.btnTitlePlus:hover span:before, .titre_right a.btnTitlePlus:hover span:before {
419 font-size: unset !important;
420 }
421}
422
423
424<?php if (getDolGlobalString('MAIN_BUTTON_HIDE_UNAUTHORIZED') && (!$user->admin)) { ?>
425.butActionRefused, .butActionNewRefused, .btnTitle.refused {
426 display: none !important;
427}
428<?php } ?>
429
430
431/*
432 * BTN LINK (used with <a/> tag in general but not with <button/>)
433 */
434
435.btn-link{
436 margin-right: 5px;
437 border: 1px solid #ddd;
438 color: #333;
439 padding: 5px 10px;
440 border-radius:1em;
441 text-decoration: none !important;
442}
443
444.btn-link:hover{
445 background-color: #ddd;
446 border: 1px solid #ddd;
447}
448
449
450/*
451 * BUTTON With Low emphasis
452 */
453
454button.btn-low-emphasis{
455 text-align: center;
456 display: inline-block;
457 border: none;
458 outline: none;
459 cursor: pointer;
460 margin: 0;
461 padding: 0;
462 width: auto;
463 min-width: 1.5em;
464 min-height: 1.5em;
465 line-height: 1.5em;
466
467 overflow: visible;
468 background: transparent;
469 background-position: center; /* used for hover ripple effect */
470 background-size: 0%;
471 color: var(--colortextlink, inherit);
472 font: inherit;
473 line-height: normal;
474
475 /* Corrects font smoothing for webkit */
476 -webkit-font-smoothing: inherit;
477 -moz-osx-font-smoothing: inherit;
478
479 /* Corrects inability to style clickable input types in iOS */
480 -webkit-appearance: none;
481
482
483 transition: background 0.8s;/* used for hover ripple effect */
484 background: transparent radial-gradient(circle, transparent 1%, hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1) 1%, transparent 10%) center/15000%;
485}
486
487button.btn-low-emphasis.--btn-icon{
488 border-radius: 100%;
489}
490
491button.btn-low-emphasis :is(.fa, .fas){
492 color: var(--colortextlink, inherit);
493 opacity: 0.4;
494}
495
496button.btn-low-emphasis:is(:focus,:hover) :is(.fa, .fas){
497 opacity: 0.8;
498}
499
500button.btn-low-emphasis.--btn-icon:active {
501 background-color: hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1);
502 background-size: 100%;
503 transition: background 0s;/* used for hover ripple effect */
504}
505
506
507input.button-save, input.button-cancel {
508 min-width: 110px;
509 margin-left: 8px !important;
510 margin-right: 8px !important;
511}
512
513/* smartphone */
514
515@media only screen and (max-width: 767px)
516{
517 input.button-save, input.button-cancel {
518 min-width: 90px;
519 margin-left: 4px !important;
520 margin-right: 4px !important;
521 }
522}
print $object position
Definition edit.php:206
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
editval_textarea active
$fontlist
Definition style.css.php:75
$conf db user
Active Directory does not allow anonymous connections.
Definition repair.php:141