Enhancement in bookmark module

This commit is contained in:
Laurent Destailleur 2009-01-23 16:44:12 +00:00
parent 23d715f8ac
commit d61219feed
9 changed files with 117 additions and 203 deletions

View File

@ -36,6 +36,9 @@ http://www.fsf.org/licensing/licenses/index_html
Copyright
---------
Copyright (C) 2009
- Laurent Destailleur <eldy@users.sourceforge.net>
Copyright (C) 2008
- Laurent Destailleur <eldy@users.sourceforge.net>
- Regis Houssin <regis@dolibarr.fr>

View File

@ -1,190 +0,0 @@
diff -Naur --exclude=add.png --exclude=html.formactions.class.php --exclude=paiement.php --exclude=CVS --exclude=synchro_dev.sh --exclude=recup_cvs.sh --exclude=patch.sh --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents /var/www/html/dolibarr/htdocs/bookmarks/fonctions.inc.php /var/www/html/dolibarr_dev/htdocs/bookmarks/fonctions.inc.php
--- /var/www/html/dolibarr/htdocs/bookmarks/fonctions.inc.php 1970-01-01 01:00:00.000000000 +0100
+++ /var/www/html/dolibarr_dev/htdocs/bookmarks/fonctions.inc.php 2009-01-21 22:41:44.000000000 +0100
@@ -0,0 +1,51 @@
+<?php
+
+ function printBookmarksList ($aDb, $aLangs) {
+ $db = $aDb;
+ $langs = $aLangs;
+
+ require_once(DOL_DOCUMENT_ROOT."/bookmarks/bookmark.class.php");
+
+ $bookm = new Bookmark($db);
+
+ $langs->load("bookmarks");
+
+ $ret = '';
+ $ret .= '<div class="blockvmenupair">';
+
+ $ret .= '<div class="menu_titre">';
+ $ret .= '<a class="vsmenu" href="'.DOL_URL_ROOT.'/bookmarks/liste.php">'.$langs->trans('Bookm').'</a>';
+ $ret .= '<a class="vsmenu"" href="'.DOL_URL_ROOT.'/bookmarks/fiche.php?action=create"><img style="border: none; position: relative;" src="'.DOL_URL_ROOT.'/bookmarks/add.png" alt="'.$langs->trans('NewBookmark').'" title="'.$langs->trans('NewBookmark').'" /></a>';
+ $ret .= '</div>';
+
+ $ret .= '<div class="menu_contenu">';
+
+ $sql = "
+ SELECT rowid FROM ".MAIN_DB_PREFIX."bookmark
+ WHERE true
+ ;";
+
+ if ( $resql = $db->query($sql) ) {
+
+ while ( $obj = $db->fetch_object($resql) ) {
+
+ $bookm->fetch($obj->rowid);
+
+ $ret .='<a class="vsmenu" title="'.$bookm->title.'" href="'.$bookm->url.'">'.dolibarr_trunc($bookm->title, 30).'</a><br />';
+
+ }
+
+ } else {
+
+ dolibarr_print_error($db);
+
+ }
+
+ $ret .= '</div>';
+
+ $ret .= '<div class="menu_fin"></div></div>';
+
+ return $ret;
+ }
+
+?>
\ Pas de fin de ligne à la fin du fichier.
diff -Naur --exclude=add.png --exclude=html.formactions.class.php --exclude=paiement.php --exclude=CVS --exclude=synchro_dev.sh --exclude=recup_cvs.sh --exclude=patch.sh --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents /var/www/html/dolibarr/htdocs/langs/fr_FR/bookmarks.lang /var/www/html/dolibarr_dev/htdocs/langs/fr_FR/bookmarks.lang
--- /var/www/html/dolibarr/htdocs/langs/fr_FR/bookmarks.lang 1970-01-01 01:00:00.000000000 +0100
+++ /var/www/html/dolibarr_dev/htdocs/langs/fr_FR/bookmarks.lang 2009-01-21 22:14:05.000000000 +0100
@@ -0,0 +1,4 @@
+# Dolibarr language file - fr_FR - marque pages
+CHARSET=ISO-8859-1
+Bookm=Marque pages
+NewBookmark=Nouveau marque page
\ Pas de fin de ligne à la fin du fichier.
diff -Naur --exclude=add.png --exclude=html.formactions.class.php --exclude=paiement.php --exclude=CVS --exclude=synchro_dev.sh --exclude=recup_cvs.sh --exclude=patch.sh --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents /var/www/html/dolibarr/htdocs/main.inc.php /var/www/html/dolibarr_dev/htdocs/main.inc.php
--- /var/www/html/dolibarr/htdocs/main.inc.php 2009-01-21 17:09:23.000000000 +0100
+++ /var/www/html/dolibarr_dev/htdocs/main.inc.php 2009-01-21 21:01:39.000000000 +0100
@@ -886,6 +886,15 @@
img_object($langs->trans("List"),'user').' '.$langs->trans("Members"), 'member', 'sall');
}
+ // Zone d'affichage permanente des marque pages
+ if ($conf->bookmark->enabled && $conf->global->MAIN_PERMANENT_BOOKMARKS && $user->rights->bookmark->lire)
+ {
+ include_once (DOL_DOCUMENT_ROOT.'/bookmarks/fonctions.inc.php');
+ $langs->load("bookmarks");
+
+ $ret.=printBookmarksList($db, $langs);
+ }
+
if ($ret)
{
print "\n";
@@ -901,7 +910,7 @@
{
print $form_search;
}
-
+
// Lien vers l'aide en ligne (uniquement si langue fr_FR)
if ($helppagename)
{
diff -Naur --exclude=add.png --exclude=html.formactions.class.php --exclude=paiement.php --exclude=CVS --exclude=synchro_dev.sh --exclude=recup_cvs.sh --exclude=patch.sh --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents /var/www/html/dolibarr/output.patch /var/www/html/dolibarr_dev/output.patch
--- /var/www/html/dolibarr/output.patch 1970-01-01 01:00:00.000000000 +0100
+++ /var/www/html/dolibarr_dev/output.patch 2009-01-21 22:41:47.000000000 +0100
@@ -0,0 +1,93 @@
+diff -Naur --exclude=add.png --exclude=html.formactions.class.php --exclude=paiement.php --exclude=CVS --exclude=synchro_dev.sh --exclude=recup_cvs.sh --exclude=patch.sh --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents /var/www/html/dolibarr/htdocs/bookmarks/fonctions.inc.php /var/www/html/dolibarr_dev/htdocs/bookmarks/fonctions.inc.php
+--- /var/www/html/dolibarr/htdocs/bookmarks/fonctions.inc.php 1970-01-01 01:00:00.000000000 +0100
++++ /var/www/html/dolibarr_dev/htdocs/bookmarks/fonctions.inc.php 2009-01-21 22:41:44.000000000 +0100
+@@ -0,0 +1,51 @@
++<?php
++
++ function printBookmarksList ($aDb, $aLangs) {
++ $db = $aDb;
++ $langs = $aLangs;
++
++ require_once(DOL_DOCUMENT_ROOT."/bookmarks/bookmark.class.php");
++
++ $bookm = new Bookmark($db);
++
++ $langs->load("bookmarks");
++
++ $ret = '';
++ $ret .= '<div class="blockvmenupair">';
++
++ $ret .= '<div class="menu_titre">';
++ $ret .= '<a class="vsmenu" href="'.DOL_URL_ROOT.'/bookmarks/liste.php">'.$langs->trans('Bookm').'</a>';
++ $ret .= '<a class="vsmenu"" href="'.DOL_URL_ROOT.'/bookmarks/fiche.php?action=create"><img style="border: none; position: relative;" src="'.DOL_URL_ROOT.'/bookmarks/add.png" alt="'.$langs->trans('NewBookmark').'" title="'.$langs->trans('NewBookmark').'" /></a>';
++ $ret .= '</div>';
++
++ $ret .= '<div class="menu_contenu">';
++
++ $sql = "
++ SELECT rowid FROM ".MAIN_DB_PREFIX."bookmark
++ WHERE true
++ ;";
++
++ if ( $resql = $db->query($sql) ) {
++
++ while ( $obj = $db->fetch_object($resql) ) {
++
++ $bookm->fetch($obj->rowid);
++
++ $ret .='<a class="vsmenu" title="'.$bookm->title.'" href="'.$bookm->url.'">'.dolibarr_trunc($bookm->title, 30).'</a><br />';
++
++ }
++
++ } else {
++
++ dolibarr_print_error($db);
++
++ }
++
++ $ret .= '</div>';
++
++ $ret .= '<div class="menu_fin"></div></div>';
++
++ return $ret;
++ }
++
++?>
+\ Pas de fin de ligne à la fin du fichier.
+diff -Naur --exclude=add.png --exclude=html.formactions.class.php --exclude=paiement.php --exclude=CVS --exclude=synchro_dev.sh --exclude=recup_cvs.sh --exclude=patch.sh --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents /var/www/html/dolibarr/htdocs/langs/fr_FR/bookmarks.lang /var/www/html/dolibarr_dev/htdocs/langs/fr_FR/bookmarks.lang
+--- /var/www/html/dolibarr/htdocs/langs/fr_FR/bookmarks.lang 1970-01-01 01:00:00.000000000 +0100
++++ /var/www/html/dolibarr_dev/htdocs/langs/fr_FR/bookmarks.lang 2009-01-21 22:14:05.000000000 +0100
+@@ -0,0 +1,4 @@
++# Dolibarr language file - fr_FR - marque pages
++CHARSET=ISO-8859-1
++Bookm=Marque pages
++NewBookmark=Nouveau marque page
+\ Pas de fin de ligne à la fin du fichier.
+diff -Naur --exclude=add.png --exclude=html.formactions.class.php --exclude=paiement.php --exclude=CVS --exclude=synchro_dev.sh --exclude=recup_cvs.sh --exclude=patch.sh --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents /var/www/html/dolibarr/htdocs/main.inc.php /var/www/html/dolibarr_dev/htdocs/main.inc.php
+--- /var/www/html/dolibarr/htdocs/main.inc.php 2009-01-21 17:09:23.000000000 +0100
++++ /var/www/html/dolibarr_dev/htdocs/main.inc.php 2009-01-21 21:01:39.000000000 +0100
+@@ -886,6 +886,15 @@
+ img_object($langs->trans("List"),'user').' '.$langs->trans("Members"), 'member', 'sall');
+ }
+
++ // Zone d'affichage permanente des marque pages
++ if ($conf->bookmark->enabled && $conf->global->MAIN_PERMANENT_BOOKMARKS && $user->rights->bookmark->lire)
++ {
++ include_once (DOL_DOCUMENT_ROOT.'/bookmarks/fonctions.inc.php');
++ $langs->load("bookmarks");
++
++ $ret.=printBookmarksList($db, $langs);
++ }
++
+ if ($ret)
+ {
+ print "\n";
+@@ -901,7 +910,7 @@
+ {
+ print $form_search;
+ }
+-
++
+ // Lien vers l'aide en ligne (uniquement si langue fr_FR)
+ if ($helppagename)
+ {

87
htdocs/admin/bookmark.php Normal file
View File

@ -0,0 +1,87 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.org>
*
* 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.
*/
/** \file htdocs/admin/bookmark.php
* \ingroup bookmark
* \brief Page to setup bookmark module
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
$langs->load("admin");
if (!$user->admin)
accessforbidden();
if ($_POST["action"] == 'setvalue' && $user->admin)
{
$result=dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU",$_POST["BOOKMARKS_SHOW_IN_MENU"]);
if ($result >= 0)
{
$mesg='<div class="ok">'.$langs->trans("Success").'</div>';
}
else
{
dolibarr_print_error($db);
}
}
/*
*
*
*/
llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("BookmarkSetup"),$linkback,'setup');
print $langs->trans("BookmarkDesc")."<br>\n";
if ($mesg) print '<br>'.$mesg;
print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="action" value="setvalue">';
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("NbOfBoomarkToShow").'</td><td>';
print '<input size="3" type="text" name="BOOKMARKS_SHOW_IN_MENU" value="'.$conf->global->BOOKMARKS_SHOW_IN_MENU.'">';
print '</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table></form>';
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -29,7 +29,8 @@
* @param unknown_type $aDb
* @param unknown_type $aLangs
* @return unknown
*/function printBookmarksList ($aDb, $aLangs)
*/
function printBookmarksList ($aDb, $aLangs)
{
global $conf, $user;
@ -37,6 +38,7 @@
$langs = $aLangs;
require_once(DOL_DOCUMENT_ROOT."/bookmarks/bookmark.class.php");
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
$bookm = new Bookmark($db);

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -35,7 +35,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php");
if (!$user->rights->societe->lire)
accessforbidden();
$langs->load("commercial");
$langs->load("orders");
@ -342,7 +342,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire && 0) // \todo A REF
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("LastContracts",5).'</td></tr>';
$i = 0;
$staticcontrat=new Contrat($db);
$var=false;
@ -400,13 +400,15 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
// Ref
print '<td nowrap="nowrap" width="140">';
$propalstatic->id=$obj->propalid;
$propalstatic->ref=$obj->ref;
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td width="100" class="nobordernopadding" nowrap="nowrap">';
print '<td class="nobordernopadding" nowrap="nowrap">';
print $propalstatic->getNomUrl(1);
print '</td>';
print '<td width="18" class="nobordernopadding" nowrap="nowrap">';
@ -420,6 +422,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
print '</td></tr></table>';
print "</td>";
print "<td align=\"left\"><a href=\"fiche.php?socid=".$obj->rowid."\">".img_object($langs->trans("ShowCompany"),"company")." ".dolibarr_trunc($obj->nom,44)."</a></td>\n";
print "<td align=\"right\">";
print dolibarr_print_date($obj->dp,'day')."</td>\n";
@ -442,8 +445,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
}
/*
* Derni<EFBFBD>res propales ferm<EFBFBD>es
*
* Last closed proposals
*/
if ($conf->propal->enabled && $user->rights->propale->lire)
@ -466,7 +468,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
if ( $db->query($sql) )
{
$num = $db->num_rows();
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="6">'.$langs->trans("LastClosedProposals",$NBMAX).'</td></tr>';
@ -475,13 +477,15 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
{
$objp = $db->fetch_object();
print "<tr $bc[$var]>";
// Ref
print '<td nowrap="nowrap" width="140">';
$propalstatic->id=$objp->propalid;
$propalstatic->ref=$objp->ref;
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td width="100" class="nobordernopadding" nowrap="nowrap">';
print '<td class="nobordernopadding" nowrap="nowrap">';
print $propalstatic->getNomUrl(1);
print '</td>';
print '<td width="18" class="nobordernopadding" nowrap="nowrap">';
@ -506,7 +510,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
$var=!$var;
}
print "</table>";
$db->free();
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2009 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

View File

@ -64,12 +64,12 @@ class modBookmark extends DolibarrModules
// Dir
$this->dirs = array();
// D<EFBFBD>pendances
// Dependancies
$this->depends = array();
$this->requiredby = array();
// Config pages
//$this->config_page_url = array();
$this->config_page_url = array('bookmark.php');
// Constantes
$this->const = array();

View File

@ -981,3 +981,7 @@ CashDeskSetup=Cash desk module setup
CashDeskThirdPartyForSell=Generic third party to use for sells
CashDeskBankAccountForSell=Cash account to use for sells
CashDeskIdWareHouse=Datawarehous to user for sells
##### Bookmark #####
BookmarkSetup=Bookmark module setup
BookmarkDesc=This module allows you to manage bookmarks. You can also add shortcuts to any Dolibarr pages or externale web sites on your left menu.
NbOfBoomarkToShow=Maximum number of bookmarks to show in left menu

View File

@ -987,3 +987,7 @@ CashDeskSetup=Configuration du module Caisse enregistreuse
CashDeskThirdPartyForSell=Tiers générique à utiliser pour les ventes
CashDeskBankAccountForSell=Compte caisse à utiliser pour les ventes
CashDeskIdWareHouse=Entrepot à utiliser pour les ventes
##### Bookmark #####
BookmarkSetup=Configuration du module Bookmark
BookmarkDesc=Ce module vous permet de gérer des liens et raccourcis. Il permet aussi d'ajouter n'importe quelle page de Dolibarr ou lien web dans le menu d'accès rapide sur la gauche.
NbOfBoomarkToShow=Nombre maximum de marques-pages à afficher dans le menu