Showing posts with label sps. Show all posts
Showing posts with label sps. Show all posts

Creating List/Document Library with Terms and Conditions sections

Often business comes with a requirement that they need to store data in the sharepoint list, however they need some information to be displayed on the New item page.
 
These kind of requirements although look very simple from business point of view, it becomes a nightmare if you want to create custom pages for it.
 
"Terms and conditions" option is one such requirement. Although you can implement it in various ways, here is a good option to create "T&C" text on new items page and enable the form only when these "T&C" are agreed. 
 
1. Create a List/Document library. http://spsite/Lists/ExampleList
2. Create the desired columns for the List/Document Library created
3. Open the http://spsite/Lists/ExampleList/Newform.aspx for that List/Document Library with the following query parameter “toolpaneview=2”. So your URL will look likehttp://spsite/Lists/ExampleList/Newform.aspx?toolpaneview=2
4. Now the newform.aspx page opens in edit mode.
5. Add a content editor webpart in the page. This content editor webpart should be added just above the fields of the form.
6. Add following HTML code in the webpart.

<div style="text-align: left">&#160;</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="text-align: left"><tbody><tr><td>
REPLACE THIS WITH YOUR TERMS AND CONDITIONS
<br/><br/> <font style="font-size: 12pt">
<input id="chkAgreement" onclick="apply()" type="checkbox" value="on"/>
<strong>I AGREE</strong></font><br/><br/><font style="font-size: 10pt
<br/></font></td></tr></tbody></table>
<script type="text/javascript">
function hideload()
{
var imag = document.getElementsByTagName('table');
for(var i=0;i<imag.length;i++)
{
if(imag[i].className.indexOf('ms-formtable') != -1 ) { var tbl = imag[i];}
if(imag[i].className.indexOf('ms-formtoolbar') != -1 ) { var tbl2 = imag[i];}
}
var ribbonhide = document.getElementById("s4-ribbonrow");
var stylechng = tbl.style;
var stylechng2 = tbl2.style;
var stylechng3 = ribbonhide.style;
stylechng.display = 'none';
stylechng2.display = 'none';
stylechng3.display = 'none';
}

function apply()
{
var imag = document.getElementsByTagName('table');
for(var i=0;i<imag.length;i++)
{
if(imag[i].className.indexOf('ms-formtable') != -1 ) { var tbl = imag[i];}
if(imag[i].className.indexOf('ms-formtoolbar') != -1 ) { var tbl2 = imag[i];}
}

var ribbonhide = document.getElementById("s4-ribbonrow");
var chkBx = document.getElementById("chkAgreement");
var stylechng = tbl.style;
var stylechng2 = tbl2.style;
var stylechng3 = ribbonhide.style;

if(chkBx.checked==false) {
stylechng.display = 'none';
stylechng2.display = 'none';
stylechng3.display = 'none';
}
else {
stylechng.display = 'block';
stylechng2.display = 'block';
stylechng3.display = 'none';
}
}
hideload();</script>
7. Add a content editor webpart in the page. This content editor webpart should be added just below the fields of the form.
8. Add following HTML code in the webpart.
<script>
hideload();</script>
Done.
If you don’t want to touch the ribbon control please remove the greyed out line above. Hiding the ribbon can be tricky as you might find it difficult to modify the webparts. But it gives a very good look and feel to the page if you remove it.
 
So if you have hidden the ribbon, you can edit the page by first closing content webpart, deployed in step 7 and 8. Then edit the page and redeploy the closed webpart.
 
 
 
 

Webpart not available for custom site group members

Webpart not available for custom site group members:

To implement security in the Portal area, I created new security groups in sharepoint. But users complained that many webparts were not available for them to import on page. Users were not able to browse or search them.Users who are members of custom site groups cannot access Web Parts when they view Web Part galleries in SharePoint Portal Server 2003.
This is because the webpart gallery is not set to automatically inherit permissions - so none of the custom site groups can access any of the standard webparts in the web part gallery.


After some investigation found following workaround:

1. Connect to the portal site, and then click Site Settings.
2. Under General Settings on the Site Settings page, click Manage security and additional settings.
3. Under Templates and Web Parts on the Manage security and additional settings page, click Manage Web Part gallery.
4. On the Web Part Gallery page, click Modify settings and columns.
5. The Customize Web Part Gallery page is displayed in your Web browser. The URL in the Address box of the Web browser contains a GUID in brackets. Copy the GUID that appears in the URL, and then paste the GUID into a blank document in Notepad.

The following is an example of a URL:
http://ServerName/_layouts/1033/listedit.aspx?List={AE2A9E4C-BE4C-47C6-8A01-45E119543F7F}
In this example URL, the GUID is AE2A9E4C-BE4C-47C6-8A01-45E119543F7F.
6. In a new Web browser window, type the following URL in the Address box, where GUID is the GUID that you determined earlier in step 5:
http://ServerName/_layouts/1033/ShrOpt.aspx?obj=GUID,doclib
Note Make sure that you replace the GUID that you determined in step 5 with the GUID in the URL. To do this, paste the GUID from the Notepad document into the URL.

The following is an example of a URL that uses the example GUID from step 5:
http://ServerName/_layouts/1033/ShrOpt.aspx?obj=AE2A9E4C-BE4C-47C6-8A01-45E119543F7F,doclib
7. After you type the URL and the GUID in the Address box of your Web browser, press ENTER. The Change Permissions: Web Part Gallery page is displayed in your Web browser.
8. On the Change Permissions: Web Part Gallery page, click Inherit permissions from the parent Web site.
9. Click OK on the message that appears.
10. Assign the View items permission to all site groups except for the Web Designer site group. To do this, follow these steps:a. On the Change Permissions: Web Part Gallery page, click to select the check boxes that are next to the site groups that are displayed on the Change Permissions: Web Part Gallery page. Do not click to select the check box that is next to the Web Designer site group.

Note Make sure that the check box that is next to the Web Designer site group is not selected.
b. Click Edit Permissions of Selected Users.
c. On the Modify Permissions: Web Part Gallery page, click View Items, and then click OK.

11. Assign the View, insert, edit, delete items; change list settings permission to the Web Designer site group. To do this, follow these steps:a. On the Change Permissions: Web Part Gallery page, click to select the check box that is next to the Web Designer site group, and then click Edit Permissions of Selected Users.
b. On the Modify Permissions: Web Part Gallery page, click View, insert, edit, delete items; change list settings, and then click OK