NEW Show tags and status in search list of website pages

This commit is contained in:
Laurent Destailleur 2020-07-09 14:07:41 +02:00
parent b55b0e505f
commit e6b241a083
7 changed files with 47 additions and 96 deletions

View File

@ -809,9 +809,10 @@ function getSocialNetworkSharingLinks()
* @param string $sortorder Sort order ('DESC' or 'ASC')
* @param string $langcode Language code ('' or 'en', 'fr', 'es', ...)
* @param array $otherfilters Other filters
* @param int $status 0 or 1, or -1 for both
* @return string HTML content
*/
function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield = 'date_creation', $sortorder = 'DESC', $langcode = '', $otherfilters = 'null')
function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield = 'date_creation', $sortorder = 'DESC', $langcode = '', $otherfilters = 'null', $status = 1)
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
@ -852,7 +853,9 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
$sql .= ', '.MAIN_DB_PREFIX.'categorie_website_page as cwp';
}
$sql .= " WHERE wp.fk_website = ".$website->id;
$sql .= " AND wp.status = 1";
if ($status >= 0) {
$sql .= " AND wp.status = ".$status;
}
if ($langcode) {
$sql .= " AND wp.lang ='".$db->escape($langcode)."'";
}

View File

@ -485,6 +485,7 @@ Categories=Tags/categories
Category=Tag/category
By=By
From=From
FromDate=From
FromLocation=From
to=to
To=to

View File

@ -108,6 +108,7 @@ DisabledInMonoUserMode=Disabled in maintenance mode
UserAccountancyCode=User accounting code
UserLogoff=User logout
UserLogged=User logged
DateOfEmployment=Employment date
DateEmployment=Employment Start Date
DateEmploymentEnd=Employment End Date
CantDisableYourself=You can't disable your own user record

View File

@ -7,8 +7,10 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
--btncolorbg: #fbfbfb;
--btncolorborderhover: none;
--btncolorborder: #FFF;
--butactionbg:rgb(218, 235, 225);
--butactiondeletebg: rgb(234,228,225);
/* tertiary color */
--butactionbg:rgb(218, 235, 225);
/* --butactionbg:rgb(228, 218, 235); */
}
<?php

View File

@ -312,11 +312,6 @@ a.buttonticket {
/* height: 40px; */
}
/* Used by categories */
span.categorysquarre {
padding: 0 4px 0 4px;
}
/* Used by timesheets */
span.timesheetalreadyrecorded input {
border: none;
@ -703,7 +698,9 @@ body[class*="colorblind-"] .text-success{
.fa-toggle-on, .fa-toggle-off { font-size: 2em; }
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off,
.asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off {
.asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off,
.tdwebsitesearchresult .fa-toggle-on, .tdwebsitesearchresult .fa-toggle-off
{
font-size: 1.5em; vertical-align: text-bottom;
}

View File

@ -1085,73 +1085,6 @@ if ($action == 'create' || $action == 'adduserldap')
}
}
}
// // Skype
// if (! empty($conf->socialnetworks->enabled))
// {
// print '<tr><td>'.$langs->trans("Skype").'</td>';
// print '<td>';
// if (! empty($ldap_skype))
// {
// print '<input type="hidden" name="skype" value="'.$ldap_skype.'">';
// print $ldap_skype;
// }
// else
// {
// print '<input class="maxwidth200" type="text" name="skype" value="'.GETPOST('skype', 'alpha').'">';
// }
// print '</td></tr>';
// }
// // Twitter
// if (! empty($conf->socialnetworks->enabled))
// {
// print '<tr><td>'.$langs->trans("Twitter").'</td>';
// print '<td>';
// if (! empty($ldap_twitter))
// {
// print '<input type="hidden" name="twitter" value="'.$ldap_twitter.'">';
// print $ldap_twitter;
// }
// else
// {
// print '<input class="maxwidth200" type="text" name="twitter" value="'.GETPOST('twitter', 'alpha').'">';
// }
// print '</td></tr>';
// }
// // Facebook
// if (! empty($conf->socialnetworks->enabled))
// {
// print '<tr><td>'.$langs->trans("Facebook").'</td>';
// print '<td>';
// if (! empty($ldap_facebook))
// {
// print '<input type="hidden" name="facebook" value="'.$ldap_facebook.'">';
// print $ldap_facebook;
// }
// else
// {
// print '<input class="maxwidth200" type="text" name="facebook" value="'.GETPOST('facebook', 'alpha').'">';
// }
// print '</td></tr>';
// }
// // LinkedIn
// if (! empty($conf->socialnetworks->enabled))
// {
// print '<tr><td>'.$langs->trans("LinkedIn").'</td>';
// print '<td>';
// if (! empty($ldap_linkedin))
// {
// print '<input type="hidden" name="linkedin" value="'.$ldap_linkedin.'">';
// print $ldap_linkedin;
// }
// else
// {
// print '<input class="maxwidth200" type="text" name="linkedin" value="'.GETPOST('linkedin', 'alpha').'">';
// }
// print '</td></tr>';
// }
// Accountancy code
if ($conf->accounting->enabled)
@ -1661,16 +1594,22 @@ if ($action == 'create' || $action == 'adduserldap')
print "</tr>\n";
// Date employment
print '<tr><td>'.$langs->trans("DateEmployment").'</td>';
print '<tr><td>'.$langs->trans("DateOfEmployment").'</td>';
print '<td>';
print dol_print_date($object->dateemployment, 'day');
print '</td>';
print "</tr>\n";
if ($object->dateemployment) {
print '<span class="opacitymedium">'.$langs->trans("FromDate ").'</span>';
print dol_print_date($object->dateemployment, 'day');
}
//print '</td>';
//print "</tr>\n";
// Date employment
print '<tr><td>'.$langs->trans("DateEmploymentEnd").'</td>';
print '<td>';
print dol_print_date($object->dateemploymentend);
//print '<tr><td>'.$langs->trans("DateEmploymentEnd").'</td>';
//print '<td>';
if ($object->dateemploymentend) {
print '<span class="opacitymedium"> - '.$langs->trans("To ").'</span>';
print dol_print_date($object->dateemploymentend, 'day');
}
print '</td>';
print "</tr>\n";

View File

@ -288,7 +288,7 @@ if ($action == 'replacesiteconfirm') {
$otherfilters['category'] = GETPOST('optioncategory', 'int');
}
$listofpages = getPagesFromSearchCriterias($containertype, $algo, $searchkey, 1000, $sortfield, $sortorder, $langcode, $otherfilters);
$listofpages = getPagesFromSearchCriterias($containertype, $algo, $searchkey, 1000, $sortfield, $sortorder, $langcode, $otherfilters, -1);
}
$usercanedit = $user->rights->website->write;
@ -424,7 +424,7 @@ if ($massaction == 'setcategory' && GETPOST('confirmmassaction', 'alpha') && $us
$db->commit();
}
// Now we reload list
$listofpages = getPagesFromSearchCriterias($containertype, $algo, $searchkey, 1000, $sortfield, $sortorder, $langcode, $otherfilters);
$listofpages = getPagesFromSearchCriterias($containertype, $algo, $searchkey, 1000, $sortfield, $sortorder, $langcode, $otherfilters, -1);
}
// Replacement of string into pages
@ -3557,6 +3557,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
if ($action != 'createcontainer')
{
print '<!-- Status of page -->'."\n";
print '<tr><td>';
print $langs->trans('Status');
print '</td><td>';
@ -3829,7 +3830,6 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
print getTitleFieldOfList("Type", 0, $_SERVER['PHP_SELF'], 'type_container', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList("Page", 0, $_SERVER['PHP_SELF'], 'pageurl', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList("Categories", 0, $_SERVER['PHP_SELF']);
//print getTitleFieldOfList("Description", 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
@ -3859,7 +3859,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
print '<span class="opacitymedium">'.$answerrecord->description.'</span>';
print '</td>';
// Categories
// Categories - Tags
print '<td>';
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire))
{
@ -3868,7 +3868,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
if (is_array($existing)) {
foreach ($existing as $tmpcategory) {
//var_dump($tmpcategory);
print '<span class="categorysquarre marginrightonly" style="background-color: #'.($tmpcategory->color != '' ? $tmpcategory->color : '888').'" title="'.dol_escape_htmltag($langs->trans("Category").' '.$tmpcategory->label).'"></span>';
print img_object($langs->trans("Category").' : '.$tmpcategory->label, 'category', 'style="padding-left: 2px; padding-right: 2px; color: #'.($tmpcategory->color != '' ? $tmpcategory->color : '888').'"');
}
}
}
@ -3886,30 +3886,37 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
$param .= '&optioncategory='.GETPOST('optioncategory', 'aZ09');
$param .= '&searchstring='.urlencode($searchkey);
// Edit properties
// Language
print '<td>';
print $answerrecord->lang;
print '</td>';
// Edit properties, HTML sources, status
print '<td class="tdwebsitesearchresult right">';
$disabled = '';
$urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editmeta&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param);
if (empty($user->rights->website->write)) {
$disabled = ' disabled';
$urltoedithtmlsource = '';
}
print '<a class="editfielda '.$disabled.'" href="'.$urltoedithtmlsource.'" title="'.$langs->trans("EditPageMeta").'">'.img_picto($langs->trans("EditPageMeta"), 'pencil-ruler').'</a>';
print '</td>';
print '<a class="editfielda marginleftonly marginrightonly '.$disabled.'" href="'.$urltoedithtmlsource.'" title="'.$langs->trans("EditPageMeta").'">'.img_picto($langs->trans("EditPageMeta"), 'pencil-ruler').'</a>';
// Edit HTML source
print '<td>';
$disabled = '';
$urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editsource&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param);
if (empty($user->rights->website->write)) {
$disabled = ' disabled';
$urltoedithtmlsource = '';
}
print '<a class="editfielda '.$disabled.'" href="'.$urltoedithtmlsource.'" title="'.$langs->trans("EditHTMLSource").'">'.img_picto($langs->trans("EditHTMLSource"), 'edit').'</a>';
print '<a class="editfielda marginleftonly marginrightonly '.$disabled.'" href="'.$urltoedithtmlsource.'" title="'.$langs->trans("EditHTMLSource").'">'.img_picto($langs->trans("EditHTMLSource"), 'edit').'</a>';
print '<span class="marginleftonly marginrightonly"></span>'.ajax_object_onoff($answerrecord, 'status', 'status', 'Enabled', 'Disabled');
print '</td>';
// Action column
print '<td class="nowrap center">';
print '<!-- Status of page -->'."\n";
if ($massactionbutton || $massaction)
{
$selected = 0;
@ -3956,10 +3963,11 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editcss&website='.$website->ref.'&backtopage='.urlencode($backtopageurl).'">'.$langs->trans("EditCss").'</a>';
print '</td>';
// Language
print '<td>';
print '</td>';
print '<td class="tdoverflow100">';
print '<td>';
print '</td>';
// Action column
@ -3974,7 +3982,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
print '<br>';
}
else {
print $listofpages['message'];
print '<div class="warning">'.$listofpages['message'].'</div>';
}
print '</div>';