added: mount params can have arguments (in parentheses) added: mount params: withheader, withinfo, restrictcreatethread, only_root_can_remove, can_use_emacs_on(level), can_use_mkdir_on(level), added: table Item has 'subject' column now removed: column 'subject' from table Content git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@505 e52654a7-88a9-db11-a3e9-0013d4bc506e
50 lines
1.0 KiB
C++
Executable File
50 lines
1.0 KiB
C++
Executable File
/*
|
|
* This file is a part of CMSLU -- Content Management System like Unix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2008-2009, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include "content.h"
|
|
#include "../core/request.h"
|
|
#include "../core/db.h"
|
|
#include "../core/data.h"
|
|
#include "../core/mount.h"
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
bool Content::FunThreadSort(const Thread & t1, const Thread & t2)
|
|
{
|
|
Item * pdir1 = data.dirs.GetDir(t1.dir_id);
|
|
Item * pdir2 = data.dirs.GetDir(t2.dir_id);
|
|
|
|
if( !pdir1 || !pdir2 )
|
|
return false;
|
|
|
|
time_t time1 = mktime(&pdir1->date_creation);
|
|
time_t time2 = mktime(&pdir2->date_creation);
|
|
|
|
return time1 > time2;
|
|
}
|
|
|
|
|
|
void Content::FunThread()
|
|
{
|
|
bool asc = true;
|
|
|
|
if( data.mounts.CurrentMountIsParam(Mount::desc) )
|
|
asc = false;
|
|
|
|
db.GetItems(request.item_table, request.dir_table.back()->id, Item::file, true, true, asc);
|
|
db.GetThreads(request.dir_table.back()->id, request.thread_tab);
|
|
|
|
std::sort(request.thread_tab.begin(), request.thread_tab.end(), FunThreadSort);
|
|
}
|
|
|
|
|
|
|
|
|