Individual ids for photos

This commit is contained in:
Max Shinn 2010-12-27 16:57:13 -06:00
parent a6bf28f3ee
commit 18f46958f2
4 changed files with 11 additions and 8 deletions

View 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),

View 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();
}
}

View 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'));

View 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;
}
/*