Why is Visible controlled by - xslt

In my home page I have the following snippet that fetches all blog posts:
var docs = CurrentPage.Children.Where("Visible")
What I don't understand is that Visible is controlled by a property in the document named umbracoNaviHide. Setting it to true on the document excludes the page from the list above.
How is umbracoNaviHide translated to Visible? I have no macros or XSLT (none actually) that is doing anything funny...

umbracoNaviHide is one of umbraco's internal property implementations.
We used to have to check the property explicitly in xslt but nowadays it is used as you are using it here.
Here is a more complete explanation from the Umbraco wiki
The "umbracoNaviHide" is an Umbraco convention for marking nodes which
should not show up in a navigational context. It is normally added (or
inherited) on every Document Type with a Data Type of "True/false".
NOTE: This property is not added by default on new installations,
meaning you need to add it manually
There are a number of other useful properties that everybody should know about:
umbracoSitemapHide
umbracoUrlAlias
umbracoUrlName
umbracoInternalRedirectId
umbracoRedirect
We always insert these properties on a master page doctype so that all other doc types that represent data on web page content nodes inherit them
Wing

Related

Capella links inside descriptions of elements

In Capella, in the descriptions of my model elements, I am using hypertext links towards other elements of the model. When I generate a document with M2Doc, these links are not properly transformed/interpreted.
Example: a Capella hypertext link towards the "Cabin Screen" model element...
<p>Link:</p>
<p>Cabin Screen</p>
... becomes an hypertext link with the following address in the generated Word document:
hlink://11e922f1-192b-43a5-9060-f935c26998a5/
But there is no way to "follow this link":
Resulting link in Word & Impossible navigation
What I need to achieve is to have the original link transformed in a bookmark reference (I have a bookmark for this element somewhere else in my document)
{REF 11e922f1-192b-43a5-9060-f935c26998a5 \h }
I was wondering whether one service allows to automatically transform these links in bookmark references (BookmarkRef)? If not, has this request been raised already?
This replacement depend on the way you are creating your bookmark IDs. If you are using the same way as the sample templates provided with the M2Doc IFE project, you can use the replaceLink() service. This service is only available if you install M2Doc Capella extensions. You can use it like this:
myCapellaElement.description.fromHTMLBodyString().replaceLink(myCapellaElement)
Otherwise you can have a look at the implementation to implement your own version.

Using document as a template: problem with heading numbering

The document body is hardcoded and then inserted into a template document with contains cover, summary, headers and styles. Heading styles are numbered 1, 1.1, 1.2, and so on. But to insert a heading just with 'Heading [n]' style does not work, numbering is lost. I think this happens because numbering is set through a multilevel list with headings attached.
Question: is it possible to use a document as a template without coding any formatting, or it is inevitable to deal with list styles in the code?
Yes, you can use a document as a template without any formatting. Please note that when you copy nodes from one document to another, this option specifies how formatting is resolved when both documents have a style with the same name, but different formatting.
The formatting is resolved as follows:
Built-in styles are matched using their locale independent style
identifier. User defined styles are matched using case-sensitive
style name.
If a matching style is not found in the destination document, the
style (and all styles referenced by it) are copied into the
destination document and the imported nodes are updated to reference
the new style.
If a matching style already exists in the destination document, what
happens depends on the importFormatMode parameter passed to
Document.ImportNode as described below.
When using the UseDestinationStyles option, if a matching style already exists in the destination document, the style is not copied and the imported nodes are updated to reference the existing style.
So, in your case, I suggest you please use UseDestinationStyles option while inserting one document into another.
I work with Aspose as Developer Evangelist.

Drupal 8 Webform: how to display text input on one page on the next page?

I am trying to develop a multistep webform in Drupal 8 using Webform 8.x-5.1. I have written a WebformHandler that extends Drupal\webform\Plugin\WebformHandlerBase and made it available to the webform.
In the first step of the webform, I collect a text-field. I would like to display the value of that text-field in an HTML element (Advanced HTML/Text or Basic HTML) on the second page after doing some computation.
I have overwritten submitForm() in the WebformHandler and in it assign the value I want to the HTML element as follows:
$form['elements']['page_name']
['advanced_html_element']['#text'] = '...my HTML...';
Using ksm() I can see that this assignment works, but the the HTML element is not rendered with my HTML: the element is either invisible or contains the initial value set up in the form editor.
Clearly I'm missing something. Should I be using something other than submitForm? Can anyone help me?
It's been a long haul, but I've finally worked out how to do what I want to. The following works for me.
Firstly, I discovered the method validateForm in WebformHandlerBase. On each page in a form with multiple pages, you will find that the following methods are called in the order given here:
submitForm (called once)
alterForm(called possibly more than once)
validateForm (called once)
The name validateForm leads me to believe I may be misusing this method, but that is where I set up the elements on the following page that I wish to programmatically initialise. It works, so what the hey!
In validateForm, I initialise the elements that appear on the following page as follows:
$form_state->setValue(<element name>, <data structure>);
The <element name> is the name you give the element in the form editor ("Build" tab). The <data structure> has to be correct, of course: I suggest you find the appropriate structure by first filling in the element on the next page manually and seeing what turns up in $form_state.
There is also a $form_state->getValue(<element name>), which seems to me to mean that $form_state can also be used for storing session data, say in hidden fields. I initially used Drupal::service('tempstore.private')->get('xxx') for storing data that had to be available across page boundaries, but $form_state might be a cleaner solution.
I hope this helps someone: I spent a horribly long time trying to get this to work.

HTML Purifier - Change default allowed HTML tags configuration

I want to allow a limited white list of HTML tags that users can use in my forum. So I have configured the HTML Purifier like so:
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Allowed', 'p,a[href|rel|target|title],img[src],span[style],strong,em,ul,ol,li');
$purifier = new HTMLPurifier($config);
What I am wondering is, does the default configuration of the HTML Purifier still apply, with the exception of a reduced number of accepted HTML tags or do I need to re-set every possible configuration parameter manually?
Additionally, should I tweak the default configuration in any way to stay safe? I am new to the whole XSS protection thing, new to HTML Purifier and didn't find that the manual gave a lot of 'basic' tips and hints.
HTML Purifier is safe by default and any restrictions you impose on it by changing %HTML.Allowed are guaranteed only to reduce the permitted tag set. Check out http://htmlpurifier.org/live/smoketests/printDefinition.php to see how tweaking configuration changes the allowed tagset.
Why not just use a DOM parser and check if tag type is in allowed white list of HTML tags?
Converting the input to a DOM node list you should be able to loop through all the DOM nodes and check if the type is allowed that way. php.net has great examples for how to do this written by others like you trying to solve the input sanitization problem.
More information here:
http://php.net/manual/en/class.domdocument.php

C++, web browser control: cannot change encoding/charset

There's a document I'm displaying in a web browser ActiveX control hosted in a C++ app. This document has a META tag that specifies incorrect charset, so the output is funny. I know the correct encoding and want to change it programmatically to fix that. But whatever I try, the encoding remains unchanged.
I alredy tried, in various combinations and flavors:
IHTMLDocument2::put_Charset (after the document finished loading);
changing the "charset" property of the "META" tag (using IHTMLMetaElement);
deleting the "META" tag altogether (by setting its "outerHTML" to empty string);
refreshing the control.
The control demonstrates remarkable persistence in preserving the incorrect encoding. What are my other options? I can't manipulate the source of the document being loaded.
try to put the designMode property "On".
According to this, it should work if you call IWebBrowser->Refresh() after calling IHTMLDocument2->put_charset().
Here's what eventually worked:
In the handler of the "NavigateComplete2" browser event,
the charset is modified using the charset property,
then the META tag is thrown away by setting its outerHTML to empty string,
and then the control is refreshed.
Modifying the order of these actions, or omitting a step, will render the entire operation void. MSHTML is picky.