added: created directory 'content' which has Content:: files

added:   created directory 'templates' which has Templates:: and TemplatesFunctions:: files
changed: content.cpp split into many files (directory 'content')
changed: templates.cpp split into many files (directory 'templates')
added:   full permissions
changed: building of the program (GNU make is used now)
         Makefile and Makefile.dep added into directories
added:   a parser 'FunctionParser'
         is used to parse the GET string
         it recognizes directories, items, functions, functions parameters
added:   other classes: Function, Functions 
added:   function: ls, privileges
changed: function 'id' to 'node'
changed: version: to 0.2.0
added/changed: a lot of work have been done


git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@469 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2008-12-30 01:05:03 +00:00
parent fac60a197b
commit 3e328932fc
62 changed files with 3457 additions and 1617 deletions

View File

@@ -485,7 +485,7 @@ return result;
// !! with_subject zamienic na with_url
Error Db::EditItemInItem(Item & item, bool with_subject)
{
PGresult * r = 0;
@@ -634,6 +634,8 @@ return result;
// item.id must be set
// !! with_subject zamienic na with_url
// !! moze nazwa poprostu EditItem (nie trzeba tego ById) ? (sprawdzic czy nie koliduje z inna nazwa)
Error Db::EditItemById(Item & item, bool with_subject)
{
Error result = EditItemGetContentId(item);
@@ -760,6 +762,44 @@ void Db::GetItem(std::vector<Item> & item_table, long id)
// !! nowy interfejs
Error Db::GetItem(long parent_id, const std::string & url, Item & item)
{
PGresult * r = 0;
Error result = Error::ok;
try
{
AssertConnection();
std::ostringstream query;
query << "select * from core.item left join core.content on item.content_id = content.id where type='1' and item.parent_id='";
query << parent_id << "' and item.url='" << Escape(url) << "';";
r = AssertQuery( query.str() );
AssertResultStatus(r, PGRES_TUPLES_OK);
int rows = PQntuples(r);
if( rows == 0 )
throw Error(Error::db_no_item);
ItemColumns col;
col.SetColumns(r);
col.SetItem(r, 0, item);
}
catch(const Error & e)
{
result = e;
}
ClearResult(r);
return result;
}
bool Db::GetPriv(Item & item, long id)
{
bool result = false;
@@ -797,6 +837,37 @@ return result;
}
// !! to jest nowy interfejs, z jawnym podaniem id
Error Db::EditPrivById(Item & item, long id)
{
PGresult * r = 0;
Error result = Error::ok;
try
{
AssertConnection();
std::ostringstream query;
query << "update core.item set (user_id, group_id, privileges) = (";
query << '\'' << item.user_id << "', ";
query << '\'' << item.group_id << "', ";
query << '\'' << item.privileges << "' ";
query << ") where id='" << id << "';";
r = AssertQuery(query.str());
AssertResultStatus(r, PGRES_COMMAND_OK);
}
catch(const Error & e)
{
result = e;
}
ClearResult(r);
return result;
}
bool Db::DelItemDelItem(const Item & item)