[Isocial-svn] SF.net SVN: isocial: [213]
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <fsn...@us...> - 2008-05-20 17:38:42
|
Revision: 213 http://isocial.svn.sourceforge.net/isocial/?rev=213&view=rev Author: fsnobody Date: 2008-05-20 10:38:44 -0700 (Tue, 20 May 2008) Log Message: ----------- cover manage Modified Paths: -------------- app/controllers/photoapp/album_controller.php app/models/photoapp_photo.php app/views/photoapp/album/index.tpl timesheet/eerunov.txt Modified: app/controllers/photoapp/album_controller.php =================================================================== --- app/controllers/photoapp/album_controller.php 2008-05-18 18:09:46 UTC (rev 212) +++ app/controllers/photoapp/album_controller.php 2008-05-20 17:38:44 UTC (rev 213) @@ -29,6 +29,10 @@ if ($album->owner == $this->current_user->getId()) { $photo->setAttributes($this->params['photo']); if ($this->Request->isPost() && $photo->save()){ + if ($photo->is_cover == 1) { + $album->img = $photo->img; + $album->save(); + } // set cover if needed $this->redirectTo(array('action' => 'view', 'id' => $album->id)); } } @@ -137,10 +141,17 @@ if (!empty($this->params['album']) ){ // delete $album = $this->PhotoappAlbum->find($this->params['id']); - if ($album->get('owner') == $this->current_user->getId() && $this->Request->isPost()) { - if( $this->PhotoappPhoto->destroyAll("album_id = " . $this->params['id']) && $this->PhotoappAlbum->destroyAll("id = " . $this->params['id'])) { + if ($album && $album->get('owner') == $this->current_user->getId() && $this->Request->isPost()) { + + $photos = $this->PhotoappPhoto->find('all', array('conditions' => array('album_id = ' . $this->params['id']))); + if ($photos) { + $this->PhotoappPhoto->destroyAll("album_id = " . $this->params['id']); // delete photos in album + } + if( $this->PhotoappAlbum->destroyAll("id = " . $this->params['id'])) { $this->redirectTo(array('action' => 'index')); return; + } else { + $this->importErrors( $this->PhotoappAlbum->getErrors() ); } } } else if (!empty($this->params['id']) && $this->PhotoappAlbum->find($this->params['id'])) { Modified: app/models/photoapp_photo.php =================================================================== --- app/models/photoapp_photo.php 2008-05-18 18:09:46 UTC (rev 212) +++ app/models/photoapp_photo.php 2008-05-20 17:38:44 UTC (rev 213) @@ -5,7 +5,14 @@ var $belongs_to = array('album' => array('class_name' => 'PhotoappAlbum', 'primary_key_name' => 'album_id') ); function beforeDestroy() { - + + if ($this->is_cover) { + $this->album->load(); + + $this->album->img = "xxx"; + $this->album->save(); + } + $path = str_replace("@" , "/", $this->img); $file = AK_PUBLIC_DIR . "/images/uploaded/" . $path; `rm -f $file`; @@ -14,4 +21,4 @@ } -?> +?> \ No newline at end of file Modified: app/views/photoapp/album/index.tpl =================================================================== --- app/views/photoapp/album/index.tpl 2008-05-18 18:09:46 UTC (rev 212) +++ app/views/photoapp/album/index.tpl 2008-05-20 17:38:44 UTC (rev 213) @@ -26,7 +26,7 @@ <div class="container"> {loop my_albums} <div class="album"> - <div class="img"><? if ($my_album->get('img')) {?><img src="/preview/index/100x100/<?= $my_album->get('img')?>" /><? + <div class="img"><? if ($my_album->get('img') != '' || $my_album->get('img')) {?><img src="/preview/index/100x100/<?= $my_album->get('img')?>" /><? } else {?>No Cover choosed<? } ?></div> Modified: timesheet/eerunov.txt =================================================================== --- timesheet/eerunov.txt 2008-05-18 18:09:46 UTC (rev 212) +++ timesheet/eerunov.txt 2008-05-20 17:38:44 UTC (rev 213) @@ -13,3 +13,4 @@ 2008-05-13,07:00,09:10,photoapp,RT:2,"photo list + delete" 2008-05-14,09:00,11:00.photoapp,RT:2,"change img storage + design edit photo v1" 2008-05-15,10:00,11:00,photoapp,RT:2,"edit photo" +2008-05-20,18:00,19:00,photoaoo,RT:2,"edit photo - save cover to album,trouble in destroyPhoto when it is cover" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |