Add a card on each ecm section

This commit is contained in:
Laurent Destailleur 2008-04-28 21:56:42 +00:00
parent 9d43f5ff0e
commit 3062b49bbe
5 changed files with 101 additions and 44 deletions

View File

@ -17,15 +17,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/commande/document.php \file htdocs/commande/document.php
\ingroup facture \ingroup order
\brief Page de gestion des documents attachées à une facture \brief Page de gestion des documents attachees a une commande
\version $Revision$ \version $Id$
*/ */
require('./pre.inc.php'); require('./pre.inc.php');

View File

@ -28,6 +28,7 @@ require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/ecm/ecmdirectory.class.php"); require_once(DOL_DOCUMENT_ROOT."/ecm/ecmdirectory.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/ecm.lib.php");
// Load traductions files // Load traductions files
@ -65,6 +66,7 @@ if (! empty($_REQUEST["section"]))
exit; exit;
} }
} }
$upload_dir = $conf->ecm->dir_output.'/'.$ecmdir->label; $upload_dir = $conf->ecm->dir_output.'/'.$ecmdir->label;
@ -128,29 +130,6 @@ llxHeader();
$form=new Form($db); $form=new Form($db);
print_fiche_titre($langs->trans("ECMManualOrg"));
print '<br>';
$ecmdir->ref=$ecmdir->label;
print $langs->trans("ECMSection").': ';
print img_picto('','object_dir').' ';
print '<a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a>';
print ' -> <b>'.$ecmdir->getNomUrl(1).'</b>';
print "<br><br>";
//$head = societe_prepare_head($societe);
//dolibarr_fiche_head($head, 'document', $societe->nom);
/*
* Confirmation de la suppression d'une ligne produit
*/
if ($_GET['action'] == 'delete_file')
{
$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&amp;urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
print '<br>';
}
// Construit liste des fichiers // Construit liste des fichiers
clearstatcache(); clearstatcache();
@ -182,23 +161,63 @@ else
} }
/* $head = ecm_prepare_head($ecmdir);
dolibarr_fiche_head($head, 'card', $langs->trans("ECMManualOrg"));
print '<table class="border"width="100%">';
// Nbre fichiers
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
//Total taille
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '<table class="border" width="100%">';
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
$s='';
$tmpecmdir=$ecmdir;
$result = 1;
while ($tmpecmdir && $result > 0)
{
$tmpecmdir->ref=$tmpecmdir->label;
$s=' -> '.$tmpecmdir->getNomUrl(1).$s;
if ($tmpecmdir->fk_parent)
{
$result=$tmpecmdir->fetch($tmpecmdir->fk_parent);
}
else
{
$tmpecmdir=0;
}
}
print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a>';
print $s;
print '</td></tr>';
print '<tr><td>'.$langs->trans("Description").'</td><td>';
print dol_nl2br($ecmdir->description);
print '</td></tr>';
print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>';
$user=new User($db,$ecmdir->fk_user_c);
$user->fetch();
print $user->getNomUrl(1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
print dolibarr_print_date($ecmdir->date_c,'dayhour');
print '</td></tr>';
print '<tr><td>'.$langs->trans("ECMNbOfDocs").'</td><td>';
print sizeof($filearray);
print '</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>';
print $totalsize;
print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
*/
/*
* Confirmation de la suppression d'une ligne produit
*/
if ($_GET['action'] == 'delete_file')
{
$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&amp;urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
print '<br>';
}
if ($mesg) { print $mesg."<br>"; } if ($mesg) { print $mesg."<br>"; }
// Affiche formulaire upload // Affiche formulaire upload

View File

@ -216,10 +216,9 @@ class EcmDirectory // extends CommonObject
/* /*
* \brief Load object in memory from database * \brief Load object in memory from database
* \param id id object * \param id id object
* \param user User that load
* \return int <0 if KO, >0 if OK * \return int <0 if KO, >0 if OK
*/ */
function fetch($id, $user=0) function fetch($id)
{ {
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
@ -230,8 +229,8 @@ class EcmDirectory // extends CommonObject
$sql.= " t.cachenbofdoc,"; $sql.= " t.cachenbofdoc,";
$sql.= " t.fk_user_c,"; $sql.= " t.fk_user_c,";
$sql.= " t.fk_user_m,"; $sql.= " t.fk_user_m,";
$sql.= " ".$this->db->pdate('t.date_c').","; $sql.= " ".$this->db->pdate('t.date_c')." as date_c,";
$sql.= " ".$this->db->pdate('t.date_m').""; $sql.= " ".$this->db->pdate('t.date_m')." as date_m";
$sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t"; $sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t";
$sql.= " WHERE t.rowid = ".$id; $sql.= " WHERE t.rowid = ".$id;

View File

@ -41,11 +41,11 @@ function llxHeader($head = "", $title="", $help_url='')
$menu->add(DOL_URL_ROOT."/ecm/index.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("MenuECM"),0,$user->rights->ecm->read); $menu->add(DOL_URL_ROOT."/ecm/index.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("MenuECM"),0,$user->rights->ecm->read);
//$menu->add_submenu(DOL_URL_ROOT."/ecm/docdir.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("List"),1,$user->rights->ecm->read); //$menu->add_submenu(DOL_URL_ROOT."/ecm/docdir.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("List"),1,$user->rights->ecm->read);
$menu->add_submenu(DOL_URL_ROOT."/ecm/index.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("List"),1,$user->rights->ecm->read); $menu->add_submenu(DOL_URL_ROOT."/ecm/index.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("List"),1,$user->rights->ecm->read);
$menu->add_submenu(DOL_URL_ROOT."/ecm/index?mainmenu=ecm&action=create&idmenu=".$_SESSION["idmenu"], $langs->trans("ECMNewDocument"),1,$user->rights->ecm->create); //$menu->add_submenu(DOL_URL_ROOT."/ecm/index?mainmenu=ecm&action=create&idmenu=".$_SESSION["idmenu"], $langs->trans("ECMNewDocument"),1,$user->rights->ecm->create);
$menu->add_submenu(DOL_URL_ROOT."/ecm/docdir?mainmenu=ecm&action=create&idmenu=".$_SESSION["idmenu"], $langs->trans("ECMNewSection"),1,$user->rights->ecm->setup); $menu->add_submenu(DOL_URL_ROOT."/ecm/docdir?mainmenu=ecm&action=create&idmenu=".$_SESSION["idmenu"], $langs->trans("ECMNewSection"),1,$user->rights->ecm->setup);
/*
if ($conf->societe->enabled) $menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsThirdParties"),2); /* if ($conf->societe->enabled) $menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsThirdParties"),2);
if ($conf->contrat->enabled) $menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsContracts"),2); if ($conf->contrat->enabled) $menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsContracts"),2);
if ($conf->propal->enabled) $menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsProposals"),2); if ($conf->propal->enabled) $menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsProposals"),2);
if ($conf->commande->enabled) $menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsOrders"),2); if ($conf->commande->enabled) $menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsOrders"),2);

41
htdocs/lib/ecm.lib.php Normal file
View File

@ -0,0 +1,41 @@
<?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*/
/**
\file htdocs/lib/ecm.lib.php
\brief Ensemble de fonctions de base pour le module ecm
\ingroup ecm
\version $Id$
*/
function ecm_prepare_head($obj)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/ecm/docmine.php?section='.$obj->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
return $head;
}
?>