Alfresco webscript text fromat line break - alfresco

I created an alfresco webscript and output file as xxx.get.text.ftl file.
In the output file(xxx.get.text.ftl), I am trying to create text version of newsletter. But I am not able to get text lines with line break.
if I put
AAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBB
I am getting as
AAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBB
Any Idea what could be the reason?
EDIT:
in my case i have page, template-instance,template and region. It turns out that when I call web script that fill the region it displays as text.But if I call full url like "www.xxx.com/news/my-news" it includes other components like template, page etc. and it turns the output to html. Because output for template or page is hard coded to text/html in surf.

If is text try to add
\n
at the end of line

Whitespace and especially new-line handling is always an issue for template languages because it is not clear whether the remove the new line after a closing template-tag or not. See the freemarker documentation for discussion: http://freemarker.org/docs/dgui_misc_whitespace.html
I think you just have to add an extra newline.

Related

Display FORMATTED XML

I am retrieving an XML document from a web service (UPS actually), and I can pull the information I need from the XML, but I can't get the XML to display in the XML format. I can get it to display in a label and literal, but its all ran together. The nodes aren't displaying. The nodes display in a text box control, but it still runs together (no brks)
Any idea how to take the XML document that i get from the service and display it just like it would if you open up an XML doc in IE?
Thanks
BTW... i have search all day for this and the only thing i could find is if i was displaying a static file, which i'm not. I also tried doing the stringbuilder/stringwriter, but no luck. I'm still pretty new at this stuff so i could be missing something.
HELP... PLEASE!
Try encompassing the XML in the
<pre>... your xml</pre>
tags.

Loss of line breaks after interference with usual mode of creating or viewing content in drupal

have created a module and two custom content types(protocol and protocol2). The module interferes with the usual mode of creating and editing the content type protocol and it changes the usual mode of viewing the content type protocol2.
In both these cases I get the problem that I lose the line breaks that where present in the textarea where the content was added, or in the case of viewing the line breaks that where stored.
That is a text entered in a textarea like this:
"Text
with
line
breaks."
ends up looking like this:
"Text with line breaks."
I have echoed the content of form_state and in both those cases I see no line breaks, and I use form_state when fetching and changing the text.
I'm not sure what the problem might be or exactly when and how that information is lost. Does anyone have any hints?
This probably means that your default text format is one that strips line breaks. Go to admin/config/content/formats to see your text formats and which one is the default.
If you want to specifically set a certain text format for your textarea in your custom module, you something like the below:
$form['yourfield'] = array(
'#type'=>'text_format',
'#format'=>'full_html',
...
...
);
Does that fix it?

seam-gen and flex

I have integrated seam and flex with FlamingoDS
I got html file from mxml file and I stored it in WebContent folder it's fine
then I want to create link named as 'Plan' in menu.xhtml
My aim is to get that html file when i clicked on this button I don't know what to do for that
so, I have created some test.xhtml in that top element is the
for the template attribute this element I have given the template.html
and I used
then for 'Plan' link I gave the view="/test.xhtml"
It's fine when I clicked on that link I am getting the test.seam file which includes our html file but this html file is coming in some fixed area with scroll bars only eventhough there is a lot of space to fit
Please help...... me
First of all, it is very difficult to read your post. Please format it more readable.
Secondly, we can only guess what's wrong when we cannot see any code. But my hunch is that you are using s:decorate that includes some formating you are not aware of. This comes in standard seam-gen. Try removing that s:decorate stuff or point to another style you wish to use.

Response.WriteFile("mymenu.aspx") Bug?

I'm using Response.WriteFile("mymenu.aspx") to write a plain text file out to an area in a MasterPage. Unfortunately it's also printing out an unknown character represented by the square character. The contents of the menu file are as followings:
<ul>
<li>Accounts</li>
</ul>
The square character is what is causing my menu to display incorrectly, pushing it down about 20 pixels. I tested putting just the HTML in the master page instead of including the file and it works fine which mean it must be down to the Response.WriteFile function. I don't suppose anyone else has encountered this problem?
EDIT: I tried the following as well, just to really make sure I wasn't doing anything stupid and that the file didn't contain anything dodgy.
<%
Dim tw As New System.IO.StreamReader(Server.MapPath("menu.aspx"))
For Each s As String In tw.ReadToEnd
Response.Write(s)
Next
%>
It worked. But that still doesn't explain Response.WriteFile behaviour.
Have a look at your text file in an editor that will show all characters including carriage returns, line feeds etc. (Notepad++ is my choice). File may have an unusual eof marker or other encoding issue from the software that created the file.
This sounds like a character encoding issue. Is this file in the same encoding as the page your using it from?
Edit
Open the file up in a hex editor make sure there are no weird characters in there.
I tested your code and it rendered correctly for me.
I have seen ASP.NET alter incoming XML strings in WebMethods before. Save the text to a file on disk before you Response.Write it to compare. Check your CSS for your LI style.

How to create a bookmarklet for creating a screen scraping?

How to create a bookmarklet like this one: http://www.vimeo.com/1626505
I want to create one the same, where to start? i want to know the work flow of how this one is working to build my own.
Thanks
A bookmarklet is just a javascript program written on a single line of code replacing the usual location attribute (http://www.somestuffhere.com) on a bookmark.
To build your own bookmarklet, I suggest you to use Firebug :
- type your code inside firebug and execute it until what you want to do is working,
- then, remove all new lines in order to have a big one line piece of code,
- create a new bookmark in your browser and, in the location field, write javascript: and copy-paste your single line of code.
You can try a simple bookmarklet by typing that directly in your browser location bar : javascript: alert('this is a very simple bookmarklet'); then type enter to execute it.
Here is a handy bookmarket builder I have sometimes used. It can squash many lines of javascript into one line that can be set as the 'target' of a bookmark
(there may very well be better ones out there than this, but its done the job well for me)

Resources