diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-24 00:20:26 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-24 00:20:26 +0000 |
commit | 672eca53371b131484d00cbe6a069092d0b7f6b3 (patch) | |
tree | 507cce76fc6dc9d022455eed9075e039fa779da2 /core/models | |
parent | c76d730a7c07253e7cc3224a78c616ce63989f40 (diff) |
Lots of deltas rolled up into a bigger change. Sorry for the mess.
1) Deleted in-place-editing. We'll be replacing this with a real edit
system that groups settings together and is more coherent.
2) Tweaked the way that dialog boxes work to get the ajax stuff working
again. It's imperfect and does not work properly for uploading images.
This is going to get redone also, but this is a good resting point.
3) Created edit forms for albums and photos. Moved _update and _create out
of Items_Controller and into the individual subclasses.
4) Created access::required which is a shorthand for:
if (!access::can(...)) {
access::forbidden();
}
5) Added validation rules to Items_Model
6) Converted login to use the regular modal dialog approach in the theme.
Diffstat (limited to 'core/models')
-rw-r--r-- | core/models/item.php | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/core/models/item.php b/core/models/item.php index cd2e1670..a21aaf16 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -22,7 +22,11 @@ class Item_Model extends ORM_MPTT { private $relative_path = null; private $view_restrictions = array(); - var $rules = array(); + var $rules = array( + "name" => "required|length[0,255]", + "title" => "required|length[0,255]", + "description" => "length[0,255]" + ); /** * Add a set of restrictions to any following queries to restrict access only to items @@ -173,17 +177,7 @@ class Item_Model extends ORM_MPTT { * @see ORM::__get() */ public function __get($column) { - if (substr($column, -5) == "_edit") { - $real_column = substr($column, 0, strlen($column) - 5); - $editable = $this->type == "album" ? - access::can("edit", $this) : access::can("edit", $this->parent()); - if ($editable) { - return "<span class=\"gInPlaceEdit gEditField-{$this->id}-{$real_column}\">" . - "{$this->$real_column}</span>"; - } else { - return parent::__get($real_column); - } - } else if ($column == "owner") { + if ($column == "owner") { // This relationship depends on an outside module, which may not be present so handle // failures gracefully. try { |