quickfw-git Mailing List for QuickFramework (Page 2)
Brought to you by:
ivan1986,
seriousdron
You can subscribe to this list here.
| 2010 |
Jan
|
Feb
|
Mar
(9) |
Apr
(25) |
May
(22) |
Jun
(22) |
Jul
(15) |
Aug
(16) |
Sep
(4) |
Oct
(9) |
Nov
(9) |
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2011 |
Jan
(5) |
Feb
(3) |
Mar
(2) |
Apr
(11) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(3) |
Sep
|
Oct
(2) |
Nov
|
Dec
|
|
From: Ivan1986 <iva...@us...> - 2011-02-17 08:41:19
|
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 31b59d46fb3ef0a120c1d9ad0fc35e65016ccc7b (commit)
via 4e2c20d3bf5c32ae12529fb73c45a3522cafedbb (commit)
via efab6e5e855dde27afca0f4d1480e5ea090d5d7e (commit)
via b6a248d9e028ccff6e34dbf4130aed84d50e1355 (commit)
via 37d5da8c5fcb24b8903c5d912e494a349d6ddddb (commit)
via dac3eb560e559d7a5fd3f5b6db73bb4f3e13b6dd (commit)
via bacb508b934df994d3c6090dc73b8b88e530c197 (commit)
via 63bd585f28ecd53760bda6a89111e03c07df05aa (commit)
from d8ae62b53971e4e59359059f22754f2beefff373 (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 31b59d46fb3ef0a120c1d9ad0fc35e65016ccc7b
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Feb 16 23:46:11 2011 +0300
Игнорим .idea (phpstorm)
diff --git a/.gitignore b/.gitignore
index b0da8fc..29bd83c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-/var/tmp/doc
\ No newline at end of file
+/var/tmp/doc
+.idea
\ No newline at end of file
commit 4e2c20d3bf5c32ae12529fb73c45a3522cafedbb
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Feb 16 15:11:21 2011 +0300
Условие если не нашли
diff --git a/QFW/Init.php b/QFW/Init.php
index e27b0ea..1a5e0eb 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -171,7 +171,7 @@ class QFW
$msg."\n\n".
$info['query']."\n";
$trace = debug_backtrace();
- while(1)
+ while(count($trace))
{
$t = $trace[0];
if (!isset($t['file']) || $t['file']!=$file || $t['line']!=$line || $t['function'] == '__call')
commit efab6e5e855dde27afca0f4d1480e5ea090d5d7e
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Feb 16 15:08:29 2011 +0300
Теперь ошибки базы данных отправляются в нотифер если он установлен
diff --git a/QFW/Init.php b/QFW/Init.php
index 7b2023d..e27b0ea 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -126,6 +126,8 @@ class QFW
/** @var Debug_ErrorHook_Listener Обработчик ошибок */
static private $ErrorHook = false;
+ /** @var Debug_ErrorHook_INotifier Сообщение об ошибке */
+ static private $Notifer = false;
/**
* Инициализация обработчика ошибок из конфига
@@ -153,7 +155,34 @@ class QFW
$i = new Debug_ErrorHook_RemoveDupsWrapper($i,
TMPPATH.'/errors', $handler['RemoveDups']);
}
- self::$ErrorHook->addNotifier($i);
+ self::$Notifer = $i;
+ self::$ErrorHook->addNotifier(self::$Notifer);
+ self::$db->setErrorHandler(array(get_class(), 'dbErrorHandler'));
+ }
+
+ static public function dbErrorHandler($msg, $info)
+ {
+ // Если использовалась @, ничего не делать.
+ if (!error_reporting()) return;
+ // В лог подробную информацию об ошибке.
+ list($file, $line) = explode(' line ', $info['context']);
+ $msg = str_replace(' at '.$info['context'], ' of query', $msg);
+ $text = "SQL Error\n\n".
+ $msg."\n\n".
+ $info['query']."\n";
+ $trace = debug_backtrace();
+ while(1)
+ {
+ $t = $trace[0];
+ if (!isset($t['file']) || $t['file']!=$file || $t['line']!=$line || $t['function'] == '__call')
+ {
+ array_shift($trace);
+ continue;
+ }
+ break;
+ }
+ self::$Notifer->notify($info['code'], $text, $file, $line, $trace);
+ exit();
}
/**
commit b6a248d9e028ccff6e34dbf4130aed84d50e1355
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Feb 10 14:09:39 2011 +0300
Сайтмап - поддержка gzip и флаг использования _index.xml
diff --git a/lib/Sitemap.php b/lib/Sitemap.php
index 55d5def..d2cf104 100644
--- a/lib/Sitemap.php
+++ b/lib/Sitemap.php
@@ -5,121 +5,133 @@
*/
class Sitemap
{
- /**
- * Класс для генерации sitemap
- *
- * @param string $dir DOC_ROOT сайта
- * @param string $prefix Префикс урла
- * @param string $suffix Суффикс файла
- */
- public function __construct($dir, $prefix, $suffix='')
- {
- $this->dir = $dir;
- $this->curFileNum = 0;
- $this->prefix = $prefix;
- $this->suffix = $suffix;
- $this->head.="\n";
- $this->data = $this->head;
- $this->realsize = 10*1024*1024 - mb_strlen($this->head) - mb_strlen($this->foot);
- //$this->realsize = 400 - mb_strlen($this->head) - mb_strlen($this->foot);
- $this->last_len = $this->realsize;
- $this->last_urls = 50000;
- }
+ /**
+ * Класс для генерации sitemap
+ *
+ * @param string $dir DOC_ROOT сайта
+ * @param string $prefix Префикс урла
+ * @param string $name Имя файла
+ * @param string $gzip Использовать gzip
+ */
+ public function __construct($dir, $prefix, $name = 'sitemap', $gzip = false)
+ {
+ $this->dir = $dir;
+ $this->curFileNum = 0;
+ $this->prefix = $prefix;
+ $this->name = $name;
+ $this->gzip = $gzip;
+ $this->head.="\n";
+ $this->data = $this->head;
+ $this->realsize = 10*1024*1024 - mb_strlen($this->head) - mb_strlen($this->foot);
+ //$this->realsize = 400 - mb_strlen($this->head) - mb_strlen($this->foot);
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ }
- /**
- * Добавить путь
- *
- * @param string $url Урл
- * @param array $extra Дополнительные поля
- */
- public function add($url, $extra = array())
- {
- if ($this->last_urls == 0)
- $this->nextFile();
+ /**
+ * Добавить путь
+ *
+ * @param string $url Урл
+ * @param array $extra Дополнительные поля
+ */
+ public function add($url, $p, $extra = array())
+ {
+ if ($this->last_urls == 0)
+ $this->nextFile();
- $text = '<url><loc>'.$this->prefix.$url.'</loc>';
- foreach($extra as $tag=>$value)
- $text.='<'.$tag.'>'.$value.'</'.$tag.'>';
- $text.='</url>'."\n";
- $len = mb_strlen($text);
+ $text = '<url><loc>'.$this->prefix.$url.'</loc>';
+ foreach($extra as $tag=>$value)
+ $text.='<'.$tag.'>'.$value.'</'.$tag.'>';
+ $text.='</url>'."\n";
+ $len = mb_strlen($text);
- if ($this->last_len < $len)
- $this->nextFile();
- $this->last_len-=$len;
+ if ($this->last_len < $len)
+ $this->nextFile();
+ $this->last_len-=$len;
- $this->data.=$text;
- }
+ $this->data.=$text;
+ }
- /**
- * Закончить генерацию
- */
- public function end()
- {
- //Файл был не один - генерим индекс
- if ($this->curFileNum)
- {
- $this->curFileNum++;
- file_put_contents($this->dir.'/sitemap'.$this->suffix.$this->curFileNum.'.xml', $this->data.$this->foot);
+ /**
+ * Закончить генерацию
+ *
+ * @return bool Был ли создан индекс фаил?
+ */
+ public function end()
+ {
+ //Файл был не один - генерим индекс
+ if ($this->curFileNum)
+ {
+ if ($this->last_urls != 50000)
+ { //если у нас еще есть урлы для записи
+ $this->curFileNum++;
+ file_put_contents(($this->gzip ? 'compress.zlib://' : '').
+ $this->dir.'/'.$this->name.$this->curFileNum.'.'.($this->gzip ? 'gz' : 'xml'), $this->data.$this->foot);
+ }
- $index= '<?xml version="1.0" encoding="UTF-8"?>'."\n".
-'<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
- for($i=1; $i<=$this->curFileNum; $i++)
- {
- $index.= "\t<sitemap>\n";
- $index.= "<loc>".$this->prefix.'/sitemap'.$this->suffix.$i.'.xml'."</loc>";
- $index.= "<lastmod>".(date(DATE_W3C))."</lastmod>";
- $index.= "</sitemap>";
- }
- $index.= '</sitemapindex>';
- file_put_contents($this->dir.'/sitemap'.$this->suffix.'_index.xml', $index);
- }
- else
- file_put_contents($this->dir.'/sitemap'.$this->suffix.'.xml', $this->data.$this->foot);
- //восстанавливаем значения
- $this->data = $this->head;
- $this->last_len = $this->realsize;
- $this->last_urls = 50000;
- $this->curFileNum = 0;
- }
+ $index= '<?xml version="1.0" encoding="UTF-8"?>'."\n".
+ '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
+ for($i=1; $i<=$this->curFileNum; $i++)
+ {
+ $index.= "\t<sitemap>\n";
+ $index.= "<loc>".$this->prefix.'/'.$this->name.$i.'.'.($this->gzip ? 'gz' : 'xml')."</loc>";
+ $index.= "<lastmod>".(date(DATE_W3C))."</lastmod>";
+ $index.= "</sitemap>";
+ }
+ $index.= '</sitemapindex>';
+ file_put_contents($this->dir.'/'.$this->name.'_index.xml', $index);
+ }
+ else
+ file_put_contents(($this->gzip ? 'compress.zlib://' : '').
+ $this->dir.'/'.$this->name.'.'.($this->gzip ? 'gz' : 'xml'), $this->data.$this->foot);
+ $index = (bool)$this->curFileNum;
+ //восстанавливаем значения
+ $this->data = $this->head;
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ $this->curFileNum = 0;
+ return $index;
+ }
- /**
- * Переключаемся на следующий файл
- */
- private function nextFile()
- {
- $this->curFileNum++;
- file_put_contents($this->dir.'/sitemap'.$this->suffix.$this->curFileNum.'.xml', $this->data.$this->foot);
- //восстанавливаем значения
- $this->data = $this->head;
- $this->last_len = $this->realsize;
- $this->last_urls = 50000;
- }
+ /**
+ * Переключаемся на следующий файл
+ */
+ private function nextFile()
+ {
+ $this->curFileNum++;
+ file_put_contents(($this->gzip ? 'compress.zlib://' : '').
+ $this->dir.'/'.$this->name.$this->curFileNum.'.'.($this->gzip ? 'gz' : 'xml'), $this->data.$this->foot);
+ //восстанавливаем значения
+ $this->data = $this->head;
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ }
- /** @var integer Текущий номер файла */
- private $curFileNum;
- /** @var string Директория */
- private $dir;
-
- /** @var string Префикс урла */
- private $prefix;
- /** @var string Суффикс файла */
- private $suffix;
- /** @var string генерируемый сайтмап */
- private $data;
- /** @var integer осталось адресов */
- private $last_urls;
- /** @var integer осталось байт */
- private $last_len;
- /** @var integer Размер без шапок */
- private $realsize;
- /** @var string шапка */
- private $head = '<?xml version="1.0" encoding="UTF-8"?><urlset
- xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
- http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
- /** @var string футер */
- private $foot = '</urlset>';
+ /** @var integer Текущий номер файла */
+ private $curFileNum;
+ /** @var string Директория */
+ private $dir;
+ /** @var string Префикс урла */
+ private $prefix;
+ /** @var string Имя файла */
+ private $name;
+ /** @var bool использовать gzip */
+ private $gzip;
+ /** @var string генерируемый сайтмап */
+ private $data;
+ /** @var integer осталось адресов */
+ private $last_urls;
+ /** @var integer осталось байт */
+ private $last_len;
+ /** @var integer Размер без шапок */
+ private $realsize;
+ /** @var string шапка */
+ private $head = '<?xml version="1.0" encoding="UTF-8"?><urlset'."\n".
+ 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'."\n".
+ 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'."\n".
+ 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
+ /** @var string футер */
+ private $foot = '</urlset>';
}
commit 37d5da8c5fcb24b8903c5d912e494a349d6ddddb
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Feb 2 13:26:28 2011 +0300
Приоритет в сайтмапе необязательный
diff --git a/lib/Sitemap.php b/lib/Sitemap.php
index ab87baf..55d5def 100644
--- a/lib/Sitemap.php
+++ b/lib/Sitemap.php
@@ -30,16 +30,14 @@ class Sitemap
* Добавить путь
*
* @param string $url Урл
- * @param float $priority Приоритет
* @param array $extra Дополнительные поля
*/
- public function add($url, $priority, $extra = array())
+ public function add($url, $extra = array())
{
if ($this->last_urls == 0)
$this->nextFile();
- $text = '<url><loc>'.$this->prefix.$url.'</loc>'.
- '<priority>'.$priority.'</priority>';
+ $text = '<url><loc>'.$this->prefix.$url.'</loc>';
foreach($extra as $tag=>$value)
$text.='<'.$tag.'>'.$value.'</'.$tag.'>';
$text.='</url>'."\n";
commit dac3eb560e559d7a5fd3f5b6db73bb4f3e13b6dd
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Feb 2 13:07:37 2011 +0300
Класс для генерации sitemap
diff --git a/lib/Sitemap.php b/lib/Sitemap.php
new file mode 100644
index 0000000..ab87baf
--- /dev/null
+++ b/lib/Sitemap.php
@@ -0,0 +1,127 @@
+<?php
+
+/**
+ * Класс для генерации sitemap
+ */
+class Sitemap
+{
+ /**
+ * Класс для генерации sitemap
+ *
+ * @param string $dir DOC_ROOT сайта
+ * @param string $prefix Префикс урла
+ * @param string $suffix Суффикс файла
+ */
+ public function __construct($dir, $prefix, $suffix='')
+ {
+ $this->dir = $dir;
+ $this->curFileNum = 0;
+ $this->prefix = $prefix;
+ $this->suffix = $suffix;
+ $this->head.="\n";
+ $this->data = $this->head;
+ $this->realsize = 10*1024*1024 - mb_strlen($this->head) - mb_strlen($this->foot);
+ //$this->realsize = 400 - mb_strlen($this->head) - mb_strlen($this->foot);
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ }
+
+ /**
+ * Добавить путь
+ *
+ * @param string $url Урл
+ * @param float $priority Приоритет
+ * @param array $extra Дополнительные поля
+ */
+ public function add($url, $priority, $extra = array())
+ {
+ if ($this->last_urls == 0)
+ $this->nextFile();
+
+ $text = '<url><loc>'.$this->prefix.$url.'</loc>'.
+ '<priority>'.$priority.'</priority>';
+ foreach($extra as $tag=>$value)
+ $text.='<'.$tag.'>'.$value.'</'.$tag.'>';
+ $text.='</url>'."\n";
+ $len = mb_strlen($text);
+
+ if ($this->last_len < $len)
+ $this->nextFile();
+ $this->last_len-=$len;
+
+ $this->data.=$text;
+ }
+
+ /**
+ * Закончить генерацию
+ */
+ public function end()
+ {
+ //Файл был не один - генерим индекс
+ if ($this->curFileNum)
+ {
+ $this->curFileNum++;
+ file_put_contents($this->dir.'/sitemap'.$this->suffix.$this->curFileNum.'.xml', $this->data.$this->foot);
+
+ $index= '<?xml version="1.0" encoding="UTF-8"?>'."\n".
+'<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
+ for($i=1; $i<=$this->curFileNum; $i++)
+ {
+ $index.= "\t<sitemap>\n";
+ $index.= "<loc>".$this->prefix.'/sitemap'.$this->suffix.$i.'.xml'."</loc>";
+ $index.= "<lastmod>".(date(DATE_W3C))."</lastmod>";
+ $index.= "</sitemap>";
+ }
+ $index.= '</sitemapindex>';
+ file_put_contents($this->dir.'/sitemap'.$this->suffix.'_index.xml', $index);
+ }
+ else
+ file_put_contents($this->dir.'/sitemap'.$this->suffix.'.xml', $this->data.$this->foot);
+ //восстанавливаем значения
+ $this->data = $this->head;
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ $this->curFileNum = 0;
+ }
+
+ /**
+ * Переключаемся на следующий файл
+ */
+ private function nextFile()
+ {
+ $this->curFileNum++;
+ file_put_contents($this->dir.'/sitemap'.$this->suffix.$this->curFileNum.'.xml', $this->data.$this->foot);
+ //восстанавливаем значения
+ $this->data = $this->head;
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ }
+
+ /** @var integer Текущий номер файла */
+ private $curFileNum;
+ /** @var string Директория */
+ private $dir;
+
+ /** @var string Префикс урла */
+ private $prefix;
+ /** @var string Суффикс файла */
+ private $suffix;
+ /** @var string генерируемый сайтмап */
+ private $data;
+ /** @var integer осталось адресов */
+ private $last_urls;
+ /** @var integer осталось байт */
+ private $last_len;
+ /** @var integer Размер без шапок */
+ private $realsize;
+ /** @var string шапка */
+ private $head = '<?xml version="1.0" encoding="UTF-8"?><urlset
+ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
+ http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
+ /** @var string футер */
+ private $foot = '</urlset>';
+
+
+}
commit bacb508b934df994d3c6090dc73b8b88e530c197
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Feb 1 18:03:14 2011 +0300
Фикс джаббера
diff --git a/lib/XMPPHP/XMPP.php b/lib/XMPPHP/XMPP.php
index 3e94286..c9b7aea 100644
--- a/lib/XMPPHP/XMPP.php
+++ b/lib/XMPPHP/XMPP.php
@@ -86,7 +86,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
/**
* @var boolean
*/
- protected $use_encryption = true;
+ protected $use_encryption = false;
/**
* @var boolean
@@ -138,6 +138,11 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
$this->roster = new Roster();
$this->track_presence = true;
+ $transports = stream_get_transports();
+ $transports = array_flip($transports);
+ if (isset($transports['sslv2']) || isset($transports['sslv3']))
+ $this->use_encryption = true;
+
$this->stream_start = '<stream:stream to="' . $server . '" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">';
$this->stream_end = '</stream:stream>';
$this->default_ns = 'jabber:client';
commit 63bd585f28ecd53760bda6a89111e03c07df05aa
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Jan 28 19:09:01 2011 +0300
Новое определение модуля
diff --git a/QFW/QuickFW/Autoload.php b/QFW/QuickFW/Autoload.php
index ea5200c..9ede401 100644
--- a/QFW/QuickFW/Autoload.php
+++ b/QFW/QuickFW/Autoload.php
@@ -37,11 +37,11 @@ class Autoload
{
$file =
strtolower(mb_substr($class, 0, $pos)).
- '/controllers/'.
+ '/'.QuickFW_Router::CONTROLLERS_DIR.'/'.
ucfirst(mb_substr($class, $pos+1));
}
else
- $file = QFW::$router->cModule.'/controllers/'.$class;
+ $file = QFW::$router->cModule.'/'.QuickFW_Router::CONTROLLERS_DIR.'/'.$class;
require APPPATH.'/'.$file.'.php';
return true;
}
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index de70c54..4ad2f98 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -16,6 +16,11 @@ class QuickFW_Router
*/
const PATH_SEPARATOR = '/';
+ /**
+ * @var string Папка контроллеров в модуле
+ */
+ const CONTROLLERS_DIR = 'controllers';
+
protected $classes=array();
protected $baseDir;
@@ -440,7 +445,7 @@ SREG;
$path = $this->baseDir.'/'.$MCA['Module'];
QFW::$view->setScriptPath($path.'/templates');
$class = ucfirst($MCA['Controller']).'Controller';
- $fullname = $path . '/controllers/' . strtr($class,'_','/') . '.php';
+ $fullname = $path . '/' . self::CONTROLLERS_DIR . '/' .strtr($class,'_','/') . '.php';
require_once($fullname);
$class_key=$MCA['Module'].'|'.$MCA['Controller'];
if (!isset($this->classes[$class_key]))
@@ -455,7 +460,7 @@ SREG;
$MCA = array();
//Определяем модуль
- if (isset($data[0]) && (is_dir($this->baseDir . '/' . $data[0])))
+ if (isset($data[0]) && (is_dir($this->baseDir . '/' . $data[0] . '/' . self::CONTROLLERS_DIR . '/')))
$MCA['Module'] = array_shift($data);
else
$MCA['Module'] = $type=='Block' ? $this->curModule : $this->defM;
@@ -469,7 +474,7 @@ SREG;
$cname = isset($data[0]) ? $data[0] : ($type=='Block' ? $this->curController : $this->defC);
$class = ucfirst($cname).'Controller';
- $fullname = $path . '/controllers/' . strtr($class,'_','/') . '.php';
+ $fullname = $path . '/' . self::CONTROLLERS_DIR . '/' . strtr($class,'_','/') . '.php';
if (is_file($fullname))
array_shift($data);
@@ -477,7 +482,7 @@ SREG;
{
$cname = $type=='Block' ? $this->curController : $this->defC;
$class = ucfirst($cname).'Controller';
- $fullname = $path . '/controllers/' . $class . '.php';
+ $fullname = $path . '/' . self::CONTROLLERS_DIR . '/' . $class . '.php';
if (!is_file($fullname))
{
$MCA['Error']="не найден файл \t\t\t".$fullname."\nФайл не найден, твою дивизию...";
diff --git a/doc/asciidoc/mvc.txt b/doc/asciidoc/mvc.txt
index 16f5f78..5190b8a 100644
--- a/doc/asciidoc/mvc.txt
+++ b/doc/asciidoc/mvc.txt
@@ -4,13 +4,15 @@ MVC и преобразование адресов в контроллеры
Рассмотрим разбор URI при запросе:
По умолчанию разделителем компонентов является +/+, однако помимо него можно указать произвольный символ.
-Это бывает полезно в случае, если сайт пишется не с нуля, а используются шаблоны с относительной адресацией и весь сайт находится на одном уровне, тем самым можно использовать старые шаблоны, пока адреса не изменятся.
+Это бывает полезно в случае, если сайт пишется не с нуля, а используются шаблоны с относительной адресацией и весь сайт находится на одном уровне,
+тем самым можно использовать старые шаблоны, пока адреса не изменятся.
При разборе адреса он разбивается на компоненты и они анализируются по очереди. Рассмотрим компоненты адреса:
module/controller/action/p1/p2/p3
- * Первым идет модуль - в папке +application+ ищется папка с именем модуля, если же ее нет, то выбирается модуль по умолчанию (+default+).
+ * Первым идет модуль - в папке +application+ ищется папка с именем модуля, содержащая папку +controllers+ (+QuickFW_Router::CONTROLLERS_DIR+),
+ если же ее нет, то выбирается модуль по умолчанию (+default+).
* Контроллер - в текущем модуле в папке +controllers+ проверяется наличие файла +NameСontroller+, если его нет, то используется файл +IndexСontroller+.
* После подключения файла контроллера проверяется наличие класса +NameСontroller+, а если его нет, то проверяется его наличие в пространстве имен с именем модуля.
* Если класс не найден, а файл существует, то выводится сообщение об ошибке.
@@ -22,6 +24,8 @@ MVC и преобразование адресов в контроллеры
отправлены на действие по умолчанию (+default/index/index+), однако есть опция +$config[\'QFW'][\'auto404']+, и если она установлена,
то на все запросы пришедшие на действие по умолчанию кромя запроса к корню будет выдана страница 404.
+Если в папке, находящейся в +application+ нету папки +controllers+, то она не считается модулем.
+
Несколько примеров.
.Разбор обычного URI вызванного через http
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 3 +-
QFW/Init.php | 31 ++++++++++-
QFW/QuickFW/Autoload.php | 4 +-
QFW/QuickFW/Router.php | 13 +++-
doc/asciidoc/mvc.txt | 8 ++-
lib/Sitemap.php | 137 ++++++++++++++++++++++++++++++++++++++++++++++
lib/XMPPHP/XMPP.php | 7 ++-
7 files changed, 192 insertions(+), 11 deletions(-)
create mode 100644 lib/Sitemap.php
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2011-01-31 19:08:21
|
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 d8ae62b53971e4e59359059f22754f2beefff373 (commit)
from 5fa1d8f23e0ec33fe521dd60bfd5c97604f9d6b5 (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 d8ae62b53971e4e59359059f22754f2beefff373
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Jan 26 13:04:09 2011 +0300
Исправлена ошибка при совпадающих полях в связанной таблице
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 7582a3c..f10a049 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -274,7 +274,7 @@ abstract class ScaffoldController extends Controller
$foreign = $this->getForeign();
$data = QFW::$db->select('SELECT ?# AS ARRAY_KEY, ?# ?s FROM ?# ?s
WHERE ?s ?s '.$this->where.' ?s LIMIT ?d, ?d',
- $this->primaryKey, array($this->table=>array_merge($this->order, array('*'))),
+ array($this->table=>$this->primaryKey), array($this->table=>array_merge($this->order, array('*'))),
$foreign['field'], $this->table, $foreign['join'],
$filter['where'], $parentWhere,
$this->getSort(),
-----------------------------------------------------------------------
Summary of changes:
lib/Modules/Scaffold/ScaffoldController.php | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2011-01-21 21:21:47
|
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 5fa1d8f23e0ec33fe521dd60bfd5c97604f9d6b5 (commit)
via 26b0b87b199910f5d647b9149cd2e698c1036884 (commit)
via 0895cd4eaca51491b2ced2c2136ccb18a86c984a (commit)
via b7728f97fdffbc4a9026861cbac47a73a629eaab (commit)
from d5b36acee01ffaeb1dbdc7d956ad4c852e53d522 (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 5fa1d8f23e0ec33fe521dd60bfd5c97604f9d6b5
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Jan 21 18:18:23 2011 +0300
Ошибка в скафолде
diff --git a/lib/Modules/Scaffold/scaffold/edit.php b/lib/Modules/Scaffold/scaffold/edit.php
index 8fe2e49..14358d8 100644
--- a/lib/Modules/Scaffold/scaffold/edit.php
+++ b/lib/Modules/Scaffold/scaffold/edit.php
@@ -1,6 +1,6 @@
<?php require dirname(__FILE__).'/info.php' ?>
<?php echo $this->block(Url::C('preForm'), $id); ?>
-<form class="scaffoldEdit" action="<?php echo Url::C('edit/-1') ?>"
+<form class="scaffoldEdit" action="<?php echo Url::C('edit/'.$id) ?>"
method="post" id="form_<?php echo $table ?>" enctype="multipart/form-data">
<?php echo $this->block(Url::C('preEdit'), $id); ?>
<dl>
commit 26b0b87b199910f5d647b9149cd2e698c1036884
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Jan 21 14:00:08 2011 +0300
Фикс мультиедита с селектами
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index ec52a97..7582a3c 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -468,13 +468,9 @@ abstract class ScaffoldController extends Controller
$state = new TemplaterState(QFW::$view);
QFW::$view->setScriptPath(dirname(__FILE__));
- $foreign = $this->getForeign();
- $data = QFW::$db->select('SELECT ?# AS ARRAY_KEY, ?# ?s FROM ?# ?s
- WHERE ?# IN (?a) ?s',
+ $data = QFW::$db->select('SELECT ?# AS ARRAY_KEY, ?# FROM ?# WHERE ?# IN (?a) ?s',
$this->primaryKey, array($this->table=>array_merge($this->order, array('*'))),
- $foreign['field'], $this->table, $foreign['join'],
- $this->primaryKey, $ids,
- $this->getSort());
+ $this->table, $this->primaryKey, $ids, $this->getSort());
return QFW::$view->assign(array(
'data' => $data,
))->fetch('scaffold/multiedit.php');
commit 0895cd4eaca51491b2ced2c2136ccb18a86c984a
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Jan 21 13:34:01 2011 +0300
Правки скафолдинга
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 4c21851..ec52a97 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -127,6 +127,9 @@ abstract class ScaffoldController extends Controller
*/
public function __construct()
{
+ //инициализация FormPersister
+ require_once LIBPATH.'/HTML/FormPersister.php';
+ ob_start(array(new HTML_FormPersister(), 'process'));
$this->row = array();
Hlp::addCSS('built-in/scaffold.css');
if ($this->useJs)
@@ -278,11 +281,7 @@ abstract class ScaffoldController extends Controller
$page*$this->pageSize, $this->pageSize);
if (count($filter['form']))
- {
- require_once LIBPATH.'/HTML/FormPersister.php';
- ob_start(array(new HTML_FormPersister(), 'process'));
QFW::$view->assign('filter', $filter['form']);
- }
//получаем пагинатор
$pages = ceil($count/$this->pageSize);
$pager=QFW::$router->blockRoute('helper.nav.pager', Url::A('$'), $pages, $page+1);
@@ -300,10 +299,6 @@ abstract class ScaffoldController extends Controller
*/
public function newBlock()
{
- //инициализация FormPersister
- /*require_once LIBPATH.'/HTML/FormPersister.php';
- ob_start(array(new HTML_FormPersister(), 'process'));*/
-
//получение дефолтовых значений для новой записи
$data = array();
$fields = array();
@@ -339,9 +334,6 @@ abstract class ScaffoldController extends Controller
*/
public function editAction($id=-1)
{
- //инициализация FormPersister
- require_once LIBPATH.'/HTML/FormPersister.php';
- ob_start(array(new HTML_FormPersister(), 'process'));
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_POST['data'][$id])>0)
@@ -454,8 +446,6 @@ abstract class ScaffoldController extends Controller
if (empty($this->sess['multi']['ids']))
QFW::$router->redirect(Url::C('index'));
$ids = $this->sess['multi']['ids'];
- require_once LIBPATH.'/HTML/FormPersister.php';
- ob_start(array(new HTML_FormPersister(), 'process'));
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['edit']))
{
diff --git a/lib/Modules/Scaffold/scaffold/edit.php b/lib/Modules/Scaffold/scaffold/edit.php
index 44d4219..8fe2e49 100644
--- a/lib/Modules/Scaffold/scaffold/edit.php
+++ b/lib/Modules/Scaffold/scaffold/edit.php
@@ -1,6 +1,6 @@
<?php require dirname(__FILE__).'/info.php' ?>
<?php echo $this->block(Url::C('preForm'), $id); ?>
-<form class="scaffoldEdit"
+<form class="scaffoldEdit" action="<?php echo Url::C('edit/-1') ?>"
method="post" id="form_<?php echo $table ?>" enctype="multipart/form-data">
<?php echo $this->block(Url::C('preEdit'), $id); ?>
<dl>
@@ -8,13 +8,13 @@
<?php echo $this->block(Url::C('preEditField'.ucfirst($k)), $id); ?>
<?php
$i = $fields[$k];
- if ( ($id == -1 && !$i->disp->new) && (!$i->disp->edit))
+ if ( ($id == -1 && !$i->disp->new) || ($id != -1 && !$i->disp->edit))
continue;
//по умолчанию первичный ключ не редактируем, но если принудительно установим показ
if (!$i->primaryKey && !($i->hide === false))
continue;
?>
- <label>
+ <?php if ($i->label) { ?><label><?php } ?>
<dt<?php if (isset($errors[$k])) echo ' class="err"'; ?>>
<?php echo $i->title ?><?php
if ($i->required) {?><span class="required"></span><?php }
@@ -26,7 +26,7 @@
echo $i->editor($id, $v); ?>
<?php if ($i->desc) {?><small><?php echo $i->desc ?></small><?php } ?>
</dd>
- </label>
+ <?php if ($i->label) { ?></label><?php } ?>
<?php } ?>
<?php echo $this->block(Url::C('preSend'), $id); ?>
<dt></dt>
diff --git a/lib/Modules/Scaffold/scaffold/multidel.php b/lib/Modules/Scaffold/scaffold/multidel.php
index 23df76f..f6014cb 100644
--- a/lib/Modules/Scaffold/scaffold/multidel.php
+++ b/lib/Modules/Scaffold/scaffold/multidel.php
@@ -7,7 +7,7 @@
<tr>
<?php foreach(current($data) as $key=>$v) {
$i = $fields[$key];
- if ($i->hide)
+ if (!$i->disp->multidel)
continue;
$cols++;
?>
@@ -20,7 +20,7 @@
<tr>
<?php foreach($row as $key=>$v) {
$i = $fields[$key];
- if ($i->hide)
+ if (!$i->disp->multidel)
continue;
?>
<td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>><?php //отображение обычного не связанного поля
diff --git a/lib/Modules/Scaffold/scaffold/multiedit.php b/lib/Modules/Scaffold/scaffold/multiedit.php
index 1a58082..5d1079f 100644
--- a/lib/Modules/Scaffold/scaffold/multiedit.php
+++ b/lib/Modules/Scaffold/scaffold/multiedit.php
@@ -7,7 +7,7 @@
<tr>
<?php foreach(current($data) as $key=>$v) {
$i = $fields[$key];
- if ($i->hide)
+ if (!$i->disp->multiedit)
continue;
if (!$i->primaryKey && !($i->hide === false))
continue;
@@ -23,7 +23,7 @@
<tr>
<?php foreach($row as $key=>$v) {
$i = $fields[$key];
- if ($i->hide)
+ if (!$i->disp->multiedit)
continue;
if (!$i->primaryKey && !($i->hide === false))
continue;
commit b7728f97fdffbc4a9026861cbac47a73a629eaab
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Jan 21 13:10:39 2011 +0300
Исправлена ошибка в условии показа поля
diff --git a/lib/Modules/Scaffold/scaffold/edit.php b/lib/Modules/Scaffold/scaffold/edit.php
index 163183f..44d4219 100644
--- a/lib/Modules/Scaffold/scaffold/edit.php
+++ b/lib/Modules/Scaffold/scaffold/edit.php
@@ -8,9 +8,7 @@
<?php echo $this->block(Url::C('preEditField'.ucfirst($k)), $id); ?>
<?php
$i = $fields[$k];
- if ($id == -1 && !$i->disp->new)
- continue;
- if (!$i->disp->edit)
+ if ( ($id == -1 && !$i->disp->new) && (!$i->disp->edit))
continue;
//по умолчанию первичный ключ не редактируем, но если принудительно установим показ
if (!$i->primaryKey && !($i->hide === false))
-----------------------------------------------------------------------
Summary of changes:
lib/Modules/Scaffold/ScaffoldController.php | 24 +++++-------------------
lib/Modules/Scaffold/scaffold/edit.php | 10 ++++------
lib/Modules/Scaffold/scaffold/multidel.php | 4 ++--
lib/Modules/Scaffold/scaffold/multiedit.php | 4 ++--
4 files changed, 13 insertions(+), 29 deletions(-)
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2011-01-13 11:39:57
|
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 d5b36acee01ffaeb1dbdc7d956ad4c852e53d522 (commit)
from e0e506b8b45546f88287222d045c44b7d0b5d19e (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 d5b36acee01ffaeb1dbdc7d956ad4c852e53d522
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Jan 13 14:38:32 2011 +0300
Автолоад слотов и тегов
diff --git a/QFW/QuickFW/Autoload.php b/QFW/QuickFW/Autoload.php
index a0cf4d4..ea5200c 100644
--- a/QFW/QuickFW/Autoload.php
+++ b/QFW/QuickFW/Autoload.php
@@ -17,6 +17,7 @@ class Autoload
spl_autoload_register(array(__CLASS__, 'Bind'));
spl_autoload_register(array(__CLASS__, 'Dirs'));
spl_autoload_register(array(__CLASS__, 'Controller'));
+ spl_autoload_register(array(__CLASS__, 'SlotsAndTags'));
if (is_callable($function))
spl_autoload_register($function);
}
@@ -59,6 +60,8 @@ class Autoload
'ScaffoldController' => LIBPATH.'/Modules/Scaffold/ScaffoldController.php',
'QuickFW_Auth' => QFWPATH.'/QuickFW/Auth.php',
'Hlp' => QFWPATH.'/QuickFW/Helpers.php',
+ 'Dklab_Cache_Frontend_Slot' => QFWPATH.'/QuickFW/Cacher/Slot.php',
+ 'Dklab_Cache_Frontend_Tag' => QFWPATH.'/QuickFW/Cacher/Tag.php',
);
if (empty(self::$classes[$class]))
return false;
@@ -66,6 +69,26 @@ class Autoload
return true;
}
+ /**
+ * Автолоад слотов и тегов
+ *
+ * @param string $class искомый класс
+ */
+ static public function SlotsAndTags($class)
+ {
+ if (strpos($class, 'Slot_') === 0)
+ {
+ require APPPATH.'/_common/slots/'.substr($class, 5).'.php';
+ return true;
+ }
+ if (strpos($class, 'Tag_') === 0)
+ {
+ require APPPATH.'/_common/tags/'.substr($class, 4).'.php';
+ return true;
+ }
+ return false;
+ }
+
/** @var array соответствие классов и файлов */
static private $classes;
-----------------------------------------------------------------------
Summary of changes:
QFW/QuickFW/Autoload.php | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2011-01-11 11:33:32
|
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 e0e506b8b45546f88287222d045c44b7d0b5d19e (commit)
via d1b5f408b1ce297df33e3ca832655c7bf36cca0f (commit)
via 82a869a23d2b9f0157ec8d87a85769446e81503c (commit)
from c464926bd305acddc990d7c808ac524d18d3e855 (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 e0e506b8b45546f88287222d045c44b7d0b5d19e
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Jan 11 14:29:49 2011 +0300
Не использовать кеш в compass и Make файл для генерации продакшена
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0e89d7b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+#мейк файл для основных действий
+
+all:
+ php cron/start.php css/gen
+ php cron/start.php js/gen
+ - compass compile -e production --force
+ #- compass compile --output-style compressed --force
+
+daemon:
+ - compass watch
+
+clean: compass_clean
+ php cron/start.php css/clean
+ php cron/start.php js/clean
+
+compass_clean:
+ - find application/_common/css -name '*.s[ac]ss' | sed 's/application\/_common/www/' | sed 's/\.s[ac]ss/\.css/' | xargs -I'{}' rm {}
+
+.PHONY:
+ clean compass_clean
\ No newline at end of file
diff --git a/config.rb b/config.rb
index 454a4d7..1981215 100644
--- a/config.rb
+++ b/config.rb
@@ -7,3 +7,6 @@ images_dir = "www/img"
javascripts_dir = "www/js"
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
+
+sass_options = { :cache => false }
+
commit d1b5f408b1ce297df33e3ca832655c7bf36cca0f
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Jan 11 14:29:15 2011 +0300
Расширения файлов scss.php и js.php для генеримых
diff --git a/application/default/controllers/CssController.php b/application/default/controllers/CssController.php
index 4374492..d5f0651 100644
--- a/application/default/controllers/CssController.php
+++ b/application/default/controllers/CssController.php
@@ -30,7 +30,7 @@ class CssController
QFW::$view->mainTemplate = '';
$args = func_get_args();
$css = implode('/', $args);
- $scss = str_replace('.css', '.scss', $css);
+ $scss = str_replace('.css', '.scss.php', $css);
if (!is_file($this->path.'/'.$scss))
QFW::$router->show404();
@@ -61,14 +61,17 @@ class CssController
$ret = false;
chdir($this->path);
QFW::$view->setScriptPath($this->path);
- exec('find . -name \'*.scss\'', $out, $ret);
+ exec('find . -name \'*.scss.php\'', $out, $ret);
if ($ret)
return;
foreach ($out as $file)
{
- $css = str_replace('.scss', '.css', $file);
+ $css = str_replace(
+ array('.scss.php', './'),
+ array('.css', DOC_ROOT.'/css/'),
+ $file);
$text = QFW::$view->fetch($file);
- exec('echo '.escapeshellarg($text).' | '.self::SASS.' 2>&1 | unexpand -t2 --first-only > '.DOC_ROOT.'/css/'.$css, $out, $ret);
+ exec('echo '.escapeshellarg($text).' | '.self::SASS.' 2>&1 | unexpand -t2 --first-only > '.$css, $out, $ret);
}
}
@@ -80,13 +83,13 @@ class CssController
$out = array();
$ret = false;
chdir($this->path);
- exec('find . -name \'*.scss\'', $out, $ret);
+ exec('find . -name \'*.scss.php\'', $out, $ret);
if ($ret)
return;
foreach ($out as $file)
{
$css = str_replace(
- array('.scss', './'),
+ array('.scss.php', './'),
array('.css', DOC_ROOT.'/css/'),
$file);
if (is_file($css))
diff --git a/application/default/controllers/JsController.php b/application/default/controllers/JsController.php
index 798906f..fd772dc 100644
--- a/application/default/controllers/JsController.php
+++ b/application/default/controllers/JsController.php
@@ -25,12 +25,13 @@ class JsController
QFW::$view->mainTemplate = '';
$args = func_get_args();
$js = implode('/', $args);
- if (!is_file($this->path.'/'.$js))
+ $jsp = str_replace('.js', '.js.php', $js);
+ if (!is_file($this->path.'/'.$jsp))
QFW::$router->show404();
header('Content-Type: application/javascript');
QFW::$view->setScriptPath($this->path);
- $text = QFW::$view->fetch($js);
+ $text = QFW::$view->fetch($jsp);
return $text;
}
@@ -44,11 +45,14 @@ class JsController
$ret = false;
chdir($this->path);
QFW::$view->setScriptPath($this->path);
- exec('find . -name \'*.js\'', $out, $ret);
+ exec('find . -name \'*.js.php\'', $out, $ret);
if ($ret)
return;
foreach ($out as $file)
- file_put_contents(DOC_ROOT.'/js/'.$file, QFW::$view->fetch($file));
+ {
+ $js = str_replace('.js.php', '.js', $file);
+ file_put_contents(DOC_ROOT.'/js/'.$js, QFW::$view->fetch($file));
+ }
}
/**
@@ -59,12 +63,15 @@ class JsController
$out = array();
$ret = false;
chdir($this->path);
- exec('find . -name \'*.js\'', $out, $ret);
+ exec('find . -name \'*.js.php\'', $out, $ret);
if ($ret)
return;
foreach ($out as $file)
{
- $js = str_replace('./', DOC_ROOT.'/js/', $file);
+ $js = str_replace(
+ array('.js.php', './'),
+ array('.js', DOC_ROOT.'/css/'),
+ $file);
if (is_file($js))
unlink($js);
}
commit 82a869a23d2b9f0157ec8d87a85769446e81503c
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Jan 11 14:11:30 2011 +0300
Поправил пути в кроне
diff --git a/cron/cruise.php b/cron/cruise.php
index 3da151c..b270253 100644
--- a/cron/cruise.php
+++ b/cron/cruise.php
@@ -1,6 +1,6 @@
<?php
- define ('DOC_ROOT', realpath(dirname(__FILE__).'../www'));
- define ('ROOTPATH', realpath(dirname(__FILE__).'/../'));
+ define ('DOC_ROOT', dirname(dirname(__FILE__)).'/www');
+ define ('ROOTPATH', dirname(dirname(__FILE__)));
define ('APPPATH', ROOTPATH . '/application');
define ('VARPATH', ROOTPATH . '/var');
define ('QFWPATH', ROOTPATH . '/QFW');
diff --git a/cron/start.php b/cron/start.php
index 34453ab..9afe7ce 100644
--- a/cron/start.php
+++ b/cron/start.php
@@ -1,6 +1,6 @@
<?php
- define ('DOC_ROOT', realpath(dirname(__FILE__).'../www'));
- define ('ROOTPATH', realpath(dirname(__FILE__).'/../'));
+ define ('DOC_ROOT', dirname(dirname(__FILE__)).'/www');
+ define ('ROOTPATH', dirname(dirname(__FILE__)));
define ('APPPATH', ROOTPATH . '/application');
define ('VARPATH', ROOTPATH . '/var');
define ('QFWPATH', ROOTPATH . '/QFW');
-----------------------------------------------------------------------
Summary of changes:
Makefile | 20 ++++++++++++++++++++
application/default/controllers/CssController.php | 15 +++++++++------
application/default/controllers/JsController.php | 19 +++++++++++++------
config.rb | 3 +++
cron/cruise.php | 4 ++--
cron/start.php | 4 ++--
6 files changed, 49 insertions(+), 16 deletions(-)
create mode 100644 Makefile
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2011-01-10 16:15:47
|
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 c464926bd305acddc990d7c808ac524d18d3e855 (commit)
from f16c6770b72325d28ad12410d919b5330416ee76 (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 c464926bd305acddc990d7c808ac524d18d3e855
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Jan 10 14:23:40 2011 +0300
Конфиг для Compass (http://compass-style.org/)
diff --git a/config.rb b/config.rb
new file mode 100644
index 0000000..454a4d7
--- /dev/null
+++ b/config.rb
@@ -0,0 +1,9 @@
+# Require any additional compass plugins here.
+# Set this to the root of your project when deployed:
+http_path = "www"
+css_dir = "www/css"
+sass_dir = "application/_common/css"
+images_dir = "www/img"
+javascripts_dir = "www/js"
+# To enable relative paths to assets via compass helper functions. Uncomment:
+# relative_assets = true
-----------------------------------------------------------------------
Summary of changes:
config.rb | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 config.rb
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-12-28 15:35:26
|
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 f16c6770b72325d28ad12410d919b5330416ee76 (commit)
via 3e95eb5137dbae0b6e38ce5941667b633f321940 (commit)
via 9c6f266fb030c0e39829d4b786b99d332f16b288 (commit)
via 17c39014c6405068cc319a32f94d480438904c38 (commit)
via 9aacc8770d3f13233b3c07a57a0cad80a0a5fc5c (commit)
via c15bb6dc573bc110389c12172a1335bda23025ec (commit)
via b91283e9fd469896e5f082896c8b83e4957dce82 (commit)
via 66dbd1236ef86711e84abc5e5f2b79acee7d2eea (commit)
via 28c5d6e56fe950ad3a9c5d29fc31d6b9579c31e3 (commit)
via 8a97e39d76fd14767ce0bdc36ed5b7f7f770def9 (commit)
via cb7910326b4baf3cb4e4285bf697f6251ce9b0b5 (commit)
via fc359e1604e526ff18edad012adff8346a3f02a4 (commit)
via b88291c2a508353270af01c803612c6cd0b7a3ec (commit)
via f4c104f3504ae86db111803ac34730c66978e86f (commit)
via 372e4fff0ad087e01aea21e39ba2264c21dcbf03 (commit)
via 591e3944de40be7a6a2363e375989f2175807068 (commit)
via bf17b4da56c86e1a000179b282a60c6bbb31569e (commit)
from 47b65efefa33e3583f8f0ebc5108e1609d7899bb (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 f16c6770b72325d28ad12410d919b5330416ee76
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 16:56:21 2010 +0300
Удалена старая функция управления кешами
diff --git a/QFW/QuickFW/Cache.php b/QFW/QuickFW/Cache.php
index f369fd1..3f66fd0 100644
--- a/QFW/QuickFW/Cache.php
+++ b/QFW/QuickFW/Cache.php
@@ -200,46 +200,6 @@ class Cache
}
-/**
- * нужна для того, что сессии используют кешер и они записывают данные
- * после уничтожения всех обьектов, кешер пересоздается заново
- * для записи сессий
- *
- * @deprecated Используйте Cache::get()
- */
-function &getCache($backend='',$opt=array(),$tags=false,$namespace='')
-{
- trigger_error('Используйте Cache::get()', E_USER_DEPRECATED);
- global $config;
- static $cachers=array();
- if ($backend=='')
- $backend=ucfirst($config['cacher']['module']);
- $key=crc32(serialize(func_get_args()));
- if (isset($cachers[$key]))
- return $cachers[$key];
-
- $cl='Cacher_'.$backend;
- require_once(QFWPATH.'/Cacher/'.$backend.'.php');
- $c=new $cl;
-
- if (isset($config['cacher']['options']))
- $opt = array_merge($config['cacher']['options'],$opt);
- $c->setDirectives($opt);
-
- if ($namespace!='')
- {
- require_once(QFWPATH.'/QuickFW/Cacher/Namespace.php');
- $c=new Dklab_Cache_Backend_NamespaceWrapper($c,$namespace);
- }
- if ($tags)
- {
- require_once(QFWPATH.'/QuickFW/Cacher/TagEmu.php');
- $c=new Dklab_Cache_Backend_TagEmuWrapper($c);
- }
- $cachers[$key]=&$c;
- return $cachers[$key];
-}
-
class Cache_Thru
{
private $_cacher, $_obj, $_id, $_tags, $_lt;
diff --git a/QFW/config.php b/QFW/config.php
index e2ec504..7dd0e6e 100644
--- a/QFW/config.php
+++ b/QFW/config.php
@@ -68,9 +68,6 @@ $config['session'] = array(
//'httponly' => false,
);
-$config['cacher']=array(
- 'module' => 'File',
-);
$config['cache'] = array(
'default' => array(
'module' => 'File',
diff --git a/application/default.php b/application/default.php
index bf84612..e24e60e 100644
--- a/application/default.php
+++ b/application/default.php
@@ -59,23 +59,12 @@ $config['error'][] = array(
$config['error'] = false;
/**
- * Настройки кешера (класс бекенда и дополнительные параметры, если есть)
- *
- * @deprecated лучше юзайте новый кешер
- */
-$config['cacher']=array(
- 'module' => 'Bdb',
- 'options' => array(
- 'file'=>'ttt',
- ),
-);
-/**
* Настройки кешеров
* Массив из названий, обязателен default
*/
$config['cache'] = array(
'default' => array(
- 'module' => 'Bdb',
+ 'module' => 'File',
'namespace' => '',
'tags' => false,
),
commit 3e95eb5137dbae0b6e38ce5941667b633f321940
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 16:37:25 2010 +0300
Конфиг для ошибок
diff --git a/application/default.php b/application/default.php
index 0f63902..bf84612 100644
--- a/application/default.php
+++ b/application/default.php
@@ -35,7 +35,7 @@ $config['redirection']=array(
/**
* Настройки обработчика ошибок
*/
-$config['error'] = array();
+/*$config['error'] = array();
$config['error'][] = array(
'name' => 'mail',
'RemoveDups' => 300, //секунд или false
@@ -46,6 +46,16 @@ $config['error'][] = array(
'charset' => 'UTF-8',
),
);
+$config['error'][] = array(
+ 'name' => 'log',
+ 'RemoveDups' => 300, //секунд или false
+ 'options' => array(
+ 'to' => 'error',
+ 'whatToSend' => 65535, // LOG_ALL (look in TextNotifier)
+ 'subjPrefix' => '[ERROR] ',
+ 'charset' => 'UTF-8',
+ ),
+);*/
$config['error'] = false;
/**
commit 9c6f266fb030c0e39829d4b786b99d332f16b288
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 16:31:41 2010 +0300
Инициализация логера ошибок + новые логеры ошибок - в лог и в jabber
diff --git a/QFW/Init.php b/QFW/Init.php
index 08d8599..7b2023d 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -141,17 +141,12 @@ class QFW
$name = ucfirst($handler['name']);
require_once LIBPATH.'/Debug/ErrorHook/'.$name.'Notifier.php';
//пока так, потом возможно придется переделать
- if ($name == 'Mail')
{
- $i = new Debug_ErrorHook_MailNotifier(
+ $class = 'Debug_ErrorHook_'.$name.'Notifier';
+ $i = new $class(
$handler['options']['to'], $handler['options']['whatToSend'],
$handler['options']['subjPrefix'], $handler['options']['charset']);
}
- else
- {
- $class = 'Debug_ErrorHook_'.$name.'Notifier';
- $i = new $class($handler['options']['whatToSend']);
- }
if ($handler['RemoveDups'])
{
require_once LIBPATH.'/Debug/ErrorHook/RemoveDupsWrapper.php';
diff --git a/lib/Debug/ErrorHook/JabberNotifier.php b/lib/Debug/ErrorHook/JabberNotifier.php
new file mode 100644
index 0000000..77643f3
--- /dev/null
+++ b/lib/Debug/ErrorHook/JabberNotifier.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Sends all notifications to a specified jabber.
+ *
+ * Consider using this class together with Debug_ErrorHook_RemoveDupsWrapper
+ * to avoid mail server flooding when a lot of errors arrives.
+ */
+
+require_once dirname(__FILE__).'/Util.php';
+require_once dirname(__FILE__).'/TextNotifier.php';
+
+class Debug_ErrorHook_JabberNotifier extends Debug_ErrorHook_TextNotifier
+{
+ private $_to;
+ private $_charset;
+ private $_whatToSend;
+ private $_subjPrefix;
+ private static $messages=array();
+
+ public function __construct($to, $whatToSend, $subjPrefix = "[ERROR] ", $charset = "UTF-8")
+ {
+ parent::__construct($whatToSend);
+ $this->_to = $to;
+ $this->_subjPrefix = $subjPrefix;
+ $this->_charset = $charset;
+ }
+
+ protected function _notifyText($subject, $body)
+ {
+ $str = $this->_subjPrefix . $subject . "\n\n".$body;
+ self::$messages[$this->_to][]=$str;
+ }
+
+ /**
+ * Отправляет очередь сообщений
+ * <br>нужно в случае длительной работы и отправке в jabber
+ */
+ private static function sendQuery()
+ {
+ if (count(self::$messages))
+ {
+ if (!isset(QFW::$config['jabber']))
+ error_log('Jabber не настроен ');
+ else
+ {
+ $J = QFW::JabberFromConfig();
+ $J->connect();
+ $J->processUntil('session_start',10);
+ $J->presence();
+ foreach (self::$messages as $k=>$msg)
+ $J->message($k, join("\n",$msg));
+ $J->disconnect();
+ }
+ self::$messages = array();
+ }
+ }
+
+ public function __destruct()
+ {
+ self::sendQuery();
+ }
+
+}
diff --git a/lib/Debug/ErrorHook/LogNotifier.php b/lib/Debug/ErrorHook/LogNotifier.php
new file mode 100644
index 0000000..07f71dd
--- /dev/null
+++ b/lib/Debug/ErrorHook/LogNotifier.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Sends all notifications to a specified jabber.
+ *
+ * Consider using this class together with Debug_ErrorHook_RemoveDupsWrapper
+ * to avoid mail server flooding when a lot of errors arrives.
+ */
+
+require_once dirname(__FILE__).'/Util.php';
+require_once dirname(__FILE__).'/TextNotifier.php';
+require_once LIBPATH.'/Log.php';
+
+class Debug_ErrorHook_LogNotifier extends Debug_ErrorHook_TextNotifier
+{
+ private $_to;
+ private $_charset;
+ private $_whatToSend;
+ private $_subjPrefix;
+ private static $messages=array();
+
+ public function __construct($to, $whatToSend, $subjPrefix = "[ERROR] ", $charset = "UTF-8")
+ {
+ parent::__construct($whatToSend);
+ $this->_to = $to;
+ $this->_subjPrefix = $subjPrefix;
+ $this->_charset = $charset;
+ }
+
+ protected function _notifyText($subject, $body)
+ {
+ $str = $this->_subjPrefix . $subject . "\n".$body;
+ Log::out($str, $this->_to);
+ }
+
+}
diff --git a/lib/Debug/ErrorHook/TextNotifier.php b/lib/Debug/ErrorHook/TextNotifier.php
index a02e670..5d0019c 100644
--- a/lib/Debug/ErrorHook/TextNotifier.php
+++ b/lib/Debug/ErrorHook/TextNotifier.php
@@ -36,7 +36,7 @@ abstract class Debug_ErrorHook_TextNotifier implements Debug_ErrorHook_INotifier
$body[] = $this->_makeSection(
"",
join("\n", array(
- (@$_SERVER['GATEWAY_INTERFACE']? "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" : ""),
+ (!empty($_SERVER['GATEWAY_INTERFACE'])? "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" : ""),
"$errno: $errstr",
"at $errfile on line $errline",
))
commit 17c39014c6405068cc319a32f94d480438904c38
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 16:31:01 2010 +0300
Исправлена ошибка создания класса jabberа
diff --git a/QFW/Init.php b/QFW/Init.php
index 941431e..08d8599 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -169,7 +169,7 @@ class QFW
static public function JabberFromConfig()
{
require_once LIBPATH.'/XMPPHP/XMPP.php';
- new XMPPHP_XMPP(
+ return new XMPPHP_XMPP(
QFW::$config['jabber']['host'], QFW::$config['jabber']['port'],
QFW::$config['jabber']['user'], QFW::$config['jabber']['pass'],
QFW::$config['jabber']['resource'], QFW::$config['jabber']['server'],
commit 9aacc8770d3f13233b3c07a57a0cad80a0a5fc5c
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 14:59:40 2010 +0300
Обнуляем все, а не только модуль
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index 81cbe70..de70c54 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -96,8 +96,10 @@ class QuickFW_Router
$data = explode(self::PATH_SEPARATOR, $requestUri);
$data = array_map('urldecode', $data);
- //обнуляем модуль - если нас вызвали повторно
+ //обнуляем если нас вызвали повторно
$this->module = '';
+ $this->controller = '';
+ $this->action = '';
$MCA = $this->loadMCA($data, $type);
if (isset($MCA['Error']))
commit c15bb6dc573bc110389c12172a1335bda23025ec
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 14:49:56 2010 +0300
404 может быть в дизайне главной
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index d66bf98..81cbe70 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -227,7 +227,10 @@ class QuickFW_Router
header((empty($_SERVER['SERVER_PROTOCOL']) ? 'HTTP/1.1 ' : $_SERVER['SERVER_PROTOCOL']).' 404 Not Found');
if (!is_file(QFW::$view->getScriptPath().'/404.php'))
QFW::$view->setScriptPath(APPPATH.'/default/templates/');
- die(QFW::$view->displayMain(QFW::$view->render('404.php')));
+ $content = QFW::$view->fetch('404.php');
+ if (!QFW::$config['QFW']['main404'])
+ QFW::$view->mainTemplate = '';
+ die(QFW::$view->displayMain($content));
}
/**
diff --git a/QFW/config.php b/QFW/config.php
index b0ff7cf..e2ec504 100644
--- a/QFW/config.php
+++ b/QFW/config.php
@@ -34,8 +34,9 @@ $config['redirection']=array(
$config['QFW'] = array(
'release' => false, /* статус проекта на данном хосте - отладка и всякие быстрые компиляции */
'cacheSessions' => false, /* Хранить сессии в кеше, не использовать стандартный механизм */
- 'autoload' => false, /* включить автолоад false|true|string */
+ 'autoload' => true, /* включить автолоад false|true|string */
'auto404' => false, /* не перенаправлять на дефолтовый контроллер все запросы */
+ 'main404' => false, /* 404 страница в дизайне main */
'addCSSXml' => false, /* addJS и addCSS выводят теги в XML */
);
diff --git a/application/default.php b/application/default.php
index 14c650c..0f63902 100644
--- a/application/default.php
+++ b/application/default.php
@@ -84,6 +84,7 @@ $config['QFW'] = array(
'cacheSessions' => false, /* Хранить сессии в кеше, не использовать стандартный механизм */
'autoload' => true, /* включить автолоад false|true|string */
'auto404' => false, /* не перенаправлять на дефолтовый контроллер все запросы */
+ 'main404' => false, /* 404 страница в дизайне main */
'addCSSXml' => false, /* addJS и addCSS выводят теги в XML */
);
commit b91283e9fd469896e5f082896c8b83e4957dce82
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 14:41:12 2010 +0300
Фикс с my_trim
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 9ad11c7..5d978d8 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -1,6 +1,7 @@
<?php
require_once LIBPATH.'/utils.php';
+require_once LIBPATH.'/Text.php';
require_once dirname(__FILE__).'/Display.php';
/**
@@ -309,7 +310,7 @@ abstract class Scaffold_UserInput extends Scaffold_Field
public function display($id, $value)
{
- return QFW::$view->esc(my_trim($value, $this->trim));
+ return QFW::$view->esc(Text::my_trim($value, $this->trim));
}
}
commit 66dbd1236ef86711e84abc5e5f2b79acee7d2eea
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 14:40:44 2010 +0300
Возможность использования блоков на 404 странице
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index 1d7d62d..d66bf98 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -227,7 +227,7 @@ class QuickFW_Router
header((empty($_SERVER['SERVER_PROTOCOL']) ? 'HTTP/1.1 ' : $_SERVER['SERVER_PROTOCOL']).' 404 Not Found');
if (!is_file(QFW::$view->getScriptPath().'/404.php'))
QFW::$view->setScriptPath(APPPATH.'/default/templates/');
- die(QFW::$view->render('404.php'));
+ die(QFW::$view->displayMain(QFW::$view->render('404.php')));
}
/**
@@ -454,7 +454,9 @@ SREG;
$MCA['Module'] = array_shift($data);
else
$MCA['Module'] = $type=='Block' ? $this->curModule : $this->defM;
- $path = $this->baseDir.'/'.$MCA['Module'];
+ $this->cModule = $MCA['Module'];
+ if ($this->module == '') $this->module = $this->cModule;
+ $path = $this->baseDir.'/'.$this->cModule;
QFW::$view->setScriptPath($path.'/templates');
$c=count($data); // Количество элементов URI исключая модуль
@@ -480,9 +482,8 @@ SREG;
}
$MCA['Controller'] = $cname;
$class_key=$MCA['Module'].'|'.$MCA['Controller'];
-
- $this->cModule = $MCA['Module'];
$this->cController = $MCA['Controller'];
+ if ($this->controller == '') $this->controller = $this->cController;
if (!isset($this->classes[$class_key]))
{
@@ -503,17 +504,13 @@ SREG;
$acts = get_class_methods($class);
//Выполняется при первом вызове и сохраняет значение вызванного MCA
- //Достаточно проверить только один - после выполнения пустыми они быть не могут
- if ($this->module == '')
+ //Проверяем последний так как остальные уже записаны
+ if ($this->action == '')
{
$aname = isset($data[0]) ? $data[0] :
(isset($vars['defA']) ? $vars['defA'] : $this->defA);
if (!in_array(strtr($aname,'.','_').$type, $acts))
$aname = (isset($vars['defA']) ? $vars['defA'] : $this->defA);
- //Инициализируем значения, чтобы можно было узнать
- //как нас вызвали в конструкторе
- $this->cModule = $this->module = $MCA['Module'];
- $this->cController = $this->controller = $MCA['Controller'];
$this->cAction = $this->action = $aname;
$this->type = $type;
}
commit 28c5d6e56fe950ad3a9c5d29fc31d6b9579c31e3
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 14:17:28 2010 +0300
Пара полезных функций в утилиты
diff --git a/lib/utils.php b/lib/utils.php
index 17eb979..46bad18 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -288,4 +288,23 @@ function nocache()
*/
function esc($s) { return htmlspecialchars($s, ENT_QUOTES, QFW::$config['host']['encoding']); }
+/**
+ * Добавляет соль пароля
+ */
+function password_sailt($pass)
+{
+ return md5($pass.QFW::$config['pass_sailt']);
+}
+
+/**
+ * Генерирует урл из текста - убирает / и применяет urlencode
+ *
+ * @param string $text
+ * @return string
+ */
+function genUrl($text)
+{
+ return rawurlencode(str_replace(array('/', ' '), '-', $text));
+}
+
?>
commit 8a97e39d76fd14767ce0bdc36ed5b7f7f770def9
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 14:14:18 2010 +0300
Часть функций из utils в хелпер text
diff --git a/lib/Text.php b/lib/Text.php
index 7567de8..68d8990 100644
--- a/lib/Text.php
+++ b/lib/Text.php
@@ -32,6 +32,9 @@ class Text
return $form5;
}
+ /**
+ * Обрезка текста
+ */
static public function my_trim($str, $size, $word=false)
{
if (mb_strlen($str)<=$size)
@@ -46,6 +49,19 @@ class Text
return $str;
}
+
+ /**
+ * Печать размера файла в форматированном виде
+ */
+ static public function printSize($size)
+ {
+ if ($size>1024*1024*2)
+ return round($size/1024/1024,2).' Мб';
+ if ($size>1024*10)
+ return round($size/1024,2).' Кб';
+ return $size.' байт';
+ }
+
/**
* Формирование даты по-русски
* <br>так как при выстановке локали неправильно склоняет
diff --git a/lib/utils.php b/lib/utils.php
index c950a5f..17eb979 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -127,31 +127,6 @@ function make_urls($string)
}
/**
- * Печать размера файла в форматированном виде
- */
-function printSize($size)
-{
- if ($size>1024*1024*2)
- return round($size/1024/1024,2).' Мб';
- if ($size>1024*10)
- return round($size/1024,2).' Кб';
- return $size.' байт';
-}
-
-/**
- * Обрезает длинные строки, добавляя в конце многоточие
- *
- * @param string $str строка, которую нужно обрезать
- * @param integer $size до скольки знаков
- */
-function my_trim($str, $size)
-{
- if (mb_strlen($str)>$size)
- $str=mb_substr($str,0,$size-3).'...';
- return $str;
-}
-
-/**
* Обрезает длинные строки, не разрывая последнее слово
*
* @param string $str строка, которую нужно обрезать
@@ -275,61 +250,6 @@ function array2xml($array,$attrName='attr',$arrFlar='array')
}
/**
- * Вывод окончаний русских слов с учетом числительных (например сообщение сообщения сообщений)
- *
- * @param integer $n число
- * @param string $form1 единственное
- * @param string $form2 форма для 2-4
- * @param string $form5 форма для 5 и более
- * @return string нужная форма
- */
-function pluralForm($n, $form1, $form2, $form5)
-{
- $n = abs($n) % 100;
- $n1 = $n % 10;
- if ($n > 10 && $n < 20) return $form5;
- if ($n1 > 1 && $n1 < 5) return $form2;
- if ($n1 == 1) return $form1;
- return $form5;
-}
-
-/**
- * Формирование даты по-русски
- * <br>так как при выстановке локали неправильно склоняет
- *
- * @see date
- * @param string $format формат аналогичен date
- * @param integer $time время
- * @return string дата
- */
-function russian_date($format, $time=false)
-{
- static $translation = array(
- "January" => "Января",
- "February" => "Февраля",
- "March" => "Марта",
- "April" => "Апреля",
- "May" => "Мая",
- "June" => "Июня",
- "July" => "Июля",
- "August" => "Августа",
- "September" => "Сентября",
- "October" => "Октября",
- "November" => "Ноября",
- "December" => "Декабря",
- "Monday" => "Понедельник",
- "Tuesday" => "Вторник",
- "Wednesday" => "Среда",
- "Thursday" => "Четверг",
- "Friday" => "Пятница",
- "Saturday" => "Суббота",
- "Sunday" => "Воскресенье",
- );
- return strtr(date($format, $time!==false ? $time : time()), $translation);
-}
-
-
-/**
* Вызывает preg_match(_all) и
* <br>возвращается данные в удобном формате
* <br>с использованием флага PREG_SET_ORDER
commit cb7910326b4baf3cb4e4285bf697f6251ce9b0b5
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 28 14:07:09 2010 +0300
Обновлена DbSimple
diff --git a/lib/DbSimple/Connect.php b/lib/DbSimple/Connect.php
index b3dec28..17fc5e7 100644
--- a/lib/DbSimple/Connect.php
+++ b/lib/DbSimple/Connect.php
@@ -40,6 +40,8 @@ class DbSimple_Connect
protected $DSN;
/** @var string Тип базы данных */
protected $shema;
+ /** @var array Что выставить при коннекте */
+ protected $init;
/**
* Конструктор только запоминает переданный DSN
@@ -51,6 +53,7 @@ class DbSimple_Connect
{
$this->DbSimple = null;
$this->DSN = $dsn;
+ $this->init = array();
$this->shema = ucfirst(substr($dsn, 0, strpos($dsn, ':')));
}
@@ -101,6 +104,7 @@ class DbSimple_Connect
/**
* Подключение к базе данных
+ * @param string $dsn DSN строка БД
*/
protected function connect($dsn)
{
@@ -115,13 +119,22 @@ class DbSimple_Connect
$this->DbSimple = new $class($parsed);
if (isset($parsed['prefix']))
$this->DbSimple->setIdentPrefix($parsed['prefix']);
- $this->DbSimple->setCachePrefix('db_'.md5($parsed['dsn']).'_');
+ if ($this->_cachePrefix) $this->DbSimple->setCachePrefix($this->_cachePrefix);
+ if ($this->_cacher) $this->DbSimple->setCacher($this->_cacher);
+ if ($this->_logger) $this->DbSimple->setLogger($this->_logger);
$this->DbSimple->setErrorHandler($this->errorHandler!==null ? $this->errorHandler : array(&$this, 'errorHandler'));
+ //выставление переменных
+ foreach($this->init as $query)
+ call_user_func_array(array(&$this->DbSimple, 'query'), $query);
+ $this->init = array();
}
/**
* Функция обработки ошибок - стандартный обработчик
* Все вызовы без @ прекращают выполнение скрипта
+ *
+ * @param string $msg Сообщение об ошибке
+ * @param array $info Подробная информация о контексте ошибки
*/
public function errorHandler($msg, $info)
{
@@ -135,6 +148,19 @@ class DbSimple_Connect
}
/**
+ * Выставляет запрос для инициализации
+ *
+ * @param string $query запрос
+ */
+ public function addInit($query)
+ {
+ $args = func_get_args();
+ if ($this->DbSimple !== null)
+ return call_user_func_array(array(&$this->DbSimple, 'query'), $args);
+ $this->init[] = $args;
+ }
+
+ /**
* Устанавливает новый обработчик ошибок
* Обработчик получает 2 аргумента:
* - сообщение об ошибке
@@ -143,6 +169,7 @@ class DbSimple_Connect
* @param callback|null|false $handler обработчик ошибок
* <br> null - по умолчанию
* <br> false - отключен
+ * @return callback|null|false предыдущий обработчик
*/
public function setErrorHandler($handler)
{
@@ -155,11 +182,69 @@ class DbSimple_Connect
/** @var callback обработчик ошибок */
private $errorHandler = null;
+ private $_cachePrefix = '';
+ private $_logger = null;
+ private $_cacher = null;
+
+ /**
+ * callback setLogger(callback $logger)
+ * Set query logger called before each query is executed.
+ * Returns previous logger.
+ */
+ public function setLogger($logger)
+ {
+ $prev = $this->_logger;
+ $this->_logger = $logger;
+ if ($this->DbSimple)
+ $this->DbSimple->setLogger($logger);
+ return $prev;
+ }
+
+ /**
+ * callback setCacher(callback $cacher)
+ * Set cache mechanism called during each query if specified.
+ * Returns previous handler.
+ */
+ public function setCacher(Zend_Cache_Backend_Interface $cacher=null)
+ {
+ $prev = $this->_cacher;
+ $this->_cacher = $cacher;
+ if ($this->DbSimple)
+ $this->DbSimple->setCacher($cacher);
+ return $prev;
+ }
+
+ /**
+ * string setIdentPrefix($prx)
+ * Set identifier prefix used for $_ placeholder.
+ */
+ public function setIdentPrefix($prx)
+ {
+ $old = $this->_identPrefix;
+ if ($prx !== null) $this->_identPrefix = $prx;
+ if ($this->DbSimple)
+ $this->DbSimple->setIdentPrefix($prx);
+ return $old;
+ }
+
+ /**
+ * string setCachePrefix($prx)
+ * Set cache prefix used in key caclulation.
+ */
+ public function setCachePrefix($prx)
+ {
+ $old = $this->_cachePrefix;
+ if ($prx !== null) $this->_cachePrefix = $prx;
+ if ($this->DbSimple)
+ $this->DbSimple->setCachePrefix($prx);
+ return $old;
+ }
/**
* Разбирает строку DSN в массив параметров подключения к базе
*
- * @param array parseDSN(string $dsn)
+ * @param string $dsn строка DSN для разбора
+ * @return array Параметры коннекта
*/
protected function parseDSN($dsn)
{
@@ -177,4 +262,4 @@ class DbSimple_Connect
}
}
-?>
\ No newline at end of file
+?>
commit fc359e1604e526ff18edad012adff8346a3f02a4
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Dec 27 16:54:30 2010 +0300
Немного переписан Scaffold_Display
diff --git a/lib/Modules/Scaffold/Display.php b/lib/Modules/Scaffold/Display.php
index a98826d..c521a6e 100644
--- a/lib/Modules/Scaffold/Display.php
+++ b/lib/Modules/Scaffold/Display.php
@@ -11,19 +11,50 @@ class Scaffold_Display
public $new;
public $multiedit;
public $multidel;
+ /** @var bool текущее состояние */
+ private static $cur;
+
+ /**
+ * Фабрика
+ *
+ * @return Scaffold_Display
+ */
+ public static function get() { return new self; }
public function __construct()
{
+ self::$cur = true;
$this->edit = $this->list = $this->multiedit = $this->multidel = $this->new = true;
}
- public function show()
- {
+ public function tedit($v=null) { $this->edit = $v===null ? self::$cur : (bool)$v; return $this; }
+ public function tlist($v=null) { $this->list = $v===null ? self::$cur : (bool)$v; return $this; }
+ public function tnew($v=null) { $this->new = $v===null ? self::$cur : (bool)$v; return $this; }
+ public function tmultiedit($v=null) { $this->multiedit = $v===null ? self::$cur : (bool)$v; return $this; }
+ public function tmultidel($v=null) { $this->multidel = $v===null ? self::$cur : (bool)$v; return $this; }
- }
- public function hide()
+ /**
+ * Показывать следующие поля
+ *
+ * @param $v bool показывать
+ * @return Scaffold_Display this
+ */
+ public function show($v=true)
{
+ self::$cur = $v;
+ return $this;
+ }
+ /**
+ * Скрывать следующие поля
+ *
+ * @param $v bool скрывать
+ * @return Scaffold_Display this
+ */
+ public function hide($v=true)
+ {
+ self::$cur = !$v;
+ return $this;
}
}
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index e804a39..9ad11c7 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -74,14 +74,13 @@ class Scaffold_Field extends Scaffold_Field_Info
$this->title = $this->name;
//для совместимости
if ($this->disp === false)
- {
- $this->disp = new Scaffold_Display();
- $this->disp->list =
- $this->disp->edit =
- $this->disp->new =
- $this->disp->multiedit =
- $this->disp->multidel = !$this->hide;
- }
+ $this->disp = Scaffold_Display::get()
+ ->hide($this->hide)
+ ->tlist()
+ ->tedit()
+ ->tnew()
+ ->tmultiedit()
+ ->tmultidel();
}
/**
commit b88291c2a508353270af01c803612c6cd0b7a3ec
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Dec 24 18:01:05 2010 +0300
Скафолдинг - обработка данных после записи в таблицу для поля и переменная $row - текущая строка
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index d06ba5a..e804a39 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -165,6 +165,17 @@ class Scaffold_Field extends Scaffold_Field_Info
return $value;
}
+ /**
+ * Обработка значения после записи в таблицу - известен ID для insert
+ *
+ * @param string $id первичный ключ - уже исзвестен для insert
+ * @param string $value новое значение
+ * @param string $old Старое значение
+ */
+ public function post($id, $value, $old)
+ {
+ }
+
public function action($id, $action='do')
{
die('Был вызван метод '.$action.' для поля '. $this->title);
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 1563630..4c21851 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -55,6 +55,28 @@ abstract class ScaffoldController extends Controller
/** @var array сообщения для вывода */
private $messages;
+ /** @var array текущая строка */
+ static private $row;
+
+ /**
+ * Получает текущую строку
+ *
+ * @return array текущая строка
+ */
+ static public function getCurRow()
+ {
+ return self::$row;
+ }
+ /**
+ * устанавливает текущую строку
+ *
+ * @param array $row строка
+ */
+ static public function setCurRow($row)
+ {
+ self::$row = $row;
+ }
+
/**
* Получает данные о полях
*
@@ -105,6 +127,7 @@ abstract class ScaffoldController extends Controller
*/
public function __construct()
{
+ $this->row = array();
Hlp::addCSS('built-in/scaffold.css');
if ($this->useJs)
{
@@ -297,6 +320,7 @@ abstract class ScaffoldController extends Controller
$data[$f] = call_user_func(array(get_class($this), 'default_'.ucfirst($f)));
else
$data[$f] = $this->fields[$f]->def();
+ self::setCurRow($data);
$state = new TemplaterState(QFW::$view);
QFW::$view->setScriptPath(dirname(__FILE__));
@@ -341,6 +365,7 @@ abstract class ScaffoldController extends Controller
$this->sess['return'] = $_SERVER['HTTP_REFERER'];
$data = $this->getOldVars($id);
+ self::setCurRow($data);
$state = new TemplaterState(QFW::$view);
QFW::$view->setScriptPath(dirname(__FILE__));
@@ -365,6 +390,7 @@ abstract class ScaffoldController extends Controller
$old = $this->getOldVars($id);
if (!$old)
QFW::$router->redirect(Url::C('index'), true);
+ self::setCurRow($old);
foreach($this->fields as $k=>$v)
$v->proccess($id, false, $old[$k]);
QFW::$db->query('DELETE FROM ?# WHERE ?#=?',
@@ -394,8 +420,11 @@ abstract class ScaffoldController extends Controller
$this->primaryKey, array($this->table=>array_merge($this->order, array('*'))),
$this->table, $this->primaryKey, $ids);
foreach($olds as $id=>$old)
+ {
+ self::setCurRow($old);
foreach($this->fields as $k=>$v)
$v->proccess($id, false, $old[$k]);
+ }
QFW::$db->query('DELETE FROM ?# WHERE ?# IN (?a)',
$this->table, $this->primaryKey, $ids);
$this->messages['success'][] = 'Выбранные записи удалены';
@@ -472,6 +501,8 @@ abstract class ScaffoldController extends Controller
$errors = array();
//Обработка результата редактирования
foreach($alldata as $id => $data)
+ {
+ self::setCurRow($old);
foreach ($data as $k=>$v)
{
if (isset($this->methods['validator_'.ucfirst($k)]))
@@ -483,6 +514,7 @@ abstract class ScaffoldController extends Controller
if ($res === false)
$errors[$k] = 'Поле '.$this->fields[$k]->title.' имеет некорректное значение';
}
+ }
//Если ошибок нет, то записываем в базу изменения
if (count($errors))
@@ -494,7 +526,8 @@ abstract class ScaffoldController extends Controller
foreach($alldata as $id => $data)
{
$old = $this->getOldVars($id);
- //Обработка данных после POST
+ self::setCurRow($old);
+ //Обработка данных перед POST
foreach ($this->fields as $k=>$class)
if ($k == $this->primaryKey && !isset($data[$k]))
continue; //не трогаем первичный ключ
@@ -513,6 +546,17 @@ abstract class ScaffoldController extends Controller
QFW::$db->query('UPDATE ?# SET ?a WHERE ?#=?',
$this->table, $data, $this->primaryKey, $id);
+ //Обработка данных после POST
+ foreach ($this->fields as $k=>$class)
+ if ($k == $this->primaryKey && !isset($data[$k]))
+ continue; //не трогаем первичный ключ
+ elseif (isset($this->methods['post_'.ucfirst($k)]))
+ $data[$k] = call_user_func(array($this, 'post_'.ucfirst($k)),
+ isset($data[$k]) ? $data[$k] : $old[$k], $id == -1 ? $ins_id : $id, $old[$k]);
+ else
+ $data[$k] = $class->post($id == -1 ? $ins_id : $id,
+ isset($data[$k]) ? $data[$k] : $old[$k], $old[$k]);
+
if (isset($this->methods['postEdit']))
call_user_func(array($this, 'postEdit'), $id == -1 ? $ins_id : $id);
}
diff --git a/lib/Modules/Scaffold/scaffold/index.php b/lib/Modules/Scaffold/scaffold/index.php
index 3e522f4..d00f6d8 100644
--- a/lib/Modules/Scaffold/scaffold/index.php
+++ b/lib/Modules/Scaffold/scaffold/index.php
@@ -48,7 +48,7 @@ foreach(current($data) as $key=>$v)
</tr>
</thead>
<tbody>
-<?php foreach($data as $id=>$row) { ?>
+<?php foreach($data as $id=>$row) { $class::setCurRow($row); ?>
<tr>
<td><input type="checkbox" name="id[]" value="<?php echo $id ?>" /></td>
<?php foreach($row as $key=>$v) {
diff --git a/lib/Modules/Scaffold/scaffold/multidel.php b/lib/Modules/Scaffold/scaffold/multidel.php
index 1d2c7f3..23df76f 100644
--- a/lib/Modules/Scaffold/scaffold/multidel.php
+++ b/lib/Modules/Scaffold/scaffold/multidel.php
@@ -16,7 +16,7 @@
</tr>
</thead>
<tbody>
-<?php foreach($data as $id=>$row) { ?>
+<?php foreach($data as $id=>$row) { $class::setCurRow($row); ?>
<tr>
<?php foreach($row as $key=>$v) {
$i = $fields[$key];
diff --git a/lib/Modules/Scaffold/scaffold/multiedit.php b/lib/Modules/Scaffold/scaffold/multiedit.php
index f783b4b..1a58082 100644
--- a/lib/Modules/Scaffold/scaffold/multiedit.php
+++ b/lib/Modules/Scaffold/scaffold/multiedit.php
@@ -19,7 +19,7 @@
</tr>
</thead>
<tbody>
-<?php foreach($data as $id=>$row) { ?>
+<?php foreach($data as $id=>$row) { $class::setCurRow($row); ?>
<tr>
<?php foreach($row as $key=>$v) {
$i = $fields[$key];
commit f4c104f3504ae86db111803ac34730c66978e86f
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Dec 24 17:43:33 2010 +0300
Функция сортировки перенесера вверх
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 2676e53..1563630 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -562,6 +562,37 @@ abstract class ScaffoldController extends Controller
QFW::$router->redirect(Url::C('index'), true);
}
+
+ /**
+ * Устанавливает порядок сортировки
+ *
+ * @param string $field Имя поля
+ * @param string $dir Направление сортировки (ASC|DESC|) - пустое - сменить
+ * @return bool Удачно или нет
+ */
+ public function setSort($field='', $dir='')
+ {
+ //такого поля нету
+ if (!isset($this->fields[$field]))
+ return false;
+ //если сортировки в этой таблице еще нет
+ if (!isset($this->sess['sort']))
+ $this->sess['sort'] = array(
+ 'field' => '',
+ 'direction' => '',
+ );
+ //если не указана, то ASC или сменить ASC на DESC
+ if ($dir != 'ASC' && $dir != 'DESC')
+ $dir = ($this->sess['sort']['field'] == $field &&
+ $this->sess['sort']['direction'] == 'ASC')
+ ? 'DESC' : 'ASC';
+ $this->sess['sort'] = array(
+ 'field' => $field,
+ 'direction' => $dir,
+ );
+ return true;
+ }
+
////////////////////////////////////////////////////////////
//Функции для упращения настройки таблицы - удобные сеттеры
////////////////////////////////////////////////////////////
@@ -886,36 +917,6 @@ abstract class ScaffoldController extends Controller
}
/**
- * Устанавливает порядок сортировки
- *
- * @param string $field Имя поля
- * @param string $dir Направление сортировки (ASC|DESC|) - пустое - сменить
- * @return bool Удачно или нет
- */
- public function setSort($field='', $dir='')
- {
- //такого поля нету
- if (!isset($this->fields[$field]))
- return false;
- //если сортировки в этой таблице еще нет
- if (!isset($this->sess['sort']))
- $this->sess['sort'] = array(
- 'field' => '',
- 'direction' => '',
- );
- //если не указана, то ASC или сменить ASC на DESC
- if ($dir != 'ASC' && $dir != 'DESC')
- $dir = ($this->sess['sort']['field'] == $field &&
- $this->sess['sort']['direction'] == 'ASC')
- ? 'DESC' : 'ASC';
- $this->sess['sort'] = array(
- 'field' => $field,
- 'direction' => $dir,
- );
- return true;
- }
-
- /**
* Генерирует сортировку
*
* @return DbSimple_SubQuery Подзапрос сортировки
commit 372e4fff0ad087e01aea21e39ba2264c21dcbf03
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Dec 24 17:40:43 2010 +0300
Прикручет datetime
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index bcc62a0..d06ba5a 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -465,16 +465,17 @@ class Scaffold_Datetime extends Scaffold_Field
public function editor($id, $value)
{
- return QFW::$view->
- assign('id', $id)->
- assign('name', $this->editName($id))->
- assign('value', $value)->
- fetch('scaffold/fields/dateedit.php');
+ //баг - с секундами не отправляет - ограничимся минутами
+ return '<input type="datetime-local" name="'.$this->editName($id).'"
+ default="'.date('Y-m-d\TH:i:00', strtotime($value)).'" />';
}
}
-class Scaffold_Timestamp extends Scaffold_Datetime {}
+class Scaffold_Timestamp extends Scaffold_Datetime {
+ //пока никаких отличий от Scaffold_Datetime
+ //так как в опере баг с datetime - часовой пояс отличный от 0 не работает
+}
/**
diff --git a/lib/Modules/Scaffold/scaffold/fields/dateedit.php b/lib/Modules/Scaffold/scaffold/fields/dateedit.php
deleted file mode 100644
index 061f28e..0000000
--- a/lib/Modules/Scaffold/scaffold/fields/dateedit.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-Hlp::addCSS('timepicker/jquery-ui-1.8.custom.css');
-Hlp::addJs('js/jquery.js');
-Hlp::addJs('timepicker/jquery-ui-1.8.custom.min.js');
-Hlp::addJs('timepicker/jquery-ui-timepicker-addon.min.js');
-Hlp::addJs('timepicker/jquery-ui-datepicker-ru.js');
-?><input type="text" name="<?php echo $name ?>" default="<?php echo $value?>" class="datepicker" />
-<?php Hlp::sJSe() ?>
-$('.datepicker').datetimepicker({
- showSecond: true,
- dateFormat: 'yy-mm-dd',
- timeFormat: 'hh:mm:ss',
- timeOnlyTitle: 'Выберите время',
- timeText: 'Время',
- hourText: 'Час',
- minuteText: 'Мин',
- secondText: 'Сек',
- currentText: 'Теперь',
-});
-<?php Hlp::eJSe() ?>
commit 591e3944de40be7a6a2363e375989f2175807068
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Dec 24 16:21:37 2010 +0300
Доработки скафолдинга - label
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 0b6cee3..bcc62a0 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -45,6 +45,8 @@ class Scaffold_Field_Info
public $class = false;
/** @var bool Обязательная колонка */
public $required = false;
+ /** @var bool использовать label */
+ public $label = true;
}
@@ -500,6 +502,7 @@ class Scaffold_File extends Scaffold_Field
public function __construct($info)
{
parent::__construct($info);
+ $this->label = false;
if (empty ($info->typeParams['path']))
throw new Exception('Не указана директория для фалов', 1);
if (!is_dir($info->typeParams['path']))
diff --git a/lib/Modules/Scaffold/scaffold/index.php b/lib/Modules/Scaffold/scaffold/index.php
index 184be51..3e522f4 100644
--- a/lib/Modules/Scaffold/scaffold/index.php
+++ b/lib/Modules/Scaffold/scaffold/index.php
@@ -5,6 +5,7 @@
include 'filterForm.php';
} ?>
+<?php echo $this->block(Url::C('preTable')); ?>
<?php echo $pager; ?>
<?php if (count($data)>0) { $cols = 3 + (empty($actions) ? 0 : 1); // с чекбоксами, редактирование+удаление, действия
@@ -17,7 +18,8 @@ foreach(current($data) as $key=>$v)
<thead>
<tr>
<td colspan="<?php echo $cols ?>">
- <input type="button" class="button" value="Добавить" onclick="window.location.href='<?php echo Url::C('edit/-1') ?>'" />
+ <?php echo $this->block(Url::C('multiPre')); ?>
+ <input type="button" value="Добавить" onclick="window.location.href='<?php echo Url::C('edit/-1') ?>'" />
<input type="submit" name="edit" value="Редактировать выбранных" />
<input type="submit" name="delete" value="Удалить выбранных" />
<?php echo $this->block(Url::C('multiPost')); ?>
@@ -54,25 +56,26 @@ foreach(current($data) as $key=>$v)
if (!$i->disp->list)
continue;
?>
- <td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>><?php
+ <td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>><?php //отображение обычного не связанного поля
if (isset($methods['display_'.ucfirst($key)]))
echo call_user_func($class.'::display_'.ucfirst($key), $id, $v);
else
echo $i->display($id, $v);
?></td>
<?php } ?>
- <td><a href="<?php echo Url::C('edit/'.$id) ?>">ред.</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 Url::C($uri.'/'.$id) ?>"><?php echo $tit ?></a>
+ <a href="<?php echo Url::C($uri.'/'.$row[$primaryKey]) ?>"><?php echo $tit ?></a>
<?php } ?></td><?php } ?>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr><td colspan="<?php echo $cols ?>">
- <input type="button" class="button" value="Добавить" onclick="window.location.href='<?php echo Url::C('edit/-1') ?>'" />
+ <?php echo $this->block(Url::C('multiPre')); ?>
+ <input type="button" value="Добавить" onclick="window.location.href='<?php echo Url::C('edit/-1') ?>'" />
<input type="submit" name="edit" value="Редактировать выбранных" />
<input type="submit" name="delete" value="Удалить выбранных" />
<?php echo $this->block(Url::C('multiPost')); ?>
commit bf17b4da56c86e1a000179b282a60c6bbb31569e
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Dec 17 20:09:46 2010 +0300
Сохранение в слот возвращает то что сохранила - для удобства
diff --git a/QFW/QuickFW/Cacher/Slot.php b/QFW/QuickFW/Cacher/Slot.php
index b4f853c..6ac8e45 100644
--- a/QFW/QuickFW/Cacher/Slot.php
+++ b/QFW/QuickFW/Cacher/Slot.php
@@ -77,7 +77,7 @@ abstract class Dklab_Cache_Frontend_Slot
* Saves a data for this slot.
*
* @param mixed $data Data to be saved.
- * @return void
+ * @return mixed $data
*/
public function save($data)
{
@@ -87,6 +87,7 @@ abstract class Dklab_Cache_Frontend_Slot
}
$raw = serialize($data);
$this->_getBackend()->save($raw, $this->_id, $tags, $this->_lifetime);
+ return $data;
}
-----------------------------------------------------------------------
Summary of changes:
QFW/Init.php | 11 +--
QFW/QuickFW/Cache.php | 40 --------
QFW/QuickFW/Cacher/Slot.php | 3 +-
QFW/QuickFW/Router.php | 24 +++--
QFW/config.php | 6 +-
application/default.php | 26 +++---
lib/DbSimple/Connect.php | 91 +++++++++++++++++-
lib/Debug/ErrorHook/JabberNotifier.php | 63 ++++++++++++
lib/Debug/ErrorHook/LogNotifier.php | 35 +++++++
lib/Debug/ErrorHook/TextNotifier.php | 2 +-
lib/Modules/Scaffold/Display.php | 39 +++++++-
lib/Modules/Scaffold/Fields.php | 45 ++++++---
lib/Modules/Scaffold/ScaffoldController.php | 107 +++++++++++++++------
lib/Modules/Scaffold/scaffold/fields/dateedit.php | 20 ----
lib/Modules/Scaffold/scaffold/index.php | 15 ++-
lib/Modules/Scaffold/scaffold/multidel.php | 2 +-
lib/Modules/Scaffold/scaffold/multiedit.php | 2 +-
lib/Text.php | 16 +++
lib/utils.php | 99 ++++---------------
19 files changed, 407 insertions(+), 239 deletions(-)
create mode 100644 lib/Debug/ErrorHook/JabberNotifier.php
create mode 100644 lib/Debug/ErrorHook/LogNotifier.php
delete mode 100644 lib/Modules/Scaffold/scaffold/fields/dateedit.php
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-12-16 12:57:59
|
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 tag, 1.8 has been created
at 47b65efefa33e3583f8f0ebc5108e1609d7899bb (commit)
- Log -----------------------------------------------------------------
commit 47b65efefa33e3583f8f0ebc5108e1609d7899bb
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Dec 16 15:12:42 2010 +0300
Функция get в урле - если по какой-то причине __toString не работает
-----------------------------------------------------------------------
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-12-16 12:24:02
|
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 47b65efefa33e3583f8f0ebc5108e1609d7899bb (commit)
via 49b3e21f044db8a18a7440b79f1cf5e0725d6527 (commit)
via f5a1e0b4400cb90b475ec42263ada9a103329cf6 (commit)
via 4493ed8fe482cee8cc63d5a9436b7310a2716419 (commit)
via fe1841a18049e1e6c375377ce623e3c131f436a4 (commit)
via 8391e26846472c822f2266fd73d0df0d4a98f6fb (commit)
from 54cfd404f5688c34973cf724da716560d570418b (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 47b65efefa33e3583f8f0ebc5108e1609d7899bb
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Dec 16 15:12:42 2010 +0300
Функция get в урле - если по какой-то причине __toString не работает
diff --git a/QFW/QuickFW/Url.php b/QFW/QuickFW/Url.php
index aef159c..a346f19 100644
--- a/QFW/QuickFW/Url.php
+++ b/QFW/QuickFW/Url.php
@@ -138,12 +138,21 @@ class Url
*/
public function __toString()
{
+ return $this->get();
+ }
+
+ /**
+ * урл для вывода, с подстановками
+ *
+ * @return string урл
+ */
+ public function get()
+ {
return QFW::$router->backrewriteUrl(
self::$config['base'].QFW::$router->backrewrite($this->u).
($this->u!=='' ? self::$config['ext'] : '').
($this->get ? '?' . $this->get : '').
($this->anchor ? '#' . $this->anchor : ''));
-
}
/**
@@ -156,7 +165,7 @@ class Url
{
return $this->u;
}
-
+
}
?>
commit 49b3e21f044db8a18a7440b79f1cf5e0725d6527
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Dec 16 12:57:03 2010 +0300
Инициализация запроса от jQuery
diff --git a/QFW/Init.php b/QFW/Init.php
index 9da621f..941431e 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -23,7 +23,7 @@ class QFW
/** @var mixed|false Данные о пользователе */
static public $userdata = false;
- /** @var JsHttpRequest|false JsHttpRequest, если был выполнени Ajax запрос */
+ /** @var JsHttpRequest|jQuery|false JsHttpRequest или jQuery, если был выполнени Ajax запрос */
static public $ajax = false;
private function __construct() {}
@@ -107,20 +107,14 @@ class QFW
if (isset($_REQUEST['JsHttpRequest']))
{
require_once LIBPATH.'/JsHttpRequest.php';
- //QFW::$libs['JsHttpRequest'] для совместимости со старым вариантом
- self::$ajax = QFW::$libs['JsHttpRequest'] = new
- JsHttpRequest(self::$config['host']['encoding']);
+ self::$ajax = new JsHttpRequest(self::$config['host']['encoding']);
//устанавливаем пустой главный шаблон
self::$view->mainTemplate = '';
}
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
{
- //TODO: нужен класс для возврата данных в json
- //сейчас не отличаются вызовы html и json
- //возможно -
- // ["HTTP_ACCEPT"]=> string(3) "*/*" для json
- // ["HTTP_ACCEPT"]=> string(3) "text/html, */*; q=0.01" для html
- self::$ajax = 'jquery';
+ require_once LIBPATH.'/jquery.php';
+ self::$ajax = new jQuery();
//устанавливаем пустой главный шаблон
self::$view->mainTemplate = '';
}
diff --git a/lib/jquery.php b/lib/jquery.php
new file mode 100644
index 0000000..f25625c
--- /dev/null
+++ b/lib/jquery.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Бэкенд для удобного использования JQ
+ *
+ * @author ivan
+ */
+class jQuery
+{
+ /**
+ * Устанавливает заголовок и кодирует данные
+ *
+ * @param mixed $data данные для возврата браузеру
+ * @return string json
+ */
+ public function json($data)
+ {
+ header('Content-type: application/json');
+ return json_encode($data);
+ }
+}
+
commit f5a1e0b4400cb90b475ec42263ada9a103329cf6
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Dec 15 15:33:45 2010 +0300
Определение jquery - для аякса
diff --git a/QFW/Init.php b/QFW/Init.php
index e5e6c82..9da621f 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -113,6 +113,17 @@ class QFW
//устанавливаем пустой главный шаблон
self::$view->mainTemplate = '';
}
+ if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
+ {
+ //TODO: нужен класс для возврата данных в json
+ //сейчас не отличаются вызовы html и json
+ //возможно -
+ // ["HTTP_ACCEPT"]=> string(3) "*/*" для json
+ // ["HTTP_ACCEPT"]=> string(3) "text/html, */*; q=0.01" для html
+ self::$ajax = 'jquery';
+ //устанавливаем пустой главный шаблон
+ self::$view->mainTemplate = '';
+ }
}
/**
commit 4493ed8fe482cee8cc63d5a9436b7310a2716419
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 14 13:44:52 2010 +0300
Мелкоправки скафолда
diff --git a/lib/Modules/Scaffold/scaffold/index.php b/lib/Modules/Scaffold/scaffold/index.php
index 98bfb19..184be51 100644
--- a/lib/Modules/Scaffold/scaffold/index.php
+++ b/lib/Modules/Scaffold/scaffold/index.php
@@ -54,18 +54,18 @@ foreach(current($data) as $key=>$v)
if (!$i->disp->list)
continue;
?>
- <td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>><?php //отображение обычного не связанного поля
+ <td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>><?php
if (isset($methods['display_'.ucfirst($key)]))
echo call_user_func($class.'::display_'.ucfirst($key), $id, $v);
else
echo $i->display($id, $v);
?></td>
<?php } ?>
- <td><a href="<?php echo Url::C('edit/'.$row[$primaryKey]) ?>">ред.</a></td>
+ <td><a href="<?php echo Url::C('edit/'.$id) ?>">ред.</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 Url::C($uri.'/'.$row[$primaryKey]) ?>"><?php echo $tit ?></a>
+ <a href="<?php echo Url::C($uri.'/'.$id) ?>"><?php echo $tit ?></a>
<?php } ?></td><?php } ?>
</tr>
<?php } ?>
@@ -95,4 +95,4 @@ foreach(current($data) as $key=>$v)
<?php echo $this->block(Url::C('new')) ?>
<p> </p>
</div>
-<?php } ?>
\ No newline at end of file
+<?php } ?>
commit fe1841a18049e1e6c375377ce623e3c131f436a4
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 14 13:14:22 2010 +0300
Вместо класса таблицы передаем ссылку на объект
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 09fb737..0b6cee3 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -30,8 +30,8 @@ class Scaffold_Field_Info
public $table;
/** @var string Имя первичного ключа */
public $primaryKey;
- /** @var string Класс таблицы */
- public $tableClass;
+ /** @var ScaffoldController Объект таблицы */
+ public $tableObject;
/** @var string Имя поля */
public $name = '';
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 5803041..2676e53 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -978,7 +978,7 @@ abstract class ScaffoldController extends Controller
{
$infoClass->fiendInfo = $fieldInfo;
$infoClass->table = $this->table;
- $infoClass->tableClass = get_class($this);
+ $infoClass->tableObject = &$this;
$infoClass->primaryKey = $this->primaryKey;
if ($infoClass->type)
commit 8391e26846472c822f2266fd73d0df0d4a98f6fb
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 14 13:00:22 2010 +0300
Хелперы для работы с текстом
diff --git a/lib/Text.php b/lib/Text.php
new file mode 100644
index 0000000..7567de8
--- /dev/null
+++ b/lib/Text.php
@@ -0,0 +1,193 @@
+<?php
+
+define('_TS_MINUTE', 60);
+define('_TS_HOUR', _TS_MINUTE * 60);
+define('_TS_DAY', _TS_HOUR * 24);
+define('_TS_WEEK', _TS_DAY * 7);
+define('_TS_MONTH', _TS_DAY * 30);
+define('_TS_YEAR', _TS_DAY * 365);
+
+/**
+ * Хелперы для работы с текстовым выводом
+ */
+class Text
+{
+
+ /**
+ * Вывод окончаний русских слов с учетом числительных (например сообщение сообщения сообщений)
+ *
+ * @param intereg $n число
+ * @param string $form1 единственное
+ * @param string $form2 форма для 2-4
+ * @param string $form5 форма для 5 и более
+ * @return string нужная форма
+ */
+ static public function pluralForm($n, $form1, $form2, $form5)
+ {
+ $n = abs($n) % 100;
+ $n1 = $n % 10;
+ if ($n > 10 && $n < 20) return $form5;
+ if ($n1 > 1 && $n1 < 5) return $form2;
+ if ($n1 == 1) return $form1;
+ return $form5;
+ }
+
+ static public function my_trim($str, $size, $word=false)
+ {
+ if (mb_strlen($str)<=$size)
+ return $str;
+ if (!$word)
+ return mb_substr($str, 0, $size-3).'...';
+ $str = str_replace("\r", "", $str);
+ $str_space = str_replace("\n", " ", $str);
+ $words = explode(' ', mb_substr($str_space, 0, $size-3));
+ $len = mb_strlen(implode(' ', count($words) > 1 ? array_slice($words, 0, count($words)-1) : $words));
+ $str = mb_substr($str, 0, $len).'...';
+ return $str;
+ }
+
+ /**
+ * Формирование даты по-русски
+ * <br>так как при выстановке локали неправильно склоняет
+ *
+ * @see date
+ * @param string $format формат аналогичен date
+ * @param integer $time время
+ * @return string дата
+ */
+ static public function russian_date($format, $time=false)
+ {
+ static $translation = array(
+ "January" => "Января",
+ "February" => "Февраля",
+ "March" => "Марта",
+ "April" => "Апреля",
+ "May" => "Мая",
+ "June" => "Июня",
+ "July" => "Июля",
+ "August" => "Августа",
+ "September" => "Сентября",
+ "October" => "Октября",
+ "November" => "Ноября",
+ "December" => "Декабря",
+ "Monday" => "Понедельник",
+ "Tuesday" => "Вторник",
+ "Wednesday" => "Среда",
+ "Thursday" => "Четверг",
+ "Friday" => "Пятница",
+ "Saturday" => "Суббота",
+ "Sunday" => "Воскресенье",
+ );
+ return strtr(date($format, $time!==false ? $time : time()), $translation);
+ }
+
+ static public function date_ago($ts)
+ {
+ $dif = time() - $ts;
+
+ $prefix = '';
+ $special = false;
+
+ if($dif < _TS_MINUTE) {
+ $n = ($dif > 0 ? $dif : 1);
+
+ if($n >= 25 and $n <= 35) {
+ $word = 'полминуты';
+ $special = true;
+ }
+ else {
+ $word = self::pluralForm($n, 'секунду', 'секунды', 'секунд');
+ }
+ }
+ elseif($dif < _TS_HOUR) {
+ $n = (int) ($dif / _TS_MINUTE);
+
+ if($n >= 25 and $n <= 35) {
+ $word = 'полчаса';
+ $special = true;
+ }
+ else {
+ $word = self::pluralForm($n, 'минуту', 'минуты', 'минут');
+ }
+ }
+ elseif($dif < _TS_DAY) {
+ $n = (int) ($dif / _TS_HOUR);
+
+ $n2 = (int) (($dif % _TS_HOUR) / _TS_MINUTE);
+
+ if($n2 >= 20) {
+ $prefix = 'более ';
+ $word = self::pluralForm($n, 'часа', 'часов', 'часов');
+ }
+ else {
+ $word = self::pluralForm($n, 'час', 'часа', 'часов');
+ }
+ }
+ elseif($dif < _TS_WEEK) {
+ $n = (int) ($dif / _TS_DAY);
+
+ $n2 = (int) (($dif % _TS_DAY) / _TS_HOUR);
+
+ if($n2 >= 6) {
+ $prefix = 'более ';
+ $word = self::pluralForm($n, 'дня', 'дней', 'дней');
+ }
+ else {
+ $word = self::pluralForm($n, 'день', 'дня', 'дней');
+ }
+ }
+ elseif($dif < _TS_MONTH) {
+ $n = (int) ($dif / _TS_WEEK);
+
+ $n2 = (int) (($dif % _TS_WEEK) / _TS_DAY);
+
+ if($n2 >= 2) {
+ $prefix = 'более ';
+ $word = self::pluralForm($n, 'недели', 'недель', 'недель');
+ }
+ else {
+ $word = self::pluralForm($n, 'неделю', 'недели', 'недель');
+ }
+ }
+ elseif($dif < _TS_YEAR) {
+ $n = (int) ($dif / _TS_MONTH);
+
+ $n2 = (int) (($dif % _TS_MONTH) / _TS_WEEK);
+
+ if($n2 >= 1) {
+ $prefix = 'более ';
+ $word = self::pluralForm($n, 'месяца', 'месяцев', 'месяцев');
+ }
+ else {
+ $word = self::pluralForm($n, 'месяц', 'месяца', 'месяцев');
+ }
+ }
+ else {
+ $n = (int) ($dif / _TS_YEAR);
+
+ $n2 = (int) (($dif % _TS_YEAR) / _TS_MONTH);
+
+ if($n2 >= 1) {
+ $prefix = 'более ';
+ $word = self::pluralForm($n, 'года', 'лет', 'лет');
+ }
+ else {
+ $word = self::pluralForm($n, 'год', 'года', 'лет');
+ }
+ }
+
+ if($special) {
+ $ret = $word;
+ }
+ elseif($n == 1) {
+ $ret = "$prefix$word";
+ }
+ else {
+ $ret = "$prefix$n $word";
+ }
+
+ return $ret;
+ }
+
+
+}
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
QFW/Init.php | 13 ++-
QFW/QuickFW/Url.php | 13 ++-
lib/Modules/Scaffold/Fields.php | 4 +-
lib/Modules/Scaffold/ScaffoldController.php | 2 +-
lib/Modules/Scaffold/scaffold/index.php | 8 +-
lib/Text.php | 193 +++++++++++++++++++++++++++
lib/jquery.php | 21 +++
7 files changed, 241 insertions(+), 13 deletions(-)
create mode 100644 lib/Text.php
create mode 100644 lib/jquery.php
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-12-13 15:54:43
|
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 54cfd404f5688c34973cf724da716560d570418b (commit)
via 5c14ee23e5ff2e25431c54de7d5240e38a5fd13b (commit)
via 8c2b2d6a033b9b3d5ea7fce1c11eddbe2245d587 (commit)
via a2ed372be6d8f94c0c601184ee672d49424ce944 (commit)
via 7d29d2e026a07adb3c078ae20b3e89d107ba1f83 (commit)
via 8e06a19ef7ba963ad8b01500f58f48cc0bd84791 (commit)
from f194b28a3e20242addcc86b22dec7a1b59d37cef (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 54cfd404f5688c34973cf724da716560d570418b
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Dec 13 18:45:14 2010 +0300
Тесты для шаблонизаторов
diff --git a/tests/app/060_view_assigns.phpt b/tests/app/060_view_assigns.phpt
new file mode 100644
index 0000000..47f355c
--- /dev/null
+++ b/tests/app/060_view_assigns.phpt
@@ -0,0 +1,52 @@
+--TEST--
+QFW: assigns in view
+--FILE--
+<?php
+require dirname(__FILE__).'/init.php';
+
+QFW::$router->route('assigns');
+
+--EXPECT--
+1
+array1
+array2
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+------------------------------------------
+1
+array1
+array2
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+local1
+------------------------------------------
+1
+array1
+array2
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+local2
+local3
+------------------------------------------
+1
+array1
+array2
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+------------------------------------------
diff --git a/tests/testapp/default/controllers/AssignsController.php b/tests/testapp/default/controllers/AssignsController.php
new file mode 100644
index 0000000..4c197ee
--- /dev/null
+++ b/tests/testapp/default/controllers/AssignsController.php
@@ -0,0 +1,20 @@
+<?php
+
+class AssignsController
+{
+
+ public function indexAction()
+ {
+ QFW::$view->mainTemplate = '';
+ QFW::$view->assign('var', 1);
+ QFW::$view->assign(array('array1' => 'array1', 'array2' => 'array2'));
+ QFW::$view->append('append', 1);
+ QFW::$view->append('append', 2);
+ echo QFW::$view->fetch('assigns.php');
+ echo QFW::$view->fetch('assigns.php', array('local1' => 'local1'));
+ echo QFW::$view->fetch('assigns.php', array('local2' => 'local2', 'local3' => 'local3'));
+ echo QFW::$view->fetch('assigns.php');
+ }
+
+}
+
diff --git a/tests/testapp/default/templates/assigns.php b/tests/testapp/default/templates/assigns.php
new file mode 100644
index 0000000..23139ac
--- /dev/null
+++ b/tests/testapp/default/templates/assigns.php
@@ -0,0 +1,8 @@
+<?php echo $var."\n" ?>
+<?php echo $array1."\n" ?>
+<?php echo $array2."\n" ?>
+<?php var_dump($append) ?>
+<?php if (isset($local1)) echo $local1."\n" ?>
+<?php if (isset($local2)) echo $local2."\n" ?>
+<?php if (isset($local3)) echo $local3."\n" ?>
+------------------------------------------
commit 5c14ee23e5ff2e25431c54de7d5240e38a5fd13b
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Dec 13 18:44:49 2010 +0300
Локальные переменные и append в шаблонизаторах
diff --git a/QFW/Templater/PlainView.php b/QFW/Templater/PlainView.php
index 7892ad4..037780d 100644
--- a/QFW/Templater/PlainView.php
+++ b/QFW/Templater/PlainView.php
@@ -69,9 +69,10 @@ class PlainView_Delegate
class Templater_PlainView extends Templater
{
- public function fetch($tmpl)
+ public function fetch($tmpl, $vars=array())
{
extract($this->_vars, EXTR_OVERWRITE);
+ extract($vars, EXTR_OVERWRITE);
$P=&$this->P;
ob_start();
include($this->_tmplPath . '/' . $tmpl);
diff --git a/QFW/Templater/Proxy.php b/QFW/Templater/Proxy.php
index d804b78..1e8a641 100644
--- a/QFW/Templater/Proxy.php
+++ b/QFW/Templater/Proxy.php
@@ -52,7 +52,7 @@ class Templater_Proxy extends Templater
parent::delete($spec);
}
- public function fetch($name)
+ public function fetch($name, $vars=array())
{
$key=substr($name,strrpos($name,'.')+1);
$T = isset(QFW::$config['templater']['exts'][$key]) ?
@@ -75,7 +75,7 @@ class Templater_Proxy extends Templater
$this->syncronize($this->templates[$T]['c']);
$this->templates[$T]['s']=true;
}
- return $this->templates[$T]['c']->fetch($name);
+ return $this->templates[$T]['c']->fetch($name, $vars);
}
/**
diff --git a/QFW/Templater/Smarty.php b/QFW/Templater/Smarty.php
index b0ae22c..7a85aad 100644
--- a/QFW/Templater/Smarty.php
+++ b/QFW/Templater/Smarty.php
@@ -111,9 +111,18 @@ class Templater_Smarty extends Templater
return $this->getEngine()->get_template_vars($var);
}
- public function fetch($name)
+ public function fetch($name, $vars=array())
{
- return $this->getEngine()->fetch($name);
+ if (!$vars)
+ return $this->getEngine()->fetch($name);
+ //если есть локальные переменные - сохраняем старые
+ //Smarty не поддерживает локальные переменные
+ $old = $this->getEngine()->get_template_vars();
+ $this->getEngine()->assign($vars);
+ $data = $this->getEngine()->fetch($name);
+ $this->getEngine()->clear_all_assign();
+ $this->getEngine()->assign($old);
+ return $data;
}
/**
diff --git a/QFW/Templater/Templater.php b/QFW/Templater/Templater.php
index a512db6..1ff31ce 100644
--- a/QFW/Templater/Templater.php
+++ b/QFW/Templater/Templater.php
@@ -46,6 +46,20 @@ abstract class Templater
}
/**
+ * Добавлеет в массив в шаблонизаторе новое значение
+ *
+ * @param string $name имя массива
+ * @param mixed $value значение
+ */
+ public function append($name, $value)
+ {
+ if (empty($this->_vars[$name]))
+ $this->_vars[$name] = array();
+ $this->_vars[$name][] = $value;
+ return $this;
+ }
+
+ /**
* Удаляет указанную переменную из шаблона
*
* @param string|array имя переменной или массив имен
@@ -124,12 +138,12 @@ abstract class Templater
/**
* Синоним fetch
*/
- public function render($tmpl)
+ public function render($tmpl, $vars=array())
{
- return $this->fetch($tmpl);
+ return $this->fetch($tmpl, $vars);
}
- abstract public function fetch($tmpl);
+ abstract public function fetch($tmpl, $vars=array());
/**
* Генерирует полный вывод, обрабатывает фильтрами
diff --git a/QFW/Templater/Twig.php b/QFW/Templater/Twig.php
index 8dad408..619e246 100644
--- a/QFW/Templater/Twig.php
+++ b/QFW/Templater/Twig.php
@@ -62,11 +62,11 @@ class Templater_Twig extends Templater
return true;
}
- public function fetch($name)
+ public function fetch($name, $vars=array())
{
$template = $this->getEngine()->loadTemplate($name);
$this->assign('P', $this->P);
- return $template->render($this->_vars);
+ return $template->render($vars + $this->_vars);
}
/**
commit 8c2b2d6a033b9b3d5ea7fce1c11eddbe2245d587
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Dec 13 13:14:52 2010 +0300
Фильтр для чекбокса
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 93d1d4a..09fb737 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -417,6 +417,35 @@ class Scaffold_Checkbox extends Scaffold_Field
default="'.($value?'checked':'').'" />';
}
+ /**
+ * Часть условия WHERE для данного фильтра
+ *
+ * @param mixed $session сохраненное в сессии значение
+ * @return DbSimple_SubQuery часть запроса к базе данных
+ */
+ public function filterWhere($session)
+ {
+ if ($session == 0)
+ return QFW::$db->subquery('');
+ return QFW::$db->subquery('?# LIKE ?',
+ array($this->table=>$this->name), $session==1 ? '1' : '0');
+ }
+
+ /**
+ * Формирует поле ввода для фильтра
+ *
+ * @param mixed $session сохраненные в сесии данные
+ * @return string часть формы для фильтра
+ */
+ public function filterForm($session)
+ {
+ return '<fieldset>'.$this->title.':
+ <label><input type="radio" name="filter['.$this->name.']" value=""'.($session==0 ? ' checked': '').'> любой</label>
+ <label><input type="radio" name="filter['.$this->name.']" value="1"'.($session==1 ? ' checked': '').'> установлен</label>
+ <label><input type="radio" name="filter['.$this->name.']" value="-1"'.($session==-1 ? ' checked': '').'> сброшен</label>
+ </fieldset>';
+ }
+
}
/**
commit a2ed372be6d8f94c0c601184ee672d49424ce944
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Dec 10 20:55:04 2010 +0300
Постим туда-же, с параметрами
diff --git a/lib/Modules/Scaffold/scaffold/edit.php b/lib/Modules/Scaffold/scaffold/edit.php
index cd4e9d4..163183f 100644
--- a/lib/Modules/Scaffold/scaffold/edit.php
+++ b/lib/Modules/Scaffold/scaffold/edit.php
@@ -1,6 +1,6 @@
<?php require dirname(__FILE__).'/info.php' ?>
<?php echo $this->block(Url::C('preForm'), $id); ?>
-<form action="<?php echo Url::C('edit/'.$id) ?>" class="scaffoldEdit"
+<form class="scaffoldEdit"
method="post" id="form_<?php echo $table ?>" enctype="multipart/form-data">
<?php echo $this->block(Url::C('preEdit'), $id); ?>
<dl>
commit 7d29d2e026a07adb3c078ae20b3e89d107ba1f83
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Dec 10 20:38:57 2010 +0300
Загрузка файлов - фикс
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index ca02e33..93d1d4a 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -526,9 +526,8 @@ class Scaffold_File extends Scaffold_Field
$info = pathinfo($this->postField($id, 'name'));
if (empty($info['extension']))
return '';
- if ($id == -1)
- $id = time();
- $new_name = $this->genFunc ? call_user_func($this->genFunc, $this->name, $id, '.'.$info['extension']) : $this->name.'_'.$id.'.'.$info['extension'];
+ $p = $id == -1 ? time() : $id;
+ $new_name = $this->genFunc ? call_user_func($this->genFunc, $this->name, $id, '.'.$info['extension']) : $this->name.'_'.$p.'.'.$info['extension'];
move_uploaded_file($this->postField($id, 'tmp_name'), $this->path.'/'.$new_name);
return $new_name;
}
commit 8e06a19ef7ba963ad8b01500f58f48cc0bd84791
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Dec 10 18:53:42 2010 +0300
Правка загрузки файлов
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index e7bdae3..ca02e33 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -265,6 +265,8 @@ class Scaffold_Foreign extends Scaffold_Field
public function editor($id, $value)
{
+ if (isset($_POST['data'][$id][$this->name]))
+ $value = $_POST['data'][$id][$this->name];
return $this->selectBuild($id, $this->lookup, $value, $this->isnull);
}
@@ -391,6 +393,8 @@ class Scaffold_Enum extends Scaffold_Field
public function editor($id, $value)
{
+ if (isset($_POST['data'][$id][$this->name]))
+ $value = $_POST['data'][$id][$this->name];
return $this->selectBuild($id, $this->items, $value, false);
}
@@ -590,12 +594,8 @@ class Scaffold_Image extends Scaffold_File
public function proccess($id, $value, $old)
{
//если запись удалили
- if ($value === false)
- {
- if (is_file($this->path.'/'.$old))
- unlink($this->path.'/'.$old);
- return '';
- }
+ if ($value === false && is_file($this->path.'/'.$old))
+ unlink($this->path.'/'.$old);
//оставляем старое значение
if ($this->postField($id, 'error') == 4 && !$value)
return $old ? $old : '';
@@ -607,9 +607,8 @@ class Scaffold_Image extends Scaffold_File
return '';
//генерим новое имя
$ext = $this->getImgType($this->postField($id, 'tmp_name'));
- if ($id == -1)
- $id = time();
- $new_name = $this->genFunc ? call_user_func($this->genFunc, $this->name, $id, $ext) : $this->name.'_'.$id.$ext;
+ $p = $id == -1 ? time() : $id;
+ $new_name = $this->genFunc ? call_user_func($this->genFunc, $this->name, $id, $ext) : $this->name.'_'.$p.$ext;
move_uploaded_file($this->postField($id, 'tmp_name'), $this->path.'/'.$new_name);
return $new_name;
}
-----------------------------------------------------------------------
Summary of changes:
QFW/Templater/PlainView.php | 3 +-
QFW/Templater/Proxy.php | 4 +-
QFW/Templater/Smarty.php | 13 ++++-
QFW/Templater/Templater.php | 20 ++++++-
QFW/Templater/Twig.php | 4 +-
lib/Modules/Scaffold/Fields.php | 51 +++++++++++++++-----
lib/Modules/Scaffold/scaffold/edit.php | 2 +-
tests/app/060_view_assigns.phpt | 52 ++++++++++++++++++++
.../default/controllers/AssignsController.php | 20 ++++++++
tests/testapp/default/templates/assigns.php | 8 +++
10 files changed, 154 insertions(+), 23 deletions(-)
create mode 100644 tests/app/060_view_assigns.phpt
create mode 100644 tests/testapp/default/controllers/AssignsController.php
create mode 100644 tests/testapp/default/templates/assigns.php
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-12-09 19:02:30
|
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 f194b28a3e20242addcc86b22dec7a1b59d37cef (commit)
via 3782a361fc6af24eb965b1263b527972e3359877 (commit)
via 50f365c06a2be1b59f981dbab77f5a32a18a1186 (commit)
via 313250545da8f002a09a5f8aee1205db8330bc69 (commit)
via 2b456bdbb8f65c41e5771950fbf3f64df901edd6 (commit)
via 84d76c3d87657809326de4a8ecc867294557c8ab (commit)
from b4f8c135aa485ee9aaf59a9514b8eafd04ff3e48 (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 f194b28a3e20242addcc86b22dec7a1b59d37cef
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Dec 8 16:14:02 2010 +0300
Нотайсы в скафолде
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 677d2ba..e7bdae3 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -520,6 +520,8 @@ class Scaffold_File extends Scaffold_Field
return '';
//генерим новое имя
$info = pathinfo($this->postField($id, 'name'));
+ if (empty($info['extension']))
+ return '';
if ($id == -1)
$id = time();
$new_name = $this->genFunc ? call_user_func($this->genFunc, $this->name, $id, '.'.$info['extension']) : $this->name.'_'.$id.'.'.$info['extension'];
@@ -545,8 +547,8 @@ class Scaffold_File extends Scaffold_Field
*/
protected function postField($id, $field)
{
- return $_FILES['fdata'][$field][$id][$this->name];
- //return 'data['.$id.']['.$this->name.']';
+ return isset($_FILES['fdata'][$field][$id][$this->name]) ?
+ $_FILES['fdata'][$field][$id][$this->name] : '';
}
}
commit 3782a361fc6af24eb965b1263b527972e3359877
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Dec 8 13:19:36 2010 +0300
Установка display в любой момент - так как ничего не мешает
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 96b3f18..5803041 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -650,6 +650,23 @@ abstract class ScaffoldController extends Controller
}
/**
+ * Устанавливает отображение для столбцев
+ *
+ * @param string|array $colum Колонка<br>
+ * Или массив ключи - колонки => значения
+ * @param string $value значение
+ * @return ScaffoldController
+ */
+ protected function setDisp($colum, $value='')
+ {
+ if (!is_array($colum))
+ $colum = array($colum => $value);
+ foreach ($colum as $col=>$val)
+ $this->getInfoClass($col)->disp = $val;
+ return $this;
+ }
+
+ /**
* Скрывает при выводе и редактировании указанные колонки
*
* <br><br> Вызывается только в конструкторе
commit 50f365c06a2be1b59f981dbab77f5a32a18a1186
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Dec 8 13:19:03 2010 +0300
Скафолд - для файлов accept
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index d0e971f..677d2ba 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -456,6 +456,8 @@ class Scaffold_File extends Scaffold_Field
protected $download;
/** @var function Генерит имя файла */
protected $genFunc;
+ /** @var string параметр accept */
+ protected $accept;
/**
* Проверяет параметры для файлового поля
@@ -471,6 +473,7 @@ class Scaffold_File extends Scaffold_Field
throw new Exception('Неверная директория для файлов '.$info->typeParams['path'], 1);
if (!is_writable($info->typeParams['path']))
throw new Exception('Нельзя писать в директорию файлов '.$info->typeParams['path'], 1);
+ $this->accept = !empty($info->typeParams['accept']) ? 'accept="'.$info->typeParams['accept'].'"' : '';
$this->path = $info->typeParams['path'];
$this->genFunc = !empty($info->typeParams['genFunc']) ? $info->typeParams['genFunc'] : false;
$this->prim = $info->primaryKey;
@@ -482,7 +485,7 @@ class Scaffold_File extends Scaffold_Field
public function editor($id, $value)
{
- return '<input type="file" name="f'.$this->editName($id).'" />
+ return '<input type="file" name="f'.$this->editName($id).'" '.$this->accept.' />
<input type="hidden" name="'.$this->editName($id).'" value="0" />
<input type="checkbox" name="'.$this->editName($id).'" value="1" label="Удалить" />'.
'<div>'.$this->display($id, $value).'</div>';
@@ -550,6 +553,12 @@ class Scaffold_File extends Scaffold_Field
class Scaffold_Image extends Scaffold_File
{
+ public function __construct($info)
+ {
+ if (empty($info->typeParams['accept']))
+ $info->typeParams['accept'] = 'image/*';
+ parent::__construct($info);
+ }
public function display($id, $value)
{
commit 313250545da8f002a09a5f8aee1205db8330bc69
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Dec 7 18:28:35 2010 +0300
Скафолдинг - класс для инфы об отображении
diff --git a/lib/Modules/Scaffold/Display.php b/lib/Modules/Scaffold/Display.php
new file mode 100644
index 0000000..a98826d
--- /dev/null
+++ b/lib/Modules/Scaffold/Display.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Группа значений, от которых зависит показ поля
+ *
+ * @author ivan
+ */
+class Scaffold_Display
+{
+ public $list;
+ public $edit;
+ public $new;
+ public $multiedit;
+ public $multidel;
+
+ public function __construct()
+ {
+ $this->edit = $this->list = $this->multiedit = $this->multidel = $this->new = true;
+ }
+
+ public function show()
+ {
+
+ }
+ public function hide()
+ {
+
+ }
+
+}
+
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 7d0ebae..d0e971f 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -1,6 +1,7 @@
<?php
require_once LIBPATH.'/utils.php';
+require_once dirname(__FILE__).'/Display.php';
/**
* Класс, на основе которого создаются остальные<br>
@@ -11,6 +12,8 @@ class Scaffold_Field_Info
{
/** @var boolean скрытое поле */
public $hide = null;
+ /** @var Scaffold_Display условие показа */
+ public $disp = false;
/** @var string класс поля */
public $type = false;
/** @var string параметры класса */
@@ -67,6 +70,16 @@ class Scaffold_Field extends Scaffold_Field_Info
$this->default = $info->fiendInfo['Default'];
if (!$this->title)
$this->title = $this->name;
+ //для совместимости
+ if ($this->disp === false)
+ {
+ $this->disp = new Scaffold_Display();
+ $this->disp->list =
+ $this->disp->edit =
+ $this->disp->new =
+ $this->disp->multiedit =
+ $this->disp->multidel = !$this->hide;
+ }
}
/**
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index e1e45b6..96b3f18 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -636,6 +636,20 @@ abstract class ScaffoldController extends Controller
////////////////////////////////////////////////////////////
/**
+ * Условия отображения колонки
+ *
+ * <br><br> Вызывается только в конструкторе
+ *
+ * @param string|array $colum Колонка или массив колонок, которые нужно скрыть
+ * @param boolean $disp Scaffold_Display
+ * @return ScaffoldController
+ */
+ protected function disp($colum, $disp)
+ {
+ return $this->setColumOpt('disp', $colum, $disp);
+ }
+
+ /**
* Скрывает при выводе и редактировании указанные колонки
*
* <br><br> Вызывается только в конструкторе
diff --git a/lib/Modules/Scaffold/scaffold/edit.php b/lib/Modules/Scaffold/scaffold/edit.php
index 732b7a0..cd4e9d4 100644
--- a/lib/Modules/Scaffold/scaffold/edit.php
+++ b/lib/Modules/Scaffold/scaffold/edit.php
@@ -8,7 +8,9 @@
<?php echo $this->block(Url::C('preEditField'.ucfirst($k)), $id); ?>
<?php
$i = $fields[$k];
- if ($i->hide)
+ if ($id == -1 && !$i->disp->new)
+ continue;
+ if (!$i->disp->edit)
continue;
//по умолчанию первичный ключ не редактируем, но если принудительно установим показ
if (!$i->primaryKey && !($i->hide === false))
diff --git a/lib/Modules/Scaffold/scaffold/index.php b/lib/Modules/Scaffold/scaffold/index.php
index 547a41d..98bfb19 100644
--- a/lib/Modules/Scaffold/scaffold/index.php
+++ b/lib/Modules/Scaffold/scaffold/index.php
@@ -7,17 +7,28 @@
<?php echo $pager; ?>
-<?php if (count($data)>0) { $cols = 3 + (empty($actions) ? 0 : 1); // с чекбоксами, редактирование+удаление, действия ?>
+<?php if (count($data)>0) { $cols = 3 + (empty($actions) ? 0 : 1); // с чекбоксами, редактирование+удаление, действия
+//считаем колонки
+foreach(current($data) as $key=>$v)
+ $cols += $fields[$key]->disp->list ? 1 : 0;
+?>
<form action="" method="post" enctype="multipart/form-data">
<table id="table_<?php echo $table ?>" class="scaffoldTable">
<thead>
<tr>
+ <td colspan="<?php echo $cols ?>">
+ <input type="button" class="button" value="Добавить" onclick="window.location.href='<?php echo Url::C('edit/-1') ?>'" />
+ <input type="submit" name="edit" value="Редактировать выбранных" />
+ <input type="submit" name="delete" value="Удалить выбранных" />
+ <?php echo $this->block(Url::C('multiPost')); ?>
+ </td>
+</tr>
+<tr>
<th><input type="checkbox" class="multiSelect" /></th>
<?php foreach(current($data) as $key=>$v) {
$i = $fields[$key];
- if ($i->hide)
+ if (!$i->disp->list)
continue;
- $cols++;
?>
<th><a href="<?php echo Url::C('sort/'.$key) ?>"><?php echo $i->title ?></a>
<?php if (isset($order) && $order['field'] == $key) { ?><span class="scaffoldSort">
@@ -40,7 +51,7 @@
<td><input type="checkbox" name="id[]" value="<?php echo $id ?>" /></td>
<?php foreach($row as $key=>$v) {
$i = $fields[$key];
- if ($i->hide)
+ if (!$i->disp->list)
continue;
?>
<td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>><?php //отображение обычного не связанного поля
@@ -61,6 +72,7 @@
</tbody>
<tfoot>
<tr><td colspan="<?php echo $cols ?>">
+ <input type="button" class="button" value="Добавить" onclick="window.location.href='<?php echo Url::C('edit/-1') ?>'" />
<input type="submit" name="edit" value="Редактировать выбранных" />
<input type="submit" name="delete" value="Удалить выбранных" />
<?php echo $this->block(Url::C('multiPost')); ?>
commit 2b456bdbb8f65c41e5771950fbf3f64df901edd6
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Dec 2 14:20:28 2010 +0300
Исправлена ошибка в хелперах
diff --git a/application/helper/controllers/NavController.php b/application/helper/controllers/NavController.php
index a631ede..7673245 100644
--- a/application/helper/controllers/NavController.php
+++ b/application/helper/controllers/NavController.php
@@ -48,6 +48,8 @@ class NavController
return '';
if ($cur == false)
$cur = QFW::$router->RequestUri;
+ if ($cur instanceof Url)
+ $cur = $cur->intern();
$result = '<ul'.($id?' id="'.$id.'"':'').'>';
$result.=$this->menuTreeNodes($items, $cur);
$result.= '</ul>';
@@ -96,6 +98,8 @@ class NavController
return '';
if ($cur == false)
$cur = QFW::$router->RequestUri;
+ if ($cur instanceof Url)
+ $cur = $cur->intern();
$result = '<ul'.($id?' id="'.$id.'"':'').'>';
foreach ($items as $k=>$v)
{
commit 84d76c3d87657809326de4a8ecc867294557c8ab
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Dec 2 12:59:42 2010 +0300
Пустой int
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index e3e3169..7d0ebae 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -106,7 +106,6 @@ class Scaffold_Field extends Scaffold_Field_Info
*/
public function validator($id, $value)
{
- var_dump($this->required);
if ($this->required && empty($value))
return false;
return true;
@@ -323,6 +322,11 @@ class Scaffold_Int extends Scaffold_Field
{
public function validator($id, $value)
{
+ $res = parent::validator($id, $value);
+ if ($res !== true)
+ return $res;
+ if (!$this->required && empty($value))
+ return true;
return is_numeric($value);
}
}
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 68d54a2..e1e45b6 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -345,6 +345,7 @@ abstract class ScaffoldController extends Controller
$state = new TemplaterState(QFW::$view);
QFW::$view->setScriptPath(dirname(__FILE__));
+ $this->assignMainInfo();
return QFW::$view->assign(array(
'id' => $id,
'data' => $data,
diff --git a/lib/Modules/Scaffold/scaffold/info.php b/lib/Modules/Scaffold/scaffold/info.php
index 4582d5c..67bbcae 100644
--- a/lib/Modules/Scaffold/scaffold/info.php
+++ b/lib/Modules/Scaffold/scaffold/info.php
@@ -6,4 +6,4 @@
<?php
//вывели сообщения, очищаем
$session['messages']=array();
-?>
\ No newline at end of file
+?>
-----------------------------------------------------------------------
Summary of changes:
application/helper/controllers/NavController.php | 4 ++
lib/Modules/Scaffold/Display.php | 30 ++++++++++++++++++
lib/Modules/Scaffold/Fields.php | 36 +++++++++++++++++++--
lib/Modules/Scaffold/ScaffoldController.php | 32 +++++++++++++++++++
lib/Modules/Scaffold/scaffold/edit.php | 4 ++-
lib/Modules/Scaffold/scaffold/index.php | 20 ++++++++++--
lib/Modules/Scaffold/scaffold/info.php | 2 +-
7 files changed, 118 insertions(+), 10 deletions(-)
create mode 100644 lib/Modules/Scaffold/Display.php
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-12-01 20:46:43
|
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 b4f8c135aa485ee9aaf59a9514b8eafd04ff3e48 (commit)
via c24eaf6eaa50759fdf80ea677f837f12f8c63010 (commit)
via 92f0b2ae8ccb77d0701da3f1f9f3b608fd5aef27 (commit)
via 30a43b067f81887ad53957a6713559f6b6d044e6 (commit)
via 25e4c4979ca9815bc8594882b0b08edd3075ca78 (commit)
via d8e6daceb0f469cd8259fb1a1208f7b52d8eb880 (commit)
via 4aa9bded18576e6974e1f839688d02a51227c36d (commit)
via 60e25d354d1b089d382053d4e6eca22842445075 (commit)
via 46e8cece03258ca756c2942bf9c8ed169b5fd4b2 (commit)
via 6d2685713e4329172fb79f5bfbaf14a454958c70 (commit)
via 9249c6aa2a062279ed5ee7bacf20322a775ca6ab (commit)
via 8eac6a03dc867bc53918df0262aed8d2ad5301ee (commit)
via c43822d8b9dabd38c21a193b6e5d4aa7b25cf980 (commit)
via 80978b34317acf68a717fa595169b15b0e6b73a6 (commit)
via 64b69b3247c13721cc452d039a5e43d7216c5051 (commit)
from d551551f5e9ca0c115506e8ffbf6112cea97ae35 (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 b4f8c135aa485ee9aaf59a9514b8eafd04ff3e48
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Dec 1 16:22:41 2010 +0300
Обработка из обычного edit в функцию
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 3ac0db1..68d54a2 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -322,46 +322,9 @@ abstract class ScaffoldController extends Controller
if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_POST['data'][$id])>0)
{
- //Обработка результата редактирования
- $data = $_POST['data'][$id];
- foreach ($data as $k=>$v)
- {
- if (isset($this->methods['validator_'.ucfirst($k)]))
- $res = call_user_func(array($this, 'validator_'.ucfirst($k)), $v, $id);
- else
- $res = $this->fields[$k]->validator($id, $v);
- if ($res !== true)
- $errors[$k] = $res;
- if ($res === false)
- $errors[$k] = 'Поле '.$this->fields[$k]->title.' имеет некорректное значение';
- }
- //Если ошибок нет, то записываем в базу изменения
- if (count($errors))
- $this->messages['error'] = $errors;
- else
+ $res = $this->multiEditPost($_POST['data']);
+ if ($res)
{
- $old = $this->getOldVars($id);
- //Обработка данных после POST
- foreach ($this->fields as $k=>$class)
- if ($k == $this->primaryKey && !isset($data[$k]))
- continue; //не трогаем первичный ключ
- elseif (isset($this->methods['proccess_'.ucfirst($k)]))
- $data[$k] = call_user_func(array($this, 'proccess_'.ucfirst($k)),
- isset($data[$k]) ? $data[$k] : $old[$k], $id, $old[$k]);
- else
- $data[$k] = $class->proccess($id,
- isset($data[$k]) ? $data[$k] : $old[$k], $old[$k]);
-
- if ($id == -1)
- $ins_id = QFW::$db->query('INSERT INTO ?#(?#) VALUES(?a)',
- $this->table, array_keys($data), array_values($data));
- else
- QFW::$db->query('UPDATE ?# SET ?a WHERE ?#=?',
- $this->table, $data, $this->primaryKey, $id);
-
- if (isset($this->methods['postEdit']))
- call_user_func(array($this, 'postEdit'), $id == -1 ? $ins_id : $id);
-
//редирект назад
if (!empty($this->sess['return']))
{
@@ -371,7 +334,6 @@ abstract class ScaffoldController extends Controller
}
else
QFW::$router->redirect(Url::C('index'));
-
}
}
commit c24eaf6eaa50759fdf80ea677f837f12f8c63010
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Dec 1 15:50:00 2010 +0300
Починил зависимую таблицу - POST
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 4663a47..3ac0db1 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -196,6 +196,11 @@ abstract class ScaffoldController extends Controller
//обработка выбора мультиедита и мультидела
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
+ if (isset($_POST['parent']))
+ {
+ $this->sess['parent'] = $_POST['parent'];
+ QFW::$router->redirect(Url::A());
+ }
if (empty($_POST['id']))
QFW::$router->redirect(Url::C('index'));
if (empty($_POST['edit']) && empty($_POST['delete']))
@@ -224,11 +229,6 @@ abstract class ScaffoldController extends Controller
$parent = QFW::$db->selectCol('SELECT ?# AS ARRAY_KEY, ?# FROM ?# ?s',
$this->parentData['key'], $this->parentData['field'],
$this->parentData['table'], $this->parentData['other']);
- if (isset($_POST['parent']))
- {
- $this->sess['parent'] = $_POST['parent'];
- QFW::$router->redirect(Url::A());
- }
if (empty($this->sess['parent']))
$this->sess['parent'] = count($parent) ? key($parent) : 0;
commit 92f0b2ae8ccb77d0701da3f1f9f3b608fd5aef27
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Dec 1 15:26:19 2010 +0300
Мультиедит
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 164e65e..4663a47 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -163,7 +163,7 @@ abstract class ScaffoldController extends Controller
),
'messages' => $this->messages,
));
- }
+ }
/**
* Востанавливает данные сессии по умолчанию
@@ -246,9 +246,9 @@ abstract class ScaffoldController extends Controller
WHERE ?s ?s '.$this->where, $this->table, $filter['where'], $parentWhere);
$foreign = $this->getForeign();
- $data = QFW::$db->select('SELECT ?# ?s FROM ?# ?s
+ $data = QFW::$db->select('SELECT ?# AS ARRAY_KEY, ?# ?s FROM ?# ?s
WHERE ?s ?s '.$this->where.' ?s LIMIT ?d, ?d',
- array($this->table=>array_merge($this->order, array('*'))),
+ $this->primaryKey, array($this->table=>array_merge($this->order, array('*'))),
$foreign['field'], $this->table, $foreign['join'],
$filter['where'], $parentWhere,
$this->getSort(),
@@ -457,6 +457,105 @@ abstract class ScaffoldController extends Controller
))->fetch('scaffold/multidel.php');
}
+ public function multiEditAction()
+ {
+ if (empty($this->sess['multi']['ids']))
+ QFW::$router->redirect(Url::C('index'));
+ $ids = $this->sess['multi']['ids'];
+ require_once LIBPATH.'/HTML/FormPersister.php';
+ ob_start(array(new HTML_FormPersister(), 'process'));
+ $errors = array();
+ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['edit']))
+ {
+ $res = $this->multiEditPost($_POST['data']);
+ if ($res)
+ {
+ $this->messages['success'][] = 'Выбранные записи отредактированы';
+ unset($this->sess['multi']['ids']);
+ QFW::$router->redirect(Url::C('index'));
+ }
+ QFW::$view->assign('messages', $this->messages);
+ }
+ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['cancel']))
+ {
+ $this->messages['message'][] = 'редактирование отменено';
+ unset($this->sess['multi']['ids']);
+ QFW::$router->redirect(Url::C('index'));
+ }
+
+ $state = new TemplaterState(QFW::$view);
+ QFW::$view->setScriptPath(dirname(__FILE__));
+
+ $foreign = $this->getForeign();
+ $data = QFW::$db->select('SELECT ?# AS ARRAY_KEY, ?# ?s FROM ?# ?s
+ WHERE ?# IN (?a) ?s',
+ $this->primaryKey, array($this->table=>array_merge($this->order, array('*'))),
+ $foreign['field'], $this->table, $foreign['join'],
+ $this->primaryKey, $ids,
+ $this->getSort());
+ return QFW::$view->assign(array(
+ 'data' => $data,
+ ))->fetch('scaffold/multiedit.php');
+ }
+
+ /**
+ * Редактирование данных
+ *
+ * @param array $alldata данные
+ * @return bool успешно отредактировано
+ */
+ private function multiEditPost($alldata)
+ {
+ $errors = array();
+ //Обработка результата редактирования
+ foreach($alldata as $id => $data)
+ foreach ($data as $k=>$v)
+ {
+ if (isset($this->methods['validator_'.ucfirst($k)]))
+ $res = call_user_func(array($this, 'validator_'.ucfirst($k)), $v, $id);
+ else
+ $res = $this->fields[$k]->validator($id, $v);
+ if ($res !== true)
+ $errors[$k] = $res;
+ if ($res === false)
+ $errors[$k] = 'Поле '.$this->fields[$k]->title.' имеет некорректное значение';
+ }
+
+ //Если ошибок нет, то записываем в базу изменения
+ if (count($errors))
+ {
+ $this->messages['error'] = $errors;
+ return false;
+ }
+
+ foreach($alldata as $id => $data)
+ {
+ $old = $this->getOldVars($id);
+ //Обработка данных после POST
+ foreach ($this->fields as $k=>$class)
+ if ($k == $this->primaryKey && !isset($data[$k]))
+ continue; //не трогаем первичный ключ
+ elseif (isset($this->methods['proccess_'.ucfirst($k)]))
+ $data[$k] = call_user_func(array($this, 'proccess_'.ucfirst($k)),
+ isset($data[$k]) ? $data[$k] : $old[$k], $id, $old[$k]);
+ else
+ $data[$k] = $class->proccess($id,
+ isset($data[$k]) ? $data[$k] : $old[$k], $old[$k]);
+
+ //вообще при редактировании быть не может, но для вставки
+ if ($id == -1)
+ $ins_id = QFW::$db->query('INSERT INTO ?#(?#) VALUES(?a)',
+ $this->table, array_keys($data), array_values($data));
+ else
+ QFW::$db->query('UPDATE ?# SET ?a WHERE ?#=?',
+ $this->table, $data, $this->primaryKey, $id);
+
+ if (isset($this->methods['postEdit']))
+ call_user_func(array($this, 'postEdit'), $id == -1 ? $ins_id : $id);
+ }
+ return true;
+ }
+
/**
* Вызывает действие, привязанное к определенному полю
*
@@ -732,8 +831,8 @@ abstract class ScaffoldController extends Controller
private function getOldVars($id)
{
if ($id != -1)
- return QFW::$db->selectRow('SELECT ?# FROM ?# WHERE ?#=?',
- array($this->table=>array_merge($this->order, array('*'))),
+ return QFW::$db->selectRow('SELECT ?# AS ARRAY_KEY, ?# FROM ?# WHERE ?#=?',
+ $this->primaryKey, array($this->table=>array_merge($this->order, array('*'))),
$this->table, $this->primaryKey, $id);
//получение дефолтовых значений для новой записи
diff --git a/lib/Modules/Scaffold/scaffold/index.php b/lib/Modules/Scaffold/scaffold/index.php
index 34e549b..547a41d 100644
--- a/lib/Modules/Scaffold/scaffold/index.php
+++ b/lib/Modules/Scaffold/scaffold/index.php
@@ -8,12 +8,12 @@
<?php echo $pager; ?>
<?php if (count($data)>0) { $cols = 3 + (empty($actions) ? 0 : 1); // с чекбоксами, редактирование+удаление, действия ?>
-<form action="" method="post">
+<form action="" method="post" enctype="multipart/form-data">
<table id="table_<?php echo $table ?>" class="scaffoldTable">
<thead>
<tr>
<th><input type="checkbox" class="multiSelect" /></th>
- <?php foreach($data[0] as $key=>$v) {
+ <?php foreach(current($data) as $key=>$v) {
$i = $fields[$key];
if ($i->hide)
continue;
@@ -37,7 +37,7 @@
<tbody>
<?php foreach($data as $id=>$row) { ?>
<tr>
- <td><input type="checkbox" name="id[]" value="<?php echo $row[$primaryKey] ?>" /></td>
+ <td><input type="checkbox" name="id[]" value="<?php echo $id ?>" /></td>
<?php foreach($row as $key=>$v) {
$i = $fields[$key];
if ($i->hide)
@@ -45,9 +45,9 @@
?>
<td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>><?php //отображение обычного не связанного поля
if (isset($methods['display_'.ucfirst($key)]))
- echo call_user_func($class.'::display_'.ucfirst($key), $row[$primaryKey], $v);
+ echo call_user_func($class.'::display_'.ucfirst($key), $id, $v);
else
- echo $i->display($row[$primaryKey], $v);
+ echo $i->display($id, $v);
?></td>
<?php } ?>
<td><a href="<?php echo Url::C('edit/'.$row[$primaryKey]) ?>">ред.</a></td>
diff --git a/lib/Modules/Scaffold/scaffold/multidel.php b/lib/Modules/Scaffold/scaffold/multidel.php
index 6116d02..1d2c7f3 100644
--- a/lib/Modules/Scaffold/scaffold/multidel.php
+++ b/lib/Modules/Scaffold/scaffold/multidel.php
@@ -1,11 +1,11 @@
<?php require dirname(__FILE__).'/info.php' ?>
<?php $cols = 0; // при удалении дополнительных колонок нет ?>
-<form action="" method="post">
+<form action="" method="post" enctype="multipart/form-data">
<table id="table_<?php echo $table ?>" class="scaffoldTable">
<thead>
<tr>
- <?php foreach($data[0] as $key=>$v) {
+ <?php foreach(current($data) as $key=>$v) {
$i = $fields[$key];
if ($i->hide)
continue;
@@ -25,9 +25,9 @@
?>
<td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>><?php //отображение обычного не связанного поля
if (isset($methods['display_'.ucfirst($key)]))
- echo call_user_func($class.'::display_'.ucfirst($key), $row[$primaryKey], $v);
+ echo call_user_func($class.'::display_'.ucfirst($key), $id, $v);
else
- echo $i->display($row[$primaryKey], $v);
+ echo $i->display($id, $v);
?></td>
<?php } ?>
</tr>
diff --git a/lib/Modules/Scaffold/scaffold/multiedit.php b/lib/Modules/Scaffold/scaffold/multiedit.php
new file mode 100644
index 0000000..f783b4b
--- /dev/null
+++ b/lib/Modules/Scaffold/scaffold/multiedit.php
@@ -0,0 +1,50 @@
+<?php require dirname(__FILE__).'/info.php' ?>
+
+<?php $cols = 0; // при удалении дополнительных колонок нет ?>
+<form action="" method="post" enctype="multipart/form-data">
+<table id="table_<?php echo $table ?>" class="scaffoldTable">
+<thead>
+<tr>
+ <?php foreach(current($data) as $key=>$v) {
+ $i = $fields[$key];
+ if ($i->hide)
+ continue;
+ if (!$i->primaryKey && !($i->hide === false))
+ continue;
+ //по умолчанию первичный ключ не редактируем, но если принудительно установим показ
+ $cols++;
+ ?>
+ <th><?php echo $i->title ?></th>
+ <?php } ?>
+</tr>
+</thead>
+<tbody>
+<?php foreach($data as $id=>$row) { ?>
+<tr>
+ <?php foreach($row as $key=>$v) {
+ $i = $fields[$key];
+ if ($i->hide)
+ continue;
+ if (!$i->primaryKey && !($i->hide === false))
+ continue;
+ //по умолчанию первичный ключ не редактируем, но если принудительно установим показ
+ ?>
+ <td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>>
+ <?php
+ if (isset($methods['editor_'.ucfirst($key)]))
+ echo call_user_func($class.'::editor_'.ucfirst($key), $id, $v);
+ else
+ echo $i->editor($id, $v);
+ ?></td>
+ <?php } ?>
+</tr>
+<?php } ?>
+</tbody>
+<tfoot>
+<tr><td colspan="<?php echo $cols ?>">
+ <input type="submit" name="edit" value="Редактировать" />
+ <input type="submit" name="cancel" value="Отменить" />
+</td></tr>
+</tfoot>
+</table>
+</form>
commit 30a43b067f81887ad53957a6713559f6b6d044e6
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Dec 1 14:11:54 2010 +0300
Мультидел
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 3f78628..164e65e 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -43,6 +43,8 @@ abstract class ScaffoldController extends Controller
protected $addOnBottom = true;
/** @var bool Показывать картинки при сортировке */
protected $sortImages = false;
+ /** @var bool Подключить JS и jquery */
+ protected $useJs = true;
/** @var array Массив методов */
private $methods;
@@ -103,7 +105,12 @@ abstract class ScaffoldController extends Controller
*/
public function __construct()
{
- QFW::$view->P->addCSS('built-in/scaffold.css');
+ Hlp::addCSS('built-in/scaffold.css');
+ if ($this->useJs)
+ {
+ Hlp::addJS('js/jquery.js');
+ Hlp::addJS('built-in/scaffold.js');
+ }
$this->session();
//Создаем сессию для таблицы и ссылаемся на нее
if (!isset($_SESSION['scaffold'][$this->table]))
@@ -186,6 +193,25 @@ abstract class ScaffoldController extends Controller
*/
public function indexAction($page=1)
{
+ //обработка выбора мультиедита и мультидела
+ if ($_SERVER['REQUEST_METHOD'] == 'POST')
+ {
+ if (empty($_POST['id']))
+ QFW::$router->redirect(Url::C('index'));
+ if (empty($_POST['edit']) && empty($_POST['delete']))
+ QFW::$router->redirect(Url::C('index'));
+ $this->sess['multi']['ids'] = $_POST['id'];
+ if (!empty($_POST['edit']))
+ QFW::$router->redirect(Url::C('multiEdit'));
+ elseif (!empty($_POST['delete']))
+ QFW::$router->redirect(Url::C('multiDelete'));
+ else
+ {
+ unset($this->sess['multi']);
+ QFW::$router->redirect(Url::C('index'), true);
+ }
+ }
+
// считаем страницы с нуля и убираем отрицательные
$page = max($page-1, 0);
$state = new TemplaterState(QFW::$view);
@@ -293,7 +319,7 @@ abstract class ScaffoldController extends Controller
require_once LIBPATH.'/HTML/FormPersister.php';
ob_start(array(new HTML_FormPersister(), 'process'));
$errors = array();
-
+
if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_POST['data'][$id])>0)
{
//Обработка результата редактирования
@@ -380,10 +406,58 @@ abstract class ScaffoldController extends Controller
$v->proccess($id, false, $old[$k]);
QFW::$db->query('DELETE FROM ?# WHERE ?#=?',
$this->table, $this->primaryKey, $id);
+ $this->messages['success'][] = 'Запись успешно удалена';
QFW::$router->redirect(Url::C('index'), true);
}
/**
+ * Удаление множества строк
+ *
+ * <br>Если нужно обработать удаление как-то нестандартно,
+ * то функция должна быть перегружена
+ *
+ * @param string $id значение первичного ключа удаляемой строки
+ */
+ public function multiDeleteAction()
+ {
+ if (empty($this->sess['multi']['ids']))
+ QFW::$router->redirect(Url::C('index'));
+ $ids = $this->sess['multi']['ids'];
+ if ($_SERVER['REQUEST_METHOD'] == 'POST')
+ {
+ if (isset($_POST['delete']))
+ {
+ $olds = QFW::$db->select('SELECT ?# AS PRIMARY_KEY, ?# FROM ?# WHERE ?# IN (?a)',
+ $this->primaryKey, array($this->table=>array_merge($this->order, array('*'))),
+ $this->table, $this->primaryKey, $ids);
+ foreach($olds as $id=>$old)
+ foreach($this->fields as $k=>$v)
+ $v->proccess($id, false, $old[$k]);
+ QFW::$db->query('DELETE FROM ?# WHERE ?# IN (?a)',
+ $this->table, $this->primaryKey, $ids);
+ $this->messages['success'][] = 'Выбранные записи удалены';
+ }
+ elseif (isset($_POST['cancel']))
+ $this->messages['message'][] = 'Удаление отменено';
+ unset($this->sess['multi']['ids']);
+ QFW::$router->redirect(Url::C('index'));
+ }
+ $state = new TemplaterState(QFW::$view);
+ QFW::$view->setScriptPath(dirname(__FILE__));
+
+ $foreign = $this->getForeign();
+ $data = QFW::$db->select('SELECT ?# ?s FROM ?# ?s
+ WHERE ?# IN (?a) ?s',
+ array($this->table=>array_merge($this->order, array('*'))),
+ $foreign['field'], $this->table, $foreign['join'],
+ $this->primaryKey, $ids,
+ $this->getSort());
+ return QFW::$view->assign(array(
+ 'data' => $data,
+ ))->fetch('scaffold/multidel.php');
+ }
+
+ /**
* Вызывает действие, привязанное к определенному полю
*
* @param string $name имя поля
diff --git a/lib/Modules/Scaffold/scaffold/index.php b/lib/Modules/Scaffold/scaffold/index.php
index 6aeff32..34e549b 100644
--- a/lib/Modules/Scaffold/scaffold/index.php
+++ b/lib/Modules/Scaffold/scaffold/index.php
@@ -7,13 +7,17 @@
<?php echo $pager; ?>
-<?php if (count($data)>0) { ?>
+<?php if (count($data)>0) { $cols = 3 + (empty($actions) ? 0 : 1); // с чекбоксами, редактирование+удаление, действия ?>
+<form action="" method="post">
<table id="table_<?php echo $table ?>" class="scaffoldTable">
+<thead>
<tr>
+ <th><input type="checkbox" class="multiSelect" /></th>
<?php foreach($data[0] as $key=>$v) {
$i = $fields[$key];
if ($i->hide)
continue;
+ $cols++;
?>
<th><a href="<?php echo Url::C('sort/'.$key) ?>"><?php echo $i->title ?></a>
<?php if (isset($order) && $order['field'] == $key) { ?><span class="scaffoldSort">
@@ -29,8 +33,11 @@
<th colspan="2"><a href="<?php echo Url::C('edit/-1') ?>">доб.</a></th>
<?php if (count($actions)) { ?><th>действия</th><?php } ?>
</tr>
+</thead>
+<tbody>
<?php foreach($data as $id=>$row) { ?>
<tr>
+ <td><input type="checkbox" name="id[]" value="<?php echo $row[$primaryKey] ?>" /></td>
<?php foreach($row as $key=>$v) {
$i = $fields[$key];
if ($i->hide)
@@ -51,7 +58,16 @@
<?php } ?></td><?php } ?>
</tr>
<?php } ?>
+</tbody>
+<tfoot>
+<tr><td colspan="<?php echo $cols ?>">
+ <input type="submit" name="edit" value="Редактировать выбранных" />
+ <input type="submit" name="delete" value="Удалить выбранных" />
+ <?php echo $this->block(Url::C('multiPost')); ?>
+</td></tr>
+</tfoot>
</table>
+</form>
<?php } else { ?>
Записей нет
<?php if (!$options['addOnBottom']) {?>
diff --git a/lib/Modules/Scaffold/scaffold/multidel.php b/lib/Modules/Scaffold/scaffold/multidel.php
new file mode 100644
index 0000000..6116d02
--- /dev/null
+++ b/lib/Modules/Scaffold/scaffold/multidel.php
@@ -0,0 +1,43 @@
+<?php require dirname(__FILE__).'/info.php' ?>
+
+<?php $cols = 0; // при удалении дополнительных колонок нет ?>
+<form action="" method="post">
+<table id="table_<?php echo $table ?>" class="scaffoldTable">
+<thead>
+<tr>
+ <?php foreach($data[0] as $key=>$v) {
+ $i = $fields[$key];
+ if ($i->hide)
+ continue;
+ $cols++;
+ ?>
+ <th><?php echo $i->title ?></th>
+ <?php } ?>
+</tr>
+</thead>
+<tbody>
+<?php foreach($data as $id=>$row) { ?>
+<tr>
+ <?php foreach($row as $key=>$v) {
+ $i = $fields[$key];
+ if ($i->hide)
+ continue;
+ ?>
+ <td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>><?php //отображение обычного не связанного поля
+ if (isset($methods['display_'.ucfirst($key)]))
+ echo call_user_func($class.'::display_'.ucfirst($key), $row[$primaryKey], $v);
+ else
+ echo $i->display($row[$primaryKey], $v);
+ ?></td>
+ <?php } ?>
+</tr>
+<?php } ?>
+</tbody>
+<tfoot>
+<tr><td colspan="<?php echo $cols ?>">
+ <input type="submit" name="delete" value="Удалить" />
+ <input type="submit" name="cancel" value="Отменить" />
+</td></tr>
+</tfoot>
+</table>
+</form>
diff --git a/www/built-in/scaffold.css b/www/built-in/scaffold.css
index 2b52f05..10f5fd4 100644
--- a/www/built-in/scaffold.css
+++ b/www/built-in/scaffold.css
@@ -16,7 +16,7 @@ table.scaffoldTable
margin: 0;
}
-.scaffoldTable td:last-child, .scaffoldTable td:nth-last-child(2)
+.scaffoldTable td:last-child, .scaffoldTable td:nth-last-child(2), .scaffoldTable td:first-child
{
width: 25px;
}
diff --git a/www/built-in/scaffold.js b/www/built-in/scaffold.js
new file mode 100644
index 0000000..a548fd8
--- /dev/null
+++ b/www/built-in/scaffold.js
@@ -0,0 +1,9 @@
+$(function() {
+ cb = $('.scaffoldTable .multiSelect');
+ if (cb.length == 0)
+ return;
+ cb.click(function(){
+ $("input[name^=id]", $('.scaffoldTable')).attr("checked", $(this).attr("checked"));
+ });
+});
+
commit 25e4c4979ca9815bc8594882b0b08edd3075ca78
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Dec 1 14:09:46 2010 +0300
Переписаны сообщения в скафолдинге
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 3bed522..3f78628 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -50,6 +50,8 @@ abstract class ScaffoldController extends Controller
private $setup = false;
/** @var array Порядок столбцев */
private $order = array();
+ /** @var array сообщения для вывода */
+ private $messages;
/**
* Получает данные о полях
@@ -108,6 +110,14 @@ abstract class ScaffoldController extends Controller
$_SESSION['scaffold'][$this->table] = array();
$this->sess = &$_SESSION['scaffold'][$this->table];
+ $this->messages = &$this->sess['messages'];
+ if (empty($this->messages))
+ $this->messages = array(
+ 'error' => array(),
+ 'success' => array(),
+ 'message' => array(),
+ );
+
$this->setup = true;
parent::__construct();
$this->methods = array_flip(get_class_methods($this));
@@ -144,6 +154,7 @@ abstract class ScaffoldController extends Controller
'addOnBottom' => $this->addOnBottom,
'sortImages' => $this->sortImages,
),
+ 'messages' => $this->messages,
));
}
@@ -300,7 +311,7 @@ abstract class ScaffoldController extends Controller
}
//Если ошибок нет, то записываем в базу изменения
if (count($errors))
- QFW::$view->assign('errors', $errors);
+ $this->messages['error'] = $errors;
else
{
$old = $this->getOldVars($id);
@@ -400,7 +411,6 @@ abstract class ScaffoldController extends Controller
if (empty($_POST['filter']) || empty($_POST['apply']))
QFW::$router->redirect(Url::C('index'), true);
$this->sess['filter'] = $_POST['filter'];
-
QFW::$router->redirect(Url::C('index'), true);
}
@@ -736,7 +746,6 @@ abstract class ScaffoldController extends Controller
'direction' => $dir,
);
return true;
-
}
/**
diff --git a/lib/Modules/Scaffold/scaffold/info.php b/lib/Modules/Scaffold/scaffold/info.php
index ed57025..4582d5c 100644
--- a/lib/Modules/Scaffold/scaffold/info.php
+++ b/lib/Modules/Scaffold/scaffold/info.php
@@ -1,10 +1,9 @@
-<?php
-$messages_types = array(
- 'error' => 'errors',
-);
-foreach($messages_types as $type => $v)
-{
- if (!empty($$v)) foreach($$v as $key=>$message) { ?>
+<?php foreach($messages as $type => $messages_t) {
+ if (!empty($messages_t)) foreach($messages_t as $key=>$message) { ?>
<span class="<?php echo $type ?>"><b></b><?php echo $message; ?></span>
+ <?php } ?>
<?php } ?>
-<?php } ?>
+<?php
+ //вывели сообщения, очищаем
+ $session['messages']=array();
+?>
\ No newline at end of file
commit d8e6daceb0f469cd8259fb1a1208f7b52d8eb880
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Dec 1 12:49:27 2010 +0300
Правки к мультиедиту
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 2bbba26..e3e3169 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -91,7 +91,7 @@ class Scaffold_Field extends Scaffold_Field_Info
*/
public function editor($id, $value)
{
- return '<input type="text" name="data['.$this->name.']"
+ return '<input type="text" name="'.$this->editName($id).'"
default="'.QFW::$view->esc($value).'" />';
}
@@ -197,7 +197,7 @@ class Scaffold_Field extends Scaffold_Field_Info
*/
protected function editName($id)
{
- return 'data['.$this->name.']';
+ return 'data['.$id.']['.$this->name.']';
}
}
@@ -477,11 +477,11 @@ class Scaffold_File extends Scaffold_Field
if ($res !== true)
return $res;
//оставляем старый файл
- if ($_FILES['fdata']['error'][$this->name] == 4)
+ if ($this->postField($id, 'error') == 4)
return true;
- if ($_FILES['fdata']['error'][$this->name] != 0)
+ if ($this->postField($id, 'error') != 0)
return 'Ошибка при загрузке файла '.$this->title;
- return is_uploaded_file($_FILES['fdata']['tmp_name'][$this->name]);
+ return is_uploaded_file($this->postField($id, 'tmp_name'));
}
public function proccess($id, $value, $old)
@@ -490,7 +490,7 @@ class Scaffold_File extends Scaffold_Field
if ($value === false && is_file($this->path.'/'.$old))
unlink($this->path.'/'.$old);
//оставляем старое значение
- if ($_FILES['fdata']['error'][$this->name] == 4 && !$value)
+ if ($this->postField($id, 'error') == 4 && !$value)
return $old ? $old : '';
//удяляем старый
if (is_file($this->path.'/'.$old))
@@ -499,11 +499,11 @@ class Scaffold_File extends Scaffold_Field
if ($value)
return '';
//генерим новое имя
- $info = pathinfo($_FILES['fdata']['name'][$this->name]);
+ $info = pathinfo($this->postField($id, 'name'));
if ($id == -1)
$id = time();
$new_name = $this->genFunc ? call_user_func($this->genFunc, $this->name, $id, '.'.$info['extension']) : $this->name.'_'.$id.'.'.$info['extension'];
- move_uploaded_file($_FILES['fdata']['tmp_name'][$this->name], $this->path.'/'.$new_name);
+ move_uploaded_file($this->postField($id, 'tmp_name'), $this->path.'/'.$new_name);
return $new_name;
}
@@ -516,6 +516,19 @@ class Scaffold_File extends Scaffold_Field
return $value;
}
+ /**
+ * Имя поля для формы
+ *
+ * @param string $id первичный ключ
+ * @param string $field имя поля в массиве files
+ * @return mixed значение
+ */
+ protected function postField($id, $field)
+ {
+ return $_FILES['fdata'][$field][$id][$this->name];
+ //return 'data['.$id.']['.$this->name.']';
+ }
+
}
class Scaffold_Image extends Scaffold_File
@@ -538,9 +551,9 @@ class Scaffold_Image extends Scaffold_File
//флаг что удалили
if ($value)
return true;
- if ($_FILES['fdata']['error'][$this->name] == 4)
+ if ($this->postField($id, 'error') == 4)
return true;
- $ext = $this->getImgType($_FILES['fdata']['tmp_name'][$this->name]);
+ $ext = $this->getImgType($this->postField($id, 'tmp_name'));
if (!$ext)
return 'Картинка должна быть';
return true;
@@ -556,7 +569,7 @@ class Scaffold_Image extends Scaffold_File
return '';
}
//оставляем старое значение
- if ($_FILES['fdata']['error'][$this->name] == 4 && !$value)
+ if ($this->postField($id, 'error') == 4 && !$value)
return $old ? $old : '';
//удяляем старый
if (is_file($this->path.'/'.$old))
@@ -565,11 +578,11 @@ class Scaffold_Image extends Scaffold_File
if ($value)
return '';
//генерим новое имя
- $ext = $this->getImgType($_FILES['fdata']['tmp_name'][$this->name]);
+ $ext = $this->getImgType($this->postField($id, 'tmp_name'));
if ($id == -1)
$id = time();
$new_name = $this->genFunc ? call_user_func($this->genFunc, $this->name, $id, $ext) : $this->name.'_'.$id.$ext;
- move_uploaded_file($_FILES['fdata']['tmp_name'][$this->name], $this->path.'/'.$new_name);
+ move_uploaded_file($this->postField($id, 'tmp_name'), $this->path.'/'.$new_name);
return $new_name;
}
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 438ede1..3bed522 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -283,10 +283,10 @@ abstract class ScaffoldController extends Controller
ob_start(array(new HTML_FormPersister(), 'process'));
$errors = array();
- if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_POST['data'])>0)
+ if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_POST['data'][$id])>0)
{
//Обработка результата редактирования
- $data = $_POST['data'];
+ $data = $_POST['data'][$id];
foreach ($data as $k=>$v)
{
if (isset($this->methods['validator_'.ucfirst($k)]))
commit 4aa9bded18576e6974e1f839688d02a51227c36d
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Nov 30 19:41:25 2010 +0300
valign
diff --git a/www/built-in/scaffold.css b/www/built-in/scaffold.css
index b579234..2b52f05 100644
--- a/www/built-in/scaffold.css
+++ b/www/built-in/scaffold.css
@@ -21,7 +21,7 @@ table.scaffoldTable
width: 25px;
}
-.scaffoldTable tr {vertical-align:top;}
+.scaffoldTable tr > * {vertical-align:top;}
.scaffoldTable th { background-color:#eec0c0; }
.scaffoldTable tr td { background-color:#ddd; text-align:left;}
.scaffoldTable tr:nth-child(odd) td { background-color:#c0ffc0; }
commit 60e25d354d1b089d382053d4e6eca22842445075
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Nov 30 19:28:04 2010 +0300
Верстка и пагинатор
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 18577d0..438ede1 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -39,8 +39,8 @@ abstract class ScaffoldController extends Controller
protected $sess = array();
//Опции
- /** @var bool Ссылка добавить внизу страницы */
- protected $addOnBottom = false;
+ /** @var bool|string Добавить внизу страницы (заголовок) */
+ protected $addOnBottom = true;
/** @var bool Показывать картинки при сортировке */
protected $sortImages = false;
@@ -243,7 +243,6 @@ abstract class ScaffoldController extends Controller
//инициализация FormPersister
/*require_once LIBPATH.'/HTML/FormPersister.php';
ob_start(array(new HTML_FormPersister(), 'process'));*/
- $errors = array();
//получение дефолтовых значений для новой записи
$data = array();
@@ -269,7 +268,6 @@ abstract class ScaffoldController extends Controller
return QFW::$view->assign(array(
'id' => -1,
'data' => $data,
- 'errors' => $errors,
))->fetch('scaffold/edit.php');
}
@@ -297,9 +295,13 @@ abstract class ScaffoldController extends Controller
$res = $this->fields[$k]->validator($id, $v);
if ($res !== true)
$errors[$k] = $res;
+ if ($res === false)
+ $errors[$k] = 'Поле '.$this->fields[$k]->title.' имеет некорректное значение';
}
//Если ошибок нет, то записываем в базу изменения
- if (count($errors) == 0)
+ if (count($errors))
+ QFW::$view->assign('errors', $errors);
+ else
{
$old = $this->getOldVars($id);
//Обработка данных после POST
@@ -347,7 +349,6 @@ abstract class ScaffoldController extends Controller
return QFW::$view->assign(array(
'id' => $id,
'data' => $data,
- 'errors' => $errors,
))->fetch('scaffold/edit.php');
}
diff --git a/lib/Modules/Scaffold/scaffold/edit.php b/lib/Modules/Scaffold/scaffold/edit.php
index abee257..732b7a0 100644
--- a/lib/Modules/Scaffold/scaffold/edit.php
+++ b/lib/Modules/Scaffold/scaffold/edit.php
@@ -1,8 +1,4 @@
-<?php if (count($errors)) foreach($errors as $k=>$err) { ?>
- <?php if ($err) echo $err; else {?>
- Поле <?php echo $fields[$k]->title ?> имеет некорректное значение<br />
- <?php } ?>
-<?php } ?>
+<?php require dirname(__FILE__).'/info.php' ?>
<?php echo $this->block(Url::C('preForm'), $id); ?>
<form action="<?php echo Url::C('edit/'.$id) ?>" class="scaffoldEdit"
method="post" id="form_<?php echo $table ?>" enctype="multipart/form-data">
@@ -37,5 +33,6 @@
<dd><input type="submit" value="Отправить" name="send" /></dd>
</dl>
<?php echo $this->block(Url::C('postEdit'), $id); ?>
+ <div></div>
</form>
<?php echo $this->block(Url::C('postForm'), $id); ?>
diff --git a/lib/Modules/Scaffold/scaffold/index.php b/lib/Modules/Scaffold/scaffold/index.php
index 5ea4b79..6aeff32 100644
--- a/lib/Modules/Scaffold/scaffold/index.php
+++ b/lib/Modules/Scaffold/scaffold/index.php
@@ -1,3 +1,4 @@
+<?php require dirname(__FILE__).'/info.php' ?>
<?php if (isset($parent)) echo $parent; ?>
<?php if (isset($filter)) {
@@ -51,11 +52,19 @@
</tr>
<?php } ?>
</table>
-<?php if ($options['addOnBottom']) {?><a href="<?php echo Url::C('edit/-1') ?>">добавить</a><?php } ?>
<?php } else { ?>
Записей нет
+ <?php if (!$options['addOnBottom']) {?>
<a href="<?php echo Url::C('edit/-1') ?>">добавить</a>
+ <?php } ?>
<?php } ?>
-
<?php echo $pager; ?>
<?php echo $this->block(Url::C('postTable')); ?>
+
+<?php if ($options['addOnBottom']) {?>
+<div>
+<?php if ($options['addOnBottom']!==true) echo $options['addOnBottom'] ?>
+<?php echo $this->block(Url::C('new')) ?>
+<p> </p>
+</div>
+<?php } ?>
\ No newline at end of file
diff --git a/lib/Modules/Scaffold/scaffold/info.php b/lib/Modules/Scaffold/scaffold/info.php
new file mode 100644
index 0000000..ed57025
--- /dev/null
+++ b/lib/Modules/Scaffold/scaffold/info.php
@@ -0,0 +1,10 @@
+<?php
+$messages_types = array(
+ 'error' => 'errors',
+);
+foreach($messages_types as $type => $v)
+{
+ if (!empty($$v)) foreach($$v as $key=>$message) { ?>
+ <span class="<?php echo $type ?>"><b></b><?php echo $message; ?></span>
+<?php } ?>
+<?php } ?>
diff --git a/www/built-in/scaffold.css b/www/built-in/scaffold.css
index db373b6..b579234 100644
--- a/www/built-in/scaffold.css
+++ b/www/built-in/scaffold.css
@@ -1,4 +1,7 @@
-div.pageslist {text-align:center;}
+.pageslist {margin: 15px; text-align: center}
+.pageslist b {padding: 5px 10px; margin: 2px; border: 1px solid #eee; font-weight: bold }
+.pageslist a {padding: 5px 10px; margin: 2px; border: 1px solid #eee; text-decoration: none }
+.pageslist a:hover {background: #f0f0ff}
table.scaffoldTable
{
@@ -62,3 +65,8 @@ form.scaffoldEdit small
margin-left: 20px;
color: #999;
}
+
+form.scaffoldEdit > :last-child
+{
+ clear:left;
+}
commit 46e8cece03258ca756c2942bf9c8ed169b5fd4b2
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Nov 30 18:00:25 2010 +0300
Спан для обязательного поля при редактировании
diff --git a/lib/Modules/Scaffold/scaffold/edit.php b/lib/Modules/Scaffold/scaffold/edit.php
index 6e14b70..abee257 100644
--- a/lib/Modules/Scaffold/scaffold/edit.php
+++ b/lib/Modules/Scaffold/scaffold/edit.php
@@ -20,7 +20,9 @@
?>
<label>
<dt<?php if (isset($errors[$k])) echo ' class="err"'; ?>>
- <?php echo $i->title ?></dt>
+ <?php echo $i->title ?><?php
+ if ($i->required) {?><span class="required"></span><?php }
+ ?></dt>
<dd><?php
if (isset($methods['editor_'.ucfirst($k)]))
echo call_user_func($class.'::editor_'.ucfirst($k), $id, $v);
commit 6d2685713e4329172fb79f5bfbaf14a454958c70
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Nov 30 17:55:23 2010 +0300
Обязательное поле и label
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 73392c5..2bbba26 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -38,8 +38,10 @@ class Scaffold_Field_Info
public $title = '';
/** @var string Описание колонки */
public $desc = '';
- /** @var bool|string добавить класс колонке */
+ /** @var bool|string Добавить класс колонке */
public $class = false;
+ /** @var bool Обязательная колонка */
+ public $required = false;
}
@@ -104,6 +106,9 @@ class Scaffold_Field extends Scaffold_Field_Info
*/
public function validator($id, $value)
{
+ var_dump($this->required);
+ if ($this->required && empty($value))
+ return false;
return true;
}
@@ -211,6 +216,9 @@ class Scaffold_Parent extends Scaffold_Field
public function validator($id, $value)
{
+ $res = parent::validator($id, $value);
+ if ($res !== true)
+ return $res;
//если у нас будет потеря сессии, то случится фигня
return isset($_SESSION['scaffold'][$this->table]['parent']);
}
@@ -250,6 +258,9 @@ class Scaffold_Foreign extends Scaffold_Field
public function validator($id, $value)
{
+ $res = parent::validator($id, $value);
+ if ($res !== true)
+ return $res;
return $this->isnull || !empty($value);
}
@@ -334,6 +345,9 @@ class Scaffold_Varchar extends Scaffold_Field
public function validator($id, $value)
{
+ $res = parent::validator($id, $value);
+ if ($res !== true)
+ return $res;
return mb_strlen($value) <= $this->size;
}
}
@@ -459,6 +473,9 @@ class Scaffold_File extends Scaffold_Field
public function validator($id, $value)
{
+ $res = parent::validator($id, $value);
+ if ($res !== true)
+ return $res;
//оставляем старый файл
if ($_FILES['fdata']['error'][$this->name] == 4)
return true;
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 71b9359..18577d0 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -552,6 +552,21 @@ abstract class ScaffoldController extends Controller
}
/**
+ * Устанавливает флаг, что поле обязательно для заполнения
+ *
+ * <br><br> Вызывается только в конструкторе
+ *
+ * @param string|array $colum Колонка<br>
+ * Или массив ключи - колонки, значения заголовки
+ * @param string $title Заголовок
+ * @return ScaffoldController
+ */
+ protected function required($colum, $required=true)
+ {
+ return $this->setColumOpt('required', $colum, $required);
+ }
+
+ /**
* Устанавливает css класс для столбца
*
* <br><br> Вызывается только в конструкторе
diff --git a/lib/Modules/Scaffold/scaffold/edit.php b/lib/Modules/Scaffold/scaffold/edit.php
index b72d88f..6e14b70 100644
--- a/lib/Modules/Scaffold/scaffold/edit.php
+++ b/lib/Modules/Scaffold/scaffold/edit.php
@@ -18,6 +18,7 @@
if (!$i->primaryKey && !($i->hide === false))
continue;
?>
+ <label>
<dt<?php if (isset($errors[$k])) echo ' class="err"'; ?>>
<?php echo $i->title ?></dt>
<dd><?php
@@ -27,6 +28,7 @@
echo $i->editor($id, $v); ?>
<?php if ($i->desc) {?><small><?php echo $i->desc ?></small><?php } ?>
</dd>
+ </label>
<?php } ?>
<?php echo $this->block(Url::C('preSend'), $id); ?>
<dt></dt>
diff --git a/lib/Modules/Scaffold/scaffold/fields/dateedit.php b/lib/Modules/Scaffold/scaffold/fields/dateedit.php
index e604139..061f28e 100644
--- a/lib/Modules/Scaffold/scaffold/fields/dateedit.php
+++ b/lib/Modules/Scaffold/scaffold/fields/dateedit.php
@@ -4,7 +4,7 @@ Hlp::addJs('js/jquery.js');
Hlp::addJs('timepicker/jquery-ui-1.8.custom.min.js');
Hlp::addJs('timepicker/jquery-ui-timepicker-addon.min.js');
Hlp::addJs('timepicker/jquery-ui-datepicker-ru.js');
-?><input type="text" name="<?php echo $name ?>" value="<?php echo $value?>" class="datepicker" />
+?><input type="text" name="<?php echo $name ?>" default="<?php echo $value?>" class="datepicker" />
<?php Hlp::sJSe() ?>
$('.datepicker').datetimepicker({
showSecond: true,
commit 9249c6aa2a062279ed5ee7bacf20322a775ca6ab
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Nov 30 17:08:41 2010 +0300
Поправил меню - текущий элемент - класс
diff --git a/application/helper/controllers/NavController.php b/application/helper/controllers/NavController.php
index d7d11b9..a631ede 100644
--- a/application/helper/controllers/NavController.php
+++ b/application/helper/controllers/NavController.php
@@ -68,19 +68,14 @@ class NavController
{
if (isset($v['show']) && $v['show'] === false)
continue;
- $result.='<li>';
+ $self = $cur == ($v['url'] instanceof Url ? $v['url']->intern() : $v['url']);
+ $result.='<li'.($self?' class="cur"':'').'>';
if ($v['url'] === false)
$result.=$v['title'];
else
- {
- if ($v['url'] instanceof Url)
- $self = $cur == $v['url']->intern();
- else
- $self = $cur == $v['url'];
$result.= $self ? '<b>'.$v['title'].'</b>' : '<a href="'.$v['url'].'">'.$v['title'].'</a>';
- }
if (isset($v['childNodes']))
- $result.='<ul>'.$this->menuTreeNodes($v['childNodes'], $cur).'</ul>';
+ $result.="\n<ul>".$this->menuTreeNodes($v['childNodes'], $cur).'</ul>';
$result.="</li>\n";
}
return $result;
commit 8eac6a03dc867bc53918df0262aed8d2ad5301ee
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 29 15:48:02 2010 +0300
filter true по умолчанию
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 167b726..71b9359 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -516,7 +516,7 @@ abstract class ScaffoldController extends Controller
* mixed - произвольный параметр
* @return ScaffoldController
*/
- protected function filter($colum, $filter='')
+ protected function filter($colum, $filter=true)
{
return $this->setColumOpt('filter', $colum, $filter);
}
commit c43822d8b9dabd38c21a193b6e5d4aa7b25cf980
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 29 15:41:20 2010 +0300
Скафолдинг добавление класса столбца
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 3a29b1c..73392c5 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -38,6 +38,8 @@ class Scaffold_Field_Info
public $title = '';
/** @var string Описание колонки */
public $desc = '';
+ /** @var bool|string добавить класс колонке */
+ public $class = false;
}
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index d3a8719..167b726 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -552,6 +552,21 @@ abstract class ScaffoldController extends Controller
}
/**
+ * Устанавливает css класс для столбца
+ *
+ * <br><br> Вызывается только в конструкторе
+ *
+ * @param string|array $colum Колонка<br>
+ * Или массив ключи - колонки, значения заголовки
+ * @param bool|string $class имя класса или true (col_$key)
+ * @return ScaffoldController
+ */
+ protected function setClass($colum, $class='')
+ {
+ return $this->setColumOpt('class', $colum, $class);
+ }
+
+ /**
* Принудительно устанавливает класс для поля
*
* <br><br> Вызывается только в конструкторе
diff --git a/lib/Modules/Scaffold/scaffold/index.php b/lib/Modules/Scaffold/scaffold/index.php
index 8ad66a5..5ea4b79 100644
--- a/lib/Modules/Scaffold/scaffold/index.php
+++ b/lib/Modules/Scaffold/scaffold/index.php
@@ -35,7 +35,7 @@
if ($i->hide)
continue;
?>
- <td><?php //отображение обычного не связанного поля
+ <td<?php if ($i->class) {?> class="<?php echo $i->class===true ? 'col_'.$key : $i->class ?>"<?php } ?>><?php //отображение обычного не связанного поля
if (isset($methods['display_'.ucfirst($key)]))
echo call_user_func($class.'::display_'.ucfirst($key), $row[$primaryKey], $v);
else
commit 80978b34317acf68a717fa595169b15b0e6b73a6
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 29 14:30:51 2010 +0300
Генерация имени загружаемого файла
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 033510b..3a29b1c 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -421,6 +421,8 @@ class Scaffold_File extends Scaffold_Field
protected $prim;
/** @var bool Скачиваемый (доступен извне) */
protected $download;
+ /** @var function Генерит имя файла */
+ protected $genFunc;
/**
* Проверяет параметры для файлового поля
@@ -437,6 +439,7 @@ class Scaffold_File extends Scaffold_Field
if (!is_writable($info->typeParams['path']))
throw new Exception('Нельзя писать в директорию файлов '.$info->typeParams['path'], 1);
$this->path = $info->typeParams['path'];
+ $this->genFunc = !empty($info->typeParams['genFunc']) ? $info->typeParams['genFunc'] : false;
$this->prim = $info->primaryKey;
if (strpos($info->typeParams['path'], DOC_ROOT) === 0)
$this->download = substr($info->typeParams['path'], strlen(DOC_ROOT) );
@@ -480,7 +483,7 @@ class Scaffold_File extends Scaffold_Field
$info = pathinfo($_FILES['fdata']['name'][$this->name]);
if ($id == -1)
$id = time();
- $new_name = $this->name.'_'.$id.'.'.$info['extension'];
+ $new_name = $this->genFunc ? call_user_func($this->genFunc, $this->name, $id, '.'.$info['extension']) : $this->name.'_'.$id.'.'.$info['extension'];
move_uploaded_file($_FILES['fdata']['tmp_name'][$this->name], $this->path.'/'.$new_name);
return $new_name;
}
@@ -516,6 +519,8 @@ class Scaffold_Image extends Scaffold_File
//флаг что удалили
if ($value)
return true;
+ if ($_FILES['fdata']['error'][$this->name] == 4)
+ return true;
$ext = $this->getImgType($_FILES['fdata']['tmp_name'][$this->name]);
if (!$ext)
return 'Картинка должна быть';
@@ -544,7 +549,7 @@ class Scaffold_Image extends Scaffold_File
$ext = $this->getImgType($_FILES['fdata']['tmp_name'][$this->name]);
if ($id == -1)
$id = time();
- $new_name = $this->name.'_'.$id.$ext;
+ $new_name = $this->genFunc ? call_user_func($this->genFunc, $this->name, $id, $ext) : $this->name.'_'.$id.$ext;
move_uploaded_file($_FILES['fdata']['tmp_name'][$this->name], $this->path.'/'.$new_name);
return $new_name;
}
commit 64b69b3247c13721cc452d039a5e43d7216c5051
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 29 13:34:24 2010 +0300
Правки скафолдинга
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index 3f891be..033510b 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -416,11 +416,11 @@ class Scaffold_Timestamp extends Scaffold_Datetime {}
class Scaffold_File extends Scaffold_Field
{
/** @var string Путь к директории, где хранятся файлы */
- private $path;
+ protected $path;
/** @var string Первичный ключ таблицы */
- private $prim;
+ protected $prim;
/** @var bool Скачиваемый (доступен извне) */
- private $download;
+ protected $download;
/**
* Проверяет параметры для файлового поля
@@ -448,8 +448,8 @@ class Scaffold_File extends Scaffold_Field
{
return '<input type="file" name="f'.$this->editName($id).'" />
<input type="hidden" name="'.$this->editName($id).'" value="0" />
- <input type="checkbox" name="'.$this->editName($id).'" value="1" label="Удалить" /> '.
- $this->display($id, $value);
+ <input type="checkbox" name="'.$this->editName($id).'" value="1" label="Удалить" />'.
+ '<div>'.$this->display($id, $value).'</div>';
}
public function validator($id, $value)
@@ -496,4 +496,68 @@ class Scaffold_File extends Scaffold_Field
}
+class Scaffold_Image extends Scaffold_File
+{
+
+ public function display($id, $value)
+ {
+ if (!$value || !is_file($this->path.'/'.$value))
+ return '-нет-';
+ if ($this->download)
+ return '<img src="'.$this->download.'/'.$value.'" />';
+ return $value;
+ }
+
+ public function validator($id, $value)
+ {
+ $res = parent::validator($id, $value);
+ if ($res !== true)
+ return $res;
+ //флаг что удалили
+ if ($value)
+ return true;
+ $ext = $this->getImgType($_FILES['fdata']['tmp_name'][$this->name]);
+ if (!$ext)
+ return 'Картинка должна быть';
+ return true;
+ }
+
+ public function proccess($id, $value, $old)
+ {
+ //если запись удалили
+ if ($value === false)
+ {
+ if (is_file($this->path.'/'.$old))
+ unlink($this->path.'/'.$old);
+ return '';
+ }
+ //оставляем старое значение
+ if ($_FILES['fdata']['error'][$this->name] == 4 && !$value)
+ return $old ? $old : '';
+ //удяляем старый
+ if (is_file($this->path.'/'.$old))
+ unlink($this->path.'/'.$old);
+ //флаг что удалили
+ if ($value)
+ return '';
+ //генерим новое имя
+ $ext = $this->getImgType($_FILES['fdata']['tmp_name'][$this->name]);
+ if ($id == -1)
+ $id = time();
+ $new_name = $this->name.'_'.$id.$ext;
+ move_uploaded_file($_FILES['fdata']['tmp_name'][$this->name], $this->path.'/'.$new_name);
+ return $new_name;
+ }
+
+ private function getImgType($name)
+ {
+ $info = getimagesize($name);
+ if (!$info)
+ return false;
+ $ext = image_type_to_extension($info[2]);
+ return $ext;
+ }
+
+}
+
?>
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index e99c5ec..d3a8719 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -241,10 +241,10 @@ abstract class ScaffoldController extends Controller
public function newBlock()
{
//инициализация FormPersister
- /* require_once LIBPATH.'/HTML/FormPersister.php';
+ /*require_once LIBPATH.'/HTML/FormPersister.php';
ob_start(array(new HTML_FormPersister(), 'process'));*/
$errors = array();
-
+
//получение дефолтовых значений для новой записи
$data = array();
$fields = array();
@@ -301,19 +301,17 @@ abstract class ScaffoldController extends Controller
//Если ошибок нет, то записываем в базу изменения
if (count($errors) == 0)
{
- $old = QFW::$db->selectRow('SELECT ?# FROM ?# WHERE ?#=?',
- array($this->table=>array_merge($this->order, array('*'))),
- $this->table, $this->primaryKey, $id);
+ $old = $this->getOldVars($id);
//Обработка данных после POST
foreach ($this->fields as $k=>$class)
if ($k == $this->primaryKey && !isset($data[$k]))
continue; //не трогаем первичный ключ
elseif (isset($this->methods['proccess_'.ucfirst($k)]))
$data[$k] = call_user_func(array($this, 'proccess_'.ucfirst($k)),
- isset($data[$k]) ? $data[$k] : $class->def(), $id, $old[$k]);
+ isset($data[$k]) ? $data[$k] : $old[$k], $id, $old[$k]);
else
$data[$k] = $class->proccess($id,
- isset($data[$k]) ? $data[$k] : $class->def(), $old[$k]);
+ isset($data[$k]) ? $data[$k] : $old[$k], $old[$k]);
if ($id == -1)
$ins_id = QFW::$db->query('INSERT INTO ?#(?#) VALUES(?a)',
@@ -341,29 +339,7 @@ abstract class ScaffoldController extends Controller
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'index'))
$this->sess['return'] = $_SERVER['HTTP_REFERER'];
- if ($id == -1)
- {
- //получение дефолтовых значений для новой записи
- $data = array();
- $fields = array();
- //сортированные поля
- foreach($this->order as $f)
- $fields[] = $f;
- //остальные поля
- foreach ($this->fields as $f=>$info)
- if (!isset($fields[$f]))
- $fields[] = $f;
- //вынимаем с учетом default_*
- foreach($fields as $f)
- if (isset($this->methods['default_'.ucfirst($f)]))
- $data[$f] = call_user_func(array(get_class($this), 'default_'.ucfirst($f)));
- else
- $data[$f] = $this->fields[$f]->def();
- }
- else
- $data = QFW::$db->selectRow('SELECT ?# FROM ?# WHERE ?#=?',
- array($this->table=>array_merge($this->order, array('*'))),
- $this->table, $this->primaryKey, $id);
+ $data = $this->getOldVars($id);
$state = new TemplaterState(QFW::$view);
QFW::$view->setScriptPath(dirname(__FILE__));
@@ -385,8 +361,11 @@ abstract class ScaffoldController extends Controller
*/
public function deleteAction($id=0)
{
+ $old = $this->getOldVars($id);
+ if (!$old)
+ QFW::$router->redirect(Url::C('index'), true);
foreach($this->fields as $k=>$v)
- $v->proccess($id, false);
+ $v->proccess($id, false, $old[$k]);
QFW::$db->query('DELETE FROM ?# WHERE ?#=?',
$this->table, $this->primaryKey, $id);
QFW::$router->redirect(Url::C('index'), true);
@@ -628,11 +607,44 @@ abstract class ScaffoldController extends Controller
return $this->fields[$name];
}
+
+ /**
+ * Получает старые значения для записи или дефолтовые для новой
+ *
+ * @param integer $id ID записи
+ * @return array значения
+ */
+ private function getOldVars($id)
+ {
+ if ($id != -1)
+ return QFW::$db->selectRow('SELECT ?# FROM ?# WHERE ?#=?',
+ array($this->table=>array_merge($this->order, array('*'))),
+ $this->table, $this->primaryKey, $id);
+
+ //получение дефолтовых значений для новой записи
+ $data = array();
+ $fields = array();
+ //сортированные поля
+ foreach($this->order as $f)
+ $fields[] = $f;
+ //остальные поля
+ foreach ($this->fields as $f=>$info)
+ if (!isset($fields[$f]))
+ $fields[] = $f;
+ //вынимаем с учетом default_*
+ foreach($fields as $f)
+ if (isset($this->methods['default_'.ucfirst($f)]))
+ $data[$f] = call_user_func(array(get_class($this), 'default_'.ucfirst($f)));
+ else
+ $data[$f] = $this->fields[$f]->def();
+ return $data;
+ }
+
/**
* Генерирует фильтр для запроса
*
* @return array(<br>
- * 'where' => DbSimple_SubQuery сгенерерованное условие с учетом фильтров<br>
+ * 'where' => DbSimple_SubQuery сгенерерованное условие с учетом фильтров<br>
* 'form' => array инпуты формы<br>
* );
*/
-----------------------------------------------------------------------
Summary of changes:
application/helper/controllers/NavController.php | 11 +-
lib/Modules/Scaffold/Fields.php | 129 +++++++-
lib/Modules/Scaffold/ScaffoldController.php | 355 ++++++++++++++++-----
lib/Modules/Scaffold/scaffold/edit.php | 13 +-
lib/Modules/Scaffold/scaffold/fields/dateedit.php | 2 +-
lib/Modules/Scaffold/scaffold/index.php | 39 ++-
lib/Modules/Scaffold/scaffold/info.php | 9 +
lib/Modules/Scaffold/scaffold/multidel.php | 43 +++
lib/Modules/Scaffold/scaffold/multiedit.php | 50 +++
www/built-in/scaffold.css | 14 +-
www/built-in/scaffold.js | 9 +
11 files changed, 551 insertions(+), 123 deletions(-)
create mode 100644 lib/Modules/Scaffold/scaffold/info.php
create mode 100644 lib/Modules/Scaffold/scaffold/multidel.php
create mode 100644 lib/Modules/Scaffold/scaffold/multiedit.php
create mode 100644 www/built-in/scaffold.js
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-11-26 18:59:44
|
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 d551551f5e9ca0c115506e8ffbf6112cea97ae35 (commit)
via 03525a0a5c8b8a085b4a65a6639192ecdbff10a0 (commit)
via 5683cc0b6328d4c57195eb1f1ebd160e88d8ee81 (commit)
via 2160aed1df841ed6e467577bdfe0ebe0e86852d3 (commit)
via bc7f900f0386151309afd33bcec54153df7fd8f0 (commit)
via 240a239b4c4fafaa7fc807b3c7b420a073a04964 (commit)
via d56536012a7ee222ee57e2da8bf1bc90a59543df (commit)
from 961d08f187aadbfece0d87ee0233080fa78f141a (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 d551551f5e9ca0c115506e8ffbf6112cea97ae35
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Nov 26 19:42:44 2010 +0300
Лишний id
diff --git a/lib/Modules/Scaffold/scaffold/index.php b/lib/Modules/Scaffold/scaffold/index.php
index 7ab1fdf..8ad66a5 100644
--- a/lib/Modules/Scaffold/scaffold/index.php
+++ b/lib/Modules/Scaffold/scaffold/index.php
@@ -58,4 +58,4 @@
<?php } ?>
<?php echo $pager; ?>
-<?php echo $this->block(Url::C('postTable'), $id); ?>
+<?php echo $this->block(Url::C('postTable')); ?>
commit 03525a0a5c8b8a085b4a65a6639192ecdbff10a0
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Nov 26 18:41:21 2010 +0300
Скафолдинг - много всего
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index dc1efdf..3f891be 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -134,9 +134,10 @@ class Scaffold_Field extends Scaffold_Field_Info
*
* @param string $id первичный ключ или -1 для новой записи
* @param string|false $value исходное значение или false при удалении
+ * @param string $old Старое значение
* @return string обработанное значение
*/
- public function proccess($id, $value)
+ public function proccess($id, $value, $old)
{
if ($this->fiendInfo['Null'] == 'YES' && $value=='')
return null;
@@ -201,7 +202,7 @@ class Scaffold_Field extends Scaffold_Field_Info
*/
class Scaffold_Parent extends Scaffold_Field
{
- public function proccess($id, $value)
+ public function proccess($id, $value, $old)
{
return $_SESSION['scaffold'][$this->table]['parent'];
}
@@ -242,7 +243,7 @@ class Scaffold_Foreign extends Scaffold_Field
public function editor($id, $value)
{
- return $this->selectBuild($id, $this->lookup, $value);
+ return $this->selectBuild($id, $this->lookup, $value, $this->isnull);
}
public function validator($id, $value)
@@ -381,6 +382,9 @@ class Scaffold_Checkbox extends Scaffold_Field
}
+/**
+ * Дата и время
+ */
class Scaffold_Datetime extends Scaffold_Field
{
@@ -404,6 +408,7 @@ class Scaffold_Datetime extends Scaffold_Field
class Scaffold_Timestamp extends Scaffold_Datetime {}
+
/**
* Класс для поля, в котором хранится имя файла,
* загружаемого на сервер
@@ -457,10 +462,8 @@ class Scaffold_File extends Scaffold_Field
return is_uploaded_file($_FILES['fdata']['tmp_name'][$this->name]);
}
- public function proccess($id, $value)
+ public function proccess($id, $value, $old)
{
- $old = QFW::$db->selectCell('SELECT ?# FROM ?# WHERE ?#=?',
- $this->name, $this->table, $this->prim, $id);
//если запись удалили
if ($value === false && is_file($this->path.'/'.$old))
unlink($this->path.'/'.$old);
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 89c2e5d..e99c5ec 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -123,6 +123,14 @@ abstract class ScaffoldController extends Controller
if (!isset($this->fields[$v]))
unset($this->order[$k]);
+ $this->assignMainInfo();
+ }
+
+ /**
+ * Выставляет в шаблон общую инфу о таблице
+ */
+ private function assignMainInfo()
+ {
//Общая информация о таблице
QFW::$view->assign(array(
'methods' => $this->methods,
@@ -137,7 +145,7 @@ abstract class ScaffoldController extends Controller
'sortImages' => $this->sortImages,
),
));
- }
+ }
/**
* Востанавливает данные сессии по умолчанию
@@ -226,6 +234,46 @@ abstract class ScaffoldController extends Controller
}
/**
+ * Отображает форму добавления
+ *
+ * @param int $id ключ записи для редактирования
+ */
+ public function newBlock()
+ {
+ //инициализация FormPersister
+ /* require_once LIBPATH.'/HTML/FormPersister.php';
+ ob_start(array(new HTML_FormPersister(), 'process'));*/
+ $errors = array();
+
+ //получение дефолтовых значений для новой записи
+ $data = array();
+ $fields = array();
+ //сортированные поля
+ foreach($this->order as $f)
+ $fields[] = $f;
+ //остальные поля
+ foreach ($this->fields as $f=>$info)
+ if (!isset($fields[$f]))
+ $fields[] = $f;
+ //вынимаем с учетом default_*
+ foreach($fields as $f)
+ if (isset($this->methods['default_'.ucfirst($f)]))
+ $data[$f] = call_user_func(array(get_class($this), 'default_'.ucfirst($f)));
+ else
+ $data[$f] = $this->fields[$f]->def();
+
+ $state = new TemplaterState(QFW::$view);
+ QFW::$view->setScriptPath(dirname(__FILE__));
+
+ $this->assignMainInfo();
+ return QFW::$view->assign(array(
+ 'id' => -1,
+ 'data' => $data,
+ 'errors' => $errors,
+ ))->fetch('scaffold/edit.php');
+ }
+
+ /**
* Отображает форму редактирования или добавления
*
* @param int $id ключ записи для редактирования
diff --git a/lib/Modules/Scaffold/scaffold/edit.php b/lib/Modules/Scaffold/scaffold/edit.php
index 4d02813..b72d88f 100644
--- a/lib/Modules/Scaffold/scaffold/edit.php
+++ b/lib/Modules/Scaffold/scaffold/edit.php
@@ -8,7 +8,9 @@
method="post" id="form_<?php echo $table ?>" enctype="multipart/form-data">
<?php echo $this->block(Url::C('preEdit'), $id); ?>
<dl>
-<?php foreach($data as $k=>$v) {
+<?php foreach($data as $k=>$v) {?>
+ <?php echo $this->block(Url::C('preEditField'.ucfirst($k)), $id); ?>
+<?php
$i = $fields[$k];
if ($i->hide)
continue;
commit 5683cc0b6328d4c57195eb1f1ebd160e88d8ee81
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Nov 26 18:14:12 2010 +0300
В скафолдинг добавлены блоки
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 6f4725b..89c2e5d 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -151,6 +151,16 @@ abstract class ScaffoldController extends Controller
}
/**
+ * Блок заглушка для всех необъявленных
+ *
+ * @return string пусто
+ */
+ public function indexBlock()
+ {
+ return '';
+ }
+
+ /**
* Вывод страницы таблицы
*
* @param integer $page страница
diff --git a/lib/Modules/Scaffold/scaffold/edit.php b/lib/Modules/Scaffold/scaffold/edit.php
index 85079d8..4d02813 100644
--- a/lib/Modules/Scaffold/scaffold/edit.php
+++ b/lib/Modules/Scaffold/scaffold/edit.php
@@ -3,8 +3,10 @@
Поле <?php echo $fields[$k]->title ?> имеет некорректное значение<br />
<?php } ?>
<?php } ?>
+<?php echo $this->block(Url::C('preForm'), $id); ?>
<form action="<?php echo Url::C('edit/'.$id) ?>" class="scaffoldEdit"
method="post" id="form_<?php echo $table ?>" enctype="multipart/form-data">
+ <?php echo $this->block(Url::C('preEdit'), $id); ?>
<dl>
<?php foreach($data as $k=>$v) {
$i = $fields[$k];
@@ -24,7 +26,10 @@
<?php if ($i->desc) {?><small><?php echo $i->desc ?></small><?php } ?>
</dd>
<?php } ?>
+ <?php echo $this->block(Url::C('preSend'), $id); ?>
<dt></dt>
<dd><input type="submit" value="Отправить" name="send" /></dd>
</dl>
+ <?php echo $this->block(Url::C('postEdit'), $id); ?>
</form>
+<?php echo $this->block(Url::C('postForm'), $id); ?>
diff --git a/lib/Modules/Scaffold/scaffold/index.php b/lib/Modules/Scaffold/scaffold/index.php
index 2c1a1ca..7ab1fdf 100644
--- a/lib/Modules/Scaffold/scaffold/index.php
+++ b/lib/Modules/Scaffold/scaffold/index.php
@@ -57,4 +57,5 @@
<a href="<?php echo Url::C('edit/-1') ?>">добавить</a>
<?php } ?>
-<?php echo $pager; ?>
\ No newline at end of file
+<?php echo $pager; ?>
+<?php echo $this->block(Url::C('postTable'), $id); ?>
commit 2160aed1df841ed6e467577bdfe0ebe0e86852d3
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Nov 26 17:20:49 2010 +0300
Скафолдинг - старые значения и postEdit - восновном для insert
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index d6c7f24..dc1efdf 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -27,6 +27,8 @@ class Scaffold_Field_Info
public $table;
/** @var string Имя первичного ключа */
public $primaryKey;
+ /** @var string Класс таблицы */
+ public $tableClass;
/** @var string Имя поля */
public $name = '';
diff --git a/lib/Modules/Scaffold/ScaffoldController.php b/lib/Modules/Scaffold/ScaffoldController.php
index 749d9bf..6f4725b 100644
--- a/lib/Modules/Scaffold/ScaffoldController.php
+++ b/lib/Modules/Scaffold/ScaffoldController.php
@@ -243,24 +243,30 @@ abstract class ScaffoldController extends Controller
//Если ошибок нет, то записываем в базу изменения
if (count($errors) == 0)
{
+ $old = QFW::$db->selectRow('SELECT ?# FROM ?# WHERE ?#=?',
+ array($this->table=>array_merge($this->order, array('*'))),
+ $this->table, $this->primaryKey, $id);
//Обработка данных после POST
foreach ($this->fields as $k=>$class)
if ($k == $this->primaryKey && !isset($data[$k]))
continue; //не трогаем первичный ключ
elseif (isset($this->methods['proccess_'.ucfirst($k)]))
$data[$k] = call_user_func(array($this, 'proccess_'.ucfirst($k)),
- isset($data[$k]) ? $data[$k] : $class->def(), $id);
+ isset($data[$k]) ? $data[$k] : $class->def(), $id, $old[$k]);
else
$data[$k] = $class->proccess($id,
- isset($data[$k]) ? $data[$k] : $class->def());
+ isset($data[$k]) ? $data[$k] : $class->def(), $old[$k]);
if ($id == -1)
- QFW::$db->query('INSERT INTO ?#(?#) VALUES(?a)',
+ $ins_id = QFW::$db->query('INSERT INTO ?#(?#) VALUES(?a)',
$this->table, array_keys($data), array_values($data));
else
QFW::$db->query('UPDATE ?# SET ?a WHERE ?#=?',
$this->table, $data, $this->primaryKey, $id);
+ if (isset($this->methods['postEdit']))
+ call_user_func(array($this, 'postEdit'), $id == -1 ? $ins_id : $id);
+
//редирект назад
if (!empty($this->sess['return']))
{
@@ -695,6 +701,7 @@ abstract class ScaffoldController extends Controller
{
$infoClass->fiendInfo = $fieldInfo;
$infoClass->table = $this->table;
+ $infoClass->tableClass = get_class($this);
$infoClass->primaryKey = $this->primaryKey;
if ($infoClass->type)
commit bc7f900f0386151309afd33bcec54153df7fd8f0
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Nov 26 14:40:27 2010 +0300
Добавил флаг показа пункта меню в хелпер
diff --git a/application/helper/controllers/NavController.php b/application/helper/controllers/NavController.php
index 887a2c5..d7d11b9 100644
--- a/application/helper/controllers/NavController.php
+++ b/application/helper/controllers/NavController.php
@@ -34,6 +34,7 @@ class NavController
* <br>каждый элемент - array(
* <br> 'title' => Заголовок,
* <br> 'url' => адрес(Url|строка|false),
+ * <br> ['show'] => true|false показывать или нет
* <br> 'childNodes' => вложенный массив аналогичной структуры,
* <br>)
* <br>остальные элементы игнорируются
@@ -65,8 +66,10 @@ class NavController
$result = '';
foreach ($items as $v)
{
+ if (isset($v['show']) && $v['show'] === false)
+ continue;
$result.='<li>';
- if ($v === false)
+ if ($v['url'] === false)
$result.=$v['title'];
else
{
commit 240a239b4c4fafaa7fc807b3c7b420a073a04964
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Nov 26 14:17:26 2010 +0300
В скафолдинг добавлен datepicker
diff --git a/addons/timepicker/jquery-ui-1.8.custom.css b/addons/timepicker/jquery-ui-1.8.custom.css
new file mode 100644
index 0000000..a2a5b4a
--- /dev/null
+++ b/addons/timepicker/jquery-ui-1.8.custom.css
@@ -0,0 +1,577 @@
+/*
+ * jQuery UI CSS Framework @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
+.ui-widget-content a { color: #333333; }
+.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
+.ui-widget-header a { color: #ffffff; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
+.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
+.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*
+ * jQuery UI Resizable @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Resizable#theming
+ */
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
+ * jQuery UI Selectable @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Selectable#theming
+ */
+.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
+/*
+ * jQuery UI Accordion @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Accordion#theming
+ */
+/* IE/Win - Fix animation bug - #4615 */
+.ui-accordion { width: 100%; }
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }/*
+ * jQuery UI Autocomplete @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Autocomplete#theming
+ */
+.ui-autocomplete { position: absolute; cursor: default; }
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Menu#theming
+ */
+.ui-menu {
+ list-style:none;
+ padding: 2px;
+ margin: 0;
+ display:block;
+ float: left;
+}
+.ui-menu .ui-menu {
+ margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+ margin:0;
+ padding: 0;
+ zoom: 1;
+ float: left;
+ clear: left;
+ width: 100%;
+}
+.ui-menu .ui-menu-item a {
+ text-decoration:none;
+ display:block;
+ padding:.2em .4em;
+ line-height:1.5;
+ zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+ font-weight: normal;
+ margin: -1px;
+}
+/*
+ * jQuery UI Button @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Button#theming
+ */
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; }
+button.ui-button-icons-only { width: 3.7em; }
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4; }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+/*
+ * jQuery UI Dialog @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Dialog#theming
+ */
+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; }
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
+.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+/*
+ * jQuery UI Slider @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Slider#theming
+ */
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
+ * jQuery UI Tabs @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Tabs#theming
+ */
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/*
+ * jQuery UI Datepicker @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker#theming
+ */
+.ui-datepicker { width: 17em; padding: .2em .2em 0; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+ display: none; /*sorry for IE5*/
+ display/**/: block; /*sorry for IE5*/
+ position: absolute; /*must have*/
+ z-index: -1; /*must have*/
+ filter: mask(); /*must have*/
+ top: -4px; /*must have*/
+ left: -4px; /*must have*/
+ width: 200px; /*must have*/
+ height: 200px; /*must have*/
+}/*
+ * jQuery UI Progressbar @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Progressbar#theming
+ */
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
+
+
+.ui-timepicker-div dl{ text-align: left; }
+.ui-timepicker-div dl dt{ height: 25px; }
+.ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; }
\ No newline at end of file
diff --git a/addons/timepicker/jquery-ui-1.8.custom.min.js b/addons/timepicker/jquery-ui-1.8.custom.min.js
new file mode 100644
index 0000000..65966b0
--- /dev/null
+++ b/addons/timepicker/jquery-ui-1.8.custom.min.js
@@ -0,0 +1,374 @@
+/*!
+ * jQuery UI 1.8
+ *
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI
+ */
/*
+ * jQuery UI 1.8
+ *
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI
+ */
+jQuery.ui||(function(a){a.ui={version:"1.8",plugin:{add:function(c,d,f){var e=a.ui[c].prototype;for(var b in f){e.plugins[b]=e.plugins[b]||[];e.plugins[b].push([d,f[b]])}},call:function(b,d,c){var f=b.plugins[d];if(!f||!b.element[0].parentNode){return}for(var e=0;e<f.length;e++){if(b.options[f[e][0]]){f[e][1].apply(b.element,c)}}}},contains:function(d,c){return document.compareDocumentPosition?d.compareDocumentPosition(c)&16:d!==c&&d.contains(c)},hasScroll:function(e,c){if(a(e).css("overflow")=="hidden"){return false}var b=(c&&c=="left")?"scrollLeft":"scrollTop",d=false;if(e[b]>0){return true}e[b]=1;d=(e[b]>0);e[b]=0;return d},isOverAxis:function(c,b,d){return(c>b)&&(c<(b+d))},isOver:function(g,c,f,e,b,d){return a.ui.isOverAxis(g,f,b)&&a.ui.isOverAxis(c,e,d)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};a.fn.extend({_focus:a.fn.focus,focus:function(b,c){return typeof b==="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus();(c&&c.call(d))},b)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var b;if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){b=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}else{b=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(thi |
|
From: Ivan1986 <iva...@us...> - 2010-11-22 13:15:02
|
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 961d08f187aadbfece0d87ee0233080fa78f141a (commit)
from fb0aa4c74502b2d656a98eb8c16fb465963e6e4d (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 961d08f187aadbfece0d87ee0233080fa78f141a
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 16:12:01 2010 +0300
Переименованы старые html
diff --git a/application/admin/templates/auth.php b/application/admin/templates/auth.php
index 195d207..c74d626 100644
--- a/application/admin/templates/auth.php
+++ b/application/admin/templates/auth.php
@@ -14,5 +14,6 @@
</tr>
</table>
</form>
+ </div>
</div>
</div>
diff --git a/lib/Modules/admin/controllers/Controller.php b/lib/Modules/admin/controllers/Controller.php
index 39f4569..ee65639 100644
--- a/lib/Modules/admin/controllers/Controller.php
+++ b/lib/Modules/admin/controllers/Controller.php
@@ -7,7 +7,7 @@ class Controller extends QuickFW_Auth
function __construct()
{
if(!parent::__construct('admin'))
- die (QFW::$view->displayMain(QFW::$view->fetch(('auth.html'))));
+ die (QFW::$view->displayMain(QFW::$view->fetch(('auth.php'))));
}
protected function acl($level)
diff --git a/lib/Modules/admin/controllers/InfoController.php b/lib/Modules/admin/controllers/InfoController.php
index 520ad7c..ee9eccb 100644
--- a/lib/Modules/admin/controllers/InfoController.php
+++ b/lib/Modules/admin/controllers/InfoController.php
@@ -20,7 +20,7 @@ class InfoController extends Controller
QFW::$view->assign('stat', '<pre>'.print_r($mc->getStats(), true).'</pre>');
unset($mc);
- return QFW::$view->fetch('memcache.html');
+ return QFW::$view->fetch('memcache.php');
}
public function phpinfoAction()
diff --git a/lib/Modules/admin/controllers/NavController.php b/lib/Modules/admin/controllers/NavController.php
index 3689f6b..c5018af 100644
--- a/lib/Modules/admin/controllers/NavController.php
+++ b/lib/Modules/admin/controllers/NavController.php
@@ -11,7 +11,7 @@ class NavController
'c'=>$cur,
'url'=>$url,
));
- return QFW::$view->fetch('pager.html');
+ return QFW::$view->fetch('pager.php');
}
public function menuBlock($type)
@@ -31,7 +31,7 @@ class NavController
$data = $data[$type];
- return QFW::$view->assign('menu',$data)->fetch('sub/head_stripe.html');
+ return QFW::$view->assign('menu',$data)->fetch('sub/head_stripe.php');
}
}
diff --git a/lib/Modules/admin/templates/auth.html b/lib/Modules/admin/templates/auth.php
similarity index 98%
rename from lib/Modules/admin/templates/auth.html
rename to lib/Modules/admin/templates/auth.php
index 195d207..c74d626 100644
--- a/lib/Modules/admin/templates/auth.html
+++ b/lib/Modules/admin/templates/auth.php
@@ -14,5 +14,6 @@
</tr>
</table>
</form>
+ </div>
</div>
</div>
diff --git a/lib/Modules/admin/templates/main.html b/lib/Modules/admin/templates/main.php
similarity index 100%
rename from lib/Modules/admin/templates/main.html
rename to lib/Modules/admin/templates/main.php
diff --git a/lib/Modules/admin/templates/memcache.html b/lib/Modules/admin/templates/memcache.php
similarity index 100%
rename from lib/Modules/admin/templates/memcache.html
rename to lib/Modules/admin/templates/memcache.php
diff --git a/lib/Modules/admin/templates/pager.html b/lib/Modules/admin/templates/pager.php
similarity index 100%
rename from lib/Modules/admin/templates/pager.html
rename to lib/Modules/admin/templates/pager.php
diff --git a/lib/Modules/admin/templates/sub/head_stripe.html b/lib/Modules/admin/templates/sub/head_stripe.php
similarity index 100%
rename from lib/Modules/admin/templates/sub/head_stripe.html
rename to lib/Modules/admin/templates/sub/head_stripe.php
-----------------------------------------------------------------------
Summary of changes:
application/admin/templates/auth.php | 1 +
lib/Modules/admin/controllers/Controller.php | 2 +-
lib/Modules/admin/controllers/InfoController.php | 2 +-
lib/Modules/admin/controllers/NavController.php | 4 ++--
.../admin/templates/{auth.html => auth.php} | 1 +
.../admin/templates/{main.html => main.php} | 0
.../templates/{memcache.html => memcache.php} | 0
.../admin/templates/{pager.html => pager.php} | 0
.../sub/{head_stripe.html => head_stripe.php} | 0
9 files changed, 6 insertions(+), 4 deletions(-)
rename lib/Modules/admin/templates/{auth.html => auth.php} (98%)
rename lib/Modules/admin/templates/{main.html => main.php} (100%)
rename lib/Modules/admin/templates/{memcache.html => memcache.php} (100%)
rename lib/Modules/admin/templates/{pager.html => pager.php} (100%)
rename lib/Modules/admin/templates/sub/{head_stripe.html => head_stripe.php} (100%)
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-11-22 11:21:09
|
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 fb0aa4c74502b2d656a98eb8c16fb465963e6e4d (commit)
via aaee7e590312bd59b05c425bee783d01354b81d7 (commit)
via 84d9cf7c13fcca8c457412ecc8ad9bf2bafe5622 (commit)
via e996d7c3810a43f33cc667e60ba25e491ace1652 (commit)
via d5b4db669724c89690a43cac2046fd893c9f45b3 (commit)
via 164b60b852927cf4b6306be3502ec073be342a20 (commit)
via 24a1c0f7768e3392fda6d800b58371a7f9de7de9 (commit)
via 2cf7e7e92599b147fc4f810aab30ae629dfd7b30 (commit)
via 0b194a53c25c71167f7227ec241b3e431b8d7b45 (commit)
via 9341fc470422a1341ff3d33dfe410d43c177d1fb (commit)
via d2b9ff6fbd589a7df0e12231264503af66fa0913 (commit)
via d68c403adbbbf7a2c31829b3269791f0796162d3 (commit)
via f2b22e35d85b5c02958a78078454b25582cf358b (commit)
via 1543b37e58d269a15839bf8b3112a6a416c50647 (commit)
via 4745d25c13011fb82bc434009ed54efeb96fddd3 (commit)
via cdaad2053edfd4c57e5f967bfa53a077743838bf (commit)
via 0874793107893068c9285a7e7588ebe1c15ee062 (commit)
via 14ebf70babc4f73bd4842001d0b117d32bb4a5aa (commit)
via 02c1ce7134b0c7d4c76bf85651811c383de63464 (commit)
via 8f52174992938653d7cfc0fe0c59aeb97f6229a7 (commit)
via 9751ab7543c8831dbe9673bd7f9ecc1701464b31 (commit)
from 918448b68383ddb83ce0dd896c89fdff8dfab517 (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 fb0aa4c74502b2d656a98eb8c16fb465963e6e4d
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 14:11:57 2010 +0300
Автолоал для Hlp
diff --git a/QFW/QuickFW/Autoload.php b/QFW/QuickFW/Autoload.php
index ad3c73f..a0cf4d4 100644
--- a/QFW/QuickFW/Autoload.php
+++ b/QFW/QuickFW/Autoload.php
@@ -58,6 +58,7 @@ class Autoload
self::$classes = array(
'ScaffoldController' => LIBPATH.'/Modules/Scaffold/ScaffoldController.php',
'QuickFW_Auth' => QFWPATH.'/QuickFW/Auth.php',
+ 'Hlp' => QFWPATH.'/QuickFW/Helpers.php',
);
if (empty(self::$classes[$class]))
return false;
commit aaee7e590312bd59b05c425bee783d01354b81d7
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 13:43:55 2010 +0300
Поправил скрипты с учетом новых папок
diff --git a/perm.sh b/perm.sh
index a4174e4..ddfa5ac 100755
--- a/perm.sh
+++ b/perm.sh
@@ -5,5 +5,4 @@ cd `dirname $0`
test -z "$1" && echo "usage prem.sh <rights>" && exit 1
-chmod $1 -R tmp
-chmod $1 log
+chmod $1 -R var
diff --git a/release.sh b/release.sh
index d3398bb..b37648f 100755
--- a/release.sh
+++ b/release.sh
@@ -14,17 +14,12 @@ git archive --format=tar master | ( cd "../$1" ; tar xf - )
cd ../$1
find ./doc/* -type d | grep -v asciidoc | xargs rm -rf $1
-find ./tmp/* -type f | xargs rm -rf $1
+find ./var/* -type f | xargs rm -rf $1
rm -rf addons
./perm.sh 777
rm -f release.sh
rm -f .gitignore
-#cd doc/asciidoc
-#make quickfw.pdf
-#mv quickfw.pdf ../
-#cd ../..
-
cd ..
rm -f $1.tar.bz2
tar -cjf $1.tar.bz2 $1
commit 84d9cf7c13fcca8c457412ecc8ad9bf2bafe5622
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 13:36:54 2010 +0300
Преведены в порядок тесты
diff --git a/QFW/config.php b/QFW/config.php
index bd25f46..b0ff7cf 100644
--- a/QFW/config.php
+++ b/QFW/config.php
@@ -85,7 +85,7 @@ $config['cache'] = array(
$config['templater'] = array(
'name' => 'PlainView',
- 'def_tpl' => 'main.html',
+ 'def_tpl' => 'main.php',
);
?>
\ No newline at end of file
diff --git a/tests/QFWTests.php b/tests/QFWTests.php
index 5b1a6b1..12e4ac4 100644
--- a/tests/QFWTests.php
+++ b/tests/QFWTests.php
@@ -2,7 +2,7 @@
define ('ROOTPATH', dirname(dirname(__FILE__)));
define ('DOC_ROOT', ROOTPATH . '/www');
define ('APPPATH', ROOTPATH . '/tests/testapp');
- define ('TMPPATH', ROOTPATH . '/tmp');
+ define ('VARPATH', ROOTPATH . '/vap');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
define ('MODPATH', APPPATH . '/_common/models');
diff --git a/tests/app/010_http_host.phpt b/tests/app/010_http_host.phpt
index f5a7605..3284915 100644
--- a/tests/app/010_http_host.phpt
+++ b/tests/app/010_http_host.phpt
@@ -9,7 +9,6 @@ define ('APPPATH', ROOTPATH . '/application');
define ('VARPATH', ROOTPATH . '/var');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
-define ('MODPATH', APPPATH . '/_common/models');
require (QFWPATH.'/Init.php');
diff --git a/tests/app/030_init_time.phpt_ b/tests/app/030_init_time.phpt_
index 199940c..dbc734c 100644
--- a/tests/app/030_init_time.phpt_
+++ b/tests/app/030_init_time.phpt_
@@ -6,7 +6,7 @@ QFW: init time (may faild - rerun)
define ('DOC_ROOT', dirname(__FILE__));
define ('ROOTPATH', dirname(dirname(dirname(__FILE__))));
define ('APPPATH', ROOTPATH . '/application');
-define ('TMPPATH', ROOTPATH . '/tmp');
+define ('VARPATH', ROOTPATH . '/var');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
define ('MODPATH', APPPATH . '/_common/models');
diff --git a/tests/app/init.php b/tests/app/init.php
index f0003c5..8ef2207 100644
--- a/tests/app/init.php
+++ b/tests/app/init.php
@@ -5,7 +5,6 @@
define ('VARPATH', ROOTPATH . '/var');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
- define ('MODPATH', APPPATH . '/_common/models');
$_SERVER['HTTP_HOST'] = 'test';
diff --git a/tests/testapp/default/templates/main.html b/tests/testapp/default/templates/main.php
similarity index 100%
rename from tests/testapp/default/templates/main.html
rename to tests/testapp/default/templates/main.php
commit e996d7c3810a43f33cc667e60ba25e491ace1652
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 13:30:50 2010 +0300
Поправил тесты
diff --git a/tests/app/010_http_host.phpt b/tests/app/010_http_host.phpt
index 372ea73..f5a7605 100644
--- a/tests/app/010_http_host.phpt
+++ b/tests/app/010_http_host.phpt
@@ -6,7 +6,7 @@ QFW: test _SERVER HTTP_HOST
define ('DOC_ROOT', dirname(__FILE__));
define ('ROOTPATH', dirname(dirname(dirname(__FILE__))));
define ('APPPATH', ROOTPATH . '/application');
-define ('TMPPATH', ROOTPATH . '/tmp');
+define ('VARPATH', ROOTPATH . '/var');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
define ('MODPATH', APPPATH . '/_common/models');
diff --git a/tests/app/init.php b/tests/app/init.php
index f0c28f0..f0003c5 100644
--- a/tests/app/init.php
+++ b/tests/app/init.php
@@ -3,8 +3,6 @@
define ('ROOTPATH', dirname(dirname(dirname(__FILE__))));
define ('APPPATH', dirname(dirname(__FILE__)).'/testapp');
define ('VARPATH', ROOTPATH . '/var');
- define ('TMPPATH', VARPATH . '/tmp');
- define ('LOGPATH', VARPATH . '/log');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
define ('MODPATH', APPPATH . '/_common/models');
commit d5b4db669724c89690a43cac2046fd893c9f45b3
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 13:27:15 2010 +0300
Исправлена ошибка в show404
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index 37425c5..1d7d62d 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -225,9 +225,9 @@ class QuickFW_Router
header ('Status: 404 Not Found');
else*/
header((empty($_SERVER['SERVER_PROTOCOL']) ? 'HTTP/1.1 ' : $_SERVER['SERVER_PROTOCOL']).' 404 Not Found');
- if (!is_file(QFW::$view->getScriptPath().'/404.html'))
+ if (!is_file(QFW::$view->getScriptPath().'/404.php'))
QFW::$view->setScriptPath(APPPATH.'/default/templates/');
- die(QFW::$view->render('404.html'));
+ die(QFW::$view->render('404.php'));
}
/**
commit 164b60b852927cf4b6306be3502ec073be342a20
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 13:26:55 2010 +0300
Убрана инициализация лишних переменных
diff --git a/application/default/controllers/CssController.php b/application/default/controllers/CssController.php
index d05eed9..4374492 100644
--- a/application/default/controllers/CssController.php
+++ b/application/default/controllers/CssController.php
@@ -35,11 +35,11 @@ class CssController
QFW::$router->show404();
header('Content-Type: text/css');
- $out = array();
- $ret = false;
QFW::$view->setScriptPath($this->path);
$text = QFW::$view->fetch($scss);
//запускаем преобразования - по умолчанию без кеша и выводим ошибки в основной поток
+ $out = array();
+ $ret = false;
exec('echo '.escapeshellarg($text).' | '.self::SASS.' 2>&1 ', $out, $ret);
$out = implode("\n", $out);
diff --git a/application/default/controllers/JsController.php b/application/default/controllers/JsController.php
index 4da4df7..798906f 100644
--- a/application/default/controllers/JsController.php
+++ b/application/default/controllers/JsController.php
@@ -29,8 +29,6 @@ class JsController
QFW::$router->show404();
header('Content-Type: application/javascript');
- $out = array();
- $ret = false;
QFW::$view->setScriptPath($this->path);
$text = QFW::$view->fetch($js);
commit 24a1c0f7768e3392fda6d800b58371a7f9de7de9
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 13:18:06 2010 +0300
Поправлен вызов крона
diff --git a/cron/cruise.php b/cron/cruise.php
index 52e1c8a..3da151c 100644
--- a/cron/cruise.php
+++ b/cron/cruise.php
@@ -2,10 +2,14 @@
define ('DOC_ROOT', realpath(dirname(__FILE__).'../www'));
define ('ROOTPATH', realpath(dirname(__FILE__).'/../'));
define ('APPPATH', ROOTPATH . '/application');
- define ('TMPPATH', ROOTPATH . '/tmp');
+ define ('VARPATH', ROOTPATH . '/var');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
- define ('MODPATH', APPPATH . '/_common/models');
+
+//Настройки по умолчанию, если нужно - измените
+// define ('TMPPATH', VARPATH . '/tmp');
+// define ('LOGPATH', VARPATH . '/log');
+// define ('MODPATH', APPPATH . '/_common/models');
//TODO: Выкинуть gethostbyaddr после перехода на PHP 5.3
if (empty($_SERVER['HTTP_HOST']))
diff --git a/cron/start.php b/cron/start.php
index b1cbc95..34453ab 100644
--- a/cron/start.php
+++ b/cron/start.php
@@ -1,11 +1,15 @@
<?php
- define ('DOC_ROOT', dirname(dirname(__FILE__)).'/www');
- define ('ROOTPATH', dirname(dirname(__FILE__)));
+ define ('DOC_ROOT', realpath(dirname(__FILE__).'../www'));
+ define ('ROOTPATH', realpath(dirname(__FILE__).'/../'));
define ('APPPATH', ROOTPATH . '/application');
- define ('TMPPATH', ROOTPATH . '/tmp');
+ define ('VARPATH', ROOTPATH . '/var');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
- define ('MODPATH', APPPATH . '/_common/models');
+
+//Настройки по умолчанию, если нужно - измените
+// define ('TMPPATH', VARPATH . '/tmp');
+// define ('LOGPATH', VARPATH . '/log');
+// define ('MODPATH', APPPATH . '/_common/models');
//TODO: Выкинуть gethostbyaddr после перехода на PHP 5.3
if (empty($_SERVER['HTTP_HOST']))
commit 2cf7e7e92599b147fc4f810aab30ae629dfd7b30
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 12:44:58 2010 +0300
Пофиксил доку - у action нет ucfirst
diff --git a/doc/asciidoc/mvc.txt b/doc/asciidoc/mvc.txt
index 98c04f4..16f5f78 100644
--- a/doc/asciidoc/mvc.txt
+++ b/doc/asciidoc/mvc.txt
@@ -14,7 +14,7 @@ MVC и преобразование адресов в контроллеры
* Контроллер - в текущем модуле в папке +controllers+ проверяется наличие файла +NameСontroller+, если его нет, то используется файл +IndexСontroller+.
* После подключения файла контроллера проверяется наличие класса +NameСontroller+, а если его нет, то проверяется его наличие в пространстве имен с именем модуля.
* Если класс не найден, а файл существует, то выводится сообщение об ошибке.
- * В классе ищется функция +Аction(Action|Cli|Block|...)+ в зависимости от способа вызова. Если функции нет, то вызывается функция +index+ с указанным суффиксом.
+ * В классе ищется функция +action(Action|Cli|Block|...)+ в зависимости от способа вызова. Если функции нет, то вызывается функция +index+ с указанным суффиксом.
* Остальные компоненты передаются как параметры функции.
* У контроллера по умолчанию в действие по умолчанию (+index/index+) не может быть параметров - если они есть, то выдается 404
commit 0b194a53c25c71167f7227ec241b3e431b8d7b45
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 12:41:04 2010 +0300
Объединил в одну
diff --git a/www/index.php b/www/index.php
index 17f9e16..797f30d 100644
--- a/www/index.php
+++ b/www/index.php
@@ -3,12 +3,12 @@
define ('ROOTPATH', dirname(dirname(__FILE__)));
define ('APPPATH', ROOTPATH . '/application');
define ('VARPATH', ROOTPATH . '/var');
-//Настройки по умолчанию, если нужно - измените
-// define ('TMPPATH', VARPATH . '/tmp');
-// define ('LOGPATH', VARPATH . '/log');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
+
//Настройки по умолчанию, если нужно - измените
+// define ('TMPPATH', VARPATH . '/tmp');
+// define ('LOGPATH', VARPATH . '/log');
// define ('MODPATH', APPPATH . '/_common/models');
require (QFWPATH.'/Init.php');
commit 9341fc470422a1341ff3d33dfe410d43c177d1fb
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 12:39:03 2010 +0300
Автоинициализация еще одной константы
diff --git a/QFW/Init.php b/QFW/Init.php
index 34acaa2..e5e6c82 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -177,6 +177,8 @@ if (!defined('TMPPATH'))
define('TMPPATH', VARPATH.'/tmp');
if (!defined('LOGPATH'))
define('LOGPATH', VARPATH.'/log');
+if (!defined('MODPATH'))
+ define ('MODPATH', APPPATH . '/_common/models');
QFW::Init();
diff --git a/www/index.php b/www/index.php
index 25069df..17f9e16 100644
--- a/www/index.php
+++ b/www/index.php
@@ -8,7 +8,8 @@
// define ('LOGPATH', VARPATH . '/log');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
- define ('MODPATH', APPPATH . '/_common/models');
+//Настройки по умолчанию, если нужно - измените
+// define ('MODPATH', APPPATH . '/_common/models');
require (QFWPATH.'/Init.php');
commit d2b9ff6fbd589a7df0e12231264503af66fa0913
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 12:35:30 2010 +0300
Убрал logpath из конфига, значения по умолчанию для путей
diff --git a/QFW/Init.php b/QFW/Init.php
index 72dfd73..34acaa2 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -173,6 +173,11 @@ class QFW
}
+if (!defined('TMPPATH'))
+ define('TMPPATH', VARPATH.'/tmp');
+if (!defined('LOGPATH'))
+ define('LOGPATH', VARPATH.'/log');
+
QFW::Init();
?>
diff --git a/QFW/config.php b/QFW/config.php
index 8e29a95..bd25f46 100644
--- a/QFW/config.php
+++ b/QFW/config.php
@@ -5,7 +5,6 @@ $config=array();
$config['host']=array(
'encoding' => 'utf-8',
'lang' => '',
- 'logpath' => ROOTPATH.'/log',
);
$config['default']=array(
diff --git a/application/default.php b/application/default.php
index ab00071..14c650c 100644
--- a/application/default.php
+++ b/application/default.php
@@ -7,7 +7,6 @@ mb_internal_encoding("UTF-8");
$config['host']=array(
'encoding' => 'utf-8',
'lang' => 'ru_RU',
- 'logpath' => ROOTPATH.'/log',
);
/* Настройки дефолтового MCA */
diff --git a/www/index.php b/www/index.php
index 26e5166..25069df 100644
--- a/www/index.php
+++ b/www/index.php
@@ -3,8 +3,9 @@
define ('ROOTPATH', dirname(dirname(__FILE__)));
define ('APPPATH', ROOTPATH . '/application');
define ('VARPATH', ROOTPATH . '/var');
- define ('TMPPATH', VARPATH . '/tmp');
- define ('LOGPATH', VARPATH . '/log');
+//Настройки по умолчанию, если нужно - измените
+// define ('TMPPATH', VARPATH . '/tmp');
+// define ('LOGPATH', VARPATH . '/log');
define ('QFWPATH', ROOTPATH . '/QFW');
define ('LIBPATH', ROOTPATH . '/lib');
define ('MODPATH', APPPATH . '/_common/models');
commit d68c403adbbbf7a2c31829b3269791f0796162d3
Author: Ivan Borzenkov <iva...@li...>
Date: Mon Nov 22 12:30:42 2010 +0300
Завел папку var, в которую поместил все изменяемое
diff --git a/.gitignore b/.gitignore
index 9d81ed1..b0da8fc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-/tmp/doc
\ No newline at end of file
+/var/tmp/doc
\ No newline at end of file
diff --git a/QFW/Cacher/File.php b/QFW/Cacher/File.php
index 1a07e4e..0ac20e5 100644
--- a/QFW/Cacher/File.php
+++ b/QFW/Cacher/File.php
@@ -29,7 +29,7 @@ class Cacher_File implements Zend_Cache_Backend_Interface
function __construct($options = array(NULL))
{
- $this->options['cacheDir']=TMPPATH.'/cache/';
+ $this->options['cacheDir'] = VARPATH.'/cache/';
$this->options=array_merge($this->options, $options);
}
diff --git a/doc/asciidoc/Makefile b/doc/asciidoc/Makefile
index ef12398..f39af5f 100644
--- a/doc/asciidoc/Makefile
+++ b/doc/asciidoc/Makefile
@@ -13,17 +13,17 @@ quickfw.pdf: $(TEXTS)
quickfw.html: $(TEXTS)
a2x -f xhtml -v quickfw.txt -a lang=ru
-site: ../../tmp/doc/quickfw.html $(TEXTS)
+site: ../../var/tmp/doc/quickfw.html $(TEXTS)
-../../tmp/doc/quickfw.html: $(TEXTS)
- rm -rf ../../tmp/doc
- mkdir -p ../../tmp/doc
- a2x -f xhtml -v quickfw.txt -D ../../tmp/doc -a lang=ru
+../../var/tmp/doc/quickfw.html: $(TEXTS)
+ rm -rf ../../var/tmp/doc
+ mkdir -p ../../var/tmp/doc
+ a2x -f xhtml -v quickfw.txt -D ../../var/tmp/doc -a lang=ru
clean:
rm -rf quickfw.pdf
rm -rf quickfw.html docbook-xsl.css
- rm -rf ../../tmp/doc
+ rm -rf ../../var/tmp/doc
install:
sudo aptitude install asciidoc texlive-xetex source-highlight
diff --git a/doc/asciidoc/directory.txt b/doc/asciidoc/directory.txt
index ccd66d9..d01b0d0 100644
--- a/doc/asciidoc/directory.txt
+++ b/doc/asciidoc/directory.txt
@@ -43,8 +43,6 @@
*lib*::
Папка с различными дополнительными библиотеками
*Не готово*
-*log*::
- Папка для сохранения логов по умолчанию (должна быть разрешена запись)
*QFW*::
Общие классы фреймворка
*QuickFW*;;
@@ -76,9 +74,13 @@
*tests*::
Тесты для PHPUnit
-*tmp*::
- Папка для временных файлов (должна быть разрешена запись)
+*var*::
+ Изменяемые файлы - для корректной работы запись должна быть разрешена
+ *tmp*;;
+ Папка для временных файлов
cache;;
Файловый кеш
+ *log*;;
+ Папка для сохранения логов
*www*::
DOCUMENT ROOT
\ No newline at end of file
diff --git a/lib/Log.php b/lib/Log.php
index a5dcfb0..5626a2f 100644
--- a/lib/Log.php
+++ b/lib/Log.php
@@ -66,7 +66,7 @@ class Log
private function email($str, $to) { self::$messages['email'][$to][]=$str; }
private static function f($str, $to)
{
- error_log(date('Y-m-d H:i:s').': '.$str."\n", 3, QFW::$config['host']['logpath'].'/'.$to.'.log');
+ error_log(date('Y-m-d H:i:s').': '.$str."\n", 3, LOGPATH.'/'.$to.'.log');
}
public function __destruct()
diff --git a/lib/Log52.php b/lib/Log52.php
index 4f28952..c903358 100644
--- a/lib/Log52.php
+++ b/lib/Log52.php
@@ -71,7 +71,7 @@ class Log
private function email($str, $to) { self::$messages['email'][$to][]=$str; }
private static function f($str, $to)
{
- error_log(date('Y-m-d H:i:s').': '.$str."\n", 3, QFW::$config['host']['logpath'].'/'.$to.'.log');
+ error_log(date('Y-m-d H:i:s').': '.$str."\n", 3, LOGPATH.'/'.$to.'.log');
}
public function __destruct()
diff --git a/tests/app/init.php b/tests/app/init.php
index a0c53bc..f0c28f0 100644
--- a/tests/app/init.php
+++ b/tests/app/init.php
@@ -2,7 +2,9 @@
define ('DOC_ROOT', dirname(__FILE__));
define ('ROOTPATH', dirname(dirname(dirname(__FILE__))));
define ('APPPATH', dirname(dirname(__FILE__)).'/testapp');
- define ('TMPPATH', ROOTPATH . '/tmp');
+ define ('VARPATH', ROOTPATH . '/var');
+ define ('TM |
|
From: Ivan1986 <iva...@us...> - 2010-11-16 22:16:59
|
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 918448b68383ddb83ce0dd896c89fdff8dfab517 (commit)
via 0592b7de023e179e4a8dad16e0ba3e952d1075f4 (commit)
via fa2424abee5d7ba951f7273e45a41d095c55404b (commit)
via b3d60aa34f6cd8c02a7771d7be82d120f03ae3af (commit)
via 96ab54e3d66e6bf7b403ffbf2daa1ec09f35b170 (commit)
via f3f07bd048e2b68ebfe271c1405742f651c6ead9 (commit)
via 6d8b112233fa8bbfc4c3e243ffe04be1f4b7c436 (commit)
via c379916d66f322799f3ae1bb395ac3a1d0d808b9 (commit)
from 68b2ec429e005a1e7a58d28e5ba33852be511f19 (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 918448b68383ddb83ce0dd896c89fdff8dfab517
Author: Ivan Borzenkov <iva...@li...>
Date: Sun Nov 14 19:40:06 2010 +0300
Правки phpdoc в роутере
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index 3124e6f..37425c5 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -305,7 +305,7 @@ class QuickFW_Router
protected $rewrite = false;
/** @var array Массив обратных преобразований Uri */
protected $backrewrite = false;
- /** @var array Массив обратных преобразований Urr */
+ /** @var array Массив обратных преобразований Url */
protected $backrewriteUrl = false;
/**
@@ -321,7 +321,7 @@ class QuickFW_Router
}
/**
- * Функция производит фитальные преобразования полного урла
+ * Функция производит финальные преобразования полного урла
*
* @internal
* @param string $url Url для бекреврайта
@@ -348,7 +348,7 @@ class QuickFW_Router
* Реализация преобразования адресов
*
* @internal
- * @param string $url Uri для реврайта
+ * @param string $uri Uri для реврайта
* @param string $type тип преобразования
* @return string преобразованный Uri
*/
commit 0592b7de023e179e4a8dad16e0ba3e952d1075f4
Author: TeXHaPb <st...@in...>
Date: Wed Nov 17 00:49:05 2010 +0300
Правка очепяток + правка подстановки якоря в Url::site
diff --git a/QFW/QuickFW/Url.php b/QFW/QuickFW/Url.php
index bd2ab8c..aef159c 100644
--- a/QFW/QuickFW/Url.php
+++ b/QFW/QuickFW/Url.php
@@ -23,12 +23,12 @@ class Url
*
* @param string|self $url url
* @param string|array $get параметры
- * @param string $ancor якорь
+ * @param string $anchor якорь
* @return self адрес на сайте
*/
- public static function site($url='', $get='', $ancor='')
+ public static function site($url='', $get='', $anchor='')
{
- return new self($url, $get);
+ return new self($url, $get, $anchor);
}
/**
@@ -36,12 +36,12 @@ class Url
*
* @param string|self $CA url
* @param string|array $get параметры
- * @param string $ancor якорь
+ * @param string $anchor якорь
* @return self адрес на сайте
*/
- public static function M($CA='', $get='', $ancor='')
+ public static function M($CA='', $get='', $anchor='')
{
- return new self($CA, $get, $ancor, QFW::$router->cModule.
+ return new self($CA, $get, $anchor, QFW::$router->cModule.
QuickFW_Router::PATH_SEPARATOR);
}
@@ -50,12 +50,12 @@ class Url
*
* @param string|self $action url
* @param string|array $get параметры
- * @param string $ancor якорь
+ * @param string $anchor якорь
* @return self адрес на сайте
*/
- public static function C($action='', $get='', $ancor='')
+ public static function C($action='', $get='', $anchor='')
{
- return new self($action, $get, $ancor, QFW::$router->cModule.
+ return new self($action, $get, $anchor, QFW::$router->cModule.
QuickFW_Router::PATH_SEPARATOR.
QFW::$router->cController.
QuickFW_Router::PATH_SEPARATOR);
@@ -66,12 +66,12 @@ class Url
*
* @param string|self $params url
* @param string|array $get параметры
- * @param string $ancor якорь
+ * @param string $anchor якорь
* @return self адрес на сайте
*/
- public static function A($params='', $get='', $ancor='')
+ public static function A($params='', $get='', $anchor='')
{
- return new self($params, $get, $ancor, QFW::$router->cModule.
+ return new self($params, $get, $anchor, QFW::$router->cModule.
QuickFW_Router::PATH_SEPARATOR.
QFW::$router->cController.
QuickFW_Router::PATH_SEPARATOR.
@@ -98,10 +98,10 @@ class Url
*
* @param string $url внутреннее представление адреса
* @param string|array $get параметры get
- * @param string $ancor якорь
+ * @param string $anchor якорь
* @param string $begin базовый урл от текущего
*/
- private function __construct($url, $get='', $ancor='', $begin='')
+ private function __construct($url, $get='', $anchor='', $begin='')
{
if (is_array($get) && count($get))
$get = http_build_query($get);
@@ -109,7 +109,7 @@ class Url
{
$this->u = $begin.$url->u;
$this->get = $url->get.($get?('&'.$get):'');
- $this->ancor = $ancor ? ltrim($ancor, '#') : $url->ancor;
+ $this->anchor = $anchor ? ltrim($anchor, '#') : $url->anchor;
return;
}
//Заменяем / на QuickFW_Router::PATH_SEPARATOR
@@ -117,7 +117,7 @@ class Url
$url = strtr($url, '/', QuickFW_Router::PATH_SEPARATOR);
$this->u = trim($begin.$url, QuickFW_Router::PATH_SEPARATOR);
$this->get = $get;
- $this->ancor = ltrim($ancor, '#');
+ $this->anchor = ltrim($anchor, '#');
if (self::$config['delDef'])
$this->u = QFW::$router->delDef($this->u);
}
@@ -129,7 +129,7 @@ class Url
private $get;
/** @var string якорь */
- private $ancor;
+ private $anchor;
/**
* урл для вывода, с подстановками
@@ -142,7 +142,7 @@ class Url
self::$config['base'].QFW::$router->backrewrite($this->u).
($this->u!=='' ? self::$config['ext'] : '').
($this->get ? '?' . $this->get : '').
- ($this->ancor ? '#' . $this->ancor : ''));
+ ($this->anchor ? '#' . $this->anchor : ''));
}
commit fa2424abee5d7ba951f7273e45a41d095c55404b
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Nov 12 14:12:53 2010 +0300
Исправил имя класса в phpdoc
diff --git a/QFW/Init.php b/QFW/Init.php
index be198cb..72dfd73 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -17,7 +17,7 @@ class QFW
/** @var array Подключенные глобальные библиотеки */
static public $libs = array();
- /** @var DbSimple_Generic_Database|false Подключение к базе данных */
+ /** @var DbSimple_Database|false Подключение к базе данных */
static public $db = false;
/** @var mixed|false Данные о пользователе */
commit b3d60aa34f6cd8c02a7771d7be82d120f03ae3af
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Nov 11 11:21:10 2010 +0300
Вынес имя поля в форме в отдельную функцию
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index c2ac617..04ad999 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -159,13 +159,14 @@ class Scaffold_Field extends Scaffold_Field_Info
/**
* Строит стандартный селект
*
+ * @param string $id первичный ключ
* @param array $data массив ключ=>значение
* @param scalar $cur текущий элемент
* @return string блок селекта
*/
- protected function selectBuild($data, $cur, $null=true)
+ protected function selectBuild($id, $data, $cur, $null=true)
{
- $text = '<select name="data['.$this->name.']">';
+ $text = '<select name="'.$this->editName($id).'">';
if ($null)
$text.= '<option value="0"'.
(!isset($data[$cur]) ? ' selected="selected"' : '').
@@ -178,6 +179,17 @@ class Scaffold_Field extends Scaffold_Field_Info
return $text;
}
+ /**
+ * Имя поля для формы
+ *
+ * @param string $id первичный ключ
+ * @return string Имя поля в name
+ */
+ protected function editName($id)
+ {
+ return 'data['.$this->name.']';
+ }
+
}
//Сервисные классы
@@ -228,7 +240,7 @@ class Scaffold_Foreign extends Scaffold_Field
public function editor($id, $value)
{
- return $this->selectBuild($this->lookup, $value);
+ return $this->selectBuild($id, $this->lookup, $value);
}
public function validator($id, $value)
@@ -282,7 +294,7 @@ class Scaffold_Text extends Scaffold_UserInput
public function editor($id, $value)
{
- return '<textarea name="data['.$this->name.']" '.
+ return '<textarea name="'.$this->editName($id).'" '.
'rows="'.$this->rows.'" cols="'.$this->cols.'">'.
QFW::$view->esc($value).'</textarea>';
}
@@ -343,7 +355,7 @@ class Scaffold_Enum extends Scaffold_Field
public function editor($id, $value)
{
- return $this->selectBuild($this->items, $value, false);
+ return $this->selectBuild($id, $this->items, $value, false);
}
}
@@ -360,8 +372,8 @@ class Scaffold_Checkbox extends Scaffold_Field
public function editor($id, $value)
{
- return '<input type="hidden" name="data['.$this->name.']" value="0" />
- <input type="checkbox" name="data['.$this->name.']" value="1" label="'.$this->title.'"
+ return '<input type="hidden" name="'.$this->editName($id).'" value="0" />
+ <input type="checkbox" name="'.$this->editName($id).'" value="1" label="'.$this->title.'"
default="'.($value?'checked':'').'" />';
}
@@ -404,20 +416,20 @@ class Scaffold_File extends Scaffold_Field
public function editor($id, $value)
{
- return '<input type="file" name="file['.$this->name.']" />
- <input type="hidden" name="data['.$this->name.']" value="0" />
- <input type="checkbox" name="data['.$this->name.']" value="1" label="Удалить" /> '.
+ return '<input type="file" name="f'.$this->editName($id).'" />
+ <input type="hidden" name="'.$this->editName($id).'" value="0" />
+ <input type="checkbox" name="'.$this->editName($id).'" value="1" label="Удалить" /> '.
$this->display($id, $value);
}
public function validator($id, $value)
{
//оставляем старый файл
- if ($_FILES['file']['error'][$this->name] == 4)
+ if ($_FILES['fdata']['error'][$this->name] == 4)
return true;
- if ($_FILES['file']['error'][$this->name] != 0)
+ if ($_FILES['fdata']['error'][$this->name] != 0)
return 'Ошибка при загрузке файла '.$this->title;
- return is_uploaded_file($_FILES['file']['tmp_name'][$this->name]);
+ return is_uploaded_file($_FILES['fdata']['tmp_name'][$this->name]);
}
public function proccess($id, $value)
@@ -428,7 +440,7 @@ class Scaffold_File extends Scaffold_Field
if ($value === false && is_file($this->path.'/'.$old))
unlink($this->path.'/'.$old);
//оставляем старое значение
- if ($_FILES['file']['error'][$this->name] == 4 && !$value)
+ if ($_FILES['fdata']['error'][$this->name] == 4 && !$value)
return $old ? $old : '';
//удяляем старый
if (is_file($this->path.'/'.$old))
@@ -437,11 +449,11 @@ class Scaffold_File extends Scaffold_Field
if ($value)
return '';
//генерим новое имя
- $info = pathinfo($_FILES['file']['name'][$this->name]);
+ $info = pathinfo($_FILES['fdata']['name'][$this->name]);
if ($id == -1)
$id = time();
$new_name = $this->name.'_'.$id.'.'.$info['extension'];
- move_uploaded_file($_FILES['file']['tmp_name'][$this->name], $this->path.'/'.$new_name);
+ move_uploaded_file($_FILES['fdata']['tmp_name'][$this->name], $this->path.'/'.$new_name);
return $new_name;
}
commit 96ab54e3d66e6bf7b403ffbf2daa1ec09f35b170
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Nov 9 14:49:09 2010 +0300
Удален старый файл из XMPP
diff --git a/lib/XMPPHP/XMPP_Old.php b/lib/XMPPHP/XMPP_Old.php
deleted file mode 100644
index 6083dad..0000000
--- a/lib/XMPPHP/XMPP_Old.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/**
- * XMPPHP: The PHP XMPP Library
- * Copyright (C) 2008 Nathanael C. Fritz
- * This file is part of SleekXMPP.
- *
- * XMPPHP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * XMPPHP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XMPPHP; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category xmpphp
- * @package XMPPHP
- * @author Nathanael C. Fritz <JID: fr...@ne...>
- * @author Stephan Wentz <JID: st...@ja...>
- * @author Michael Garvin <JID: ga...@ne...>
- * @copyright 2008 Nathanael C. Fritz
- */
-
-/** XMPPHP_XMPP
- *
- * This file is unnecessary unless you need to connect to older, non-XMPP-compliant servers like Dreamhost's.
- * In this case, use instead of XMPPHP_XMPP, otherwise feel free to delete it.
- * The old Jabber protocol wasn't standardized, so use at your own risk.
- *
- */
-require_once dirname(__FILE__) . '/XMPP.php';
-
- class XMPPHP_XMPPOld extends XMPPHP_XMPP {
- /**
- *
- * @var string
- */
- protected $session_id;
-
- public function __construct($host, $port, $user, $password, $resource, $server = null, $printlog = false, $loglevel = null) {
- parent::__construct($host, $port, $user, $password, $resource, $server, $printlog, $loglevel);
- if(!$server) $server = $host;
- $this->stream_start = '<stream:stream to="' . $server . '" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">';
- $this->fulljid = "{$user}@{$server}/{$resource}";
- }
-
- /**
- * Override XMLStream's startXML
- *
- * @param parser $parser
- * @param string $name
- * @param array $attr
- */
- public function startXML($parser, $name, $attr) {
- if($this->xml_depth == 0) {
- $this->session_id = $attr['ID'];
- $this->authenticate();
- }
- parent::startXML($parser, $name, $attr);
- }
-
- /**
- * Send Authenticate Info Request
- *
- */
- public function authenticate() {
- $id = $this->getId();
- $this->addidhandler($id, 'authfieldshandler');
- $this->send("<iq type='get' id='$id'><query xmlns='jabber:iq:auth'><username>{$this->user}</username></query></iq>");
- }
-
- /**
- * Retrieve auth fields and send auth attempt
- *
- * @param XMLObj $xml
- */
- public function authFieldsHandler($xml) {
- $id = $this->getId();
- $this->addidhandler($id, 'oldAuthResultHandler');
- if($xml->sub('query')->hasSub('digest')) {
- $hash = sha1($this->session_id . $this->password);
- print "{$this->session_id} {$this->password}\n";
- $out = "<iq type='set' id='$id'><query xmlns='jabber:iq:auth'><username>{$this->user}</username><digest>{$hash}</digest><resource>{$this->resource}</resource></query></iq>";
- } else {
- $out = "<iq type='set' id='$id'><query xmlns='jabber:iq:auth'><username>{$this->user}</username><password>{$this->password}</password><resource>{$this->resource}</resource></query></iq>";
- }
- $this->send($out);
-
- }
-
- /**
- * Determine authenticated or failure
- *
- * @param XMLObj $xml
- */
- public function oldAuthResultHandler($xml) {
- if($xml->attrs['type'] != 'result') {
- $this->log->log("Auth failed!", XMPPHP_Log::LEVEL_ERROR);
- $this->disconnect();
- throw new XMPPHP_Exception('Auth failed!');
- } else {
- $this->log->log("Session started");
- $this->event('session_start');
- }
- }
- }
-
-
-?>
commit f3f07bd048e2b68ebfe271c1405742f651c6ead9
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Nov 12 23:21:29 2010 +0300
Русская дата
diff --git a/lib/utils.php b/lib/utils.php
index c6cc6c4..c950a5f 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -277,7 +277,7 @@ function array2xml($array,$attrName='attr',$arrFlar='array')
/**
* Вывод окончаний русских слов с учетом числительных (например сообщение сообщения сообщений)
*
- * @param intereg $n число
+ * @param integer $n число
* @param string $form1 единственное
* @param string $form2 форма для 2-4
* @param string $form5 форма для 5 и более
@@ -294,6 +294,42 @@ function pluralForm($n, $form1, $form2, $form5)
}
/**
+ * Формирование даты по-русски
+ * <br>так как при выстановке локали неправильно склоняет
+ *
+ * @see date
+ * @param string $format формат аналогичен date
+ * @param integer $time время
+ * @return string дата
+ */
+function russian_date($format, $time=false)
+{
+ static $translation = array(
+ "January" => "Января",
+ "February" => "Февраля",
+ "March" => "Марта",
+ "April" => "Апреля",
+ "May" => "Мая",
+ "June" => "Июня",
+ "July" => "Июля",
+ "August" => "Августа",
+ "September" => "Сентября",
+ "October" => "Октября",
+ "November" => "Ноября",
+ "December" => "Декабря",
+ "Monday" => "Понедельник",
+ "Tuesday" => "Вторник",
+ "Wednesday" => "Среда",
+ "Thursday" => "Четверг",
+ "Friday" => "Пятница",
+ "Saturday" => "Суббота",
+ "Sunday" => "Воскресенье",
+ );
+ return strtr(date($format, $time!==false ? $time : time()), $translation);
+}
+
+
+/**
* Вызывает preg_match(_all) и
* <br>возвращается данные в удобном формате
* <br>с использованием флага PREG_SET_ORDER
commit 6d8b112233fa8bbfc4c3e243ffe04be1f4b7c436
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Nov 3 11:29:32 2010 +0300
Полный бэкреврайт
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index 84e6c78..3124e6f 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -305,6 +305,8 @@ class QuickFW_Router
protected $rewrite = false;
/** @var array Массив обратных преобразований Uri */
protected $backrewrite = false;
+ /** @var array Массив обратных преобразований Urr */
+ protected $backrewriteUrl = false;
/**
* Функция производит преобразования урла для вывода на страницу
@@ -319,6 +321,18 @@ class QuickFW_Router
}
/**
+ * Функция производит фитальные преобразования полного урла
+ *
+ * @internal
+ * @param string $url Url для бекреврайта
+ * @return string преобразованный Url
+ */
+ public function backrewriteUrl($url)
+ {
+ return $this->rewr($url, 'backrewriteUrl');
+ }
+
+ /**
* Функция производит преобразования урла при запросе
*
* @internal
@@ -342,17 +356,19 @@ class QuickFW_Router
{
if (!QFW::$config['redirection']['useRewrite'])
return $uri;
- if ($this->$type == false)
+ if ($this->$type === false)
{
- $rewrite = array();
- $backrewrite = array();
+ $rewrite = $backrewrite = $backrewriteUrl = array();
require_once APPPATH . '/rewrite.php';
$this->rewrite = $rewrite;
$this->backrewrite = $backrewrite;
+ $this->backrewriteUrl = $backrewriteUrl;
}
+ if (empty($this->$type))
+ return $uri;
if (is_array($this->$type))
return preg_replace(array_keys($this->$type), array_values($this->$type), $uri);
- elseif (is_callable($this->$type))
+ if (is_callable($this->$type))
{
$f = $this->$type;
return $f($uri);
diff --git a/QFW/QuickFW/Url.php b/QFW/QuickFW/Url.php
index 63c22d5..bd2ab8c 100644
--- a/QFW/QuickFW/Url.php
+++ b/QFW/QuickFW/Url.php
@@ -138,10 +138,11 @@ class Url
*/
public function __toString()
{
- return self::$config['base'].$this->u.
+ return QFW::$router->backrewriteUrl(
+ self::$config['base'].QFW::$router->backrewrite($this->u).
($this->u!=='' ? self::$config['ext'] : '').
($this->get ? '?' . $this->get : '').
- ($this->ancor ? '#' . $this->ancor : '');
+ ($this->ancor ? '#' . $this->ancor : ''));
}
diff --git a/application/rewrite.php b/application/rewrite.php
index 5a8b367..9c7ea74 100644
--- a/application/rewrite.php
+++ b/application/rewrite.php
@@ -4,5 +4,13 @@ $rewrite = array(
);
$backrewrite = array(
);
+$backrewriteUrl = array(
+);
+
+/* пример */
+/*$backrewriteUrl = function($url)
+{
+ return $url.'?from='.QFW::$router->RequestUri ;
+}*/
?>
\ No newline at end of file
commit c379916d66f322799f3ae1bb395ac3a1d0d808b9
Author: Ivan Borzenkov <iva...@li...>
Date: Sun Oct 10 19:39:35 2010 +0400
Добавлена установка пакетов для deb
diff --git a/doc/asciidoc/Makefile b/doc/asciidoc/Makefile
index f676452..ef12398 100644
--- a/doc/asciidoc/Makefile
+++ b/doc/asciidoc/Makefile
@@ -1,8 +1,12 @@
-all: quickfw.pdf quickfw.html
+all: pdf html
FILES = quickfw general quickstart directory mvc blocks templates cache auth autoload helpers features
TEXTS = $(addsuffix .txt, $(FILES) )
+pdf: quickfw.pdf
+
+html: quickfw.html
+
quickfw.pdf: $(TEXTS)
a2x -v quickfw.txt --dblatex-opts='--backend=xetex -o quickfw.pdf' -a lang=ru
@@ -21,4 +25,7 @@ clean:
rm -rf quickfw.html docbook-xsl.css
rm -rf ../../tmp/doc
-.PHONY: all clean
+install:
+ sudo aptitude install asciidoc texlive-xetex source-highlight
+
+.PHONY: all clean install
-----------------------------------------------------------------------
Summary of changes:
QFW/Init.php | 2 +-
QFW/QuickFW/Router.php | 26 +++++++--
QFW/QuickFW/Url.php | 39 +++++++-------
application/rewrite.php | 8 +++
doc/asciidoc/Makefile | 11 +++-
lib/Modules/Scaffold/Fields.php | 44 ++++++++++------
lib/XMPPHP/XMPP_Old.php | 114 ---------------------------------------
lib/utils.php | 38 +++++++++++++-
8 files changed, 124 insertions(+), 158 deletions(-)
delete mode 100644 lib/XMPPHP/XMPP_Old.php
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-11-16 21:53:15
|
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 552590490bd5c1613ead228501dd5320cb89028a (commit)
via 0592b7de023e179e4a8dad16e0ba3e952d1075f4 (commit)
from 63eceee1fa48fefcdfa58d2a5fe80ab348653440 (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 552590490bd5c1613ead228501dd5320cb89028a
Merge: 0592b7d 63eceee
Author: TeXHaPb <st...@in...>
Date: Wed Nov 17 00:49:27 2010 +0300
Merge branch 'master' of https://github.com/ivan1986/quickfw
commit 0592b7de023e179e4a8dad16e0ba3e952d1075f4
Author: TeXHaPb <st...@in...>
Date: Wed Nov 17 00:49:05 2010 +0300
Правка очепяток + правка подстановки якоря в Url::site
diff --git a/QFW/QuickFW/Url.php b/QFW/QuickFW/Url.php
index bd2ab8c..aef159c 100644
--- a/QFW/QuickFW/Url.php
+++ b/QFW/QuickFW/Url.php
@@ -23,12 +23,12 @@ class Url
*
* @param string|self $url url
* @param string|array $get параметры
- * @param string $ancor якорь
+ * @param string $anchor якорь
* @return self адрес на сайте
*/
- public static function site($url='', $get='', $ancor='')
+ public static function site($url='', $get='', $anchor='')
{
- return new self($url, $get);
+ return new self($url, $get, $anchor);
}
/**
@@ -36,12 +36,12 @@ class Url
*
* @param string|self $CA url
* @param string|array $get параметры
- * @param string $ancor якорь
+ * @param string $anchor якорь
* @return self адрес на сайте
*/
- public static function M($CA='', $get='', $ancor='')
+ public static function M($CA='', $get='', $anchor='')
{
- return new self($CA, $get, $ancor, QFW::$router->cModule.
+ return new self($CA, $get, $anchor, QFW::$router->cModule.
QuickFW_Router::PATH_SEPARATOR);
}
@@ -50,12 +50,12 @@ class Url
*
* @param string|self $action url
* @param string|array $get параметры
- * @param string $ancor якорь
+ * @param string $anchor якорь
* @return self адрес на сайте
*/
- public static function C($action='', $get='', $ancor='')
+ public static function C($action='', $get='', $anchor='')
{
- return new self($action, $get, $ancor, QFW::$router->cModule.
+ return new self($action, $get, $anchor, QFW::$router->cModule.
QuickFW_Router::PATH_SEPARATOR.
QFW::$router->cController.
QuickFW_Router::PATH_SEPARATOR);
@@ -66,12 +66,12 @@ class Url
*
* @param string|self $params url
* @param string|array $get параметры
- * @param string $ancor якорь
+ * @param string $anchor якорь
* @return self адрес на сайте
*/
- public static function A($params='', $get='', $ancor='')
+ public static function A($params='', $get='', $anchor='')
{
- return new self($params, $get, $ancor, QFW::$router->cModule.
+ return new self($params, $get, $anchor, QFW::$router->cModule.
QuickFW_Router::PATH_SEPARATOR.
QFW::$router->cController.
QuickFW_Router::PATH_SEPARATOR.
@@ -98,10 +98,10 @@ class Url
*
* @param string $url внутреннее представление адреса
* @param string|array $get параметры get
- * @param string $ancor якорь
+ * @param string $anchor якорь
* @param string $begin базовый урл от текущего
*/
- private function __construct($url, $get='', $ancor='', $begin='')
+ private function __construct($url, $get='', $anchor='', $begin='')
{
if (is_array($get) && count($get))
$get = http_build_query($get);
@@ -109,7 +109,7 @@ class Url
{
$this->u = $begin.$url->u;
$this->get = $url->get.($get?('&'.$get):'');
- $this->ancor = $ancor ? ltrim($ancor, '#') : $url->ancor;
+ $this->anchor = $anchor ? ltrim($anchor, '#') : $url->anchor;
return;
}
//Заменяем / на QuickFW_Router::PATH_SEPARATOR
@@ -117,7 +117,7 @@ class Url
$url = strtr($url, '/', QuickFW_Router::PATH_SEPARATOR);
$this->u = trim($begin.$url, QuickFW_Router::PATH_SEPARATOR);
$this->get = $get;
- $this->ancor = ltrim($ancor, '#');
+ $this->anchor = ltrim($anchor, '#');
if (self::$config['delDef'])
$this->u = QFW::$router->delDef($this->u);
}
@@ -129,7 +129,7 @@ class Url
private $get;
/** @var string якорь */
- private $ancor;
+ private $anchor;
/**
* урл для вывода, с подстановками
@@ -142,7 +142,7 @@ class Url
self::$config['base'].QFW::$router->backrewrite($this->u).
($this->u!=='' ? self::$config['ext'] : '').
($this->get ? '?' . $this->get : '').
- ($this->ancor ? '#' . $this->ancor : ''));
+ ($this->anchor ? '#' . $this->anchor : ''));
}
-----------------------------------------------------------------------
Summary of changes:
QFW/QuickFW/Url.php | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-11-16 21:52:23
|
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 63eceee1fa48fefcdfa58d2a5fe80ab348653440 (commit)
from fa2424abee5d7ba951f7273e45a41d095c55404b (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 63eceee1fa48fefcdfa58d2a5fe80ab348653440
Author: Ivan Borzenkov <iva...@li...>
Date: Sun Nov 14 19:40:06 2010 +0300
Правки phpdoc в роутере
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index 3124e6f..37425c5 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -305,7 +305,7 @@ class QuickFW_Router
protected $rewrite = false;
/** @var array Массив обратных преобразований Uri */
protected $backrewrite = false;
- /** @var array Массив обратных преобразований Urr */
+ /** @var array Массив обратных преобразований Url */
protected $backrewriteUrl = false;
/**
@@ -321,7 +321,7 @@ class QuickFW_Router
}
/**
- * Функция производит фитальные преобразования полного урла
+ * Функция производит финальные преобразования полного урла
*
* @internal
* @param string $url Url для бекреврайта
@@ -348,7 +348,7 @@ class QuickFW_Router
* Реализация преобразования адресов
*
* @internal
- * @param string $url Uri для реврайта
+ * @param string $uri Uri для реврайта
* @param string $type тип преобразования
* @return string преобразованный Uri
*/
-----------------------------------------------------------------------
Summary of changes:
QFW/QuickFW/Router.php | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-11-12 20:54:13
|
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 fa2424abee5d7ba951f7273e45a41d095c55404b (commit)
via b3d60aa34f6cd8c02a7771d7be82d120f03ae3af (commit)
via 96ab54e3d66e6bf7b403ffbf2daa1ec09f35b170 (commit)
from f3f07bd048e2b68ebfe271c1405742f651c6ead9 (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 fa2424abee5d7ba951f7273e45a41d095c55404b
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Nov 12 14:12:53 2010 +0300
Исправил имя класса в phpdoc
diff --git a/QFW/Init.php b/QFW/Init.php
index be198cb..72dfd73 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -17,7 +17,7 @@ class QFW
/** @var array Подключенные глобальные библиотеки */
static public $libs = array();
- /** @var DbSimple_Generic_Database|false Подключение к базе данных */
+ /** @var DbSimple_Database|false Подключение к базе данных */
static public $db = false;
/** @var mixed|false Данные о пользователе */
commit b3d60aa34f6cd8c02a7771d7be82d120f03ae3af
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Nov 11 11:21:10 2010 +0300
Вынес имя поля в форме в отдельную функцию
diff --git a/lib/Modules/Scaffold/Fields.php b/lib/Modules/Scaffold/Fields.php
index c2ac617..04ad999 100644
--- a/lib/Modules/Scaffold/Fields.php
+++ b/lib/Modules/Scaffold/Fields.php
@@ -159,13 +159,14 @@ class Scaffold_Field extends Scaffold_Field_Info
/**
* Строит стандартный селект
*
+ * @param string $id первичный ключ
* @param array $data массив ключ=>значение
* @param scalar $cur текущий элемент
* @return string блок селекта
*/
- protected function selectBuild($data, $cur, $null=true)
+ protected function selectBuild($id, $data, $cur, $null=true)
{
- $text = '<select name="data['.$this->name.']">';
+ $text = '<select name="'.$this->editName($id).'">';
if ($null)
$text.= '<option value="0"'.
(!isset($data[$cur]) ? ' selected="selected"' : '').
@@ -178,6 +179,17 @@ class Scaffold_Field extends Scaffold_Field_Info
return $text;
}
+ /**
+ * Имя поля для формы
+ *
+ * @param string $id первичный ключ
+ * @return string Имя поля в name
+ */
+ protected function editName($id)
+ {
+ return 'data['.$this->name.']';
+ }
+
}
//Сервисные классы
@@ -228,7 +240,7 @@ class Scaffold_Foreign extends Scaffold_Field
public function editor($id, $value)
{
- return $this->selectBuild($this->lookup, $value);
+ return $this->selectBuild($id, $this->lookup, $value);
}
public function validator($id, $value)
@@ -282,7 +294,7 @@ class Scaffold_Text extends Scaffold_UserInput
public function editor($id, $value)
{
- return '<textarea name="data['.$this->name.']" '.
+ return '<textarea name="'.$this->editName($id).'" '.
'rows="'.$this->rows.'" cols="'.$this->cols.'">'.
QFW::$view->esc($value).'</textarea>';
}
@@ -343,7 +355,7 @@ class Scaffold_Enum extends Scaffold_Field
public function editor($id, $value)
{
- return $this->selectBuild($this->items, $value, false);
+ return $this->selectBuild($id, $this->items, $value, false);
}
}
@@ -360,8 +372,8 @@ class Scaffold_Checkbox extends Scaffold_Field
public function editor($id, $value)
{
- return '<input type="hidden" name="data['.$this->name.']" value="0" />
- <input type="checkbox" name="data['.$this->name.']" value="1" label="'.$this->title.'"
+ return '<input type="hidden" name="'.$this->editName($id).'" value="0" />
+ <input type="checkbox" name="'.$this->editName($id).'" value="1" label="'.$this->title.'"
default="'.($value?'checked':'').'" />';
}
@@ -404,20 +416,20 @@ class Scaffold_File extends Scaffold_Field
public function editor($id, $value)
{
- return '<input type="file" name="file['.$this->name.']" />
- <input type="hidden" name="data['.$this->name.']" value="0" />
- <input type="checkbox" name="data['.$this->name.']" value="1" label="Удалить" /> '.
+ return '<input type="file" name="f'.$this->editName($id).'" />
+ <input type="hidden" name="'.$this->editName($id).'" value="0" />
+ <input type="checkbox" name="'.$this->editName($id).'" value="1" label="Удалить" /> '.
$this->display($id, $value);
}
public function validator($id, $value)
{
//оставляем старый файл
- if ($_FILES['file']['error'][$this->name] == 4)
+ if ($_FILES['fdata']['error'][$this->name] == 4)
return true;
- if ($_FILES['file']['error'][$this->name] != 0)
+ if ($_FILES['fdata']['error'][$this->name] != 0)
return 'Ошибка при загрузке файла '.$this->title;
- return is_uploaded_file($_FILES['file']['tmp_name'][$this->name]);
+ return is_uploaded_file($_FILES['fdata']['tmp_name'][$this->name]);
}
public function proccess($id, $value)
@@ -428,7 +440,7 @@ class Scaffold_File extends Scaffold_Field
if ($value === false && is_file($this->path.'/'.$old))
unlink($this->path.'/'.$old);
//оставляем старое значение
- if ($_FILES['file']['error'][$this->name] == 4 && !$value)
+ if ($_FILES['fdata']['error'][$this->name] == 4 && !$value)
return $old ? $old : '';
//удяляем старый
if (is_file($this->path.'/'.$old))
@@ -437,11 +449,11 @@ class Scaffold_File extends Scaffold_Field
if ($value)
return '';
//генерим новое имя
- $info = pathinfo($_FILES['file']['name'][$this->name]);
+ $info = pathinfo($_FILES['fdata']['name'][$this->name]);
if ($id == -1)
$id = time();
$new_name = $this->name.'_'.$id.'.'.$info['extension'];
- move_uploaded_file($_FILES['file']['tmp_name'][$this->name], $this->path.'/'.$new_name);
+ move_uploaded_file($_FILES['fdata']['tmp_name'][$this->name], $this->path.'/'.$new_name);
return $new_name;
}
commit 96ab54e3d66e6bf7b403ffbf2daa1ec09f35b170
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Nov 9 14:49:09 2010 +0300
Удален старый файл из XMPP
diff --git a/lib/XMPPHP/XMPP_Old.php b/lib/XMPPHP/XMPP_Old.php
deleted file mode 100644
index 6083dad..0000000
--- a/lib/XMPPHP/XMPP_Old.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/**
- * XMPPHP: The PHP XMPP Library
- * Copyright (C) 2008 Nathanael C. Fritz
- * This file is part of SleekXMPP.
- *
- * XMPPHP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * XMPPHP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XMPPHP; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category xmpphp
- * @package XMPPHP
- * @author Nathanael C. Fritz <JID: fr...@ne...>
- * @author Stephan Wentz <JID: st...@ja...>
- * @author Michael Garvin <JID: ga...@ne...>
- * @copyright 2008 Nathanael C. Fritz
- */
-
-/** XMPPHP_XMPP
- *
- * This file is unnecessary unless you need to connect to older, non-XMPP-compliant servers like Dreamhost's.
- * In this case, use instead of XMPPHP_XMPP, otherwise feel free to delete it.
- * The old Jabber protocol wasn't standardized, so use at your own risk.
- *
- */
-require_once dirname(__FILE__) . '/XMPP.php';
-
- class XMPPHP_XMPPOld extends XMPPHP_XMPP {
- /**
- *
- * @var string
- */
- protected $session_id;
-
- public function __construct($host, $port, $user, $password, $resource, $server = null, $printlog = false, $loglevel = null) {
- parent::__construct($host, $port, $user, $password, $resource, $server, $printlog, $loglevel);
- if(!$server) $server = $host;
- $this->stream_start = '<stream:stream to="' . $server . '" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">';
- $this->fulljid = "{$user}@{$server}/{$resource}";
- }
-
- /**
- * Override XMLStream's startXML
- *
- * @param parser $parser
- * @param string $name
- * @param array $attr
- */
- public function startXML($parser, $name, $attr) {
- if($this->xml_depth == 0) {
- $this->session_id = $attr['ID'];
- $this->authenticate();
- }
- parent::startXML($parser, $name, $attr);
- }
-
- /**
- * Send Authenticate Info Request
- *
- */
- public function authenticate() {
- $id = $this->getId();
- $this->addidhandler($id, 'authfieldshandler');
- $this->send("<iq type='get' id='$id'><query xmlns='jabber:iq:auth'><username>{$this->user}</username></query></iq>");
- }
-
- /**
- * Retrieve auth fields and send auth attempt
- *
- * @param XMLObj $xml
- */
- public function authFieldsHandler($xml) {
- $id = $this->getId();
- $this->addidhandler($id, 'oldAuthResultHandler');
- if($xml->sub('query')->hasSub('digest')) {
- $hash = sha1($this->session_id . $this->password);
- print "{$this->session_id} {$this->password}\n";
- $out = "<iq type='set' id='$id'><query xmlns='jabber:iq:auth'><username>{$this->user}</username><digest>{$hash}</digest><resource>{$this->resource}</resource></query></iq>";
- } else {
- $out = "<iq type='set' id='$id'><query xmlns='jabber:iq:auth'><username>{$this->user}</username><password>{$this->password}</password><resource>{$this->resource}</resource></query></iq>";
- }
- $this->send($out);
-
- }
-
- /**
- * Determine authenticated or failure
- *
- * @param XMLObj $xml
- */
- public function oldAuthResultHandler($xml) {
- if($xml->attrs['type'] != 'result') {
- $this->log->log("Auth failed!", XMPPHP_Log::LEVEL_ERROR);
- $this->disconnect();
- throw new XMPPHP_Exception('Auth failed!');
- } else {
- $this->log->log("Session started");
- $this->event('session_start');
- }
- }
- }
-
-
-?>
-----------------------------------------------------------------------
Summary of changes:
QFW/Init.php | 2 +-
lib/Modules/Scaffold/Fields.php | 44 ++++++++++------
lib/XMPPHP/XMPP_Old.php | 114 ---------------------------------------
3 files changed, 29 insertions(+), 131 deletions(-)
delete mode 100644 lib/XMPPHP/XMPP_Old.php
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-11-12 20:21:54
|
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 f3f07bd048e2b68ebfe271c1405742f651c6ead9 (commit)
from 6d8b112233fa8bbfc4c3e243ffe04be1f4b7c436 (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 f3f07bd048e2b68ebfe271c1405742f651c6ead9
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Nov 12 23:21:29 2010 +0300
Русская дата
diff --git a/lib/utils.php b/lib/utils.php
index c6cc6c4..c950a5f 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -277,7 +277,7 @@ function array2xml($array,$attrName='attr',$arrFlar='array')
/**
* Вывод окончаний русских слов с учетом числительных (например сообщение сообщения сообщений)
*
- * @param intereg $n число
+ * @param integer $n число
* @param string $form1 единственное
* @param string $form2 форма для 2-4
* @param string $form5 форма для 5 и более
@@ -294,6 +294,42 @@ function pluralForm($n, $form1, $form2, $form5)
}
/**
+ * Формирование даты по-русски
+ * <br>так как при выстановке локали неправильно склоняет
+ *
+ * @see date
+ * @param string $format формат аналогичен date
+ * @param integer $time время
+ * @return string дата
+ */
+function russian_date($format, $time=false)
+{
+ static $translation = array(
+ "January" => "Января",
+ "February" => "Февраля",
+ "March" => "Марта",
+ "April" => "Апреля",
+ "May" => "Мая",
+ "June" => "Июня",
+ "July" => "Июля",
+ "August" => "Августа",
+ "September" => "Сентября",
+ "October" => "Октября",
+ "November" => "Ноября",
+ "December" => "Декабря",
+ "Monday" => "Понедельник",
+ "Tuesday" => "Вторник",
+ "Wednesday" => "Среда",
+ "Thursday" => "Четверг",
+ "Friday" => "Пятница",
+ "Saturday" => "Суббота",
+ "Sunday" => "Воскресенье",
+ );
+ return strtr(date($format, $time!==false ? $time : time()), $translation);
+}
+
+
+/**
* Вызывает preg_match(_all) и
* <br>возвращается данные в удобном формате
* <br>с использованием флага PREG_SET_ORDER
-----------------------------------------------------------------------
Summary of changes:
lib/utils.php | 38 +++++++++++++++++++++++++++++++++++++-
1 files changed, 37 insertions(+), 1 deletions(-)
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-11-03 18:04:01
|
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 6d8b112233fa8bbfc4c3e243ffe04be1f4b7c436 (commit)
from c379916d66f322799f3ae1bb395ac3a1d0d808b9 (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 6d8b112233fa8bbfc4c3e243ffe04be1f4b7c436
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Nov 3 11:29:32 2010 +0300
Полный бэкреврайт
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index 84e6c78..3124e6f 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -305,6 +305,8 @@ class QuickFW_Router
protected $rewrite = false;
/** @var array Массив обратных преобразований Uri */
protected $backrewrite = false;
+ /** @var array Массив обратных преобразований Urr */
+ protected $backrewriteUrl = false;
/**
* Функция производит преобразования урла для вывода на страницу
@@ -319,6 +321,18 @@ class QuickFW_Router
}
/**
+ * Функция производит фитальные преобразования полного урла
+ *
+ * @internal
+ * @param string $url Url для бекреврайта
+ * @return string преобразованный Url
+ */
+ public function backrewriteUrl($url)
+ {
+ return $this->rewr($url, 'backrewriteUrl');
+ }
+
+ /**
* Функция производит преобразования урла при запросе
*
* @internal
@@ -342,17 +356,19 @@ class QuickFW_Router
{
if (!QFW::$config['redirection']['useRewrite'])
return $uri;
- if ($this->$type == false)
+ if ($this->$type === false)
{
- $rewrite = array();
- $backrewrite = array();
+ $rewrite = $backrewrite = $backrewriteUrl = array();
require_once APPPATH . '/rewrite.php';
$this->rewrite = $rewrite;
$this->backrewrite = $backrewrite;
+ $this->backrewriteUrl = $backrewriteUrl;
}
+ if (empty($this->$type))
+ return $uri;
if (is_array($this->$type))
return preg_replace(array_keys($this->$type), array_values($this->$type), $uri);
- elseif (is_callable($this->$type))
+ if (is_callable($this->$type))
{
$f = $this->$type;
return $f($uri);
diff --git a/QFW/QuickFW/Url.php b/QFW/QuickFW/Url.php
index 63c22d5..bd2ab8c 100644
--- a/QFW/QuickFW/Url.php
+++ b/QFW/QuickFW/Url.php
@@ -138,10 +138,11 @@ class Url
*/
public function __toString()
{
- return self::$config['base'].$this->u.
+ return QFW::$router->backrewriteUrl(
+ self::$config['base'].QFW::$router->backrewrite($this->u).
($this->u!=='' ? self::$config['ext'] : '').
($this->get ? '?' . $this->get : '').
- ($this->ancor ? '#' . $this->ancor : '');
+ ($this->ancor ? '#' . $this->ancor : ''));
}
diff --git a/application/rewrite.php b/application/rewrite.php
index 5a8b367..9c7ea74 100644
--- a/application/rewrite.php
+++ b/application/rewrite.php
@@ -4,5 +4,13 @@ $rewrite = array(
);
$backrewrite = array(
);
+$backrewriteUrl = array(
+);
+
+/* пример */
+/*$backrewriteUrl = function($url)
+{
+ return $url.'?from='.QFW::$router->RequestUri ;
+}*/
?>
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
QFW/QuickFW/Router.php | 24 ++++++++++++++++++++----
QFW/QuickFW/Url.php | 5 +++--
application/rewrite.php | 8 ++++++++
3 files changed, 31 insertions(+), 6 deletions(-)
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-10-10 15:41:24
|
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 c379916d66f322799f3ae1bb395ac3a1d0d808b9 (commit)
from 68b2ec429e005a1e7a58d28e5ba33852be511f19 (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 c379916d66f322799f3ae1bb395ac3a1d0d808b9
Author: Ivan Borzenkov <iva...@li...>
Date: Sun Oct 10 19:39:35 2010 +0400
Добавлена установка пакетов для deb
diff --git a/doc/asciidoc/Makefile b/doc/asciidoc/Makefile
index f676452..ef12398 100644
--- a/doc/asciidoc/Makefile
+++ b/doc/asciidoc/Makefile
@@ -1,8 +1,12 @@
-all: quickfw.pdf quickfw.html
+all: pdf html
FILES = quickfw general quickstart directory mvc blocks templates cache auth autoload helpers features
TEXTS = $(addsuffix .txt, $(FILES) )
+pdf: quickfw.pdf
+
+html: quickfw.html
+
quickfw.pdf: $(TEXTS)
a2x -v quickfw.txt --dblatex-opts='--backend=xetex -o quickfw.pdf' -a lang=ru
@@ -21,4 +25,7 @@ clean:
rm -rf quickfw.html docbook-xsl.css
rm -rf ../../tmp/doc
-.PHONY: all clean
+install:
+ sudo aptitude install asciidoc texlive-xetex source-highlight
+
+.PHONY: all clean install
-----------------------------------------------------------------------
Summary of changes:
doc/asciidoc/Makefile | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-10-10 10:50:08
|
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 68b2ec429e005a1e7a58d28e5ba33852be511f19 (commit)
from 665668c2e8458e82d493f7eecae0102b3573ff82 (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 68b2ec429e005a1e7a58d28e5ba33852be511f19
Author: Ivan Borzenkov <iva...@li...>
Date: Sun Oct 10 14:49:34 2010 +0400
Динамическое меню - хелпер и пример
diff --git a/application/default/controllers/IndexController.php b/application/default/controllers/IndexController.php
index f087d4a..1d672b6 100644
--- a/application/default/controllers/IndexController.php
+++ b/application/default/controllers/IndexController.php
@@ -16,6 +16,11 @@ class IndexController extends QuickFW_Auth
return QFW::$view->fetch('b.html');
}
+ public function dinmenuAction()
+ {
+ return QFW::$view->fetch('dinmenu.html');
+ }
+
public function testBlock()
{
echo 2;
diff --git a/application/default/templates/dinmenu.html b/application/default/templates/dinmenu.html
new file mode 100644
index 0000000..579fa33
--- /dev/null
+++ b/application/default/templates/dinmenu.html
@@ -0,0 +1,117 @@
+<style>
+ul#ttt ul, ul#ttt li {
+ margin:-1px;
+ padding:1px;
+}
+ul#ttt li {display:inline-block; position:relative; border:1px solid red;}
+ul#ttt li a {display:block; width:200px}
+ul#ttt li ul {
+position:absolute;
+top:25px;
+left:10px;
+}
+ul#ttt li ul li {
+display:block; position:relative;
+}
+ul#ttt li ul {display:none}
+ul#ttt li:hover > ul {display:block}
+ul#ttt li ul li ul {
+position:absolute;
+top:0px;
+left:95%;
+}
+
+</style>
+
+<?php echo $this->block('helper.nav.menuTree', array(
+ array(
+ 'title' => 'afgdfgdfggf',
+ 'url' => Url::A(),
+ ),
+ array(
+ 'title' => 'asdffgdfgdfgdf',
+ 'url' => Url::A(),
+ 'childNodes' => array(
+ array(
+ 'title' => 'askj',
+ 'url' => Url::A(),
+ 'childNodes' => array(
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ 'childNodes' => array(
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ ),
+ ),
+ ),
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ 'childNodes' => array(
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ ),
+ ),
+ ),
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ 'childNodes' => array(
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ ),
+ ),
+ ),
+ ),
+ ),
+ array(
+ 'title' => 'asdfgsdf',
+ 'url' => Url::A(),
+ 'childNodes' => array(
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ 'childNodes' => array(
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ ),
+ ),
+ ),
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ 'childNodes' => array(
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ ),
+ ),
+ ),
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ 'childNodes' => array(
+ array(
+ 'title' => 'afhgfgjgf',
+ 'url' => Url::A(),
+ ),
+ ),
+ ),
+ ),
+ ),
+ array(
+ 'title' => 'asdf',
+ 'url' => Url::A(),
+ ),
+ ),
+ ),
+ array(
+ 'title' => 'a',
+ 'url' => Url::A(),
+ ),
+), 'ttt');?>
diff --git a/application/default/templates/index.html b/application/default/templates/index.html
index 5a2aa47..9ab50b9 100644
--- a/application/default/templates/index.html
+++ b/application/default/templates/index.html
@@ -4,4 +4,7 @@
<li><a href="<?php echo Url::M('doc') ?>">Документация</a>
<p><small>Для генерации нужен установленный a2x, xetex и вообще только unix - с виндой трахайтесь как хотите</small></p>
</li>
+ <li><a href="<?php echo Url::C('dinmenu') ?>">Динамическое меню</a>
+ <p><small>Пример вложенного динамического меню с помощью хелпера на CSS3</small></p>
+ </li>
</ul>
diff --git a/application/helper/controllers/NavController.php b/application/helper/controllers/NavController.php
index 7b0c95f..884c070 100644
--- a/application/helper/controllers/NavController.php
+++ b/application/helper/controllers/NavController.php
@@ -28,16 +28,71 @@ class NavController
}
/**
+ * Древоводное меню на вложенными списками
+ *
+ * @param array $items Массив элементов:
+ * <br>каждый элемент - array(
+ * <br> 'title' => Заголовок,
+ * <br> 'url' => адрес(Url|строка|false),
+ * <br> 'childNodes' => вложенный массив аналогичной структуры,
+ * <br>)
+ * <br>остальные элементы игнорируются
+ * @param string $id id для элемента ul - для оформления
+ * @param Url $cur текущий адресс
+ * @return string Сформированное меню
+ */
+ public function menuTreeBlock($items, $id='', $cur=false)
+ {
+ if (count($items) == 0)
+ return '';
+ if ($cur == false)
+ $cur = QFW::$router->RequestUri;
+ $result = '<ul'.($id?' id="'.$id.'"':'').'>';
+ $result.=$this->menuTreeNodes($items, $cur);
+ $result.= '</ul>';
+ return $result;
+ }
+
+ /**
+ * Рекурсивная функция формирования меню
+ *
+ * @param array $items Массив элементов - аналогичен menuTreeBlock
+ * @param Url $cur текущий адресс
+ * @return string Сформированное подменю
+ */
+ private function menuTreeNodes($items, $cur)
+ {
+ $result = '';
+ foreach ($items as $v)
+ {
+ $result.='<li>';
+ if ($v === false)
+ $result.=$v['title'];
+ else
+ {
+ if ($v['url'] instanceof Url)
+ $self = $cur == $v['url']->intern();
+ else
+ $self = $cur == $v['url'];
+ $result.= $self ? '<b>'.$v['title'].'</b>' : '<a href="'.$v['url'].'">'.$v['title'].'</a>';
+ }
+ if (isset($v['childNodes']))
+ $result.='<ul>'.$this->menuTreeNodes($v['childNodes'], $cur).'</ul>';
+ $result.="</li>\n";
+ }
+ return $result;
+ }
+
+ /**
* Вывод меню списком с подсветкой текущего элемента
*
* @param array $items Массив элементов:
* <br>ключ - заголовок, значение Url|false
* @param string $id id для элемента ul - для оформления
* @param Url $cur текущий адресс
- * @param boolean $delDef Применять к ссылкам функцию QFW::$router->delDef
* @return string Сформированное меню
*/
- public function menuNewBlock($items, $id='', $cur=false)
+ public function menuBlock($items, $id='', $cur=false)
{
if (count($items) == 0)
return '';
@@ -73,7 +128,7 @@ class NavController
* @param boolean $delDef Применять к ссылкам функцию QFW::$router->delDef
* @return string Сформированное меню
*/
- public function menuBlock($items, $id='', $cur=false, $delDef = true)
+ public function menuOldBlock($items, $id='', $cur=false, $delDef = true)
{
if (count($items) == 0)
return '';
-----------------------------------------------------------------------
Summary of changes:
.../default/controllers/IndexController.php | 5 +
application/default/templates/dinmenu.html | 117 ++++++++++++++++++++
application/default/templates/index.html | 3 +
application/helper/controllers/NavController.php | 61 ++++++++++-
4 files changed, 183 insertions(+), 3 deletions(-)
create mode 100644 application/default/templates/dinmenu.html
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-10-06 12:59:18
|
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 665668c2e8458e82d493f7eecae0102b3573ff82 (commit)
from 9628ca3cd173626bae58c3dba5d3711750ef68cc (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 665668c2e8458e82d493f7eecae0102b3573ff82
Author: Ivan1986 <iva...@li...>
Date: Wed Oct 6 16:58:37 2010 +0400
Преведены в порядок шаблоны из default
diff --git a/application/default/controllers/IndexController.php b/application/default/controllers/IndexController.php
index 75cc6dd..f087d4a 100644
--- a/application/default/controllers/IndexController.php
+++ b/application/default/controllers/IndexController.php
@@ -6,33 +6,14 @@ class IndexController extends QuickFW_Auth
{
public function __construct()
{
- echo QFW::$router->module.'.'.QFW::$router->controller.'.'.QFW::$router->action."<br>\n";
+ //echo QFW::$router->module.'.'.QFW::$router->controller.'.'.QFW::$router->action."<br>\n";
}
public function indexAction()
{
- /*print_r($_POST);
- require_once LIBPATH.'/HTML/MetaFormAction.php';
- require_once LIBPATH.'/HTML/MetaForm.php';
- require_once LIBPATH.'/HTML/FormPersister.php';
- $SemiParser = new HTML_SemiParser();
- ob_start(array(&$SemiParser, 'process'));
-
- $MetaForm = new HTML_MetaForm('secret_secret');
- $SemiParser->addObject($MetaForm);
-
- $FormPersister = new HTML_FormPersister();
- $SemiParser->addObject($FormPersister);
-
- $metaFormAction = new HTML_MetaFormAction($MetaForm);
- print_r($metaFormAction->process());
- print_r($metaFormAction->getErrors());
- print_r($MetaForm->getFormMeta());*/
-
- //$x = Cache::slot('Test',1);
+ QFW::$view->assign('title', 'Основная страница');
+ return QFW::$view->fetch('index.html');
return QFW::$view->fetch('b.html');
-
- return 'Корневое действие сайта, показывается на /, на /default, на /index и т.п.<br/>';
}
public function testBlock()
diff --git a/application/default/controllers/TestController.php b/application/default/controllers/TestController.php
index 452a5fd..73ea03d 100644
--- a/application/default/controllers/TestController.php
+++ b/application/default/controllers/TestController.php
@@ -6,6 +6,11 @@ class TestController
{
}
+ public function indexAction()
+ {
+ return QFW::$view->render('a.html');
+ }
+
public function indexBlock()
{
return "<pre>".QFW::$view->render('b.html')
@@ -21,8 +26,8 @@ class TestController
public function bBlock()
{
- return QFW::$view->render('b.html')."\nБлок B - ".
- QFW::$router->UriPath.' '.QFW::$router->CurPath.' '.QFW::$router->ParentPath;
+ return QFW::$view->render('b.html')
+ ."\nБлок B - ".QFW::$router->UriPath.' '.QFW::$router->CurPath.' '.QFW::$router->ParentPath;
}
}
diff --git a/application/default/templates/main.html b/application/default/templates/a.html
similarity index 68%
copy from application/default/templates/main.html
copy to application/default/templates/a.html
index 6e88a2d..d42016b 100644
--- a/application/default/templates/main.html
+++ b/application/default/templates/a.html
@@ -1,19 +1,5 @@
-<html>
-<head><title>Main.tpl</title></head>
-<body>
-<?php echo $P->outHead('h','1','2'); ?>
-Это файл Main.tpl<br />
-Это урл <?php echo Url::site('test'); ?>
-
-<br />
-<?php echo $content; ?>
-<br />
-
-<form method="post">
-<input type="text" name="test" default="ttt" label="test: ^" id="wdf" meta:validator="!filled" />
-<input type="submit" name="aaa" />
-</form>
-
+<?php echo $P->outHead('h','1','2'); ?><br>
+Это урл <?php echo Url::site('test'); ?><br>
<?php echo $P->addJS('file.js'); ?>
<?php echo $P->addJS('file.js'); ?>
<?php echo $P->addCSS('file.css'); ?>
@@ -31,5 +17,3 @@ zzzzzzzzzzzzzzzzzzz
<?php echo $this->block('test');?><br />
А вот тут он закончился
<?php echo $P->getHead(false,'h');?>HEAD<?php echo $P->getHead(true,'h');?>
-</body>
-</html>
diff --git a/application/default/templates/index.html b/application/default/templates/index.html
new file mode 100644
index 0000000..5a2aa47
--- /dev/null
+++ b/application/default/templates/index.html
@@ -0,0 +1,7 @@
+<h2>Добро пожаловать</h2>
+
+<ul>
+ <li><a href="<?php echo Url::M('doc') ?>">Документация</a>
+ <p><small>Для генерации нужен установленный a2x, xetex и вообще только unix - с виндой трахайтесь как хотите</small></p>
+ </li>
+</ul>
diff --git a/application/default/templates/index.tpl b/application/default/templates/index.tpl
deleted file mode 100644
index 625e9d5..0000000
--- a/application/default/templates/index.tpl
+++ /dev/null
@@ -1 +0,0 @@
-{include file="block:test.a()"}
\ No newline at end of file
diff --git a/application/default/templates/index2.tpl b/application/default/templates/index2.tpl
deleted file mode 100644
index d063241..0000000
--- a/application/default/templates/index2.tpl
+++ /dev/null
@@ -1 +0,0 @@
-{include file="block:test.b()"}
\ No newline at end of file
diff --git a/application/default/templates/main.html b/application/default/templates/main.html
index 6e88a2d..1e4fc8e 100644
--- a/application/default/templates/main.html
+++ b/application/default/templates/main.html
@@ -1,35 +1,11 @@
+<!DOCTYPE html>
<html>
-<head><title>Main.tpl</title></head>
+<head>
+ <meta charset="utf-8">
+ <title><?php echo isset($title)?'QFW::'.$title:'QFW' ?></title>
+</head>
<body>
-<?php echo $P->outHead('h','1','2'); ?>
-Это файл Main.tpl<br />
-Это урл <?php echo Url::site('test'); ?>
-
-<br />
+<h1>QFW - <small>оно таки у вас завелось</small></h1>
<?php echo $content; ?>
-<br />
-
-<form method="post">
-<input type="text" name="test" default="ttt" label="test: ^" id="wdf" meta:validator="!filled" />
-<input type="submit" name="aaa" />
-</form>
-
-<?php echo $P->addJS('file.js'); ?>
-<?php echo $P->addJS('file.js'); ?>
-<?php echo $P->addCSS('file.css'); ?>
-<?php echo $P->addCSS('file.css'); ?>
-<?php $this->begin()->strtoupper(); ?>
-zzzzzzzzzzzzzzzzzzz
-<?php $this->end(); ?>
-
-<?php echo $P->getHead(false,'h');?>HEAD<?php echo $P->getHead(true,'h');?>
-А сюда у нас подключен блок test/index<br />
-<?php echo $this->block('default.test', 11, 34, 'sdfsf');?><br />
-<?php echo $this->block('default.test.index(1,2,3,4)');?><br />
-<?php echo $this->block('test(\'34\\\'23\',342,\'sfsdf,sfs\'\'df\',"234545\"fdsgdf")');?><br />
-<?php echo $this->block("test(lsfdjhskjhg sjskh ,'jks'dfkjhsdf',jsh,kjs sdhf)");?><br />
-<?php echo $this->block('test');?><br />
-А вот тут он закончился
-<?php echo $P->getHead(false,'h');?>HEAD<?php echo $P->getHead(true,'h');?>
</body>
</html>
diff --git a/application/default/templates/main.tpl b/application/default/templates/main.tpl
deleted file mode 100644
index d6bdf7b..0000000
--- a/application/default/templates/main.tpl
+++ /dev/null
@@ -1,28 +0,0 @@
-<html>
-<head><title>Main.tpl</title></head>
-<body>
-{outHead name='h'}
-Это файл Main.tpl</br>
-Это урл {siteUrl url='test'}
-<br />
-{$content}
-<br />
-{getHead name='h'}HEAD{/getHead}
-{outHead name='h'}
-
-{addJS file='file.js'}
-{addJS file='file.js'}
-{addJS file='file2.js'}
-{addJS file='file1.js'}
-{addCSS file='file.css'}
-{addCSS file='file1.css'}
-
-А сюда у нас подключен блок test</br>
-{include file="block:test"}<br />
-{*include file="block:test/index//a/1/b/2"}<br />
-{include file="block:test(123,55,'1\'1','1,1','$ttt')"}<br />
-{include file="block:test.index()"*}<br />
-А вот тут он закончился
-{getHead name='123'}<script></script>{/getHead}
-</body>
-</html>
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
.../default/controllers/IndexController.php | 25 ++------------
application/default/controllers/TestController.php | 9 ++++-
.../default/templates/{main.html => a.html} | 20 +----------
application/default/templates/index.html | 7 ++++
application/default/templates/index.tpl | 1 -
application/default/templates/index2.tpl | 1 -
application/default/templates/main.html | 36 +++----------------
application/default/templates/main.tpl | 28 ---------------
8 files changed, 25 insertions(+), 102 deletions(-)
copy application/default/templates/{main.html => a.html} (68%)
create mode 100644 application/default/templates/index.html
delete mode 100644 application/default/templates/index.tpl
delete mode 100644 application/default/templates/index2.tpl
delete mode 100644 application/default/templates/main.tpl
hooks/post-receive
--
quickfw
|
|
From: Ivan1986 <iva...@us...> - 2010-10-06 12:04:17
|
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 9628ca3cd173626bae58c3dba5d3711750ef68cc (commit)
via ecde20cbd65f16467960f97182a550cf36c0ea3b (commit)
from 9519e9dc62a721afbe5b902fc62194454542f9fb (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 9628ca3cd173626bae58c3dba5d3711750ef68cc
Author: Ivan1986 <iva...@li...>
Date: Wed Oct 6 16:03:39 2010 +0400
Исправил siteUrl
diff --git a/QFW/QuickFW/Plugs.php b/QFW/QuickFW/Plugs.php
index 6bbd397..430d860 100644
--- a/QFW/QuickFW/Plugs.php
+++ b/QFW/QuickFW/Plugs.php
@@ -17,7 +17,7 @@ class QuickFW_Plugs
public function baseUrl()
{
- trigger_error('Используйте Url::base()', E_USER_DEPRECATED);
+ trigger_error('Используйте Url::base()', E_USER_NOTICE);
return QFW::$config['redirection']['baseUrl'];
}
@@ -31,7 +31,7 @@ class QuickFW_Plugs
*/
public function siteUrl($url, $get='')
{
- trigger_error('Используйте Url::...', E_USER_DEPRECATED);
+ trigger_error('Используйте Url::...', E_USER_NOTICE);
if (QFW::$config['redirection']['delDef'])
$url = QFW::$router->delDef($url);
if (QFW::$config['redirection']['useRewrite'])
diff --git a/application/default/templates/main.html b/application/default/templates/main.html
index 27a8bb1..6e88a2d 100644
--- a/application/default/templates/main.html
+++ b/application/default/templates/main.html
@@ -3,7 +3,7 @@
<body>
<?php echo $P->outHead('h','1','2'); ?>
Это файл Main.tpl<br />
-Это урл <?php echo $P->siteUrl('test'); ?>
+Это урл <?php echo Url::site('test'); ?>
<br />
<?php echo $content; ?>
commit ecde20cbd65f16467960f97182a550cf36c0ea3b
Author: Ivan1986 <iva...@li...>
Date: Wed Oct 6 16:03:26 2010 +0400
Убрал this
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index 5944058..84e6c78 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -154,7 +154,7 @@ class QuickFW_Router
$MCA = $this->loadMCA($data,'Block');
// Если вы все еще сидите на PHP 5.2 то раскомментируйте старый вариант
$MCA['Params'] = empty($patt[4]) ? array() :
- $this->str_getcsv($patt[4],',',"'",'\\'); // parseScobParams($patt[4]);
+ str_getcsv($patt[4],',',"'",'\\'); // $this->parseScobParams($patt[4]);
}
else
{
-----------------------------------------------------------------------
Summary of changes:
QFW/QuickFW/Plugs.php | 4 ++--
QFW/QuickFW/Router.php | 2 +-
application/default/templates/main.html | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
hooks/post-receive
--
quickfw
|