changed: in plugin 'menu'
menu_dir_tab ezc functions can be nested now
(not finished yet)
added: 'meta' winix function
additional meta information for files and directories
(not finished yet)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@775 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
o = adduser.o cat.o chmod.o chown.o ckeditor.o cp.o default.o download.o emacs.o functionbase.o functionparser.o functions.o last.o ln.o login.o logout.o ls.o mkdir.o mount.o mv.o nicedit.o node.o passwd.o priv.o privchanger.o reload.o rm.o run.o sort.o specialdefault.o stat.o subject.o template.o tinymce.o uname.o upload.o uptime.o vim.o who.o
|
||||
o = adduser.o cat.o chmod.o chown.o ckeditor.o cp.o default.o download.o emacs.o functionbase.o functionparser.o functions.o last.o ln.o login.o logout.o ls.o meta.o mkdir.o mount.o mv.o nicedit.o node.o passwd.o priv.o privchanger.o reload.o rm.o run.o sort.o specialdefault.o stat.o subject.o template.o tinymce.o uname.o upload.o uptime.o vim.o who.o
|
||||
|
||||
@@ -185,6 +185,7 @@ void Functions::CreateFunctions()
|
||||
Add(fun_logout);
|
||||
Add(fun_ln);
|
||||
Add(fun_ls);
|
||||
Add(fun_meta);
|
||||
Add(fun_mkdir);
|
||||
Add(fun_mount);
|
||||
Add(fun_mv);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "logout.h"
|
||||
#include "ln.h"
|
||||
#include "ls.h"
|
||||
#include "meta.h"
|
||||
#include "mkdir.h"
|
||||
#include "mount.h"
|
||||
#include "mv.h"
|
||||
@@ -73,6 +74,7 @@ public:
|
||||
Fun::Logout fun_logout;
|
||||
Fun::Ln fun_ln;
|
||||
Fun::Ls fun_ls;
|
||||
Fun::Meta fun_meta;
|
||||
Fun::Mkdir fun_mkdir;
|
||||
Fun::Mount fun_mount;
|
||||
Fun::Mv fun_mv;
|
||||
|
||||
71
functions/meta.cpp
Executable file
71
functions/meta.cpp
Executable file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "meta.h"
|
||||
#include "core/log.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Meta::Meta()
|
||||
{
|
||||
fun.url = L"meta";
|
||||
}
|
||||
|
||||
|
||||
bool Meta::HasAccess()
|
||||
{
|
||||
return system->HasReadAccess(*cur->request->last_item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Meta::AddMetaInfo(Item & item, const std::wstring & meta_str)
|
||||
{
|
||||
space.Clear();
|
||||
conf_parser.SetSpace(space);
|
||||
conf_parser.UTF8(config->utf8);
|
||||
conf_parser.SplitSingle(true);
|
||||
|
||||
if( conf_parser.ParseString(meta_str) == ConfParser::ok )
|
||||
{
|
||||
if( db->EditMetaById(space, item.id) == WINIX_ERR_OK )
|
||||
{
|
||||
item.meta = space;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Meta::MakePost()
|
||||
{
|
||||
if( system->HasWriteAccess(*cur->request->last_item) )
|
||||
{
|
||||
const std::wstring & meta_str = cur->request->PostVar(L"itemmeta");
|
||||
|
||||
if( AddMetaInfo(*cur->request->last_item, meta_str) )
|
||||
system->RedirectToLastItem();
|
||||
else
|
||||
slog << logerror << "Syntax error in line: " << conf_parser.line << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
40
functions/meta.h
Executable file
40
functions/meta.h
Executable file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_winix_functions_meta
|
||||
#define headerfile_winix_functions_meta
|
||||
|
||||
#include "functionbase.h"
|
||||
#include "core/confparser.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Meta : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Meta();
|
||||
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
bool AddMetaInfo(Item & item, const std::wstring & meta_str);
|
||||
|
||||
private:
|
||||
|
||||
ConfParser conf_parser;
|
||||
Space space;
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user