New: Bookmarks can be sorted by a position
This commit is contained in:
parent
0f4759e2c5
commit
c32113a8cc
@ -41,6 +41,7 @@ For users:
|
||||
- New: Add option to choose firstname-name or name-firstname.
|
||||
- New: Add company in fields exported by export of members tool.
|
||||
- New: Reorganise bank menu.
|
||||
- New: Bookmarks can be sorted on a particular order.
|
||||
- Fix: Debug experimental module widthrawal.
|
||||
- Fix: Format number was wrong for ar_AR language.
|
||||
- Fix: Can change password if has only permission change password.
|
||||
|
||||
11
default.properties
Normal file
11
default.properties
Normal file
@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Indicates whether an apk should be generated for each density.
|
||||
split.density=false
|
||||
@ -39,6 +39,7 @@ class Bookmark
|
||||
var $url;
|
||||
var $target; // 0=replace, 1=new window
|
||||
var $title;
|
||||
var $position;
|
||||
var $favicon;
|
||||
|
||||
|
||||
@ -60,7 +61,7 @@ class Bookmark
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT rowid, fk_user, dateb as datec, url, target,";
|
||||
$sql.= " title, favicon";
|
||||
$sql.= " title, position, favicon";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
@ -78,6 +79,7 @@ class Bookmark
|
||||
$this->url = $obj->url;
|
||||
$this->target = $obj->target;
|
||||
$this->title = $obj->title;
|
||||
$this->position= $obj->position;
|
||||
$this->favicon = $obj->favicon;
|
||||
|
||||
$this->db->free($resql);
|
||||
@ -92,24 +94,25 @@ class Bookmark
|
||||
|
||||
/**
|
||||
* \brief Insere bookmark en base
|
||||
* \return int <0 si ko, rowid du bookmark cr<EFBFBD><EFBFBD> si ok
|
||||
* \return int <0 si ko, rowid du bookmark cree si ok
|
||||
*/
|
||||
function create()
|
||||
{
|
||||
// Clean parameters
|
||||
$this->url=trim($this->url);
|
||||
$this->title=trim($this->title);
|
||||
if (empty($this->position)) $this->position=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_user,dateb,url,target";
|
||||
$sql.= " ,title,favicon";
|
||||
$sql.= " ,title,favicon,position";
|
||||
if ($this->fk_soc) $sql.=",fk_soc";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= ($this->fk_user > 0?"'".$this->fk_user."'":"0").",";
|
||||
$sql.= " ".$this->db->idate(gmmktime()).",";
|
||||
$sql.= " '".$this->url."', '".$this->target."',";
|
||||
$sql.= " '".addslashes($this->title)."', '".$this->favicon."'";
|
||||
$sql.= " '".addslashes($this->title)."', '".$this->favicon."', '".$this->position."'";
|
||||
if ($this->fk_soc) $sql.=",".$this->fk_soc;
|
||||
$sql.= ")";
|
||||
|
||||
@ -142,7 +145,7 @@ class Bookmark
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Mise <EFBFBD> jour du bookmark
|
||||
* \brief Update bookmark record
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function update()
|
||||
@ -150,6 +153,7 @@ class Bookmark
|
||||
// Clean parameters
|
||||
$this->url=trim($this->url);
|
||||
$this->title=trim($this->title);
|
||||
if (empty($this->position)) $this->position=0;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bookmark";
|
||||
$sql.= " SET fk_user = ".($this->fk_user > 0?"'".$this->fk_user."'":"0");
|
||||
@ -158,6 +162,7 @@ class Bookmark
|
||||
$sql.= " ,target = '".$this->target."'";
|
||||
$sql.= " ,title = '".addslashes($this->title)."'";
|
||||
$sql.= " ,favicon = '".$this->favicon."'";
|
||||
$sql.= " ,position = '".$this->position."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("Bookmark::update sql=".$sql, LOG_DEBUG);
|
||||
|
||||
@ -35,6 +35,7 @@ $title=isset($_GET["title"])?$_GET["title"]:$_POST["title"];
|
||||
$url=isset($_GET["url"])?$_GET["url"]:$_POST["url"];
|
||||
$target=isset($_GET["target"])?$_GET["target"]:$_POST["target"];
|
||||
$userid=isset($_GET["userid"])?$_GET["userid"]:$_POST["userid"];
|
||||
$position=isset($_GET["position"])?$_GET["position"]:$_POST["position"];
|
||||
|
||||
|
||||
/*
|
||||
@ -58,6 +59,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
$bookmark->title=$title;
|
||||
$bookmark->url=$url;
|
||||
$bookmark->target=$target;
|
||||
$bookmark->position=$position;
|
||||
|
||||
if (! $title) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle"));
|
||||
if (! $url) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink"));
|
||||
@ -156,6 +158,11 @@ if ($action == 'create')
|
||||
$html->select_users(isset($_POST['userid'])?$_POST['userid']:$user->id,'userid',1);
|
||||
print '</td><td> </td></tr>';
|
||||
|
||||
// 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 '</td></tr>';
|
||||
|
||||
print '<tr><td colspan="3" align="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("CreateBookmark").'" name="create"> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
|
||||
@ -176,7 +183,7 @@ if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"]))
|
||||
$bookmark->fetch($_GET["id"]);
|
||||
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"));
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
|
||||
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
@ -235,6 +242,13 @@ if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"]))
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Position
|
||||
print '<tr><td>'.$langs->trans("Position").'</td><td>';
|
||||
if ($_GET["action"] == 'edit') print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"])?$_POST["position"]:$bookmark->position).'">';
|
||||
else print $bookmark->position;
|
||||
print '</td></tr>';
|
||||
|
||||
// Date creation
|
||||
print '<tr><td>'.$langs->trans("DateCreation").'</td><td>'.dol_print_date($bookmark->datec,'dayhour').'</td></tr>';
|
||||
|
||||
if ($_GET["action"] == 'edit') print '<tr><td colspan="2" align="center"><input class="button" type="submit" name="save" value="'.$langs->trans("Save").'"> <input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
@ -244,6 +258,8 @@ if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"]))
|
||||
|
||||
if ($_GET["action"] == 'edit') print '</form>';
|
||||
|
||||
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/bookmarks/liste.php
|
||||
* \brief Page display bookmarks
|
||||
* \brief Page to display list of bookmarks
|
||||
* \ingroup bookmark
|
||||
* \version $Id$
|
||||
*/
|
||||
@ -30,8 +30,8 @@ require_once(DOL_DOCUMENT_ROOT."/bookmarks/class/bookmark.class.php");
|
||||
$page=$_GET["page"];
|
||||
$sortorder=$_GET["sortorder"];
|
||||
$sortfield=$_GET["sortfield"];
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="bid";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="position";
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = 26;
|
||||
@ -72,7 +72,7 @@ print_fiche_titre($langs->trans("Bookmarks"));
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
$sql = "SELECT b.fk_soc as rowid, b.dateb, b.rowid as bid, b.fk_user, b.url, b.target, b.title, b.favicon,";
|
||||
$sql = "SELECT b.fk_soc as rowid, b.dateb, b.rowid as bid, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
|
||||
$sql.= " u.login, u.name, u.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
|
||||
$sql.= " WHERE 1=1";
|
||||
@ -96,6 +96,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Target"),'','','','','align="center"')."</td>";
|
||||
print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.name","","",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","","",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('','','');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -166,10 +167,13 @@ if ($resql)
|
||||
print "</td>\n";
|
||||
|
||||
// Date creation
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dateb),'day') ."</td>";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dateb),'day')."</td>";
|
||||
|
||||
// Position
|
||||
print '<td align="right">'.$obj->position."</td>";
|
||||
|
||||
// Actions
|
||||
print "<td>";
|
||||
print '<td align="right">';
|
||||
if ($user->rights->bookmark->supprimer)
|
||||
{
|
||||
print "<a href=\"".$_SERVER["PHP_SELF"]."?action=delete&bid=$obj->bid\">".img_delete()."</a>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user