Minor enhancement in GED module

This commit is contained in:
Laurent Destailleur 2010-08-11 22:22:17 +00:00
parent 3e205a2552
commit 5439973b1e
2 changed files with 51 additions and 28 deletions

View File

@ -48,7 +48,7 @@ class FormFile
/**
* \brief Show file add form
* \param url Url
* \param title Title zone
* \param title Title zone (Title or '' or 'none')
* \param addcancel 1=Add 'Cancel' button
* \param sectionid If upload must be done inside a particular ECM section
* \param perm Value of permission to allow upload
@ -58,10 +58,12 @@ class FormFile
{
global $conf,$langs;
$maxlength=62;
print "\n\n<!-- Start form attach new file -->\n";
if (! $title) $title=$langs->trans("AttachANewFile");
print_titre($title);
if (empty($title)) $title=$langs->trans("AttachANewFile");
if ($title != 'none') print_titre($title);
print '<form name="userfile" action="'.$url.'" enctype="multipart/form-data" method="POST">';
print '<input type="hidden" name="section" value="'.$sectionid.'">';
@ -81,7 +83,7 @@ class FormFile
{
print '<input type="hidden" name="max_file_size" value="'.($max*1024).'">';
}
print '<input class="flat" type="file" name="userfile" size="70"';
print '<input class="flat" type="file" name="userfile" size="'.$maxlength.'"';
print (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="true"':'');
print '>';
print ' &nbsp; ';

View File

@ -231,7 +231,10 @@ $head = ecm_prepare_head_fm($fac);
dol_fiche_head($head, 'file_manager', '', 1);
print '<table class="border" width="100%"><tr><td width="40%" valign="top" style="background: #FFFFFF">';
print '<table class="border" width="100%">';
print '<tr>';
print '<td width="40%" valign="top" style="background: #FFFFFF" rowspan="2">';
// Left area
@ -251,14 +254,34 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
// Construit liste des repertoires
print '<table width="100%" class="nobordernopadding">';
//print '<tr class="liste_titre" style="height: 30px !important">';
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">'.$langs->trans("ECMSections").'</td>';
print '<td class="liste_titre" colspan="5" align="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=refreshmanual'.($section?'&amp;section='.$section:'').'">'.img_picto($langs->trans("Refresh"),'refresh').'</a>';
print '</td>';
print '<tr class="liste_titre" style="height: 24px !important">';
print '<td class="liste_titre" align="left" colspan="6">';
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action))
{
if ($user->rights->ecm->setup)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create">'.$langs->trans('ECMAddSection').'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
}
}
//print '</td>';
//print '<td class="liste_titre" colspan="5" align="right">';
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=refreshmanual'.($section?'&amp;section='.$section:'').'">'.img_picto($langs->trans("Refresh"),'refresh').'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=refreshmanual'.($section?'&amp;section='.$section:'').'">'.$langs->trans('Refresh').'</a>';
print '</td>';
print '</tr>';
print '<tr class="liste_titre"';
print '<td class="liste_titre" align="left" colspan="6">';
print '&nbsp;'.$langs->trans("ECMSections");
print '</td></tr>';
$showonrightsize='';
if (sizeof($sectionauto))
{
// Root title line (Automatic section)
@ -354,7 +377,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
}
else
{
print '<tr><td colspan="6">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
$showonrightsize='featurenotyetavailable';
}
}
@ -572,15 +595,22 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
// ----- End of section -----
// --------------------------
print "</table>";
// Fin de zone Ajax
}
print '</td><td valign="top" style="background: #FFFFFF">';
print '<table width="100%" class="nobordernopadding">';
print '<tr class="liste_titre" style="height: 24px !important"><td>';
//print $langs->trans("Filter").': ';
print '</td></tr>';
print '</table>';
// Right area
$relativepath=$ecmdir->getRelativePath();
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
@ -588,7 +618,7 @@ $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolowe
$formfile=new FormFile($db);
$param='&amp;section='.$section;
$textifempty=($section?$langs->trans("NoFileFound"):$langs->trans("ECMSelectASection"));
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
$formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,40);
// print '<table width="100%" class="border">';
@ -601,22 +631,13 @@ print '</td></tr>';
// Actions buttons
print '<tr height="22"><td align="center">';
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action))
{
if ($user->rights->ecm->setup)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create">'.$langs->trans('ECMAddSection').'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
}
}
print '</td><td>';
print '<tr height="22">';
//print '<td align="center">';
//print '</td>';
print '<td>';
if (! empty($section))
{
$formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php','',0,$section,$user->rights->ecm->upload);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php','none',0,$section,$user->rights->ecm->upload);
}
else print '&nbsp;';
print '</td></tr>';