]> git.andy128k.dev Git - ipf.git/commitdiff
zzz
authoravl <alex.litovchenko@gmail.com>
Sun, 12 Oct 2008 23:09:27 +0000 (02:09 +0300)
committeravl <alex.litovchenko@gmail.com>
Sun, 12 Oct 2008 23:09:27 +0000 (02:09 +0300)
ipf/admin/views.php
ipf/form/db/html.php [new file with mode: 0644]
ipf/form/field/html.php [new file with mode: 0644]
ipf/form/field/modelchoice.php
ipf/form/model.php
ipf/orm/utils.php
ipf/orm/validator/html.php [new file with mode: 0644]

index 7fab61c90565add380ea6684ee2ec7ae3dc0c544..c096d21a03f18c27ea76c22951b74c2244afa013 100644 (file)
@@ -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 (file)
index 0000000..6c253f6
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+
+class IPF_Form_DB_Html extends IPF_Form_DB{
+    function formField($def, $form_field='IPF_Form_Field_Html'){
+        return parent::formField($def, $form_field);
+    }
+}
diff --git a/ipf/form/field/html.php b/ipf/form/field/html.php
new file mode 100644 (file)
index 0000000..ed985e8
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+
+class IPF_Form_Field_Html extends IPF_Form_Field_Varchar{
+    protected function getWidget(){
+        return 'IPF_Form_Widget_HTMLInput';
+    }
+}
\ No newline at end of file
index 47d832569e59a2ffe1bc841bccb7c14844ffe3d1..6f4d595ad5a2ca920238d407f30655f1984dd91e 100644 (file)
@@ -21,9 +21,6 @@ class IPF_Form_Field_ModelChoice extends IPF_Form_Field_Choice{
         if (in_array($value, $this->empty_values)) {
             return null;
         }
-        //print_r($this->model);
-        //print $value;
-        //$this->model->get($value);
         $o = $this->_model->getTable()->find($value);
         return $o;
     }
index 994d4d235aad08a029b3b55148943c4574b25608..171ccd24f7879e332b8587026915ee42152b19b8 100644 (file)
@@ -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;
index 5b2afc6e2d4b4c6262873320dfaef98b6fd3506b..371f5bea67beb4195a6053a57a629f37864c5ea6 100644 (file)
@@ -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 (file)
index 0000000..bd663d0
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+class IPF_ORM_Validator_Html
+{
+    public function validate($value){
+        return true;
+    }
+}