|
@@ -44,7 +44,7 @@ $userid=GETPOST("userid","int");
|
|
|
$position=GETPOST("position","int");
|
|
|
$backtopage=GETPOST('backtopage','alpha');
|
|
|
|
|
|
-$bookmark=new Bookmark($db);
|
|
|
+$object=new Bookmark($db);
|
|
|
|
|
|
|
|
|
/*
|
|
@@ -69,14 +69,14 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
- if ($action == 'update') $bookmark->fetch(GETPOST("id",'int'));
|
|
|
+ if ($action == 'update') $object->fetch(GETPOST("id",'int'));
|
|
|
// Check if null because user not admin can't set an user and send empty value here.
|
|
|
if(!empty($userid))
|
|
|
- $bookmark->fk_user=$userid;
|
|
|
- $bookmark->title=$title;
|
|
|
- $bookmark->url=$url;
|
|
|
- $bookmark->target=$target;
|
|
|
- $bookmark->position=$position;
|
|
|
+ $object->fk_user=$userid;
|
|
|
+ $object->title=$title;
|
|
|
+ $object->url=$url;
|
|
|
+ $object->target=$target;
|
|
|
+ $object->position=$position;
|
|
|
|
|
|
if (! $title) {
|
|
|
$error++;
|
|
@@ -90,10 +90,10 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
|
|
|
|
|
if (! $error)
|
|
|
{
|
|
|
- $bookmark->favicon='none';
|
|
|
+ $object->favicon='none';
|
|
|
|
|
|
- if ($action == 'update') $res=$bookmark->update();
|
|
|
- else $res=$bookmark->create();
|
|
|
+ if ($action == 'update') $res=$object->update();
|
|
|
+ else $res=$object->create();
|
|
|
|
|
|
if ($res > 0)
|
|
|
{
|
|
@@ -103,14 +103,14 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if ($bookmark->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
|
|
+ if ($object->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
|
|
{
|
|
|
$langs->load("errors");
|
|
|
setEventMessages($langs->transnoentities("WarningBookmarkAlreadyExists"), null, 'warnings');
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- setEventMessages($bookmark->error, $bookmark->errors, 'errors');
|
|
|
+ setEventMessages($object->error, $object->errors, 'errors');
|
|
|
}
|
|
|
$action = $invertedaction;
|
|
|
}
|
|
@@ -133,7 +133,7 @@ $form=new Form($db);
|
|
|
$head = array();
|
|
|
$h=1;
|
|
|
|
|
|
-$head[$h][0] = $_SERVER["PHP_SELF"].($bookmark->id?'id='.$bookmark->id:'');
|
|
|
+$head[$h][0] = $_SERVER["PHP_SELF"].($object->id?'id='.$object->id:'');
|
|
|
$head[$h][1] = $langs->trans("Card");
|
|
|
$head[$h][2] = 'card';
|
|
|
$h++;
|
|
@@ -157,7 +157,7 @@ if ($action == 'create')
|
|
|
|
|
|
print '<table class="border" width="100%">';
|
|
|
|
|
|
- print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input class="flat" name="title" size="30" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
|
|
|
+ print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input class="flat" name="title" size="30" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
|
|
|
|
|
|
print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat" name="url" size="50" value="'.$url.'"></td><td class="hideonsmartphone">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>';
|
|
|
|
|
@@ -172,7 +172,7 @@ if ($action == 'create')
|
|
|
|
|
|
// Position
|
|
|
print '<tr><td>'.$langs->trans("Position").'</td><td>';
|
|
|
- print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"])?$_POST["position"]:$bookmark->position).'">';
|
|
|
+ print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"])?$_POST["position"]:$object->position).'">';
|
|
|
print '</td><td class="hideonsmartphone"> </td></tr>';
|
|
|
|
|
|
print '</table>';
|
|
@@ -193,8 +193,9 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
|
|
|
/*
|
|
|
* Fact bookmark mode or visually edition
|
|
|
*/
|
|
|
- $bookmark->fetch($id);
|
|
|
-
|
|
|
+ $object->fetch($id);
|
|
|
+
|
|
|
+ $hselected = 'card';
|
|
|
$head = array(
|
|
|
array(
|
|
|
'',
|
|
@@ -208,18 +209,22 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
|
|
|
print '<form name="edit" method="POST" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data">';
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
|
print '<input type="hidden" name="action" value="update">';
|
|
|
- print '<input type="hidden" name="id" value="'.$bookmark->id.'">';
|
|
|
- print '<input type="hidden" name="urlsource" value="'.DOL_URL_ROOT.'/bookmarks/card.php?id='.$bookmark->id.'">';
|
|
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">';
|
|
|
+ print '<input type="hidden" name="urlsource" value="'.DOL_URL_ROOT.'/bookmarks/card.php?id='.$object->id.'">';
|
|
|
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
|
|
}
|
|
|
|
|
|
+
|
|
|
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
|
|
|
+
|
|
|
+ $linkback = '<a href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans("BackToList").'</a>';
|
|
|
+
|
|
|
+ dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '' , '', 0, '', '', 0);
|
|
|
|
|
|
+ print '<div class="underbanner clearboth"></div>';
|
|
|
print '<table class="border" width="100%">';
|
|
|
|
|
|
- print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bookmark->ref.'</td></tr>';
|
|
|
-
|
|
|
- print '<tr><td>';
|
|
|
+ print '<tr><td class="titlefield">';
|
|
|
if ($action == 'edit') {
|
|
|
print '<span class="fieldrequired">';
|
|
|
}
|
|
@@ -231,8 +236,8 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
|
|
|
}
|
|
|
|
|
|
print '</td><td>';
|
|
|
- if ($action == 'edit') print '<input class="flat minwidth200" name="title" value="'.(isset($_POST["title"])?GETPOST("title",'',2):$bookmark->title).'">';
|
|
|
- else print $bookmark->title;
|
|
|
+ if ($action == 'edit') print '<input class="flat minwidth200" name="title" value="'.(isset($_POST["title"])?GETPOST("title",'',2):$object->title).'">';
|
|
|
+ else print $object->title;
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print '<tr><td>';
|
|
@@ -244,34 +249,34 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
|
|
|
print '</span>';
|
|
|
}
|
|
|
print '</td><td>';
|
|
|
- if ($action == 'edit') print '<input class="flat" name="url" size="80" value="'.(isset($_POST["url"])?$_POST["url"]:$bookmark->url).'">';
|
|
|
- else print '<a href="'.(preg_match('/^http/i',$bookmark->url)?$bookmark->url:DOL_URL_ROOT.$bookmark->url).'"'.($bookmark->target?' target="_blank"':'').'>'.$bookmark->url.'</a>';
|
|
|
+ if ($action == 'edit') print '<input class="flat" name="url" size="80" value="'.(isset($_POST["url"])?$_POST["url"]:$object->url).'">';
|
|
|
+ else print '<a href="'.(preg_match('/^http/i',$object->url)?$object->url:DOL_URL_ROOT.$object->url).'"'.($object->target?' target="_blank"':'').'>'.$object->url.'</a>';
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
|
|
|
if ($action == 'edit')
|
|
|
{
|
|
|
$liste=array(1=>$langs->trans("OpenANewWindow"),0=>$langs->trans("ReplaceWindow"));
|
|
|
- print $form->selectarray('target',$liste,isset($_POST["target"])?$_POST["target"]:$bookmark->target);
|
|
|
+ print $form->selectarray('target',$liste,isset($_POST["target"])?$_POST["target"]:$object->target);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if ($bookmark->target == 0) print $langs->trans("ReplaceWindow");
|
|
|
- if ($bookmark->target == 1) print $langs->trans("OpenANewWindow");
|
|
|
+ if ($object->target == 0) print $langs->trans("ReplaceWindow");
|
|
|
+ if ($object->target == 1) print $langs->trans("OpenANewWindow");
|
|
|
}
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print '<tr><td>'.$langs->trans("Owner").'</td><td>';
|
|
|
if ($action == 'edit' && $user->admin)
|
|
|
{
|
|
|
- print $form->select_dolusers(isset($_POST['userid'])?$_POST['userid']:($bookmark->fk_user?$bookmark->fk_user:''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
|
|
+ print $form->select_dolusers(isset($_POST['userid'])?$_POST['userid']:($object->fk_user?$object->fk_user:''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if ($bookmark->fk_user)
|
|
|
+ if ($object->fk_user)
|
|
|
{
|
|
|
$fuser=new User($db);
|
|
|
- $fuser->fetch($bookmark->fk_user);
|
|
|
+ $fuser->fetch($object->fk_user);
|
|
|
print $fuser->getNomUrl(1);
|
|
|
}
|
|
|
else
|
|
@@ -283,12 +288,12 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
|
|
|
|
|
|
// Position
|
|
|
print '<tr><td>'.$langs->trans("Position").'</td><td>';
|
|
|
- if ($action == 'edit') print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"])?$_POST["position"]:$bookmark->position).'">';
|
|
|
- else print $bookmark->position;
|
|
|
+ if ($action == 'edit') print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"])?$_POST["position"]:$object->position).'">';
|
|
|
+ else print $object->position;
|
|
|
print '</td></tr>';
|
|
|
|
|
|
// Date creation
|
|
|
- print '<tr><td>'.$langs->trans("DateCreation").'</td><td>'.dol_print_date($bookmark->datec,'dayhour').'</td></tr>';
|
|
|
+ print '<tr><td>'.$langs->trans("DateCreation").'</td><td>'.dol_print_date($object->datec,'dayhour').'</td></tr>';
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
@@ -308,13 +313,13 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
|
|
|
// Edit
|
|
|
if ($user->rights->bookmark->creer && $action != 'edit')
|
|
|
{
|
|
|
- print " <a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?id=".$bookmark->id."&action=edit\">".$langs->trans("Edit")."</a>\n";
|
|
|
+ print " <a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?id=".$object->id."&action=edit\">".$langs->trans("Edit")."</a>\n";
|
|
|
}
|
|
|
|
|
|
// Remove
|
|
|
if ($user->rights->bookmark->supprimer && $action != 'edit')
|
|
|
{
|
|
|
- print " <a class=\"butActionDelete\" href=\"list.php?bid=".$bookmark->id."&action=delete\">".$langs->trans("Delete")."</a>\n";
|
|
|
+ print " <a class=\"butActionDelete\" href=\"list.php?bid=".$object->id."&action=delete\">".$langs->trans("Delete")."</a>\n";
|
|
|
}
|
|
|
|
|
|
print '</div>';
|