Bookmark : 'delete' option

This commit is contained in:
Armel Fauveau
2001-05-11 00:11:41 +00:00
parent 5a9503da8e
commit ea3ec15d62
2 changed files with 18 additions and 4 deletions

View File

@@ -78,13 +78,14 @@ if($cfgBookmark['db'] && $cfgBookmark['table'])
if(($bookmark_list=list_bookmarks($db, $cfgBookmark)) && count($bookmark_list)>0) if(($bookmark_list=list_bookmarks($db, $cfgBookmark)) && count($bookmark_list)>0)
{ {
echo "<i>$strOr</i> $strBookmarkQuery:<br>\n"; echo "<i>$strOr</i> $strBookmarkQuery:<br>\n";
echo "<select name=\"sql_bookmark\">\n"; echo "<select name=\"id_bookmark\">\n";
echo "<option value=\"\"></option>\n"; echo "<option value=\"\"></option>\n";
while(list($key,$value)=each($bookmark_list)) { while(list($key,$value)=each($bookmark_list)) {
echo "<option value=\"".htmlentities($value)."\">".htmlentities($key)."</option>\n"; echo "<option value=\"".htmlentities($value)."\">".htmlentities($key)."</option>\n";
} }
echo "</select>\n"; echo "</select>\n";
echo "<input type=\"checkbox\" name=\"view_bookmark\" value=\"1\">".$strBookmarkView; echo "<input type=\"radio\" name=\"action_bookmark\" value=\"0\">".$strBookmarkView;
echo "<input type=\"radio\" name=\"action_bookmark\" value=\"1\">".$strDelete;
echo "<br>\n"; echo "<br>\n";
} }
} }

View File

@@ -54,7 +54,7 @@ function show_table_navigation($pos_next, $pos_prev, $dt_result) {
( isset($SelectNumRows) && $pos + $sessionMaxRows < $SelectNumRows && mysql_num_rows($dt_result) >= $sessionMaxRows ? ( isset($SelectNumRows) && $pos + $sessionMaxRows < $SelectNumRows && mysql_num_rows($dt_result) >= $sessionMaxRows ?
"true" : "false" ); ?>" "true" : "false" ); ?>"
action=<?php printf ( action=<?php printf (
"\"sql.php3?server=$server&lang=$lang&db=$db&table=$table&sql_query=%s&sql_order=%s&pos=%d&sessionMaxRows=%d&goto=%s\"", urlencode($sql_query),urlencode($sql_order),$SelectNumRows - $sessionMaxRows, $sessionMaxRows, $goto);?> "\"sql.php3?server=$server&lang=$lang&db=$db&table=$table&sql_query=%s&sql_order=%s&pos=%d&sessionMaxRows=%d&goto=%s\"", urlencode($sql_query),urlencode($sql_order),$SelectNumRows - $sessionMaxRows, $sessionMaxRows, (isset($goto) ? $goto : ''));?>
><input type="submit" value="<?php echo "&gt;&gt; " . $strEnd ; ?>" > ><input type="submit" value="<?php echo "&gt;&gt; " . $strEnd ; ?>" >
</form> </form>
</td> </td>
@@ -718,7 +718,7 @@ function get_bookmarks_param() {
} }
function list_bookmarks($db, $cfgBookmark) { function list_bookmarks($db, $cfgBookmark) {
$query="SELECT label, query FROM ".$cfgBookmark['db'].".".$cfgBookmark['table']." WHERE dbase='$db'"; $query="SELECT label, id FROM ".$cfgBookmark['db'].".".$cfgBookmark['table']." WHERE dbase='$db'";
$result=mysql_db_query($cfgBookmark['db'], $query); $result=mysql_db_query($cfgBookmark['db'], $query);
if($result>0 && mysql_num_rows($result)>0) if($result>0 && mysql_num_rows($result)>0)
@@ -735,6 +735,19 @@ function list_bookmarks($db, $cfgBookmark) {
return false; return false;
} }
function query_bookmarks($db, $cfgBookmark, $id) {
$query="SELECT query FROM ".$cfgBookmark['db'].".".$cfgBookmark['table']." WHERE dbase='$db' AND id='$id'";
$result=mysql_db_query($cfgBookmark['db'], $query);
$bookmark_query=mysql_result($result,0,"query");
return $bookmark_query;
}
function delete_bookmarks($db, $cfgBookmark, $id) {
$query="DELETE FROM ".$cfgBookmark['db'].".".$cfgBookmark['table']." WHERE id='$id'";
$result=mysql_db_query($cfgBookmark['db'], $query);
}
$cfgBookmark=get_bookmarks_param(); $cfgBookmark=get_bookmarks_param();
} // $__LIB_INC__ } // $__LIB_INC__