Typo3 and DirectMail - Plaintext - typo3-8.x

I'm facing a problem with &type=99 - I created a page that's being sent as a Newsletter. I used FCE's from a provider extension to create the page. HTML works fine, But when I try to call the page in plaintext (&type=99), all I can see is Hello. This is default template for plain-text mail content [Unrendered Content Element...
Any ideas how to solve this? (I'm using T3 8.7 and DM 5.3)
(using simplegrids, as mentioned here TYPO3: direct_mail - no plain text output isn't an option)

So, turns out it was pretty simple...
TS:
plaintext = PAGE
plaintext {
typeNum = 99
10 = FLUIDTEMPLATE
10 {
templateName = Newsletter-99
templateRootPaths {
0 = EXT:fluid_styled_content/Resources/Private/Templates/
10 = pathToMyExt/Resources/Private/Templates/Page
}
partialRootPaths {
0 = EXT:fluid_styled_content/Resources/Private/Partials/
10 = pathToMyExt/Resources/Private/Partials/
}
layoutRootPaths {
0 = EXT:fluid_styled_content/Resources/Private/Layouts/
10 = pathToMyExt/Resources/Private/Layouts/
}
template = FILE
template.file = pathToMyExt/Resources/Private/Templates/Page/Newsletter-99.html
}
}
Then I created a new Template named «Newsletter-99.html» (s. above) with this content:
<f:format.stripTags><v:content.render column="0"/></f:format.stripTags>
This renders all fluid-templates and then strips all tags (which makes it basically plaintext).
That's it - after these changes I can call the page with &type=99 and I get a plaintext represenation of the Newsletter.

Related

How do I parse specific data from a website within Codename One?

I have run into a road block developing my Codename One app. One of my classes in my project parses 3 specific html "td" elements from a website and saves the text to a string where I then input that text data into a Codename One multibutton. I originally used jSoup for this operation but soon realized that Codename One doesn't support 3rd party jar files so I used this method as shown below.
public void showOilPrice() {
if (current != null) {
current.show();
return;
}
WebBrowser b = new WebBrowser() {
#Override
public void onLoad(String url) {
BrowserComponent c = (BrowserComponent) this.getInternal();
JavascriptContext ctx = new JavascriptContext(c);
String wtiLast = (String) ctx.get("document.getElementById('pair_8849').childNodes[4].innerText");
String wtiPrev = (String) ctx.get("document.getElementById('pair_8849').childNodes[5].innerText");
String wtiChange = (String) ctx.get("document.getElementById('pair_8849').childNodes[8].innerText");
Form op = new Form("Oil Prices", new BoxLayout(BoxLayout.Y_AXIS));
MultiButton wti = new MultiButton("West Texas Intermediate");
Image icon = null;
Image emblem = null;
wti.setEmblem(emblem);
wti.setTextLine2("Current Price: " + wtiLast);
wti.setTextLine3("Previous: " + wtiPrev);
wti.setTextLine4("Change: " + wtiChange);
op.add(wti);
op.show();
}
};
b.setURL("https://sslcomrates.forexprostools.com/index.php?force_lang=1&pairs_ids=8833;8849;954867;8988;8861;8862;&header-text-color=%23FFFFFF&curr-name-color=%230059b0&inner-text-color=%23000000&green-text-color=%232A8215&green-background=%23B7F4C2&red-text-color=%23DC0001&red-background=%23FFE2E2&inner-border-color=%23CBCBCB&border-color=%23cbcbcb&bg1=%23F6F6F6&bg2=%23ffffff&open=show&last_update=show");
}
This method works in the simulator (and gives a "depreciated API" warning), but does not run when I submit my build online after signing. I have imported the parse4cn1 and cn1JSON libraries and have gone through a series of obstacles but I still receive a build error when I submit. I want to start fresh and use an alternative method if one exists. Is there a way that I can rewrite this segment of code without having to use these libraries? Maybe by using the XMLParser class?
The deprecation is for the WebBrowser class. You can use BrowserComponent directly so WebBrowser is redundant in this case.
I used XMLParser for this use case in the past. It should work with HTML as it was originally designed to show HTML.
It might also be possible to port JSoup to Codename One although I'm not sure about the scope of effort involved.
It's very possible that onLoad isn't invoked for a site you don't actually see rendered so the question is what specifically failed on the device?

how to read additional parameters in alfresco 5.1.1- aikau faceted search

Custom Search UI will be populated when user selects Complex asset in the Advance search screen drop down(apart from Folders,Contents) where 12 fields will be displayed .So when user clicks search button ,need to read those values and redirect to the alfresco repo files(org/alfresco/slingshot/search/search.get.js).We have already customized these files(search.get.js,search.lib.js) existed in the repository to suit out logic and working fine in 4.2.2;As we are migrating to 511,so we need to change this logic in customized faceted-search.get.js to read these values.How to write this logic in customized facted-search.get.js?
It's not actually possible to read those URL hash attributes in the faceted-search.get.js file because the JavaScript controller of the WebScript does not have access to that part of the URL (it only has information about the URL and the request parameters, not the hash parameters).
The hash parameters are actually handled on the client-side by the AlfSearchList widget.
Maybe you could explain what you're trying to achieve so that I can suggest an alternative - i.e. the end goal for the user, not the specifics of the coding you're trying to achieve.
We will be reading the querystring values something like below in the .get.js file.
function getNodeRef(){
var queryString = page.url.getQueryString();
var nodeRef = "NOT FOUND";
var stringArray = queryString.split("&");
for (var t = 0; t < stringArray.length; t++) {
if (stringArray[t].indexOf('nodeRef=') > -1) {
nodeRef = stringArray[t].split('=')[1];
break;
}
}
if (nodeRef !== "NOT FOUND") {
nodeRef = nodeRef.replace("://", "/");
return nodeRef;
}
else {
throw new Error("Node Reference is not found.");
}
}
It may be help you and we will wait for Dave Drapper suggestion also.

Pdf Generation using Rotativa in ASP.Net MVC5

I am Generating PDF using Rotativa. Below is my Function to generate PDF:
public ActionResult GeneratePDF()
{
return new ViewAsPdf("pdfView")
{
FileName = "Fee_Challan.pdf",
PageOrientation = Orientation.Landscape,
PageSize = Size.A4,
PageMargins = { Left = 10, Right = 10, Top = 15, Bottom = 22 },
MinimumFontSize = 7,
PageHeight = 40
};
}
I'm Calling this function from Create method. When I call it in return RedirectToAction("GeneratePDF"); it works fine.
But when I call it before the return statement, it does not work.
GeneratePDF(); //this does not work. But I want to use this approach.
return RedirectToAction("index","Applicants");
I want to load another view after PDF is generated, that is why I don't want to call GeneratePDF() in RedirectToAction(). The debugger shows that the method is being executed fine. Tell my why it is not Working.
It is not working because in your case the GeneratePDF() method indeed returns a view as pdf. So what are you doing with it? The answer is: Nothing!
GeneratePDF(); //this returns an ActionResult which contains your pdf, but you do nothing with it here
return RedirectToAction("index","Applicants"); // this redirects the user to another action
So in this case you can only redirect the user to another action or return the pdf. You can not have two return statements in the same method.
In order to make the user not being able to generate the same pdf again (which should be harmless, so which would be the problem if the user wants the pdf again? but it's your choice how you want your application to work) you will have to disable (hide or even redirect to another page, etc.) using javascript.
Hope this covers it all. Cheers!

Concrete5.7.5.2 - non-english URL in Topics pages

My Topics are not in English. So, when I go a page for any topic (from a page list block), the last bit of that topics page URL in also in the same language. Is there any way to change that? Is there any way to change the Topics URL to English while leaving the topics names in another language? The same way as the page name - you can change the page URL in the SEO section to whatever you want, the page name and page URL can be different. How can I do that for topics?
I found this in the topic list block:
public function getTopicLink(\Concrete\Core\Tree\Node\Node $topic = null)
{
if ($this->cParentID) {
$c = \Page::getByID($this->cParentID);
} else {
$c = \Page::getCurrentPage();
}
if ($topic) {
$nodeName = $topic->getTreeNodeName();
$nodeName = strtolower($nodeName); // convert to lowercase
$nodeName = Core::make('helper/text')->encodePath($nodeName); // urlencode
return \URL::page($c, 'topic', $topic->getTreeNodeID(), $nodeName);
} else {
return \URL::page($c);
}
}
I guess I have to convert the nodeName to English somehow. Maybe with the transliteration tool which is used in the page (which is I don't know where)?
Thank you very much.

Annotation in pdfclown

I am trying to put a sticky note at some x,y location. For this i am using the pdfclown annotation class in .net.
Below is what is available.
using files = org.pdfclown.files;
public override bool Run()
{
files::File file = new files::File();
Document document = file.Document;
Populate(document);
Serialize(file, false, "Annotations", "inserting annotations");
return true;
}
private void Populate(Document document)
{
Page page = new Page(document);
document.Pages.Add(page);
PrimitiveComposer composer = new PrimitiveComposer(page);
StandardType1Font font = new StandardType1Font(document, StandardType1Font.FamilyEnum.Courier, true, false);
composer.SetFont(font, 12);
annotations::Note note = new annotations::Note(page, new Point(78, 658), "this is my annotation...");
note.IconType = annotations::Note.IconTypeEnum.Help;
note.ModificationDate = new DateTime();
note.IsOpen = true;
composer.Flush();
}
Link for annotation
This is putting a sticky note at 78, 658 cordinates in a blank pdf.
The problem is that i want that sticky note in a particular pdf which has some data. How can i modify it...thanks for the help..
I'm the author of PDF Clown -- this is the right way to insert an annotation like a sticky note into an existing page:
using org.pdfclown.documents;
using annotations = org.pdfclown.documents.interaction.annotations;
using files = org.pdfclown.files;
using System.Drawing;
. . .
// Open the PDF file!
using(files::File file = new files::File(#"C:\mypath\myfile.pdf"))
{
// Get the document (high-level representation of the PDF file)!
Document document = file.Document;
// Get, e.g., the first page of the document!
Page page = document.Pages[0];
// Insert your sticky note into the page!
annotations::Note note = new annotations::Note(page, new Point(78, 658), "this is my annotation...");
note.IconType = annotations::Note.IconTypeEnum.Help;
note.ModificationDate = new DateTime();
note.IsOpen = true;
// Save the PDF file!
file.Save(files::SerializationModeEnum.Incremental);
}
Please consider that there are lots of options about the way you can save your file (to an output (in-memory) stream, to a distinct path, as a compacted file, as an appended file...).
If you look at the 50+ samples accompanying the library's distribution, along with the API documentation, you can discover how expressive and powerful it is. Its architecture strictly adheres to the official Adobe PDF Reference 1.7.
enjoy!

Resources