Permanent link in schema

This commit is contained in:
Jakub Vrana 2010-12-29 18:08:34 +01:00
parent 850d1aa130
commit 61b1fd57e0
4 changed files with 10 additions and 3 deletions

View file

@ -4,7 +4,7 @@ page_header(lang('Database schema'), "", array(), DB);
$table_pos = array();
$table_pos_js = array();
// saved in one cookie because there is a limit of 20 cookies per domain
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', $_COOKIE["adminer_schema"], $matches, PREG_SET_ORDER); //! ':' in table name
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', ($_GET["schema"] ? $_GET["schema"] : $_COOKIE["adminer_schema"]), $matches, PREG_SET_ORDER); //! ':' in table name
foreach ($matches as $i => $match) {
$table_pos[$match[1]] = array($match[2], $match[3]);
$table_pos_js[] = "\n\t'" . js_escape($match[1]) . "': [ $match[2], $match[3] ]";
@ -100,3 +100,4 @@ foreach ($schema as $name => $table) {
}
?>
</div>
<p><a href="<?php echo h($_SERVER["REQUEST_URI"]); ?>" id="schema-link">#</a>

View file

@ -400,6 +400,9 @@ function schemaMouseup(ev) {
for (var key in tablePos) {
s += '_' + key + ':' + Math.round(tablePos[key][0] * 10000) / 10000 + 'x' + Math.round(tablePos[key][1] * 10000) / 10000;
}
cookie('adminer_schema=' + encodeURIComponent(s.substr(1)), 30, '; path="' + location.pathname + location.search + '"');
s = encodeURIComponent(s.substr(1));
var link = document.getElementById('schema-link');
link.href = link.href.replace(/[^=]+$/, '') + s;
cookie('adminer_schema=' + s, 30, '; path="' + location.pathname + location.search + '"');
}
}

View file

@ -1,10 +1,13 @@
Adminer 3.2.0-dev:
Get long texts and slow information by AJAX
All links and some forms by AJAX in browsers with support for history.pushState
Permanent link in schema
Display total time in show only errors mode in SQL command
History: edit all
MS SQL: auto primary and foreign key
SQLite: display 0
Create table default data type: int
Work without session.use_cookies (bug #3138640)
Portuguese translation
Adminer 3.1.0 (released 2010-11-16):

View file

@ -8,8 +8,8 @@ Shift-click in checkboxes to select range
Export by GET parameters
Only first part of big BZ2 export is readable, files are missing in TAR
Auto-refresh processlist (thanks to Jan Garaj)
Save schema layout to #hash in URL
Double click in select - Esc to abort editation
Draggable columns in alter table (thanks to Michal Manak)
? Filter by value in row under <thead> in select
? Column and table names auto-completition in SQL textarea
? Aliasing of built-in functions can save 7 KB, function minification can save 7 KB, substitution of repetitive $a["a"] can save 4 KB, substitution of $_GET and friends can save 2 KB, aliasing of $connection->query can save 24 B, JS Closure compiler can save 2 KB, not enclosing HTML attribute values can save 1.2 KB, replacing \\n by \n can save .3 KB