]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Individual ids for photos
authorMax Shinn <trombonechamp@gmail.com>
Mon, 27 Dec 2010 22:57:13 +0000 (16:57 -0600)
committerMax Shinn <trombonechamp@gmail.com>
Mon, 27 Dec 2010 22:57:13 +0000 (16:57 -0600)
plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php
plugins/GNUsocialPhotos/actions/photo.php
plugins/GNUsocialPhotos/actions/photoupload.php
plugins/GNUsocialPhotos/classes/gnusocialphoto.php

index 4ba5aee732cd73b4566fa422f1dbd95575af1cf6..bb00f32000edf56b9d0d31db38d5164dbdcad4b2 100644 (file)
@@ -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),
index 5150cf7071d9726b5b947a18187f99f984c270fb..4f194b163476a83eebf52f40da324796e2f51bba 100644 (file)
@@ -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();
     }
 }
index c9e3d79af708af3da30066bc6545c424642267bb..42bbb633a32f97d41835f80a3ca8863b2da0f4bd 100644 (file)
@@ -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'));
index 70716340d9ceca15c4a157a2b68d88e8c5159e41..a122d44ecbf68e77a56f9a653c4b4d56dff74c89 100644 (file)
@@ -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;
     }
 
     /*