Sharepoint 高级筛选

 

先看看效果吧..............

默认情况下:不做任何筛选.

 

添加一个筛选条件:

 

条件:如果是int类型那么可以有> < = 等 如果是string的话那么就没有这么多条件,当然这个还不是很完善.有兴趣的可以改善一下.. 

 

根据字段自动找出字段所包含的值,

 

删选一个出来,一般关系有and和or. 做过caml查询的都能明白..

 

先看看高级查询的html:

<div>
<h2>高级筛选</h2>
<div style="float:left;width:50%">
<table width="100%" border="1" bordercolor="silver">
<tbody><tr>
<th class="col">Field Name</th>
<th class="col">Compare</th>
<th class="col">Value</th>
<th class="col">Relation</th>
<th class="col">Action</th>
</tr>
</tbody></table>
<style type="text/css">
.col
{
 width:20%;
}
.searchField,.searchCompare,.searchValue,.searchConjunctions
{
width:100%;
}
</style>
<table id="filterdata" width="100%" border="1" bordercolor="silver">
</div>
<div style="float:right">
<input id="filter" type="button" value="筛选" style="">
<input id="addrow" type="button" value="添加" style="">

</div>
</div>

这里table里面的条件都是jquery 创建的.

 

 

这个是结果输出的div. 输出到autofilter

<div id="autofilter"></div>

 

这里是经过压缩的js.或者使用sp.services.js.

(function (H) { var h = "/"; var n = "Alerts"; var m = "Authentication"; var r = "Copy"; var O = "Forms"; var o = "Lists"; var L = "Meetings"; var d = "People"; var b = "Permissions"; var u = "PublishedLinksService"; var B = "Search"; var x = "SiteData"; var Q = "SocialDataService"; var Y = "TaxonomyClientService"; var M = "usergroup"; var J = "UserProfileService"; var aa = "Versions"; var k = "Views"; var G = "WebPartPages"; var q = "Webs"; var c = "Workflow"; var e = ""; var s = ""; var W = 0; var P = ""; var K = []; K.GetAlerts = [n, false]; K.DeleteAlerts = [n, true]; K.Mode = [m, false]; K.Login = [m, false]; K.CopyIntoItems = [r, true]; K.CopyIntoItemsLocal = [r, true]; K.GetItem = [r, false]; K.GetForm = [O, false]; K.GetFormCollection = [O, false]; K.AddAttachment = [o, true]; K.AddList = [o, true]; K.CheckInFile = [o, true]; K.CheckOutFile = [o, true]; K.DeleteList = [o, true]; K.GetAttachmentCollection = [o, false]; K.GetList = [o, false]; K.GetListAndView = [o, false]; K.GetListCollection = [o, false]; K.GetListContentType = [o, false]; K.GetListContentTypes = [o, false]; K.GetListItems = [o, false]; K.UpdateList = [o, true]; K.UpdateListItems = [o, true]; K.AddMeeting = [L, true]; K.CreateWorkspace = [L, true]; K.RemoveMeeting = [L, true]; K.SetWorkSpaceTitle = [L, true]; K.SearchPrincipals = [d, false]; K.AddPermission = [b, true]; K.AddPermissionCollection = [b, true]; K.GetPermissionCollection = [b, true]; K.RemovePermission = [b, true]; K.RemovePermissionCollection = [b, true]; K.UpdatePermission = [b, true]; K.GetLinks = [u, true]; K.GetPortalSearchInfo = [B, false]; K.GetSearchMetadata = [B, false]; K.Query = [B, false]; K.QueryEx = [B, false]; K.Status = [B, false]; K.EnumerateFolder = [x, false]; K.SiteDataGetList = [x, false]; K.SiteDataGetListCollection = [x, false]; K.AddComment = [Q, true]; K.AddTag = [Q, true]; K.AddTagByKeyword = [Q, true]; K.CountCommentsOfUser = [Q, false]; K.CountCommentsOfUserOnUrl = [Q, false]; K.CountCommentsOnUrl = [Q, false]; K.CountRatingsOnUrl = [Q, false]; K.CountTagsOfUser = [Q, false]; K.DeleteComment = [Q, true]; K.DeleteRating = [Q, true]; K.DeleteTag = [Q, true]; K.DeleteTagByKeyword = [Q, true]; K.DeleteTags = [Q, true]; K.GetAllTagTerms = [Q, false]; K.GetAllTagTermsForUrlFolder = [Q, false]; K.GetAllTagUrls = [Q, false]; K.GetAllTagUrlsByKeyword = [Q, false]; K.GetCommentsOfUser = [Q, false]; K.GetCommentsOfUserOnUrl = [Q, false]; K.GetCommentsOnUrl = [Q, false]; K.GetRatingAverageOnUrl = [Q, false]; K.GetRatingOfUserOnUrl = [Q, false]; K.GetRatingOnUrl = [Q, false]; K.GetRatingsOfUser = [Q, false]; K.GetRatingsOnUrl = [Q, false]; K.GetSocialDataForFullReplication = [Q, false]; K.GetTags = [Q, true]; K.GetTagsOfUser = [Q, true]; K.GetTagTerms = [Q, true]; K.GetTagTermsOfUser = [Q, true]; K.GetTagTermsOnUrl = [Q, true]; K.GetTagUrlsOfUser = [Q, true]; K.GetTagUrlsOfUserByKeyword = [Q, true]; K.GetTagUrls = [Q, true]; K.GetTagUrlsByKeyword = [Q, true]; K.SetRating = [Q, true]; K.UpdateComment = [Q, true]; K.AddTerms = [Y, true]; K.GetChildTermsInTerm = [Y, false]; K.GetChildTermsInTermSet = [Y, false]; K.GetKeywordTermsByGuids = [Y, false]; K.GetTermsByLabel = [Y, false]; K.GetTermSets = [Y, false]; K.AddGroup = [M, true]; K.AddGroupToRole = [M, true]; K.AddRole = [M, true]; K.AddRoleDef = [M, true]; K.AddUserCollectionToGroup = [M, true]; K.AddUserCollectionToRole = [M, true]; K.AddUserToGroup = [M, true]; K.AddUserToRole = [M, true]; K.GetAllUserCollectionFromWeb = [M, false]; K.GetGroupCollection = [M, false]; K.GetGroupCollectionFromRole = [M, false]; K.GetGroupCollectionFromSite = [M, false]; K.GetGroupCollectionFromUser = [M, false]; K.GetGroupCollectionFromWeb = [M, false]; K.GetGroupInfo = [M, false]; K.GetRoleCollection = [M, false]; K.GetRoleCollectionFromGroup = [M, false]; K.GetRoleCollectionFromUser = [M, false]; K.GetRoleCollectionFromWeb = [M, false]; K.GetRoleInfo = [M, false]; K.GetRolesAndPermissionsForCurrentUser = [M, false]; K.GetRolesAndPermissionsForSite = [M, false]; K.GetUserCollection = [M, false]; K.GetUserCollectionFromGroup = [M, false]; K.GetUserCollectionFromRole = [M, false]; K.GetUserCollectionFromSite = [M, false]; K.GetUserCollectionFromWeb = [M, false]; K.GetUserInfo = [M, false]; K.GetUserLoginFromEmail = [M, false]; K.RemoveGroup = [M, true]; K.RemoveGroupFromRole = [M, true]; K.RemoveRole = [M, true]; K.RemoveUserCollectionFromGroup = [M, true]; K.RemoveUserCollectionFromRole = [M, true]; K.RemoveUserCollectionFromSite = [M, true]; K.RemoveUserFromGroup = [M, true]; K.RemoveUserFromRole = [M, true]; K.RemoveUserFromSite = [M, true]; K.RemoveUserFromWeb = [M, true]; K.UpdateGroupInfo = [M, true]; K.UpdateRoleDefInfo = [M, true]; K.UpdateRoleInfo = [M, true]; K.UpdateUserInfo = [M, true]; K.AddColleague = [J, true]; K.AddLink = [J, true]; K.AddMembership = [J, true]; K.AddPinnedLink = [J, true]; K.CreateMemberGroup = [J, true]; K.CreateUserProfileByAccountName = [J, true]; K.GetCommonColleagues = [J, false]; K.GetCommonManager = [J, false]; K.GetCommonMemberships = [J, false]; K.GetInCommon = [J, false]; K.GetPropertyChoiceList = [J, false]; K.GetUserColleagues = [J, false]; K.GetUserLinks = [J, false]; K.GetUserMemberships = [J, false]; K.GetUserPinnedLinks = [J, false]; K.GetUserProfileByGuid = [J, false]; K.GetUserProfileByIndex = [J, false]; K.GetUserProfileByName = [J, false]; K.GetUserProfileCount = [J, false]; K.GetUserProfileSchema = [J, false]; K.ModifyUserPropertyByAccountName = [J, true]; K.RemoveAllColleagues = [J, true]; K.RemoveAllLinks = [J, true]; K.RemoveAllMemberships = [J, true]; K.RemoveAllPinnedLinks = [J, true]; K.RemoveColleague = [J, true]; K.RemoveLink = [J, true]; K.RemoveMembership = [J, true]; K.RemovePinnedLink = [J, true]; K.UpdateColleaguePrivacy = [J, true]; K.UpdateLink = [J, true]; K.UpdateMembershipPrivacy = [J, true]; K.UpdatePinnedLink = [J, true]; K.DeleteAllVersions = [aa, true]; K.DeleteVersion = [aa, true]; K.GetVersions = [aa, false]; K.RestoreVersion = [aa, true]; K.AddView = [k, true]; K.DeleteView = [k, true]; K.GetView = [k, false]; K.GetViewHtml = [k, false]; K.GetViewCollection = [k, false]; K.UpdateView = [k, true]; K.UpdateViewHtml = [k, true]; K.AddWebPart = [G, true]; K.GetWebPart2 = [G, false]; K.GetWebPartPage = [G, false]; K.GetWebPartProperties = [G, false]; K.GetWebPartProperties2 = [G, false]; K.CreateContentType = [q, true]; K.GetColumns = [q, false]; K.GetContentType = [q, false]; K.GetContentTypes = [q, false]; K.GetCustomizedPageStatus = [q, false]; K.GetListTemplates = [q, false]; K.GetObjectIdFromUrl = [q, false]; K.GetWeb = [q, false]; K.GetWebCollection = [q, false]; K.GetAllSubWebCollection = [q, false]; K.UpdateColumns = [q, true]; K.UpdateContentType = [q, true]; K.WebUrlFromPageUrl = [q, false]; K.AlterToDo = [c, true]; K.GetTemplatesForItem = [c, false]; K.GetToDosForItem = [c, false]; K.GetWorkflowDataForItem = [c, false]; K.GetWorkflowTaskData = [c, false]; K.StartWorkflow = [c, true]; var F = {}; F.header = "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body>"; F.footer = "</soap:Body></soap:Envelope>"; F.payload = ""; var N; H.fn.SPServices = function (i) { var t = H.extend({}, H.fn.SPServices.defaults, i); F.opheader = "<" + t.operation + " "; switch (K[t.operation][0]) { case n: F.opheader += "xmlns='http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/' >"; N = "http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/"; break; case L: F.opheader += "xmlns='http://schemas.microsoft.com/sharepoint/soap/meetings/' >"; N = "http://schemas.microsoft.com/sharepoint/soap/meetings/"; break; case b: F.opheader += "xmlns='http://schemas.microsoft.com/sharepoint/soap/directory/' >"; N = "http://schemas.microsoft.com/sharepoint/soap/directory/"; break; case u: F.opheader += "xmlns='http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService/' >"; N = "http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService/"; break; case B: F.opheader += "xmlns='urn:Microsoft.Search' >"; N = "urn:Microsoft.Search/"; break; case Q: F.opheader += "xmlns='http://microsoft.com/webservices/SharePointPortalServer/SocialDataService' >"; N = "http://microsoft.com/webservices/SharePointPortalServer/SocialDataService/"; break; case Y: F.opheader += "xmlns='http://schemas.microsoft.com/sharepoint/taxonomy/soap/' >"; N = "http://schemas.microsoft.com/sharepoint/taxonomy/soap/"; break; case M: F.opheader += "xmlns='http://schemas.microsoft.com/sharepoint/soap/directory/' >"; N = "http://schemas.microsoft.com/sharepoint/soap/directory/"; break; case J: F.opheader += "xmlns='http://microsoft.com/webservices/SharePointPortalServer/UserProfileService' >"; N = "http://microsoft.com/webservices/SharePointPortalServer/UserProfileService/"; break; case G: F.opheader += "xmlns='http://microsoft.com/sharepoint/webpartpages' >"; N = "http://microsoft.com/sharepoint/webpartpages/"; break; case c: F.opheader += "xmlns='http://schemas.microsoft.com/sharepoint/soap/workflow/' >"; N = "http://schemas.microsoft.com/sharepoint/soap/workflow/"; break; default: F.opheader += "xmlns='http://schemas.microsoft.com/sharepoint/soap/'>"; N = "http://schemas.microsoft.com/sharepoint/soap/"; break } N += t.operation; F.opfooter = "</" + t.operation + ">"; var ab = "_vti_bin/" + K[t.operation][0] + ".asmx"; if (t.webURL.charAt(t.webURL.length - 1) === h) { ab = t.webURL + ab } else { if (t.webURL.length > 0) { ab = t.webURL + h + ab } else { ab = H().SPServices.SPGetCurrentSite() + h + ab } } F.payload = ""; switch (t.operation) { case "GetAlerts": break; case "DeleteAlerts": F.payload += "<IDs>"; for (W = 0; W < t.IDs.length; W++) { F.payload += A("string", t.IDs[W]) } F.payload += "</IDs>"; break; case "Mode": break; case "Login": g(t, ["userName", "password"]); break; case "CopyIntoItems": g(t, ["SourceUrl"]); F.payload += "<DestinationUrls>"; for (W = 0; W < t.DestinationUrls.length; W++) { F.payload += A("string", t.DestinationUrls[W]) } F.payload += "</DestinationUrls>"; g(t, ["Fields", "Stream", "Results"]); break; case "CopyIntoItemsLocal": g(t, ["SourceUrl"]); F.payload += "<DestinationUrls>"; for (W = 0; W < t.DestinationUrls.length; W++) { F.payload += A("string", t.DestinationUrls[W]) } F.payload += "</DestinationUrls>"; break; case "GetItem": g(t, ["Url", "Fields", "Stream"]); break; case "GetForm": g(t, ["listName", "formUrl"]); break; case "GetFormCollection": g(t, ["listName"]); break; case "AddAttachment": g(t, ["listName", "listItemID", "fileName", "attachment"]); break; case "AddList": g(t, ["listName", "description", "templateID"]); break; case "CheckInFile": g(t, ["pageUrl", "comment", "CheckinType"]); break; case "CheckOutFile": g(t, ["pageUrl", "checkoutToLocal", "lastmodified"]); break; case "DeleteList": g(t, ["listName"]); break; case "GetAttachmentCollection": g(t, ["listName", ["listItemID", "ID"]]); break; case "GetList": g(t, ["listName"]); break; case "GetListAndView": g(t, ["listName", "viewName"]); break; case "GetListCollection": break; case "GetListContentType": g(t, ["listName", "contentTypeId"]); break; case "GetListContentTypes": g(t, ["listName"]); break; case "GetListItems": g(t, ["listName", "viewName", ["query", "CAMLQuery"], ["viewFields", "CAMLViewFields"], ["rowLimit", "CAMLRowLimit"], ["queryOptions", "CAMLQueryOptions"]]); break; case "UpdateList": g(t, ["listName", "listProperties", "newFields", "updateFields", "deleteFields", "listVersion"]); break; case "UpdateListItems": g(t, ["listName"]); if (t.updates.length > 0) { g(t, ["updates"]) } else { F.payload += "<updates><Batch OnError='Continue'><Method ID='1' Cmd='" + t.batchCmd + "'>"; for (W = 0; W < t.valuepairs.length; W++) { F.payload += "<Field Name='" + t.valuepairs[W][0] + "'>" + t.valuepairs[W][1] + "</Field>" } if (t.batchCmd !== "New") { F.payload += "<Field Name='ID'>" + t.ID + "</Field>" } F.payload += "</Method></Batch></updates>" } break; case "AddMeeting": g(t, ["organizerEmail", "uid", "sequence", "utcDateStamp", "title", "location", "utcDateStart", "utcDateEnd", "nonGregorian"]); break; case "CreateWorkspace": g(t, ["title", "templateName", "lcid", "timeZoneInformation"]); break; case "RemoveMeeting": g(t, ["recurrenceId", "uid", "sequence", "utcDateStamp", "cancelMeeting"]); break; case "SetWorkspaceTitle": g(t, ["title"]); break; case "SearchPrincipals": g(t, ["searchText", "maxResults", "principalType"]); break; case "AddPermission": g(t, ["objectName", "objectType", "permissionIdentifier", "permissionType", "permissionMask"]); break; case "AddPermissionCollection": g(t, ["objectName", "objectType", "permissionsInfoXml"]); break; case "GetPermissionCollection": g(t, ["objectName", "objectType"]); break; case "RemovePermission": g(t, ["objectName", "objectType", "permissionIdentifier", "permissionType"]); break; case "RemovePermissionCollection": g(t, ["objectName", "objectType", "memberIdsXml"]); break; case "UpdatePermission": g(t, ["objectName", "objectType", "permissionIdentifier", "permissionType", "permissionMask"]); break; case "GetLinks": break; case "GetPortalSearchInfo": F.opheader = "<" + t.operation + " xmlns='http://microsoft.com/webservices/OfficeServer/QueryService'/>"; N = "http://microsoft.com/webservices/OfficeServer/QueryService/" + t.operation; break; case "GetSearchMetadata": F.opheader = "<" + t.operation + " xmlns='http://microsoft.com/webservices/OfficeServer/QueryService'/>"; N = "http://microsoft.com/webservices/OfficeServer/QueryService/" + t.operation; break; case "Query": F.payload += A("queryXml", a(t.queryXml)); break; case "QueryEx": F.opheader = "<" + t.operation + " xmlns='http://microsoft.com/webservices/OfficeServer/QueryService'>"; N = "http://microsoft.com/webservices/OfficeServer/QueryService/" + t.operation; F.payload += A("queryXml", a(t.queryXml)); break; case "Status": break; case "EnumerateFolder": g(t, ["strFolderUrl"]); break; case "SiteDataGetList": g(t, ["strListName"]); P = F.opheader; F.opheader = P.replace("SiteDataGetList", "GetList"); P = F.opfooter; F.opfooter = P.replace("SiteDataGetList", "GetList"); break; case "SiteDataGetListCollection": P = F.opheader; F.opheader = P.replace("SiteDataGetListCollection", "GetListCollection"); P = F.opfooter; F.opfooter = P.replace("SiteDataGetListCollection", "GetListCollection"); break; case "AddComment": g(t, ["url", "comment", "isHighPriority", "title"]); break; case "AddTag": g(t, ["url", "termID", "title", "isPrivate"]); break; case "AddTagByKeyword": g(t, ["url", "keyword", "title", "isPrivate"]); break; case "CountCommentsOfUser": g(t, ["userAccountName"]); break; case "CountCommentsOfUserOnUrl": g(t, ["userAccountName", "url"]); break; case "CountCommentsOnUrl": g(t, ["url"]); break; case "CountRatingsOnUrl": g(t, ["url"]); break; case "CountTagsOfUser": g(t, ["userAccountName"]); break; case "DeleteComment": g(t, ["url", "lastModifiedTime"]); break; case "DeleteRating": g(t, ["url"]); break; case "DeleteTag": g(t, ["url", "termID"]); break; case "DeleteTagByKeyword": g(t, ["url", "keyword"]); break; case "DeleteTags": g(t, ["url"]); break; case "GetAllTagTerms": g(t, ["maximumItemsToReturn"]); break; case "GetAllTagTermsForUrlFolder": g(t, ["urlFolder", "maximumItemsToReturn"]); break; case "GetAllTagUrls": g(t, ["termID"]); break; case "GetAllTagUrlsByKeyword": g(t, ["keyword"]); break; case "GetCommentsOfUser": g(t, ["userAccountName", "maximumItemsToReturn", "startIndex"]); break; case "GetCommentsOfUserOnUrl": g(t, ["userAccountName", "url"]); break; case "GetCommentsOnUrl": g(t, ["url", "maximumItemsToReturn", "startIndex"]); if (t.excludeItemsTime.length > 0) { F.payload += A("excludeItemsTime", t.excludeItemsTime) } break; case "GetRatingAverageOnUrl": g(t, ["url"]); break; case "GetRatingOfUserOnUrl": g(t, ["userAccountName", "url"]); break; case "GetRatingOnUrl": g(t, ["url"]); break; case "GetRatingsOfUser": g(t, ["userAccountName"]); break; case "GetRatingsOnUrl": g(t, ["url"]); break; case "GetSocialDataForFullReplication": g(t, ["userAccountName"]); break; case "GetTags": g(t, ["url"]); break; case "GetTagsOfUser": g(t, ["userAccountName", "maximumItemsToReturn", "startIndex"]); break; case "GetTagTerms": g(t, ["maximumItemsToReturn"]); break; case "GetTagTermsOfUser": g(t, ["userAccountName", "maximumItemsToReturn"]); break; case "GetTagTermsOnUrl": g(t, ["url", "maximumItemsToReturn"]); break; case "GetTagUrls": g(t, ["termID"]); break; case "GetTagUrlsByKeyword": g(t, ["keyword"]); break; case "GetTagUrlsOfUser": g(t, ["termID", "userAccountName"]); break; case "GetTagUrlsOfUserByKeyword": g(t, ["keyword", "userAccountName"]); break; case "SetRating": g(t, ["url", "rating", "title", "analysisDataEntry"]); break; case "UpdateComment": g(t, ["url", "lastModifiedTime", "comment", "isHighPriority"]); break; case "AddTerms": g(t, ["sharedServiceId", "termSetId", "lcid", "newTerms"]); break; case "GetChildTermsInTerm": g(t, ["sspId", "lcid", "termId", "termSetId"]); break; case "GetChildTermsInTermSet": g(t, ["sspId", "lcid", "termSetId"]); break; case "GetKeywordTermsByGuids": g(t, ["termIds", "lcid"]); break; case "GetTermsByLabel": g(t, ["label", "lcid", "matchOption", "resultCollectionSize", "termIds", "addIfNotFound"]); break; case "GetTermSets": g(t, ["sharedServiceId", "termSetId", "lcid", "clientTimeStamps", "clientVersions"]); break; case "AddGroup": g(t, ["groupName", "ownerIdentifier", "ownerType", "defaultUserLoginName", "groupName", "description"]); break; case "AddGroupToRole": g(t, ["groupName", "roleName"]); break; case "AddRole": g(t, ["roleName", "description", "permissionMask"]); break; case "AddRoleDef": g(t, ["roleName", "description", "permissionMask"]); break; case "AddUserCollectionToGroup": g(t, ["groupName", "usersInfoXml"]); break; case "AddUserCollectionToRole": g(t, ["roleName", "usersInfoXml"]); break; case "AddUserToGroup": g(t, ["groupName", "userName", "userLoginName", "userEmail", "userNotes"]); break; case "AddUserToRole": g(t, ["roleName", "userName", "userLoginName", "userEmail", "userNotes"]); break; case "GetAllUserCollectionFromWeb": break; case "GetGroupCollection": g(t, ["groupNamesXml"]); break; case "GetGroupCollectionFromRole": g(t, ["roleName"]); break; case "GetGroupCollectionFromSite": break; case "GetGroupCollectionFromUser": g(t, ["userLoginName"]); break; case "GetGroupCollectionFromWeb": break; case "GetGroupInfo": g(t, ["groupName"]); break; case "GetRoleCollection": g(t, ["roleNamesXml"]); break; case "GetRoleCollectionFromGroup": g(t, ["groupName"]); break; case "GetRoleCollectionFromUser": g(t, ["userLoginName"]); break; case "GetRoleCollectionFromWeb": break; case "GetRoleInfo": g(t, ["roleName"]); break; case "GetRolesAndPermissionsForCurrentUser": break; case "GetRolesAndPermissionsForSite": break; case "GetUserCollection": g(t, ["userLoginNamesXml"]); break; case "GetUserCollectionFromGroup": g(t, ["groupName"]); break; case "GetUserCollectionFromRole": g(t, ["roleName"]); break; case "GetUserCollectionFromSite": break; case "GetUserCollectionFromWeb": break; case "GetUserInfo": g(t, ["userLoginName"]); break; case "GetUserLoginFromEmail": g(t, ["emailXml"]); break; case "RemoveGroup": g(t, ["groupName"]); break; case "RemoveGroupFromRole": g(t, ["roleName", "groupName"]); break; case "RemoveRole": g(t, ["roleName"]); break; case "RemoveUserCollectionFromGroup": g(t, ["groupName", "userLoginNamesXml"]); break; case "RemoveUserCollectionFromRole": g(t, ["roleName", "userLoginNamesXml"]); break; case "RemoveUserCollectionFromSite": g(t, ["userLoginNamesXml"]); break; case "RemoveUserFromGroup": g(t, ["groupName", "userLoginName"]); break; case "RemoveUserFromRole": g(t, ["roleName", "userLoginName"]); break; case "RemoveUserFromSite": g(t, ["userLoginName"]); break; case "RemoveUserFromWeb": g(t, ["userLoginName"]); break; case "UpdateGroupInfo": g(t, ["oldGroupName", "groupName", "ownerIdentifier", "ownerType", "description"]); break; case "UpdateRoleDefInfo": g(t, ["oldRoleName", "roleName", "description", "permissionMask"]); break; case "UpdateRoleInfo": g(t, ["oldRoleName", "roleName", "description", "permissionMask"]); break; case "UpdateUserInfo": g(t, ["userLoginName", "userName", "userEmail", "userNotes"]); break; case "AddColleague": g(t, ["accountName", "colleagueAccountName", "group", "privacy", "isInWorkGroup"]); break; case "AddLink": g(t, ["accountName", "name", "url", "group", "privacy"]); break; case "AddMembership": g(t, ["accountName", "membershipInfo", "group", "privacy"]); break; case "AddPinnedLink": g(t, ["accountName", "name", "url"]); break; case "CreateMemberGroup": g(t, ["membershipInfo"]); break; case "CreateUserProfileByAccountName": g(t, ["accountName"]); break; case "GetCommonColleagues": g(t, ["accountName"]); break; case "GetCommonManager": g(t, ["accountName"]); break; case "GetCommonMemberships": g(t, ["accountName"]); break; case "GetInCommon": g(t, ["accountName"]); break; case "GetPropertyChoiceList": g(t, ["propertyName"]); break; case "GetUserColleagues": g(t, ["accountName"]); break; case "GetUserLinks": g(t, ["accountName"]); break; case "GetUserMemberships": g(t, ["accountName"]); break; case "GetUserPinnedLinks": g(t, ["accountName"]); break; case "GetUserProfileByName": if (t.accountName.length > 0) { g(t, [["AccountName", "accountName"]]) } else { g(t, ["AccountName"]) } break; case "GetUserProfileCount": break; case "GetUserProfileSchema": break; case "ModifyUserPropertyByAccountName": g(t, ["accountName", "newData"]); break; case "RemoveAllColleagues": g(t, ["accountName"]); break; case "RemoveAllLinks": g(t, ["accountName"]); break; case "RemoveAllMemberships": g(t, ["accountName"]); break; case "RemoveAllPinnedLinks": g(t, ["accountName"]); break; case "RemoveColleague": g(t, ["accountName", "colleagueAccountName"]); break; case "RemoveLink": g(t, ["accountName", "id"]); break; case "RemoveMembership": g(t, ["accountName", "sourceInternal", "sourceReference"]); break; case "RemovePinnedLink": g(t, ["accountName", "id"]); break; case "UpdateColleaguePrivacy": g(t, ["accountName", "colleagueAccountName", "newPrivacy"]); break; case "UpdateLink": g(t, ["accountName", "data"]); break; case "UpdateMembershipPrivacy": g(t, ["accountName", "sourceInternal", "sourceReference", "newPrivacy"]); break; case "UpdatePinnedLink ": g(t, ["accountName", "data"]); break; case "DeleteAllVersions": g(t, ["fileName"]); break; case "DeleteVersion": g(t, ["fileName", "fileVersion"]); break; case "GetVersions": g(t, ["fileName"]); break; case "RestoreVersion": g(t, ["fileName", "fileVersion"]); break; case "AddView": g(t, ["listName", "viewName", "viewFields", "query", "rowLimit", "rowLimit", "type", "makeViewDefault"]); break; case "DeleteView": g(t, ["listName", "viewName"]); break; case "GetView": g(t, ["listName", "viewName"]); break; case "GetViewCollection": g(t, ["listName"]); break; case "GetViewHtml": g(t, ["listName", "viewName"]); break; case "UpdateView": g(t, ["listName", "viewName", "viewProperties", "query", "viewFields", "aggregations", "formats", "rowLimit"]); break; case "UpdateViewHtml": g(t, ["listName", "viewName", "viewProperties", "toolbar", "viewHeader", "viewBody", "viewFooter", "viewEmpty", "rowLimitExceeded", "query", "viewFields", "aggregations", "formats", "rowLimit"]); break; case "AddWebPart": g(t, ["pageUrl", "webPartXml", "storage"]); break; case "GetWebPart2": g(t, ["pageUrl", "storageKey", "storage", "behavior"]); break; case "GetWebPartPage": g(t, ["documentName", "behavior"]); break; case "GetWebPartProperties": g(t, ["pageUrl", "storage"]); break; case "GetWebPartProperties2": g(t, ["pageUrl", "storage", "behavior"]); break; case "CreateContentType": g(t, ["displayName", "parentType", "newFields", "contentTypeProperties"]); break; case "GetColumns": g(t, ["webUrl"]); break; case "GetContentType": g(t, ["contentTypeId"]); break; case "GetContentTypes": break; case "GetCustomizedPageStatus": g(t, ["fileUrl"]); break; case "GetListTemplates": break; case "GetObjectIdFromUrl": g(t, ["objectUrl"]); break; case "GetWeb": g(t, [["webUrl", "webURL"]]); break; case "GetWebCollection": break; case "GetAllSubWebCollection": break; case "UpdateColumns": g(t, ["newFields", "updateFields", "deleteFields"]); break; case "UpdateContentType": g(t, ["contentTypeId", "contentTypeProperties", "newFields", "updateFields", "deleteFields"]); break; case "WebUrlFromPageUrl": g(t, [["pageUrl", "pageURL"]]); break; case "AlterToDo": g(t, ["item", "todoId", "todoListId", "taskData"]); break; case "GetTemplatesForItem": g(t, ["item"]); break; case "GetToDosForItem": g(t, ["item"]); break; case "GetWorkflowDataForItem": g(t, ["item"]); break; case "GetWorkflowTaskData": g(t, ["item", "listId", "taskId"]); break; case "StartWorkflow": g(t, ["item", "templateId", "workflowParameters"]); break; default: break } var ac = F.header + F.opheader + F.payload + F.opfooter + F.footer; H.ajax({ url: ab, async: t.async, beforeSend: function (ad) { if (K[t.operation][1]) { ad.setRequestHeader("SOAPAction", N) } }, type: "POST", data: ac, dataType: "xml", contentType: "text/xml;charset='utf-8'", complete: t.completefunc }) }; H.fn.SPServices.defaults = { operation: "", webURL: "", pageURL: "", objectUrl: "", listName: "", description: "", templateID: "", formUrl: "", fileName: "", fileVersion: "", ID: 1, updates: "", comment: "", CheckinType: "", checkoutToLocal: "", lastmodified: "", viewName: "", viewProperties: "", viewFields: "", query: "", aggregations: "", formats: "", rowLimit: "", type: "", makeViewDefault: false, toolbar: "", viewHeader: "", viewBody: "", viewFooter: "", viewEmpty: "", rowLimitExceeded: "", CAMLViewName: "", CAMLQuery: "", CAMLViewFields: "", CAMLRowLimit: 0, CAMLQueryOptions: "<QueryOptions></QueryOptions>", batchCmd: "Update", valuepairs: [], listProperties: "", newFields: "", updateFields: "", deleteFields: "", contentTypeId: "", contentTypeProperties: "", listVersion: "", username: "", password: "", accountName: "", propertyName: "", newData: "", AccountName: "", userName: "", userLoginName: "", userEmail: "", userNotes: "", groupNamesXml: "", groupName: "", oldGroupName: "", ownerIdentifier: "", ownerType: "", defaultUserLoginName: "", roleNamesXml: "", roleName: "", oldRoleName: "", permissionIdentifier: "", permissionType: "", permissionMask: "", permissionsInfoXml: "", memberIdsXml: "", usersInfoXml: "", userLoginNamesXml: "", emailXml: "", objectName: "", objectType: "List", IDs: null, listItemID: "", attachment: "", SourceUrl: "", Url: "", DestinationUrls: [], Fields: "", Stream: "", Results: "", documentName: "", behavior: "Version3", storageKey: "", storage: "Shared", webPartXml: "", item: "", todoId: "", todoListId: "", taskData: "", listId: "", taskId: "", templateId: "", workflowParameters: "", fClaim: false, queryXml: "", cancelMeeting: true, lcid: "", location: "", nonGregorian: false, organizerEmail: "", recurrenceId: 0, sequence: 0, templateName: "", timeZoneInformation: "", title: "", uid: "", utcDateStamp: "", utcDateStart: "", utcDateEnd: "", searchText: "", maxResults: 10, principalType: "User", strFolderUrl: "", strListName: "", fileUrl: "", displayName: "", parentType: "", url: "", termID: "", userAccountName: "", maximumItemsToReturn: 0, urlFolder: "", keyword: "", startIndex: 0, excludeItemsTime: "", isHighPriority: false, isPrivate: false, lastModifiedTime: "", rating: 1, analysisDataEntry: "", sharedServiceId: "", termSetId: "", newTerms: "", sspId: "", termId: "", termIds: "", label: "", matchOption: "", resultCollectionSize: "", addIfNotFound: "", clientTimeStamps: "", clientVersions: "", async: true, completefunc: null }; H.fn.SPServices.SPGetCurrentSite = function () { if (e.length > 0) { return e } var i = F.header + "<WebUrlFromPageUrl xmlns='http://schemas.microsoft.com/sharepoint/soap/' ><pageUrl>" + ((location.href.indexOf("?") > 0) ? location.href.substr(0, location.href.indexOf("?")) : location.href) + "</pageUrl></WebUrlFromPageUrl>" + F.footer; H.ajax({ async: false, url: "/_vti_bin/Webs.asmx", type: "POST", data: i, dataType: "xml", contentType: 'text/xml;charset="utf-8"', complete: function (ab, t) { e = H(ab.responseXML).find("WebUrlFromPageUrlResult").text() } }); return e }; H.fn.SPServices.SPCascadeDropdowns = function (i) { var ab = H.extend({}, { relationshipWebURL: "", relationshipList: "", relationshipListParentColumn: "", relationshipListChildColumn: "", relationshipListSortColumn: "", parentColumn: "", childColumn: "", listName: H().SPServices.SPListNameFromUrl(), CAMLQuery: "", promptText: "Choose {0}...", completefunc: null, debug: false }, i); var t = new R(ab.parentColumn); if (t.Obj.html() === null && ab.debug) { E("SPServices.SPCascadeDropdowns", "parentColumn: " + ab.parentColumn, "Column not found on page"); return } switch (t.Type) { case "S": t.Obj.bind("change", function () { U(ab) }); t.Obj.change(); break; case "C": t.Obj.bind("propertychange", function () { U(ab) }); t.Obj.trigger("propertychange"); break; case "M": t.Obj.bind("dblclick", function () { U(ab) }); parentSelections = t.Obj.closest("span").find("select[ID$='SelectResult'][Title^='" + ab.parentColumn + " ']"); parentSelections.bind("dblclick", function () { U(ab) }); t.Obj.closest("span").find("button").each(function () { H(this).bind("click", function () { U(ab) }) }); U(ab); break; default: break } }; function U(ac) { var am = ""; var ag = null; var af = []; var ab; var ah; var aj; var ak; var ae = new R(ac.parentColumn); switch (ae.Type) { case "S": af.push(ae.Obj.find("option:selected").text()); break; case "C": af.push(ae.Obj.attr("value")); break; case "M": parentSelections = ae.Obj.closest("span").find("select[ID$='SelectResult'][Title^='" + ac.parentColumn + " ']"); H(parentSelections).find("option").each(function () { af.push(H(this).html()) }); break; default: break } var ai = H().SPServices.SPGetStaticFromDisplay({ listName: ac.listName, columnDisplayName: ac.childColumn }); if (ae.Obj.attr("SPCascadeDropdown_Selected_" + ai) === af.join(";#")) { return } ae.Obj.attr("SPCascadeDropdown_Selected_" + ai, af.join(";#")); var t = new R(ac.childColumn); if (t.Obj.html() === null && ac.debug) { E("SPServices.SPCascadeDropdowns", "childColumn: " + ac.childColumn, "Column not found on page"); return } switch (t.Type) { case "S": ag = t.Obj.find("option:selected").val(); break; case "C": ag = t.Obj.attr("value"); break; case "M": ah = t.Obj.closest("span").find("input[name$='MultiLookupPicker$data']"); ab = window[t.Obj.closest("tr").find("button[id$='AddButton']").attr("id").replace(/AddButton/, "MultiLookupPicker_m")]; currentSelection = t.Obj.closest("span").find("select[ID$='SelectResult'][Title^='" + ac.childColumn + " ']"); ab.data = ""; break; default: break } var ad = (ac.relationshipListSortColumn.length > 0) ? ac.relationshipListSortColumn : ac.relationshipListChildColumn; var i = "<Query><OrderBy><FieldRef Name='" + ad + "'/></OrderBy><Where>"; if (ac.CAMLQuery.length > 0) { i += "<And>" } if (af.length === 0) { i += "<Eq><FieldRef Name='" + ac.relationshipListParentColumn + "'/><Value Type='Text'></Value></Eq>" } else { if (af.length === 1) { i += "<Eq><FieldRef Name='" + ac.relationshipListParentColumn + "'/><Value Type='Text'>" + w(af[0]) + "</Value></Eq>" } else { var al = (af.length > 2) ? true : false; for (W = 0; W < (af.length - 1); W++) { i += "<Or>" } for (W = 0; W < af.length; W++) { i += "<Eq><FieldRef Name='" + ac.relationshipListParentColumn + "'/><Value Type='Text'>" + w(af[W]) + "</Value></Eq>"; if (W > 0 && (W < (af.length - 1)) && al) { i += "</Or>" } } i += "</Or>" } } if (ac.CAMLQuery.length > 0) { i += ac.CAMLQuery + "</And>" } i += "</Where></Query>"; H().SPServices({ operation: "GetList", async: false, listName: ac.listName, completefunc: function (ao, an) { H(ao.responseXML).find("Fields").each(function () { H(this).find("Field[DisplayName='" + ac.childColumn + "']").each(function () { ak = (H(this).attr("Required") === "TRUE") ? true : false; return false }) }) } }); H().SPServices({ operation: "GetListItems", async: false, webURL: ac.relationshipWebURL, listName: ac.relationshipList, CAMLQuery: i, CAMLViewFields: "<ViewFields><FieldRef Name='" + ac.relationshipListParentColumn + "' /><FieldRef Name='" + ac.relationshipListChildColumn + "' /></ViewFields>", CAMLRowLimit: 0, CAMLQueryOptions: "<QueryOptions><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns></QueryOptions>", completefunc: function (ao, an) { H(ao.responseXML).find("faultcode").each(function () { if (ac.debug) { E("SPServices.SPCascadeDropdowns", "relationshipListParentColumn: " + ac.relationshipListParentColumn + " or relationshipListChildColumn: " + ac.relationshipListChildColumn, "Not found in relationshipList " + ac.relationshipList) } return }); switch (t.Type) { case "S": t.Obj.attr("length", 0); if (!ak && (ac.promptText.length > 0)) { t.Obj.append("<option value='0'>" + ac.promptText.replace(/\{0\}/g, ac.childColumn) + "</option>") } break; case "C": am = ak ? "" : "(None)|0"; t.Obj.attr("value", ""); break; case "M": t.Obj.attr("length", 0); aj = ""; break; default: break } H(ao.responseXML).find("[nodeName='z:row']").each(function () { var aq = (H(this).attr("ows_" + ac.relationshipListChildColumn).indexOf(";#") > 0) ? H(this).attr("ows_" + ac.relationshipListChildColumn).split(";#")[0] : H(this).attr("ows_ID"); if (isNaN(aq)) { aq = H(this).attr("ows_ID") } var ap = (H(this).attr("ows_" + ac.relationshipListChildColumn).indexOf(";#") > 0) ? H(this).attr("ows_" + ac.relationshipListChildColumn).split(";#")[1] : H(this).attr("ows_" + ac.relationshipListChildColumn); switch (t.Type) { case "S": var ar = (H(this).attr("ows_ID") === ag) ? " selected='selected'" : ""; t.Obj.append("<option" + ar + " value='" + aq + "'>" + ap + "</option>"); break; case "C": if (ap === ag) { t.Obj.attr("value", ag) } am = am + ((am.length > 0) ? "|" : "") + ap + "|" + aq; break; case "M": t.Obj.append("<option value='" + aq + "'>" + ap + "</option>"); aj += aq + "|t" + ap + "|t |t |t"; break; default: break } }); switch (t.Type) { case "S": t.Obj.trigger("change"); break; case "C": t.Obj.attr("choices", am); t.Obj.trigger("propertychange"); break; case "M": ah.attr("value", aj); H(currentSelection).find("option").each(function () { var ap = H(this); H(this).attr("selected", "selected"); H(t.Obj).find("option").each(function () { if (H(this).html() === ap.html()) { ap.attr("selected", "") } }) }); GipRemoveSelectedItems(ab); H(t.Obj).find("option").each(function () { var ap = H(this); H(currentSelection).find("option").each(function () { if (H(this).html() === ap.html()) { ap.remove() } }) }); GipAddSelectedItems(ab); ab.data = GipGetGroupData(aj); t.Obj.trigger("dblclick"); break; default: break } } }); if (ac.completefunc !== null) { ac.completefunc() } } H.fn.SPServices.SPDisplayRelatedInfo = function (i) { var t = H.extend({}, { columnName: "", relatedWebURL: "", relatedList: "", relatedListColumn: "", relatedColumns: [], displayFormat: "table", headerCSSClass: "ms-vh2", rowCSSClass: "ms-vb", CAMLQuery: "", numChars: 0, matchType: "Eq", completefunc: null, debug: false }, i); var ab = new R(t.columnName); if (ab.Obj.html() === null && t.debug) { E("SPServices.SPDisplayRelatedInfo", "columnName: " + t.columnName, "Column not found on page"); return } switch (ab.Type) { case "S": ab.Obj.bind("change", function () { C(t) }); ab.Obj.change(); break; case "C": ab.Obj.bind("propertychange", function () { C(t) }); ab.Obj.trigger("propertychange"); break; case "M": if (t.debug) { E("SPServices.SPDisplayRelatedInfo", "columnName: " + t.columnName, "Multi-select columns not supported by this function") } break; default: break } }; function C(ae) { var t = null; var af = new R(ae.columnName); switch (af.Type) { case "S": t = af.Obj.find("option:selected").text(); break; case "C": t = af.Obj.attr("value"); if (ae.numChars > 0 && t.length < ae.numChars) { return } break; case "M": break; default: break } if (af.Obj.attr("showRelatedSelected") === t) { return } af.Obj.attr("showRelatedSelected", t); var ac = j("SPDisplayRelatedInfo", ae.columnName); H("#" + ac).remove(); af.Obj.parent().append("<div id=" + ac + "></div>"); var ad = []; H().SPServices({ operation: "GetList", async: false, webURL: ae.relatedWebURL, listName: ae.relatedList, completefunc: function (ah, ag) { H(ah.responseXML).find("faultcode").each(function () { if (ae.debug) { E("SPServices.SPDisplayRelatedInfo", "relatedList: " + ae.relatedList, "List not found"); return } }); H(ah.responseXML).find("Fields").each(function () { H(ah.responseXML).find("Field").each(function () { for (W = 0; W < ae.relatedColumns.length; W++) { if (H(this).attr("Name") === ae.relatedColumns[W]) { ad[W] = H(this) } } }) }) } }); var i = "<Query><Where>"; if (ae.CAMLQuery.length > 0) { i += "<And>" } i += "<" + ae.matchType + "><FieldRef Name='" + ae.relatedListColumn + "'/><Value Type='Text'>" + w(t) + "</Value></" + ae.matchType + ">"; if (ae.CAMLQuery.length > 0) { i += ae.CAMLQuery + "</And>" } i += "</Where></Query>"; var ab = " "; for (W = 0; W < ae.relatedColumns.length; W++) { ab += "<FieldRef Name='" + ae.relatedColumns[W] + "' />" } H().SPServices({ operation: "GetListItems", async: false, webURL: ae.relatedWebURL, listName: ae.relatedList, CAMLQuery: i, CAMLViewFields: "<ViewFields>" + ab + "</ViewFields>", CAMLRowLimit: 0, completefunc: function (ai, ah) { H(ai.responseXML).find("faultcode").each(function () { if (ae.debug) { E("SPServices.SPDisplayRelatedInfo", "relatedListColumn: " + ae.relatedListColumn, "Column not found in relatedList " + ae.relatedList); return } }); var ag; switch (ae.displayFormat) { case "table": ag = "<table>"; ag += "<tr>"; for (W = 0; W < ae.relatedColumns.length; W++) { if (typeof ad[W] === "undefined" && ae.debug) { E("SPServices.SPDisplayRelatedInfo", "columnName: " + ae.relatedColumns[W], "Column not found in relatedList"); return } ag += "<th class='" + ae.headerCSSClass + "'>" + ad[W].attr("DisplayName") + "</th>" } ag += "</tr>"; H(ai.responseXML).find("[nodeName='z:row']").each(function () { ag += "<tr>"; for (W = 0; W < ae.relatedColumns.length; W++) { ag += "<td class='" + ae.rowCSSClass + "'>" + y(ad[W], H(this).attr("ows_" + ae.relatedColumns[W]), ae) + "</td>" } ag += "</tr>" }); ag += "</table>"; break; case "list": ag = "<table>"; H(ai.responseXML).find("[nodeName='z:row']").each(function () { for (W = 0; W < ae.relatedColumns.length; W++) { ag += "<tr>"; ag += "<th class='" + ae.headerCSSClass + "'>" + ad[W].attr("DisplayName") + "</th>"; ag += "<td class='" + ae.rowCSSClass + "'>" + y(ad[W], H(this).attr("ows_" + ae.relatedColumns[W]), ae) + "</td>"; ag += "</tr>" } }); ag += "</table>"; break; default: break } H("#" + ac).html(ag) } }); if (ae.completefunc !== null) { ae.completefunc() } } H.fn.SPServices.SPFilterDropdown = function (aj) { var ab = H.extend({}, { relationshipWebURL: "", relationshipList: "", relationshipListColumn: "", relationshipListSortColumn: "", columnName: "", listName: H().SPServices.SPListNameFromUrl(), promptText: "Choose {0}...", CAMLQuery: "", completefunc: null, debug: false }, aj); var ai = ""; var ah = null; var t; var ad; var ag; var af; var ae = new R(ab.columnName); if (ae.Obj.html() === null && ab.debug) { E("SPServices.SPFilterDropdown", "columnName: " + ab.columnName, "Column not found on page"); return } switch (ae.Type) { case "S": ah = ae.Obj.find("option:selected").val(); break; case "C": ah = ae.Obj.attr("value"); break; case "M": ad = ae.Obj.closest("span").find("input[name$='MultiLookupPicker$data']"); t = window[ae.Obj.closest("tr").find("button[id$='AddButton']").attr("id").replace(/AddButton/, "MultiLookupPicker_m")]; currentSelection = ae.Obj.closest("span").find("select[ID$='SelectResult'][Title^='" + ab.columnName + " ']"); t.data = ""; break; default: break } var ac = (ab.relationshipListSortColumn.length > 0) ? ab.relationshipListSortColumn : ab.relationshipListColumn; var i = "<Query><OrderBy><FieldRef Name='" + ac + "'/></OrderBy><Where>"; if (ab.CAMLQuery.length > 0) { i += ab.CAMLQuery } i += "</Where></Query>"; H().SPServices({ operation: "GetList", async: false, listName: ab.listName, completefunc: function (al, ak) { H(al.responseXML).find("Fields").each(function () { H(this).find("Field[DisplayName='" + ab.columnName + "']").each(function () { af = (H(this).attr("Required") === "TRUE") ? true : false; return false }) }) } }); H().SPServices({ operation: "GetListItems", async: false, webURL: ab.relationshipWebURL, listName: ab.relationshipList, CAMLQuery: i, CAMLViewFields: "<ViewFields><FieldRef Name='" + ab.relationshipListColumn + "' /></ViewFields>", CAMLRowLimit: 0, CAMLQueryOptions: "<QueryOptions><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns></QueryOptions>", completefunc: function (al, ak) { H(al.responseXML).find("faultcode").each(function () { if (ab.debug) { E("SPServices.SPFilterDropdown", "relationshipListColumn: " + ab.relationshipListColumn, "Not found in relationshipList " + ab.relationshipList + " - or CAML is incorrect") } return }); switch (ae.Type) { case "S": ae.Obj.attr("length", 0); if (!af && (ab.promptText.length > 0)) { ae.Obj.append("<option value='0'>" + ab.promptText.replace(/\{0\}/g, ab.columnName) + "</option>") } break; case "C": ai = af ? "" : "(None)|0"; ae.Obj.attr("value", ""); break; case "M": ae.Obj.attr("length", 0); ag = ""; break; default: break } H(al.responseXML).find("[nodeName='z:row']").each(function () { var an = (H(this).attr("ows_" + ab.relationshipListColumn).indexOf(";#") > 0) ? H(this).attr("ows_" + ab.relationshipListColumn).split(";#")[0] : H(this).attr("ows_ID"); if (isNaN(an)) { an = H(this).attr("ows_ID") } var am = (H(this).attr("ows_" + ab.relationshipListColumn).indexOf(";#") > 0) ? H(this).attr("ows_" + ab.relationshipListColumn).split(";#")[1] : H(this).attr("ows_" + ab.relationshipListColumn); switch (ae.Type) { case "S": var ao = (H(this).attr("ows_ID") === ah) ? " selected='selected'" : ""; ae.Obj.append("<option" + ao + " value='" + an + "'>" + am + "</option>"); break; case "C": if (am === ah) { ae.Obj.attr("value", ah) } ai = ai + ((ai.length > 0) ? "|" : "") + am + "|" + an; break; case "M": ae.Obj.append("<option value='" + an + "'>" + am + "</option>"); ag += an + "|t" + am + "|t |t |t"; break; default: break } }); switch (ae.Type) { case "S": ae.Obj.trigger("change"); break; case "C": ae.Obj.attr("choices", ai); ae.Obj.trigger("propertychange"); break; case "M": ad.attr("value", ag); H(currentSelection).find("option").each(function () { var am = H(this); H(this).attr("selected", "selected"); H(ae.Obj).find("option").each(function () { if (H(this).html() === am.html()) { am.attr("selected", "") } }) }); GipRemoveSelectedItems(t); H(ae.Obj).find("option").each(function () { var am = H(this); H(currentSelection).find("option").each(function () { if (H(this).html() === am.html()) { am.remove() } }) }); GipAddSelectedItems(t); t.data = GipGetGroupData(ag); ae.Obj.trigger("dblclick"); break; default: break } } }); if (ab.completefunc !== null) { ab.completefunc() } }; H.fn.SPServices.SPDebugXMLHttpResult = function (t) { var ab = H.extend({}, { node: null, indent: 0 }, t); var ad = 3; var ac = 4; var i = ""; i += "<table class='ms-vb' style='margin-left:" + ab.indent * 3 + "px;' width='100%'>"; if (ab.node.nodeName === "DisplayPattern") { i += "<tr><td width='100px' style='font-weight:bold;'>" + ab.node.nodeName + "</td><td><textarea readonly='readonly' rows='5' cols='50'>" + ab.node.xml + "</textarea></td></tr>" } else { if (!ab.node.hasChildNodes()) { i += "<tr><td width='100px' style='font-weight:bold;'>" + ab.node.nodeName + "</td><td>" + ((ab.node.nodeValue !== null) ? v(ab.node.nodeValue) : "&nbsp;") + "</td></tr>"; if (ab.node.attributes) { i += "<tr><td colspan='99'>"; i += S(ab.node, ab); i += "</td></tr>" } } else { if (ab.node.hasChildNodes() && ab.node.firstChild.nodeType === ac) { i += "<tr><td width='100px' style='font-weight:bold;'>" + ab.node.nodeName + "</td><td><textarea readonly='readonly' rows='5' cols='50'>" + ab.node.parentNode.text + "</textarea></td></tr>" } else { if (ab.node.hasChildNodes() && ab.node.firstChild.nodeType === ad) { i += "<tr><td width='100px' style='font-weight:bold;'>" + ab.node.nodeName + "</td><td>" + v(ab.node.firstChild.nodeValue) + "</td></tr>" } else { i += "<tr><td width='100px' style='font-weight:bold;' colspan='99'>" + ab.node.nodeName + "</td></tr>"; if (ab.node.attributes) { i += "<tr><td colspan='99'>"; i += S(ab.node, ab); i += "</td></tr>" } i += "<tr><td>"; for (W = 0; W < ab.node.childNodes.length; W++) { i += H().SPServices.SPDebugXMLHttpResult({ node: ab.node.childNodes.item(W), indent: ab.indent++ }) } i += "</td></tr>" } } } } i += "</table>"; return i }; H.fn.SPServices.SPGetCurrentUser = function (ab) { var ac = H.extend({}, { fieldName: "Name", debug: false }, ab); if (ac.fieldName === "ID") { return _spUserId } var t = ""; var i = RegExp('FieldInternalName="' + ac.fieldName + '"', "gi"); H.ajax({ async: false, url: H().SPServices.SPGetCurrentSite() + "/_layouts/userdisp.aspx?Force=True&" + new Date().getTime(), complete: function (ae, ad) { H(ae.responseText).find("table.ms-formtable td[id^='SPField']").each(function () { if (i.test(H(this).html())) { switch (H(this).attr("id")) { case "SPFieldText": t = H(this).text(); break; case "SPFieldNote": t = H(this).find("div").html(); break; case "SPFieldURL": t = H(this).find("img").attr("src"); break; default: t = H(this).text(); break } return false } }) } }); return t.replace(/(^[\s\xA0]+|[\s\xA0]+$)/g, "") }; H.fn.SPServices.SPLookupAddNew = function (ab) { var ac = H.extend({}, { lookupColumn: "", promptText: "Add new {0}", completefunc: null, debug: false }, ab); var t = new R(ac.lookupColumn); if (t.Obj.html() === null && ac.debug) { E("SPServices.SPLookupAddNew", "lookupColumn: " + ac.lookupColumn, "Column not found on page"); return } var ae = ""; var i = ""; var ad = ""; H().SPServices({ operation: "GetList", async: false, listName: H().SPServices.SPListNameFromUrl(), completefunc: function (ag, af) { H(ag.responseXML).find("Field[DisplayName='" + ac.lookupColumn + "']").each(function () { ad = H(this).attr("StaticName"); H().SPServices({ operation: "GetList", async: false, listName: H(this).attr("List"), completefunc: function (ai, ah) { H(ai.responseXML).find("List").each(function () { i = H(this).attr("WebFullUrl"); i = i !== h ? i + h : i }) } }); ae = p(H(this).attr("List"), "NewForm"); return false }) } }); if (i.length === 0 && ac.debug) { E("SPServices.SPLookupAddNew", "lookupColumn: " + ac.lookupColumn, "This column does not appear to be a lookup column"); return } if (ae.length > 0) { newLink = "<div id='SPLookupAddNew_" + ad + "'><a href='" + i + ae + "?Source=" + Z(location.href) + "'>" + ac.promptText.replace(/\{0\}/g, ac.lookupColumn) + "</a></div>"; H(t.Obj).parents("td.ms-formbody").append(newLink) } else { if (ac.debug) { E("SPServices.SPLookupAddNew", "lookupColumn: " + ac.lookupColumn, "NewForm cannot be found"); return } } if (ac.completefunc !== null) { ac.completefunc() } }; H.fn.SPServices.SPGetLastItemId = function (t) { var ac = H.extend({}, { webURL: "", listName: "", userAccount: "", CAMLQuery: "" }, t); var ab; var ad = 0; H().SPServices({ operation: "GetUserInfo", async: false, userLoginName: (ac.userAccount !== "") ? ac.userAccount : H().SPServices.SPGetCurrentUser(), completefunc: function (af, ae) { H(af.responseXML).find("User").each(function () { ab = H(this).attr("ID") }) } }); var i = "<Query><Where>"; if (ac.CAMLQuery.length > 0) { i += "<And>" } i += "<Eq><FieldRef Name='Author' LookupId='TRUE'/><Value Type='Integer'>" + ab + "</Value></Eq>"; if (ac.CAMLQuery.length > 0) { i += ac.CAMLQuery + "</And>" } i += "</Where><OrderBy><FieldRef Name='Created_x0020_Date' Ascending='FALSE'/></OrderBy></Query>"; H().SPServices({ operation: "GetListItems", async: false, webURL: ac.webURL, listName: ac.listName, CAMLQuery: i, CAMLViewFields: "<ViewFields><FieldRef Name='ID'/></ViewFields>", CAMLRowLimit: 1, CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope='Recursive' /></QueryOptions>", completefunc: function (af, ae) { H(af.responseXML).find("[nodeName='z:row']").each(function () { ad = H(this).attr("ows_ID") }) } }); return ad }; H.fn.SPServices.SPRequireUnique = function (ah) { var i = H.extend({}, { columnStaticName: "Title", duplicateAction: 0, ignoreCase: false, initMsg: "This value must be unique.", initMsgCSSClass: "ms-vb", errMsg: "This value is not unique.", errMsgCSSClass: "ms-formvalidation", showDupes: false, completefunc: null }, ah); var ab = H().SPServices.SPGetQueryString(); var af = ab.ID; var ae = H().SPServices.SPListNameFromUrl(); var t = "<span id='SPRequireUnique" + i.columnStaticName + "' class='{0}'>{1}</span><br/>"; var ad = t.replace(/\{0\}/g, i.initMsgCSSClass).replace(/\{1\}/g, i.initMsg); var ac = H().SPServices.SPGetDisplayFromStatic({ listName: ae, columnStaticName: i.columnStaticName }); var ag = H("input[Title='" + ac + "']"); H(ag).parent().append(ad); H(ag).blur(function () { var ak = []; var al = H(this).attr("value"); H().SPServices({ operation: "GetListItems", async: false, listName: ae, CAMLQuery: "<Query><Where><IsNotNull><FieldRef Name='" + i.columnStaticName + "'/></IsNotNull></Where></Query>", CAMLViewFields: "<ViewFields><FieldRef Name='ID' /><FieldRef Name='" + i.columnStaticName + "' /></ViewFields>", CAMLRowLimit: 0, completefunc: function (ao, am) { var an = i.ignoreCase ? al.toUpperCase() : al; H(ao.responseXML).find("[nodeName='z:row']").each(function () { var ap = i.ignoreCase ? H(this).attr("ows_" + i.columnStaticName).toUpperCase() : H(this).attr("ows_" + i.columnStaticName); if ((an === ap) && (H(this).attr("ows_ID") !== af)) { ak.push([H(this).attr("ows_ID"), H(this).attr("ows_" + i.columnStaticName)]) } }) } }); var aj = i.initMsg; H("span#SPRequireUnique" + i.columnStaticName).html(aj).attr("class", i.initMsgCSSClass); H("input[value='OK'], input[value='Save']").attr("disabled", ""); if (ak.length > 0) { aj = i.errMsg; H("span#SPRequireUnique" + i.columnStaticName).html(aj).attr("class", i.errMsgCSSClass); if (i.duplicateAction === 1) { H("input[Title='" + i.columnDisplayName + "']").focus(); H("input[value='OK'], input[value='Save']").attr("disabled", "disabled") } if (i.showDupes) { var ai = " " + ak.length + " duplicate item" + (ak.length > 1 ? "s" : "") + ": "; for (W = 0; W < ak.length; W++) { ai += "<a href='DispForm.aspx?ID=" + ak[W][0] + "&Source=" + location.href + "'>" + ak[W][1] + "</a> " } H("span#SPRequireUnique" + i.columnStaticName).append(ai) } } }); if (i.completefunc !== null) { i.completefunc() } }; H.fn.SPServices.SPGetDisplayFromStatic = function (t) { var ab = H.extend({}, { webURL: "", listName: "", columnStaticName: "" }, t); var i = ""; H().SPServices({ operation: "GetList", async: false, webURL: ab.webURL, listName: ab.listName, completefunc: function (ad, ac) { H(ad.responseXML).find("Field[StaticName='" + ab.columnStaticName + "']").each(function () { i = H(this).attr("DisplayName"); return false }) } }); return i }; H.fn.SPServices.SPGetStaticFromDisplay = function (i) { var ab = H.extend({}, { webURL: "", listName: "", columnDisplayName: "" }, i); var t = ""; H().SPServices({ operation: "GetList", async: false, webURL: ab.webURL, listName: ab.listName, completefunc: function (ad, ac) { H(ad.responseXML).find("Field[DisplayName='" + ab.columnDisplayName + "']").each(function () { t = H(this).attr("StaticName"); return false }) } }); return t }; H.fn.SPServices.SPRedirectWithID = function (ah) { var i = H.extend({}, { redirectUrl: "", qsParamName: "ID" }, ah); var af = H().SPServices.SPListNameFromUrl(); var t = H().SPServices.SPGetQueryString(); var ac = t.ID; var ad = t.List; var ag = t.RootFolder; var ae = t.ContentTypeId; if (typeof t.ID === "undefined") { ac = H().SPServices.SPGetLastItemId({ listName: af }); H("form[name='aspnetForm']").each(function () { var aj = (location.href.indexOf("?") > 0) ? location.href.substring(0, location.href.indexOf("?")) : location.href; var ak = (typeof t.Source === "string") ? "Source=" + t.Source.replace(/\//g, "%2f").replace(/:/g, "%3a") : ""; var ai = []; if (typeof ad !== "undefined") { ai.push("List=" + ad) } if (typeof ag !== "undefined") { ai.push("RootFolder=" + ag) } if (typeof ae !== "undefined") { ai.push("ContentTypeId=" + ae) } var al = aj + ((ai.length > 0) ? ("?" + ai.join("&") + "&") : "?") + "Source=" + aj + "?ID=" + ac + ((ak.length > 0) ? ("%26RealSource=" + t.Source) : "") + ((typeof t.RedirectURL === "string") ? ("%26RedirectURL=" + t.RedirectURL) : ""); H(this).attr("action", al) }) } else { while (t.ID === ac) { ac = H().SPServices.SPGetLastItemId({ listName: af }) } var ab = (typeof t.RedirectURL === "string") ? t.RedirectURL : i.redirectUrl; location.href = ab + "?" + i.qsParamName + "=" + ac + ((typeof t.RealSource === "string") ? ("&Source=" + t.RealSource) : "") } }; H.fn.SPServices.SPSetMultiSelectSizes = function (ah) { var i = H.extend({}, { multiSelectColumn: "", minWidth: 0, maxWidth: 0 }, ah); var ad = H("select[ID$='SelectCandidate'][Title^='" + i.multiSelectColumn + " ']"); var af = ad.closest("span").find("select[ID$='SelectResult'][Title^='" + i.multiSelectColumn + " ']"); var ae = j("SPSetMultiSelectSizes", i.multiSelectColumn); ad.clone().appendTo(ad.closest("span")).css({ width: "auto", height: 0, visibility: "hidden" }).attr({ id: ae, length: 0 }); var ac = H("#" + ae); ad.find("option").each(function () { ac.append("<option value='" + H(this).html() + "'>" + H(this).html() + "</option>") }); af.find("option").each(function () { ac.append("<option value='" + H(this).html() + "'>" + H(this).html() + "</option>") }); var t = H("#" + ae).width() + 5; var ag = t; if (i.minWidth > 0 || i.maxWidth > 0) { if (t < i.minWidth) { t = i.minWidth } if (ag < i.minWidth) { ag = i.minWidth } if (ag > i.maxWidth) { ag = i.maxWidth } } var ab = t; ad.css("width", ab + "px").parent().css("width", ag + "px"); af.css("width", ab + "px").parent().css("width", ag + "px"); H("#" + ae).remove() }; H.fn.SPServices.SPScriptAudit = function (ab) { var ac = H.extend({}, { webURL: "", listName: "", outputId: "", auditForms: true, auditViews: true, auditPages: true, auditPagesListName: "Pages", showHiddenLists: false, showNoScript: false, showSrc: true }, ab); var t = [["New", "NewForm.aspx", false], ["Display", "DispForm.aspx", false], ["Edit", "EditForm.aspx", false]]; var ad; H("#" + ac.outputId).append("<table id='SPScriptAudit' width='100%' style='border-collapse: collapse;' border=0 cellSpacing=0 cellPadding=1><tr><th></th><th>List</th><th>Page Class</th><th>Page Type</th><th>Page</th>" + (ac.showSrc ? "<th>Script References</th>" : "") + "</tr></table>"); H("#SPScriptAudit th").attr("class", "ms-vh2-nofilter"); if (ac.auditForms || ac.auditViews) { H().SPServices({ operation: "GetListCollection", webURL: ac.webURL, async: false, completefunc: function (ag, af) { H(ag.responseXML).find("List").each(function () { ad = H(this); if ((ac.listName.length === 0) || (ad.attr("Title") === ac.listName)) { if ((ac.showHiddenLists && ad.attr("Hidden") === "False") || !ac.showHiddenLists) { if (ac.auditForms) { H().SPServices({ operation: "GetListContentTypes", webURL: ac.webURL, listName: ad.attr("ID"), async: false, completefunc: function (ai, ah) { H(ai.responseXML).find("ContentType").each(function () { if (H(this).attr("ID").substring(0, 6) !== "0x0120") { var ak = H(this).find("FormUrls"); for (W = 0; W < t.length; W++) { H(ak).find(t[W][0]).each(function () { l(ac, ad, "Form", this.nodeName, ((ac.webURL.length > 0) ? ac.webURL : H().SPServices.SPGetCurrentSite()) + h + H(this).text()); t[W][2] = true }); if (!t[W][2]) { var aj = ad.attr("DefaultViewUrl"); l(ac, ad, "Form", t[W][0], aj.substring(0, aj.lastIndexOf(h) + 1) + t[W][1]) } } for (W = 0; W < t.length; W++) { t[W][2] = false } } }) } }) } if (ac.auditViews) { H().SPServices({ operation: "GetViewCollection", webURL: ac.webURL, listName: ad.attr("ID"), async: false, completefunc: function (ai, ah) { H(ai.responseXML).find("View").each(function () { l(ac, ad, "View", H(this).attr("DisplayName"), H(this).attr("Url")) }) } }) } } } }) } }) } var i = 0; var ae = []; if (typeof ac.auditPagesListName === "string") { i = 1; ae.push(ac.auditPagesListName) } else { i = ac.auditPagesListName.length; ae = ac.auditPagesListName } if (ac.auditPages) { for (W = 0; W < i; W++) { H().SPServices({ operation: "GetList", async: false, webURL: ac.webURL, listName: ae[W], completefunc: function (ag, af) { H(ag.responseXML).find("List").each(function () { ad = H(this) }) } }); H().SPServices({ operation: "GetListItems", async: false, webURL: ac.webURL, listName: ae[W], CAMLQuery: "<Query><Where><Neq><FieldRef Name='ContentType'/><Value Type='Text'>Folder</Value></Neq></Where></Query>", CAMLViewFields: "<ViewFields><FieldRef Name='Title'/><FieldRef Name='FileRef'/></ViewFields>", CAMLRowLimit: 0, completefunc: function (ag, af) { H(ag.responseXML).find("[nodeName='z:row']").each(function () { var ai = H(this).attr("ows_FileRef").split(";#")[1]; var ah = (typeof H(this).attr("ows_Title") !== "undefined") ? H(this).attr("ows_Title") : ""; if (ai.indexOf(".aspx") > 0) { l(ac, ad, "Page", ah, h + ai) } }) } }) } } H("#SPScriptAudit tr[class='ms-alternating']:even").attr("class", "") }; function l(t, ab, ai, ae, ac) { var af = 0; var ah = 0; var ad = {}; ad.type = []; ad.src = []; ad.script = []; var ag = RegExp("<script[\\s\\S]*?/script>", "gi"); H.ajax({ type: "GET", url: ac, dataType: "text", async: false, success: function (an) { while (scriptMatch = ag.exec(an)) { var aj = D(scriptMatch, "language"); var ao = D(scriptMatch, "type"); var al = D(scriptMatch, "src"); if (al !== null && al.length > 0 && !I(al)) { ad.type.push((aj !== null && aj.length > 0) ? aj : ao); ad.src.push(al); ah++ } } if ((!t.showNoScript && (ad.type.length > 0)) || t.showNoScript) { var am = ac.substring(0, ac.lastIndexOf(h) + 1); var ak = "<tr class=ms-alternating><td class=ms-vb-icon><a href='" + ab.attr("DefaultViewUrl") + "'><IMG border=0 src='" + ab.attr("ImageUrl") + "'width=16 height=16></A></TD><td class=ms-vb2><a href='" + ab.attr("DefaultViewUrl") + "'>" + ab.attr("Title") + ((ab.attr("Hidden") === "True") ? "(Hidden)" : "") + "</td><td class=ms-vb2>" + ai + "</td><td class=ms-vb2>" + ae + "</td><td class=ms-vb2><a href='" + ac + "'>" + z(ac) + "</td>"; if (t.showSrc) { var i; ak += "<td valign='top'><table width='100%' style='border-collapse: collapse;' border=0 cellSpacing=0 cellPadding=1>"; for (af = 0; af < ad.type.length; af++) { i = (ad.src[af].substr(0, 1) !== h) ? am + ad.src[af] : ad.src[af]; ak += "<tr><td class=ms-vb2 width='30%'>" + ad.type[af] + "</td>"; ak += "<td class=ms-vb2 width='70%'><a href='" + i + "'>" + z(ad.src[af]) + "</td></tr>" } ak += "</table></td>" } H("#SPScriptAudit").append(ak) } } }) } function D(ab, t) { var i = RegExp(t + "=(\"([^\"]*)\")|('([^']*)')", "gi"); if (matches = i.exec(ab)) { return matches[2] } return null } function I(ac) { var ab; var t = ["WebResource.axd", "_layouts"]; for (ab = 0; ab < t.length; ab++) { if (ac.indexOf(t[ab]) > -1) { return true } } return false } H.fn.SPServices.SPArrangeChoices = function (ai) { var t = H.extend({}, { listName: "", columnName: "", perRow: 99, randomize: false }, ai); var ae = false; var af = []; var ac; H().SPServices({ operation: "GetList", async: false, listName: (t.listName.length > 0) ? t.listName : H().SPServices.SPListNameFromUrl(), completefunc: function (ak, aj) { H(ak.responseXML).find("Fields").each(function () { H(this).find("Field[DisplayName='" + t.columnName + "']").each(function () { ae = (H(this).attr("FillInChoice") === "TRUE") ? true : false; return false }) }) } }); var ab = T(t.columnName); var ad = H(ab).find("tr").length; var ag = 0; var i; var ah; H(ab).find("tr").each(function () { ag++; if (ae && ag === (ad - 1)) { i = H(this).find("td").html() } else { if (ae && ag === ad) { ah = H(this).find("td").html() } else { af.push(H(this).html()) } } }); ac = "<TR>"; if (t.randomize) { af.sort(V) } for (W = 0; W < af.length; W++) { ac += af[W]; if ((W + 1) % t.perRow === 0) { ac += "</TR><TR>" } } ac += "</TR>"; if (ae) { ac += "<TR><TD colspan='99'>" + i + ah + "</TD></TR>" } H(ab).find("tr").remove(); H(ab).find("table").append(ac) }; H.fn.SPServices.SPAutocomplete = function (ab) { var ac = H.extend({}, { WebURL: "", sourceList: "", sourceColumn: "", columnName: "", CAMLQuery: "", CAMLQueryOptions: "<QueryOptions></QueryOptions>", filterType: "BeginsWith", numChars: 0, ignoreCase: false, highlightClass: "", uniqueVals: false, maxHeight: 99999, slideDownSpeed: "fast", processingIndicator: "_layouts/images/REFRESH.GIF", debug: false }, ab); var ae; var t = H("input[Title='" + ac.columnName + "']"); H("input[Title='" + ac.columnName + "']").css("position", ""); var af = H(t).attr("ID"); var ad = H(t).css("color"); var ag = H(t).css("width"); if (t.html() === null && ac.debug) { E("SPServices.SPAutocomplete", "columnName: " + ac.columnName, "Column is not an input control or is not found on page"); return } t.closest("span").find("br").remove(); t.wrap("<div>"); var i = j("SPAutocomplete", ac.columnName); t.after("<div><ul id='" + i + "' style='width:" + ag + ";display:none;padding:2px;border:1px solid #2A1FAA;background-color:#FFF;position:absolute;z-index:40;margin:0'></div>"); H("#" + i).css("width", t.width()); H(t).keyup(function () { var ap = H(this).val(); H("#" + i).hide(); if (ap.length < ac.numChars) { return false } t.css({ "background-image": "url(" + ac.processingIndicator + ")", "background-position": "right", "background-repeat": "no-repeat" }); var ao = []; var ah = "<Query><OrderBy><FieldRef Name='" + ac.sourceColumn + "'/></OrderBy><Where>"; if (ac.CAMLQuery.length > 0) { ah += "<And>" } ah += "<" + ac.filterType + "><FieldRef Name='" + ac.sourceColumn + "'/><Value Type='Text'>" + ap + "</Value></" + ac.filterType + ">"; if (ac.CAMLQuery.length > 0) { ah += ac.CAMLQuery + "</And>" } ah += "</Where></Query>"; H().SPServices({ operation: "GetListItems", async: false, webURL: ac.WebURL, listName: ac.sourceList, CAMLQuery: ah, CAMLQueryOptions: ac.CAMLQueryOptions, CAMLViewFields: "<ViewFields><FieldRef Name='" + ac.sourceColumn + "' /></ViewFields>", CAMLRowLimit: 0, completefunc: function (au, ar) { var at = ac.ignoreCase ? ap.toUpperCase() : ap; H(au.responseXML).find("[nodeName='z:row']").each(function () { var aw = H(this).attr("ows_" + ac.sourceColumn); var ax = ac.ignoreCase ? H(this).attr("ows_" + ac.sourceColumn).toUpperCase() : H(this).attr("ows_" + ac.sourceColumn); switch (ac.filterType) { case "Contains": var av = ax.indexOf(at); if ((av >= 0) && (!ac.uniqueVals || (H.inArray(aw, ao) === -1))) { ao.push(H(this).attr("ows_" + ac.sourceColumn)) } break; default: if (at === ax.substr(0, at.length) && (!ac.uniqueVals || (H.inArray(aw, ao) === -1))) { ao.push(H(this).attr("ows_" + ac.sourceColumn)) } break } }) } }); var ak = ""; for (W = 0; W < ao.length; W++) { if (ac.highlightClass.length > 0) { var aj = RegExp(ap, ac.ignoreCase ? "gi" : "g"); var am = ao[W].match(aj); var al = 0; for (ae = 0; ae < am.length; ae++) { var an = ao[W].indexOf(am[ae], al); var ai = an + am[ae].length; var aq = "<span class='" + ac.highlightClass + "'>" + am[ae] + "</span>"; ao[W] = ao[W].substr(0, an) + aq + ao[W].substr(ai); al = an + aq.length } } ak += "<li style='display: block;position: relative;cursor: pointer;'>" + ao[W] + "</li>" } H("#" + i).html(ak); H("#" + i + " li").click(function () { H("#" + i).fadeOut(ac.slideUpSpeed); H("#" + af).val(H(this).text()) }).mouseover(function () { var ar = { cursor: "hand", color: "#ffffff", background: "#3399ff" }; H(this).css(ar) }).mouseout(function () { var ar = { cursor: "inherit", color: ad, background: "transparent" }; H(this).css(ar) }); if (ao.length > 0) { H("#" + i).slideDown(ac.slideDownSpeed) } t.css("background-image", "") }) }; H.fn.SPServices.SPGetQueryString = function () { var ad; var af = {}; var t = location.search.substring(1, location.search.length); var ab = t.split("&"); for (ad = 0; ad < ab.length; ad++) { var ac = /^([^=]+)=(.*)/i, ae = ac.exec(ab[ad]); if (ac.test(location.href)) { if (ae !== null && ae.length > 2) { af[ae[1]] = unescape(ae[2]).replace("+", " ") } } } return af }; H.fn.SPServices.SPListNameFromUrl = function () { if (s.length > 0) { return s } var t = location.href; var i = t.substring(0, t.indexOf(".aspx")); var ab = X(i.substring(0, i.lastIndexOf(h) + 1)).toUpperCase(); H().SPServices({ operation: "GetListCollection", async: false, completefunc: function (ad, ac) { H(ad.responseXML).find("List").each(function () { var ae = H(this).attr("DefaultViewUrl"); var af = ae.substring(0, ae.lastIndexOf(h) + 1).toUpperCase(); if (ab.indexOf(af) > 0) { s = H(this).attr("ID"); return false } }) } }); return s }; H.fn.SPServices.SPUpdateMultipleListItems = function (ac) { var ae = H.extend({}, { webURL: "", listName: "", CAMLQuery: "", batchCmd: "Update", valuepairs: [], completefunc: null, debug: false }, ac); var ad; var ag = []; var af = []; H().SPServices({ operation: "GetListItems", async: false, webURL: ae.webURL, listName: ae.listName, CAMLQuery: ae.CAMLQuery, CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope='Recursive' /></QueryOptions>", completefunc: function (ah, i) { H(ah.responseXML).find("[nodeName='z:row']").each(function () { ag.push(H(this).attr("ows_ID")); var ai = H(this).attr("ows_FileRef"); ai = "/" + ai.substring(ai.indexOf(";#") + 2); af.push(ai) }) } }); var t; var ab = "<Batch OnError='Continue'>"; for (ad = 0; ad < ag.length; ad++) { ab += "<Method ID='" + ad + "' Cmd='" + ae.batchCmd + "'>"; for (t = 0; t < ae.valuepairs.length; t++) { ab += "<Field Name='" + ae.valuepairs[t][0] + "'>" + ae.valuepairs[t][1] + "</Field>" } ab += "<Field Name='ID'>" + ag[ad] + "</Field>"; if (af[ad].length > 0) { ab += "<Field Name='FileRef'>" + af[ad] + "</Field>" } ab += "</Method>" } ab += "</Batch>"; H().SPServices({ operation: "UpdateListItems", async: false, webURL: ae.webURL, listName: ae.listName, updates: ab, completefunc: function (ah, i) { if (ae.completefunc !== null) { ae.completefunc() } } }) }; function y(ah, af, ae) { if (typeof af === "undefined") { return "" } var ad; var t; var ac; switch (ah.attr("Type")) { case "Text": t = af; break; case "URL": switch (ah.attr("Format")) { case "Hyperlink": t = "<a href='" + af.substring(0, af.search(",")) + "'>" + af.substring(af.search(",") + 1) + "</a>"; break; case "Image": t = "<img alt='" + af.substring(af.search(",") + 1) + "' src='" + af.substring(0, af.search(",")) + "'/>"; break; default: t = af; break } break; case "User": t = "<a href='/_layouts/userdisp.aspx?ID=" + af.substring(0, af.search(";#")) + "&Source=" + Z(location.href) + "'>" + af.substring(af.search(";#") + 2) + "</a>"; break; case "Calculated": var ab = af.split(";#"); t = ab[1]; break; case "Number": t = parseFloat(af).toFixed(ah.attr("Decimals")).toString(); break; case "Currency": t = parseFloat(af).toFixed(ah.attr("Decimals")).toString(); break; case "Lookup": ac = p(ah.attr("List"), "DisplayForm"); t = "<a href='" + ae.relatedWebURL + h + ac + "?ID=" + af.substring(0, af.search(";#")) + "&RootFolder=*&Source=" + Z(location.href) + "'>" + af.substring(af.search(";#") + 2) + "</a>"; break; case "LookupMulti": ac = p(ah.attr("List"), "DisplayForm"); t = ""; if (af.length > 0) { var ag = af.split(";#"); for (ad = 0; ad < ag.length / 2; ad++) { t += "<a href='" + ae.relatedWebURL + h + ac + "?ID=" + ag[ad * 2] + "&RootFolder=*&Source=" + Z(location.href) + "'>" + ag[(ad * 2) + 1] + "</a>"; if (ad < (ag.length / 2) - 1) { t += ", " } } } break; case "Counter": t = af; break; case "DateTime": t = af; break; default: t = af; break } return t } function S(ad, ac) { var ab; var t = "<table class='ms-vb' width='100%'>"; for (ab = 0; ab < ad.attributes.length; ab++) { t += "<tr><td width='10px' style='font-weight:bold;'>" + ab + "</td><td width='100px'>" + ad.attributes.item(ab).nodeName + "</td><td>" + v(ad.attributes.item(ab).nodeValue) + "</td></tr>" } t += "</table>"; return t } function R(i) { if ((this.Obj = H("select[Title='" + i + "']")).html() !== null) { this.Type = "S" } else { if ((this.Obj = H("input[Title='" + i + "']")).html() !== null) { this.Type = "C" } else { if ((this.Obj = H("select[ID$='SelectCandidate'][Title^='" + i + " ']")).html() !== null) { this.Type = "M" } else { if ((this.Obj = H("select[ID$='SelectCandidate'][Title$=': " + i + "']")).html() !== null) { this.Type = "M" } else { if ((this.Obj = H("select[ID$='SelectCandidate'][Title$='\"" + i + "\".']")).html() !== null) { this.Type = "M" } else { this.Type = null } } } } } } function E(t, ac, ab) { var i = "<b>Error in function</b><br/>" + t + "<br/><b>Parameter</b><br/>" + ac + "<br/><b>Message</b><br/>" + ab + "<br/><br/><span onmouseover='this.style.cursor=\"hand\";' onmouseout='this.style.cursor=\"inherit\";' style='width=100%;text-align:right;'>Click to continue</span></div>"; f(i) } function f(ae) { var ab = "position:absolute;width:300px;height:150px;padding:10px;background-color:#000000;color:#ffffff;z-index:30;font-family:'Arial';font-size:12px;display:none;"; H("#aspnetForm").parent().append("<div id='SPServices_msgBox' style=" + ab + ">" + ae); var i = H("#SPServices_msgBox").height(); var ad = H("#SPServices_msgBox").width(); var ac = (H(window).width() / 2) - (ad / 2) + "px"; var t = (H(window).height() / 2) - (i / 2) - 100 + "px"; H("#SPServices_msgBox").css({ border: "5px #C02000 solid", left: ac, top: t }).show().fadeTo("slow", 0.75).click(function () { H(this).fadeOut("3000", function () { H(this).remove() }) }) } function j(i, t) { return i + "_" + H().SPServices.SPGetStaticFromDisplay({ listName: H().SPServices.SPListNameFromUrl(), columnDisplayName: t }) } function p(i, ab) { var t; H().SPServices({ operation: "GetFormCollection", async: false, listName: i, completefunc: function (ad, ac) { H(ad.responseXML).find("Form").each(function () { if (H(this).attr("Type") === ab) { t = H(this).attr("Url"); return false } }) } }); return t } function g(ac, t) { var ab; for (ab = 0; ab < t.length; ab++) { if (typeof t[ab] === "string") { F.payload += A(t[ab], ac[t[ab]]) } else { if (t[ab].length === 2) { F.payload += A(t[ab][0], ac[t[ab][1]]) } else { E(ac.operation, "paramArray[" + ab + "]: " + t[ab], "Invalid paramArray element passed to addToPayload()") } } } } function T(i) { var ab; var t = RegExp('FieldName="' + i + '"', "gi"); H("td.ms-formbody, td.ms-formbodysurvey").each(function () { if (t.test(H(this).html())) { ab = H(this); return false } }); return ab } function A(t, i) { return "<" + t + ">" + i + "</" + t + ">" } function V() { return (Math.round(Math.random()) - 0.5) } function v(i) { return ((i.indexOf("http") === 0) || (i.indexOf(h) === 0)) ? "<a href='" + i + "'>" + i + "</a>" : i } function z(i) { return i.substring(i.lastIndexOf(h) + 1, i.length) } function a(i) { return i.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;") } function w(i) { return i.replace(/&/g, "&amp;") } function X(i) { return i.replace(/%20/g, " ") } function Z(i) { return i.replace(/&/g, "%26") } })(jQuery);

 

首选新建一个array

var ViewArray = new Array();

然后在array里面配置需要显示的fileds作为参数.

ViewArray = ["Title", "Name", "EID", "Eaddress", "ID"];

配置当前页数.

var CurrenPage="Paged=TRUE&p_ID=2";

 

默认情况下不做任何筛选.

$(document).ready(function(){
FillFeild("#td_"+1);

PagingDisplay("", false);

});

点击filter button后筛选结果.

$("#filter").click(function () {

    PagingDisplay("", true);

});

 

点击del删除条件:条件至少保留一条

function delRow(k)
{
 
  if($("#filterdata").find("tr").length>1)
  {
     $(k).parent().parent().remove();
  }
  else
  {
     alert("At least retained one!");
  }
}

 

添加一条删选条件:

$("#addrow").click(function(){
 
   var id=($("#filterdata").find("tr:last").find("td:first").children().attr("id").substring(3));
   
   var html="<tr>";
   html+="<td ><select id='td_"+(parseInt(id)+4)+"'  onchange=\"fillCompare(this)\" class=\"searchField\"><option>ID</option></select></td>";
   html+="<td ><select  id='td_"+(parseInt(id)+5)+"' onchange=\"disableValue(this)\" class=\"searchCompare\"><option value=\"Gt\">></option><option value=\"Geq\">≥</option><option value=\"Eq\" selected=\"selected\">=</option><option value=\"Lt\"><</option><option value=\"Leq\">≤</option><option value=\"Neq\">≠</option><option value=\"IsNull\">Is Null</option></select></td>";
   html+="<td ><select id='td_"+(parseInt(id)+6)+"' class=\"searchValue\"><option></option><option selected=\"selected\">1</option><option>2</option></select></td>";
   html+="<td ><select id='td_"+(parseInt(id)+7)+"' class=\"searchConjunctions\"><option>Or</option><option>And</option></select></td>";
   html+="<td ><input type=\"button\" class=\"del\" value=\"删除\" onclick=\"delRow(this)\"/></td>";
   html+="</tr>";
   $("#filterdata tbody").append(html);
   
   
   FillFeild("#td_"+(parseInt(id)+4));
   
   FillValue("#td_"+(parseInt(id)+4),"#td_"+(parseInt(id)+6),"automapping");
});

 

根据条件筛选:

function PagingDisplay(next, isSearch) {
    var CAMLQuery_String = "";
    var CAMLViewFields_String="";
    try {
        next = next.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
    }
    catch (e) {
        alert(e);
    }
    if (isSearch) {

        var _searchArray = new Array();

        var _ConjunctionArray = new Array();

        CAMLQuery_String += "<Query><Where>#######";

        $("#filterdata tr").each(function () {
             
            var currentID=$(this).find("td:first").children().attr("id").substring(3); 
            var searchField = $("#td_"+(currentID)).find("option:selected").text();
            var searchCompare = $("#td_"+(parseInt(currentID)+1)).find("option:selected").val();
            var searchValue = $("#td_"+(parseInt(currentID)+2)).find("option:selected").text();
            var searchConjunctions = $("#td_"+(parseInt(currentID)+3)).find("option:selected").text();
            
            if (searchField != "" && searchField != undefined) {
                _searchArray.push("<" + searchCompare + "><FieldRef Name='" + searchField + "'/><Value Type='Text'>" + searchValue + "</Value></" + searchCompare + ">");
            }
            if (searchConjunctions != "" && searchConjunctions!= undefined) {
                _ConjunctionArray.push(searchConjunctions);
            }
            
        });

        for (var i = 0; i < _searchArray.length; i++) {
            if (i == _searchArray.length - 1) {
                CAMLQuery_String = CAMLQuery_String.replace("#######", _searchArray[i]);
            }
            else {
                CAMLQuery_String = CAMLQuery_String.replace("#######", "<" + _ConjunctionArray[i] + ">#######" + _searchArray[i] + "</" + _ConjunctionArray[i] + ">");
            }
        }

        CAMLQuery_String += "</Where><OrderBy><FieldRef Name='LinkTitle' Ascending='False' /></OrderBy></Query>";

    }
    else {
        CAMLQuery_String += "<Query><OrderBy><FieldRef Name='LinkTitle' Ascending='False' /></OrderBy></Query>";
    }
    
    //get view feild
    CAMLViewFields_String+="<ViewFields>";
    
    CAMLViewFields_String+="<FieldRef Name='LinkTitle'/>";
    
    $.each(ViewArray,function(k,v){
    
         CAMLViewFields_String+="<FieldRef Name='"+v+"'/>";
    
    });
    
    CAMLViewFields_String+="</ViewFields>";  
       
    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "automapping",
        CAMLRowLimit: "10",
        //CAMLQueryOptions: '<QueryOptions><Paging ListItemCollectionPositionNext="' + next + '" /></QueryOptions>',
        CAMLQuery: CAMLQuery_String,
        CAMLViewFields: CAMLViewFields_String,
        completefunc: function (xData, Status) {
            
            var result = "";
            result += "<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" id=\"GridView\" style=\"color:#333333;width:100%;border-collapse:collapse; text-align:center;\">";
            result += "<tr style=\"color:White;background-color:#00ff99;font-weight:bold; font-family:Arial, Tahoma, Helvetica, sans-serif; font-size:12px;\">";
            $.each(ViewArray, function (k, v) {
                result += "<th scope=\"col\">" + v + "</th>";
            });
            result += "<th scope=\"col\" colspan=\"3\">Action</th>";
            //result += "<th scope=\"col\"> </th>";
            //result += "<th scope=\"col\"> </th>";
            result += "</tr>";

            var rowCount = 0;
            $(xData.responseXML).find("[nodeName='z:row']").each(function () {
            
                if (rowCount % 2 == 0) {
                    result += "<tr style=\"background-color:#EFF3FB;\">";
                }
                else {
                    result += "<tr style=\"background-color:White;\">";
                }
                for(var i=0;i<ViewArray.length;i++)
                {
                   result += " <td>" + $(this).attr("ows_"+ViewArray[i]) + "</td>";
                }
                result += "<td><a href=\"DispForm.aspx?ID="+$(this).attr("ows_ID")+"\">查看</a></td>";
                result += "<td><a href=\"EditForm.aspx?ID="+$(this).attr("ows_ID")+"\">编辑</a></td>";
                result += "<td><a href=\"javascript:if(DeleteItemConfirmation()==true){};\">删除</a></td>";
                result += "</tr>";
                rowCount++;
            });
            if (rowCount == 0) {
                //no data
                result += "<tr><td colspan=\"14\" style=\"color:red;text-align:center;\">No Record! </td></tr>";
            }
            result += "<tr style=\"text-align:center; background-color: #00ff99; color: white;\"><td colSpan=\"14\">";

            CurrenPage = next;

            //if (ArrayPages.length != 0) {

            //}
            

            $(xData.responseXML).find("[nodeName='rs:data']").each(function () {
                 
                var nextpage = $(this).attr("ListItemCollectionPositionNext");

                if (nextpage != undefined) {
                    result += "<a style=\"color: white;\" href=\"#\" onclick=\"PagingDisplay('" + nextpage + "'," + true + ")\"/>Next Page</a>";
                }
            });

            result += "</td></tr></table>";

            $("#autofilter").html(result);
        }
    });
}

 

根据之前的配置字段来填充条件字段:

function FillFeild(id) {

    //clear data
    $(id).html("");
    var result = "";
    $.each(ViewArray, function (k, v) {
        if(v=="ID")
        {
           result += "<option selected=\"selected\">"+v+"</option>";
        }
        else
        {
           result += "<option>"+v+"</option>";
        }
    });
    $(id).html(result);
}

获取字段的类型:

function getType(field)
{
   var cn=$(field).find("option:selected").text();
   
   var flag=true;
   
   var resultArray=new Array();
   
   $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "automapping",
        CAMLViewFields: "<ViewFields><FieldRef Name='"+cn+"'/></ViewFields>",
        completefunc: function (xData, Status) {
        
            var _integer = /^\d+$/;//判断数字类型
            
            $(xData.responseXML).find("[nodeName='z:row']").each(function () {
                    var text=$(this).attr("ows_" + cn);
                    flag=_integer.test(text);
                    
                    resultArray.push(flag);
            });
        }
    });
    $.each(resultArray,function(k,v){
      if(v==false)
      {
         flag=false;
      }
    });
    return flag;
}

根据字段类型,填充值.

function FillValue(field,value,listname) {
   //clear data
    $(value).html();

    var _field = $(field).find("option:selected").text();

    var CAMLViewFields_String = "";
    //get view feild
    CAMLViewFields_String += "<ViewFields>";

    $.each(ViewArray, function (k, v) {

        if (v == _field) {
            CAMLViewFields_String += "<FieldRef Name='" + v + "'/>";
        }
    });
    CAMLViewFields_String+="</ViewFields>";  
    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: listname,
        CAMLViewFields: CAMLViewFields_String,
        completefunc: function (xData, Status) {
            var result = "<option></option>";
            $(xData.responseXML).find("[nodeName='z:row']").each(function () {
                    result += " <option>" + $(this).attr("ows_" + _field) + "</option>";
            });
            $(value).html(result);
        }
    });
}

 

填充条件,比喻int类型可以有大于,小于 等于等 而string类型的话将有包含 等于等. 这个目前还不包含所有的,可以根据情况在添加.

///需要修改
function fillCompare(obj){
   
    var option = obj.value;
    var id=obj.id.substring(3);
    $("#td_"+(parseInt(id)+2)).attr("disabled",false);
    FillValue("#td_"+id, "#td_"+(parseInt(id)+2), "automapping");
    
    if(getType("#td_"+id)==false)
    {
       var html="<option value=\"Eq\" selected=\"selected\">=</option>";
       html+="<option value=\"Neq\">≠</option>";
       html+="<option value=\"IsNull\">Is Null</option>";
       $("#td_"+(parseInt(id)+1)).html(html);
    }
   else
    {
      var html="<option value=\"Gt\">></option>";
      html+="<option value=\"Geq\">≥</option>";
      html+="<option value=\"Eq\" selected=\"selected\">=</option>";
      html+="<option value=\"Lt\"><</option>";
      html+="<option value=\"Leq\">≤</option>";
      html+="<option value=\"Neq\">≠</option>";
      html+="<option value=\"IsNull\">Is Null</option>";
      $("#td_"+(parseInt(id)+1)).html(html);
    }
    
}

 

如果所选的条件是isNull那么就不需要值了.Value这一行就被disable了

 function disableValue(obj)
 {
        var option = obj.value;
        var id=obj.id.substring(3);
        if (option == "IsNull") {
            $("#td_"+(parseInt(id)+1)).find("option:first").attr("selected","selected");
            $("#td_"+(parseInt(id)+1)).attr("disabled",true);
        }
        else {
            $("#td_"+(parseInt(id)+1)).attr("disabled",false);
            FillValue("#td_"+(parseInt(id)-1), "#td_"+(parseInt(id)+1), "automapping");
        }
}

 

 

以后有兴趣用wpf也可以写一个.

 

 

 

 

 

posted @ 2013-12-04 10:44  风清扬 No.1  阅读(1653)  评论(3编辑  收藏