This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "quickfw".
The branch, master has been updated
via 3cb2a6436df81212e9297fd170df4ce77807a3e1 (commit)
from 124e3d88ebc3f6d1ede8a4afcb65644291c1c3c7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3cb2a6436df81212e9297fd170df4ce77807a3e1
Author: Ivan1986 <iva...@li...>
Date: Fri Jun 4 14:54:02 2010 +0400
Скафолдинг переписан с использованием класса Url
diff --git a/lib/Modules/Scafold/ScafoldController.php b/lib/Modules/Scafold/ScafoldController.php
index 64259a1..494ba9e 100644
--- a/lib/Modules/Scafold/ScafoldController.php
+++ b/lib/Modules/Scafold/ScafoldController.php
@@ -36,8 +36,6 @@ abstract class ScafoldController extends Controller
/** @var array Эта таблица зависимая - данные о родительской */
protected $parentData = false;
- /** @var string Адрес контроллера */
- private $ControllerUrl;
/** @var array Массив методов */
private $methods;
/** @var boolean Флаг окончания настройки */
@@ -98,7 +96,6 @@ abstract class ScafoldController extends Controller
QFW::$view->P->addCSS('buildin/scafold.css');
$this->setup = true;
parent::__construct();
- $this->ControllerUrl = QFW::$router->module.'/'.QFW::$router->controller;
$this->methods = array_flip(get_class_methods($this));
//Получаем данные о полях
@@ -116,10 +113,7 @@ abstract class ScafoldController extends Controller
QFW::$view->assign(array(
'methods' => $this->methods,
'class' => get_class($this),
- 'info' => array(
- 'ControllerUrl' => $this->ControllerUrl,
- 'primaryKey' => $this->primaryKey,
- ),
+ 'primaryKey' => $this->primaryKey,
'fields' => $this->fields,
'actions' => $this->actions,
'table' => str_replace('?_', '', $this->table),
@@ -149,7 +143,7 @@ abstract class ScafoldController extends Controller
if (isset($_POST['parent']))
{
$_SESSION['scafold'][$this->table]['parent'] = $_POST['parent'];
- QFW::$router->redirectMCA(QFW::$router->module.'/'.QFW::$router->controller.'/index');
+ QFW::$router->redirect(Url::A());
}
if (empty($_SESSION['scafold'][$this->table]['parent']))
$_SESSION['scafold'][$this->table]['parent'] = count($parent) ? key($parent) : 0;
@@ -183,9 +177,8 @@ abstract class ScafoldController extends Controller
QFW::$view->assign('filter', $filter['form']);
}
//получаем пагинатор
- $curUrl = QFW::$view->P->siteUrl($this->ControllerUrl.'/index/$');
$pages = ceil($count/$this->pageSize);
- $pager=QFW::$router->blockRoute('helper.nav.pager('.$curUrl.','.$pages.','.($page+1).')');
+ $pager=QFW::$router->blockRoute('helper.nav.pager', Url::A('$'), $pages, $page+1);
return QFW::$view->assign(array(
'data' => $data,
@@ -247,7 +240,7 @@ abstract class ScafoldController extends Controller
QFW::$router->redirect($url);
}
else
- QFW::$router->redirect('/'.$this->ControllerUrl.'/index/');
+ QFW::$router->redirect(Url::C('index'));
}
}
@@ -294,7 +287,7 @@ abstract class ScafoldController extends Controller
$v->proccess($id, false);
QFW::$db->query('DELETE FROM ?# WHERE ?#=?',
$this->table, $this->primaryKey, $id);
- QFW::$router->redirect('/'.$this->ControllerUrl.'/index', true);
+ QFW::$router->redirect(Url::C('index'), true);
}
/**
@@ -309,7 +302,7 @@ abstract class ScafoldController extends Controller
array_shift($args);
if (isset($this->fields[$name]))
call_user_func_array(array($this->fields[$name], 'action'), $args);
- QFW::$router->redirect('/'.$this->ControllerUrl.'/index', true);
+ QFW::$router->redirect(Url::C('index'), true);
}
/**
@@ -321,13 +314,13 @@ abstract class ScafoldController extends Controller
if (!empty($_POST['clear']))
{
$_SESSION['scafold'][$this->table]['filter'] = array();
- QFW::$router->redirect('/'.$this->ControllerUrl.'/index', true);
+ QFW::$router->redirect(Url::C('index'), true);
}
if (empty($_POST['filter']) || empty($_POST['apply']))
- QFW::$router->redirect('/'.$this->ControllerUrl.'/index', true);
+ QFW::$router->redirect(Url::C('index'), true);
$_SESSION['scafold'][$this->table]['filter'] = $_POST['filter'];
- QFW::$router->redirect('/'.$this->ControllerUrl.'/index', true);
+ QFW::$router->redirect(Url::C('index'), true);
}
/**
@@ -340,7 +333,7 @@ abstract class ScafoldController extends Controller
$this->session();
//такого поля нету
if (!isset($this->fields[$field]))
- QFW::$router->redirect('/'.$this->ControllerUrl.'/index', true);
+ QFW::$router->redirect(Url::C('index'), true);
if (isset($_SESSION['scafold'][$this->table]['sort']) &&
$_SESSION['scafold'][$this->table]['sort']['field'] == $field)
$r = array(
@@ -354,7 +347,7 @@ abstract class ScafoldController extends Controller
'direction' => 'ASC',
);
$_SESSION['scafold'][$this->table]['sort'] = $r;
- QFW::$router->redirect('/'.$this->ControllerUrl.'/index', true);
+ QFW::$router->redirect(Url::C('index'), true);
}
////////////////////////////////////////////////////////////
diff --git a/lib/Modules/Scafold/scafold/edit.html b/lib/Modules/Scafold/scafold/edit.html
index 0c14992..5877e6b 100644
--- a/lib/Modules/Scafold/scafold/edit.html
+++ b/lib/Modules/Scafold/scafold/edit.html
@@ -3,7 +3,7 @@
Поле <?php echo $fields[$k]->title ?> имеет некорректное значение<br />
<?php } ?>
<?php } ?>
-<form action="<?php echo $P->siteUrl($info['ControllerUrl'].'/edit/'.$id) ?>" class="scafoldEdit"
+<form action="<?php echo Url::C('edit/'.$id) ?>" class="scafoldEdit"
method="post" id="form_<?php echo $table ?>" enctype="multipart/form-data">
<dl>
<?php foreach($data as $k=>$v) {
diff --git a/lib/Modules/Scafold/scafold/filterForm.html b/lib/Modules/Scafold/scafold/filterForm.html
index 44152a9..59b0d90 100644
--- a/lib/Modules/Scafold/scafold/filterForm.html
+++ b/lib/Modules/Scafold/scafold/filterForm.html
@@ -1,4 +1,4 @@
-<form action="<?php echo $P->siteUrl($info['ControllerUrl'].'/filter') ?>"
+<form action="<?php echo Url::C('filter') ?>"
method="post" id="filter_<?php echo $table ?>" class="scafoldFilter">
<?php foreach ($filter as $v) {?>
<?php echo $v; ?>
diff --git a/lib/Modules/Scafold/scafold/index.html b/lib/Modules/Scafold/scafold/index.html
index ff3d096..d5e4354 100644
--- a/lib/Modules/Scafold/scafold/index.html
+++ b/lib/Modules/Scafold/scafold/index.html
@@ -14,8 +14,7 @@
if ($i->hide)
continue;
?>
- <th><a href="<?php echo $P->siteUrl($info['ControllerUrl'].
- '/sort/'.$key) ?>"><?php echo $i->title ?></a>
+ <th><a href="<?php echo Url::C('sort/'.$key) ?>"><?php echo $i->title ?></a>
<?php if (isset($order) && $order['field'] == $key) { ?><span class="scafoldSort">
<span><?php echo $order['direction']=='ASC' ? '↓' : '↑' ?></span>
<?php /*<img src="/buildin/<?php echo $order['direction']=='ASC' ? 'az' : 'za' ?>.png"
@@ -23,8 +22,7 @@
</span><?php } ?>
</th>
<?php } ?>
- <th><a href="<?php echo $P->siteUrl($info['ControllerUrl'].
- '/edit/-1') ?>">доб.</a></th>
+ <th><a href="<?php echo Url::C('edit/-1') ?>">доб.</a></th>
<th> </th>
<?php if (count($actions)) { ?><th>действия</th><?php } ?>
</tr>
@@ -42,20 +40,18 @@
echo $i->display($id, $v);
?></td>
<?php } ?>
- <td><a href="<?php echo $P->siteUrl($info['ControllerUrl'].
- '/edit/'.$row[$info['primaryKey']]) ?>">ред.</a></td>
- <td><a onclick="return confirm('Удалить?')" href="<?php echo $P->siteUrl($info['ControllerUrl'].
- '/delete/'.$row[$info['primaryKey']]) ?>">уд.</a></td>
+ <td><a href="<?php echo Url::C('edit/'.$row[$primaryKey]) ?>">ред.</a></td>
+ <td><a onclick="return confirm('Удалить?')" href="<?php echo
+ Url::C('delete/'.$row[$primaryKey]) ?>">уд.</a></td>
<?php if (count($actions)) {?><td><?php foreach ($actions as $tit => $uri) { ?>
- <a href="<?php echo $P->siteUrl($info['ControllerUrl'].
- '/'.$uri.'/'.$row[$info['primaryKey']]) ?>"><?php echo $tit ?></a>
+ <a href="<?php echo Url::C($uri.'/'.$row[$primaryKey]) ?>"><?php echo $tit ?></a>
<?php } ?></td><?php } ?>
</tr>
<?php } ?>
</table>
<?php } else { ?>
Записей нет
- <a href="<?php echo $P->siteUrl($info['ControllerUrl'].'/edit/-1') ?>">добавить</a>
+ <a href="<?php echo Url::C('edit/-1') ?>">добавить</a>
<?php } ?>
<?php echo $pager; ?>
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
lib/Modules/Scafold/ScafoldController.php | 29 ++++++++++----------------
lib/Modules/Scafold/scafold/edit.html | 2 +-
lib/Modules/Scafold/scafold/filterForm.html | 2 +-
lib/Modules/Scafold/scafold/index.html | 18 ++++++----------
4 files changed, 20 insertions(+), 31 deletions(-)
hooks/post-receive
--
quickfw
|