![]() |
SPSFAQ SharePoint Server Frequently Asked Questions |
|
Customising SharePoint
SPSFAQ0301100 - How do I change the News Web Part or any other built in web part, such as categories to have icons/images in front of the words? - 0 Comments - stephencummins - Mon, Jan 6th, 2003 - Customisation Go to: Content, and find the webpart News. Go to: Show Advanced Settings. Go to: Embedded XSL.
You will need to add a row for the image...(see last line of code below): <xsl:stylesheet xmlns:xsl="uri:xsl" xmlns:dav="DAV:" xmlns:office="urn:schemas-microsoft-com:office:office" xmlns:attributes="urn:schemas-microsoft-com:publishing:" xmlns:fulltext="urn:schemas.microsoft.com:fulltextqueryinfo:"> <xsl:template match="/"> <xsl:if test=".[$not$ $any$ dav:multistatus]"> <xsl:eval no-entities="t">"&nbsp;"</xsl:eval> </xsl:if> <xsl:for-each select="dav:multistatus"> <TABLE cellspacing="0" cellpadding="2"> <TR><IMG src="file name.jpg"/></TR> Code continues ........... The image file should be placed in: Portal/Resources. Hopes this helps. Kathleen Coy SPSFAQ030199 - How can I make content sources show up on the index server workspace and in the workspace where the indexes are being propagated? - 0 Comments - stephencummins - Mon, Jan 6th, 2003 - Customisation You can modify the "TahoeUtils.asp" under servername\workspacename\portal\resources to achieve this.
Look for -> g_strPathToWorkspaceSchemaFolder = "http://localhost/" & GetWorkspaceName() & "/system/schema" And replace with -> g_strPathToWorkspaceSchemaFolder = "http://your index server name/your index workspace name /system/schema" Hope this help! Weimin Changchien SPSFAQ030198 - In the Document Library, the Documents listed are sorted by Title as the default. How do I change this? Toby Tellier - 0 Comments - stephencummins - Mon, Jan 6th, 2003 - Customisation After much head banging, I have come up with a solution. The 2 files that need to be modified are TahoeUtils.asp and miscFunctions.js. In TahoeUtils.asp look for this section of code:
Dim strOrderByClause strOrderByClause = Request.Cookies(g_strSortByCookieId) If strOrderByClause = "" Then strOrderByClause = """urn:schemas-microsoft-com:office:office#Title"" ASC" End If Change it to: Dim strOrderByClause strOrderByClause = Request.Cookies(g_strSortByCookieId) If strOrderByClause = "" Then strOrderByClause = """DAV:getlastmodified"" DESC" End If Then look for this code: Dim strPropertyUri, fAscending GetOrderByPropertyAndDirectionFromCookie strPropertyUri, fAscending If Err.Number <> 0 Then SaveCurrentErrorContext "GetCombinedCategoryInfoAndItemsQueryResults() - Error getting ORDER BY propery name and direction." : Exit Sub If IsEmpty(strPropertyUri) Then strPropertyUri = "urn:schemas-microsoft-com:office:office#Title" ' If no cookie is set, it's order by title Change it to: Dim strPropertyUri, fAscending GetOrderByPropertyAndDirectionFromCookie strPropertyUri, fAscending If Err.Number <> 0 Then SaveCurrentErrorContext "GetCombinedCategoryInfoAndItemsQueryResults() - Error getting ORDER BY propery name and direction." : Exit Sub If IsEmpty(strPropertyUri) Then strPropertyUri = "DAV:getlastmodified" ' If no cookie is set, it's order by date This code is in the file twice. One for Categories, one for Document Library. I changed both since I wanted both to sort by date. Once this change has been made, the "Date" link will be highlighted when you either go to the Document Library or when you do a Category search. The documents will be listed in DESC order, but the up arrow will be displayed. In order to fix this, as well as making sure that the sorting works properly, find the following code in TahoeUtils.asp: Sub GetOrderByPropertyAndDirectionFromCookie(strPropertyUri, fAscending) On Error Resume Next Dim strOrderByClause strOrderByClause = Request.Cookies(g_strSortByCookieId) If Len(strOrderByClause) <= 0 Then strPropertyUri = Empty fAscending = True Exit Sub End If Change fAscending = True to fAscending = False Then we need to alter the miscFunctions.js file. Find this code: function setSortByDate( fUseForm ) { var strOrderByPropList = GetCookie( g_strSortByCookieId ); if ( g_strSearchSortByDate + g_strSearchSortDesc == strOrderByPropList ) { strOrderByPropList = g_strSearchSortByDate + g_strSearchSortAsc; } else { strOrderByPropList = g_strSearchSortByDate + g_strSearchSortDesc; } document.cookie = g_strSortByCookieId + "=" + strOrderByPropList; reloadPage( fUseForm, true ); } Just change all Desc to Asc and all Asc to Desc. function setSortByDate( fUseForm ) { var strOrderByPropList = GetCookie( g_strSortByCookieId ); if ( g_strSearchSortByDate + g_strSearchSortAsc == strOrderByPropList ) { strOrderByPropList = g_strSearchSortByDate + g_strSearchSortDesc; } else { strOrderByPropList = g_strSearchSortByDate + g_strSearchSortAsc; } document.cookie = g_strSortByCookieId + "=" + strOrderByPropList; reloadPage( fUseForm, true ); } Works like a charm! SPSFAQ030197 - We are trying to deny access to documents by setting the "NoAccess" property. Has anyone an idea how to accomplish this? Uwe - 0 Comments - stephencummins - Sat, Dec 7th, 2002 - Customisation I've done it. It works like this:
Const conCreateOverWrite = 67108864 Const adModeRead = 1 Dim arrNoAccess Dim oSpsSourceObject 'As New PKMCDO.KnowledgeDocument() set oSpsSourceObject = CreateObject("CDO.KnowledgeDocument") call oSpsSourceObject.DataSource.Open(conSourceFile, , adModeRead) Dim oNewBaseDocument 'As New PKMCDO.KnowledgeDocument() set oNewBaseDocument = CreateObject("CDO.KnowledgeDocument") arrNoAccess = array("DOMAIN\USER1","DOMAIN\USER2","DOMAIN\GROUP1") oNewBaseDocument.NoAccess = arrNoAccess call oNewBaseDocument.DataSource.SaveTo(conTargetFile , , , conCreateOverWrite) Uwe SPSFAQ030196 - How do I read the value of a document profile field? - 0 Comments - stephencummins - Sun, Nov 17th, 2002 - Customisation Use this code. Call GetDocumentData and pass it the URL for the document that you want to inspect.
Ted Gamble <% function StripSpecialCharacters(strStringIn) dim strTempString strTempString = strStringIn strTempString = replace(strTempString,"&","&") strTempString = replace(strTempString,"<","<") strTempString = replace(strTempString,">",">") strTempString = replace(strTempString,"""",""") strTempString = replace(strTempString,"'","'") StripSpecialCharacters=strTempString end function function GetDocumentData(strDocURL) dim oCDODoc dim oCDOItem dim oCDOFieldArray dim strDocURLVersioned dim strTitle dim strDescription dim strIndustry ' Get the document set oCDODoc = Server.CreateObject("CDO.KnowledgeDocument") ' Get the document's most recent version oCDODoc.DataSource.open strDocURL,,adModeRead strDocURLVersioned = oCDODoc.fields("urn:schemas-microsoft-com:publishing:LastUnapprovedVersion") & "" if strDocURLVersioned = "" then strDocURLVersioned = oCDODoc.fields("DAV:href") end if ' Rebind to current version oCDODoc.DataSource.open strDocURLVersioned,,adModeRead ' Retrieve profile fields strTitle = StripSpecialCharacters(oCDODoc.Title) strDescription = StripSpecialCharacters(oCDODoc.Description) oCDOFieldArray = oCDODoc.Fields("urn:schemas-microsoft-com:office:office#Industry") if isarray(oCDOFieldArray) then for each oCDOItem in oCDOFieldArray strIndustry = strIndustry & StripSpecialCharacters(oCDOItem) next end if . . etc, etc, etc..... . . set oCDODoc = Nothing end function %> SPSFAQ030195 - How do I how to make the Search webpart in the document library search through subfolders when the 'This Folder' scope is set? - 0 Comments - stephencummins - Sun, Nov 3rd, 2002 - Customisation A number of people have asked how to make the Search webpart in the document library search through subfolders when the 'This Folder' scope is set. I've not seen a real answer before.
1. In the document library goto Content and choose the Search part. 2. Open up advanced settings. 3. In the code look for :- strScopeQuery = " ( """ & g_strParentNamePropName & """ = '" & strScopeQuery & "' ) AND " it's about 1/3 of the way through the code. 4. Change it to :- strScopeQuery = " ( """ & g_strParentNamePropName & """ LIKE '" & strScopeQuery & "%' ) AND " 5. Save. Steven Collier SPSFAQ030194 - Is there a way of restricting the file size of the document uploaded? - 0 Comments - stephencummins - Sun, Nov 3rd, 2002 - Customisation There is not much code i needed to add, just cheking the totalbytes solved the matter , any way here is the link to the message:
http://groups.yahoo.com/group/sharepoint/message/3277 and to the file http://groups.yahoo.com/group/sharepoint/files/Restricting%20the%20file%20size.txt Khader SPSFAQ030193 - Is there any code that connects to the Team Services server and displays a list of STS sites the present user has access to? - 0 Comments - stephencummins - Sun, Nov 3rd, 2002 - Customisation Here's the post from Ryan, anyone know the solution?
Stephen Ok, I have a web part, code below, that connects to the Team Services server and displays a list of STS sites the present user has access to. There is only 1 problem, and maybe I need to ask this on the STS message board, but thought I would try here. The DB for STS only puts a users info into the USERINFO table once they have visited the site. So if you hit the portal, and you have access to 6 TS sites, but have only been to 3, only 3 show up in the Web part. Is there another table in the DB for STS that I can pull the "Have Access" info from? Thanks.. Ryan Here is the code: Function getContent(xmdomPart) Dim sContent DIM UserName DIM UserNameRep UserName = Request.ServerVariables("Logon_User") if Len(UserName) = 0 then UserName = "Anonymous" end if strconn = "Driver={SQL Server};Description=sqldemo;SERVER=TS_SERVER;UID=DBUSER;PWD =DBPWD;DATABASE=TS_SERVER_LM_W3SVC_1_Collab" set conn = server.createobject("adodb.connection") conn.open strconn strQuery="SELECT projects.tp_title, DocMd.Url from projects, DocMd, UserInfo " & _ "where projects.tp_HomePageId = DocMd.UrlId and " & _ "projects.tp_ID = UserInfo.tp_project and " & _ "UserInfo.tp_Name = '" & UserName & "' order by projects.tp_title" Set rs = conn.Execute(strQuery) 'flds = rs.Fields.Count If rs.EOF then sContent = "You have no communities." Else rs.movefirst sContent = "<TABLE border=0>" while not rs.eof sContent = sContent & "<TR><TD><IMG SRC=squarebullet.gif></TD><TD>" sContent = sContent & "<B><a target=newwindow href=http://TS_Server" & rs("Url") & ">" & rs("tp_title") & "</a>" sContent = sContent & "</TD></TR>" rs.MoveNext wend sContent = sContent & "</TABLE>" End if getContent = sContent End Function Page 12 of 24 - Jump to: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
|||||||||||||||||||||||||||||||||||||||||||||||||