This commit is contained in:
Laurent Destailleur 2017-11-11 14:20:08 +01:00
parent d938a56282
commit 01a41237bf
12 changed files with 94 additions and 54 deletions

View File

@ -231,6 +231,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
$nblines=count($contents);
$out.= "\n<!-- Box ".get_class($this)." start -->\n";
//$out.= '<div class="div-table-responsive-no-min">'; // Does not work on home page. TODO Try to fix this.
$out.= '<div class="box" id="boxto_'.$this->box_id.'">'."\n";
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
@ -360,6 +361,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) $out.= "<br>\n";
$out.= "</div>\n";
//$out.= "</div>\n";
$out.= "<!-- Box ".get_class($this)." end -->\n\n";
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
dol_filecache($cachedir, $filename, $out);

View File

@ -689,18 +689,19 @@ class Form
if (empty($row['favorite']) && $atleastonefavorite)
{
$atleastonefavorite=0;
$out.= '<option value="" disabled class="selectoptiondisabledwhite">----------------------</option>';
$out.= '<option a value="" disabled class="selectoptiondisabledwhite">----------------------</option>';
}
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) )
{
$foundselected=true;
$out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'" selected>';
$out.= '<option b value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'" selected>';
}
else
{
$out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'">';
$out.= '<option c value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'">';
}
$out.= dol_trunc($row['label'],$maxlength,'middle');
if ($row['label']) $out.= dol_trunc($row['label'],$maxlength,'middle');
else $out.= '&nbsp;';
if ($row['code_iso']) $out.= ' ('.$row['code_iso'] . ')';
$out.= '</option>';
}
@ -5508,7 +5509,7 @@ class Form
cache: true
},
language: select2arrayoflanguage,
containerCssClass: \':all:\', /* Line to add class or origin SELECT propagated to the new <span class="select2-selection...> tag */
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
placeholder: "'.dol_escape_js($placeholder).'",
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: '.$minimumInputLength.',

View File

@ -393,8 +393,10 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
{
global $conf;
if (! empty($conf->browser->phone)) return ''; // select2 disabled for smartphones with standard browser (does not works, popup appears outside screen)
//if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile.
// select2 disabled for smartphones with standard browser.
// TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array)
if (! empty($conf->browser->phone)) return '';
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
if (empty($conf->use_javascript_ajax)) return '';
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return '';
@ -405,19 +407,15 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
$msg="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
<script type="text/javascript">
$(document).ready(function () {
var query = {};
$(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({
dir: \'ltr\',
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
minimumInputLength: '.$minLengthToAutocomplete.',
language: select2arrayoflanguage,
containerCssClass: \':all:\', /* Line to add class or origin SELECT propagated to the new <span class="select2-selection...> tag */
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
templateResult: function (data, container) { /* Format visible output into combo list */
/* Code to add class of origin OPTION propagated to the new select2 <li> tag */
if (data.element) {
$(container).addClass($(data.element).attr("class"));
}
if (data.element) { $(container).addClass($(data.element).attr("class")); }
//console.log(data.html);
if ($(data.element).attr("html") != undefined) return htmlEntityDecodeJs($(data.element).attr("html")); // If property html set, we decode html entities and use this
return data.text;

View File

@ -55,7 +55,7 @@ function dol_basename($pathfile)
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...)
* @see dol_dir_list_indatabase
*/
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="")
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="")
{
global $db, $hookmanager;
global $object;

View File

@ -45,26 +45,36 @@ class FormEcm
/**
* Retourne la liste des categories du type choisi
* Return list of sections
*
* @param int $selected Id categorie preselectionnee
* @param string $select_name Nom formulaire HTML
* @param int $selected Id of preselected section
* @param string $select_name Name of HTML select component
* @param string $module Module ('ecm', 'medias', ...)
* @return string String with HTML select
*/
function select_all_sections($selected=0,$select_name='')
function select_all_sections($selected=0, $select_name='', $module='ecm')
{
global $langs;
global $conf, $langs;
$langs->load("ecm");
if ($select_name=="") $select_name="catParent";
if ($select_name=='') $select_name="catParent";
$cat = new EcmDirectory($this->db);
$cate_arbo = $cat->get_full_arbo();
if ($module == 'ecm')
{
$cat = new EcmDirectory($this->db);
$cate_arbo = $cat->get_full_arbo();
}
if ($module == 'medias')
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$path = $conf->medias->multidir_output[$conf->entity];
$cate_arbo = dol_dir_list($path, 'directories', 1, '', array('(\.meta|_preview.*\.png)$','^\.'), 'relativename', SORT_ASC);
}
$output = '<select class="flat" name="'.$select_name.'">';
$output = '<select class="flat minwidth100 maxwidth500" id="'.$select_name.'" name="'.$select_name.'">';
if (is_array($cate_arbo))
{
if (! count($cate_arbo)) $output.= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
if (! count($cate_arbo)) $output.= '<option value="-1" disabled>'.$langs->trans("NoDirectoriesFound").'</option>';
else
{
$output.= '<option value="-1">&nbsp;</option>';
@ -78,11 +88,12 @@ class FormEcm
{
$add = '';
}
$output.= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'">'.$cate_arbo[$key]['fulllabel'].'</option>';
$output.= '<option '.$add.'value="'.dol_escape_htmltag(empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id']).'">'.(empty($cate_arbo[$key]['fulllabel']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['fulllabel']).'</option>';
}
}
}
$output.= '</select>';
$output.=ajax_combobox($select_name);
$output.= "\n";
return $output;
}

View File

@ -48,6 +48,10 @@ $cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$confirm=GETPOST('confirm','alpha');
$module = GETPOST('module', 'alpha');
$website = GETPOST('website', 'alpha');
$pageid = GETPOST('pageid', 'int');
// Security check
if ($user->societe_id > 0)
{
@ -55,9 +59,17 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
$section=$urlsection=GETPOST('section');
$section=$urlsection=GETPOST('section','alpha');
if (empty($urlsection)) $urlsection='misc';
$upload_dir = $conf->ecm->dir_output.'/'.$urlsection;
if ($module == 'ecm')
{
$upload_dir = $conf->ecm->dir_output.'/'.$urlsection;
}
if ($module == 'medias')
{
$upload_dir = $conf->medias->multidir_output[$conf->entity];
}
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@ -162,6 +174,8 @@ if ($action == 'create')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($website) print '<input type="hidden" name="website" value="'.$website.'">';
if ($pageid) print '<input type="hidden" name="pageid" value="'.$pageid.'">';
$title=$langs->trans("ECMNewSection");
print load_fiche_titre($title);
@ -171,18 +185,21 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Label
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" maxlength="32" value="'.$ecmdir->label.'"></td></tr>'."\n";
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth100" maxlength="32" value="'.$ecmdir->label.'"></td></tr>'."\n";
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
print $formecm->select_all_sections(! empty($_GET["catParent"])?$_GET["catParent"]:$ecmdir->fk_parent,'catParent');
print $formecm->select_all_sections(! empty($_GET["catParent"]) ? $_GET["catParent"] : $ecmdir->fk_parent, 'catParent', $module);
print '</td></tr>'."\n";
// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
print '<textarea name="desc" rows="4" cols="90">';
print $ecmdir->description;
print '</textarea>';
print '</td></tr>'."\n";
if ($module == 'ecm')
{
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
print '<textarea name="desc" rows="4" class="quatrevingtpercent">';
print $ecmdir->description;
print '</textarea>';
print '</td></tr>'."\n";
}
print '</table>';

View File

@ -23,8 +23,25 @@
<!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
<?php
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
if (empty($module)) $module='ecm';
$permtoadd = 0;
$permtoupload = 1;
if ($module == 'ecm')
{
$permtoadd = $user->rights->ecm->setup;
$permtoupload = $user->rights->ecm->upload;
}
if ($module == 'medias')
{
$permtoadd = ($user->rights->mailing->creer || $user->rights->website->setup);
$permtoupload = ($user->rights->mailing->creer || $user->rights->website->setup);
}
// Confirm remove file (for non javascript users)
if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->use_javascript_ajax))
@ -45,13 +62,10 @@ print '<div class="inline-block toolbarbutton centpercent">';
// Toolbar
//if (preg_match('/\/ecm/', $_SERVER['PHP_SELF'])) {
//if ($module == 'ecm') {
$permtoadd = 0;
if ($module == 'ecm') $permtoadd = $user->rights->ecm->setup;
if ($module == 'medias') $permtoadd = ($user->rights->ecm->setup || $user->rights->website->setup);
if ($permtoadd)
{
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create&module='.urlencode($module).'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$website.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create&module='.urlencode($module).($website?'&website='.$website:'').($pageid?'&pageid='.$pageid:'').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$website.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>';
}
@ -91,7 +105,7 @@ if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABL
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$formfile=new FormFile($db);
$formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, $nameforformuserfile);
$formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile);
}
else print '&nbsp;';
@ -147,8 +161,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
{
print '<tr><td colspan="6" style="padding-left: 20px">';
if (empty($module)) $module='ecm';
$_POST['modulepart'] = $module;
$_POST['openeddir'] = GETPOST('openeddir');
$_POST['dir'] = empty($_POST['dir'])?'/':$_POST['dir'];

View File

@ -45,4 +45,5 @@ DirNotSynchronizedSyncFirst=This directory seems to be created or modified outsi
ReSyncListOfDir=Resync list of directories
HashOfFileContent=Hash of file content
FileNotYetIndexedInDatabase=File not yet indexed into database (try to re-upload it)
FileSharedViaALink=File shared via a link
FileSharedViaALink=File shared via a link
NoDirectoriesFound=No directories found

View File

@ -722,7 +722,7 @@ if ($source == 'order')
if ($directdownloadlink)
{
print '<br><a href="'.$directdownloadlink.'">';
print img_mime($order->last_main_doc,'').' ';
print img_mime($order->last_main_doc,'');
print $langs->trans("DownloadDocument").'</a>';
}
print '</td></tr>'."\n";
@ -840,7 +840,7 @@ if ($source == 'invoice')
if ($directdownloadlink)
{
print '<br><a href="'.$directdownloadlink.'">';
print img_mime($invoice->last_main_doc,'').' ';
print img_mime($invoice->last_main_doc,'');
print $langs->trans("DownloadDocument").'</a>';
}
print '</td></tr>'."\n";
@ -1029,7 +1029,7 @@ if ($source == 'contractline')
if ($directdownloadlink)
{
print '<br><a href="'.$directdownloadlink.'">';
print img_mime($invoice->last_main_doc,'').' ';
print img_mime($contract->last_main_doc,'');
print $langs->trans("DownloadDocument").'</a>';
}
print '</td></tr>'."\n";

View File

@ -550,7 +550,6 @@ if ($search_idprof4 != '') $param.= '&search_idprof4='.urlencode($search_idprof4
if ($search_idprof5 != '') $param.= '&search_idprof5='.urlencode($search_idprof5);
if ($search_idprof6 != '') $param.= '&search_idprof6='.urlencode($search_idprof6);
if ($search_vat != '') $param.= '&search_vat='.urlencode($search_vat);
if ($search_country != '') $param.='&search_country='.urlencode($search_country);
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
@ -631,7 +630,7 @@ if (empty($type) || $type == 'c' || $type == 'p')
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter.=$formother->select_categories('customer',$search_categ_cus,'search_categ_cus',1);
$moreforfilter.=$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort'));
$moreforfilter.='</div>';
}
}

View File

@ -285,7 +285,6 @@ input, input.flat, form.flat select, select, select.flat, .dataTables_length lab
?>
}
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {
font-size: <?php print $fontsize ?>px;
font-family: <?php print $fontlist ?>;
outline: none;
margin: 0px 0px 0px 0px;
@ -348,7 +347,7 @@ input.buttongen {
vertical-align: middle;
}
input.buttonpayment {
min-width: 290px;
min-width: 300px;
margin-bottom: 15px;
background-image: none;
line-height: 24px;
@ -403,6 +402,7 @@ td.actionbuttons a {
}
select.flat, form.flat select {
font-weight: normal;
height: 2.1em;
}
.optionblue {
color: rgb(<?php echo $colortextlink; ?>);
@ -672,10 +672,9 @@ div.myavailability {
padding-bottom: 10px;
}
.checkallactions {
/* vertical-align: text-bottom;
margin-top: 6px; */
margin-left: 2px; /* left must be same than right to keep checkbox centered */
margin-right: 2px; /* left must be same than right to keep checkbox centered */
vertical-align: middle;
}
.selectlimit, .marginrightonly {
margin-right: 10px !important;

View File

@ -345,7 +345,7 @@ input.buttongen {
vertical-align: middle;
}
input.buttonpayment {
min-width: 290px;
min-width: 300px;
margin-bottom: 15px;
background-image: none;
line-height: 24px;
@ -410,6 +410,7 @@ td.actionbuttons a {
}
select.flat, form.flat select {
font-weight: normal;
height: 2.1em;
}
.optionblue {
color: rgb(<?php echo $colortextlink; ?>);
@ -678,10 +679,9 @@ div.myavailability {
padding-bottom: 10px;
}
.checkallactions {
/*vertical-align: text-bottom;
margin-top: 6px;*/
margin-left: 2px; /* left must be same than right to keep checkbox centered */
margin-right: 2px; /* left must be same than right to keep checkbox centered */
vertical-align: middle;
}
.selectlimit, .marginrightonly {
margin-right: 10px !important;