When a custom master page is applied, editing a list in Datasheet View causes IE to just hang. I found this script hich solved my problem:
<script type="text/javascript">
function GCComputeSizing(GCObject)
{
if (TestGCObject(GCObject))
{
var fBIDI=(document.documentElement.currentStyle.direction=="rtl");
var lGCWindowWidth=document.documentElement.scrollWidth;
var lGCWindowHeight=(document.documentElement.scrollHeight>document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.documentElement.scrollHeight;
var lGCObjectOffsetLeft=0;
var lGCObjectOffsetTop=0;
if (fBIDI)
{
lGCObjectOffsetLeft=-180;
lGCObjectOffsetTop=120;
}
else
{
lGCObjectOffsetLeft=32;
lGCObjectOffsetTop=-2;
}
var lGCObjectWalker=GCObject.parentElement;
while (lGCObjectWalker !=document.body)
{
lGCObjectOffsetLeft+=lGCObjectWalker.offsetLeft;
lGCObjectOffsetTop+=lGCObjectWalker.offsetTop;
lGCObjectWalker=lGCObjectWalker.offsetParent;
if (fBIDI)
if (lGCObjectWalker.offsetLeft > 0)
break;
}
lGCObjectOffsetLeft+=GCObject.parentElement.offsetLeft;
lGCObjectOffsetTop+=GCObject.parentElement.offsetTop;
glGCObjectHeight=lGCWindowHeight - lGCObjectOffsetTop;
if (glGCObjectHeight > lGCWindowHeight)
glGCObjectHeight=lGCWindowHeight
if (glGCObjectHeight < cGCMinimumHeight)f
glGCObjectHeight=cGCMinimumHeight;
if (fBIDI)
{
glGCObjectWidth=lGCWindowWidth+lGCObjectOffsetLeft;
}
else
glGCObjectWidth=lGCWindowWidth - lGCObjectOffsetLeft;
if (glGCObjectWidth > lGCWindowWidth)
glGCObjectWidth=lGCWindowWidth;
if (glGCObjectWidth < cGCMinimumWidth)
glGCObjectWidth=cGCMinimumWidth;
}
}
</script>
place it after core.js in your master page.
Thursday, March 11, 2010
How to change the Maximum File Upload Size
By default SharePoint allows a maximum file size of 50MB that can be uploaded into any document library. This might be too much as you might not want users downloading 50MB files over your LAN/WAN. To change the maximum file size
1. Goto SharePoint Central Administration > Configure Virtual Server Settings from Virtual Server List Page.
2. Select your server
3. Goto Virtual Server General Settings (in Virtual Server Management)
4. Change the value of the Maximum Upload Size in MB's.
If you increase the file size limit, your site might occassionally time out for users while they are uploading files. To accomodate this increase the default time out property for IIS.
1. Goto SharePoint Central Administration > Configure Virtual Server Settings from Virtual Server List Page.
2. Select your server
3. Goto Virtual Server General Settings (in Virtual Server Management)
4. Change the value of the Maximum Upload Size in MB's.
If you increase the file size limit, your site might occassionally time out for users while they are uploading files. To accomodate this increase the default time out property for IIS.
Tuesday, February 23, 2010
DiscussionBoard ListView in onet.xml
When tried to create site definition and added ListView for DiscussionForum. Link of added Item redirected to the default Web page for the site intead of open.
<View List="Discussion Forums"
WebPartZoneID="Left" BaseViewID="0" WebPartOrder="3" Type="HTML" RowLimit="5"
/>
After investigation I found error occur if the XML parser cannot find a matching content type ID.
Solution:
add the ContentTypeID attribute together with the content type value "0x012001" to the View element code of the discussion Web part in the Onet.xml file:
<View List="Discussion Forums" ContentTypeID="0x012001"
WebPartZoneID="Left" BaseViewID="0" WebPartOrder="3" Type="HTML" RowLimit="5"
/>
<View List="Discussion Forums"
WebPartZoneID="Left" BaseViewID="0" WebPartOrder="3" Type="HTML" RowLimit="5"
/>
After investigation I found error occur if the XML parser cannot find a matching content type ID.
Solution:
add the ContentTypeID attribute together with the content type value "0x012001" to the View element code of the discussion Web part in the Onet.xml file:
<View List="Discussion Forums" ContentTypeID="0x012001"
WebPartZoneID="Left" BaseViewID="0" WebPartOrder="3" Type="HTML" RowLimit="5"
/>
Labels:
Discussion,
onet.xml,
SharePoint 2007,
view Pages
Tuesday, May 26, 2009
MOSS 2007 Content Type Field Authorization
In MOSS 2007 you have authorization control over an entire content type, but not over a single field or combination of fields. This requirement comes up often with some of my clients, so I decided to whip up a quick authorization container control that could be wrapped around fields in a page layout to control who has access to the fields. This will work both for content editing and for content viewing.
First you need to create a custom ASP.NET control that can act as a container. While this is fairly easy, one item that often catches people unaware is the ParseChildren attribute. You need to set the ParseChildren to "false" in order for the custom ASP.NET control to interpret nested tags as separate controls rather than as properties. Setting the ParseChildren attribute to "true" will cause the control to think that the nested tags contain values that should be set to the matching properties of the control.
The complete code for the finished control is listed below:
As you can see the code is fairly simple. There is a property for setting the comma separated list of SharePoint group names that are authorized to view the content of the control, and a render method that checks to make sure that the current user is a member of one of the specified groups.
Using this new control to filter authorized users is super easy. Open up the page you want to edit in SharePoint Designer and edit the page layout of the page. The page layout will contain placeholder controls for the content type fields. Wrap the new AuthorizationContainer around the sections that you want to control. An example of this is listed below.
<MyControls:AuthorizationContainer runat="server" Groups="Approvers">
<table id="MSO_ContentTable" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr> <td>
<div class="pageContent">
<PublishingWebControls:RichHtmlField id="content" FieldName="PublishingPageContent" runat="server"/>
</div>
</td>
</tr>
</table>
</MyControls:AuthorizationContainer>
While this code sample is simple in nature, you could extend it in many ways. It could filter authorization by audience membership or by custom logic based on database stored values. Feel free to turn it into whatever you want, just make sure to share the goods with me.
First you need to create a custom ASP.NET control that can act as a container. While this is fairly easy, one item that often catches people unaware is the ParseChildren attribute. You need to set the ParseChildren to "false" in order for the custom ASP.NET control to interpret nested tags as separate controls rather than as properties. Setting the ParseChildren attribute to "true" will cause the control to think that the nested tags contain values that should be set to the matching properties of the control.
The complete code for the finished control is listed below:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Microsoft.SharePoint; using Microsoft.SharePoint.WebControls; namespace MyCompany.SharePoint { [DefaultProperty("Groups")] [ParseChildren(false)] [ToolboxData("<{0}:AuthorizationContainer runat=server>")] public class AuthorizationContainer : CompositeControl { private const string groupsCategory = "SharePoint"; private const string groupsViewState = "Groups"; [Bindable(false)] [Category(groupsCategory)] [DefaultValue("")] [Localizable(false)] public string Groups { get { string groups = (string)ViewState[groupsViewState]; if (groups == null) { groups = string.Empty; } return groups; } set { ViewState[groupsViewState] = value; } } protected override void RenderContents(HtmlTextWriter output) { try { SPWeb web = SPControl.GetContextWeb(this.Context); SPUser user = web.CurrentUser; bool isInGroup = false; if (!string.IsNullOrEmpty(this.Groups)) { string[] items = this.Groups.Split(','); foreach (string item in items) { if (this.IsInGroup(user, item.Trim())) { isInGroup = true; break; } } } else { isInGroup = true; } if (isInGroup) { base.RenderContents(output); } } catch (Exception ex) { output.WriteLine(ex.Message); } } private bool IsInGroup(SPUser user, string name) { foreach (SPGroup group in user.Groups) { if (group.Name == name) return true; } return false; } } } |
As you can see the code is fairly simple. There is a property for setting the comma separated list of SharePoint group names that are authorized to view the content of the control, and a render method that checks to make sure that the current user is a member of one of the specified groups.
Using this new control to filter authorized users is super easy. Open up the page you want to edit in SharePoint Designer and edit the page layout of the page. The page layout will contain placeholder controls for the content type fields. Wrap the new AuthorizationContainer around the sections that you want to control. An example of this is listed below.
<MyControls:AuthorizationContainer runat="server" Groups="Approvers">
<table id="MSO_ContentTable" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr> <td>
<div class="pageContent">
<PublishingWebControls:RichHtmlField id="content" FieldName="PublishingPageContent" runat="server"/>
</div>
</td>
</tr>
</table>
</MyControls:AuthorizationContainer>
While this code sample is simple in nature, you could extend it in many ways. It could filter authorization by audience membership or by custom logic based on database stored values. Feel free to turn it into whatever you want, just make sure to share the goods with me.
Labels:
Authorization,
Content type,
Field,
MOSS 2007
Thursday, March 12, 2009
Announcing the Accessibility Kit for SharePoint (AKS) v2.0
Microsoft and HiSoftware are pleased to announce the release of the Accessibility Kit for SharePoint (AKS) v2.0. The AKS v2.0 provides an accessible development framework and significantly reduces the level of effort and knowledge needed by customers and partners to improve the accessibility of SharePoint based sites and applications.
You can download from url:http://www.hisoftware.com/
You can download from url:http://www.hisoftware.com/
Labels:
AKS,
SharePoint 2007,
W3C Compliance
Thursday, March 5, 2009
Propagate Content Type Changes
There is a common problem of propagating changes to content types deployed via a Feature.
I found solution for this problem by extended stsadm wroted by Søren to propagate changes.
You will find extended stsadm in this url:
http://stsadm.blogspot.com/2008/05/propagate-content-type-changes.html
I found solution for this problem by extended stsadm wroted by Søren to propagate changes.
You will find extended stsadm in this url:
http://stsadm.blogspot.com/2008/05/propagate-content-type-changes.html
Labels:
contentType,
deploy,
feature,
SharePoint 2007
Sunday, March 1, 2009
ValidationGroup in SharePoint 2007
The situation
You have an ASP.NET control that contains validation controls in the masterpage or page layout for a publishing site (an ASP.NET login control for example). When you try to edit and check in a publishing page you receive the following error.
This page contains content or formatting that is not valid. You can find more information in the affected sections.
The problem
Even if you fill in all the required fields on the publishing page, the validation controls on the other ASP.NET controls prevent the page from saving.
The solution:
You have 2 solutions:
1. Put your control in EditModePanel
<PublishingWebControls:EditModePanel runat=server id="EditModePanel1" PageDisplayMode="Display">
<------------Your Control --------------->
</PublishingWebControls:EditModePanel>
2. Hide your validators in edit mode:
WebPartManager wp = WebPartManager.GetCurrentWebPartManager(Page);
if(wp.DisplayMode == WebPartManager.BrowseDisplayMode)
{
yourvalidator.Visible = true;
}
else
{
yourvalidator.Visible = false;
}
You have an ASP.NET control that contains validation controls in the masterpage or page layout for a publishing site (an ASP.NET login control for example). When you try to edit and check in a publishing page you receive the following error.
This page contains content or formatting that is not valid. You can find more information in the affected sections.
The problem
Even if you fill in all the required fields on the publishing page, the validation controls on the other ASP.NET controls prevent the page from saving.
The solution:
You have 2 solutions:
1. Put your control in EditModePanel
</PublishingWebControls:EditModePanel>
2. Hide your validators in edit mode:
WebPartManager wp = WebPartManager.GetCurrentWebPartManager(Page);
if(wp.DisplayMode == WebPartManager.BrowseDisplayMode)
{
yourvalidator.Visible = true;
}
else
{
yourvalidator.Visible = false;
}
Labels:
not valid,
SharePoint 2007,
ValidationGroup
Subscribe to:
Posts (Atom)