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

@ -20215,3 +20215,10 @@
'RDRssSchemas::itemCommentsSupported()' methods.
* Modified the 'Editing Item' dialog in rdcastmanager(1) to
conditionally display the 'Link' and 'Comments' controls.
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).

View File

@ -2,44 +2,45 @@
The FEEDS table holds data concerning which defines RSS feeds.
FIELD NAME TYPE REMARKS
FIELD NAME TYPE REMARKS
---------------------------------------------------------------
ID int(10) unsigned Primary key, auto increment
KEY_NAME varchar(8) Unique
IS_SUPERFEED enum('N','Y')
CHANNEL_TITLE varchar(191)
CHANNEL_DESCRIPTION text
CHANNEL_CATEGORY varchar(64)
CHANNEL_SUB_CATEGORY varchar(64)
CHANNEL_LINK varchar(191)
CHANNEL_COPYRIGHT varchar(64)
CHANNEL_EDITOR varchar(64)
CHANNEL_AUTHOR varchar(64)
CHANNEL_OWNER_NAME varchar(64)
CHANNEL_OWNER_EMAIL varchar(64)
CHANNEL_WEBMASTER varchar(64)
CHANNEL_LANGUAGE varchar(5)
CHANNEL_EXPLICIT enum('N','Y')
CHANNEL_IMAGE_ID int(11) From FEED_IMAGES.ID
BASE_URL varchar(191)
BASE_PREAMBLE varchar(191)
PURGE_URL varchar(191)
PURGE_USERNAME varchar(64)
PURGE_PASSWORD varchar(64)
RSS_SCHEMA int(10) unsigned 0=Custom, 1=RSS-2.0.2
HEADER_XML text
CHANNEL_XML text
ITEM_XML text
CAST_ORDER enum('N','Y')
MAX_SHELF_LIFE int(11)
LAST_BUILD_DATETIME datetime
ORIGIN_DATETIME datetime
ENABLE_AUTOPOST enum('N','Y')
DEFAULT_ITEM_IMAGE_ID int(11) From FEED_IMAGES.ID
UPLOAD_FORMAT int(11)
UPLOAD_CHANNELS int(11)
UPLOAD_SAMPRATE int(11)
UPLOAD_BITRATE int(11)
UPLOAD_QUALITY int(11)
UPLOAD_EXTENSION varchar(16)
NORMALIZE_LEVEL int(11)
ID int(10) unsigned Primary key, auto increment
KEY_NAME varchar(8) Unique
IS_SUPERFEED enum('N','Y')
CHANNEL_TITLE varchar(191)
CHANNEL_DESCRIPTION text
CHANNEL_CATEGORY varchar(64)
CHANNEL_SUB_CATEGORY varchar(64)
CHANNEL_LINK varchar(191)
CHANNEL_COPYRIGHT varchar(64)
CHANNEL_EDITOR varchar(64)
CHANNEL_AUTHOR varchar(64)
CHANNEL_AUTHOR_IS_DEFAULT enum('N','Y')
CHANNEL_OWNER_NAME varchar(64)
CHANNEL_OWNER_EMAIL varchar(64)
CHANNEL_WEBMASTER varchar(64)
CHANNEL_LANGUAGE varchar(5)
CHANNEL_EXPLICIT enum('N','Y')
CHANNEL_IMAGE_ID int(11) From FEED_IMAGES.ID
BASE_URL varchar(191)
BASE_PREAMBLE varchar(191)
PURGE_URL varchar(191)
PURGE_USERNAME varchar(64)
PURGE_PASSWORD varchar(64)
RSS_SCHEMA int(10) unsigned 0=Custom, 1=RSS-2.0.2
HEADER_XML text
CHANNEL_XML text
ITEM_XML text
CAST_ORDER enum('N','Y')
MAX_SHELF_LIFE int(11)
LAST_BUILD_DATETIME datetime
ORIGIN_DATETIME datetime
ENABLE_AUTOPOST enum('N','Y')
DEFAULT_ITEM_IMAGE_ID int(11) From FEED_IMAGES.ID
UPLOAD_FORMAT int(11)
UPLOAD_CHANNELS int(11)
UPLOAD_SAMPRATE int(11)
UPLOAD_BITRATE int(11)
UPLOAD_QUALITY int(11)
UPLOAD_EXTENSION varchar(16)
NORMALIZE_LEVEL int(11)

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;

View File

@ -149,6 +149,13 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent)
feed_channel_author_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter);
feed_channel_author_is_default_check=new QCheckBox(this);
feed_channel_author_is_default_label=
new QLabel(tr("Use as default Item Author"),this);
feed_channel_author_is_default_label->setFont(labelFont());
feed_channel_author_is_default_label->
setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
//
// Channel Owner Name
//
@ -453,6 +460,8 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent)
feed_channel_copyright_edit->setText(feed_feed->channelCopyright());
feed_channel_editor_edit->setText(feed_feed->channelEditor());
feed_channel_author_edit->setText(feed_feed->channelAuthor());
feed_channel_author_is_default_check->
setChecked(feed_feed->channelAuthorIsDefault());
feed_channel_owner_name_edit->setText(feed_feed->channelOwnerName());
feed_channel_owner_email_edit->setText(feed_feed->channelOwnerEmail());
feed_channel_webmaster_edit->setText(feed_feed->channelWebmaster());
@ -507,7 +516,7 @@ EditFeed::~EditFeed()
QSize EditFeed::sizeHint() const
{
return QSize(1000,688);
return QSize(1000,710);
}
@ -643,6 +652,8 @@ void EditFeed::okData()
feed_feed->setChannelCopyright(feed_channel_copyright_edit->text());
feed_feed->setChannelEditor(feed_channel_editor_edit->text());
feed_feed->setChannelAuthor(feed_channel_author_edit->text());
feed_feed->setChannelAuthorIsDefault(feed_channel_author_is_default_check->
isChecked());
feed_feed->setChannelOwnerName(feed_channel_owner_name_edit->text());
feed_feed->setChannelOwnerEmail(feed_channel_owner_email_edit->text());
feed_feed->setChannelWebmaster(feed_channel_webmaster_edit->text());
@ -705,7 +716,7 @@ void EditFeed::resizeEvent(QResizeEvent *e)
feed_list_images_button->setGeometry(345,13,100,38);
feed_channel_section_groupbox->setGeometry(10,52,sizeHint().width()/2-10,355);
feed_channel_section_groupbox->setGeometry(10,52,sizeHint().width()/2-10,377);
feed_channel_title_edit->setGeometry(115,67,375,19);
feed_channel_title_label->setGeometry(20,67,90,19);
@ -725,67 +736,73 @@ void EditFeed::resizeEvent(QResizeEvent *e)
feed_channel_author_edit->setGeometry(115,176,375,19);
feed_channel_author_label->setGeometry(20,176,90,19);
feed_channel_owner_name_edit->setGeometry(115,198,375,19);
feed_channel_owner_name_label->setGeometry(20,198,90,19);
feed_channel_author_is_default_check->setGeometry(120,197,15,15);
feed_channel_author_is_default_label->setGeometry(140,196,260,19);
feed_channel_owner_email_edit->setGeometry(115,220,375,19);
feed_channel_owner_email_label->setGeometry(20,220,90,19);
feed_channel_explicit_check->setGeometry(205,198,15,15);
feed_channel_explicit_label->setGeometry(225,197,260,19);
feed_channel_webmaster_edit->setGeometry(115,242,375,19);
feed_channel_webmaster_label->setGeometry(20,242,90,19);
feed_channel_owner_name_edit->setGeometry(115,220,375,19);
feed_channel_owner_name_label->setGeometry(20,220,90,19);
feed_channel_language_edit->setGeometry(115,264,60,19);
feed_channel_language_label->setGeometry(20,264,90,19);
feed_channel_owner_email_edit->setGeometry(115,242,375,19);
feed_channel_owner_email_label->setGeometry(20,242,90,19);
feed_channel_explicit_check->setGeometry(205,266,15,15);
feed_channel_explicit_label->setGeometry(225,265,260,19);
feed_channel_webmaster_edit->setGeometry(115,264,375,19);
feed_channel_webmaster_label->setGeometry(20,264,90,19);
feed_channel_description_edit->setGeometry(115,286,375,76);
feed_channel_description_label->setGeometry(20,286,90,19);
feed_channel_language_edit->setGeometry(115,286,60,19);
feed_channel_language_label->setGeometry(20,286,90,19);
feed_channel_image_box->setGeometry(115,364,375,38);
feed_channel_explicit_check->setGeometry(205,288,15,15);
feed_channel_explicit_label->setGeometry(225,287,260,19);
feed_channel_description_edit->setGeometry(115,308,375,76);
feed_channel_description_label->setGeometry(20,308,90,19);
feed_channel_image_box->setGeometry(115,386,375,38);
feed_channel_image_box->setIconSize(QSize(36,36));
feed_channel_image_label->setGeometry(20,364,90,19);
feed_channel_image_label->setGeometry(20,386,90,19);
feed_purge_url_edit->setGeometry(155,414,335,19);
feed_purge_url_label->setGeometry(20,414,130,19);
feed_purge_username_edit->setGeometry(225,436,95,19);
feed_purge_username_label->setGeometry(40,436,180,19);
feed_purge_password_edit->setGeometry(395,436,95,19);
feed_purge_password_label->setGeometry(320,436,70,19);
feed_purge_url_edit->setGeometry(155,436,335,19);
feed_purge_url_label->setGeometry(20,436,130,19);
feed_purge_username_edit->setGeometry(225,458,95,19);
feed_purge_username_label->setGeometry(40,458,180,19);
feed_purge_password_edit->setGeometry(395,458,95,19);
feed_purge_password_label->setGeometry(320,458,70,19);
feed_format_edit->setGeometry(155,460,285,20);
feed_format_label->setGeometry(5,460,145,20);
feed_format_button->setGeometry(450,458,40,24);
feed_format_edit->setGeometry(155,482,285,20);
feed_format_label->setGeometry(5,482,145,20);
feed_format_button->setGeometry(450,480,40,24);
feed_normalize_check->setGeometry(155,487,15,15);
feed_normalize_check_label->setGeometry(175,484,83,20);
feed_normalize_spin->setGeometry(295,484,40,20);
feed_normalize_label->setGeometry(245,484,45,20);
feed_normalize_unit_label->setGeometry(340,484,40,20);
feed_normalize_check->setGeometry(155,509,15,15);
feed_normalize_check_label->setGeometry(175,506,83,20);
feed_normalize_spin->setGeometry(295,506,40,20);
feed_normalize_label->setGeometry(245,506,45,20);
feed_normalize_unit_label->setGeometry(340,506,40,20);
feed_extension_edit->setGeometry(155,504,70,19);
feed_extension_label->setGeometry(20,504,130,19);
feed_extension_edit->setGeometry(155,526,70,19);
feed_extension_label->setGeometry(20,526,130,19);
feed_base_url_edit->setGeometry(155,526,335,19);
feed_base_url_label->setGeometry(5,526,145,19);
feed_base_url_edit->setGeometry(155,548,335,19);
feed_base_url_label->setGeometry(5,548,145,19);
feed_autopost_box->setGeometry(155,551,60,19);
feed_autopost_label->setGeometry(5,551,145,19);
feed_autopost_box->setGeometry(155,573,60,19);
feed_autopost_label->setGeometry(5,573,145,19);
feed_max_shelf_life_spin->setGeometry(155,573,90,19);
feed_max_shelf_life_label->setGeometry(20,573,130,19);
feed_max_shelf_life_unit_label->setGeometry(250,573,50,19);
feed_max_shelf_life_spin->setGeometry(155,595,90,19);
feed_max_shelf_life_label->setGeometry(20,595,130,19);
feed_max_shelf_life_unit_label->setGeometry(250,595,50,19);
feed_item_image_box->setGeometry(155,595,335,38);
feed_item_image_box->setGeometry(155,617,335,38);
feed_item_image_box->setIconSize(QSize(36,36));
feed_item_image_label->setGeometry(20,595,130,19);
feed_item_image_label->setGeometry(20,617,130,19);
feed_base_preamble_edit->setGeometry(155,636,335,19);
feed_base_preamble_label->setGeometry(20,636,130,19);
feed_base_preamble_edit->setGeometry(155,658,335,19);
feed_base_preamble_label->setGeometry(20,658,130,19);
feed_castorder_box->setGeometry(155,660,100,19);
feed_castorder_label->setGeometry(20,660,130,19);
feed_castorder_box->setGeometry(155,682,100,19);
feed_castorder_label->setGeometry(20,682,130,19);
//
// Right-hand Side

View File

@ -83,6 +83,8 @@ class EditFeed : public RDDialog
QLineEdit *feed_channel_editor_edit;
QLabel *feed_channel_author_label;
QLineEdit *feed_channel_author_edit;
QCheckBox *feed_channel_author_is_default_check;
QLabel *feed_channel_author_is_default_label;
QLabel *feed_channel_owner_name_label;
QLineEdit *feed_channel_owner_name_edit;
QLabel *feed_channel_owner_email_label;

View File

@ -1710,6 +1710,10 @@ Feeds</source>
Clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use as default Item Author</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditFeedPerms</name>

View File

@ -1545,6 +1545,10 @@ Feeds</source>
Clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use as default Item Author</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditFeedPerms</name>

View File

@ -1709,6 +1709,10 @@ Feeds</source>
Clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use as default Item Author</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditFeedPerms</name>

View File

@ -1213,6 +1213,10 @@ Feeds</source>
Clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use as default Item Author</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditFeedPerms</name>

View File

@ -1511,6 +1511,10 @@ Feeds</source>
Clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use as default Item Author</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditFeedPerms</name>

View File

@ -1511,6 +1511,10 @@ Feeds</source>
Clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use as default Item Author</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditFeedPerms</name>

View File

@ -1521,6 +1521,10 @@ Feeds</source>
Clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use as default Item Author</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditFeedPerms</name>

View File

@ -40,6 +40,15 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
// NEW SCHEMA REVERSIONS GO HERE...
//
// Revert 332
//
if((cur_schema==332)&&(set_schema<cur_schema)) {
DropColumn("FEEDS","CHANNEL_AUTHOR_IS_DEFAULT");
WriteSchemaVersion(--cur_schema);
}
//
// Revert 331
//

View File

@ -161,7 +161,7 @@ void MainObject::InitializeSchemaMap() {
global_version_map["3.2"]=311;
global_version_map["3.3"]=314;
global_version_map["3.4"]=317;
global_version_map["4.0"]=331;
global_version_map["4.0"]=332;
}

View File

@ -10185,6 +10185,17 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
WriteSchemaVersion(++cur_schema);
}
if((cur_schema<332)&&(set_schema>cur_schema)) {
sql=QString("alter table FEEDS ")+
"add column CHANNEL_AUTHOR_IS_DEFAULT enum('N','Y') default 'N' "+
"after CHANNEL_AUTHOR";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
WriteSchemaVersion(++cur_schema);
}