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++
CFLAGS = -Wall -pedantic -g -I/usr/local/include -L/usr/local/lib
name = cmslu.fcgi
export CC
endif
ifndef CFLAGS
CFLAGS = -Wall -pedantic -g -I/usr/local/include -L/usr/local/lib
export CFLAGS
all: $(name)
endif
$(name): core content confparser templates ezc
g++ -o $(name) $(CFLAGS) core/core.a content/content.a confparser/confparser.a templates/templates.a ../ezc/src/ezc.a -lfcgi -lpq
all: core content confparser templates
cp core/core.a ./
cp content/content.a ./
cp confparser/confparser.a ./
cp templates/templates.a ./
core: FORCE
@cd core ; $(MAKE) -e
templates: FORCE
@cd templates ; $(MAKE) -e
content: FORCE
@cd content ; $(MAKE) -e
confparser: FORCE
@cd confparser ; $(MAKE) -e
content: FORCE
@cd content ; $(MAKE) -e
ezc: FORCE
@cd ../ezc/src ; $(MAKE) -e
templates: FORCE
@cd templates ; $(MAKE) -e
clean:
@cd core ; $(MAKE) -e clean
@cd templates ; $(MAKE) -e clean
@cd confparser ; $(MAKE) -e clean
@cd content ; $(MAKE) -e clean
@cd ../ezc/src ; $(MAKE) -e clean
rm -f $(name)
@cd confparser ; $(MAKE) -e clean
@cd templates ; $(MAKE) -e clean
rm -f *.a
FORCE:
@ -46,8 +46,7 @@ FORCE:
depend:
cd core ; $(MAKE) -e depend
cd templates ; $(MAKE) -e depend
cd confparser ; $(MAKE) -e depend
cd content ; $(MAKE) -e depend
cd ../ezc/src ; $(MAKE) -e depend
@cd core ; $(MAKE) -e depend
@cd content ; $(MAKE) -e depend
@cd confparser ; $(MAKE) -e depend
@cd templates ; $(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:
makedepend -Y. -f- *.cpp > Makefile.dep
makedepend $(DEPMACROS) -Y. -f- *.cpp > Makefile.dep
clean:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,9 +11,8 @@ templates.a: $(o)
.cpp.o:
$(CC) -c $(CFLAGS) $<
depend:
makedepend -Y. -f- *.cpp > Makefile.dep
makedepend $(DEPMACROS) -Y. -f- *.cpp > Makefile.dep
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;
@ -152,6 +170,9 @@ void dir_last_default_item_url(Info & i)
} // 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

View File

@ -188,6 +188,8 @@ void Templates::CreateFunctions()
functions.Insert("item_dir", item_dir);
functions.Insert("item_url", item_url);
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_subject", item_old_subject);
@ -215,6 +217,7 @@ void Templates::CreateFunctions()
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_url", dir_childs_tab_url);
@ -270,6 +273,13 @@ void Templates::CreateFunctions()
// !! tymczasowa
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_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.ParseFile("err_others.html");

View File

@ -24,6 +24,10 @@
#include "../core/groups.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_url(Info & i);
void item_link(Info & i);
void item_can_read(Info & i);
// !! wprowadzic item_old_is ?
void item_old_id(Info & i);
@ -92,6 +97,7 @@ namespace TemplatesFunctions
dir
*/
void dir(Info & i);
void dir_can_read_exec(Info & i);
void dir_childs_tab(Info & i);
void dir_childs_tab_url(Info & i);