fixed: index templates and 'change' templates were not cleared when 'reload' function was called
so wrong indexes have been assigned git-svn-id: svn://ttmath.org/publicrep/winix/trunk@759 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
4f114ea33c
commit
b984475e49
|
@ -105,6 +105,15 @@
|
||||||
// in p1 you have a pointer to the Item struct
|
// in p1 you have a pointer to the Item struct
|
||||||
#define WINIX_FILE_CHANGED 3016
|
#define WINIX_FILE_CHANGED 3016
|
||||||
|
|
||||||
|
// here you add your own html templates
|
||||||
|
// call TemplatesFunctions::patterns.Add(L"file_name.html")
|
||||||
|
// the method returns an index which you have to remember
|
||||||
|
// and you can get the template with patterns.Get(index, lang_index)
|
||||||
|
// it returns a pointer to Ezc::Pattern (or null pointer if the index is wrong)
|
||||||
|
// the message will be sent too whenever 'reload/templates' winix function is called
|
||||||
|
// templates you should add only in this message
|
||||||
|
// in other cases after 'reload' function the indexes would be wrong
|
||||||
|
#define WINIX_ADD_TEMPLATE 3017
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -100,3 +100,9 @@ Value::iterator v, next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ChangePatterns::Clear()
|
||||||
|
{
|
||||||
|
pat_tab.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,12 @@ public:
|
||||||
void DeleteMarked();
|
void DeleteMarked();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
deleting all patterns
|
||||||
|
*/
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Patterns * patterns;
|
Patterns * patterns;
|
||||||
|
|
|
@ -120,6 +120,25 @@ void dir_can_use_mkdir(Info & i)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static std::wstring dir_parents_str;
|
||||||
|
|
||||||
|
|
||||||
|
void dir_has_parents(Info & i)
|
||||||
|
{
|
||||||
|
dir_parents_str.clear();
|
||||||
|
|
||||||
|
for(size_t a=0 ; a<cur->request->dir_tab.size() ; ++a)
|
||||||
|
{
|
||||||
|
dir_parents_str += cur->request->dir_tab[a]->url;
|
||||||
|
dir_parents_str += '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
i.res = IsSubString(i.par, dir_parents_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static std::vector<Item*> dir_childs_table;
|
static std::vector<Item*> dir_childs_table;
|
||||||
static size_t dir_childs_index;
|
static size_t dir_childs_index;
|
||||||
// cur->request->id is never 0 and we can start dir_childs_reqid from 0
|
// cur->request->id is never 0 and we can start dir_childs_reqid from 0
|
||||||
|
@ -365,29 +384,6 @@ void dir_last_has_html_template(Info & i)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static std::wstring dir_parents_str;
|
|
||||||
|
|
||||||
|
|
||||||
void dir_has_parents(Info & i)
|
|
||||||
{
|
|
||||||
dir_parents_str.clear();
|
|
||||||
|
|
||||||
for(size_t a=0 ; a<cur->request->dir_tab.size() ; ++a)
|
|
||||||
{
|
|
||||||
dir_parents_str += cur->request->dir_tab[a]->url;
|
|
||||||
dir_parents_str += '/';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
i.res = IsSubString(i.par, dir_parents_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace TemplatesFunctions
|
} // namespace TemplatesFunctions
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,3 +76,10 @@ Tab::iterator next;
|
||||||
i = next;
|
i = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void IndexPatterns::Clear()
|
||||||
|
{
|
||||||
|
tab.clear();
|
||||||
|
}
|
||||||
|
|
|
@ -52,6 +52,11 @@ public:
|
||||||
void DeleteMarked();
|
void DeleteMarked();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
deleting all patterns
|
||||||
|
*/
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ void Templates::CreateFunctions()
|
||||||
ezc_functions.Insert("dir_can_remove", dir_can_remove);
|
ezc_functions.Insert("dir_can_remove", dir_can_remove);
|
||||||
ezc_functions.Insert("dir_can_use_emacs", dir_can_use_emacs);
|
ezc_functions.Insert("dir_can_use_emacs", dir_can_use_emacs);
|
||||||
ezc_functions.Insert("dir_can_use_mkdir", dir_can_use_mkdir);
|
ezc_functions.Insert("dir_can_use_mkdir", dir_can_use_mkdir);
|
||||||
ezc_functions.Insert("dir_has_parents",dir_has_parents);
|
ezc_functions.Insert("dir_has_parents", dir_has_parents);
|
||||||
|
|
||||||
ezc_functions.Insert("dir_childs_tab", dir_childs_tab);
|
ezc_functions.Insert("dir_childs_tab", dir_childs_tab);
|
||||||
ezc_functions.Insert("dir_childs_is_parent", dir_childs_is_parent);
|
ezc_functions.Insert("dir_childs_is_parent", dir_childs_is_parent);
|
||||||
|
@ -680,6 +680,8 @@ using namespace TemplatesFunctions;
|
||||||
|
|
||||||
ReadLocale();
|
ReadLocale();
|
||||||
patterns.Clear();
|
patterns.Clear();
|
||||||
|
index_patterns.Clear();
|
||||||
|
change_patterns.Clear();
|
||||||
|
|
||||||
pat_index = patterns.Add(config->templates_index);
|
pat_index = patterns.Add(config->templates_index);
|
||||||
pat_err_404 = patterns.Add(L"err_404.html");
|
pat_err_404 = patterns.Add(L"err_404.html");
|
||||||
|
@ -689,6 +691,8 @@ using namespace TemplatesFunctions;
|
||||||
ReadIndexTemplates();
|
ReadIndexTemplates();
|
||||||
ReadChangeTemplates();
|
ReadChangeTemplates();
|
||||||
|
|
||||||
|
plugin.Call(WINIX_ADD_TEMPLATE);
|
||||||
|
|
||||||
SetHtmlFilter();
|
SetHtmlFilter();
|
||||||
|
|
||||||
log << log3 << "Templates: there are " << patterns.Size() << " patterns"
|
log << log3 << "Templates: there are " << patterns.Size() << " patterns"
|
||||||
|
|
Loading…
Reference in New Issue