何小碩's profileGet More... ExperiencePhotosBlogListsMore ![]() | Help |
|
July 26 Vertical Marquee in Silverlightby Anish M. 2. April 2009 21:08 In IE8, it seems that the Marquee tag isn't supported anymore. Need for a Marquee replacement got me into my first Silverlight endeavour. Basically I've used the DoubleAnimation control to achieve this by altering the"To", "From" and "Duration" property. So, with little modification this can be made to rotate horizontally as well. In Settings.xml, <Images> tag holds the list of images. <Delay> tag is used to set the speed, the images rotate.The <CanvasValue> width and height maps to the outer grid and the <MarqueeValue> maps to the width and height of the listbox inside the grid. <ImageValue> is used to set the width and the height of the image control. The images are stretched to fit.
To add the Silverlight control to an aspx page add register tag to the top of the page.
Set the Source property of the silverlight control to Marquee.xap.
SPUtility - worth a lookI'd seen references to SPUtility before, and probably even used the object when basing code of blog posts I'd found on the net, but inspiration struct me the other day, and I decided to look it up in the SDK. It is a static object that contains a number of useful functions - it also contains a number of obsolete functions, and some downright weird ones (like SPUtility.HideTaiwan and SPUtility.IsEastAsia strike me as ones that won't be widely used). To access the object, you need to add the following using statement: using Microsoft.SharePoint.Utilities; I had a quick go through the SDK, an the following are what strikes me as some of the more useful functions this object provides (note, I havent used all of these yet, just went through the SDK then googled the functions I thought sounded interesting):
There are a bunch of others on there, and although they are not really very well documented, they are certainly worth a look through. posted 14 January 2009 16:24 by AussieNigel Programmatically uploading an attachment to a list item in WSS3/MOSS 2007
Removing Single File Upload Menu From Document Library Toolbar MOSS 2007Posted by: Asfar Sadewa on: February 23, 2008
Well, not exactly removing, just crippling it so it won’t function. Hahah… It all began with a guy in another department who got this persistent demand of getting rid of the single file upload button from a SharePoint document library upload menu. “We can upload single file from the multiple one, no need to have a single one.” He claimed. Hahah.. Given that I am a world-class-lazy-bum, I googled, but found that some working solutions applied globally towards the entire site collection, and not strictly to one doclib inside one site. Some claimed they have managed to do so by doing various tricks. But again, due to my acute laziness, I decided not to play around with Features, or even those object models, instead, I resorted to JavaScript. What I did was described in Lazy 101; detect the Upload Menu by it’s many possible identifier (in this case i use its’ “text” attribute), and brutally disabled it. I cunningly inserted a content editor webpart in the page where the doclib tool bar was visible, and chuckled in an insane glee. Mwhuahahahhahuahahahah … The script is as below:
[Update] Hey, guess what, a very kind guy has created a better tool for this (he’s even “featurize” it), check it here How to customise a Sharepoint list with attachmentsThis problem is pretty well documented across the MSDN forums and developer lists - only recently did I come across a solution, so in the interests of helping out anyone else who has spent months trying to get this to work - here's a brief how-to. It assumes basic knowledge of Sharepoint Designer, MOSS 2007, and a bit of XSL.
You will also need the latest patches for MOSS 2007 which allow attachments to be displayed in customised data views of lists. What we will create is a summary view of a list which contains 'more...' links to a full view of a list item, where you can download the attachment. Step 1 - AllItems.aspx Create a new List which you wish to customise. Open AllItems.aspx and customise it as an XSL Data View - or alternatively, if you wish to display your data on the default.aspx of your site, create a data view. Select a few fields to display which make a good summary, and format it as you wish. If you are using AllItems.aspx I recommend saving this under another name such as 'CurrentItems.aspx' so you don't lose your ability to edit list items. Create a link somewhere in the dvt_1.rowview template in the format: <a href="disp.aspx?ID={@ID}">More...</a>This will link you to a single item display page that we are about to create, and passes the ID of the item to be displayed. Step 2 - DispForm.aspx Next open up DispForm.aspx and revert to its Master page's content. Create a Single Item data view of your list on this page showing all of its fields. Include the Attachments field. In the dvt_1.rowview template replace the Attachments tag with this: Attachments: <SharePoint:AttachmentsField ControlMode="Display" Now we need to set a Parameter for the List Item ID so that the page will display the corresponding details of an ID passed to it: click to show Common Data View Tasks and click on Parameters. Add a new Parameter called ListItemID. For Parameter Source select Query String, for Query String Variable enter ID and for Default Value enter 0. (Lists begin their first item with an ID of 0). Next click on Filter and check the box at the bottom marked 'Add XSLT Filtering'. Click Edit.In the section marked 'Edit the XPath expression' enter: [@ID=$ListItemID] Click OK, OK again to exit the Filter menu, and save this page as 'disp.aspx'. Notice that this corresponds with the hyperlink we added above. Now go to Paging and ensure that your list is set to display all items, not just a single item. If you've set this all up correctly you should now have a full view of your list, which links to a single item view displaying the corresponding attachment for download! I'm still getting to know XSL and MOSS so I am yet to get a list to display multiple items with corresponding attachments, but I'm sure its a case of fiddling around with parameters... This entry was written by iriXx, posted on December 15, 2008 at 12:38 PM , filed under CMS, MOSS, Web geekiness. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL. Programmatically Adding, Deleting, Copying and Downloading Attachments in SPListADDING AN ATTACHMENT TO AN ITEM IN SPLIST : private void AddNewAttachment(int NodeID) { try { SPList myList = SPContext.Current.Web.Lists["Item List"]; SPListItem myNewItem = myList.GetItemById(NodeID); if (fileUpload.PostedFile != null && fileUpload.HasFile) { Stream fStream = fileUpload.PostedFile.InputStream; byte[] contents = new byte[fStream.Length]; fStream.Read(contents, 0, (int)fStream.Length); fStream.Close(); fStream.Dispose(); SPAttachmentCollection attachments = myNewItem.Attachments; string fileName = Path.GetFileName(fileUpload.PostedFile.FileName); attachments.Add(fileName, contents); myNewItem["Attached FileName"] = fileName; // store the name of the file in a column for future requirements myNewItem.Update(); } } catch (Exception eAdd) { string errAdd = eAdd.Message; } } DELETING AN ATTACHMENT FROM SPLIST : private void DeleteAttachment(int NodeID) { try { SPList myList = SPContext.Current.Web.Lists["Item List"]; SPListItem delItem = myList.GetItemById(NodeID); SPAttachmentCollection atCol = delItem.Attachments; if (delItem["Attached FileName"] != null) { string strFileName = delItem["Attached FileName"].ToString(); delItem["Attached FileName"] = string.Empty; atCol.Delete(strFileName); delItem.Update(); } } catch (Exception eDel) { string errDel = eDel.Message; } } DOWNLOADING THE ATTACHMENT : Find the download link first then reedirect to another aspx page so that the response ending on the current page does not affect the functionalities on this :- private void DownloadAttachment(int NodeID) { try { string AttachmentURL = string.Empty; SPList myList = SPContext.Current.Web.Lists["Item List"]; SPListItem attItem = myList.GetItemById(NodeID); if (attItem["Attached FileName"] != null) { AttachmentURL = “/Lists/Item%20List1/Attachments/” + NodeID.ToString() + “/” + attItem["Attached FileName"].ToString(); System.Web.HttpContext.Current.Session["FileName"] = attItem["Attached FileName"].ToString(); System.Web.HttpContext.Current.Session["Attachment"] = AttachmentURL.Trim(); } else { lblReport.Text = GetMessage(110); } if (AttachmentURL != string.Empty) Page.Response.Write(”"); } catch (Exception eDwn) { string errDwn = eDwn.Message; } } At the aspx page you need to run the code as : if(System.Web.HttpContext.Current.Session["Attachment"] != null) { string strName = System.Web.HttpContext.Current.Session["FileName"].ToString(); string sbURL = System.Web.HttpContext.Current.Session["Attachment"].ToString(); System.Web.HttpResponse response; response = System.Web.HttpContext.Current.Response; System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default; response.AppendHeader(”Content-disposition”, “attachment; filename=” + strName); response.AppendHeader(”Pragma”, “cache”); response.AppendHeader(”Cache-control”, “private”); response.Redirect(sbURL); response.End(); } Now set these sessions to null. COPYING AN ATTACHMENT FROM ONE ITEM TO ANOTHER IN SPLIST : private void CopyAttachment(int FromID, int NodeID, string AttachedFile) { try { SPList myList = SPContext.Current.Web.ParentWeb.Lists["Item List"]; SPListItem myItem = myList.GetItemById(NodeID); SPListItem myPrevItem = myList.GetItemById(FromID); SPAttachmentCollection attColl = myPrevItem.Attachments; SPFile attFile = myPrevItem.ParentList.ParentWeb.GetFile(myPrevItem.Attachments.UrlPrefix + AttachedFile); string fileRead = myPrevItem.Attachments.UrlPrefix.ToString() + AttachedFile; StreamReader fsReader = new StreamReader(attFile.OpenBinaryStream()); Stream fStream = fsReader.BaseStream; byte[] contents = new byte[fStream.Length]; fStream.Read(contents, 0, (int)fStream.Length); fStream.Close(); fStream.Dispose(); myItem.Attachments.Add(AttachedFile, contents); myItem.Update(); } catch (Exception eCopy) { string errCopy = eCopy.Message; } } Download File Reference URL : http://nehasinha.wordpress.com/2008/05/23/programmticallyc-adding-deleting-copying-and-downloading-attachments-in-splist/ Showing random images in SharePoint 2007 using jQueryIf you’ve been following my blog you know that a bit more than a year ago I’ve published the Imtech Random Image Web Part: a SharePoint web part which allows you to display random images from a list of your choice. The web part I’ve made contains some code which you would have to deploy it in your SharePoint environment to get it working. Did you actually know that you can create the same functionality using no more than a couple of lines of JavaScript and no server-side code at all? Showing random images: the ingredientsThere are two things we need to display random images. First of all an image library with some images in it. It doesn’t matter how many or what kind of images you put in there: it’s okay as long as they are viewable in the browser. The second thing we need is a Content Editor Web Part which we will use to include the JavaScript which will do the magic for us. Let’s see some random imagesFor the purpose of this case I have created a publishing site. The template you choose doesn’t really matter. A WSS3.0 Blank Site would do as well. I’ve uploaded some random photos I’ve found on Flickr to illustrate how it all works. As soon as the images list is done, let’s proceed to the page. Let’s start off with putting on the page the List View Web Part of the Images list: Nothing special here. Now let’s do the magic. Let’s add a Content Editor Web Part, edit it, and paste in the Source Editor the following piece of HTML: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> What it does? First of all I extend the jQuery framework with the “:random” filter which allows me to pick a randomly chosen element. Then, as soon as the page has been loaded I select all the links from the Images Web Part and pick a random one to display. The last thing I do is to substitute the list of images with the random image I’ve just picked: That’s all! Each time you load this page another image will be picked and displayed. What’s next?The example I’ve presented is quite simple. Because we’re using a common SharePoint list here, you could store some metadata together with the images and make them appear on the page as well. You could extend the script to add the title, description and maybe even a link to a different site: the sky is the limit. SummaryProviding custom functionality doesn’t necessarily have to mean development and deployment. By just extending the standard SharePoint functionality with JavaScript you can easily create great features which can enhance the overall experience of your application. Using the jQuery framework you can simplify creating these enhancements even more. jQuery covers for you all the basics and allows you to focus on the functionality you to provide to your users. ref:http://blog.mastykarz.nl/showing-random-images-sharepoint-2007-jquery/Talking about Sharepoint Marquee Scroll Listings
Quote Sharepoint Marquee Scroll Listings Building a Rotating Banner for ImagesThe first thing you should do is have your environment configured and have the web extensions for MOSS. Please see the article located here: blogspot article. Open Visual Studio and create a new project of type "web part" ![]() I then am going to create a sharepoint picture library and upload some pictures into it. Now, because I am going to create a rotating banner, and I am concerned about real estate, I will make sure that all the pictures are the same size. In this case I took some button images. ![]() The goal at the end will be to have a random image from this selection appear on a web part on a web page within my portal. What we are going to do next is create the *.webpart file. This file will expose and set certain properties that will be used for the webpart. Please keep in mind that many of these properties are required. We are going to add a file of XML type to the project and call it RotatingImage.webpart. ![]() It will look something like this:
Obviously you would replace your public key token with the one generated from the sn command. For details on this please see my post on Code Access Security. Next you will need to add the following to the assembly.cs file:
Before adding your web part make sure to add it to the safe controls section of the website you are going to add it to if it is not already there. If you do a deploy from visual studio and you have chosen the Sharepoint WebPart project, this should automatically be done. It would look something like this:
Finally, the code. I recommend to deploy as is and add to a page first because at this point you have generated the "plumbing" of the part if you will. This will at least ensure that all is deployed correctly and you only have to worry about your custom code if it doesn't quite go as planned ;) As I alluded to earlier in the post we are just going to pull the pictures out of a picture library and add a random one to the page. The way I did this in this example was instead of overriding the Render method that came out of the box, I deleted it and added the following code in the *.cs file:
Essentially what we have done here is override the child controls method and added our own image to the controls collection. You could essentially add any control you wished to this collection and it would render. Go ahead and add your new web part to a page if you have not already done so and poof! You now have a randomized picture from your picture library. I know it probably didn't work the first time but if it did great! Posted by Joseph Krupinski at 3:33 PM Convert a Sub-site to a Site CollectionI finally figured it out! This was supposed to be one of those very simple tasks that I should have been able to do without any custom code. Turning a sub-site (or web) into a site collection (or top level site) turned out to be the most difficult task I've yet to face with SharePoint 2007. In theory you should be able to do this using the following commands which could be put into a batch file: REM Create a test web for exporting stsadm -o createweb -url "http://intranet/testweb" -sitetemplate "SPSTOPIC#0" REM Export the test web to the filesystem stsadm -o export -url "http://intranet/testweb" -filename "c:\testweb" -includeusersecurity -versions 4 -nofilecompression -quiet REM Create a managed path for the new top level site stsadm -o addpath -url "http://intranet/testsite" -type explicitinclusion REM Create an empty site with a default site template (note that if you don't specify a template you have to manually activate the required features) stsadm -o createsite -url "http://intranet/testsite" -owneremail "someone@example.com" -ownerlogin "domain\username" -sitetemplate "SPSTOPIC#0" REM Import the site stsadm -o import -url "http://intranet/testsite" -filename "c:\testweb" -includeusersecurity -nofilecompression -quiet Unfortunately what you get is only a partially functional site (and in some case not functional at all). There are several errors that you are likely to encounter after running the above using the created testweb or your own existing web. The first and most obvious error is that when you load the default.aspx page of the new site you may get a File Not Found error (note that running the above as is will not give you this error). This is the result of the publishing pages PageLayout URL getting messed up (effectively still pointing to an old value). I addressed this specific issue with a separate command (http://stsadm.blogspot.com/2007/08/fix-publishing-pages-page-layout-url.html) and the I've encapsulated that functionality into the new commands I've created which are detailed below. The next error you're likely to see is on the Area Template Settings page (Site Settings -> Page layouts and site templates). The specific error is "Data at the root level is invalid. Line 1, position 1".
For a top level site collection this value should always be either an empty string (all page layouts are available) or XML describing which layouts are available. The import operation does not consider this and leaves the value as is thus resulting in the XML error when attempting to parse "__inherit" as XML. The fix for this is simple enough - change the value to an empty string. Unfortunately that's not all we have to do. Fixing the above error results in the page loading without errors, however, the page layouts section does not load. There's still several issues that need to be resolved. If you now go and view the master gallery (Site Settings -> Master pages and page layouts) you should see all the default page layouts. If you have any custom page layouts those won't exist and will cause problems. Also, if you attempt to edit a file you'll notice that even though we used a publishing template it doesn't prompt you to check the file out. What's more is that once you view the form for a layout you should see that only the core fields are present (no Content Type, Associated Content Type, Variations, etc.).
Third we have to change the ContentType field from being a Text field to being a Choice field (more about this in a minute). Fourth we need to re-associate each file as a Page Layout file by setting all the necessary properties (Content Type, Associated Content Type, etc.). In regards to changing the ContentType field this is the one that caused me the most headache to figure out. For some reason during the import of the site this field gets a bit messed up (note that I'm not referring to the ContentType field that is linked in from the Page content type which is associated with the library but rather another field that is part of the gallery definition itself). The field should be a Choice field with options such as "Page Layout", "Publishing Mater Page", "Master Page", and "Folder". However, during the import the field is converted to a Text field - don't ask me why. The result is that when you query for the list of available page layouts the unmanaged code that Microsoft uses to do the actual query chokes because it can't find a matching value in the list so it produces an invalid query which will always return no results back. To fix this I copy the source master page gallery on top of the target gallery using the content deployment API. I also found that (with SP2) the PublishingResources feature seemed to correct the issue (at least in the tests that I ran). UPDATE 9/4/2007: I just discovered that another issue is related to the global navigation. If you view the navigation via the browser it will look as though everything is just peachy but if you attempt to manipulate the navigation programmatically you'll find that the PublishingWeb's GlobalNavigationNodes property is empty (no items are present). This is because the global navigation is stored at the site collection level so when you import the web it does not take the global navigation with it, just the current. The fix is simple enough - just loop through the current navigation collection and copy it to the global navigation collection. This will help to allow other programmatic manipulations of the global navigation to succeed. UPDATE 7/6/2009: I am now calling the code that I created to copy content types from one site collection to another. This solves issues that can occur if a site collection content type was not created via a Feature. I've also added additional logging to better show what is happening. So, to summarize the things that need to be repaired after importing into your empty site collection:
Some of the above can be done via the browser but most of it requires programmatic changes. In order to solve all these problems I've created two custom stsadm commands - the first will take a site make all the repairs identified above (so it assumes you've already imported the site). The second basically just abstracts the whole process of exporting a web, creating a site, importing into the site, and then repairing the site (this way the entire process can be done with just one command). The commands I created are detailed below (forgive the verbosity of the names - I had trouble coming up with something shorter). 1. gl-repairsitecollectionimportedfromsubsite The code is fairly well documented so rather than discuss it all (there's a lot of it) I've linked it to this post here. The syntax of the command can be seen below: C:\>stsadm -help gl-repairsitecollectionimportedfromsubsite
stsadm -o gl-repairsitecollectionimportedfromsubsite
Repairs a site collection that has been imported from an exported sub-site. Note that the sourceurl can be the actual source site or any site collection that can be used as a model for the target.
Parameters:
-sourceurl <source location of the existing sub-site or model site collection>
-targeturl <target location for the new site collection>
The following table summarizes the command and its various parameters:
Here’s an example of how to repair the site created using the batch file above:
2. gl-convertsubsitetositecollection As stated above, this command is just an abstraction of other commands - it simply calls out to stsadm to do export the site (note that you can provide a previously exported site file/folder), create the managed path, create the empty site, import the site, and finally repair the imported site. As there's nothing spectacular going on here I didn't bother culling the code out in this post (download the project if you're interested in the details). The syntax of the command can be seen below:
The following table summarizes the command and its various parameters:
Here's an example of how to do all that the batch file above is doing (minus the creation of the testweb) as well as the repair operation all with one command: One area of improvement may be to pull the owner and secondary owner information from the source site collection so that this information does not have to be provided - maybe I'll do that if I feel I have the time or if people express enough interest. Note that you can specify a title and description but they'll be overwritten during the import - I only included them so that if the import fails and you're left with an incomplete site you'll at least have a name for it if you should forget to delete it and stumble upon it a year later. Figuring out how to solve all the issues surrounding converting a web to a site collection was a real pain the a$$ so any feedback that people have on this would be greatly appreciated - hopefully if there are others out there that have stumbled on this then they'll benefit from it as well. Keep in mind also that though I think I've solved all the errors related to the conversion it's possible that different implementations may have additional errors that I have not seen - if that's the case please let me know (especially if you've solved the problems) so that I can share with others. Update 9/21/2007: I've fixed a couple minor bugs that pop up when converting a non-publishing site. I've also enhanced the command to take advantage of another new command I created: gl-updatev2tov3upgradeareaurlmappings (updates the url mapping of V2 bucket webs to V3 webs thereby reflecting the change of url as a result of the move so if a user tries to hit the V2 url it will redirect to the new and updated V3 url). Update 10/2/2007: I've enhanced the command to take advantage of another new command I created: gl-retargetcontentquerywebpart (fixes Grouped Listings web parts that remained pointed at the old list rather than the newly imported list). Update 10/12/2007: I've removed the retainobjectidentity parameter. If you attempt to use this parameter you will receive a syntax error. Turns out that retaining the object identity when going from a sub-site to a site collection just created a nightmare. However, because I still had to handle these web parts that were broken I decided to enhance the repair routines to manually retarget the DataFormWebPart and ContentByQueryWebPart web parts. So if a matching list can be found on the source then any of these web parts on your pages should be fixed so that you don't have to manually fix them (the gl-repairsitecollectionimportedfromsubsite command will do the same). Update 7/6/2009: I removed the direct DB access code and added support for copying content types from the source. Posted by Gary Lapointe at 9:11 AM MOSS 2007 Publishing: Improve your page size with removing core.css, core.js and other stuffDo you want to save about 500kb traffic for every anonymous request to your MOSS 2007 Publishing Site? There is no default way in MOSS 2007 where you can say: "I'm online visible for anonymous users, I don't want to load core.js, portal.js, init.js, ... every time a user is accessing a page". I was searching for this switch a long time, but it doesn't seems to exist.
Microsoft's proposal for this is to force a delayed loading of the core.js, which can be read here: http://support.microsoft.com/kb/933823/en-us or here: http://blogs.msdn.com/ecm/archive/2007/02/21/building-a-new-page-layout-which-does-not-reference-core-js-but-downloads-it-while-the-page-is-being-viewed-thereby-optimizing-response-time.aspx. This doesn't solve the problem, but is one way to speed up your pages.
A solution for this problem is a HTTP-Filter. This filter can be deployed in the /bin directory of your web application and has to be referenced in your web.config.
The solution below is not perfect, but it works and saves a lot of traffic, server load, time and money. And it enables you to publish lightweight pages with MOSS 2007.
Improvements for the code below would be a separation of the "tags to cleanup" in a configuration file and the usage of regular expressions. But with output cache enabled, this shouldn't be a performance issue.
Make sure to adapt this code for your own needs, as I'm removing e.g. ViewState and so on, which could possibly crash your MOSS applications. MOSSCleanupModule.cs: using System;using System.Collections.Generic; using System.Text; using System.Web; using Microsoft.SharePoint; namespace HttpModules { public class MOSSCleanupModule : IHttpModule { public void Init(HttpApplication app) { app.ReleaseRequestState += new EventHandler(InstallResponseFilter); } private void InstallResponseFilter(object sender, EventArgs e) { HttpResponse response = HttpContext.Current.Response; HttpRequest request = HttpContext.Current.Request; if (response.ContentType == "text/html" && request.Url.AbsolutePath.EndsWith(".aspx") && !request.Url.AbsolutePath.Contains ("_layouts/")) { SPUser user = SPContext.Current.Web.CurrentUser; if (user == null || string.IsNullOrEmpty(user.LoginName)) { response.Filter = new MOSSCleanupFilter(response.Filter); } } } public void Dispose() { } } } MOSSCleanupFilter.cs: using System;using System.Collections.Generic; using System.Text; using System.Web; using System.IO; namespace HttpModules { public class MOSSCleanupFilter : Stream { private static string[] completeTagsToCleanup = new string[] { "<meta name=\"GENERATOR\" content=\"Microsoft SharePoint\" />", "<input type=\"hidden\" name=\"__SPSCEditMenu\" id=\"__SPSCEditMenu\" value=\"true\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOWebPartPage_PostbackSource\" id=\"MSOWebPartPage_PostbackSource\" value=\"\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOTlPn_SelectedWpId\" id=\"MSOTlPn_SelectedWpId\" value=\"\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOTlPn_View\" id=\"MSOTlPn_View\" value=\"0\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOTlPn_ShowSettings\" id=\"MSOTlPn_ShowSettings\" value=\"False\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOGallery_SelectedLibrary\" id=\"MSOGallery_SelectedLibrary\" value=\"\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOGallery_FilterString\" id=\"MSOGallery_FilterString\" value=\"\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOTlPn_Button\" id=\"MSOTlPn_Button\" value=\"none\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOAuthoringConsole_FormContext\" id=\"MSOAuthoringConsole_FormContext\" value=\"\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOAC_EditDuringWorkflow\" id=\"MSOAC_EditDuringWorkflow\" value=\"\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOSPWebPartManager_DisplayModeName\" id=\"MSOSPWebPartManager_DisplayModeName\" value=\"Browse\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOWebPartPage_Shared\" id=\"MSOWebPartPage_Shared\" value=\"\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOLayout_LayoutChanges\" id=\"MSOLayout_LayoutChanges\" value=\"\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOLayout_InDesignMode\" id=\"MSOLayout_InDesignMode\" value=\"\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOSPWebPartManager_OldDisplayModeName\" id=\"MSOSPWebPartManager_OldDisplayModeName\" value=\"Browse\" />"+System.Environment.NewLine, "<input type=\"hidden\" name=\"MSOSPWebPartManager_StartWebPartEditingName\" id=\"MSOSPWebPartManager_StartWebPartEditingName\" value=\"false\" />"+System.Environment.NewLine, "_spBodyOnLoadWrapper();", }; private static string[] tagsToCleanup = new string[] { "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_layouts/1033/styles/core.css?rev=", "<link rel=\"stylesheet\" type=\"text/css\" href=\"/Style%20Library/en-US/Core%20Styles/Band.css", "<link rel=\"stylesheet\" type=\"text/css\" href=\"/Style%20Library/en-US/Core%20Styles/Controls.css", "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_layouts/1033/styles/HtmlEditorCustomStyles.css?rev=", "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_layouts/1033/styles/HtmlEditorTableFormats.css?rev=", "<input type=\"hidden\" name=\"__REQUESTDIGEST\" id=\"__REQUESTDIGEST\"", "<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"__VIEWSTATE\" value=", }; private static string[] scriptsToCleanup = new string[] { "<script type=\"text/javascript\" language=\"javascript\" src=\"/_layouts/1033/core.js?rev=", "<script src=\"/WebResource.axd?", "<script> var MSOWebPartPageFormName = 'aspnetForm'", "<script type=\"text/javascript\" language=\"javascript\" src=\"/_layouts/1033/init.js?rev=", "<script type=\"text/javascript\" language=\"javascript\" src=\"/_layouts/1033/init.js?rev=", "<script type=\"text/javascript\" language=\"javascript\" src=\"/_layouts/portal.js?rev=", "<script type=\"text/javascript\" language=\"javascript\" src=\"/_layouts/1033/ie55up.js?rev=", "<script type=\"text/javascript\" language=\"javascript\" src=\"/_layouts/1033/non_ie.js?rev=", "<script type=\"text/javascript\">"+System.Environment.NewLine+"<!--"+System.Environment.NewLine+"var __wpmExportWarning", "<script type=\"text/JavaScript\" language=\"JavaScript\">"+System.Environment.NewLine+"<!--"+System.Environment.NewLine+"var L_Menu_BaseUrl", }; private Stream responseStream; private long position; public MOSSCleanupFilter(Stream inputStream) { this.responseStream = inputStream; } public override void Write(byte[] buffer, int offset, int count) { StringBuilder html = new StringBuilder(System.Text.UTF8Encoding.UTF8.GetString(buffer, offset, count)); foreach(string completeTagToClean in completeTagsToCleanup) { this.CleanUp(html, completeTagToClean); } foreach (string tagToClean in tagsToCleanup) { this.CleanUp(html, tagToClean, ">"); } foreach (string scriptToClean in scriptsToCleanup) { this.CleanUp(html, scriptToClean, "</script>"); } byte[] data = System.Text.UTF8Encoding.UTF8.GetBytes(html.ToString()); responseStream.Write(data, 0, data.Length); } private void CleanUp(StringBuilder html, string search, string endTag) { int startPos = html.ToString().IndexOf(search); if (startPos != -1) { if (!string.IsNullOrEmpty(endTag)) { int endPos = html.ToString().IndexOf(endTag, startPos); if (endPos != -1) { html.Remove(startPos, endPos - startPos + endTag.Length); } } else { html.Remove(startPos, search.Length); } } } private void CleanUp(StringBuilder html, string search) { this.CleanUp(html, search, null); } #region Filter overrides public override bool CanRead { get { return true; } } public override bool CanSeek { get { return true; } } public override bool CanWrite { get { return true; } } public override void Close() { responseStream.Close(); } public override void Flush() { responseStream.Flush(); } public override long Length { get { return 0; } } public override long Position { get { return position; } set { position = value; } } public override long Seek(long offset, SeekOrigin origin) { return responseStream.Seek(offset, origin); } public override void SetLength(long length) { responseStream.SetLength(length); } public override int Read(byte[] buffer, int offset, int count) { return responseStream.Read(buffer, offset, count); } #endregion } } web.config: < httpModules>... <add name="MOSSCleanupModule" type="HttpModules.MOSSCleanupModule, HttpModules, Version=1.0.0.1, Culture=neutral, PublicKeyToken=..."/> ... </httpModules>
ref:http://www.ie-soft.de/blog/PermaLink,guid,968b0588-f306-467b-be51-54f7a8f2079d.aspx MOSS 2007: Enable inline codeIf you add inline code to your e.g. PageLayout in MOSS 2007 you will get the following error: "Code blocks are not allowed in this file". To avoid this problem, add the following code block to your web.config: <PageParserPaths> <PageParserPath VirtualPath="/" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" /> </PageParserPaths> This will allow inline code in your entire site collection. Make sure to be aware with security issues and inline code. To enable inline code only for a single file use: <PageParserPaths> <PageParserPath VirtualPath="/Pages/MyPage.aspx" CompilationMode="Always" AllowServerSideScript="true" /> </PageParserPaths> ref:http://www.ie-soft.de/blog/PermaLink,guid,cb97a3df-6725-468c-97fa-725e2c4ceb4c.aspx Disable MySite and MyLinks in Sharepoint (MOSS) 2007Okay, this one took me a while to figure out, but nonetheless I found it and will share it. In order to turn off or disable the MySite or MyLinks functionality you need to be an Sharepoint administrator. Go to the Central Administration Web Page Select the group you want to limit the functionality for. More than likely you will just have NTAuthority\Authenticated Users. In the next screen you will see a list of checkboxes, Once you find it, disabling the functionality is pretty easy, but if you are new to 2007 like I am it will take a while to find. Hopefully this will save you a few cycles. ref:http://geekswithblogs.net/RogueCoder/archive/2006/11/01/95766.aspx Accessing Controls in SharePoint Web Parts using JavaScript on the Client SidePosted in ASP.NET | Office | SharePoint at Tuesday, February 14, 2006 4:38 AM W. Europe Standard Time A rather long title for this post, but that's what it comes down to.
I've been struggling with some problems an couldn't find anything about this issue on the web, so I decided to post my findings. Because it is possible to place a Web Part multiple times on a SharePoint web page, SharePoint Server will assign a unique identifier to each control (that is, a Web Part and some of its child controls¹) to be able to distinguish between Postbacks originating from different Web Parts. The unique ID can be found in the ID attribute of a HTML element and looks similar to this: TopZone_g_d72e1f89_87e6_4f08_b6c5_165dc560ce8a__ctl1
The JavaScript code to add an onchange event handler to the master control looks like this: master.Attributes.Add("onchange", String.Format("setDetail(document.getElementById('{0}'));", detail.ClientID));
However, this will not work: The location and the GUID of the Web Part is evaluated when the page is rendered. These values then serve as a prefix to the control ID (_ctl1) you set in your own code. You have to retrieve the location/GUID prefix along with the control ID and combine them to the actual HTML ID. Because Web Parts should derive from // Combine the Web Part's ID and the control ID. July 21 Talking about SharePoint Usage Analytics
Quote SharePoint Usage Analytics July 05 How to configure Project Server 2007 for Timesheets Management – A Complete Guide!Our main service is providing nearshore outsourcing to customers around the globe. It is very important for us to track effort spent as much detailed as possible, and report it to our customers, usually on a weekly basis. After trying with other tools and not being 100% satisfied, we decided to take advantage of Microsoft tools and start using Project Server 2007 for time management here in our company. I spent some hours doing research about this topic, and I found different articles and posts explaining just one chapter at a time, without finding a complete guide to install and configure this tool for this particular goal. Even after we followed all the steps found around several sources, we were still not able to generate the reports with the time spent by the resources selected for this pilot, due to some issues with the browser and also with the Cube (Project integrates with Analysis Services) used for populating the data. Then after several hours of effort with one of our Senior developers, we had our Project Server running and some of our team members were able to enter their timesheets using Project Web Access, a web interface exposed by this technology. Using Project Server also enabled us to integrate Sharepoint workspaces for centralizing project documentation, risks, issues and tasks, with project schedule, costs and time management that we can also publish through web so our customers can have a snapshot of the project anytime. We can generate customized reports through Pivot Tables and Analysis Services integration. Having this said, this is a powerful tool with a complete set of features, ideal for small, medium or enterprise organizations. Some features such as the web interface are really helpful for our nearshore software development practice, enabling both customers and remote teams to access the data everywhere. These are the steps you should follow in order to install and configure Project Server 2007 for timesheet management: 1. Install Sharepoint Server 2007 in a brand new Virtual Machine with Windows Server 2003. Step by step and different deployment scenarios can be found here: http://technet.microsoft.com/en-us/library/cc197758.aspx#section2 2. After installed, the project web access is located in a url like http://servername:port/PWA 3. Add a few domain users to the Project Server using the Server Settings / Security / Manage Users link. 4. Add your team members into Project Server resources list, using the Resources Center. These will be the team members you will allocate to each project and task. 5. Even when you can do almost everything from the Project Server web interface, it is faster to use your desktop version of Office Project 2007 to create projects, tasks and allocate resources. This requires the PM to have MS Office Project 2007 Professional version installed (Standard doesn´t support it) 6. To connect your Office Project to the Project Server 2007, you need to configure it through the Enterprise Options under the Tools menu. 7. Create a test project using the Project Center link / Add Project. 8. After adding a few test tasks, you must assign the team to the project and each task. This will allow the team members to see the assigned tasks and a. Go to Build Team From Enterprise b. Select the task(s) c. Go to Assign Resources d. Select the resources you want to assign. You can set costs and effort allocated. 9. Project Server requires timesheets periods to be defined (in most of the cases these will be mapped to each week of the year). You should go through each link in the Timesheets section under the Server Settings section. There is a complete ebook for this topic which you should download and read from here http://technet.microsoft.com/en-us/library/cc197478.aspx 10. Once the timesheets periods have been defined, your team member should be able to view the assigned tasks after login into the PWA with his credentials. 11. Each resource will be responsible for creating the timesheet and reporting it. The timesheet can be populated with the assigned tasks, or can be blank and then populated using the Add New Line link 12. Resource should submit his timesheet. These will be usually automatically approved unless you configure it. The timesheet cannot be updated except for the admin, once it is submitted. Once all of this is done, the database will have the data but you won´t be able to retrieve it using the reports yet. First, you need to configure this feature, otherwise you will see just a blank page when clicking the Data Analysis link In order to configure the Reports follow these steps: 1. Go to Create Server Settings, Views, New View, and select Data Analysis as the view type 2. Select your Data Analysis Services. If is it not populated you should go to check if Analysis Services was installed and all services are running. 3. Configure the settings and the data view properties (just follow the sections in the screen) 4. Configure the fields you want to display in the default timesheet view 5. Add the project server URL to the list of Local Intranet sites in your browser settings. 6. Configure your browser settings to allow ActiveX. 7. Configure your browser settings to allow Data Sources across domains. And that´s all! So if you follow these steps then you will be able to take advantage of Project Server reporting features: I hope this guide is useful and ping us if you face any issues when using this powerful tool ! So far we are really satisfied with it. Post written by - Marcelo Lopez, Project Manager @ UruIT Global IT Services |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|