From 63fe869d864e4bde30ce0d814cbafaf46d92c259 Mon Sep 17 00:00:00 2001 From: avl Date: Mon, 13 Oct 2008 02:09:27 +0300 Subject: [PATCH] zzz --- ipf/admin/views.php | 18 +++++++++--------- ipf/form/db/html.php | 7 +++++++ ipf/form/field/html.php | 7 +++++++ ipf/form/field/modelchoice.php | 3 --- ipf/form/model.php | 6 +++--- ipf/orm/utils.php | 1 + ipf/orm/validator/html.php | 8 ++++++++ 7 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 ipf/form/db/html.php create mode 100644 ipf/form/field/html.php create mode 100644 ipf/orm/validator/html.php diff --git a/ipf/admin/views.php b/ipf/admin/views.php index 7fab61c..c096d21 100644 --- a/ipf/admin/views.php +++ b/ipf/admin/views.php @@ -6,7 +6,7 @@ function checkAdminAuth($request){ $ok = false; elseif ( (!$request->user->is_staff) && (!$request->user->is_superuser) ) $ok = false; - + if ($ok) return true; else @@ -16,7 +16,7 @@ function checkAdminAuth($request){ function IPF_Admin_Views_Index($request, $match){ $ca = checkAdminAuth($request); if ($ca!==true) return $ca; - + $apps = array(); $app_list = new IPF_Template_ContextVars(); foreach (IPF_Project::getInstance()->appList() as $app){ @@ -24,13 +24,13 @@ function IPF_Admin_Views_Index($request, $match){ $models = new IPF_Template_ContextVars(); $models_found = false; foreach($app->modelList() as $m){ - + $ma = IPF_Admin_Model::getModelAdmin($m); if ($ma!==null){ $perms = $ma->getPerms($request); if (array_search('view', $perms)!==false){ $models[] = new IPF_Template_ContextVars(array( - 'name'=>$m, + 'name'=>$m, 'path'=>strtolower($m), 'perms'=>$perms, )); @@ -47,16 +47,16 @@ function IPF_Admin_Views_Index($request, $match){ } } } - + $admin_log = IPF_ORM_Query::create() ->select("*") ->from('AdminLog') ->orderby('created_at desc') ->limit(10) ->execute(); - + $context = array( - 'page_title' => __('Administration'), + 'page_title' => __('Administration'), 'app_list' => $app_list, 'admin_log' => $admin_log, ); @@ -169,7 +169,7 @@ function IPF_Admin_Views_ChangePassword($request, $match){ else $form = new IPF_Auth_Forms_ChangePassword(); $context = array( - 'page_title'=>'Change Password: '.$user->username, + 'page_title'=>'Change Password: '.$user->username, 'classname'=>'User', 'object'=>$user, 'form'=>$form, @@ -189,7 +189,7 @@ function IPF_Admin_Views_Login($request, $match){ $success_url = $request->REQUEST['next']; if (trim($success_url)=='') $success_url = IPF_HTTP_URL_urlForView('IPF_Admin_Views_Index'); - + if ($request->method == 'POST') { $form = new IPF_Auth_Forms_Login($request->POST); if ($form->isValid()){ diff --git a/ipf/form/db/html.php b/ipf/form/db/html.php new file mode 100644 index 0000000..6c253f6 --- /dev/null +++ b/ipf/form/db/html.php @@ -0,0 +1,7 @@ +empty_values)) { return null; } - //print_r($this->model); - //print $value; - //$this->model->get($value); $o = $this->_model->getTable()->find($value); return $o; } diff --git a/ipf/form/model.php b/ipf/form/model.php index 994d4d2..171ccd2 100644 --- a/ipf/form/model.php +++ b/ipf/form/model.php @@ -75,12 +75,12 @@ class IPF_Form_Model extends IPF_Form if (isset($col['image'])) $type = 'image'; + if (isset($col['html'])) + $type = 'html'; + $cn = 'IPF_Form_DB_'.$type; $db_field = new $cn('', $name); - //echo $name; - //print_r($defaults); - if (null !== ($form_field=$db_field->formField($defaults))) { $this->fields[$name] = $form_field; diff --git a/ipf/orm/utils.php b/ipf/orm/utils.php index 5b2afc6..371f5be 100644 --- a/ipf/orm/utils.php +++ b/ipf/orm/utils.php @@ -56,6 +56,7 @@ class IPF_ORM_Utils { 'usstate', 'file', 'image', + 'html', ); } diff --git a/ipf/orm/validator/html.php b/ipf/orm/validator/html.php new file mode 100644 index 0000000..bd663d0 --- /dev/null +++ b/ipf/orm/validator/html.php @@ -0,0 +1,8 @@ +