mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Gestion des bookmarks
This commit is contained in:
parent
fb3640a7cb
commit
652e9727f7
|
|
@ -18,12 +18,12 @@
|
|||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/comm/bookmark.php
|
||||
\brief Page affichage des bookmarks
|
||||
\file htdocs/bookmarks/fiche.php
|
||||
\brief Page affichage/creation des bookmarks
|
||||
\ingroup bookmark
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
|
@ -31,13 +31,22 @@
|
|||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/bookmarks/bookmark.class.php");
|
||||
|
||||
$langs->load("other");
|
||||
|
||||
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
||||
$title=isset($_GET["title"])?$_GET["title"]:$_POST["title"];
|
||||
$url=isset($_GET["url"])?$_GET["url"]:$_POST["url"];
|
||||
$target=isset($_GET["target"])?$_GET["target"]:$_POST["target"];
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_GET["action"] == 'add')
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
$mesg='';
|
||||
|
||||
$bookmark=new Bookmark($db);
|
||||
$bookmark->fk_user=$user->id;
|
||||
if ($_GET["socid"]) // Lien vers fiche comm société
|
||||
|
|
@ -47,27 +56,41 @@ if ($_GET["action"] == 'add')
|
|||
$societe->fetch($_GET["socid"]);
|
||||
$bookmark->fk_soc=$societe->id;
|
||||
$bookmark->url=DOL_URL_ROOT.'/comm/fiche.php?socidp='.$societe->id;
|
||||
$bookmark->target='';
|
||||
$bookmark->target='0';
|
||||
$bookmark->title=$societe->nom;
|
||||
}
|
||||
else
|
||||
{
|
||||
$bookmark->url=$_GET["url"];
|
||||
$bookmark->target=$_GET["target"];
|
||||
$bookmark->title=$_GET["title"];
|
||||
if (! $title) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle"));
|
||||
if (! $url) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink"));
|
||||
|
||||
$bookmark->title=$title;
|
||||
$bookmark->url=$url;
|
||||
$bookmark->target=$target;
|
||||
}
|
||||
$bookmark->favicon='xxx';
|
||||
|
||||
$res=$bookmark->create();
|
||||
if ($res > 0)
|
||||
|
||||
if (! $mesg)
|
||||
{
|
||||
$urlsource=isset($_GET["urlsource"])?$_GET["urlsource"]:$_SERVER["PHP_SELF"];
|
||||
header("Location: ".$urlsource);
|
||||
$bookmark->favicon='xxx';
|
||||
|
||||
$res=$bookmark->create();
|
||||
if ($res > 0)
|
||||
{
|
||||
$urlsource=isset($_GET["urlsource"])?$_GET["urlsource"]:DOL_URL_ROOT.'/bookmarks/liste.php';
|
||||
header("Location: ".$urlsource);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$bookmark->error.'</div>';
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$bookmark->error.'</div>';
|
||||
$mesg='<div class="error">'.$mesg.'</div>';
|
||||
$action='create';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'delete')
|
||||
|
|
@ -94,13 +117,76 @@ if ($_GET["action"] == 'delete')
|
|||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("Bookmarks"));
|
||||
|
||||
$html=new Form($db);
|
||||
|
||||
print 'En construction';
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
/*
|
||||
* Fiche bookmark en mode creation
|
||||
*/
|
||||
|
||||
print '<form action="fiche.php" method="post">'."\n";
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print_fiche_titre($langs->trans("NewBookmark"));
|
||||
|
||||
if ($mesg) print "$mesg<br>";
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans("BookmarkTitle").'</td><td><input class="flat" name="title" size="30" value="'.$title.'"></td><td>'.$langs->trans("SetHereATitleForLink").'</td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans("UrlOrLink").'</td><td><input class="flat" name="url" size="50" value=""></td><td>'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans("BehaviourOnClick").'</td><td>';
|
||||
$liste=array(1=>$langs->trans("OpenANewWindow"),0=>$langs->trans("ReplaceWindow"));
|
||||
$html->select_array('target',$liste,1);
|
||||
print '</td><td>'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</td></tr>';
|
||||
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("CreateBookmark").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
if ($_GET["id"] > 0)
|
||||
{
|
||||
/*
|
||||
* Fiche bookmark en mode edition
|
||||
*/
|
||||
$bookmark=new Bookmark($db);
|
||||
$bookmark->fetch($_GET["id"]);
|
||||
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Bookmark"));
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans("BookmarkTitle").'</td><td>'.$bookmark->title.'</td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans("UrlOrLink").'</td><td>';
|
||||
print '<a href="'.(eregi('^http',$bookmark->url)?$bookmark->url:DOL_URL_ROOT.$bookmark->url).'" target="'.($bookmark->target?"":"newlink").'">'.$bookmark->url.'</a></td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans("BehaviourOnClick").'</td><td>';
|
||||
if ($bookmark->target == 0) print $langs->trans("OpenANewWindow");
|
||||
if ($bookmark->target == 1) print $langs->trans("ReplaceWindow");
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
// Supprimer
|
||||
if ($user->rights->bookmark->supprimer)
|
||||
{
|
||||
print " <a class=\"butActionDelete\" href=\"liste.php?bid=".$bookmark->id."&action=delete\">".$langs->trans("Delete")."</a>\n";
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
/**
|
||||
\file htdocs/bookmarks/liste.php
|
||||
\brief Page affichage des bookmarks
|
||||
\ingroup bookmark
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
|
@ -75,7 +76,7 @@ $sql = "SELECT b.fk_soc as idp, ".$db->pdate("b.dateb")." as dateb, b.rowid as b
|
|||
$sql.= " u.name, u.firstname, u.code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE b.fk_user=u.rowid";
|
||||
if (! $user->admin) $sql.= " AND b.fk_user = ".$user->id;
|
||||
if (! $user->admin) $sql.= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL)";
|
||||
$sql.= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
|
@ -89,8 +90,9 @@ if ($resql)
|
|||
print "<tr class=\"liste_titre\">";
|
||||
//print "<td> </td>";
|
||||
print_liste_field_titre($langs->trans("Id"),$_SERVER["PHP_SELF"],"bid","","",'align="left"',$sortfield);
|
||||
print "<td>".$langs->trans("Title")."</td>";
|
||||
print "<td>".$langs->trans("Link")."</td>";
|
||||
print '<td>'.$langs->trans("Title")."</td>";
|
||||
print '<td>'.$langs->trans("Link")."</td>";
|
||||
print '<td align="center">'.$langs->trans("Target")."</td>";
|
||||
print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.name","","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","","",'align="center"',$sortfield);
|
||||
print "<td> </td>";
|
||||
|
|
@ -137,20 +139,34 @@ if ($resql)
|
|||
|
||||
// Url
|
||||
print "<td>";
|
||||
if (! $lieninterne) print "<a href=\"".$obj->url."\">";
|
||||
if (! $lieninterne) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
|
||||
print $lien;
|
||||
if (! $lieninterne) print "</a>";
|
||||
if (! $lieninterne) print '</a>';
|
||||
print "</td>\n";
|
||||
|
||||
// Target
|
||||
print '<td align="center">';
|
||||
if ($obj->target == 0) print $langs->trans("BookmarkTargetReplaceWindowShort");
|
||||
if ($obj->target == 1) print $langs->trans("BookmarkTargetNewWindowShort");
|
||||
print "</td>\n";
|
||||
|
||||
// Auteur
|
||||
print "<td><a href='".DOL_URL_ROOT."/user/fiche.php?id=".$obj->fk_user."'>".img_object($langs->trans("ShowUser"),"user").' '.$obj->code."</a></td>\n";
|
||||
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT."/user/fiche.php?id=".$obj->fk_user."'>".img_object($langs->trans("ShowUser"),"user").' '.$obj->code."</a></td>\n";
|
||||
|
||||
// Date creation
|
||||
print '<td align="center">'.dolibarr_print_date($obj->dateb) ."</td>";
|
||||
|
||||
// Actions
|
||||
print "<td><a href=\"".$_SERVER["PHP_SELF"]."?action=delete&bid=$obj->bid\">".img_delete()."</a></td>\n";
|
||||
|
||||
print "<td>";
|
||||
if ($user->rights->bookmark->supprimer)
|
||||
{
|
||||
print "<a href=\"".$_SERVER["PHP_SELF"]."?action=delete&bid=$obj->bid\">".img_delete()."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005 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
|
||||
|
|
@ -40,10 +40,13 @@ function llxHeader($head = "", $title = "")
|
|||
$menu = new Menu();
|
||||
|
||||
// Bookmarks
|
||||
$menu->add(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("Bookmarks"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/bookmarks/fiche.php?action=create", $langs->trans("NewBookmark"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("List"));
|
||||
|
||||
if ($conf->bookmark->enabled)
|
||||
{
|
||||
if ($user->rights->bookmark->lire) $menu->add(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("Bookmarks"));
|
||||
if ($user->rights->bookmark->creer) $menu->add_submenu(DOL_URL_ROOT."/bookmarks/fiche.php?action=create", $langs->trans("NewBookmark"));
|
||||
if ($user->rights->bookmark->lire) $menu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("List"));
|
||||
}
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -545,11 +545,14 @@ class MenuLeft {
|
|||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/liste.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire);
|
||||
}
|
||||
|
||||
$langs->load("other");
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php?leftmenu=bookmarks", $langs->trans("Bookmarks"), 0, 1);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/bookmarks/fiche.php?action=create", $langs->trans("NewBookmark"));
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("List"));
|
||||
|
||||
if ($conf->bookmark->enabled)
|
||||
{
|
||||
$langs->load("other");
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php?leftmenu=bookmarks", $langs->trans("Bookmarks"), 0, $user->rights->bookmark->lire);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/bookmarks/fiche.php?action=create", $langs->trans("NewBookmark"), 1, $user->rights->bookmark->creer);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("List"), 1, $user->rights->bookmark->lire);
|
||||
}
|
||||
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Exports"),0,1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 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
|
||||
|
|
@ -21,13 +22,13 @@
|
|||
|
||||
/**
|
||||
\defgroup bookmark Module Bookmark
|
||||
\brief Module pour gérer l'addon Bookmark
|
||||
\brief Module pour gérer les Bookmarks
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/modBookmark.class.php
|
||||
\ingroup bookmark
|
||||
\brief Fichier de description et activation du module Bookmark
|
||||
\brief Fichier de description et activation du module Bookmarks
|
||||
*/
|
||||
|
||||
include_once "DolibarrModules.class.php";
|
||||
|
|
@ -47,13 +48,13 @@ class modBookmark extends DolibarrModules
|
|||
function modBookmark($DB)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->numero = 67 ;
|
||||
$this->numero = 330;
|
||||
|
||||
$this->family = "technic";
|
||||
$this->name = "Bookmarks";
|
||||
$this->description = "Gestion des Bookmarks";
|
||||
$this->revision = explode(" ","$Revision$");
|
||||
$this->version = $this->revision[1]."(DEV)";
|
||||
$this->version = $this->revision[1];
|
||||
|
||||
$this->const_name = "MAIN_MODULE_BOOKMARK";
|
||||
$this->const_config = MAIN_MODULE_BOOKMARK;
|
||||
|
|
@ -79,6 +80,29 @@ class modBookmark extends DolibarrModules
|
|||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'bookmark';
|
||||
$r=0;
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 331; // id de la permission
|
||||
$this->rights[$r][1] = 'Lire les bookmarks'; // libelle de la permission
|
||||
$this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
|
||||
$this->rights[$r][3] = 1; // La permission est-elle une permission par défaut
|
||||
$this->rights[$r][4] = 'lire';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 332; // id de la permission
|
||||
$this->rights[$r][1] = 'Creer/modifier les bookmarks'; // libelle de la permission
|
||||
$this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
|
||||
$this->rights[$r][3] = 1; // La permission est-elle une permission par défaut
|
||||
$this->rights[$r][4] = 'creer';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 333; // id de la permission
|
||||
$this->rights[$r][1] = 'Supprimer les bookmarks'; // libelle de la permission
|
||||
$this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
|
||||
$this->rights[$r][3] = 1; // La permission est-elle une permission par défaut
|
||||
$this->rights[$r][4] = 'supprimer';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -81,8 +81,6 @@ Module58Name=ClickToDial
|
|||
Module58Desc=ClickToDial integration
|
||||
Module59Name=Bookmark4u
|
||||
Module59Desc=Add function to generate Bookmark4u account from a Dolibarr account
|
||||
Module67Name=Bookmarks
|
||||
Module67Desc=Bookmarks' management
|
||||
Module70Name=Interventions
|
||||
Module70Desc=Interventions' management
|
||||
Module75Name=Trips
|
||||
|
|
@ -103,6 +101,8 @@ Module310Name=Members
|
|||
Module310Desc=Foundation members management
|
||||
Module320Name=RSS Flux
|
||||
Module320Desc=Add RSS flux inside Dolibarr screen pages
|
||||
Module330Name=Bookmarks
|
||||
Module330Desc=Bookmarks' management
|
||||
Module400Name=Projects
|
||||
Module400Desc=Projects' management inside other modules
|
||||
Module410Name=Webcalendar
|
||||
|
|
@ -185,6 +185,9 @@ Permission233=Delete supplier invoices
|
|||
Permission300=Read bar codes
|
||||
Permission301=Create/modify bar codes
|
||||
Permission302=Delete bar codes
|
||||
Permission331=Read bookmarks
|
||||
Permission332=Create/modify bookmarks
|
||||
Permission333=Delete bookmarks
|
||||
Permission700=Read donations
|
||||
Permission701=Create/modify donations
|
||||
Permission702=Delete donations
|
||||
|
|
|
|||
|
|
@ -25,4 +25,15 @@ Bookmark=Bookmark
|
|||
Bookmarks=Bookmarks
|
||||
NewBookmark=New bookmark
|
||||
ShowBookmark=Show bookmark
|
||||
BookmarkThisPage=Bookmark this page
|
||||
BookmarkThisPage=Bookmark this page
|
||||
OpenANewWindow=Open a new window
|
||||
ReplaceWindow=Replace current window
|
||||
BookmarkTargetNewWindowShort=New window
|
||||
BookmarkTargetReplaceWindowShort=Current window
|
||||
BookmarkTitle=Bookmark title
|
||||
UrlOrLink=URL
|
||||
BehaviourOnClick=Behaviour on click on URL
|
||||
CreateBookmark=Create bookmark
|
||||
SetHereATitleForLink=Set here a title for bookmark
|
||||
UseAnExternalHttpLinkOrRelativeDolibarrLink=Use an external http URL or a relative Dolibarr URL
|
||||
ChooseIfANewWindowMustBeOpenedOnClickOnBookmark=Choose if page opened by link must appear on current or new window
|
||||
|
|
@ -81,8 +81,6 @@ Module58Name=ClickToDial
|
|||
Module58Desc=Intégration de ClickToDial
|
||||
Module59Name=Bookmark4u
|
||||
Module59Desc=Ajoute fonction pour générer un compte Bookmark4u depuis un compte Dolibarr
|
||||
Module67Name=Bookmarks
|
||||
Module67Desc=Gestion des bookmarks
|
||||
Module70Name=Interventions
|
||||
Module70Desc=Gestion des interventions
|
||||
Module75Name=Déplacements
|
||||
|
|
@ -103,6 +101,8 @@ Module310Name=Adh
|
|||
Module310Desc=Gestion des adhérents d'une association
|
||||
Module320Name=Fils RSS
|
||||
Module320Desc=Ajout de fils d'informations RSS dans les écrans Dolibarr
|
||||
Module330Name=Bookmarks
|
||||
Module330Desc=Gestion des marque-pages
|
||||
Module400Name=Projets
|
||||
Module400Desc=Gestion des projets au sein des autres modules
|
||||
Module410Name=Webcalendar
|
||||
|
|
@ -185,6 +185,9 @@ Permission233=Supprimer les factures fournisseurs
|
|||
Permission300=Consulter les codes barres
|
||||
Permission301=Créer/modifier les codes barres
|
||||
Permission302=Supprimer les codes barres
|
||||
Permission331=Lire les bookmarks
|
||||
Permission332=Créer/modifier les bookmarks
|
||||
Permission333=Supprimer les bookmarks
|
||||
Permission700=Consulter les dons
|
||||
Permission701=Créer/modifier les dons
|
||||
Permission702=Supprimer les dons
|
||||
|
|
|
|||
|
|
@ -25,4 +25,15 @@ Bookmark=Marque page
|
|||
Bookmarks=Marque pages
|
||||
NewBookmark=Nouveau marque page
|
||||
ShowBookmark=Afficher marque page
|
||||
BookmarkThisPage=Marquer cette page dans ces favoris
|
||||
BookmarkThisPage=Marquer cette page dans ces favoris
|
||||
OpenANewWindow=Ouvrir une nouvelle fenêtre
|
||||
ReplaceWindow=Remplacer fenêtre courante
|
||||
BookmarkTargetNewWindowShort=Nouvelle fenêtre
|
||||
BookmarkTargetReplaceWindowShort=Fenêtre courante
|
||||
BookmarkTitle=Titre du marque page
|
||||
UrlOrLink=URL
|
||||
BehaviourOnClik=Comportement sur click de l'URL
|
||||
CreateBookmark=Créer bookmark
|
||||
SetHereATitleForLink=Saisir ici un titre pour le marque page
|
||||
UseAnExternalHttpLinkOrRelativeDolibarrLink=Saisir une URL http externe ou une URL Dolibarr relative
|
||||
ChooseIfANewWindowMustBeOpenedOnClickOnBookmark=Choisir si le raccourci doit ouvrir la page dans une nouvelle fenêtre ou fenêtre courante
|
||||
Loading…
Reference in New Issue
Block a user