added: item content type: raw
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@549 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -51,12 +51,12 @@ void Content::PostFunEmacsAdd()
|
||||
request.item.privileges = 0644; // !! tymczasowo, bedzie uzyte umask
|
||||
request.item.parent_id = request.dir_table.back()->id;
|
||||
request.item.type = Item::file;
|
||||
request.item.content_type = 1;// !! tymczasowo formatted text
|
||||
request.item.content_type = Item::ct_formatted_text;// !! tymczasowo formatted text
|
||||
|
||||
// dates (creation and modification) is set by request.item.Clear() at the beginning
|
||||
|
||||
if( !request.CanUseEmacs(*request.dir_table.back() ) )
|
||||
throw Error(Error::permision_denied);
|
||||
throw Error(Error::permission_denied);
|
||||
|
||||
request.session->done_status = db.AddItem(request.item);
|
||||
|
||||
@@ -74,7 +74,7 @@ void Content::PostFunEmacsEdit(bool with_url)
|
||||
request.session->done = Done::edited_item;
|
||||
|
||||
if( !request.CanUseEmacs(request.item) )
|
||||
throw Error(Error::permision_denied);
|
||||
throw Error(Error::permission_denied);
|
||||
|
||||
time_t t = std::time(0);
|
||||
request.item.date_modification = *std::localtime( &t );
|
||||
@@ -91,7 +91,7 @@ void Content::PostFunEmacsEdit(bool with_url)
|
||||
}
|
||||
|
||||
|
||||
// returning true if the 'url' has to be changed
|
||||
// returning true if the 'url' has to be change
|
||||
bool Content::PostFunSetUrlSubject()
|
||||
{
|
||||
bool with_url = false;
|
||||
@@ -132,6 +132,42 @@ return with_url;
|
||||
}
|
||||
|
||||
|
||||
void Content::SetContentType()
|
||||
{
|
||||
request.item.content_type = Item::ct_formatted_text; // formatted text default
|
||||
request.PostVar("contenttype", temp);
|
||||
|
||||
if( temp == "text" )
|
||||
request.item.content_type = Item::ct_text;
|
||||
else
|
||||
if( temp == "formatted text" )
|
||||
request.item.content_type = Item::ct_formatted_text;
|
||||
|
||||
if( !request.session->puser )
|
||||
return;
|
||||
|
||||
long user_id = request.session->puser->id;
|
||||
|
||||
if( temp == "html" )
|
||||
{
|
||||
if( request.CanUseHtml(user_id) )
|
||||
request.item.content_type = Item::ct_html;
|
||||
}
|
||||
else
|
||||
if( temp == "bbcode" )
|
||||
{
|
||||
if( request.CanUseBBCode(user_id) )
|
||||
request.item.content_type = Item::ct_bbcode;
|
||||
}
|
||||
else
|
||||
if( temp == "raw" )
|
||||
{
|
||||
if( request.CanUseRaw(user_id) )
|
||||
request.item.content_type = Item::ct_raw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunEmacs()
|
||||
{
|
||||
@@ -141,6 +177,7 @@ bool adding = !request.is_item;
|
||||
{
|
||||
bool with_url = PostFunSetUrlSubject();
|
||||
request.PostVar("content", request.item.content);
|
||||
SetContentType();
|
||||
|
||||
if( !CheckRebus() )
|
||||
{
|
||||
@@ -220,7 +257,7 @@ void Content::FunEmacs()
|
||||
{
|
||||
// adding a new item
|
||||
if( !request.CanUseEmacs(*request.dir_table.back()) )
|
||||
request.status = Error::permision_denied;
|
||||
request.status = Error::permission_denied;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -228,7 +265,7 @@ void Content::FunEmacs()
|
||||
// editing an existing item
|
||||
if( !request.CanUseEmacs(request.item) )
|
||||
{
|
||||
request.status = Error::permision_denied;
|
||||
request.status = Error::permission_denied;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user