From 34dcbd8b4314970b6044ac958c3c148acabd1616 Mon Sep 17 00:00:00 2001 From: abijah Date: Sat, 29 Aug 2009 21:29:23 +0000 Subject: [PATCH] Made all grids the same width, which is much more pleasing than when they were variable. This width is a bit too large for 800x600, but has been tested at 1024x768 with no problem. It works great on the Acer netbook. git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@826 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/views/elements/contacts.ctp | 4 ++-- site/views/elements/jqGrid.ctp | 12 ++++++++++-- site/views/elements/leases.ctp | 8 ++++---- site/views/elements/statement_entries.ctp | 2 +- site/views/elements/tenders.ctp | 2 +- site/views/elements/units.ctp | 2 +- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/site/views/elements/contacts.ctp b/site/views/elements/contacts.ctp index b35b45b..c4b85de 100644 --- a/site/views/elements/contacts.ctp +++ b/site/views/elements/contacts.ctp @@ -4,8 +4,8 @@ $cols = array(); $cols['Relationship'] = array('index' => 'ContactsCustomer.type', 'formatter' => 'enum'); $cols['Name'] = array('index' => 'Contact.display_name', 'formatter' => 'longname'); -$cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'longname'); -$cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'longname'); +$cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'name'); +$cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'name'); $cols['Company'] = array('index' => 'Contact.company_name', 'formatter' => 'longname'); $cols['Comment'] = array('index' => 'Contact.comment', 'formatter' => 'comment'); diff --git a/site/views/elements/jqGrid.ctp b/site/views/elements/jqGrid.ctp index 88ab9e1..4f64155 100644 --- a/site/views/elements/jqGrid.ctp +++ b/site/views/elements/jqGrid.ctp @@ -148,8 +148,14 @@ foreach ($jqGridColumns AS $header => &$col) { // No special formatting for name unset($col['formatter']); } - elseif ($col['formatter'] === 'enum') { + elseif (preg_match("/^(long|short)?enum$/", + $col['formatter'], $matches)) { $default['width'] = 60; + if (!empty($matches[1]) && $matches[1] === 'long') + $default['width'] *= 1.5; + if (!empty($matches[1]) && $matches[1] === 'short') + $default['width'] *= 0.7; + //$default['align'] = 'right'; // No special formatting for enum @@ -166,7 +172,8 @@ foreach ($jqGridColumns AS $header => &$col) { // Just a rough approximation to ensure columns // are wide enough to fully display their header. - $min_width = strlen($header) * 10; + $min_width = strlen($header) * 7; + $min_width = 0; // REVISIT : 20090829; if/while jqGrid is fixed width if ((!isset($default['width']) || $default['width'] < $min_width) && !$default['force']) $default['width'] = $min_width; } @@ -239,6 +246,7 @@ $jqGrid_setup = array_merge 'colNames' => array_keys($jqGridColumns), 'colModel' => array('--special' => $jqGridColumns), 'height' => $height, + 'width' => 700, 'rowNum' => $limit, 'rowList' => $limitOptions, 'sortname' => $sortname, diff --git a/site/views/elements/leases.ctp b/site/views/elements/leases.ctp index af17b33..916924a 100644 --- a/site/views/elements/leases.ctp +++ b/site/views/elements/leases.ctp @@ -3,16 +3,16 @@ // Define the table columns $cols = array(); $cols['Lease'] = array('index' => 'Lease.number', 'formatter' => 'id'); -$cols['Unit'] = array('index' => 'Unit.name', 'width' => '50', 'align' => 'center'); +$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'shortname', 'align' => 'center'); $cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname'); -$cols['Rent'] = array('index' => 'Lease.rent', 'formatter' => 'currency', 'hiddenz' => true); -$cols['Deposit'] = array('index' => 'Lease.deposit', 'formatter' => 'currency', 'hiddenz' => true); +$cols['Rent'] = array('index' => 'Lease.rent', 'formatter' => 'currency'); +$cols['Deposit'] = array('index' => 'Lease.deposit', 'formatter' => 'currency'); $cols['Signed'] = array('index' => 'Lease.lease_date', 'formatter' => 'date'); $cols['Move-In'] = array('index' => 'Lease.movein_date', 'formatter' => 'date'); $cols['Move-Out'] = array('index' => 'Lease.moveout_date', 'formatter' => 'date'); $cols['Closed'] = array('index' => 'Lease.close_date', 'formatter' => 'date'); $cols['Paid-Thru'] = array('index' => 'Lease.paid_through_date', 'formatter' => 'date'); -$cols['Status'] = array('index' => 'status', 'formatter' => 'enum', 'width' => 100); +$cols['Status'] = array('index' => 'status', 'formatter' => 'longenum'); $cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency'); $cols['Comment'] = array('index' => 'Lease.comment', 'formatter' => 'comment'); diff --git a/site/views/elements/statement_entries.ctp b/site/views/elements/statement_entries.ctp index f97b2aa..7556ec6 100644 --- a/site/views/elements/statement_entries.ctp +++ b/site/views/elements/statement_entries.ctp @@ -15,7 +15,7 @@ $cols['Unit'] = array('index' => 'Unit.name', 'formatter' => $cols['Comment'] = array('index' => 'StatementEntry.comment', 'formatter' => 'comment', 'width'=>150); -$cols['Type'] = array('index' => 'StatementEntry.type', 'formatter' => 'enum', 'width'=>120); +$cols['Type'] = array('index' => 'StatementEntry.type', 'formatter' => 'longenum'); $cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name'); $cols['Debit'] = array('index' => 'charge', 'formatter' => 'currency'); $cols['Credit'] = array('index' => 'disbursement', 'formatter' => 'currency'); diff --git a/site/views/elements/tenders.ctp b/site/views/elements/tenders.ctp index 312551b..c14535c 100644 --- a/site/views/elements/tenders.ctp +++ b/site/views/elements/tenders.ctp @@ -17,4 +17,4 @@ $grid ->defaultFields(array('Date', 'Name', 'Amount')) ->searchFields(array('Name', 'Type')) ->render($this, isset($config) ? $config : null, - array_diff(array_keys($cols), array('Sub-Total'))); + array_diff(array_keys($cols), array('Comment', 'Sub-Total'))); diff --git a/site/views/elements/units.ctp b/site/views/elements/units.ctp index b67aa17..5e14775 100644 --- a/site/views/elements/units.ctp +++ b/site/views/elements/units.ctp @@ -9,7 +9,7 @@ $cols['Size'] = array('index' => 'UnitSize.name', 'formatter' => 'shortname' $cols['Area'] = array('index' => 'sqft', 'formatter' => 'number'); $cols['Rent'] = array('index' => 'Unit.rent', 'formatter' => 'currency'); $cols['Deposit'] = array('index' => 'Unit.deposit', 'formatter' => 'currency'); -$cols['Status'] = array('index' => 'Unit.status', 'formatter' => 'name'); // We have enough real estate +$cols['Status'] = array('index' => 'Unit.status', 'formatter' => 'enum'); $cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency'); $cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment');