Skip to main content
Boman.Biz

Boman.Biz

Go Search
Home
Mobile Monger
  

Changing the message during a Microsoft.SharePoint.SPLongOperation

The SPLongOperation is undoubtedly a Good Thing® to let users know that something is happening during a long processing operation. I had cause to use one the other day, and thought that it would be great to be able to change the message during the processing to let the user know which part of the Long Operation it was up to.

For example:

Using objLongOp As New SPLongOperation(Me.Page)

objLongOp.LeadingHTML = "Leading HTML"

objLongOp.TrailingHTML = "Trailing HTML"

 

objLongOp.Begin()

 

System.Threading.Thread.CurrentThread.Sleep(3000)

 

objLongOp.LeadingHTML = "New Leading HTML"

objLongOp.TrailingHTML = "New Trailing HTML"

 

System.Threading.Thread.CurrentThread.Sleep(3000)

 

objLongOp.End(Me.Page.Request.Url.ToString())

End Using

 

Would result in this screen, for 6 seconds:

I wrote a wrapper class called SPLongOperationEx to make sure that in our example after the first 3 seconds the LeadingHTML and TrailingHTML text is updated with the new values. This way you can have much longer Long Operations and still keep the user happy J

3 seconds later ...

This is a fairly trivial programming exercise once you understand how the SPLongOperation class is manipulating the browser, but I thought I would package it up into a separate class for easy re-use to save people some time.

Download the SPLongOperationEx Class here.

Microsoft Axum

A .NET language for safe, scalable and productive parallel programming through isolation, actors and message-passing. Sounds good especially if it compiles up to normal .NET assemblies!

http://www.microsoft.com/downloads/details.aspx?FamilyID=CFE70D5D-37AA-4C4C-8EEB-D4576C41BAA2&displaylang=en

Announcements Transform for CQWP
I was asked to do a roll-up for announcements and was frustrated that the Content Query WebPart does not have a out-of-the box transform for displaying announcements.  I could get the title but that was about it.
 
I have cobbled togther a transform to be put in the ItemStyle.xsl file to give the rolled-up announcements an almost identical look to the normal announcements webpart.
 
Note:
  • You need to add the Dataviewer namespace to your ItemStyle.xsl file.
  • You need to export you CQWP add "Body,text" into your commonviewfields property and import it back in.

<!-- JBoman: Start announcement transform --> 
 <xsl:template name="removeHtmlTags">
  <xsl:param name="html"/>
  <xsl:choose>
    <xsl:when test="contains($html, '&lt;')">
      <xsl:value-of select="substring-before($html, '&lt;')"/>
      <!-- Recurse through HTML -->
      <xsl:call-template name="removeHtmlTags">
        <xsl:with-param name="html" select="substring-after($html, '&gt;')"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$html"/>
    </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="Announcements" match="Row[@Style='Announcements']" mode="itemstyle">
 
  <xsl:variable name="SafeLinkUrl">
      <xsl:call-template name="OuterTemplate.GetSafeLink">
          <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
      </xsl:call-template>
  </xsl:variable>
        <xsl:variable name="LinkTarget">
            <xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if>
        </xsl:variable>
  <xsl:variable name="AuthorName">
    <xsl:call-template name="OuterTemplate.GetGroupName">
      <xsl:with-param name="GroupName" select="@Author"/>
      <xsl:with-param name="GroupType" select="'User'"/>
    </xsl:call-template>
  </xsl:variable>
       
        <xsl:variable name="TextBody">
            <xsl:call-template name="removeHtmlTags">
                <xsl:with-param name="html" select="@Body" />
            </xsl:call-template>
        </xsl:variable>
       
  <xsl:variable name="AuthorID">
    <xsl:value-of select="ddwrt:UserLookup(string(@Author) ,'ID')" />
  </xsl:variable>       

  <xsl:variable name="AuthorEmail">
    <xsl:value-of select="ddwrt:UserLookup(string(@Author) ,'EMail')" />
  </xsl:variable>   
       
<TABLE class="ms-summarycustombody">

 <TBODY>
  <TR>
   <TD class="ms-vb" style="PADDING-BOTTOM: 3px" width="80%">
    <SPAN class="ms-announcementtitle">
     <A onfocus="OnLink(this)" onclick="GoToLink(this);return false;" href="{$SafeLinkUrl}" target="_self"><xsl:value-of select="@Title"/></A>
    </SPAN>
    <BR />
    <table border="0" cellpadding="0" cellspacing="0">
     <tr>
      <td>
       by<xsl:value-of select="'&amp;nbsp;'" disable-output-escaping="yes" />
      </td>
      <!--
      <td>
       <span class="presence-status-icon">
          <img src="/_layouts/images/imnhdr.gif" onload="IMNRC('{$AuthorEmail}')" ShowOfflinePawn="1" alt="" id="{concat('MWP_pawn_',@ID,'type=sip')}" />
       </span>
      </td>
      -->
      <td>
       <a href="/_layouts/userdisp.aspx?ID={$AuthorID}"><xsl:value-of select="$AuthorName" /></a>
      </td>
     </tr>
    </table>

    <!-- Attempt at Presence icon, $ClientId is undefined :( <img src="/_layouts/images/imnhdr.gif" onload="IMNRC('{$AuthorEmail}')" ShowOfflinePawn="1" alt="" id="{concat('MWP_pawn_',$ClientId,'_',@ID,'type=sip')}" /> -->
    <!--     
    <A onclick="GoToLink(this);return false;" href="/_layouts/userdisp.aspx?ID={$AuthorID}"><xsl:value-of select="$Author" /></A>
    <IMG height="1" alt="" src="/_layouts/images/blank.gif" width="3" border="0" />
    -->
   </TD>
   <TD class="ms-vb" align="right" width="20%">
    <xsl:value-of select="'&amp;nbsp;'" disable-output-escaping="yes" />
    <xsl:value-of disable-output-escaping="no" select="ddwrt:FormatDateTime(string(@Created) ,1033 ,'d-MMM-yyyy hh:MM tt')" />
   </TD> 
  </TR>

  <TR>
   <TD class="ms-vb" colSpan="2">
    <DIV>
     <xsl:value-of select="substring($TextBody,0,200)" disable-output-escaping="yes" />
     <xsl:if test="string-length(@Body) &gt; 200">...</xsl:if>
    </DIV>
   </TD>
  </TR>
  <TR>
   <TD>
    <FONT size="1">
    <xsl:value-of select="'&amp;nbsp;'" disable-output-escaping="yes" />
    </FONT>
   </TD>
  </TR>
 </TBODY>
</TABLE>
  
 </xsl:template>
 <!-- JBoman: End announcement transform -->

Diving on the Barrier Reef

I have to say diving on The Great Barrier Reef was excellent, 29C water and plenty of fish and coral life. Although we had to travel all the way out to the "Outer Reef" to have that experience as the inner reef is a bit dead now L

LHC – A nice piece of gear

Today is the day that the guys over at CERN on the border of France and Switzerland turn on the Large Hadron Collider. The scientists say that there is almost no chance that it will create a black hole and engulf the Earth. I believe them, and continue to buy green bananas. Check out the photos here.

Google Chrome in the Wild

Google has released their own browser called "Chrome". I have installed it and given it a try and found it to be extremely fast and efficient. It looks like it will serve me well except for one thing:

WebParts: Like FireFox Chrome can't add WebParts to MOSS/WSS pages L

This is a real shame, and maybe it is because Microsoft is being evil and doing something anti-standard with the WebPart addition process – but it would be nice to completely switch over.

Get Chrome here

Mobile Monger in the News

Mobile Monger has made the news on a few sites:

Will actually have to spend some time making it more pretty J

PhotoSynth - My Desk at SDM
After discovering the new version of PhotoSynth I immediately took some photos with my phone around my desk at SDM .... only 68% Synthy, but pretty good for a first attempt :)
 
 
Make your own PhotoSynth environment!

 

If you don't know what PhotoSynth is prepare to be blown away. A couple of years ago Microsoft Labs released a version of their PhotoSynth product where you could view PhotoSynth Environments pre-compiled by the Microsoft Labs – Now they have released a version of their product where you can create your own PhotoSynth environments with your own photos. And as per the example below – the photos don't have to be of real places, recognise the famous location below?

Check it out!

J.

 

 

1 - 10 Next

 ‭(Hidden)‬ Admin Links