We have a "Home page" with multiple functionality and one of them is Account command link. Home page is define in the main-flow.xml(see below) and when we will click this link, the new flow should open.
main_page.xhtml file:
<h:commandLink value="Account" target="_blank" action="account"/>
main-flow.xml file:
<view-state id="main_page">
<transition-state on="account" to="newFlowOpen"/>
</view-state>
<view-state id="newFlowOpen" view="/Report/account.xhtml"/>
But when we click this link, than instead of opening new flow like e2s1, its simple opening new execution key with same flow execution like e1s2 which wrong.
Please advise me on this :(
Because you added "newFlowOpen" as a view-state inside the main-flow.xml thus it is a part of main-flow.xml and not an independent stand alone flow.
If you want to create an independent stand alone flow you need to create a new "account-flow.xml" in it's own path. Once you do this the account link on the "Home page" once clicked will leave the existing flow and create a new account-flow.
If holding on/remembering the the main-flow state is important... OPTIONALLY (after doing the above), you can embed the newly created stand alone account flow inside the main-flow as a subflow.
Reasons to create a subflow relationship between parent->child flow:
When you want to pass parameters or POJOs between 2 flows (without embedding the parameters inside the url)
When you want preserve the parent flow's current state(s) and return back to the parent flow once the child flow is completed.
Below is a good example of how to create a subflow:
http://www.springbyexample.org/examples/spring-web-flow-subflow-webapp.html
<!-- You would place the subflow-state below inside main-flow.xml -->
<subflow-state id="accountSubflow" subflow="account">
<input name="id" value="accountId"/> <!-- input to send to subflow-->
<input name="person" value="person" type="foo.bar.entities.Person"/> <!-- input to send to subflow for pojos you have explicitly declare the type-->
<output name="boolSuccess" /> <!-- output returned by the subflow -->
<transition on="save" to="saveForm"/> <!-- "save" = id of the <end-state id="save"> inside the subflow -->
<transition on="cancel" to="cancelForm" /> <!-- "cancel" = id of the <end-state id="cancel"> inside the subflow -->
</subflow-state>
Related
I am creating a dropdown in XUL like this:
<button id="bid" oncommand="alert(event.target.nodeName)" >
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</button>
I want to alert the value of nodeitem which is being clicked. Using event.target.nodeName giving nodeName as menuitem but using nodeValue is retuning undefined as it starts to take value of button node. How can I get the value of the menuitem clicked. I also tried $(this).val() but even that gave undefined. Using $(this).attr('value')
also didn't help. I can put oncommand for menuitem but that doesn't seem to be actual solution. Is that the only way or some method exist to get the value?
The XUL code you have in the question is non-functional. Either you should be using a <menulist> instead of a <button>, or your <button> needs the property type="menu" or type="menu-button". If you are going to use a <button> without the type="menu" property, you would actually have to open a popup in the command event handler for the <button> and then select from there. That does not appear to be what you are wanting. It is, however, quite doable. I use a construction like that in one of my add-ons, except I have it open when one of several <label> items is clicked. This allows re-use of a single <menupopup> for multiple different items in the window. In that case, the <menupopup> is a rather large amount XUL code that I did not want to repeat and maintain multiple duplicates in the XUL for the window.
The value of the <menuitem> selected:
Your actual question is how to get the value of the <menuitem> selected by the user. All of the code below is tested and functional. As you can see from the code you can get the value of the <menuitem> you select (at the time of selection) from: event.target.value.
Using a <menulist> element:
The most common element to use would be a <menulist>. This would normally be used when you are having the user select from multiple options a choice that is going to be remembered and used later, or used to adjust what is presented in the user interface. It would generally not be used to select from multiple immediate actions (which are acted upon and the choice not remembered). A <menulist> is what is used in the examples for <menuitem> and <menupopup> on MDN.
<menulist id="bid2" oncommand="alert(event.target.value)" >
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</menulist>
The above code will give you what looks like a button with a selection of <menuitem> entries when you click on it. It will alert with the value of the <menuitem> you have selected.
This will produce an item that looks like:
Which you can click on to open a drop-down list:
If you select an item:
You will get an alert:
And the object will then show your selection:
Using a <button> element:
It is also possible to use a <button> element with the property type="menu" or type="menu-button" specified. However, this provides no visual feedback to the user as to which option is currently selected. [Note: Your JavaScript could manually change the <button> label property to provide this feedback.] You could use this type of element if it is button that produces an immediate action rather than a selection that is remembered.
The code:
<button type="menu" id="bid2" label="A Button" oncommand="alert(event.target.value)">
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</button>
This will produce an item that looks like:
Which you can click on to open a drop-down list:
If you select an item:
You will get an alert:
And the object will then NOT show your selection:
If you want to set the label of the <button> to reflect the selection made by the user, you could use:
<button type="menu" id="bid2" label="A Button" oncommand="event.target.parentElement.parentElement.label=event.target.value;alert(event.target.value)">
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</button>
When three is selected, that will result in a button that looks like:
Using a <toolbarbutton>:
You could, alternately, use a <toolbarbutton>.
When not hovered, doing so would look like:
When hovered:
When open for selection:
Choices in UI design:
There are many choices that you have to make when designing your user interface. There are many different ways to get to the same effective result, with somewhat different look and feel. You really should be trying these types of options on your own. You may find the XULRunner program XUL Explorer to be of use when prototyping XUL.
Selecting UI elements and a look and feel is, in my opinion, beyond the scope of questions on stackoverflow. While you probably won't get specific XUL help, you can ask UI design questions at: the User Experience stack exchange.
I got a simple login form. I am using <p:ajax> to invoke a <p:blockUI> (see this question).
<h:commandButton id="anmeldung_button"
action="#{benutzerAnmeldung.anmelden}" value="Anmelden"
styleClass="btn btn-info btn-sm">
<p:ajax process="#form" update="#form"/>
</h:commandButton>
<p:blockUI id="block" block=":anmeldung" trigger="anmeldung_button" />
I am using <o:highlight /> to highlight invalid inputs. This works fine.
It is working with a <f:ajax> perfectly, too.
Apperently, it is not working with <p:ajax>.
How can I achieve this?
This is caused by <p:ajax> trying to refocus the active element after executing the oncomplete scripts via doEval() (as can be seen in handleReFocus() function in core.ajax.js script. However, when you submit the form by clicking the command button instead of pressing Enter while inside the input, then that active element becomes the command button itself, not the input text. You can confirm this by just using Enter key to submit the form. You'll see that the focus is done right.
There are in your particular case 2 ways to workaround this:
Make use of PrimeFaces' own autofocus facility via <p:focus> which is placed inside the form as below:
<h:form id="anmeldung">
<p:focus context="anmeldung" />
...
</h:form>
It also automatically takes into account invalidated input fields.
Set PrimeFaces.customFocus to true in JavaScript, so that handleReFocus() function won't do its job.
<script>PrimeFaces.customFocus = true;</script>
I'm trying to record a whole phone call using VoiceXML (on Nexmo).
I can make a recording or give menu prompts and forward a call seperately, but I can't work out how to do both together. I'd like to record the call from start to finish, including the forwarded call part.
I would imagine the VoiceXML would look something like this, but this isn't valid VoiceXML.
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" >
<var name="callerid" expr="123" />
<form>
<record name="recording" beep="true" dtmfterm="true" maxtime="100s">
<menu dtmf="true">
<property name="inputmodes" value="dtmf"/>
<audio src="server/forwardingnow.mp3"/>
<choice dtmf="10" next="#sales"/>
<choice dtmf="30" next="#support"/>
</menu>
<form id="sales">
<transfer name="MyCall" dest="tel:123123123" bridge="true" connecttimeout="20s"/>
</form>
<form id="support">
<transfer name="MyCall" dest="tel:123123123" bridge="true" connecttimeout="20s"/>
</form>
<catch event="connection.disconnect.hangup">
<submit next="server/voice/savecall" method="post" namelist="recording callerid" enctype="multipart/form-data"/>
</catch>
</record>
</form>
It is not possible to do this using standard VoiceXML, you either have to use vendor extensions or put your call in conference with a recording application (a single document with a single for the whole call).
We had GeneSys add this for our company about 10 years ago. (Who knows, maybe other vendors started supporting it this way since then; try it ...) In your vxml, as soon as it is entered, add this vendor-specific log line to the first block of the first form entered in order to turn on whole call recording (NOTE: they MUST each be on their own line for it to work in GeneSys, so do not reformat these 4 lines):
<log gvp:dest="calllog">
directory /myDirectoryName absolute
enable callrec type=audio/wav recsrc=mixed;
</log>
Whole call recording will automatically end when the call is disconnected; or you can end it when you want by executing this log line:
<log gvp:dest="calllog">
disable callrec;
</log>
CCXML is for this purpose.
You can use CCXML for conference and record call etc...
I have built click to call and conference recording for InterpreXer
Voximal is the VoiceXML interpreter for Asterisk.
He can manage the Asterisk Application from the VoiceXML syntaxe.
With the MixMonitor application you can record all the call and then post the result with the ot tags...
I need to refresh page in include tag, but this is load dynamically using forEach property, this is a fragment of my code:
<button onClick="... refresh include page ..."/>
<tabbox id="tb" orient="vertical" >
<tabs>
<tab forEach="${vm.columnList}" label="${each}" hflex="true"/>
</tabs>
<tabpanels>
<tabpanel forEach="${vm.columnList}" >
<include height="90%" rc="/Campaigns.zul" rca="${each}" date="${vm.date}" />
</tabpanel>
</tabpanels>
</tabbox>
I want that when the button is pressed, the page that is in the include will reload, not whole page. Try using an id to use invalidate function, but using the forEach property to load the page gave an error with repeated id.
The page is loaded using forEach because depending of the parameter that is passed the content is different and different tabs are generated.
In the onClick of the button try this
<button onClick="tb.getSelectedPanel().getFirstChild().invalidate()" />
I am using the ASP.NET MVC SiteMap provider in a project, and it is working great. I am having a tough time trying to figure out how to hide a menu item however. The menu item I want to hide from displaying in the global navigation is my "Site Map" page. Now I know that there is something called a VisibilityProvider available to me on the mvcSiteMapNode - but I can't seem to figure out how to make it work.
Taken from my answer here explaining how to hide nodes and options available.
https://stackoverflow.com/a/27095721/853295
You should use this guide on how to hide a node
https://github.com/maartenba/MvcSiteMapProvider/wiki/Advanced-Node-Visibility-with-ISiteMapNodeVisibilityProvider
Some settings you can set from the link above:
<appSettings>
<!-- Visibility will not filter to children -->
<add key="MvcSiteMapProvider_VisibilityAffectsDescendants" value="false"/>
<!-- Set default visibility provider -->
<add key="MvcSiteMapProvider_DefaultSiteMapNodeVisibiltyProvider" value="MvcSiteMapProvider.FilteredSiteMapNodeVisibilityProvider, MvcSiteMapProvider"/>
</appSettings>
Once you have added the app settings, add the following to any node you want to see in the breadcrumbs but not the menu:
visibility="SiteMapPathHelper,!*" (SiteMapPathHelper - the node is visible in the sitemappath, !* - it is invisible for all other controls)
eg:
<mvcSiteMapNode title="Administration" area="Admin" clickable="false" visibility="SiteMapPathHelper,!*" />
Other options available:
Type..........................What it Affects
CanonicalHelper.......The Canonical HTML Helper
MenuHelper..............The Menu HTML Helper
MetaRobotsHelper....The Meta Robots HTML Helper
SiteMapHelper..........The SiteMap HTML Helper
SiteMapPathHelper...The SiteMapPath HTML Helper
SiteMapTitleHelper...The Title HTML Helper
XmlSiteMapResult....The sitemaps XML output of the /sitemap.xml endpoint
First, I suggest you read this wiki page: Creating a Custom SiteMapNodeVisibilityProvider. Then for the specific node that points to your Site Map page, declare it this way:
<mvcSiteMapNode title="Site Map" controller="Home" action="Map" visibility="false" />
Now, when implementing the IsVisible method (shown in the wiki page linked above), you can do this:
string visibility = mvcNode["visibility"];
// Is a visibility attribute specified?
if (!string.IsNullOrEmpty(visibility))
{
isVisible = Convert.ToBoolean(mvcNode["visibility"]);
if (!isVisible)
{
return false;
}
}
return true;