Bugs and Features item #3366317, was opened at 2011-07-13 21:46
Message generated for change (Comment added) made by jakubvrana
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=1127745&aid=3366317&group_id=264133
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Common
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Jakub Vrána (jakubvrana)
Summary: Chyba v pluginu Slugify
Initial Comment:
Ahoj, nevim jestli na sourceforge funguje něco jako pull-request, tak opravu hodím sem:
V pluginu AdminerSlugify je potřeba změnit řádek
23. if (!$_GET["select"] && !$_GET["where"]) {
za
23. if (!$_GET["select"]) {
Jinak se nahrazení neprovede. Díky.
----------------------------------------------------------------------
Comment By: Jakub Vrána (jakubvrana)
Date: 2011-07-14 10:36
Message:
Thank you for the report, I've fixed it in Git. You can download the
"Current development version" from http://www.adminer.org/#download
----------------------------------------------------------------------
Comment By: Jakub Vrána (jakubvrana)
Date: 2011-07-14 10:36
Message:
Podmínka je tam proto, že při editaci je slug obvykle nežádoucí
měnit. Ten se předvyplňuje jen při vytváření nové položky.
----------------------------------------------------------------------
Comment By: Michal Mikoláš (nanuqcz)
Date: 2011-07-13 22:57
Message:
Tak jsem si s tím teď hrál a přišel jsem na další problémy. Celý
ten if se musí zrušit, protože pak to nefunguje při přidávání nové
položky. A taky, nevím přesně proč, ale kvůli tomu foreach se mi na
localhostu (PHP 5.3) zruší proměnná $field, původně předaná jako
argument metody. No, celé to mám takto, a teď už mi to funguje (Adminer
Editor 3.3.0-dev) bez problému:
<?php
/** Prefill field containing "_slug" with slugified value of a previous
field (JavaScript)
* @author Jakub Vrana, http://www.vrana.cz/
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License,
Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public
License, version 2 (one or other)
*/
class AdminerSlugify {
/** @var string @access protected */
var $from, $to;
/**
* @param string find these characters ...
* @param string ... and replace them by these
*/
function AdminerSlugify($from = 'áčďéěíňóřšťúůýž', $to
= 'acdeeinorstuuyz') {
$this->from = $from;
$this->to = $to;
}
function editInput($table, $field, $attrs, $value) {
static $slugify;
if (!isset($slugify)) {
$slugify = array();
$prev = null;
foreach (fields($table) as $name => $_field) {
if ($prev && ereg('(^|_)slug(_|$)', $name)) {
$slugify[$prev] = $name;
}
$prev = $name;
}
}
$slug = $slugify[$field["field"]];
if (isset($slug)) {
return "<input value='" . h($value) . "'
maxlength='$field[length]' size='40'$attrs onchange=\"var find =
'$this->from'; var repl = '$this->to'; this.form['fields[$slug]'].value =
this.value.toLowerCase().replace(new RegExp('[' + find + ']', 'g'),
function (str) { return repl[find.indexOf(str)]; }).replace(/[^a-z0-9_]+/g,
'-').replace(/^-|-\$/g, '').substr(0, $field[length]);\">";
}
}
}
Kdyžtak kontakt na mě: nanuqcz@...
Díky, Michal Mikoláš
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=1127745&aid=3366317&group_id=264133
|