From 7a284910815eee79841cbe0a6f44e36078abc5fa Mon Sep 17 00:00:00 2001 From: avl Date: Sat, 4 Oct 2008 17:51:41 +0300 Subject: [PATCH] CSS Admin & Template fixes --- ipf/admin/media/css/changelists.css | 3 +- ipf/admin/media/css/global.css | 12 +++--- ipf/admin/model.php | 54 +++++++++++++-------------- ipf/admin/templates/admin/add.html | 8 ++-- ipf/admin/templates/admin/base.html | 4 +- ipf/admin/templates/admin/change.html | 8 ++-- ipf/admin/templates/admin/index.html | 2 +- ipf/admin/templates/admin/items.html | 8 +--- ipf/form/model.php | 20 +++++----- ipf/orm/record.php | 30 ++++++++------- 10 files changed, 77 insertions(+), 72 deletions(-) diff --git a/ipf/admin/media/css/changelists.css b/ipf/admin/media/css/changelists.css index 8d57e55..f79a8ce 100644 --- a/ipf/admin/media/css/changelists.css +++ b/ipf/admin/media/css/changelists.css @@ -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; } diff --git a/ipf/admin/media/css/global.css b/ipf/admin/media/css/global.css index b19a226..716509f 100644 --- a/ipf/admin/media/css/global.css +++ b/ipf/admin/media/css/global.css @@ -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; } diff --git a/ipf/admin/model.php b/ipf/admin/model.php index a2f0b14..673299f 100644 --- a/ipf/admin/model.php +++ b/ipf/admin/model.php @@ -1,8 +1,8 @@ -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 = 'True'; - else + else $str = '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('{%page} '); $pager->setSelectedTemplate('{%page} '); $objects = $pager->getPager()->execute(); - + $context = array( - 'page_title'=>$this->modelName.' List', + 'page_title'=>$this->modelName.' List', 'header'=>$this->header, 'classname'=>$this->modelName, 'objects'=>$objects, diff --git a/ipf/admin/templates/admin/add.html b/ipf/admin/templates/admin/add.html index 45611d9..30faec7 100644 --- a/ipf/admin/templates/admin/add.html +++ b/ipf/admin/templates/admin/add.html @@ -6,13 +6,14 @@

{$page_title}

- +
{$form.render_table}
+ {if $inlineInstances} {foreach $inlineInstances as $inline}
{$inline->getLegend()} @@ -34,13 +35,14 @@
{/foreach} + {/if}
-
- + +
{/block} diff --git a/ipf/admin/templates/admin/base.html b/ipf/admin/templates/admin/base.html index a645a89..476d8ec 100644 --- a/ipf/admin/templates/admin/base.html +++ b/ipf/admin/templates/admin/base.html @@ -6,7 +6,7 @@ {$page_title} - IPF Administration - + @@ -21,7 +21,7 @@
- + diff --git a/ipf/admin/templates/admin/change.html b/ipf/admin/templates/admin/change.html index 6d23e28..31c7fac 100644 --- a/ipf/admin/templates/admin/change.html +++ b/ipf/admin/templates/admin/change.html @@ -7,13 +7,14 @@

{$page_title}

- +
{$form.render_table}
+ {if $inlineInstances} {foreach $inlineInstances as $inline}
{$inline->getLegend()} @@ -35,14 +36,15 @@
{/foreach} + {/if}
{if array_search('delete',$perms)!==false}

Delete

{/if}
-
- + +
{/block} diff --git a/ipf/admin/templates/admin/index.html b/ipf/admin/templates/admin/index.html index b100e82..380394e 100644 --- a/ipf/admin/templates/admin/index.html +++ b/ipf/admin/templates/admin/index.html @@ -2,7 +2,7 @@ {block content} -
+

{$page_title}

diff --git a/ipf/admin/templates/admin/items.html b/ipf/admin/templates/admin/items.html index 718b8c1..c9e6cf2 100644 --- a/ipf/admin/templates/admin/items.html +++ b/ipf/admin/templates/admin/items.html @@ -8,7 +8,7 @@

{$page_title}

-
+