XPages "xsp://" in rich text - what is that protocol? - xpages

I am using code I found in the sanple database that comes with the book "Mastering XPages, 2nd edition" - Chapter 11, that has a managed bean to handle the rich text.
in there, it converts html links to xsp:// links. Anyone knows what they are and how they work?
This is a sample HTML output generated by this bean, for two attachments and an Embedded image:
<p dir="ltr"><a class="xsp-inline-attachment application-vnd-openxmlformats-officedocument-spreadsheetml-sheet" href="xsp://Docum2.1.xlsx">Docum2.1.xlsx</a></p>
<p dir="ltr"> </p>
<p dir="ltr"><a class="xsp-inline-attachment application-vnd-openxmlformats-officedocument-wordprocessingml-document" href="xsp://CM034468.docx">CM034468.docx</a></p>
<p dir="ltr"> </p>
<p dir="ltr"><img src=cid:blue_lava_lamp_md_wht /></p>
I'd like to understand a bit better how this all works, as we have "invalid persisted content session id" issues that pop up often...
Thanks a bunch

Related

Nodejs writing a scraper that can read JS protected websites

nodejs is new for me, and I've just started learning web scrapers. The problem is that I need to scrap a website that is protected with JS. So I need to get phones from the website, but div with the phone number appears only after user clicks on "show number" button. Are there any ways or npm to get the numbers? Here is the website enter link description here, but it is in russian language. So the button is "показать телефоны". Thank you in advance!
Go to the page with the phone numbers and open the console and look at your network tools. When you click on a phone number it makes an ajax request and gives you a nice formatted response
{"status":"ok","phone":"+7 (727) 317-20-86","html_tooltip":"<section class=\"company-phones-tooltip\">\r\n <div class=\"company-phones-tooltip__wrap\">\r\n <header class=\"company-phones-tooltip__header\">\r\n Inform the manager that you learned the information on Allbiz.\r\n <\/header>\r\n <ul class=\"company-phones-tooltip-list\">\r\n <li class=\"company-phones-tooltip-list__item\">\r\n <div class=\"company-phones-tooltip-list__name\">\r\n management\r\n <\/div>\r\n <div class=\"company-phones-tooltip-list__number\">\r\n +7 (727) 317-20-86\r\n <\/div>\r\n <\/li>\r\n <\/ul>\r\n <footer class=\"company-phones-tooltip__footer\">\r\n <a class=\"company-phones-tooltip__link\" href=\"https:\/\/12246-kz.all.biz\/contacts\" target=\"_blank\">\r\n Show all contacts\r\n <\/a>\r\n <\/footer>\r\n <\/div>\r\n<\/section>"}
In order to emulate this you just need to make a call to the http://api.all.biz/ajax/viewphonenew/kz endpoint with the correct parameters after scraping the page. And all the query params that are needed for this endpoint is in the html element.
<div class="company-phones__wrap" data-click="company-phones" data-entid="58474" data-verify="bYjmFpAfm5QWOgIjx8cyNOARdSG3FIoPo6he2dYGLIc=" data-phone="Zk6xDyCXPMqWMXgTaCI51A24FHIsDwuy8IaF993LsHI=" data-country="kz" data-placement="company-phones-tooltip___3" data-tooltip-direction="left" data-source="list">
<div class="company-phones__code">+7(7 </div>
<div class="company-phones__main" data-ga="show-phones-list" data-ga-id="">
<div class="company-phones__btn">Показать телефоны</div>
</div>
</div>

how to make custom templates in Koken

I'm using Koken and would like to customize the template for text entries by putting the date at the top of the entry.
I hacked a call to new Date() into the core template file /admin/templates/text.tmpl.html
<div id="entry-editor">
<div id="edit-area" data-bind="html: content() ||
'<p class=\'date\'>' + new Date() + '</p>
<p class=\'media-row\'><br /></p>'">
</div>
</div> <!-- close #entry-editor -->
This works fine, but I know the perils of hacking core files.
As of this writing, I don't see an answer on the page linked as "define your own custom template types" on help.koken.me.
Without hacking core files, how can I have Koken add a date to the top of each text entry?
From http://help.koken.me/customer/portal/questions/1080677-how-to-make-custom-templates-in-koken-
Simply place a <koken:time> tag in the customized theme template.
For example, in my /storage/themes/<custom-theme-name>/essay.lens file:
<header>
<h2>
<koken:link>{{ essay.title }}</koken:link>
</h2>
<p>
<strong><koken:time show="time" /> <koken:time show="date" /></strong>
</p>
</header>

Customizing the entire markup for the orchard cms navigation zone

I've been searching high and low for the past couple of days for the file(s) in Orchard where I can customize the markup used for the navigation
Traversing the tree in the Designer Tool and looking at the template and HTML views doesn't help much seeing as the MenuItemLink renders the <li> in the HTML view but nothing renders it in the template view. So I am quite stumped.
The original markup is like so (Taken from the Designer Tools Zone [Navigation]):
<div class="zone zone-navigation">
<article class="widget-navigation widget-menu-widget widget">
<nav>
<ul class="menu menu-main-menu">
<li class="first">
Work
</li>
</ul>
</nav>
</article>
</div>
What I need is to customize the classes on the <ul> and <li> elements, really.
If possible I'd love to be able to customize it all so I didn't need the <div class="zone zone-navigation"> for example.
But is this even possible?
<li> element is rendered by MenuItem shape (Core\Shapes\MenuItem.cshtml)
<nav> and top <ul> elements are rendered by Menu shape
(Core\Shapes\Menu.cshtml)
<a> element is rendered by MenuItemLink shape (Core\Shapes\MenuItemLink.cshtml)
If you want to override the defaults, simply put appropriate Menu.cshtml, MenuItem.cshtml or MenuItemLink.cshtml files in your theme (or better - copy the default one(s) and alter). Those will be used then instead of the default ones I wrote about above.

.properties storing long text values/lists/other

I am in the process of internationalising a website and I can't seem to find a way to store large paragraphs that my contain some other tags.
For example let's say I have this : (call this example 1)
<h1> the title </h1>
<p>
... A very large paragraph ... <h:link value="click me" outocme="newPage"/> ... more text...
</p>
Or again something of this sort : (call this example 2)
<h1> check this list out </h1>
<ul>
<li> ... text here </li>
<li> ... text here </li>
<!-- more items -->
</ul>
I am in JSF 2.0 and using the bundeled resource to internationalise my page and that's working fine as there are many examples how to do this.
But what I'd like to be able to do is something like this for example 1 (msg being my variable linked to my bundle)
<h1> #{msg['page.title']} </h1>
<p> #{msg['page.largeParagraph']} </p>
And example 2 would look like this :
<h1> #{msg['page2.title']} </h1>
<ul>
#{msg['page2.myList']}
</ul>
Is there any way to do that, or do I have to resort to something like this (using example 1)
<h1> #{msg['page.title']} </h1>
<p>
#{msg['page.largeParagraph.part1']} <h:link value="#{msg['page.largeParagraph.link']} #{msg['page.largeParagraph.part2']}
</p>
The same would be for example 2 where I would need a different entry for each <li>.
What is the best practice when we are doing something of this sort?
Thank you for any input.
Edit :
It had occured to me that by default did escape characters. Therefore I have tried :
<p><h:outputText value="#{msg['page.paragraphWithLink']}" escape="false"/></p>
Unfortunately, this did not work for me.
Edit 2 :
Using escape="false" did work for <strong> but definetly does not work for <h:link>.
You cannot specify JSF components in the bundle file. They won't be parsed as part of the component tree. The webbrowser also doesn't understand JSF tags, it only understands HTML. Just plain HTML should work with <h:outputText escape="false">.
page.paragraphWithLink=lorem ipsum click me dolor sit amet

Can I use Microdata with JSF 2.0?

I found this page:
http://www.kiwi-community.eu/pages/viewpage.action?pageId=7733331
But it is rather discouraging.
Do I simply add the namespace and use the tags ?
I also seem to have a hard time finding the correct namespace...
When adding microdata to a JSF composite component in a webapp I'm working on I found that it worked fine as long as itemscope was not left with an empty value. See: how-can-i-manage-microdata-with-xslt
So something like the following is fine:
<section itemscope="itemscope" itemtype="http://schema.org/Person">
<div class="profile">
<h4 itemprop="name" ><h:outputText value="#{cc.attrs.name}"/></h4>
<h5 itemprop="title"><h:outputText value="#{cc.attrs.jobTitle}"/></h5>
<p itemprop="telephone" class="phone"><h:outputText value="#{cc.attrs.phoneNumber}"/></p>
</div>
</section>
idk what jsf is but you can use microdata in any html5 markup. check out schema.org for the namespace and linkage dude.

Resources