how to redirect pages in jsf 2? - redirect

i have a simple menu on jsf:
<h:panelGroup id="panelMenu">
<h:form id="menuForm">
<ul class="nav nav-tabs" id="myTab">
<li class="active"><h:outputLink value="contenido/Agrupaciones.xhtml"><h:outputText value="Agrupaciones" /></h:outputLink></li>
<li><h:outputLink value="contenido/Usuarios.xhtml" ><h:outputText value="Usuarios" /></h:outputLink></li>
<li><h:outputLink value="contenido/Modulos.xhtml" ><h:outputText value="Modulos" /></h:outputLink></li>
<li><h:outputLink value="contenido/Roles.xhtml" ><h:outputText value="Roles" /></h:outputLink></li>
</ul>
</h:form>
</h:panelGroup>
it works ok, but when im on one of my pages.. let say "users.xhtml" and from that page i go to another like "details" <h:outputLink value="../contenido/detalleUsuario.xhtml">, when i click again in my principal menu to go back to "users" the url looks like this:
contenido/contenido/Usuarios.xhtml when it should be contenido/Users.xhtml. so i get a "page not found error".

Use <h:link> instead of <h:outputLink>. The <h:link> treats the path as navigation case outcome and will always resolve it relative to the context path. So you can safely start the outcome with / without worrying about the context path.
<li class="active"><h:link value="Agrupaciones" outcome="/contenido/Agrupaciones.xhtml" /></li>
<li><h:link value="Usuarios" outcome="/contenido/Usuarios.xhtml" /></li>
<li><h:link value="Modulos" outcome="/contenido/Modulos.xhtml" /></li>
<li><h:link value="Roles" outcome="/contenido/Roles.xhtml" /></li>
Note that those links doesn't require a form at all. So the whole <h:form> as you've in your code is completely superfluous.

Related

remove tag and add additional css class to data-sly-resource

Here's my code and I want to add another css class toggleable-content to the existing code:
<sly data-sly-resource="${'item' # resourceType='components/header'}"></sly>
This code would look something like this:
<section aria-label="aria label">
<ul class="row">
<li class="col">
<div class="body px-3">
<h2 class="h3">
body
</h2>
<p>body text</p>
</div>
</li>
</ul>
</section>
I want to remove section tag and add another css class toggleable-content to the <ul> tag. Below is what I'd like to achieve:
<ul class="row toggleable-content">
<li class="col">
<div class="body px-3">
<h2 class="h3">
body
</h2>
<p>body text</p>
</div>
</li>
</ul>
I was wondering how to use slightly to achieve the above? I tried something below but it doesn't work:
<sly data-sly-resource="${'item' # resourceType='components/header', cssClassName='toggleable-content'}"></sly>
Assuming the section markup is managed by the included resource (components/header) then you cannot do it directly. Indirectly, with AEM, you can pass a parameter (through request attributes) and retrieve it in the components/header model, then add the section conditionally (using data-sly-unwrap for example).
Or you re-organize your code and switch from resource inclusion to template calling and pass the parameter directly using data-sly-call.

GTM - Track all downloads except certain classes

I currently have a trigger in GTM that tracks when certain documents are downloaded, such as pdfs, xlsx, png, docx, jpg... etc..
This is setup to track on the entire site, however I have a specific section that I don't want tracked by this catch all.
I've been trying to add an exception that says if a download link contains the class "Library_Download" then don't track it under the catch all trigger.
I'm trying to bring more clarity to what types of files are being downloaded.
I have tried adding exceptions to the tag, or adding validation to the trigger that and I seem to be missing something.
Catch All Trigger
Trigger Type: Click - Just Links
Trigger Fires On: Element URL Path - matches RegEx
\.(pdf|xlsx|png|docx|jpg|jpeg|zip|pat|dwg)$
How do I not count any link that contains the class "Library_Download" Or is there another way I should have them omitted?
I've created the following trigger and added it as an exception to the tag but it didn't work.
Trigger Type: Custom Event
Event name: \* (Enabled regex matching)
Trigger Fires on: Click Class - contains - "Library_booking"
Nov 21 Edit
So to clarify a bit more with HTML. Below is what I'm currently using for my library_download link. I'm currently only concerned with the pdfdownload.pdf
<div class="resource_row">
<div class="resource_item large <?php echo $post->post_name; ?>" data-filter-item data-filter-name="<?php echo $post->post_name; ?>">
<a href="www.librarywebsite.com/librarypage/" ><?php the_post_thumbnail('medium'); ?></a>
<p><?php the_title(); ?></p>
<ul class="resource_icons">
<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon-download.png" alt="Download PDF" /></li>
<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon-library.png" alt="library" /></li>
</ul>
</div>
</div>
This is how a regular link would look like (the only thing that's changed is I have removed the class Library_Download
<div class="resource_row">
<div class="resource_item large <?php echo $post->post_name; ?>" data-filter-item data-filter-name="<?php echo $post->post_name; ?>">
<a href="www.librarywebsite.com/librarypage/" ><?php the_post_thumbnail('medium'); ?></a>
<p><?php the_title(); ?></p>
<ul class="resource_icons">
<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon-download.png" alt="Download PDF" /></li>
<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon-library.png" alt="library" /></li>
</ul>
</div>
</div>
Like I've mentioned my catch all trigger currently get's triggered on every single PDF download, I just want to omit the links that have class "Library_download".
In my opinion you made a mistake in your regex in "Custom Event" exclusion rule (that's why this rule doesn't work). You have "\*" (with regex matching checked). Try to change regex to:
.*
This will match every event (and then of course preserve this: Trigger Fires on: Click Class - contains - "Library_booking").
In your case regex like this: "\*" will match only to event strictly named as "*" (star)

How to locate multiple text element within class in Protractor?

For on my test i need to verify highlighted text (Lexington, KY) using my protractor test.
<li id="address" class="list">
<div class="content">
<small class="mb-1">
<span>
Suite # 278
<br>
</span>
**Lexington, KY**
</small>
</li>
How to verify highlighted text using css OR cssContainingText locator?
Actually Protractor creators have put great documentation in place , and pls read it thoroughly to gain good knowledge on usage of css & cssContainingText. I will answer your question in short here - Use element(by.cssContainingText('.content','Lexington'))
UPDATE 1:
In case you want to add an assertion .. do this - expect(element(by.cssContainingText('.content','Lexington'))).toContain('Lexington, KY')
For one I am confused because it seems like you are never closing the content div...is it closed after the li is closed?
Anyway...I would simply change the HTML so that you don't need some crazy convoluted mess of a selector. I would do it like this:
<li id="address" class="list">
<div class="content">
<small class="mb-1">
<span>
Suite # 278
<br>
</span>
<cityState>Lexington, KY</cityState>
</small>
</li>
function checkCityState(){
return element(by.tagName('cityState')).getText();
}
expect(checkCityState()).toBe('Lexington, KY');

TYPO3 merge list and edit

I've got a TYPO3 backend module which lists a lot of elements. Now, I want to include in my list the edit form, but that doesn't work well at the moment.
Rendering is good, but if I send the form, I get the error:
Required argument "note" is not set.
My code looks like this:
<f:for each="{notes}" as="note">
<f:form action="update" name="note" object="{note}">
<textarea class="form-control gettooltip" rows="1" placeholder="Kommentar" title="Kommentar zur Note">{note.kommentar}</textarea>
</f:form>
</f:for>
How can I merge these two views correctly?
Your code cannot work because your textarea doesn't have a property (or you don't use the <f:form.textarea ViewHelper).
If you property map $note in your controller, the property must be passed to Fluid with the prefixed extension name and plugin name. This is done automatically when using the "property" argument of the textarea ViewHelper. The name attribute will then be:
<textarea name="tx_myext_myplugin[note]"...
Thîs will map to $note in the controller.
So if you don't use the ViewHelper, you need to manually prefix the name attribute to create an output like printed just above.
If you're planning to update multiple objects of the of the same kind in one request, this won't because because there is an Extbase limitation.
You could do the following:
Use a submit button for each note and save/reload the changes through AJAX.
<f:for each="{notes}" as="note">
<f:form action="update" name="note" object="{note}">
<f:form.textarea class="form-control gettooltip" placeholder="Kommentar" property="kommentar">{note.kommentar}</f:form.textarea>
<f:form.submit value="Update" />
</f:form>
</f:for>
Then you intercept the submit click, submit the form through AJAX and set the new content to the textarea.
If you want to have one form for all objects, you will need to prefix the fields
<f:form action="update" name="note">
<f:for each="{notes}" as="note">
<f:form.textarea class="form-control gettooltip" placeholder="Kommentar" name="note[note{note.uid}][kommentar]">{note.kommentar}</f:form.textarea>
</f:for>
<f:form.submit value="Update" />
</f:form>
You will then have an array of values and need to iterate in your controller and manually persist the changes.
For your problem - as #lorenz answered you need to use viewhelpers for rendering fields OR at least use valid name attributes for your fields...
Anyway, I'm wondering why do you want to reinvent the wheel - especially while creating BE modules, the fastest, easiest and most elegant way is... using TYPO3 forms. They handle many things, relations, localization, validation, RTE etc, etc. What's more you can also add own type of field to TCA and process with your own PHP and JS - very rare situation, but may be used i.e. for adding GoogleMap field,
#see: user type in TCA
Finally all you need to open the record from your BE module is creating proper link - which can be easily copied from List module (right click on the yellow pencil next to your record and copy the code), sample:
<a href="#" onclick="window.location.href='alt_doc.php?returnUrl='+T3_THIS_LOCATION+'&edit[fe_users][1234]=edit'; return false;" title="Edit user">
<span title="" class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-open"> </span>
</a>
Where fe_users is table name and 1234 is record uid.
alt_doc.php?returnUrl='+T3_THIS_LOCATION part handles returning to the place from which edit was started, so it will be your module again including all GET params selected by admin before editing.
For creating new user
<a href="#" onclick="window.location.href='alt_doc.php?returnUrl='+T3_THIS_LOCATION+'&edit[fe_users][6789]=new'; return false;" title="New record">
<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new"> </span>
</a>
In this case 6789 is a PID (uid of the page where the user should be created...
You can even set some default values when creating records from your own module using params in your new link:
&defVals[table_name][field_name]=value
sample
<a href="#" onclick="window.location.href='alt_doc.php?returnUrl='+T3_THIS_LOCATION+'&edit[fe_users][6789]=new&defVals[fe_users][tx_extbase_type]=Tx_MyExt_People&defVals[fe_users][usergroup]=1'; return false;" title="New record">
<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new"> </span>
</a>

Knockoutjs sortable with helper:clone, doesn't clone and moves the original item

Strange issue, I am struggling for couple days. I have a simple knockoutjs sortable page that binds to 2 lists as below. I would like to move copy an item from list A to B. I tried passing helper: 'clone' in options as in documentation, but it doesn’t create a copy and moves the original item.
Here is the http://jsfiddle.net/a5FL5/13/, that shows the problem. Try moving item from list A to B, and it moves the original item, and no copy is created.
I haven’t been able to figure out what the issues. Any help is appreciated.
<div class="A">
<ul data-bind="sortable: { data:stagingList.filteredTodos , options: {helper: 'clone', connectToSortable: '.okay'}}">
<li data-bind="text: itemlist"> </li>
</ul>
</div>
<div class="B">
<ul data-bind="sortable: { data: dayList.dfilteredTodos }">
<li class="okay" data-bind="text: itemlist"> </li>
</ul>
</div>
Regards
Srini