forked from Wavyzz/dolibarr
apply appli btn to more elements
This commit is contained in:
@@ -151,9 +151,7 @@ if ($object->id > 0)
|
|||||||
$newcardbutton = '';
|
$newcardbutton = '';
|
||||||
if (! empty($conf->agenda->enabled))
|
if (! empty($conf->agenda->enabled))
|
||||||
{
|
{
|
||||||
$newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span>';
|
$newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
|
||||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
|
||||||
$newcardbutton.= '</a>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||||
|
|||||||
@@ -321,9 +321,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|||||||
$newcardbutton='';
|
$newcardbutton='';
|
||||||
//if ($user->rights->emailcollector->creer)
|
//if ($user->rights->emailcollector->creer)
|
||||||
//{
|
//{
|
||||||
$newcardbutton='<a class="butActionNew" href="emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
|
$newcardbutton.= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']));
|
||||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
|
||||||
$newcardbutton.= '</a>';
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
|
||||||
|
|||||||
@@ -82,12 +82,8 @@ $userstatic=new User($db);
|
|||||||
llxHeader('', $langs->trans("ListOfBookmarks"));
|
llxHeader('', $langs->trans("ListOfBookmarks"));
|
||||||
|
|
||||||
$newcardbutton='';
|
$newcardbutton='';
|
||||||
if ($user->rights->bookmark->creer)
|
$newcardbutton.= dolGetButtonTitle($langs->trans('NewBookmark'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer));
|
||||||
{
|
|
||||||
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewBookmark').'</span>';
|
|
||||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
|
||||||
$newcardbutton.= '</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton);
|
print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton);
|
||||||
|
|
||||||
|
|||||||
@@ -65,9 +65,7 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css')
|
|||||||
|
|
||||||
llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
|
llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
|
||||||
|
|
||||||
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewCategory").'</span>';
|
$newcardbutton.= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type));
|
||||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
|
||||||
$newcardbutton.= '</a>';
|
|
||||||
|
|
||||||
print load_fiche_titre($title, $newcardbutton);
|
print load_fiche_titre($title, $newcardbutton);
|
||||||
|
|
||||||
|
|||||||
@@ -8146,16 +8146,26 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
|
|||||||
* @param string $iconClass class for icon element
|
* @param string $iconClass class for icon element
|
||||||
* @param string $url the url for link
|
* @param string $url the url for link
|
||||||
* @param string $id attribute id of button
|
* @param string $id attribute id of button
|
||||||
* @param int $status 0 no user rights, 1 active, -1 Feature Disabled
|
* @param int $status 0 no user rights, 1 active, -1 Feature Disabled, -2 disable Other reason use helpText as tooltip
|
||||||
* @param array $params various params for future : recommended rather than adding more function arguments
|
* @param array $params various params for future : recommended rather than adding more function arguments
|
||||||
* @return string html button
|
* @return string html button
|
||||||
*/
|
*/
|
||||||
function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array())
|
function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array())
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs, $conf, $user;
|
||||||
|
|
||||||
|
// Actually this conf is used in css too for external module compatibility and smooth transition to this function
|
||||||
|
if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin) && $status <= 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$class = 'title-button' ;
|
$class = 'title-button' ;
|
||||||
|
|
||||||
|
// hidden conf keep during button transition TODO: remove this block
|
||||||
|
if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){
|
||||||
|
$class = 'butActionNew';
|
||||||
|
}
|
||||||
|
|
||||||
$attr=array(
|
$attr=array(
|
||||||
'class' => $class
|
'class' => $class
|
||||||
,'href' => empty($url)?'':$url
|
,'href' => empty($url)?'':$url
|
||||||
@@ -8165,15 +8175,22 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
|
|||||||
$attr['title'] = dol_escape_htmltag($helpText);
|
$attr['title'] = dol_escape_htmltag($helpText);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($status)){
|
if($status <= 0){
|
||||||
$attr['class'] .= ' title-button-refused';
|
$attr['class'] .= ' title-button-refused';
|
||||||
$attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions"));
|
|
||||||
$attr['href'] = '';
|
// hidden conf keep during button transition TODO: remove this block
|
||||||
}
|
if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){
|
||||||
elseif($status < 0){
|
$attr['class'] = 'butActionRefused';
|
||||||
$attr['class'] .= ' title-button-refused';
|
}
|
||||||
$attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("FeatureDisabled"));
|
|
||||||
$attr['href'] = '';
|
$attr['href'] = '';
|
||||||
|
|
||||||
|
if($status == -1){ // Not enough permissions
|
||||||
|
$attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("FeatureDisabled"));
|
||||||
|
}
|
||||||
|
elseif($status == 0){ // disable
|
||||||
|
$attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($attr['title'])){
|
if(!empty($attr['title'])){
|
||||||
@@ -8223,5 +8240,12 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
|
|||||||
$button.= '<span class="valignmiddle text-plus-circle title-button-label">'.$label.'</span>';
|
$button.= '<span class="valignmiddle text-plus-circle title-button-label">'.$label.'</span>';
|
||||||
$button.= '</'.$tag.'>';
|
$button.= '</'.$tag.'>';
|
||||||
|
|
||||||
|
// hidden conf keep during button transition TODO: remove this block
|
||||||
|
if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){
|
||||||
|
$button='<'.$tag.' '.$compiledAttributes.' ><span class="text-plus-circle">'.$label.'</span>';
|
||||||
|
$button.= '<span class="'.$iconClass.' valignmiddle"></span>';
|
||||||
|
$button.= '</'.$tag.'>';
|
||||||
|
}
|
||||||
|
|
||||||
return $button;
|
return $button;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ if (count($import->array_import_code))
|
|||||||
{
|
{
|
||||||
//if ($user->rights->import->run)
|
//if ($user->rights->import->run)
|
||||||
//{
|
//{
|
||||||
print '<a class="butActionNew" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewImport").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
print dolGetButtonTitle($langs->trans('NewImport'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/imports/import.php?leftmenu=import');
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
|
|||||||
@@ -174,14 +174,8 @@ if ($id > 0 || $ref)
|
|||||||
$morehtmlcenter='';
|
$morehtmlcenter='';
|
||||||
if (! empty($conf->agenda->enabled))
|
if (! empty($conf->agenda->enabled))
|
||||||
{
|
{
|
||||||
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
|
$linktocreatetimeBtnStatus = ! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create);
|
||||||
{
|
$morehtmlcenter = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', $linktocreatetimeBtnStatus);
|
||||||
$morehtmlcenter.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$morehtmlcenter.='<a class="butActionNewRefused" href="#"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||||
|
|||||||
@@ -578,31 +578,35 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Link to create time
|
// Link to create time
|
||||||
|
$linktocreatetimeBtnStatus = 0;
|
||||||
|
$linktocreatetimeUrl = '';
|
||||||
|
$linktocreatetimeHelpText = '';
|
||||||
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
|
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
|
||||||
{
|
{
|
||||||
if ($projectstatic->public || $userWrite > 0)
|
if ($projectstatic->public || $userWrite > 0)
|
||||||
{
|
{
|
||||||
|
$linktocreatetimeBtnStatus = 1;
|
||||||
|
|
||||||
if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project
|
if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project
|
||||||
{
|
{
|
||||||
$backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':'');
|
$backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':'');
|
||||||
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?'.($withproject?'withproject=1':'').'&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('AddTimeSpent').'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
$linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject?'withproject=1':'').'&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl);
|
||||||
}
|
}
|
||||||
else // We are on tab 'Time Spent' of task
|
else // We are on tab 'Time Spent' of task
|
||||||
{
|
{
|
||||||
$backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':'');
|
$backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':'');
|
||||||
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?'.($withproject?'withproject=1':'').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('AddTimeSpent').'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
$linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject?'withproject=1':'').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$linktocreatetime = '<a class="butActionNewRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'"><span class="valignmiddle text-plus-circle">'.$langs->trans('AddTime').'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
$linktocreatetimeBtnStatus = -2;
|
||||||
|
$linktocreatetimeHelpText = $langs->trans("NotOwnerOfProject");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
$linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus);
|
||||||
$linktocreatetime = '<a class="butActionNewRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'"><span class="valignmiddle text-plus-circle">'.$langs->trans('AddTime').'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$massactionbutton = '';
|
$massactionbutton = '';
|
||||||
if ($projectstatic->bill_time)
|
if ($projectstatic->bill_time)
|
||||||
|
|||||||
@@ -1090,7 +1090,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
|||||||
// List of bank accounts
|
// List of bank accounts
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$morehtmlright='<a class="butActionNew" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("Add").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
$morehtmlright= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create');
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, '');
|
print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, '');
|
||||||
|
|
||||||
|
|||||||
@@ -134,13 +134,10 @@ a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-ci
|
|||||||
background-color: transparent ! important;
|
background-color: transparent ! important;
|
||||||
}
|
}
|
||||||
|
|
||||||
<?php if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin)) { ?>
|
|
||||||
.butActionRefused, .butActionNewRefused {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
TITLE BUTTON
|
||||||
|
*/
|
||||||
|
|
||||||
.title-button, a.title-button {
|
.title-button, a.title-button {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -195,27 +192,28 @@ a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-ci
|
|||||||
color: #8a8a8a;
|
color: #8a8a8a;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
background-color: #fbfbfb;
|
background-color: #fbfbfb;
|
||||||
background: repeating-linear-gradient(
|
background: repeating-linear-gradient( 45deg, #ffffff, #f1f1f1 4px, #f1f1f1 4px, #f1f1f1 4px );
|
||||||
45deg,
|
|
||||||
#ffffff,
|
|
||||||
#f1f1f1 4px,
|
|
||||||
#f1f1f1 4px,
|
|
||||||
#f1f1f1 4px
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.title-button:hover .title-button-label{
|
.title-button:hover .title-button-label{
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-button.title-button-refused .title-button-label, .title-button.title-button-refused:hover .title-button-label{
|
.title-button.title-button-refused .title-button-label, .title-button.title-button-refused:hover .title-button-label{
|
||||||
color: #8a8a8a;
|
color: #8a8a8a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.title-button>.fa {
|
.title-button>.fa {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin)) { ?>
|
||||||
|
.butActionRefused, .butActionNewRefused, .title-button.title-button-refused {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
<?php } ?>
|
||||||
@@ -449,12 +449,8 @@ if ($socid) print '<input type="hidden" name="socid" value="' . $socid . '"
|
|||||||
if ($projectid) print '<input type="hidden" name="projectid" value="' . $projectid . '" >';
|
if ($projectid) print '<input type="hidden" name="projectid" value="' . $projectid . '" >';
|
||||||
|
|
||||||
$newcardbutton='';
|
$newcardbutton='';
|
||||||
if ($user->rights->ticket->write)
|
$newcardbutton.= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/ticket/card.php?action=create' . ($socid ? '&socid=' . $socid : '') . ($projectid ? '&origin=projet_project&originid=' . $projectid : ''), '', !empty($user->rights->ticket->write));
|
||||||
{
|
|
||||||
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/ticket/card.php?action=create' . ($socid ? '&socid=' . $socid : '') . ($projectid ? '&origin=projet_project&originid=' . $projectid : '') . '"><span class="valignmiddle text-plus-circle">' . $langs->trans('NewTicket').'</span>';
|
|
||||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
|
||||||
$newcardbutton.= '</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_ticket', 0, $newcardbutton, '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_ticket', 0, $newcardbutton, '', $limit);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user