1325895fa240f9b05cebc866c87b8c74a589aa19

Author: Jeff Loiselle

Date: 2008-12-22 20:01:45 -0500

now saving area config in config class now showing user@area in top right

diff --git a/app_model.php b/app_model.php index ec59b4d..a79a35a 100755 --- a/app_model.php +++ b/app_model.php @@ -40,6 +40,7 @@ class AppModel extends Model { function beforeSave() { $this->__injectUser(); + // $this->__injectArea(); return true; } @@ -58,5 +59,20 @@ class AppModel extends Model { $this->data[$this->alias]['user_id'] = $user_id; } } + + /** + * make sure record is tagged with area_id + */ + // function __injectArea() { + // if (!$area = Configure::read('Area')) { + // return false; + // } + // if (!isset($this->_schema['area_id'])) { + // throw new Exception($this->alias . ' is not being tagged with area_id'); + // } + // if (empty($this->data[$this->alias]['area_id'])) { + // $this->data[$this->alias]['area_id'] = $area['id']; + // } + // } } ?> \ No newline at end of file diff --git a/models/url.php b/models/url.php index 8dd2e16..f53774c 100644 --- a/models/url.php +++ b/models/url.php @@ -15,10 +15,14 @@ class Url extends AppModel { if (empty($this->data[$this->alias]['url'])) { return 'Must be valid web address'; } - if ($this->data[$this->alias]['url'] == 'localhost') { + if (strstr($this->data[$this->alias]['url'], 'localhost')) { return true; } - return Validation::url($this->data[$this->alias]['url']); + if (Validation::url($this->data[$this->alias]['url'])) { + return true; + } else { + return 'Must be valid web address'; + } } } diff --git a/views/elements/user.ctp b/views/elements/user.ctp index 7354fca..7e03081 100644 --- a/views/elements/user.ctp +++ b/views/elements/user.ctp @@ -1,4 +1,4 @@ <div id="user"> <?php if(Configure::read('User.avatar_url')) print $html->image(Configure::read('User.avatar_url'), array('width' => 30, 'align' => 'absmiddle', 'style' => 'border:1px solid black')) ?> - <?php if($session->read('Auth.User.username')) { print 'Hello, '.$session->read('Auth.User.username').'.' ?> [<?php print $html->link('Sign Out', '/users/logout') ?>, <?php print $html->link('Account', '/admin/users/edit/'.$session->read('Auth.User.id')) ?>, <?php print $html->link('Admin', '/admin') ?>]<?php } ?> + <?php if($session->read('Auth.User.username')) { print 'Hello, '.$session->read('Auth.User.username').'@'.Configure::read('Area.name').'.' ?> [<?php print $html->link('Sign Out', '/users/logout') ?>, <?php print $html->link('Account', '/admin/users/edit/'.$session->read('Auth.User.id')) ?>, <?php print $html->link('Admin', '/admin') ?>]<?php } ?> </div> \ No newline at end of file