From: Marc L. <ma...@ma...> - 2010-04-17 14:08:09
|
Interesting This is perhaps what it should have been since the beginning. So archives will take on alternate IDs? Thanks! M ;-) On Sat, Apr 17, 2010 at 8:56 AM, <sy...@us...> wrote: > Revision: 26663 > http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=26663&view=rev > Author: sylvieg > Date: 2010-04-17 12:56:11 +0000 (Sat, 17 Apr 2010) > > Log Message: > ----------- > [NEW]fgal: option to keep the same fileId when replacing a file in an archive fgal - useful for link from a wiki > > Modified Paths: > -------------- > trunk/lib/filegals/filegallib.php > trunk/lib/prefs/fgal.php > trunk/lib/setup/prefs.php > trunk/modules/mod-func-calendar_new.php > trunk/templates/tiki-admin-include-fgal.tpl > > Modified: trunk/lib/filegals/filegallib.php > =================================================================== > --- trunk/lib/filegals/filegallib.php 2010-04-16 22:27:08 UTC (rev 26662) > +++ trunk/lib/filegals/filegallib.php 2010-04-17 12:56:11 UTC (rev 26663) > @@ -58,7 +58,7 @@ > return true; > } > > - function insert_file($galleryId, $name, $description, $filename, $data, $size, $type, $creator, $path, $comment='', $author, $created='', $lockedby=NULL, $deleteAfter=NULL) { > + function insert_file($galleryId, $name, $description, $filename, $data, $size, $type, $creator, $path, $comment='', $author, $created='', $lockedby=NULL, $deleteAfter=NULL, $id=0) { > global $prefs, $tikilib, $smarty, $user; > > $name = strip_tags($name); > @@ -103,13 +103,19 @@ > } > } > if ( empty($created) ) $created = $this->now; > - $query = "insert into `tiki_files`(`galleryId`,`name`,`description`,`filename`,`filesize`,`filetype`,`data`,`user`,`created`,`hits`,`path`,`hash`,`search_data`,`lastModif`,`lastModifUser`, `comment`, `author`, `lockedby`, `deleteAfter`) > + if (empty($id)) { > + $query = "insert into `tiki_files`(`galleryId`,`name`,`description`,`filename`,`filesize`,`filetype`,`data`,`user`,`created`,`hits`,`path`,`hash`,`search_data`,`lastModif`,`lastModifUser`, `comment`, `author`, `lockedby`, `deleteAfter`) > values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; > - $result = $this->query($query,array($galleryId,trim($name),$description,$filename,$size,$type,$data,$creator,$created,0,$path,$checksum,$search_data,(int)$this->now,$user,$comment, $author, $lockedby,$deleteAfter)); > + $result = $this->query($query,array($galleryId,trim($name),$description,$filename,$size,$type,$data,$creator,$created,0,$path,$checksum,$search_data,(int)$this->now,$user,$comment, $author, $lockedby,$deleteAfter)); > + $query = "select max(`fileId`) from `tiki_files` where `created`=?"; > + $fileId = $this->getOne($query,array((int) $created)); > + } else { > + $query = "update `tiki_files` set `galleryId`=?, `name`=?, `description`=?,`filename`=?,`filesize`=?,`filetype`=?,`data`=?,`user`=?,`created`=?,`hits`=?,`path`=?,`hash`=?,`search_data`=?,`lastModif`=?,`lastModifUser`=?, `comment`=?, `author`=?, `lockedby`=?, `deleteAfter`=? where `fileId`=?"; > + $result = $this->query($query, array($galleryId,trim($name),$description,$filename,$size,$type,$data,$creator,$created,0,$path,$checksum,$search_data,(int)$this->now,$user,$comment, $author, $lockedby,$deleteAfter, $id)); > + $fileId = $id; > + } > $query = "update `tiki_file_galleries` set `lastModif`=? where `galleryId`=?"; > $result = $this->query($query,array((int) $this->now,$galleryId)); > - $query = "select max(`fileId`) from `tiki_files` where `created`=?"; > - $fileId = $this->getOne($query,array((int) $created)); > > if ($prefs['feature_score'] == 'y') { > $this->score_event($user, 'fgallery_new_file'); > @@ -596,9 +602,14 @@ > } > > } else { //archive the old file : change archive_id, take away from indexation and categorization > - > + if ($prefs['fgal_keep_fileId'] == 'y') { > + $query = "select * from `tiki_files` where `fileId`=?"; > + $res = $this->fetchAll($query, array($id)); > + $query = "insert into `tiki_files`(`galleryId`,`name`,`description`,`filename`,`filesize`,`filetype`,`data`,`user`,`created`,`hits`,`path`,`hash`,`search_data`,`lastModif`,`lastModifUser`, `comment`, `author`, `lockedby`, `deleteAfter`, `archiveId`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; > + $this->query($query, array($res[0]['galleryId'],$res[0]['name'],$res[0]['description'],$res[0]['filename'],$res[0]['filesize'],$res[0]['filetype'],$res[0]['data'],$res[0]['user'],$res[0]['created'],$res[0]['hits'],$res[0]['path'],$res[0]['hash'],'',$res[0]['lastModif'],$res[0]['lastModifUser'],$res[0]['comment'],$creator,NULL,$res[0]['deleteAfter'], $id)); > + } > // Insert and index (for search) the new file > - $idNew = $this->insert_file($gal_info['galleryId'], $name, $description, $filename, $data, $size, $type, $creator, $path, $comment, $author, $created, $lockedby); > + $idNew = $this->insert_file($gal_info['galleryId'], $name, $description, $filename, $data, $size, $type, $creator, $path, $comment, $author, $created, $lockedby, NULL, $prefs['fgal_keep_fileId']=='y'?$id:0); > > if ($gal_info['archives'] > 0) { > $archives = $this->get_archives($id, 0, -1, 'created_asc'); > @@ -614,8 +625,10 @@ > $this->query($query, $bindvars); > } > } > - $query = "update `tiki_files` set `archiveId`=?, `search_data`=?,`user`=?, `lockedby`=? where `archiveId`=? or `fileId`=?"; > - $this->query($query,array($idNew, '',$creator,NULL, $id, $id)); > + if ($prefs['fgal_keep_fileId'] != 'y') { > + $query = "update `tiki_files` set `archiveId`=?, `search_data`=?,`user`=?, `lockedby`=? where `archiveId`=? or `fileId`=?"; > + $this->query($query,array($idNew, '',$creator,NULL, $id, $id)); > + } > > if ($prefs['feature_categories'] == 'y') { > global $categlib; require_once('lib/categories/categlib.php'); > > Modified: trunk/lib/prefs/fgal.php > =================================================================== > --- trunk/lib/prefs/fgal.php 2010-04-16 22:27:08 UTC (rev 26662) > +++ trunk/lib/prefs/fgal.php 2010-04-17 12:56:11 UTC (rev 26663) > @@ -116,5 +116,10 @@ > 'description' => tra('These emails will receive a copy of each deleted file. Emails are separated with comma'), > 'type' => 'text', > ), > + 'fgal_keep_fileId' => array( > + 'name' => tra('Keep always the same fileId when replacing a file with archive'), > + 'description' => tra('Keep always the same fileId when replacing a file with archive'), > + 'type' => 'flag', > + ), > ); > } > > Modified: trunk/lib/setup/prefs.php > =================================================================== > --- trunk/lib/setup/prefs.php 2010-04-16 22:27:08 UTC (rev 26662) > +++ trunk/lib/setup/prefs.php 2010-04-17 12:56:11 UTC (rev 26663) > @@ -576,8 +576,8 @@ > 'fgal_list_lastDownload_admin' => 'n', > 'fgal_list_lockedby_admin' => 'n', > 'fgal_list_backlinks_admin' => 'y', > + 'fgal_keep_fileId' => 'n', > > - > // imagegals > 'feature_galleries' => 'n', > 'feature_gal_batch' => 'n', > > Modified: trunk/modules/mod-func-calendar_new.php > =================================================================== > --- trunk/modules/mod-func-calendar_new.php 2010-04-16 22:27:08 UTC (rev 26662) > +++ trunk/modules/mod-func-calendar_new.php 2010-04-17 12:56:11 UTC (rev 26663) > @@ -123,7 +123,7 @@ > > if ( !empty($calIds) ) { > $tc_infos = $calendarlib->getCalendar($calIds, $viewstart, $viewend, 'day'); > - if ($_REQUEST['viewlist'] == 'list') { > + if ($_REQUEST['viewlistmodule'] == 'list') { > foreach ($tc_infos['listevents'] as $i=>$e) { > $tc_infos['listevents'][$i]['head'] = ''; > $tc_infos['listevents'][$i]['group_description'] =''; > > Modified: trunk/templates/tiki-admin-include-fgal.tpl > =================================================================== > --- trunk/templates/tiki-admin-include-fgal.tpl 2010-04-16 22:27:08 UTC (rev 26662) > +++ trunk/templates/tiki-admin-include-fgal.tpl 2010-04-17 12:56:11 UTC (rev 26663) > @@ -77,6 +77,7 @@ > {/remarksbox} > {preference name='fgal_delete_after_email'} > </div> > + {preference name='fgal_keep_fileId'} > </fieldset> > > <fieldset> > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Tikiwiki-cvs mailing list > Tik...@li... > https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs > -- Marc Laporte http://MarcLaporte.com http://TikiWiki.org/MarcLaporte http://AvanTech.net http://OurWiki.net |