part II of rewriting

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@635 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-08-12 19:10:12 +00:00
parent c3fac2e83f
commit 9a199cd834
38 changed files with 1159 additions and 1167 deletions

View File

@@ -11,8 +11,7 @@
#include "misc.h"
#include "error.h"
#include "notify.h"
#include "functions/functions.h"
#include "templates/templates.h"
@@ -34,16 +33,6 @@ void System::SetDb(Db * pdb)
}
void System::SetFunctions(Functions * pfunctions)
{
functions = pfunctions;
}
void System::SetTemplates(Templates * ptemplates)
{
templates = ptemplates;
}
@@ -153,27 +142,6 @@ void System::RedirectToLastItem()
}
void System::PrepareUrl(Item & item)
{
TrimWhite(item.url);
if( item.url.empty() )
item.url = item.subject; // if the subject is empty then the url will be corrected by CorrectUrlOnlyAllowedChar()
CorrectUrlOnlyAllowedChar(item.url);
if( functions->Find(item.url) )
{
// the name provided by an user is the same as a name of a function
// we add one underscore character at the beginning
// names of functions should not begin with an underscore '_'
// and we can simply add one '_' at the beginning
// and the name will be unique
item.url.insert(item.url.begin(), '_');
}
}
bool System::CanChangeUser(const Item & item, long new_user_id)
{
@@ -553,9 +521,7 @@ Error System::EditFile(Item & item, bool with_url)
if( status == WINIX_ERR_OK )
{
TemplatesFunctions::pattern_cacher.UpdatePattern(item);
log << log2 << "System: modified an item" << logend;
request->notify_code |= WINIX_NOTIFY_ITEM_EDIT;
}
@@ -565,27 +531,3 @@ return status;
Error System::CheckSpecialFile(const Item & item)
{
static std::string fstab = "fstab";
Item * etc = dirs.GetEtcDir();
if( !etc )
return WINIX_NOTHING_TO_DO;
if( item.parent_id != etc->id )
return WINIX_NOTHING_TO_DO;
if( item.url == fstab )
{
log << log3 << "System: reloading mount points" << logend;
Error status = mounts.ReadMounts(item.content);
templates->ReadNewIndexTemplates();
return status;
}
return WINIX_NOTHING_TO_DO;
}