changed: winix 'upload' function is a file manager now

we're using an jquery upload plugin
added:   Item struct has new rows: hash, hash_type, file_size, sort_index
added:   css mount parameter
         you can specify css files there, and javascript wysiwyg editors
         (ckeditor, tinymce) can make use of it
changed: post parsers can parse post variables with the same name
         (a postfix is added in such a case)
added:   common_dir parameter to the config
         this is a path to common directory (directory with common static files)
         it is needed to the 'css' mount parameter
         


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@746 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-06-24 20:53:21 +00:00
parent 1d6ff73aad
commit 06f42dd9cb
58 changed files with 2462 additions and 1685 deletions

View File

@@ -965,3 +965,60 @@ return ok;
/*
adding a new file to winix
file_path - a name of a static file (from common directory)
url - url of a file which will be inserted (in /var directory)
current limitation:
warning: the url is not prepared by PrepareUrl() (PrepareUrl is from functions)
*/
bool System::AddCommonFileToVar(const wchar_t * file_path, const wchar_t * url, bool overwrite_existing)
{
if( config->common_dir.empty() )
{
log << log1 << "System: can't open a file from common directory, common_dir not set in the config" << logend;
return false;
}
file_name = config->common_dir;
file_name += '/';
file_name += file_path;
if( !GetUTF8File(file_name, file_content) )
{
log << log1 << "System: can't open a file: " << file_name << logend;
return false;
}
Item * var = dirs.CreateVarDir();
if( !var )
{
log << log1 << "System: can't create /var directory" << logend;
return false;
}
if( db->GetItem(var->id, url, file_content_item) == WINIX_ERR_OK )
{
if( overwrite_existing )
db->DelItem(file_content_item);
else
return true;
}
file_content_item.Clear();
file_content_item.parent_id = var->id;
file_content_item.user_id = -1;
file_content_item.group_id = -1;
file_content_item.privileges = 0755;
file_content_item.subject = url;
file_content_item.url = url;
file_content_item.type = Item::file;
file_content_item.content_type = Item::ct_raw;
file_content_item.content = file_content;
return AddFile(file_content_item, false) == WINIX_ERR_OK;
}