2020-08-11 Fred Gleason <fredg@paravelsystems.com>

* Added a 'FEEDS.CHANNEL_AUTHOR_IS_DEFAULT' field to the database.
	* Incremented the database version to 332.
	* Added 'RDFeed::channelAuthorIsDefault()' and
	'RDFeed::setChannelAuthorIsDefault()' methods.
	* Added a 'Use as default Item Author' checkbox to the 'Edit Feed'
	dialog in rdadmin(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2020-08-11 18:51:13 -04:00
parent d80e72152d
commit 88e0544874
17 changed files with 192 additions and 101 deletions

View File

@@ -24,7 +24,7 @@
/*
* Current Database Version
*/
#define RD_VERSION_DATABASE 331
#define RD_VERSION_DATABASE 332
#endif // DBVERSION_H

View File

@@ -296,6 +296,19 @@ void RDFeed::setChannelAuthor(const QString &str) const
}
bool RDFeed::channelAuthorIsDefault() const
{
return RDBool(RDGetSqlValue("FEEDS","KEY_NAME",feed_keyname,
"CHANNEL_AUTHOR_IS_DEFAULT").toString());
}
void RDFeed::setChannelAuthorIsDefault(bool state) const
{
SetRow("CHANNEL_AUTHOR_IS_DEFAULT",RDYesNo(state));
}
QString RDFeed::channelOwnerName() const
{
return RDGetSqlValue("FEEDS","KEY_NAME",feed_keyname,"CHANNEL_OWNER_NAME").
@@ -1052,7 +1065,6 @@ unsigned RDFeed::postCut(const QString &cutname,Error *err)
//
RDCart *cart=new RDCart(RDCut::cartNumber(cutname));
cast->setItemTitle(cart->title());
cast->setItemAuthor(rda->user()->emailContact());
cast->setItemImageId(defaultItemImageId());
delete cart;
delete cast;
@@ -1187,7 +1199,6 @@ unsigned RDFeed::postFile(const QString &srcfile,Error *err)
else {
cast->setItemTitle(srcfile.split("/").last());
}
cast->setItemAuthor(rda->user()->emailContact());
cast->setItemImageId(defaultItemImageId());
delete cast;
@@ -1249,8 +1260,6 @@ unsigned RDFeed::postLog(const QString &logname,const QTime &start_time,
connect(renderer,SIGNAL(lineStarted(int,int)),
this,SLOT(renderLineStartedData(int,int)));
printf("first: %d last: %d\n",start_line,end_line);
if(!renderer->renderToFile(tmpfile,log_event,settings,start_time,stop_at_stop,
&err_msg,start_line,end_line)) {
*err=RDFeed::ErrorRenderError;
@@ -1312,7 +1321,6 @@ unsigned RDFeed::postLog(const QString &logname,const QTime &start_time,
else {
cast->setItemTitle(log->description());
}
cast->setItemAuthor(rda->user()->emailContact());
cast->setItemImageId(defaultItemImageId());
delete log;
@@ -1633,14 +1641,16 @@ unsigned RDFeed::CreateCast(QString *filename,int bytes,int msecs) const
unsigned cast_id=0;
sql=QString("select ")+
"CHANNEL_TITLE,"+ // 00
"CHANNEL_DESCRIPTION,"+ // 01
"CHANNEL_CATEGORY,"+ // 02
"CHANNEL_LINK,"+ // 03
"MAX_SHELF_LIFE,"+ // 04
"UPLOAD_FORMAT,"+ // 05
"UPLOAD_EXTENSION,"+ // 06
"ENABLE_AUTOPOST "+ // 07
"CHANNEL_TITLE,"+ // 00
"CHANNEL_DESCRIPTION,"+ // 01
"CHANNEL_CATEGORY,"+ // 02
"CHANNEL_LINK,"+ // 03
"MAX_SHELF_LIFE,"+ // 04
"UPLOAD_FORMAT,"+ // 05
"UPLOAD_EXTENSION,"+ // 06
"ENABLE_AUTOPOST,"+ // 07
"CHANNEL_AUTHOR,"+ // 08
"CHANNEL_AUTHOR_IS_DEFAULT "+ // 09
"from FEEDS where "+
QString().sprintf("ID=%u",feed_id);
q=new RDSqlQuery(sql);
@@ -1648,6 +1658,10 @@ unsigned RDFeed::CreateCast(QString *filename,int bytes,int msecs) const
delete q;
return 0;
}
QString item_author=rda->user()->emailContact();
if(q->value(9).toString()=="Y") {
item_author=q->value(8).toString();
}
//
// Create Entry
@@ -1658,7 +1672,7 @@ unsigned RDFeed::CreateCast(QString *filename,int bytes,int msecs) const
"ITEM_DESCRIPTION=\""+RDEscapeString(q->value(1).toString())+"\","+
"ITEM_CATEGORY=\""+RDEscapeString(q->value(2).toString())+"\","+
"ITEM_LINK=\""+RDEscapeString(q->value(3).toString())+"\","+
"ITEM_AUTHOR=\""+RDEscapeString(rda->user()->emailContact())+"\","+
"ITEM_AUTHOR=\""+RDEscapeString(item_author)+"\","+
"EFFECTIVE_DATETIME=now(),"+
"ORIGIN_LOGIN_NAME=\""+RDEscapeString(rda->user()->name())+"\","+
"ORIGIN_STATION=\""+RDEscapeString(rda->station()->name())+"\","+

View File

@@ -65,6 +65,8 @@ class RDFeed : public QObject
void setChannelEditor(const QString &str) const;
QString channelAuthor() const;
void setChannelAuthor(const QString &str) const;
bool channelAuthorIsDefault() const;
void setChannelAuthorIsDefault(bool state) const;
QString channelOwnerName() const;
void setChannelOwnerName(const QString &str) const;
QString channelOwnerEmail() const;