def publish_email_semiauto(self): """ Create an AINewsSemiAutoEmail.html file for admin to click and semi-auto send it to the subscriber list. """ semiauto = """ <html> <body> <h1>AI Alert - SemiAuto Sender</h1> <form action="http://aaai.org/cgi-dada/mail.cgi?flavor=send_email" method='post'> <!-- <form action="welcome.php" method="post"> --> <input type='hidden' name='f' value='send_email' /> <input type='hidden' name='process' value='true' /> <input type='hidden' name='admin_list' value='alert' /> <input type='hidden' name='message_subject' value="%s" /> <input type='hidden' name='email_format' value='HTML' /> <textarea type='hidden' name="text_message_body">%s</textarea> <input type='submit' value='Submit Mailing List Message' /> </form> <h2>Please review the email below. If there are concerns, contact Bruce or Reid:</h2> <p> %s </p> </body> </html> """ % ("AI Alert - "+str(self.today.strftime("%B %d, %Y")), self.semiauto_email_output, self.semiauto_email_output) savefile(paths['ainews.html'] + "semiauto_email.html", semiauto)
def generate_standard_output(self): """ Generate the stanard output for debuging on screen. """ txt = LatestNewsTxt() txt.news = self.publishable_articles savefile(paths['ainews.output'] + "std_output.txt", str(txt))
def generate_feed_import(self): """ Generate XML file for feed import on the Drupal site. """ xml = FeedImport() for article in self.articles.values(): article['source'] = re.sub(r'&', '&', article['source']) xml.news = self.articles.values() savefile(paths['ainews.output_xml'] + "news.xml", str(xml))
def generate_feed_import(self): """ Generate XML file for feed import on the Drupal site. """ xml = FeedImport() for article in self.articles.values(): article["source"] = re.sub(r"&", "&", article["source"]) xml.news = self.articles.values() savefile(paths["ainews.output_xml"] + "news.xml", str(xml))
def generate_pmwiki_published_output(self): """ Genereate the output with PmWiki page format. It needs to be further processed by AINewsPmwiki.php. """ pmwiki = LatestNewsPmWiki() pmwiki.date = self.today.strftime("%B %d, %Y") pmwiki.year = self.today.strftime("%Y") pmwiki.news = self.publishable_articles pmwiki.rater = True savefile(paths['ainews.output'] + "pmwiki_output.txt", str(pmwiki)) pmwiki.rater = False savefile(paths['ainews.output'] + "pmwiki_output_norater.txt", str(pmwiki))
def generate_email_output(self): """ Generate the output for email format. """ email = LatestNewsEmail() email.date = self.today.strftime("%B %d, %Y") email.year = self.today.strftime("%Y") email.news = self.publishable_articles email.aitopic_urls = aitopic_urls email.topicids = self.topicids email_output = str(email) savefile(paths['ainews.output'] + "email_output.txt", email_output) self.semiauto_email_output = email_output
def publish_email_semiauto(self): """ Create an AINewsSemiAutoEmail.html file for admin to click and semi-auto send it to the subscriber list. """ output = self.generate_email_output() semiauto = """ <html> <head> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> </head> <body> <h1>AI Alert - SemiAuto Sender</h1> <form action="http://aaai.org/cgi-dada/mail.cgi?flavor=send_email" method='post'> <!-- <form action="welcome.php" method="post"> --> <input type='hidden' name='f' value='send_email' /> <input type='hidden' name='process' value='true' /> <input type='hidden' name='admin_list' value='alert' /> <input type='hidden' name='message_subject' value="%s" /> <input type='hidden' name='email_format' value='HTML' /> <textarea type='hidden' name="text_message_body">%s</textarea> <input type='submit' value='Submit Mailing List Message' /> </form> <h2>Please review the email below. If there are concerns, contact Bruce or Reid:</h2> <p> %s </p> </body> <head> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> </head> </html> """ % ("AI Alert - " + str(self.today.strftime("%B %d, %Y")), output, output) savefile(paths['ainews.html'] + "semiauto_email.html", semiauto)
def generate_pmwiki_all_output(self): pmwiki_all = AllNewsPmWiki() pmwiki_all.date = self.today.strftime("%B %d, %Y") pmwiki_all.year = self.today.strftime("%Y") pmwiki_all.news = self.articles.values() savefile(paths['ainews.output'] + "pmwiki_all.txt", str(pmwiki_all)) # Generate wiki metadata page for each article urlids_output = "" for urlid in self.articles: urlids_output += str(urlid) + '\n' article_wiki = ArticlePmWiki() article_wiki.year = self.today.strftime("%Y") article_wiki.dupthreshold = float(config['duplicates.threshold']) article_wiki.n = self.articles[urlid] savefile(paths['ainews.output'] + "aiarticles/%d" % urlid, str(article_wiki)) savefile(paths['ainews.output'] + "urlids_output.txt", urlids_output)