SharePoint Content Query Web Part question - sharepoint-2010

I'm using CQW to display announcement list. Only problem I'm facing to provide "Add new announcement" button like the one having in Announcement list.Here is my CQW ,
I've tried adding custom "Add new Announcement" link from SharePoint designer. But this solution looks ugly. Can we provide exact button and the interface which default "Add new announcement" link provides ? Please not it's on web part page.
Here is my SPD if someone want to see,

Editing the XSLT can be your solution.
If the repeating is the only thing that stops you from modifying the XSLT, we have to solve that.
You can stop the repeating by using a check on the current position. Only add the link when the position is 1.
Define the current position and use it:
<xsl:param name="CurPos" />
<xsl:if test="$CurPos = 1">
<![CDATA[ Here your link can be placed ]]>
</xsl:if>

Related

How can I change the styleClass of a control while also doing a partial refresh on another component?

I have a straightforward XPage that lets a user answer a question with a simple Yes/No/NA response using radio buttons. I have restyled the radio buttons to look like a bootstrap button group to make it visually more interesting for the user. If the user chooses "Fail" then they are informed that they need to do something else - easily done with a simple partial refresh to a div further down the page.
This all works fine.
The problem I'm having is that I'd like it so that when the user selects an option, I would like to add a new class of "active" to the selected option so that it highlights in a pretty colour. But for the life of me I can't get this to work and though I'm sure it's a straight forward problem, I can no longer see the wood for the trees.
My current (abridged) iteration of the radio button code is this:
<xp:div styleClass="btn-group item-result" id="edit-result" loaded="${Question.open}">
<xp:radio text="${lbl.kwPass1}" id="itemPass"
styleClass="btn btn-pass #{(item.itemResult eq '0')?'active':''}" groupName="itemResult"
selectedValue="1">
<xp:eventHandler event="onchange" submit="true"
refreshMode="partial" refreshId="actionAlert">
<xp:this.script><![CDATA[XSP.partialRefreshPost('#{id:edit-result}');]]></xp:this.script>
</xp:eventHandler>
</xp:radio>
<!-- other radio buttons -->
</xp:div>
<!-- other page compenents -->
<xp:panel id="actionAlert">
<!-- panel content and appropriate rendered value -->
</xp:panel>
This was attempting to do a chained partial refresh on the radio button container so that the EL would evaluate and apply/remove the 'active' style based on the document datasource ('item') value. I have also tried using dojo.addClass, dojo.removeClass, XSP.partialRefreshGet and other options. I don't mind what the solution is as long as it's efficient and works. I'd prefer not to move the actionAlert panel to within the same container as the radio buttons and I can't do a full page refresh because there are other fields which will lose their values.
Some notes:
I'm not using a RadioGroup control because it outputs a table and I haven't got around to writing my own renderer for it yet. Single Radio button controls work fine for what I need them to do.
I originally tried using the full Bootstrap solution of using "data-toggle='buttons'" (source) which sorts out applying the "active" style fine but then, inevitably, prevents the partial refresh from working.
the radio button styles are clearly not Bootstrap standard
Any assistance pointers or, preferably, working solutions would be appreciated.
You need to aim your partial refresh at the div containing all your radio buttons. Give it an id, so you can address it.
Partial refresh, as the name implies, refreshes one element and its content only. So you target the element that covers all of the items you need to recompute.
Stepping away from the problem, a couple of beers and an episode of iZombie later, I realized what I was doing wrong and sorted it out. So, for posterity, here is the simple solution that I swear I tried earlier but clearly works now:
<xp:div styleClass="btn-group item-result" id="edit-result" loaded="${Question.open}">
<xp:radio text="${lbl.kwPass1}" id="itemPass" value="#{item.ItemResult}"
styleClass="btn btn-pass" groupName="itemResult" selectedValue="1">
<xp:eventHandler event="onchange" submit="true" refreshMode="partial" refreshId="actionAlert">
<xp:this.script><![CDATA[dojo.query('.item-result > .btn').removeClass('active');
dojo.query('.btn-pass').addClass('active');]]></xp:this.script>
</xp:eventHandler>
</xp:radio>
<!-- et cetera -->
The many places I was going wrong:
In my code in the question, I was calling XSP.partialRefreshPost in the CSJS script of the radio button when it should have been in the onComplete of the eventHandler. It has to be chained to another partial refresh so that it runs after it, not at the same time. I did end up getting this right - but overlooked something I'll come to in point 3.
In my original attempt to use Dojo, my first mistake was to try and target the ID of the radio button, something like:
dojo.addClass(dojo.byId('#{id:radio2}'),'active');
This actually works as expected, so long as you remember that the ID of the radio button on the XPage refers to the actual radio button control and not the label wrapping; and the label is what I wanted to style. So the class "active" was being actually being added, just not to the element I thought it was. I should have spotted this in my browser code inspector except for the third thing I got wrong:
Ironically, I sorted out the first issue, remembering to put the XSP.partialRefreshPost into the onComplete - and then didn't remove it when trying to run the Dojo.addClass(). So I didn't notice the mistake with the addClass targeting the wrong element because after it ran, the partial refresh updated the container and removed the class I had just added which made me think that nothing was working.
So now I have some neatly styled radio buttons that don't look like radio buttons and it's all managed client side without any unnecessary partial refresh trips to the server barring the one where I actually need to look stuff up from the server. And the vital lesson is - sometimes you just need to step away from a problem and come back to it with fresh eyes later on.

collapse bookmarks by default in dita 1.8.4

i have a working customization, but what i cannot figure out is, how to set the bookmarks in my pdf document to 'collapsed' by default.
i tried to paste
<property name="args.bookmark.style" value="COLLAPSED" />
into my build file, as well as into build.xml, build_template.xml and build.properties in the plugin and customization folder.
Nothing seems to have an effect on this.
Am i missing a step?
(I have been wondering if there was something in my customization which would automatically leave the bookmarks expanded, but I do not know where to look for this... I am pretty sure this is not the problem)
Thanks in advance!
If you look in this XSLT stylesheet:
DITA-OT/plugins/org.dita.pdf2/cfg/fo/attrs/basic-settings.xsl
there is a parameter called "bookmarkStyle" which gets its value from the ANT build files.
<xsl:param name="bookmarkStyle">
<xsl:choose>
<xsl:when test="$antArgsBookmarkStyle!=''"><xsl:value-of select="$antArgsBookmarkStyle"/></xsl:when>
<xsl:otherwise>COLLAPSED</xsl:otherwise>
</xsl:choose>
</xsl:param>
As you can see, the default value for that parameter is COLLAPSED so you should do nothing to obtain this default behavior, I tested and the bookmarks area in a generated PDF only shows the top-level topic references.
You can also add an xsl:message in that parameter and see the value it receives from the build files.
Maybe you have another expectation of what args.bookmark.style was intended to be used for.
I finally found out what was the problem.
There was no need to change any ANT properties.
All it needs is to add the following attribute:
<xsl:attribute name="starting-state">hide</xsl:attribute>
in the template:
<xsl:template match="*[contains(#class, ' topic/topic ')]" mode="bookmark">

window.location.href('#Url.Action("UserDetails", "User")')

I am using Visual Studio 2010. Also I am using Razor and trying to develop an MVC application. I am using MVC4 and HTML5. I have following code
<input type="button" value="Click Me"
onclick = "window.location.href('#Url.Action("UserDetails", "User")')" />
Where UserDetails is my action and User is my controller. Whenever I click the button Click Me, User Details is returned. This happens properly in IE. But the same is not working for Mozilla and Chrome. an anyone suggest me on this. I went through google, and I have seen that many people faced the same issue. I tried couple of approaches given, but I could not be successful.Can you please tell where am I going wrong.
Regards
If your button's purpose is purely to redirect to another view, you should use a HTML Anchor (a) instead of an input element:
#Html.ActionLink("Click Me", "UserDetails", "User", null, new { #class = "button" })
This will render as:
Click Me
Then you can use the button class to style your link as you wish (ie. make it look like an input button, if that's your desire).

In Dojo, how to programmatically click root of a Tree?

I am creating a web application using Dojo, composed of a treeView in the left side and a Data Grid on its right. After being loaded,I want the root of the treeView to be focused and clicked, so that the content of the datagrid can be changed accordingly.
I haven't success in doing this..
Thanks for your help
Thanks #Philippe for the clue about logic problem. Because of this clue, I am able to focus my mind by searching the error code. I found it in the defintion of query of the grid. <table id="jurnalGrid" dojoType="dojox.grid.DataGrid" jsId="jurnalGrid" columnReordering="true" sortFields="['tanggal','kode_jurnal']" store="jurnalStore" query="{id: '*'}" I think you can guess that my query string is not correct :) I still left the code from that link without changing it to suit my need. Thanks... –

How to skip some section of text while speaking using SSML

Is there some SSML tags etc, to remove a particular line of text from speaking. Yes, I know I can remove this using string functions, before sending it to the speech synthesizer. But my question is, is there any way to mark or tag some text, so that it won't play. I am looking for some XML based solution for this issue.
There are so many ways, you should clarify what you want to accomplish.
Maybe one of these will help you:
1. standard XML comment <!-- -->
2. <sub alias=" "> your text </sub>
3. <audio src='short_silence.wav'> your text </audio>
4. <prosody volume='silent'> your text </prosody>
I'm wondering if XML commenting is a valid solution for what you're trying to accomplish:
<!-- <say-as interpret-as="telephone" format="39">+39.347.7577577</say-as> -->
Or:
<say-as interpret-as="telephone" format="39"><!-- +39.347.7577577 --></say-as>
Hope this helps.
Looking quickly at the SSML Documentation from W3C, I found the prosody element.
It looks like you might be able to skip the section by setting the volume to 0 and setting the duration to a very small value.
Setting the volume to zero should suppress the audio output, but it will likely take the same time to "read" the section as if it were being read out loud. If you set the duration as well, you should be able to essentially "skip" over the section (quickly read it silently).
You'll have to experiment to see if this works.
Using meta tag might offer some solution.
<speak>This is spoken <meta content="this is not spoken"/> </speak>