From: Max Shinn Date: Mon, 27 Dec 2010 22:57:13 +0000 (-0600) Subject: Individual ids for photos X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=18f46958f2de8e791f2f3ffcceca1d6febdeaaed;p=quix0rs-gnu-social.git Individual ids for photos --- diff --git a/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php b/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php index 4ba5aee732..bb00f32000 100644 --- a/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php +++ b/plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php @@ -68,7 +68,8 @@ class GNUsocialPhotosPlugin extends Plugin { $schema = Schema::get(); $schema->ensureTable('GNUsocialPhoto', - array(new ColumnDef('notice_id', 'int(11)', null, false, 'PRI'), + array(new ColumnDef('id', 'int(11)', null, false, 'PRI', null, null, true), + new ColumnDef('notice_id', 'int(11)', null, false), new ColumnDef('album_id', 'int(11)', null, false), new ColumnDef('uri', 'varchar(512)', null, false), new ColumnDef('thumb_uri', 'varchar(512)', null, false), diff --git a/plugins/GNUsocialPhotos/actions/photo.php b/plugins/GNUsocialPhotos/actions/photo.php index 5150cf7071..4f194b1634 100644 --- a/plugins/GNUsocialPhotos/actions/photo.php +++ b/plugins/GNUsocialPhotos/actions/photo.php @@ -45,8 +45,8 @@ class PhotoAction extends Action $args = $this->returnToArgs(); $this->photoid = $args[1]['photoid']; - $this->photo = GNUsocialPhoto::staticGet('notice_id', $this->photoid); - $this->notice = Notice::staticGet('id', $this->photoid); + $this->photo = GNUsocialPhoto::staticGet('id', $this->photoid); + $this->notice = Notice::staticGet('id', $this->photo->notice_id); $this->user = Profile::staticGet('id', $this->notice->profile_id); @@ -92,7 +92,7 @@ class PhotoAction extends Action $this->elementEnd('a'); $this->element('p', array(), $this->photo->photo_description); //This is a hack to hide the top-level comment - $this->element('style', array(), "#notice-{$this->photoid} div { display: none } #notice-{$this->photoid} ol li div { display: inline }"); + $this->element('style', array(), "#notice-{$this->photo->notice_id} div { display: none } #notice-{$this->photoid} ol li div { display: inline }"); $this->conversation->show(); } } diff --git a/plugins/GNUsocialPhotos/actions/photoupload.php b/plugins/GNUsocialPhotos/actions/photoupload.php index c9e3d79af7..42bbb633a3 100644 --- a/plugins/GNUsocialPhotos/actions/photoupload.php +++ b/plugins/GNUsocialPhotos/actions/photoupload.php @@ -73,10 +73,10 @@ class PhotouploadAction extends Action $this->elementEnd('li'); //$this->element('br'); $this->elementStart('li'); - $this->input('phototitle', "Title", $this->trimmed('phototitle'), "The title of the photo. (Optional)"); + $this->input('phototitle', "Title", null, "The title of the photo. (Optional)"); $this->elementEnd('li'); $this->elementStart('li'); - $this->textarea('photo_description', "Description", $this->trimmed('photo_description'), "A description of the photo. (Optional)"); + $this->textarea('photo_description', "Description", null, "A description of the photo. (Optional)"); $this->elementEnd('li'); $this->elementEnd('ul'); $this->submit('upload', _('Upload')); diff --git a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php index 70716340d9..a122d44ecb 100644 --- a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php +++ b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php @@ -35,6 +35,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; class GNUsocialPhoto extends Memcached_DataObject { public $__table = 'GNUsocialPhoto'; + public $id; // int(11) public $notice_id; // int(11) public $album_id; // int(11) public $uri; // varchar(512) @@ -70,7 +71,8 @@ class GNUsocialPhoto extends Memcached_DataObject */ function table() { - return array('notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, + return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, + 'notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, 'album_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, 'uri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, 'thumb_uri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, @@ -118,7 +120,7 @@ class GNUsocialPhoto extends Memcached_DataObject function getPageLink() { - return '/photo/' . $this->notice_id; + return '/photo/' . $this->id; } /*