From 327f18525c4db1c202feec15be23b6386e25f85f Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Wed, 14 Jan 2009 20:11:12 +0000 Subject: [PATCH] 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 --- Makefile | 49 ++++++++++++++++++++--------------------- app/templates.h | 19 ++++++++++++++++ confparser/Makefile | 2 +- content/Makefile | 2 +- content/rm.cpp | 6 +---- core/Makefile | 2 +- core/functions.cpp | 12 +++++----- core/main.cpp | 2 +- templates/Makefile | 3 +-- templates/dir.cpp | 21 ++++++++++++++++++ templates/item.cpp | 7 ++++++ templates/templates.cpp | 12 +++++++++- templates/templates.h | 6 +++++ 13 files changed, 100 insertions(+), 43 deletions(-) create mode 100755 app/templates.h diff --git a/Makefile b/Makefile index 9806fe0..be70962 100755 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/app/templates.h b/app/templates.h new file mode 100755 index 0000000..293d4fe --- /dev/null +++ b/app/templates.h @@ -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 diff --git a/confparser/Makefile b/confparser/Makefile index 5ec39dd..858e5f4 100755 --- a/confparser/Makefile +++ b/confparser/Makefile @@ -17,7 +17,7 @@ confparser.a: $(o) depend: - makedepend -Y. -f- *.cpp > Makefile.dep + makedepend $(DEPMACROS) -Y. -f- *.cpp > Makefile.dep clean: diff --git a/content/Makefile b/content/Makefile index 393d884..e47ca23 100755 --- a/content/Makefile +++ b/content/Makefile @@ -14,7 +14,7 @@ content.a: $(o) depend: - makedepend -Y. -f- *.cpp > Makefile.dep + makedepend $(DEPMACROS) -Y. -f- *.cpp > Makefile.dep clean: diff --git a/content/rm.cpp b/content/rm.cpp index 09b1b76..5a4cdbe 100755 --- a/content/rm.cpp +++ b/content/rm.cpp @@ -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; } } diff --git a/core/Makefile b/core/Makefile index 1f0a504..967174a 100755 --- a/core/Makefile +++ b/core/Makefile @@ -15,7 +15,7 @@ core.a: $(o) depend: - makedepend -Y. -f- *.cpp > Makefile.dep + makedepend $(DEPMACROS) -Y. -f- *.cpp > Makefile.dep clean: diff --git a/core/functions.cpp b/core/functions.cpp index cf2f22a..2ca3687 100755 --- a/core/functions.cpp +++ b/core/functions.cpp @@ -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; diff --git a/core/main.cpp b/core/main.cpp index 82f610f..628ced8 100755 --- a/core/main.cpp +++ b/core/main.cpp @@ -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 */ } diff --git a/templates/Makefile b/templates/Makefile index 1eaed39..c8c738b 100755 --- a/templates/Makefile +++ b/templates/Makefile @@ -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: diff --git a/templates/dir.cpp b/templates/dir.cpp index 5d8a6c4..e28a5f1 100755 --- a/templates/dir.cpp +++ b/templates/dir.cpp @@ -26,6 +26,24 @@ void dir(Info & i) +void dir_can_read_exec(Info & i) +{ +bool result = true; + + for(size_t a=0 ; a dir_childs_table; @@ -152,6 +170,9 @@ void dir_last_default_item_url(Info & i) + + + } // namespace TemplatesFunctions diff --git a/templates/item.cpp b/templates/item.cpp index 1ea66ec..1560b86 100755 --- a/templates/item.cpp +++ b/templates/item.cpp @@ -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 diff --git a/templates/templates.cpp b/templates/templates.cpp index 550be26..d7e6e13 100755 --- a/templates/templates.cpp +++ b/templates/templates.cpp @@ -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"); diff --git a/templates/templates.h b/templates/templates.h index 176ea76..aeebbd7 100755 --- a/templates/templates.h +++ b/templates/templates.h @@ -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);