we can create links (hard links, symbolic links) now

added winix functions: ln

winix function 'default' can be used without redirecting now

added new tickets types: TypeProgress, TypeString, TypeMultistring, TypeImages, TypeFiles
now tickets are combined with files
added winix functions: showtickets

fixed mountpoints:
when the default root mount was created its parameter table was empty
and it caused accessing to a non-existing objects

fixed logger:
modifiers (log1, log2, log3) were incorrectly treated
added modifier: log4 (debug info)

now we are moving threads to a new plugin 'thread'
created directory: plugins/thread
(not finished yet)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@704 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-01-05 21:24:11 +00:00
parent bb83aed20d
commit 8154c403d8
113 changed files with 5840 additions and 2972 deletions

View File

@@ -20,103 +20,33 @@ Default::Default()
}
long Default::PostFunDefaultParsePath()
bool Default::HasAccess()
{
Item * pdir, * pdir2;
long defaultid = -1;
const std::wstring & path = request->PostVar(L"defaultitem");
if( !path.empty() )
{
std::wstring dir, file;
Dirs::SplitPath(path, dir, file);
pdir = system->dirs.GetDir(dir);
if( !pdir )
throw Error(WINIX_ERR_INCORRECT_DIR);
if( file.empty() )
{
defaultid = pdir->id;
}
else
{
// checking whether the file is a directory too (the method SplitPath does not check it)
pdir2 = system->dirs.GetDir(file, pdir->id);
if( !pdir2 )
{
defaultid = db->GetFileId(pdir->id, file);
if( defaultid == -1 )
throw Error(WINIX_ERR_NO_ITEM);
}
else
{
// file is a directory
defaultid = pdir2->id;
}
}
}
return defaultid;
return !request->is_item && system->HasWriteAccess(*request->dir_tab.back());
}
void Default::MakePost()
{
if( !system->HasWriteAccess(*request->dir_tab.back()) )
{
request->status = WINIX_ERR_PERMISSION_DENIED;
return;
}
Item & dir = *request->dir_tab.back();
try
{
long defaultid = PostFunDefaultParsePath();
dir.link_to = request->PostVar(L"linkto");
dir.link_redirect = request->IsPostVar(L"makeredirect") ? 1 : 0;
TrimWhite(dir.link_to);
if( defaultid != request->dir_tab.back()->id )
{
request->status = db->EditDefaultItem(request->dir_tab.back()->id, defaultid);
if( request->status == WINIX_ERR_OK )
request->dir_tab.back()->default_item = defaultid;
}
else
{
log << "Default: skipping the same directory" << logend;
}
}
catch(const Error & e)
{
request->status = e;
}
// !! dodac sprawdzenie czy link_to jest pusty teraz
request->status = db->EditLinkItem(dir.id, dir.link_to, dir.link_redirect);
if( request->status == WINIX_ERR_OK )
system->RedirectTo(*request->dir_tab.back());
else
log << log1 << "Content: PostFunDefaultItem: Error: " << request->status << logend;
}
void Default::MakeGet()
{
if( !system->HasWriteAccess(*request->dir_tab.back()) )
{
request->status = WINIX_ERR_PERMISSION_DENIED;
return;
log << log2 << "Default: changed link_to: " << dir.link_to << ", for dir_id: " << dir.id << logend;
system->RedirectToLastDir();
}
}
} // namespace