Browse files

Display only first five columns in Editor example

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@919 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 8b37673 commit 6c97b80630c6befaab6f5d0d167e862e3efa597b jakubvrana committed Jul 27, 2009
Showing with 12 additions and 12 deletions.
  1. +2 −1 adminer/include/adminer.inc.php
  2. +3 −1 adminer/select.inc.php
  3. +5 −5 editor/example.php
  4. +1 −1 editor/include/adminer.inc.php
  5. +1 −4 todo.txt
View
3 adminer/include/adminer.inc.php
@@ -59,9 +59,10 @@ function tableName($tableStatus) {
/** Field caption used in select and edit
* @param array single field returned from fields()
+ * @param int order of column in select
* @return string
*/
- function fieldName($field) {
+ function fieldName($field, $order = 0) {
return '<span title="' . htmlspecialchars($field["full_type"]) . '">' . htmlspecialchars($field["field"]) . '</span>';
}
View
4 adminer/select.inc.php
@@ -181,11 +181,13 @@ function apply_sql_function($function, $column) {
echo "<thead><tr><td><input type='checkbox' id='all-page' onclick='form_check(this, /check/);'>";
$names = array();
reset($select);
+ $order = 0;
foreach ($rows[0] as $key => $val) {
$val = $_GET["columns"][key($select)];
$field = $fields[$select ? $val["col"] : $key];
- $name = ($field ? $adminer->fieldName($field) : "*");
+ $name = ($field ? $adminer->fieldName($field, $order) : "*");
if (strlen($name)) {
+ $order++;
$names[$key] = $name;
echo '<th><a href="' . htmlspecialchars(remove_from_uri('(order|desc)[^=]*') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"] == array($key) && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '">' . apply_sql_function($val["fun"], $name) . "</a>";
}
View
10 editor/example.php
@@ -23,14 +23,14 @@ function login($login, $password) {
return ($login == 'admin');
}
- function tableName($row) {
+ function tableName($tableStatus) {
// tables without comments would return empty string and will be ignored by Adminer
- return htmlspecialchars($row["Comment"]);
+ return htmlspecialchars($tableStatus["Comment"]);
}
- function fieldName($field) {
- // fields without comments will be ignored
- return ($field ? htmlspecialchars($field["comment"]) : "*");
+ function fieldName($field, $order = 0) {
+ // only first five columns with comments will be displayed
+ return ($order < 5 ? htmlspecialchars($field["comment"]) : "");
}
}
View
2 editor/include/adminer.inc.php
@@ -32,7 +32,7 @@ function tableName($tableStatus) {
return htmlspecialchars(strlen($tableStatus["Comment"]) ? $tableStatus["Comment"] : $tableStatus["Name"]);
}
- function fieldName($field) {
+ function fieldName($field, $order = 0) {
return htmlspecialchars(strlen($field["comment"]) ? $field["comment"] : $field["field"]);
}
View
5 todo.txt
@@ -22,10 +22,7 @@ Download external files (version checker and JUSH) from trusted HTTPS if Adminer
? AJAX editing - select page has all data to display edit form
Editor:
-Choose columns hidden in select
-Restrict column selection in select to aggregation functions by index
JavaScript data validation
Joining tables - PRIMARY KEY (table, joining)
-Simplify search - textual, from-to
Rank, Tree structure
-Treat tinyint(1) as bool, format date
+Treat tinyint(1) as bool

0 comments on commit 6c97b80

Please sign in to comment.