Strict Standards: Declaration of fs_ezSQL_mysql::query() should be compatible with fs_ezSQLcore::query() in /home/dor_rotman/rotman.be/blog/wp-content/plugins/firestats/lib/ezsql/mysql/ez_sql_mysql.php on line 0

Strict Standards: Declaration of fs_ezSQL_mysql::escape() should be compatible with fs_ezSQLcore::escape() in /home/dor_rotman/rotman.be/blog/wp-content/plugins/firestats/lib/ezsql/mysql/ez_sql_mysql.php on line 0

Warning: Cannot modify header information - headers already sent by (output started at /home/dor_rotman/rotman.be/blog/wp-content/plugins/firestats/lib/ezsql/mysql/ez_sql_mysql.php:0) in /home/dor_rotman/rotman.be/blog/wp-includes/feed-rss2.php on line 2
Dor Rotman's Blog » English Posts http://www.rotman.be/blog SharePoint, Office, and more.. Thu, 12 Oct 2017 22:48:41 +0000 http://wordpress.org/?v=2.3.3 en Using Javascript to Manipulate a List Form Field Title http://www.rotman.be/blog/?p=43 http://www.rotman.be/blog/?p=43#comments Fri, 12 Oct 2007 14:01:23 +0000 Dor http://www.rotman.be/blog/?p=43 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82
Lets say you want to change the text of a field title in a new item form, or in an edit-item form. You might want to do one of the following: Change the field title text Add a remark to the title Add a link Make the title a link Put some javascript The trick in doing this is also [...]]]>
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82

Lets say you want to change the text of a field title in a new item form, or in an edit-item form. You might want to do one of the following:

  • Change the field title text
  • Add a remark to the title
  • Add a link
  • Make the title a link
  • Put some javascript

The trick in doing this is also not breaking the Form Web Part, so new fields will appear in the form.

The solution is… Javascript at runtime! It’s inspired by this post for changing the default value of a field, only this time we’re talking about the title text and not the field value.

So how to do it? Easily. Open the NewForm page with SharePoint Designer and view the HTML code. Look for the main content placeholder:

<asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>

Paste this code inside it, before the table:

<!– Begin Field Link Code –>
<script type=”text/javascript”>
// Add the function so it will be called on Body_OnLoad.
_spBodyOnLoadFunctionNames.push(“AddFieldLinks”);

function AddFieldLinks()
{
  // Call the search function with an anonymous function that will 
// be executed upon finding the relevant field.
AddFieldLink(“Status”, // This anonymous function adds a link to the field’s title. function (currentText) { return currentText + “<br/>” +
GenerateLink(“policy.html”, “<u>See Status Policy Document</u>”); } ); } function GenerateLink(url, text) { return “<a target=\”_blank\” href=\”" + url + “\”>” + text + “</a>”; } function AddFieldLink(fieldName, fn) { // Get all field titles var tags = document.getElementsByTagName(“H3″); // Go through all field titles and search for the requested field. for(var i=0; i < tags.length; i++) { if((tags[i].children.length == 1) &&
(tags[i].className == “ms-standardheader”) && ((tags[i].children[0].innerText == fieldName) ||
(tags[i].children[0].innerText == fieldName + ” *”))) { // Found the field we need to update. Set its tags[i].children[0].innerHTML = fn(tags[i].children[0].innerHTML); break; } } } </script> <!– End Field Link Code –>

Now just edit the body of the AddFieldLinks function to change the title of the relevant fields.

It’s parameters are:

  • The title of the field
  • A function that returns a string for the title.
    Notice that I used an anonymous function so you can set a different behavior for each field title - for example, one will be a link, the other would be appended some text, etc…

Now just save the file, approve the unghosting, and that’s it! Smile

Here’s the result - click to enlarge:
click me!

Dor.

]]>
http://www.rotman.be/blog/?feed=rss2&p=43
SPD ‘Send Email’ Workflow Activity HTML Message Body http://www.rotman.be/blog/?p=42 http://www.rotman.be/blog/?p=42#comments Mon, 27 Aug 2007 22:20:54 +0000 Dor http://www.rotman.be/blog/?p=42 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82
Would you like to send email messages with a rich text body from your custom SharePoint Designer workflow? Well, it’s easier than you think… Appearatnly the out of the box activity sends the message body as HTML, but the editor is not rich, thus misleading us to think we can only insert simple text. However, the [...]]]>
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82

Would you like to send email messages with a rich text body from your custom SharePoint Designer workflow? Well, it’s easier than you think…

Appearatnly the out of the box activity sends the message body as HTML, but the editor is not rich, thus misleading us to think we can only insert simple text. However, the solution is to simply paste HTML code into the body. And that’s it! Open-mouthed

This way you can create messages with cool content, and align the body as RTL (Right To Left) for relevant languages such as Hebrew.

Here’s a screenshot from SharePoint Designer in Hebrew, in which I created an RTL message:

image

Tip: Check the Workflow XOML file that SPD creates before running it for the first time. (Because on the first run it will compile and workflow will become unchangable.) See the HTML string you created and run it through some HTML Decoder, to convert special characters to understandable text. Then you can make sure the HTML is OK.

]]>
http://www.rotman.be/blog/?feed=rss2&p=42
Stock Quote Web Part(s) http://www.rotman.be/blog/?p=40 http://www.rotman.be/blog/?p=40#comments Thu, 16 Aug 2007 16:58:33 +0000 Dor http://www.rotman.be/blog/?p=40 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82
Yesterday I was asked to put a web part on an internal MS site, which displays Microsoft’s stock current value and a graph to show its changes. This appeared to be easy - Yahoo offers these kind of web widgets that can be embedded in a site. However, the Yahoo widget has a big logo and [...]]]>
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82
Yesterday I was asked to put a web part on an internal MS site, which displays Microsoft’s stock current value and a graph to show its changes.

This appeared to be easy - Yahoo offers these kind of web widgets that can be embedded in a site.

However, the Yahoo widget has a big logo and commercials, and this isn’t suitable for an internal MS site. So I needed to get the data elsewhere.

After some research I found a way to do this, using MS only tools:

image

So I separated the functionality to two Web Parts:

  • Data View Web Part (created using SharePoint Designer) - to consume the Web Service
  • Content Editor Web Part - to run some javascript to get the chart image

If you’re interested in how I created the Web Parts, keep on reading. Otherwise, skip to the end of the post to download them.

1. The Stock Value Web Part

That’s easy - open up SharePoint Designer, open some SharePoint page you can edit on a test site, and connect to a data source - the MoneyCentral Web Service. You’ll get the data, which you can add to your page using the Data View Web Part.

However, there’s a problem - the Web Service output is a string that contains a lot of XML data as a String and not as a complex XML tag. SharePoint Designer doesn’t know the schema of that XML and can’t isolate just the current value of the stock from it. So I used a couple of functions to isolate the relevant text. (substring-before, substring-after.)

Then just save the page, view it in your browser, export it using the Web Part menu, and import it to wherever you want to place it. (By working on a test site and importing the Web Part, the page desination page will not be unghosted.)

2. The Stock Chart Web Part

This is a bit more tricky: you can take images straight from the MSN website, because the image source is a DLL that generates them on demand. You just need to send the right parameters.

Please notice that by using this trick, we’re actually “stealing” bandwidth and CPU from MSN’s servers. So the minimum I could do is put some nice link to MSN to give them credit..

I created a Javascript function that generates the URL:

formatChartImageSrc(symbol, fromDate, toDate, imgWidth, imgHeight)

Parameters:

  • symbol: a string containing the stock symbol name, like “MSFT”.
  • fromDate: a Date object containing the date from which to display the timeline.
  • toDate: the date in which the timeline will end (usually today)
  • imgWidth, imgHeight: Dimensions of generated image.

Here is a sample use of the function that outputs the URL for a 1-year view of the MSFT stock, until today. Then I get an IMG element with the ID “chart” and set it’s source to the generated URL.

var stockName = “MSFT”;
var toDate = new Date();
var day = 1000*60*60*24
var fromDate = new Date(toDate - day*365);

var srcUrl = formatChartImageSrc(stockName, fromDate, toDate, 300, 300);
var chartObj = document.getElementById(“chart”);
chartObj.src = srcUrl;

I place this code and the <img> tag itself in the Content Editor Web Part, and that’s it. The image will be up to date.

Download & Installation

Here are the links to the files:

Changing the stock symbol
After you save the Web Parts locally, open them in a text editor. Search and replace the word MSFT with the stock symbol you want to display. Do this before uploading the Web Parts to your website.

Importing the files to the site
To install, go to a SharePoint Site, click Site Settings and then Edit This Page. Add a Web Part to a zone, and then click the bottom link in the Add Web Part Dialog to get to the advanced mode. Now you’ll see the gallery on the side of the page. On the top of the gallery, you will see the word Browse. Click it and choose Import instead. Then pick one of the .webpart files and upload them. Drag and drop, repeat for the second file, and that’s it!

]]>
http://www.rotman.be/blog/?feed=rss2&p=40
Windows Live Writer works again on this blog! http://www.rotman.be/blog/?p=35 http://www.rotman.be/blog/?p=35#comments Fri, 20 Jul 2007 18:31:54 +0000 Dor http://www.rotman.be/blog/?p=35 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82
1. The Problem I was unable to write using this cool application for a while now. The reason was this annoying error: Invalid Server Response - The response to the blogger.getUsersBlogs method received from the weblog server was invalid. So I did some research and found this post about changing the .htaccess file. Unfortunently it didn’t solve the [...]]]>
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82

1. The Problem

I was unable to write using this cool application for a while now. The reason was this annoying error:

Invalid Server Response - The response to the blogger.getUsersBlogs method received from the weblog server was invalid.

So I did some research and found this post about changing the .htaccess file. Unfortunently it didn’t solve the problem.

Then I installed Fiddler 2, the wonderful HTTP proxy application. I started Windows Live Writer again and let it reconnect to my blog. I analyzed the response from XMLRPC.PHP after receiving the error again, and found this response from the server:

XML-RPC server accepts POST requests only.

I searched for this error and got to this post about the problem, which was close but didn’t solve it either. However, a link from the post to the support page on the PHP bug tracker showed me a different command to put in the XMLRPC.PHP file.

And it worked! Thanks Will! Open-mouthed

So now I’m writing this post using Windows Live Writer… finally!

P.S. Lovely link for troubleshooting WordPress and Windows Live Writer.

 

2. The New Stuff

So now I can do all sorts of nice things. First, I can embed videos - which I couldn’t using the WordPress default rich text editor. Also, I installed some add-ins for WLW:

You can see I can insert smilies such as these:

  • MSN  Open-mouthed
  • Yahoo Happy
  • CustomBanana(My favorite!)

And also I’m able to insert C# code and make it look cool:

MyObject obj = new MyObject(“foo”, 123);
int result = obj.DoStuff();
return result;
image

 In summary - maybe now I’ll start writing more Open-mouthed

Dor.

]]>
http://www.rotman.be/blog/?feed=rss2&p=35
Updating a list item without changing the Modified field http://www.rotman.be/blog/?p=33 http://www.rotman.be/blog/?p=33#comments Sat, 14 Jul 2007 15:56:54 +0000 Dor http://www.rotman.be/blog/?p=33 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82
In WSS 3.0, it is now possible to update a list item (SPListItem) without changing the contents of the Modified or Editor fields. This wonderful method is called SPListItem.SystemUpdate (has two overloads). This solves the annoying problem where people would see some system user account that is responsible for the last update, and the time was also [...]]]>
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82

In WSS 3.0, it is now possible to update a list item (SPListItem) without changing the contents of the Modified or Editor fields.
This wonderful method is called SPListItem.SystemUpdate (has two overloads).

This solves the annoying problem where people would see some system user account that is responsible for the last update, and the time was also some strange time in which the system account did its actions.

So here’s the code sample:

SPSite site = new SPSite(“http://server/sites/someSite”);
SPWeb web = site.OpenWeb();
SPList list = web.Lists[“ListNameHere”];

// Create new item
SPListItem item = list.Items.Add();
item[“Title”] = “New Item Title”;
item[“Modified”] = new DateTime(2000, 1, 1);
item[“Created”] = new DateTime(2000, 1, 1);
item[“Author”] = web.Users.GetByEmail(“author@mydomain.com”);
item.SystemUpdate();

// Update an item
// (Using some item ID from a pre-populated list)
SPListItem itemu = list.Items.GetItemById(2);
itemu[“Title”] = “An updated item title”;
itemu[“Author”] = web.Users.GetByEmail(“author@mydomain.com”);
itemu.SystemUpdate();
]]>
http://www.rotman.be/blog/?feed=rss2&p=33
New Outlook 2007 Preview Handlers! http://www.rotman.be/blog/?p=23 http://www.rotman.be/blog/?p=23#comments Sun, 15 Apr 2007 23:13:24 +0000 Dor http://www.rotman.be/blog/?p=23 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82
My good friend Gil Azar has developed a very cool set of preview handlers for Outlook 2007. Available file types for preview are: PDF, HTM, HTML, XML, ZIP, WMV, WMA, AVI, MP3, MIDI, and more. You can find more information about the implementation and even the source code on his page. I’m already testing it on my [...]]]>
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82

My good friend Gil Azar has developed a very cool set of preview handlers for Outlook 2007.
Available file types for preview are: PDF, HTM, HTML, XML, ZIP, WMV, WMA, AVI, MP3, MIDI, and more.
You can find more information about the implementation and even the source code on his page. I’m already testing it on my machine and so far it works great. Go download it! :)

]]>
http://www.rotman.be/blog/?feed=rss2&p=23
An interesting revelation about publishing… http://www.rotman.be/blog/?p=17 http://www.rotman.be/blog/?p=17#comments Thu, 28 Dec 2006 23:11:45 +0000 Dor http://www.rotman.be/blog/?p=17 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82
Sites that have the publishing feature active - can’t be saved as templates. This option simply dissappears from the site administration page when the feature is turned on. You can get to the “Save As Template” web page by appending the page’s address (”/_layouts…”) to the site’s URL, however this action is unsupported and sites restored [...]]]>
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82

Sites that have the publishing feature active - can’t be saved as templates. This option simply dissappears from the site administration page when the feature is turned on.

You can get to the “Save As Template” web page by appending the page’s address (”/_layouts…”) to the site’s URL, however this action is unsupported and sites restored from the saved template might be broken.

If you’d like to migrate a site that uses the publishing feature, use STSADM or SharePoint Designer’s import/export abilities. And if you don’t need publishing - don’t turn it on.

Hope this will be resolved in a hotfix….

]]>
http://www.rotman.be/blog/?feed=rss2&p=17
Windows SharePoint Services 3.0 Tools: Visual Studio 2005 extensions http://www.rotman.be/blog/?p=12 http://www.rotman.be/blog/?p=12#comments Tue, 07 Nov 2006 15:43:51 +0000 Dor http://www.rotman.be/blog/?p=12 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82
(Via Meron Fridman’s Blog) This Community Technology Preview (CTP) of the Visual Studio 2005 Extensions for Windows SharePoint Services contains the following tools to aid developers in building SharePoint applications: Visual Studio 2005 Project Templates Web Part Team Site Definition Blank Site Definition List Definition Visual Studio 2005 Item Templates (items that can be added into an existing project) Web Part Custom Field List Definition [...]]]>
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82

(Via Meron Fridman’s Blog)

This Community Technology Preview (CTP) of the Visual Studio 2005 Extensions for Windows SharePoint Services contains the following tools to aid developers in building SharePoint applications:

Visual Studio 2005 Project Templates

  • Web Part
  • Team Site Definition
  • Blank Site Definition
  • List Definition

Visual Studio 2005 Item Templates (items that can be added into an existing project)

  • Web Part
  • Custom Field
  • List Definition (with optional Event Receiver)
  • Content Type (with optional Event Receiver)
  • Module

SharePoint Solution Generator

  • This stand-alone program generates a Site Definition project from an existing SharePoint site. The program enables developers to use the browser and Microsoft Office SharePoint Designer to customize the content of their sites before creating code by using Visual Studio.

Download.

]]>
http://www.rotman.be/blog/?feed=rss2&p=12
Changing AND/OR Behavior in FREETEXT Searches http://www.rotman.be/blog/?p=11 http://www.rotman.be/blog/?p=11#comments Tue, 07 Nov 2006 13:43:47 +0000 Dor http://www.rotman.be/blog/?p=11 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82
The default functionality of search in MOSS 2007 has changed: From now on, all keywords in FREETEXT searches are linked with an “AND” operator between them. You will only receive results that contain all the words from the query. (The current product documentation is not up to date about this issue.) This means that: Searching for windows server [...]]]>
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/dor_rotman/rotman.be/blog/wp-includes/formatting.php on line 82

The default functionality of search in MOSS 2007 has changed:
From now on, all keywords in FREETEXT searches are linked with an “AND” operator between them. You will only receive results that contain all the words from the query. (The current product documentation is not up to date about this issue.)

This means that:

  • Searching for windows server will probably return results
  • Searching for windows server nonexistantword will return no results (unless you actually have a document with all of these words :)).

However, it is possible to perform an “OR” search programmatically, so that any item containing one or more of the keywords will be displayed. (Of course that items with more keywords will receive higher ranks accordingly.)

  • When using the Object Model: Set the KeywordInclusion property to All Keywords:
    query.KeywordInclusion = KeywordInclusion.AnyKeyword;
  • When using the Web Service: Insert the ImplicitAndBehavior element under the Query element and set its value to false:

    <ImplicitAndBehavior>false</ImplicitAndBehavior>

Hope this information was useful to you,
Dor.

]]>
http://www.rotman.be/blog/?feed=rss2&p=11