Add new attributes on element HTML in KB cognitive Services - azure

I want to set new attributes on element html (a or b) in answers intent.
I tried to paste the element <a href="#" onclick="try{console.log("test");}catch(i){}>Operatore</a> and the portal remove always the attribute onclick. I tried also <a href="#" onclick:try{console.log("test");}catch(i){} >Operatore</a> with result negative.
There is a way for set attribute on elements html?

Direct adding option is not yet fully functional. Instead, follow the alternative relative approach.
Use Curl tool for this operation.
From the settings tab of knowledge base, select the CURL tab.
Copy the command to the editable environment.
Follow the steps mentioned in the documentation.

Related

Kentico 9 search result transformation

We've noticed a bug when looking at French search results. in the CMS Desk, i've kept the Page Name in English for the French content. The issue is, these are showing on the French results page.
in the transformation, based off the default one, I present the clickable title like this:
<a href='<%# SearchResultUrl() %>' data-type="title" target="_blank" ><%#SearchHighlight(HTMLHelper.HTMLEncode(CMS.ExtendedControls.ControlsHelper.RemoveDynamicControls(DataHelper.GetNotEmpty(Eval("Title"), ""))), "<span class='highLight'>", "</span>")%></a>
Here's my thinking, if the Menu Caption is filled out, use that rather than title. How do i output DocumentMenuCaption without adjust the search fields on the menu page type?
I think my logic is, check if DocumentMenuCaption is emtpy, if it use, use Title.
You should be able to continue using GetNotEmpty and just pass in the DocumentMenuCaption first, something like this:
<%# GetNotEmpty(GetSearchValue("DocumentMenuCaption");Eval("Title")) %>
You may or may not need the "GetSearchValue" function, but that allows you to grab values from the object that may not be available in the default set of columns for the search results.
Alternatively, you should be able to use the IfEmpty() method:
<%# IfEmpty(GetSearchValue("DocumentMenuCaption"), Eval("Title"), GetSearchValue("DocumentMenuCaption")) %>
Both transformation methods taken from here (double check syntax on "GetNotEmpty" as there are different ways it's implemented: https://docs.kentico.com/k9/developing-websites/loading-and-displaying-data-on-websites/writing-transformations/reference-transformation-methods
You can read more about the search transformations here: https://docs.kentico.com/k9/configuring-kentico/setting-up-search-on-your-website/displaying-search-results-using-transformations

Cannot identify the object in Selenium

I cannot identify the object of the icon showed in the attached screen shot. I have shown the HTML code as well.
The ID's are getting changed dynamically.
Can anyone guide on how to identity this kind of objects in Selenium?
If the ID is always changed, I recommend using CssSelector instead.
For instance,
<div id="running_number_12345" class="icon something">...</div>
You can use locator
driver.FindElement(By.CssSelector("div[class*='icon something']"));
If your icon doesn't have any specific css pattern, I recommend adding something in class attribute. If not, you have to use complex CssSelector to find it.
Try this
driver.findElement(By.cssSelector(".icon something"));

EE alternative to WordPress shortcodes?

Any way in Expression Engine to simulate Wordpress' shortcode functionality?
I want to abide by community rules, and there's a disclaimer when clicking in the "answer" section of an existing question that says I should actually ANSWER the question, not respond to other answers.
As such, I have the same question as the one above. I am a dev with roots in WordPress and I would like to mimic the behavior of WP shortcodes in Expression Engine. All I want to do is save a snippet of code as a template that can be re-used all across my site.
For example, if I want to use an accordion menu on several pages, I could just click click while editing a page and the code appears with placeholder content that the user/dev can then replace with real content). Do I need a graphic slideshow? Click click, define the images/headings/text overlays.
As I'm posting this, I'm about to scour the EE plug-ins library but since I haven't found anything before, I wanted to post here first.
I cover an approach that I've used before in http://www.tyssendesign.com.au/articles/cms/more-stash-examples/ along with a couple of other examples of using Stash.
Short answer: there is not such a thing ... yet. The Shortcode add-on is currently in beta.
Long answer for now: use custom fields. Example: a Matrix field for your accordion, with your columns defined, and add as many row as you like. Then add tags for that in your template.
Same with a Gallery - create a Gallery field (Matrix works great for this again), then add the code to your template to build the gallery.
If these fields are made optional, then they only appear on the front-end when used.
If you want to get fancy and inject these chunks of content into your main content area, you can use NSM Transplant to do so.
Here's a simplified snippet of code I use on one site to acheive this:
{exp:nsm_transplant:body}
{inline_media}
{exp:nsm_transplant:content id="media_{row_count}"}
<figure class="{alignment}">
{exp:ifelse parse="inward"}
{if image}
{if "{alignment}" == "aligncenter"}
{exp:ce_img:make src="{image:resized}" width="860" quality="80" output='<img src="{made_url}" alt="" />'}
{if:else}
{exp:ce_img:make src="{image:resized}" width="430" quality="80" output='<img src="{made_url}" alt="" />'}
{/if}
{if:elseif video}
{if "{alignment}" == "aligncenter"}
{exp:antenna url="{video}" max_width="860"}
{if:else}
{exp:antenna url="{video}" max_width="430"}
{/if}
{if:elseif gallery}
{gallery}{embed="galleries/_embed" entry_id="{entry_id}"}{/gallery}
{/if}
{if caption}<figcaption>{caption}</figcaption>{/if}
{/exp:ifelse}
</figure>
{/exp:nsm_transplant:content}
{/inline_media}
{content}
{/exp:nsm_transplant:body}
In this case authors use {media_1}, {media_2} etc, to embed photos, videos, and galleries inside the content.
Another solution you can look at is Content Elements, which allows a more freeform method of populating an entry with a single custom field.
Hope that helps!
You can also use global variables within EE templates. You cannot use EE tags inside templates, but global variables do work. So anything that you can save as a global variable (possibly including variables made with the addon Low Variables, but I have not verified that) can be included into an EE template.
So if you need static HTML, or images, or whatever, you can absolutely mimic quite a bit of shortcode functionality by creating global vars and invoking them using the ordinary {global_var_name} syntax inside an entry field. Note that EE tags inside global variables will not get parsed, though, so you cannot use this to do an end run around parsing restrictions!

Modx Revo Wayfinder: Add extra attribute to list item of current menu

Ref: Wayfinder on Modx Revo
I've been searching extensively and couldn't find the answer.
I find a very tricky situation trying to output an extra attribute with the list item that wraps the current menu (the menu link on of the page you're currently in).
For example:
Instead of just this line..
<li class="current">This is the menu</li>
I want..
<li class="current" value="1">This is the menu</li>
see value="1"
I tried creating a chunk in relation with the &hereTpl parameter but apparently this parameter is no longer valid in Wayfinder Revo (or is it?).
I think another possible route is if there's a way for a conditional inside the &rowTpl to render the needed attribute only for the current menu but again another brick wall.
I also tried the [[+wf.attributes]] (on the list item tag in the template chunk and put the needed attribute in the Link attributes of all the the resources/documents assuming it's going to render only when the resource/document is "current" but then the attribute is just outputted to all the menu items.
Could you share a thought? thanks so much for any help.
do the following:
[[Wayfinder? &hereTpl=`navHere` (INCLUDE OTHER PARAMETERS THAT YOU LIKE)]]
In the navHere tpl write the following piece of code:
<li class="current" value="1">[[+wf.linktext]]</li>[[+wf.wrapper]]
I understand this would work out. Hope to get a response from you.

SharePoint 2007 - How To Change Attachment Paperclip Image

When a list item has an attachment, SharePoint automatically renders a paperclip image for that particular row, which indicates that the item has an attachment. Is there any way to change the image that is rendered?
The site is in a shared hosting environment, so I can't simply replace the image on the file system. Also, there are other lists that are part of the same site that should use the default image.
Is there any way to change the image that is rendered for items with an attachment on an individual list basis?
EDIT: Following is the HTML that is rendered:
<td class="ms-vb2">
<img align="absbottom" src="http://devsandbox/_layouts/images/attach.gif" alt="Attachment"/>
</td>
The only real way you'll be able to do this is to use jQuery (or some other javascript library). You'll need to locate the elements you want to update on the page and change the URL's
$('img[src*=attach.gif]').each(function() {
$(this).attr('src', '/path/to/new/image.png');
}
My jQuery may be a touch wrong but that should be near enough to give you an idea of what to do
Edit - The best way to have this down would be via a custom WebPart which renders the JavaScript. This way it can easily be dropped into any page you want
i don't know which element off the top, but I would look for it in one of the stylesheets and use SharePoint designer to do the replacement work for a specific list.
Use Firebug to inspect the element that you want to revert. This will tell you the css class and other properties used by that element. Then write your own class and add it to the core.css file or if you want, add it to the css for the Site/Site Collection through the MasterPages link in Site Settings.
EDIT
I used firebug to look at an image in SharePoint and here is how it is rendering.
<img id="img_1-2_" class="rpo-gif rpo-gif-2" border="0" style="padding: 0px;" alt="Expand/Collapse" src="/_layouts/images/minus.gif"/>
As you can see it is using a class and setting a src to '/_layouts/images/minus.gif'. Well you can go find that file in the 12Hive directory and then replace it with an image of your choice that has the same name.

Resources