partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 738ec4cb2b5b198c192319308ef730f3461e4d2e
parent b1aff5c795073d0bc58d47b088d02ef51be22e0c
Author: Felicitus <felicitus@felicitus.org>
Date:   Fri, 17 Jun 2011 10:16:52 +0800

Added description field for footprints

Diffstat:
Mfrontend/js/Components/Footprint/FootprintEditor.js | 6+++++-
Mfrontend/js/Models/Footprint.js | 5+++--
Msrc/de/RaumZeitLabor/PartKeepr/Footprint/Footprint.php | 24+++++++++++++++++++++++-
Msrc/de/RaumZeitLabor/PartKeepr/Footprint/FootprintManager.php | 2+-
Msrc/de/RaumZeitLabor/PartKeepr/Footprint/FootprintService.php | 1+
5 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/frontend/js/Components/Footprint/FootprintEditor.js b/frontend/js/Components/Footprint/FootprintEditor.js @@ -14,7 +14,11 @@ Ext.define('PartKeepr.FootprintEditor', { this.items = [{ xtype: 'textfield', name: 'name', - fieldLabel: i18n("Footprint") + fieldLabel: i18n("Name") + }, { + xtype: 'textarea', + name: 'description', + fieldLabel: i18n("Description") }, { xtype: 'fieldcontainer', fieldLabel: i18n("Attachments"), diff --git a/frontend/js/Models/Footprint.js b/frontend/js/Models/Footprint.js @@ -1,8 +1,9 @@ PartKeepr.Footprint = Ext.define("Footprint", { extend: "Ext.data.Model", fields: [ - { id: 'id', name: 'id', type: 'int' }, - { name: 'name', type: 'string'} + { id: 'id', name: 'id', type: 'int' }, + { name: 'name', type: 'string' }, + { name: 'description', type: 'string' } ], hasMany: {model: 'FootprintAttachment', name: 'attachments'}, proxy: PartKeepr.getRESTProxy("Footprint"), diff --git a/src/de/RaumZeitLabor/PartKeepr/Footprint/Footprint.php b/src/de/RaumZeitLabor/PartKeepr/Footprint/Footprint.php @@ -17,6 +17,13 @@ class Footprint extends BaseEntity implements Serializable { private $name; /** + * Holds the footprint description + * @Column(type="text",nullable=true) + * @var string + */ + private $description; + + /** * Holds the footprint attachments * @OneToMany(targetEntity="de\RaumZeitLabor\PartKeepr\Footprint\FootprintAttachment",mappedBy="part",cascade={"persist", "remove"}) * @var FootprintAttachment @@ -47,6 +54,21 @@ class Footprint extends BaseEntity implements Serializable { return $this->name; } + /** + * Sets the description of this footprint + * @param string $description The description + */ + public function setDescription ($description) { + $this->description = $description; + } + + /** + * Returns the description of this footprint + * @return string The description + */ + public function getDescription () { + return $this->description; + } /** * Returns the attachments for this footprint @@ -66,6 +88,6 @@ class Footprint extends BaseEntity implements Serializable { $aAttachments[] = $attachment->serialize(); } - return array("id" => $this->getId(), "name" => $this->getName(), "attachments" => $aAttachments); + return array("id" => $this->getId(), "name" => $this->getName(), "description" => $this->getDescription(), "attachments" => $aAttachments); } } \ No newline at end of file diff --git a/src/de/RaumZeitLabor/PartKeepr/Footprint/FootprintManager.php b/src/de/RaumZeitLabor/PartKeepr/Footprint/FootprintManager.php @@ -22,7 +22,7 @@ class FootprintManager extends Singleton { public function getFootprints ($start = 0, $limit = 10, $sort = "name", $dir = "asc", $filter = "") { $qb = PartKeepr::getEM()->createQueryBuilder(); - $qb->select("f.id, f.name")->from("de\RaumZeitLabor\PartKeepr\Footprint\Footprint","f"); + $qb->select("f.id, f.name, f.description")->from("de\RaumZeitLabor\PartKeepr\Footprint\Footprint","f"); if ($filter != "") { $qb = $qb->where("f.name LIKE :filter"); diff --git a/src/de/RaumZeitLabor/PartKeepr/Footprint/FootprintService.php b/src/de/RaumZeitLabor/PartKeepr/Footprint/FootprintService.php @@ -55,6 +55,7 @@ class FootprintService extends Service implements RestfulService { $this->requireParameter("footprint"); $footprint = FootprintManager::getInstance()->getFootprint($this->getParameter("id")); $footprint->setName($this->getParameter("footprint")); + $footprint->setDescription($this->getParameter("description")); PartKeepr::getEM()->flush();