removed: hidden variable 'old_url' in emacs template
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@527 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#include "../core/db.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/notify.h"
|
||||
#include "../core/misc.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -87,43 +89,61 @@ void Content::PostFunEmacsEdit(bool with_url)
|
||||
}
|
||||
|
||||
|
||||
// returning true if the 'url' has to be changed
|
||||
bool Content::PostFunSetUrlSubject()
|
||||
{
|
||||
bool with_url = false;
|
||||
|
||||
std::string * new_url = request.PostVar("url");
|
||||
std::string * new_subject = request.PostVar("subject");
|
||||
|
||||
if( request.is_item )
|
||||
{
|
||||
// editing an item
|
||||
if( new_url && *new_url != request.item.url )
|
||||
with_url = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// adding a new item
|
||||
with_url = true;
|
||||
}
|
||||
|
||||
if( new_url )
|
||||
request.item.url = *new_url;
|
||||
|
||||
if( new_subject )
|
||||
request.item.subject = *new_subject;
|
||||
|
||||
|
||||
if( request.item.subject.empty() )
|
||||
{
|
||||
request.item.subject = request.dir_table.back()->subject;
|
||||
request.item.subject += "_msg_";
|
||||
request.item.subject += ToStr(db.Size(request.dir_table.back()->id, Item::file));
|
||||
}
|
||||
|
||||
// if request.item.url is empty then it will be set from request.item.subject
|
||||
PrepareUrl(request.item);
|
||||
|
||||
return with_url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunEmacs()
|
||||
{
|
||||
bool adding = true;
|
||||
bool adding = !request.is_item;
|
||||
|
||||
if( request.is_item )
|
||||
adding = false;
|
||||
|
||||
try
|
||||
{
|
||||
// these old values are ignored (if exists)
|
||||
|
||||
request.PostVar("url", request.item.url);
|
||||
request.PostVar("subject", request.item.subject);
|
||||
|
||||
if( request.item.subject.empty() )
|
||||
request.item.subject = request.dir_table.back()->subject;
|
||||
// !! dodac skladanie tytuly z ostatniego katalogu i liczby okreslajacej ile jest elementow w srodku
|
||||
// !! nie bedzie obciazany modul wyszukujacy bardzo
|
||||
////////
|
||||
|
||||
bool with_url = PostFunSetUrlSubject();
|
||||
request.PostVar("content", request.item.content);
|
||||
|
||||
bool with_url = false;
|
||||
std::string * old_url = request.PostVar("old_url");
|
||||
|
||||
if( !request.is_item || (old_url && *old_url!=request.item.url) )
|
||||
with_url = true;
|
||||
|
||||
PrepareUrl(request.item);
|
||||
|
||||
if( !CheckRebus() )
|
||||
{
|
||||
request.status = Error::rebus_bad_answer;
|
||||
SetUser(request.item);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user