changed: cmslu building

Makefile from cmslu/ builds only: confparser.a content.a core.a templates.a
         the proper *.fcgi file is created from an application
changed: all cmslu functions have english names (ls, emacs, etc)
fixed:   function: login/logout are placed where there are permissions


git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@474 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2009-01-14 20:11:12 +00:00
parent 8a0ea59c77
commit 327f18525c
13 changed files with 100 additions and 43 deletions

View File

@ -1,44 +1,44 @@
# Makefile for GNU make
ifndef CC
CC = g++ CC = g++
CFLAGS = -Wall -pedantic -g -I/usr/local/include -L/usr/local/lib
name = cmslu.fcgi
export CC export CC
endif
ifndef CFLAGS
CFLAGS = -Wall -pedantic -g -I/usr/local/include -L/usr/local/lib
export CFLAGS export CFLAGS
endif
all: $(name)
$(name): core content confparser templates ezc all: core content confparser templates
g++ -o $(name) $(CFLAGS) core/core.a content/content.a confparser/confparser.a templates/templates.a ../ezc/src/ezc.a -lfcgi -lpq cp core/core.a ./
cp content/content.a ./
cp confparser/confparser.a ./
cp templates/templates.a ./
core: FORCE core: FORCE
@cd core ; $(MAKE) -e @cd core ; $(MAKE) -e
templates: FORCE content: FORCE
@cd templates ; $(MAKE) -e @cd content ; $(MAKE) -e
confparser: FORCE confparser: FORCE
@cd confparser ; $(MAKE) -e @cd confparser ; $(MAKE) -e
content: FORCE templates: FORCE
@cd content ; $(MAKE) -e @cd templates ; $(MAKE) -e
ezc: FORCE
@cd ../ezc/src ; $(MAKE) -e
clean: clean:
@cd core ; $(MAKE) -e clean @cd core ; $(MAKE) -e clean
@cd templates ; $(MAKE) -e clean
@cd confparser ; $(MAKE) -e clean
@cd content ; $(MAKE) -e clean @cd content ; $(MAKE) -e clean
@cd ../ezc/src ; $(MAKE) -e clean @cd confparser ; $(MAKE) -e clean
rm -f $(name) @cd templates ; $(MAKE) -e clean
rm -f *.a
FORCE: FORCE:
@ -46,8 +46,7 @@ FORCE:
depend: depend:
cd core ; $(MAKE) -e depend @cd core ; $(MAKE) -e depend
cd templates ; $(MAKE) -e depend @cd content ; $(MAKE) -e depend
cd confparser ; $(MAKE) -e depend @cd confparser ; $(MAKE) -e depend
cd content ; $(MAKE) -e depend @cd templates ; $(MAKE) -e depend
cd ../ezc/src ; $(MAKE) -e depend

19
app/templates.h Executable file
View File

@ -0,0 +1,19 @@
#ifndef headerfileapptemplates
#define headerfileapptemplates
#include "../../ezc/src/ezc.h"
#include "../core/log.h"
#include "../core/data.h"
namespace AppTemplateFunctions
{
void CreateAppFunctions(Ezc::Functions & functions);
}
#endif

View File

@ -17,7 +17,7 @@ confparser.a: $(o)
depend: depend:
makedepend -Y. -f- *.cpp > Makefile.dep makedepend $(DEPMACROS) -Y. -f- *.cpp > Makefile.dep
clean: clean:

View File

@ -14,7 +14,7 @@ content.a: $(o)
depend: depend:
makedepend -Y. -f- *.cpp > Makefile.dep makedepend $(DEPMACROS) -Y. -f- *.cpp > Makefile.dep
clean: clean:

View File

@ -56,11 +56,7 @@ void Content::FunRm()
} }
else else
{ {
if( request.IsParam("potwierdz") ) if( !request.IsParam("confirm") )
{
//request.result = Request::del_item_confirm;
}
else
request.result = Request::err404; request.result = Request::err404;
} }
} }

View File

@ -15,7 +15,7 @@ core.a: $(o)
depend: depend:
makedepend -Y. -f- *.cpp > Makefile.dep makedepend $(DEPMACROS) -Y. -f- *.cpp > Makefile.dep
clean: clean:

View File

@ -36,11 +36,11 @@ void Functions::ReadFunctions()
// in the future we will read these functions from the database // in the future we will read these functions from the database
f.code = Function::ls; f.code = Function::ls;
f.item.url = "list"; f.item.url = "ls";
table.insert( std::make_pair(f.item.url, f) ); table.insert( std::make_pair(f.item.url, f) );
f.code = Function::cat; f.code = Function::cat;
f.item.url = "wyswietl"; f.item.url = "cat";
table.insert( std::make_pair(f.item.url, f) ); table.insert( std::make_pair(f.item.url, f) );
f.code = Function::node; f.code = Function::node;
@ -48,7 +48,7 @@ void Functions::ReadFunctions()
table.insert( std::make_pair(f.item.url, f) ); table.insert( std::make_pair(f.item.url, f) );
f.code = Function::emacs; f.code = Function::emacs;
f.item.url = "edytuj"; f.item.url = "emacs";
table.insert( std::make_pair(f.item.url, f) ); table.insert( std::make_pair(f.item.url, f) );
f.code = Function::mkdir; f.code = Function::mkdir;
@ -60,15 +60,15 @@ void Functions::ReadFunctions()
table.insert( std::make_pair(f.item.url, f) ); table.insert( std::make_pair(f.item.url, f) );
f.code = Function::privileges; f.code = Function::privileges;
f.item.url = "uprawnienia"; f.item.url = "priv";
table.insert( std::make_pair(f.item.url, f) ); table.insert( std::make_pair(f.item.url, f) );
f.code = Function::rm; f.code = Function::rm;
f.item.url = "usun"; f.item.url = "rm";
table.insert( std::make_pair(f.item.url, f) ); table.insert( std::make_pair(f.item.url, f) );
f.code = Function::logout; f.code = Function::logout;
f.item.url = "wyloguj"; f.item.url = "logout";
table.insert( std::make_pair(f.item.url, f) ); table.insert( std::make_pair(f.item.url, f) );
f.code = Function::login; f.code = Function::login;

View File

@ -41,7 +41,7 @@ void signal_term(int)
void signal_hup(int) void signal_hup(int)
{ {
log << log3 << "SIGHUP received" << logend; log << log1 << "SIGHUP received" << logend;
data.signal_hup = true; data.signal_hup = true;
config.ReadConfig(false); /* errors not to stdout */ config.ReadConfig(false); /* errors not to stdout */
} }

View File

@ -11,9 +11,8 @@ templates.a: $(o)
.cpp.o: .cpp.o:
$(CC) -c $(CFLAGS) $< $(CC) -c $(CFLAGS) $<
depend: depend:
makedepend -Y. -f- *.cpp > Makefile.dep makedepend $(DEPMACROS) -Y. -f- *.cpp > Makefile.dep
clean: clean:

View File

@ -26,6 +26,24 @@ void dir(Info & i)
void dir_can_read_exec(Info & i)
{
bool result = true;
for(size_t a=0 ; a<request.dir_table.size() ; ++a)
{
if( !request.HasReadExecAccess(*request.dir_table[a]) )
{
result = false;
break;
}
}
i.result = result;
}
static std::vector<Item*> dir_childs_table; static std::vector<Item*> dir_childs_table;
@ -152,6 +170,9 @@ void dir_last_default_item_url(Info & i)
} // namespace TemplatesFunctions } // namespace TemplatesFunctions

View File

@ -240,6 +240,13 @@ void item_tab_link(Info & i)
} }
void item_can_read(Info & i)
{
if( request.HasReadAccess(request.item) )
i.result = true;
}
} // namespace TemplatesFunctions } // namespace TemplatesFunctions

View File

@ -188,6 +188,8 @@ void Templates::CreateFunctions()
functions.Insert("item_dir", item_dir); functions.Insert("item_dir", item_dir);
functions.Insert("item_url", item_url); functions.Insert("item_url", item_url);
functions.Insert("item_link", item_link); functions.Insert("item_link", item_link);
functions.Insert("item_can_read", item_can_read);
functions.Insert("item_old_id", item_old_id); functions.Insert("item_old_id", item_old_id);
functions.Insert("item_old_subject", item_old_subject); functions.Insert("item_old_subject", item_old_subject);
@ -215,6 +217,7 @@ void Templates::CreateFunctions()
dir dir
*/ */
functions.Insert("dir", dir); functions.Insert("dir", dir);
functions.Insert("dir_can_read_exec", dir_can_read_exec);
functions.Insert("dir_childs_tab", dir_childs_tab); functions.Insert("dir_childs_tab", dir_childs_tab);
functions.Insert("dir_childs_tab_url", dir_childs_tab_url); functions.Insert("dir_childs_tab_url", dir_childs_tab_url);
@ -270,6 +273,13 @@ void Templates::CreateFunctions()
// !! tymczasowa // !! tymczasowa
functions.Insert("is_group_tv", is_group_tv); functions.Insert("is_group_tv", is_group_tv);
#ifdef APPTEMPLATES
AppTemplateFunctions::CreateAppFunctions(functions);
#endif
} }
@ -311,7 +321,7 @@ void Templates::Read()
pat_fun_default_item.ParseFile("fun_default_item.html"); pat_fun_default_item.ParseFile("fun_default_item.html");
pat_fun_privileges.Directory(data.templates); pat_fun_privileges.Directory(data.templates);
pat_fun_privileges.ParseFile("fun_privileges.html"); pat_fun_privileges.ParseFile("fun_priv.html");
pat_err_others.Directory(data.templates); pat_err_others.Directory(data.templates);
pat_err_others.ParseFile("err_others.html"); pat_err_others.ParseFile("err_others.html");

View File

@ -24,6 +24,10 @@
#include "../core/groups.h" #include "../core/groups.h"
#include "../core/log.h" #include "../core/log.h"
#ifdef APPTEMPLATES
#include "../app/templates.h"
#endif
@ -64,6 +68,7 @@ namespace TemplatesFunctions
void item_dir(Info & i); // the same as full_dir() void item_dir(Info & i); // the same as full_dir()
void item_url(Info & i); void item_url(Info & i);
void item_link(Info & i); void item_link(Info & i);
void item_can_read(Info & i);
// !! wprowadzic item_old_is ? // !! wprowadzic item_old_is ?
void item_old_id(Info & i); void item_old_id(Info & i);
@ -92,6 +97,7 @@ namespace TemplatesFunctions
dir dir
*/ */
void dir(Info & i); void dir(Info & i);
void dir_can_read_exec(Info & i);
void dir_childs_tab(Info & i); void dir_childs_tab(Info & i);
void dir_childs_tab_url(Info & i); void dir_childs_tab_url(Info & i);