Office Js: avoid doubling "&" symbol on ribbon button tooltip - ms-word

I am developing a Word addin with Office-js. I want to create a button in my ribbon. This button's name and tooltip should be AAA & BBB.
So, I developed the following part of the xml manifest.
<Group id="XXX.GrpYYY">
<Label resid="XXX.GrpYYY.Label"/>
<Icon>...</Icon>
<Control xsi:type="Button" id="XXX.BtnYYY">
<Label resid="XXX.BtnYYY.Label" />
<Supertip>
<Title resid="XXX.BtnYYY.Label" />
<Description resid="XXX.BtnYYY.Tooltip" />
</Supertip>
<Icon>...</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="XXX.YYY.SL" />
</Action>
</Control>
</Group>
And this is the relevant part of the Resources in the xml manifest:
<bt:ShortStrings>
...
<bt:String id="XXX.GrpYYY.Label" DefaultValue="MY GROUP" />
...
<bt:String id="XXX.BtnYYY.Label" DefaultValue="AAA & BBB" />
...
</bt:ShortStrings>
<bt:LongStrings>
...
<bt:String id="XXX.BtnYYY.Tooltip" DefaultValue="AAA & BBB" />
...
</bt:LongStrings>
This is the result:
As you can see the & symbol in the tooltip is doubled.
Is it a bug or am I doing something wrong? Is there a way to avoid doubling this symbol?

Related

Can we use PrimaryCommandSurface in Outlook add-in generated by yo office

Is there any way we can use PrimaryCommandSurface to show the add-in on the top Ribbon in the outlook add-in development, if yes Please help with the updated valid manifest.xml.
If not help with the other way how to create outlook top Ribbon commands plug-in
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<CustomTab id="Contoso Tab">
<!-- If you want to use a default tab that comes with Office, remove the above CustomTab element, and then uncomment the following OfficeTab element -->
<!-- <OfficeTab id="TabData"> -->
<Label resid="residLabel4" />
<Group id="Group1Id12">
<Label resid="residLabel4" />
<Icon>
<bt:Image size="16" resid="icon1_32x32" />
<bt:Image size="32" resid="icon1_32x32" />
<bt:Image size="80" resid="icon1_32x32" />
</Icon>
<Tooltip resid="residToolTip" />
<Control xsi:type="Button" id="Button1Id1">
<!-- information about the control -->
</Control>
<!-- other controls, as needed -->
</Group>
</CustomTab>
</ExtensionPoint>
<ExtensionPoint xsi:type="ContextMenu">
<OfficeMenu id="ContextMenuCell">
<Control xsi:type="Menu" id="ContextMenu2">
<!-- information about the control -->
</Control>
<!-- other controls, as needed -->
</OfficeMenu>
</ExtensionPoint>
The PrimaryCommandSurface stands for the ribbon in Office. In case of Outlook we deal with read or compose items, so we should use the MessageReadCommandSurface for received items, for example:
<ExtensionPoint xsi:type="MessageReadCommandSurface">
<OfficeTab id="TabDefault">
<-- OfficeTab Definition -->
</OfficeTab>
</ExtensionPoint>
The TabDefault is the idMso value of the built-in tab in Outlook.
Also you you can place controls into a custom tab in the following way:
<ExtensionPoint xsi:type="MessageReadCommandSurface">
<CustomTab id="TabCustom1">
<-- CustomTab Definition -->
</CustomTab>
</ExtensionPoint>
If you need to get a ribbon UI displayed for the composed items in Outlook you need to use the MessageComposeCommandSurface extension point that puts buttons on the ribbon for add-ins using mail compose form:
<ExtensionPoint xsi:type="MessageComposeCommandSurface">
<OfficeTab id="TabDefault">
<-- OfficeTab Definition -->
</OfficeTab>
</ExtensionPoint>
And to place controls into the custom tab:
<ExtensionPoint xsi:type="MessageComposeCommandSurface">
<CustomTab id="TabCustom1">
<-- CustomTab Definition -->
</CustomTab>
</ExtensionPoint>
See the ExtensionPoint element for more information.

alfresco tag content on create

is it possible to display tag form during document (cm:content) creation in Alfresco 5.2 share ?
I've searched in share-form-config.xml for an example and I've not found an answer.
I've tried with
<config evaluator="model-type" condition="myco:myType">
<forms>
<form>
<field-visibility>
<!-- ... -->
<!-- tags and categories -->
<show id="cm:taggable" for-mode="edit" force="true" />
<!-- ... -->
</field-visibility>
<appearance>
<!-- ... -->
<field id="cm:taggable">
<control>
<control-param name="compactMode">true</control-param>
<control-param name="params">aspect=cm:taggable</control-param>
<control-param name="createNewItemUri">/api/tag/workspace/SpacesStore</control-param>
<control-param name="createNewItemIcon">tag</control-param>
</control>
</field>
<!-- ... -->
</appearance>
</form>
</forms>
but it works only during edit forms (with <config evaluator="node-type" condition="myco:myType">, not during creation.
SOLUTION
the previous code is right except for
<!-- tags and categories -->
<show id="cm:taggable" for-mode="edit" force="true" />
which should be without the for-mode="edit" during creation of a document.
I can't tell what you are doing because you haven't included the enclosing "" element. If you want to change the form that exists for new nodes use the "model-type" evaluator, like:
<config evaluator="model-type" condition="sc:whitepaper">
The "node-type" evaluator is used for existing nodes.
If that doesn't meet your requirements you might take a look at the Uploader Plus add-on.

Validate only specific parts of the form instead of whole form

I have a whole form with a lot of components including a p:tab
When I click on p:commandButton id=c1 to submit the whole form content:
I need to validate the whole form required messages but I do need to ignore the p:tab required messages fields.
If I click on p:commandButton id=c2 inside the p:tab, I need to validate only the required messages fields inside the p:tab.
What is the best solution for this ? Thanks in advance.
You seem to be using the "God Form" anti-pattern. Everything is thrown together in a single <h:form>. This is a poor design/practice. Most sensible way would be to put the fields and buttons in separate forms so that only the related fields and buttons are in its own form so that the form submit doesn't unnecessarily submit/process/convert/validate irrelvant data in other forms.
See also:
How to use <h:form> in JSF page? Single form? Multiple forms? Nested forms?
If that's not possible due to some (strange?) design restrictions, then there are at least 2 other ways:
If you're using ajax, then you can make use of the process attribute. It defaults to #form which would process the entire form. It accepts a space separated string of (relative) client IDs of input field which you'd like to process during submit.
<p:inputText id="field1" ... required="true" />
<p:inputText id="field2" ... required="true" />
...
<p:inputText id="field3" ... required="true" />
<p:inputText id="field4" ... required="true" />
...
<p:commandButton id="c1" ... process="field1 field2" />
...
<p:commandButton id="c2" ... process="field3 field4" />
See also: Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes
If you're not using ajax, or desire a non-ajax fallback, then just check in the required attribute which button has been pressed. This is easy by checking the presence of the button's client ID in the request parameter map.
<p:inputText id="field1" ... required="#{not empty param[c1.clientId]}" />
<p:inputText id="field2" ... required="#{not empty param[c1.clientId]}" />
...
<p:inputText id="field3" ... required="#{not empty param[c2.clientId]}" />
<p:inputText id="field4" ... required="#{not empty param[c2.clientId]}" />
...
<p:commandButton id="c1" binding="#{c1}" ... />
...
<p:commandButton id="c2" binding="#{c2}" ... />
(note: no additional bean properties necessary for c1 or c2! the code is as-is)
See also How to let validation depend on the pressed button?
You can refactor this somewhat with a more self-documenting variable name:
<c:set var="c1ButtonPressed" value="#{not empty param[c1.clientId]}" />
<c:set var="c2ButtonPressed" value="#{not empty param[c2.clientId]}" />
...
<p:inputText id="field1" ... required="#{c1ButtonPressed}" />
<p:inputText id="field2" ... required="#{c1ButtonPressed}" />
...
<p:inputText id="field3" ... required="#{c2ButtonPressed}" />
<p:inputText id="field4" ... required="#{c2ButtonPressed}" />
...
<p:commandButton id="c1" binding="#{c1}" ... />
...
<p:commandButton id="c2" binding="#{c2}" ... />
FYI you can also process the id of a panel containing the controls you want to validate - example :
<p:outputPanel id="thisPanel">
<p:inputText id="field1" ... required="#{not empty param[c1.clientId]}" />
<p:inputText id="field2" ... required="#{not empty param[c1.clientId]}" />
<p:commandButton id="c2" ... process="thisPanel" />

Confluence Macro Browser autocompletion for attachments

I am trying to show all attachments (from the current page) in an auto-completed drop-down list. This is the part in the atlassian-plugin.xml which defines the parameters:
<xhtml-macro name="plugin-name" class="com.example.macro.name" key="macroname-xhtml" icon="/download/resources/${project.groupId}.${project.artifactId}/icons/macroname.png">
<category name="formatting"/>
<parameters>
<parameter name="content_input" type="confluence-content" />
<parameter name="space_input" type="spacekey" />
<parameter name="attachment_input" type="attachment" />
</parameters>
</xhtml-macro>
The confluence-content and spacekey types work just fine. It shows a textfield which autocompletes Pages and Spaces.
However, the attachment type shows a empty drop-down list (select box) which cannot auto-complete.
The official Confluence documentation says it should work like I do:
https://developer.atlassian.com/display/CONFDEV/Including+Information+in+your+Macro+for+the+Macro+Browser
I must be missing something here, but I don't know what. Anyone might know what the problem is?
If you want a drop-down list with all the attachments then you may also try the following:
<xhtml-macro name="plugin-name" class="com.example.macro.name" key="macroname-xhtml" icon="/download/resources/${project.groupId}.${project.artifactId}/icons/macroname.png">
<category name="confluence-content" />
<parameters>
<parameter name="page" type="confluence-content" required="false"
multiple="false" />
<parameter name="name" type="attachment" required="false" />
</parameters>
</xhtml-macro>
Don't change the names of the parameters
If you want to add a filter, then you need the following:
<web-resource key="macro-browser-smart-fields" name="Macro Browser Smart Fields">
<resource type="download" name="confluence-core-macro-fields.js" location="js/confluence-core-macro-fields.js" />
<dependency>confluence.editor.actions:editor-macro-browser</dependency>
<context>macro-browser</context>
</web-resource>
confluence-core-macro-fields.js
(function($) {
AJS.MacroBrowser.activateSmartFieldsAttachmentsOnPage("plugin-name", [ "png", "jpg", "gif" ]);
})(AJS.$);
I found that setting the type as attachment (following official documentation) is bugged. I have found a work-around to display attachments in a auto-complete box.
<parameter name="xsd" type="confluence-content" required="true">
<option key="type" value="attachment"/>
<option key="showKeyInPlaceholder" value="false" />
<option key="showValueInPlaceholder" value="true" />
</parameter>

Show label on the top of bar2d by fusioncharts

How can I show label on the top of the line in the bar2d graphic?
For example:
|-------------------------
| This is line!
|================= 70%
|
| This is line 2!
|====== 30%
|-------------------------
Thanks.
Natively, FusionCharts does not support this feature. However, what makes FusionCharts really amazing is the number of workaround or tweaks you can come up with to address an issue (makes my job easier too :)
Please try out the following XML snippet using a Single series Bar 2D chart.
<?xml version="1.0" encoding="UTF-8"?>
<chart caption="Monthly Unit Sales" xAxisName="Month" yAxisName="Units" showValues="1" decimals="0" formatNumberScale="0" chartRightMargin="30">
<set label="" value="0" alpha="0.1" displayValue="
Feb" />
<set label="" value="857" />
<set label="" value="0" alpha="0.1" displayValue="
Apr" />
<set label="" value="494" />
</chart>
What we have done here is used empty and invisible data-plot above the data-plots we want to showcase with the Label on top. Thereby, using the displayValue attribute in the invisible data-plot, we can recreate the visual effect of the Labels being on-top of the data-plot being displayed.
Note: The character &#10; (new line break) has been used to bring the output of the displayValue attribute, i.e. the apparent Label in this case, closer to the data-plot below.
Alternatively, you may also use the Multi-series Bar 2D chart to re-create the above mentioned effect, using the XML snippet quoted below.
<?xml version="1.0" encoding="UTF-8"?>
<chart palette="2" caption="Business Results: 2005" yaxisname="Revenue (Millions)" hovercapbg="FFFFFF" toolTipBorder="889E6D" divLineColor="999999" divLineAlpha="80" showShadow="0" canvasBgColor="FEFEFE" canvasBaseColor="FEFEFE" canvasBaseAlpha="50" divLineIsDashed="1" divLineDashLen="1" divLineDashGap="2" numberPrefix="$" numberSuffix="M" chartRightMargin="30" useRoundEdges="1" legendBorderAlpha="0">
<categories>
<category label="" />
<category label="" />
<category label="" />
</categories>
<dataset seriesname="Domestic" color="8EAC41">
<set value="0" alpha="0.1" displayValue="Hardware" />
<set value="0" alpha="0.1" displayValue="Software" />
<set value="0" alpha="0.1" displayValue="Service" />
</dataset>
<dataset seriesname="International" color="607142">
<set value="116" />
<set value="237" />
<set value="83" />
</dataset>
</chart>
I hope this helps. :D