Insert HTML with XBL - html

Following this answer, I was able to insert some text with Firefox like this
css
body
{
-moz-binding: url(foo.xml#bar);
}
foo.xml
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="bar">
<content>
Hello world
</content>
</binding>
</bindings>
However I could not find a way to insert HTML rather text using this method.

It appears that I just need to declare the XHTML namespace
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml">
<binding id="bar">
<content>
<html:b>
Hello world
</html:b>
</content>
</binding>
</bindings>

Related

Sapui5 column adjusting

this is how my view file looks like:
<mvc:View
controllerName="abc"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:form="sap.ui.layout.form"
xmlns:l="sap.ui.layout" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
xmlns:core="sap.ui.core">
<App>
<pages>
<Page title="APP_TITLE" showHeader="false">
<content>
<Table id="configTable" mode="None" items="{ path : '/'}">
<columns>
<Column id="bname">
<Text text="BOOKING_NAME"></Text>
</Column>
<Column> <Button icon="sap-icon://message-information" text="Info" type="Emphasized" press="handleMessagePopoverPress"/>
</Column>
<Column hAlign="Right" id="addItem" width="2em"></Column>
</columns>
</Table>
</content>
<footer>
<Toolbar class="sapContrast sapContrastPlus" width="100%">
</Toolbar>
</footer>
</Page>
</pages>
</App>
which will produce the following UI:
as you can see that button just destroys the whole column, there is a lot of space under BOOKING_NAME how can I adjust the size of the button to the column so it doesn't scratch everything? if that's not possible how can I align the text to the center of the column, I tried vAlign="Middle" but nothing changed..... I don't find anything in the sapui5 doc
actually just solved this by adding another column in that layout and instead of using an button and icon I just implemented the icon
<mvc:View
controllerName="local.controller"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:form="sap.ui.layout.form"
xmlns:l="sap.ui.layout" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
xmlns:c="sap.ui.core">
and between the colum the following:
<c:Icon src="sap-icon://message-information" size="1em" id="infoDefaultCurrency" press="onInfoButtonPressed" />
Simple workaround will be using css.You can use sapui5 predefined margin class for this.
jQuery.sap.require("sap.m.MessageToast");
sap.ui.controller("local.controller", {
doSomething: function() {
sap.m.MessageToast.show("Hello UI5 World");
}
});
var oModel = new sap.ui.model.json.JSONModel({
people: [{
name: 'Joseph',
number: 1.618
},
{
name: 'DJ',
number: 0
}
]
});
var oView = sap.ui.xmlview({
viewContent: jQuery('#view1').html()
});
oView.setModel(oModel);
oView.placeAt('content');
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8">
<title>MVC with XmlView</title>
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.m"></script>
<script id="view1" type="sapui5/xmlview">
<mvc:View controllerName="local.controller" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
<App>
<pages>
<Page title="APP_TITLE" showHeader="false">
<content>
<Table id="configTable" mode="None" items="/people">
<columns>
<Column id="bname">
<Text text="BOOKING_NAME" class="sapUiSmallMarginTop"></Text>
</Column>
<Column>
<Button icon="sap-icon://message-information" text="Info" type="Emphasized" press="handleMessagePopoverPress" />
</Column>
<Column hAlign="Right" id="addItem" width="2em"></Column>
</columns>
</Table>
</content>
<footer>
<Toolbar class="sapContrast sapContrastPlus" width="100%">
</Toolbar>
</footer>
</Page>
</pages>
</App>
</mvc:View>
</script>
</head>
<body class='sapUiBody'>
<div id='content'></div>
</body>
</html>
I have used sapUiSmallMarginTop in the sample

Package.appxmanifest not showing all 7 Tabs

I re-targeted my project from wp8 to wp8.1. At first my package.appxmanifest file's build action was not set to Appxmanifest. Also it is only showing 4 tabs
-Application
-capabilities
-Declarations
-Packaging
Tabs that are missing are
-Visual Assets
-content URI's
-Declarations
What should i do.
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
<Identity Name="37576f76-9ac9-4f78-b2d9-cb51446fb500" Publisher="CN=R" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="e4312153-3f4c-49dd-904d-5fbe8f1d6000" PhonePublisherId="3f72d71c-dd80-408e-affb-aa06372f300a" />
<Properties>
<DisplayName>app</DisplayName>
<PublisherDisplayName>app</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.3.1</OSMinVersion>
<OSMaxVersionTested>6.3.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="xe4312153y3f4cy49ddy904dy5fbe8f1d6073x" Executable="AGHost.exe" EntryPoint="MainPage.xaml">
<m3:VisualElements DisplayName="app" Square150x150Logo="Assets\SquareTile150x150.png" Square44x44Logo="Assets\Logo.png" Description="app" ForegroundText="light" BackgroundColor="#464646" ToastCapable="true">
<m3:DefaultTile Square71x71Logo="Assets\SquareTile71x71.png">
</m3:DefaultTile>
<m3:SplashScreen Image="SplashScreenImage.jpg" />
<m3:ApplicationView MinWidth="width320" />
<!--Used in XAML Designer. DO NOT REMOVE-->
</m3:VisualElements>
</Application>
</Applications>
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>AgHostSvcs.dll</Path>
<ActivatableClass ActivatableClassId="AgHost.BackgroundTask" ThreadingModel="both" />
</InProcessServer>
</Extension>
</Extensions>
<Capabilities>
<Capability Name="internetClientServer" />
<DeviceCapability Name="location" />
</Capabilities>
</Package>
Silverlight-based apps don't have those extra tabs; they are only applicable to non-Silverlight (WinRT) apps. You set things like your Tile icons via the WMAppManifest.xml file.

document.getElementById("myRewardsHistorydivXML").innerHTML rearraging closing tags

Inside a div ,place xml data for fusion chart(StackedChart3D), while getting innerHtml of div self terminated category tag are getting close in wrong order ..below is code snipshot..I am not sure what is going wrong in gatting data from DOM
Graph Data
<div id="myRewardsHistorydivXML">
<graph bgColor='F1f1f1' caption='' subcaption='' xaxisname='' yaxisname='' canvasbgcolor='F1F1F1' numdivlines='0' showLegend='1' yAxisMaxValue='50'>
**<categories font='Arial' fontSize='10' fontColor='000000'>
<category name='2011' />
<category name='2012' />
</categories>**
<dataset seriesname='My Life' color='1941A5' showValues='0' alpha='100'>
<set value='25675' color='1941A5'></set>
<set value='22475' color='1941A5'></set>
</dataset>
<dataset seriesname='My Health' color='FF0000' showValues='0' alpha='100'>
<set value='21675' color='1941A5'></set>
<set value='23531' color='1941A5'></set>
</dataset>
<graph>
</div>
in Watch Window of Browser while checking innerHTML of element document.getElementById("myRewardsHistorydivXML").innerHTML ..Its apperaing
<graph bgColor='F1f1f1' caption='' subcaption='' xaxisname='' yaxisname='' canvasbgcolor='F1F1F1' numdivlines='0' showLegend='1' yAxisMaxValue='50'>
<categories font='Arial' fontSize='10' fontColor='000000'>
**<category name='2011'>
<category name='2012'>
</category></category>**
</categories>
<dataset seriesname='My Life' color='1941A5' showValues='0' alpha='100'>
<set value='25675' color='1941A5'></set>
<set value='22475' color='1941A5'></set>
</dataset>
<dataset seriesname='My Health' color='FF0000' showValues='0' alpha='100'>
<set value='21675' color='1941A5'></set>`enter code here`
<set value='23531' color='1941A5'></set>
</dataset>
<graph>
You are dumping XML into an HTML document and the browser is trying to parse it as HTML.
<category name='2011' /> is treated as a start tag for an unrecognised element, not as a self-closing tag.
The end tags are not being rearranged, they are missing and the browser is inserting them at where it thinks the right place is to keep the DOM valid.

JSON: How to log a JSON object value from a vxml?

My aim is to log a JSON object value fethed from a jsp file from the vxml. Is there any way to do that. I see that there is a function called JSON.stringify but thats giving me nothing as a log.
Below is my code:
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<var name="userId" expr="1" />
<!--form id="get_location"-->
<data name="userData" method="get" src="http://localhost:5000/userLocation.jsp" nameList="userId" />
<property name="inputmodes" value="dtmf"/>
<menu id="menuZero">
<choice dtmf="1" next="#choice1"/>
<choice dtmf="2" next="#choice2"/>
</menu>
<!--/form-->
<form id="choice1">
<block>
<if cond="userData.HttpResponse.do_queryResponse[&apos;return&apos;].errorMsg.result_code != &apos;0&apos;">
<goto next="welcome.vxml"/>
<else/>
<goto next="welcome.vxml"/>
</if>
</block>
</form>
<form id="choice2">
<block>
<log expr="JSON.stringify(userData.HttpResponse)"/>
</block>
</form>
</vxml>
Maybe, VoiceXML is not supported "JSON.stringify".
Try to get "json2.js" and add code.
<script src="json2.js" />
For example,
<?xml version="1.0" encoding="UTF-8"?>
<vxml
version="2.0"
xmlns="http://www.w3.org/2001/vxml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<script src="json2.js" />
<var name="messageObject" expr="{keyA:'valueA',keyB:'valueB',keyC:'valueC'}" />
<form>
<block><prompt>Write Log!</prompt></block>
<block><log expr="JSON.stringify(messageObject)"/></block>
</form>
</vxml>
I tested this code on "Voxeo Prophecy 13".
I tried json2.js as described above and I had the same issue, 'assignment to undeclared variable JSON'. To fix this, I just declared in the same file (json2.js):
var JSON;
Then it worked properly. In the vxml:
<script><![CDATA[
prueba = new Object();
prueba.pepito = 1234;
prueba.OtraPrueba = "lalalapepe";
]]></script>
<log label="IVB_HISTORY">
<value expr="JSON.stringify(prueba)"/>
</log>
It gets logged as followed:
{"pepito":1234,"OtraPrueba":"lalalapepe"}
I'm using Convergy's InVision Studio

struts 2 tiles NoSuchDefinitionException

I am getting this exception when using struts 2 with tiles
org.apache.tiles.definition.NoSuchDefinitionException: /index.jsp
//tiles.xml
<tiles-definitions>
<definition name="baseLayout" template="/index.jsp">
<put-attribute name="title" value="/Template" />
<put-attribute name="header" value="/Header.jsp" />
<put-attribute name="menu" value="/Menu.jsp" />
<put-attribute name="body" value="/body.jsp" />
<put-attribute name="footer" value="/Footer.jsp" />
</definition>
<tiles-definitions>
//index.jsp
<%# taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<tiles:insertAttribute name="header"/>
<tiles:insertAttribute name="footer"/>
</body>
</html>
//web.xml
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.
DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
//struts.xml
<package name="default" namespace="/test" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="login" class="com.medics.action.LoginAction">
<result name="SUCCESS" type="tiles">/index.jsp</result>
</action>
</package>
I have searched a lot but found nothing
org.apache.tiles.definition.NoSuchDefinitionException: /index.jsp
Means that there is no tiles definition, that is no definition of the name "/index.jsp"
When using struts and tiles... Your request comes into struts then out to tiles where tiles composes the view so you shouldn't have any tiles definitions called "anything.jsp".
So just replace
<result name="SUCCESS" type="tiles">/index.jsp</result>
with
<result name="SUCCESS" type="tiles">baseLayout/result>
Now that is resolved... I would rename index.jsp, template.jsp (I think it's less confusing), why do you have a put-attribute called "/Template" ?
Now to fix the issue I recommended that you change the struts2 result target to "baseLayout" but this is probably not what you mean, so you probably want to use your baseLayout definition for new pages so add a new definition:
<definition name="index" extends="baseLayout">
<put-attribute name="title" value="My Title for Index" />
<put-attribute name="body" value="/index.jsp" />
</definition>
Now the above will take that value in defaultTemplate and add (or if the name is the same, override) what was in the base template creating a page for index.jsp, and now your struts.xml should have
<result name="SUCCESS" type="tiles">index</result>
I encountered this problem today.
Although it was a question long ago, I found the solution as below:
<result name="SUCCESS" type="dispatcher">/index.jsp</result>
Just replacing the type tiles with dispatcher works for me.