]> git.andy128k.dev Git - ipf.git/commitdiff
CSS Admin & Template fixes
authoravl <alex.litovchenko@gmail.com>
Sat, 4 Oct 2008 14:51:41 +0000 (17:51 +0300)
committeravl <alex.litovchenko@gmail.com>
Sat, 4 Oct 2008 14:51:41 +0000 (17:51 +0300)
ipf/admin/media/css/changelists.css
ipf/admin/media/css/global.css
ipf/admin/model.php
ipf/admin/templates/admin/add.html
ipf/admin/templates/admin/base.html
ipf/admin/templates/admin/change.html
ipf/admin/templates/admin/index.html
ipf/admin/templates/admin/items.html
ipf/form/model.php
ipf/orm/record.php

index 8d57e556f2e04141ea98130bd3d4c1a7363c9fc1..f79a8ce3619203923dc8ba93caaa0bf5f8accc68 100644 (file)
@@ -1,4 +1,5 @@
 #changelist { position:relative;}
+#changelist table{ width:100%;}
 .change-list .filtered table { border-right:1px solid #ddd;  }
 .change-list .filtered { min-height:400px; _height:400px; }
 .change-list .filtered { background:white url(../img/changelist-bg.gif) top right repeat-y !important; }
@@ -32,7 +33,7 @@
 #changelist-filter li.selected a { color:#5b80b2 !important; }
 
 /*  DATE DRILLDOWN  */
-.change-list ul.toplinks { display:block; background:white url(../img/nav-bg-reverse.gif) 0 -10px repeat-x; border-top:1px solid white; float:left;  padding:0 !important;  margin:0 !important; width:100%; }
+.change-list ul.toplinks { display:block; background:white url(../img/nav-bg-reverse.gif) 0 -10px repeat-x; border-top:1px solid white; float:left;  padding:0 !important;  margin:0 !important; }
 .change-list ul.toplinks li { float: left; width: 9em; padding:3px 6px; font-weight: bold; list-style-type:none; }
 .change-list ul.toplinks .date-back a { color:#999; }
 .change-list ul.toplinks .date-back a:hover { color:#036; }
index b19a226f7f7333f512826b601ca65b1ce0b15f01..716509fdb8ff22a6537c2497ea74b4955b13fbed 100644 (file)
@@ -1,4 +1,4 @@
-body.dashboard { margin:0; padding:0; font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif; color:#333; background:url('../img/topbg.gif') left top repeat-x; }
+body{ margin:0; padding:0; font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif; color:#333; background:url('../img/topbg.gif') left top repeat-x; }
 body.simple { margin:10; padding:10; font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif; color:#333; }
 
 a:link, a:visited { color: #005681; text-decoration:none; }
@@ -32,7 +32,7 @@ hr { clear:both; color:#eee; background-color:#eee; height:1px; border:none; mar
 
 
 /*  PAGE STRUCTURE  */
-#ipfcontainer { position:relative; width:100%; min-width:760px; }
+#ipfcontainer { position:relative; min-width:760px; }
 #ipfcontent { margin:10px 10px; }
 #ipfheader { width:100%;}
 #ipfcontent-main { float:left; width:100%; }
@@ -43,11 +43,11 @@ hr { clear:both; color:#eee; background-color:#eee; height:1px; border:none; mar
 /*  COLUMN TYPES  */
 .colMS { margin-right:245px !important; }
 .colSM { margin-left:245px !important; }
-.colSM #ipfcontent-related { float:left; margin-right:0; margin-left:-230px; } 
+.colSM #ipfcontent-related { float:left; margin-right:0; margin-left:-230px; }
 .colSM #ipfcontent-main { float:right; }
 .popup .colM { width:95%; }
 .subcol { float:left; width:46%; margin-right:15px; }
-.dashboard #content { width:500px; }
+.index {width:500px;}
 
 /*  HEADER  */
 #ipfheader     { overflow:hidden; height:43px; }
@@ -67,7 +67,9 @@ th { text-align:left; font-size:12px; }
 thead th       { font-weight:bold; color:#666; padding:2px 5px; font-size:11px; background:url(../img/hbg.gif) top left repeat-x; border-left:1px solid #ABB0BE; border-bottom:1px solid #ABB0BE; }
 thead th:first-child { border-left:none !important; }
 .superwide table th, .superwide table td, .superwide table input, .superwide table select { font-size:10px; }
-.module table { border-collapse: collapse; }
+.module { width:100%;}
+.module table { border-collapse: collapse; width:100%;}
+.module table th{ width:90%;}
 thead th.optional { font-weight:normal !important; }
 #ipfhome-page table.module tr:hover { background:#EDF3FE; }
 fieldset { border:1px solid #eee; }
index a2f0b145b76d26be6aad57561d11c1be42e2c8e6..673299f3804f0c3b7dd3c22052ca1cc8f537ed17 100644 (file)
@@ -1,8 +1,8 @@
-<?php 
+<?php
 
 class IPF_Admin_Model{
     static $models = array();
-    
+
     public static function register($classModel, $classAdmin){
         IPF_Admin_Model::$models[$classModel] = new $classAdmin($classModel);
     }
@@ -21,7 +21,7 @@ class IPF_Admin_Model{
         }
         return null;
     }
-    
+
     var $modelName = null;
     var $model = null;
     var $inlineInstances = array();
@@ -30,7 +30,7 @@ class IPF_Admin_Model{
     public function __construct($modelName){
         $this->modelName = $modelName;
     }
-    
+
     public function setUp(){
         $this->model = new $this->modelName;
     }
@@ -38,7 +38,7 @@ class IPF_Admin_Model{
     public function getPerms($request){
         return array('view', 'add', 'change', 'delete');
     }
-    
+
     protected function setInlines($model, &$data){
         $il = $this->inlines();
         if (is_array($il)){
@@ -47,13 +47,13 @@ class IPF_Admin_Model{
             }
         }
     }
-    
+
     protected function saveInlines($obj){
         foreach($this->inlineInstances as $inlineInstance){
             $inlineInstance->save($obj);
         }
     }
-    
+
     protected function _setupEditForm($form){
         $this->_setupForm($form);
     }
@@ -64,11 +64,11 @@ class IPF_Admin_Model{
 
     protected function _setupForm($form){
     }
-    
+
     public function fields(){return null;}
 
     public function inlines(){return null;}
-    
+
     public function isValidInlines(){
         foreach($this->inlineInstances as &$il){
             if ($il->isValid()===false){
@@ -84,7 +84,7 @@ class IPF_Admin_Model{
             $this->names = $this->list_display();
         else
             $this->names = $this->model->getTable()->getColumnNames();
-            
+
         foreach ($this->names as $name){
             $this->header[$name] = new IPF_Template_ContextVars(array(
                 'title'=>IPF_Utils::humanTitle($name),
@@ -98,10 +98,10 @@ class IPF_Admin_Model{
     public function ListItemsQuery(){
         $this->q = IPF_ORM_Query::create()->from($this->modelName)->orderby('id desc');
     }
-    
+
     public function ListRow($o){
         $row = array();
-        
+
         foreach($this->header as &$h){
             $listMethod = 'column_'.$h['name'];
             if (method_exists($this,$listMethod))
@@ -110,9 +110,9 @@ class IPF_Admin_Model{
                 $t = $o->getTable()->getTypeOf($h['name']);
                 $str = $o->$h['name'];
                 if ($t=='boolean'){
-                    if ($str) 
+                    if ($str)
                         $str = '<img src="'.IPF::get('admin_media_url').'img/icon-yes.gif" alt="True" />';
-                    else 
+                    else
                         $str = '<img src="'.IPF::get('admin_media_url').'img/icon-no.gif" alt="False" />';
                 }
             }
@@ -121,7 +121,7 @@ class IPF_Admin_Model{
         $this->linksRow(&$row, $o);
         return $row;
     }
-    
+
     protected function linksRow($row, $o){
         if (method_exists($this,'list_display_links')){
             $links_display = $this->list_display_links();
@@ -140,7 +140,7 @@ class IPF_Admin_Model{
             }
         }
     }
-    
+
     protected function UrlForResult($o){
         return  $o->__get($this->model->getTable()->getIdentifier()).'/';
     }
@@ -164,7 +164,7 @@ class IPF_Admin_Model{
     protected function _getChangeTemplate(){
         return 'admin/change.html';
     }
-    
+
     // Views Function
     public function AddItem($request, $lapp, $lmodel){
         if ($request->method == 'POST'){
@@ -187,7 +187,7 @@ class IPF_Admin_Model{
             $this->setInlines($this->model, &$data);
         }
         $context = array(
-            'page_title'=>'Add '.$this->modelName, 
+            'page_title'=>'Add '.$this->modelName,
             'classname'=>$this->modelName,
             'form'=>$form,
             'inlineInstances'=>$this->inlineInstances,
@@ -197,14 +197,14 @@ class IPF_Admin_Model{
         );
         return IPF_Shortcuts::RenderToResponse($this->_getAddTemplate(), $context, $request);
     }
-    
+
     public function EditItem($request, $lapp, $lmodel, $o){
         if ($request->method == 'POST'){
             $data = $request->POST+$request->FILES;
             $form = $this->_getEditForm($o,&$data,array('user_fields'=>$this->fields()));
             $this->_setupEditForm($form);
             $this->setInlines($o, &$data);
-            
+
             if ( ($form->isValid()) && ($this->isValidInlines()) ) {
                 //print_r($form->cleaned_data);
                 $item = $form->save();
@@ -220,9 +220,9 @@ class IPF_Admin_Model{
             $this->_setupEditForm($form);
             $this->setInlines($o, &$data);
         }
-        
+
         $context = array(
-            'page_title'=>'Edit '.$this->modelName, 
+            'page_title'=>'Edit '.$this->modelName,
             'classname'=>$this->modelName,
             'object'=>$o,
             'form'=>$form,
@@ -242,7 +242,7 @@ class IPF_Admin_Model{
             return new IPF_HTTP_Response_Redirect($url);
         }
         $context = array(
-            'page_title'=>'Delete '.$this->modelName, 
+            'page_title'=>'Delete '.$this->modelName,
             'classname'=>$this->modelName,
             'object'=>$o,
             'lapp'=>$lapp,
@@ -255,9 +255,9 @@ class IPF_Admin_Model{
     public function ListItems($request){
         $this->ListItemsQuery();
         $this->ListItemsHeader();
-        
+
         $currentPage = (int)@$request->GET['page'];
-        
+
         $pager = new IPF_ORM_Pager_LayoutArrows(
             new IPF_ORM_Pager($this->q, $currentPage, $this->perPage),
             new IPF_ORM_Pager_Range_Sliding(array('chunk' => 10)),
@@ -266,9 +266,9 @@ class IPF_Admin_Model{
         $pager->setTemplate('<a href="{%url}">{%page}</a> ');
         $pager->setSelectedTemplate('<span class="this-page">{%page}</span> ');
         $objects = $pager->getPager()->execute();
-        
+
         $context = array(
-            'page_title'=>$this->modelName.' List', 
+            'page_title'=>$this->modelName.' List',
             'header'=>$this->header,
             'classname'=>$this->modelName,
             'objects'=>$objects,
index 45611d9f1a55ed30fe1304382886f190878a92d9..30faec791b0a3bb9654cbcc0d9a014e877eb0c35 100644 (file)
@@ -6,13 +6,14 @@
 
 <div id="ipfcontent">
     <h1>{$page_title}</h1>
-    
+
     <form method="post" {if $form.hasFileField() }enctype="multipart/form-data"{/if}>
     <fieldset>
     <table>
     {$form.render_table}
     </table>
     </fieldset>
+    {if $inlineInstances}
     {foreach $inlineInstances as $inline}
     <fieldset class="inlineTabular" style="border:none; width:auto; float:left; padding:0; margin:10px 10px 10px 0;">
     <legend>{$inline->getLegend()}</legend>
     </table>
     </fieldset>
     {/foreach}
+    {/if}
     <div style="clear:both;"></div>
 
     <div class="submit-row">
         <input type="submit" value="Save" class="default" />
     </div>
-    </form>    
-    
+    </form>
+
 </div>
 
 {/block}
index a645a89cfd19ff535b1c31ef92dda269f917eaed..476d8ecede80f0416c0dd1ed1535f2c3633f4d2e 100644 (file)
@@ -6,7 +6,7 @@
   <title>{$page_title} - IPF Administration</title>
 </head>
 
-<body class="dashboard">
+<body>
 
 <script type="text/javascript" src="{$ADMIN_MEDIA_URL}js/jquery.js"></script>
 
@@ -21,7 +21,7 @@
         <br class="clear" />
     </div>
     <!-- END Header -->
-    
+
     <div class="breadcrumbs">
     {block breadcrumbs} <a href="{url 'IPF_Admin_Views_Index'}">Home</a>{/block}
     </div>
index 6d23e28da9a12f0202428360f3b8177a2db422a7..31c7fac731a5ffaf5dcbd51017b97b844520bd69 100644 (file)
@@ -7,13 +7,14 @@
 
 <div id="ipfcontent">
     <h1>{$page_title}</h1>
-    
+
     <form method="post" {if $form.hasFileField()}enctype="multipart/form-data"{/if}>
     <fieldset>
     <table>
     {$form.render_table}
     </table>
     </fieldset>
+    {if $inlineInstances}
     {foreach $inlineInstances as $inline}
     <fieldset class="inlineTabular" style="border:none; width:auto; float:left; padding:0; margin:10px 10px 10px 0;">
     <legend>{$inline->getLegend()}</legend>
     </table>
     </fieldset>
     {/foreach}
+               {/if}
     <div style="clear:both;"></div>
 
     <div class="submit-row">
         {if array_search('delete',$perms)!==false}<p class="float-left"><a href="{url 'IPF_Admin_Views_DeleteItem', array($lapp, $lmodel, $object.id)}" class="deletelink">Delete</a></p>{/if}
         <input type="submit" value="Save" class="default" />
     </div>
-    </form>    
-    
+    </form>
+
 </div>
 
 {/block}
index b100e82ca40b5b027acefe41d73a40c52b7c6055..380394e6d9b83bc83085bc1522e8d4d552e55159 100644 (file)
@@ -2,7 +2,7 @@
 
 {block content}
 
-<div id="ipfcontent" class="colMS">
+<div id="ipfcontent" class="index">
     <h1>{$page_title}</h1>
     <div id="ipfcontent-main">
         <div class="module">
index 718b8c1b7c816dec8a7e655e9344f652311c26da..c9e6cf26ec387828405c4fe67f96ede3364b6b9c 100644 (file)
@@ -8,7 +8,7 @@
 <div id="ipfcontent">
     <h1>{$page_title}</h1>
     <ul class="object-tools">{if array_search('add',$perms)!==false}<li><a href="add/" class="addlink">Add {$classname}</a></li>{/if}</ul>
-    <div id="changelist" class="module filtered">
+    <div id="changelist">
 
         <!--div id="changelist-filter">
         <h2>Filter</h2>
 
     </div>
 
-
-
-
-
-
-
 </div>
 
 
index 295a69e5ba38b73a674d4167d3ead563bfdc1c09..40d516448c9f2691ebfa88bf0453b772e1c71416 100644 (file)
@@ -11,21 +11,21 @@ class IPF_Form_Model extends IPF_Form
             $this->model = $extra['model'];
         else
             throw new IPF_Exception_Form(__('Unknown model for form'));
-        
+
         if (isset($extra['user_fields']))
             $this->user_fields = $extra['user_fields'];
-        
+
         $user_fields = $this->fields();
         $db_columns = $this->model->getTable()->getColumns();
         $db_relations = $this->model->getTable()->getRelations();
-        
+
         if ($user_fields===null){
 
-            if (isset($extra['exclude'])) 
+            if (isset($extra['exclude']))
                 $exclude = $extra['exclude'];
             else
                 $exclude = array();
-                
+
             foreach($db_columns as $name=>$col){
                 if (array_search($name,$exclude)!==false)
                     continue;
@@ -51,14 +51,14 @@ class IPF_Form_Model extends IPF_Form
             }
         }
     }
-    
+
     function addDBField($name,$col){
         if ($name==$this->model->getTable()->getIdentifier())
             return;
-            
+
         $defaults = array('blank' => true, 'verbose' => $name, 'help_text' => '', 'editable' => true);
         $type = $col['type'];
-        
+
         if (isset($col['notblank']))
             if ($col['notblank'])
                 $defaults['blank'] = false;
@@ -76,12 +76,12 @@ class IPF_Form_Model extends IPF_Form
             $type = 'image';
 
         $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 ff443387959fb8f98ee7ccb4c8b71b4e65489a2f..deea2c9af436a7840a5b3b5bb33e3b7e18fec481 100644 (file)
@@ -156,7 +156,7 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
         if ( ! $this->_errorStack) {
             $this->_errorStack = new IPF_ORM_Validator_ErrorStack(get_class($this));
         }
-        
+
         return $this->_errorStack;
     }
 
@@ -343,7 +343,7 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
         if ($state == null) {
             return $this->_state;
         }
-        
+
         $err = false;
         if (is_integer($state)) {
             if ($state >= 1 && $state <= 6) {
@@ -482,7 +482,7 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
         if (isset($this->_values[$fieldName])) {
             return $this->_values[$fieldName];
         }
-        
+
         try {
             if ( ! isset($this->_references[$fieldName]) && $load) {
                 $rel = $this->_table->getRelation($fieldName);
@@ -520,7 +520,7 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
             } else {
                 $old = $this->_data[$fieldName];
             }
-            
+
             if ($this->_isValueModified($type, $old, $value)) {
                 if ($value === null) {
                     $value = self::$_null;
@@ -564,11 +564,11 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
     public function coreSetRelated($name, $value)
     {
         $rel = $this->_table->getRelation($name);
-        
+
         if ($value === null) {
             $value = self::$_null;
         }
-        
+
         // one-to-many or one-to-one relation
         if ($rel instanceof IPF_ORM_Relation_ForeignKey || $rel instanceof IPF_ORM_Relation_LocalKey) {
             if ( ! $rel->isOneToOne()) {
@@ -779,10 +779,10 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
         if ($this->_state == self::STATE_LOCKED) {
             return false;
         }
-        
+
         $stateBeforeLock = $this->_state;
         $this->_state = self::STATE_LOCKED;
-        
+
         $a = array();
 
         foreach ($this as $column => $value) {
@@ -797,7 +797,7 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
             $i      = $this->_table->getIdentifier();
             $a[$i]  = $this->getIncremented();
         }
-        
+
         if ($deep) {
             foreach ($this->_references as $key => $relation) {
                 if (! $relation instanceof IPF_ORM_Null) {
@@ -814,7 +814,7 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
                 $a[$key] = $value;
             }
         }
-        
+
         $this->_state = $stateBeforeLock;
 
         return $a;
@@ -1217,7 +1217,7 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
     {
         $this->getNode()->delete();
     }
-    
+
     public function free($deep = false)
     {
         if ($this->_state != self::STATE_LOCKED) {
@@ -1249,7 +1249,7 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
     {
         return (string) $this->_oid;
     }
-    
+
     public function ModelAdmin(){
         $cn = get_class($this);
         if (isset(IPF_Admin_Model::$models[$cn]))
@@ -1261,7 +1261,11 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
     {
         foreach ($cleaned_values as $key=>$val) {
             $validators = $this->getTable()->getFieldValidators($key);
-            if (array_key_exists('image',$validators) || array_key_exists('file',$validators)){
+            if (
+                array_key_exists('image',$validators) ||
+                array_key_exists('file',$validators) ||
+                array_key_exists('email',$validators)
+            ){
                 if (($val!==null) && ($val==''))
                     continue;
             }