[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: fiche.php,v 1.3 2005/09/11 22:37:27 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/bookmarks/fiche.php,v $ 21 */ 22 23 /** 24 \file htdocs/bookmarks/fiche.php 25 \brief Page affichage/creation des bookmarks 26 \ingroup bookmark 27 \version $Revision: 1.3 $ 28 */ 29 30 31 require ("./pre.inc.php"); 32 require_once(DOL_DOCUMENT_ROOT."/bookmarks/bookmark.class.php"); 33 34 $langs->load("other"); 35 36 $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; 37 $title=isset($_GET["title"])?$_GET["title"]:$_POST["title"]; 38 $url=isset($_GET["url"])?$_GET["url"]:$_POST["url"]; 39 $target=isset($_GET["target"])?$_GET["target"]:$_POST["target"]; 40 41 42 /* 43 * Actions 44 */ 45 46 if ($action == 'add') 47 { 48 $mesg=''; 49 50 $bookmark=new Bookmark($db); 51 $bookmark->fk_user=$user->id; 52 if ($_GET["socid"]) // Lien vers fiche comm société 53 { 54 require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); 55 $societe=new Societe($db); 56 $societe->fetch($_GET["socid"]); 57 $bookmark->fk_soc=$societe->id; 58 $bookmark->url=DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id; 59 $bookmark->target='0'; 60 $bookmark->title=$societe->nom; 61 } 62 else 63 { 64 if (! $title) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle")); 65 if (! $url) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink")); 66 67 $bookmark->title=$title; 68 $bookmark->url=$url; 69 $bookmark->target=$target; 70 } 71 72 if (! $mesg) 73 { 74 $bookmark->favicon='xxx'; 75 76 $res=$bookmark->create(); 77 if ($res > 0) 78 { 79 $urlsource=isset($_GET["urlsource"])?$_GET["urlsource"]:DOL_URL_ROOT.'/bookmarks/liste.php'; 80 header("Location: ".$urlsource); 81 } 82 else 83 { 84 $mesg='<div class="error">'.$bookmark->error.'</div>'; 85 $action='create'; 86 } 87 } 88 else 89 { 90 $mesg='<div class="error">'.$mesg.'</div>'; 91 $action='create'; 92 } 93 94 } 95 96 if ($_GET["action"] == 'delete') 97 { 98 $bookmark=new Bookmark($db); 99 $bookmark->id=$_GET["bid"]; 100 $bookmark->url=$user->id; 101 $bookmark->target=$user->id; 102 $bookmark->title='xxx'; 103 $bookmark->favicon='xxx'; 104 105 $res=$bookmark->remove(); 106 if ($res > 0) 107 { 108 header("Location: ".$_SERVER["PHP_SELF"]); 109 } 110 else 111 { 112 $mesg='<div class="error">'.$bookmark->error.'</div>'; 113 } 114 } 115 116 117 118 llxHeader(); 119 120 $html=new Form($db); 121 122 123 if ($action == 'create') 124 { 125 /* 126 * Fiche bookmark en mode creation 127 */ 128 129 print '<form action="fiche.php" method="post">'."\n"; 130 print '<input type="hidden" name="action" value="add">'; 131 132 print_fiche_titre($langs->trans("NewBookmark")); 133 134 if ($mesg) print "$mesg<br>"; 135 136 print '<table class="border" width="100%">'; 137 138 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>'; 139 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>'; 140 print '<tr><td width="20%">'.$langs->trans("BehaviourOnClick").'</td><td>'; 141 $liste=array(1=>$langs->trans("OpenANewWindow"),0=>$langs->trans("ReplaceWindow")); 142 $html->select_array('target',$liste,1); 143 print '</td><td>'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</td></tr>'; 144 print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("CreateBookmark").'"></td></tr>'; 145 print '</table>'; 146 147 print '</form>'; 148 } 149 150 151 if ($_GET["id"] > 0) 152 { 153 /* 154 * Fiche bookmark en mode edition 155 */ 156 $bookmark=new Bookmark($db); 157 $bookmark->fetch($_GET["id"]); 158 159 160 dolibarr_fiche_head($head, $hselected, $langs->trans("Bookmark")); 161 162 print '<table class="border" width="100%">'; 163 164 print '<tr><td width="20%">'.$langs->trans("BookmarkTitle").'</td><td>'.$bookmark->title.'</td></tr>'; 165 print '<tr><td width="20%">'.$langs->trans("UrlOrLink").'</td><td>'; 166 print '<a href="'.(eregi('^http',$bookmark->url)?$bookmark->url:DOL_URL_ROOT.$bookmark->url).'" target="'.($bookmark->target?"":"newlink").'">'.$bookmark->url.'</a></td></tr>'; 167 print '<tr><td width="20%">'.$langs->trans("BehaviourOnClick").'</td><td>'; 168 if ($bookmark->target == 0) print $langs->trans("OpenANewWindow"); 169 if ($bookmark->target == 1) print $langs->trans("ReplaceWindow"); 170 print '</td></tr>'; 171 print '</table>'; 172 173 print "</div>\n"; 174 175 print "<div class=\"tabsAction\">\n"; 176 177 // Supprimer 178 if ($user->rights->bookmark->supprimer) 179 { 180 print " <a class=\"butActionDelete\" href=\"liste.php?bid=".$bookmark->id."&action=delete\">".$langs->trans("Delete")."</a>\n"; 181 } 182 183 print '</div>'; 184 185 } 186 187 $db->close(); 188 189 190 llxFooter('$Date: 2005/09/11 22:37:27 $ - $Revision: 1.3 $'); 191 192 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |