Posts

Showing posts from September, 2011

SharePoint Multi-languages with JavaScript Code

A my friend asked me how to implement Multi-languages with JavaScript in SharePoint 2010. With server code, you can use resourced for this. With JavaScript, you can identify the current language that SharePoint Site is using via _spPageContextInfo object (Ref: http://trungpv.blogspot.com/2011/09/javascript-notes-with-sharepoint.html ), it provides the currentLanguage property that allows you know which language is using. You can define an JavaScript objects like below: News.DefaultLanguage = 1033; News.Resources = {}; //English News.Resources[1033] = {     Title: "News",     Function: "Searcj" }; //Vietnamese News.Resources[1066] = { Title: "Tin tức", Function: "Tìm kiếm" }; And you can load appropriated resources: if (News.Resources[_spPageContextInfo.currentLanguage]) {             res = News.Resources[_spPageContextInfo.currentLanguage];         } else { ...

JavaScript Notes with SharePoint

  Understanding the _spPageContextInfo variable in SharePoint 2010 Adding JavaScript code Behind a SharePoint 2010 Page Introduction to SharePoint Object Model

Notes with Custom Document ID in MOSS 2010

Image
ma MOSS 2010 provides Document ID Services that allows get the document with unique key, and do not care about the document or folder will be renamed. You can develop a Custom Document ID Services and can define the format of DocumentID. You need to take care about: * DoCustomSearchBeforeDefaultSearch This is a variable with Boolean datatype, if it sets TRUE, the custom GetDocumentUrlsById will be call before the default Search function and FALSE for default Search function. But if the GetDocumentUrlsById return an empty array, the default Search function will be called. * GetDocumentUrlsById Incase you override this method, if you did not found the document never return an array string with one empty item you will get an exception (a Microsoft trap ? ) string[] res = new string[1]; res[0] = string.Empty;       public override string[] GetDocumentUrlsById(SPSite site, string documentId)         {      ...

Copy DLL(s) from C:\Windows\Assembly

  Run following command: subst x: C:\Windows\assembly”. You will have a virtual Driver that map with C:\Windows\Assemby http://en.wikipedia.org/wiki/Subst

Bug in FilterFieldV3 function (SharePoint core.js)

Image
  In SharePoint List Views, when you want to display the Filter Choices , you can add a parameter to URL : &Filter=1  or use SP Designer to add a parameter for XSLTListViewWebPart: Name: Filter; Value: 1 This works fine with Field Name that do not contain special characters or space. But with the Field Name contains special characters or space, the Reset Filter does not work fine: 1. 2.     The Views did not reset data for this. The problem come from: FilterFieldV3 function (in core.js) On this function, via call to CanonicalizeUrlEncodingCase, the Url will be changed the FilterField from f –> F Example: "Roll%5fx0020%5fOut%5fx0020%5fPhase" –> "Roll%5Fx0020%5FOut%5Fx0020%5FPhase" Default%20Filter.aspx?View={37BE24A2-9C85-4C92-A655-EC7B10CAD8D4}&FilterField1=Roll%5 f x0020%5 f Out%5 f x0020%5 f Phase&FilterValue1=Phase%202&Filter=1 -> Default%20Filter.aspx?View={37BE24A2-9C85-4C92-A655-EC7B10CAD8D4}&FilterField1=Roll%5 ...

Fixing the Personal View in SP 2010 (with Delegate Control)

Please note that the below source code should be applied for SP 2010 without SP1 and June – 2011 CU.. //Fixing the Personal View string strView = Request.QueryString[ "ShowWebPart" ]; if (! string .IsNullOrEmpty(strView) && control != null ) { if ( SPContext .Current != null ) { if ( SPContext .Current.List != null ) { SPView spView = SPContext .Current.List.Views[ new Guid (strView)]; if (spView.PersonalView) { //Fixing the Page Title try { Control pageTitleControl = this .findControl( this .Page, "PlaceHolderPageTitle" ); Control currentViewTitleControl = pageTitleControl.Controls[2]; currentViewTitleControl.Visible = false ; pageTitleControl.Controls.Add( new LiteralControl (spView.Title)); } catch { } //Fixing ...

Useful Design Pattern

http://www.dotnetage.com/publishing/library

Custom Controls in XSLT

  Ref: https://www.nothingbutsharepoint.com/sites/devwiki/articles/Pages/Custom-Controls-in-XSLT.aspx

Missing DropDown menu for choosing of views

  Ref: http://vintentou.wordpress.com/2010/08/03/missing-dropdown-menu-for-choosing-of-views/   Find row … <SharePoint:ListTitleViewSelectorMenu AlignToParent="true" id="LTViewSelectorMenu" runat="server" /> and replace with… <SPAN id=onetidPageTitleSeparator><SPAN><SPAN style="POSITION: relative; WIDTH: 11px; DISPLAY: inline-block; HEIGHT: 11px; OVERFLOW: hidden"><IMG style="POSITION: absolute; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; TOP: -585px !important; LEFT: 0px !important" alt=: src="/_layouts/images/fgimg.png"></SPAN></SPAN></SPAN> <SharePoint:ViewSelectorMenu ID="viewSelectorMenu1" runat="server" />   http://www.pentalogic.net/sharepoint-products/free-stuff/view-rescue