Show By Category

.NET Service (1) 1909 (1) ACTV (1) adidas (47) adizero (1) Admiral (9) Airness (3) Albania (3) Algeria (3) America Mineiro (1) Angola (1) Anta (2) Argentina (2) Armenia (1) Atletico Goianiense (1) Atletico Paranaense (1) Austria (2) Authentic fit (1) Auto Generate from Access (1) Avai FC (1) avoid (2) Bahia (1) Beijing Guoan (1) Belgium (4) Benin (1) Birmingham City (1) Bolivia (1) Boot Configuration Data missing (1) Bosnia (1) Botafogo (2) Botafogo SP (1) Botswana (2) Brazil (4) Brazilian brand (15) Bulgaria (2) Burkina Faso (2) Burrda (3) Bypass traverse checking (1) Cambodia (1) Cameroon (4) Ceara (1) CEWP (2) Chapecoense (2) Chile (3) China (9) Chinese Brand (4) Chongqing Lifan Dangdai (1) Club Deportivo Universidad Catolica (1) Club Universitario de Deportes (1) Clube de Remo (1) Colombia (6) Colombian Brand (1) Congo DR (1) Congo Rep (1) Copa America (3) Corinthians (1) Coritiba (1) Costa Rica (2) Cote d'Ivoire (3) Coventry City (1) Croatia (2) Crop IFRAME (1) Cruzeiro (2) Crystal Palace (4) css (3) Cuba (1) Cyprus (1) Czech Republic (2) Deleting large libraries (2) Denmark (2) design fault (2) Diadora (1) Dragao Premium (1) eagles (1) Ecuador (3) Ecuadorian Brand (3) Egypt (1) El Salvador (1) electrical (2) electrical problems (2) electrocuted (2) England (3) Errea (3) Espanyol (1) Ethiopia (1) Euro 16 (10) Excel 2010 (3) External Content Type (1) FBT (3) FC Porto (1) Fenerbahce (1) Figueirense (1) Finland (1) Fiorentina (1) Flamengo (1) Flickering (1) Fluminense (1) football (233) Fortuna Dusseldorf (1) France (2) futfanatics.net (1) Gabon (1) Germany (1) Ghana (2) Gogoalshop (2) Goias (1) Granada CF (1) Grand Sport (2) Greece (2) Green (1) Guangzhou Evergrande (1) Guinea (1) Guinea Bissau (1) Haiti (1) Heilongjiang Lava Spring (1) Honduras (1) Hong Kong (1) Hummel (1) Hungary (1) Iceland (3) Icone Sports (2) IE Developer Tools (1) India (1) Indian Brand (1) Internal Field Names (1) Italy (2) Jako (1) Jamaica (2) Japan (1) Javascript (6) Jersey (126) Jiangsu Suning FC (1) Joma (5) Kanxa (1) Kappa (3) Kelme (4) Kenya (1) kitchen extractor fan (3) Korea (1) Laos (1) Le Coq Sportif (1) leak (2) Legea (1) Levante (1) Li Ning (3) Local Security Policy (1) Login Problem (1) Lotto (4) Lupo (2) Macron (9) Mafro (3) Mali (3) Man Utd (1) Marathon Sports (6) Marseilles (1) masterpage (1) Meizhou Hakka (1) Mexico (5) Modena Volley (1) Montenegro (1) Morocco (3) Myanmar (1) N98 (1) Naija (1) Nakal (1) Namibia (1) Napoli (1) Netherlands (1) New Balance (2) Newcastle United (2) Niger (1) Nigeria (4) Nike (32) Nike Brasil (1) Nike Brazil (1) Nike China (12) Nike South Africa (1) North Macedonia (1) Norway (1) O'Neills (1) Oldham Athletic (1) Olympikus (1) Olympique Lyonnais (1) Page Viewer WebPart (1) Panama (2) Para (1) Paraguay (2) Penalty (1) Peru (6) Picture Manager (1) Poland (2) Ponte Preta (1) Portugal (2) Portuguesa RJ (1) problem (2) Puma (46) retro (1) review (111) Romai (2) Romania (1) RT Sports (1) Russia (4) Saeta (1) Sampaio Correa (1) Santarem (1) Santos (2) Sao Paulo FC (1) Sao Raimundo (1) scam (2) Score Draw (1) Search List with Count Displayed (1) Senegal (3) Serbia (1) Server Hardening (1) SESI Sao Paulo (1) Shandong Luneng (1) Shanghai Shenhua (1) Shanghai SIPG (1) SharePoint (61) SharePoint Connect to SQL (2) SharePoint Designer (3) Shenzhen FC (1) shirt (232) Sierra Leone (1) Singaporean Brand (2) Six5Six (1) Slovakia (2) Slovenia (1) Slow right click (1) Sondico (1) South Africa (1) Spain (3) SPS Services (2) Spurs (1) SQL Server 2008 (1) SSP User Profile behaviour (1) Super Bolla (2) Sweden (2) Switzerland (2) Taubate Funvic (1) Team GB (2) techfit (8) Thai Brand (3) Thailand (2) Togo (1) Topper (4) track top (13) Travels (1) Trinidad and Tobago (1) Tunisia (3) Turkiye (1) tyro (1) UAE (1) UB (3) UB Electric (3) Ucan (1) UE Llagostera (1) Uganda (1) Uhlsport (2) Ukraine (1) Umbro (18) Umbro Brazil (6) Under Armour (3) Upload Center (1) Uruguay (1) Vasco Da Gama (1) Venezuela (1) Vietnam (1) Villa Nova (1) Villarreal (1) Vitoria (1) volleyball (6) Vozao (1) Wales (1) Warrix (1) water (2) WebClient (4) WebDav (5) West Ham (2) Where to get buy Iceland football shirt in Reykjavik (1) Win 8 (2) Windows 10 (1) Windows Scheduled Task (1) wish list (1) Workflow (1) World Cup 14 (9) World Cup 18 (5) Wuhan Zall (1) Xinjiang Tianshan Leopard (1) Xtep (1) Yanbian Funde (1) Yemen (1) Zambia (1) Zhejiang Greentown (2) Zimbabwe (1)

Thursday 15 January 2015

Passing parameters into function called after Complete operation in an AJAX call

Thanks to this post http://stackoverflow.com/questions/6448058/passing-additional-parameters-to-ajax-complete-callback-function

I finally understood how to pass in a parameter into a function call after a AJAX async complete call.  I was wondering how to do it for a while and was going down the round of using global scope variables.

eg the following passes a string "0,1,0,0" into a function which then does a async AJAX call and we want to pass the parameter into the function for the complete operation. The parameter is highlighted in the example below.

getFunds("0,1,0,0");

function getFunds(strGroupsUserIn)
{

var strDeptValue = "Equities";
var strRegionValue = "TW";
var strReportTypeValue = "Characteristics";
var strReportFinderType = "Active";

$(document).ready(function() {
        var soapEnv =
            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>Names</listName> \
                        <query><Query><Where><And><And><And><Contains><FieldRef Name='Asset_Type'/><Value Type='Text'>"+strDeptValue+"</Value></Contains> \
                         <Contains><FieldRef Name='Report_Type'/><Value Type='Text'>"+strReportTypeValue+"</Value></Contains> \
                         </And> \
                         <Contains><FieldRef Name='Region'/><Value Type='Text'>"+strRegionValue+"</Value></Contains> \
                         </And> \
                         <Contains><FieldRef Name='Live'/><Value Type='Text'>"+strReportFinderType+"</Value></Contains> \
 </And> \
 </Where> \
                         <OrderBy><FieldRef Name='Display_Code' Ascending='TRUE' /></OrderBy></Query></query> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='Display_Code' /> \
                              <FieldRef Name='Asset_Type' /> \
                              <FieldRef Name='Report_Code' /> \
                              <FieldRef Name='Region' /> \
                              <FieldRef Name='Live' /> \
                              <FieldRef Name='Report_Type' /> \
                              <FieldRef Name='Group1' /> \
  <FieldRef Name='Group2' /> \
    <FieldRef Name='Group3' /> \
    <FieldRef Name='Group4' /> \
                           </ViewFields> \
                        </viewFields> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

        $.ajax({
            url: "/myserver/is/mn/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: function(jqXHR, textStatus)
            { 
            processFunds(jqXHR, textStatus, strGroupsUserIn)
            
            },
            contentType: "text/xml; charset=\"utf-8\""
        });
    });
}


    function processFunds(xData, status, strGroups
    {

var strForDropDown = "";   
   $(xData.responseXML).find("z\\:row, row").each(function() {
            strForDropDown = strForDropDown + $(this).attr("ows_Display_Code") + "@" + $(this).attr("ows_Report_Code") + "@" + $(this).attr("ows_Group1") + "@" + $(this).attr("ows_Group2") + "@" + $(this).attr("ows_Group3") + "@" + $(this).attr("ows_Group4") + "@" +"\n";
        });
        // Now populate the department dropdown with our extracted data
         populateFunds(strForDropDown, strGroups);
    }

Wednesday 14 January 2015

Spain retro shirt


I got hold of an interesting remake of a Spain 1982 retro shirt.  I think it a gorgeous simple design and prefer it to the Spain shirts adidas make today.  Also before they were the instantly recognisable world champions level team of today.
It is an adidas original branded remake of the shirt.

I like the old adidas trefoil logo. 
It's made of a elastane material and not too bad to wear.  It's cross between polyester and cotton.

Shirt itself is of a more slim fit nature with nice short sleeve helm that I prefer rather than the long length sleeve most adidas football shirts now have.  It suits more skinny people who don't have huge long biceps.  :-)
Spain crest embroided 
No 10 at the back, just a nice combination of red and yellow.
Shirt measures around 18.5 inches pit to pit for a small size making it a nice slim fit.  Collar gives it an even more retro party feel.  Adidas made a series of these remakes, heard there is a France remake shirt that is also quite nice.

Monday 12 January 2015

WebClient Service File Size and File Attribute limits

This keeps on coming back but when opening a SharePoint location with WebDav running the WebClient Service.

There are 2 parameters that we became very aware of recently else files won't open or directories with large amount of files won't show in Windows Explorer view.



The attribute FileAttributesLimitInBytes under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WebClient\Parameters.  The controls the limit to the file attributes size that is returned.  It is set to 5 meg by default, I think.The settings are in bytes thats why its so big in size.

5 meg will probably be enough for say 7000-8000 file attributes.

Increase the size if more files are returned by a directory.  Else a timeout like message gets shown by Windows Explorer.
If there are actual files that needs to be read from a SharePoint location that exceeds 50 meg.  The FileSizeLimitInBytes attribute needs to be adjusted under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WebClient\Parameters.  It is set to around 50 meg by default.  Set it to higher if required to read larger files.

Restart the WebClient service for it to take effect.

Thursday 8 January 2015

SPS Services - Just Amazing and an attribute to the great work that they have done.

Many will have come across these amazing set of libraries that have been developed to programmatically insert, update, delete and display data in SharePoint lists and libraries.

http://spservices.codeplex.com/

Just really appreciated what has been done and how useful these WebServices JQuery libraries have been.  It has opened up a new dimension in interacting with SharePoint sites since their conception.  Many of us have been quietly using it for our needs and in many ways allowed some of us who are in more locked down server environments to achieve things that otherwise would require .NET Components or InfoPath.  Both great tools too.

Anyway, I thought I will package up a simple example for reference how these libraries can be easily used.

Imagine the following HTML page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Simple SPS List Management Code</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style>
body
{
margin-left:1px;
}

</style>

<script type="text/javascript" src="/myServer/IS/mn/Files%20To%20Share/jquery-1.10.2.js"></script>
<script type="text/javascript" src="/myServer/IS/mn/Files%20To%20Share/jquery.SPServices-2014.02.min.js"></script>
<script type="text/javascript" src="/myServer/IS/mn/Files%20To%20Share/jquery.SPServices-2014.02.js"></script>
<script type="text/javascript">

function addItem()
{
var strSubsiteName =  document.getElementById("txtSubsiteName").value

var columnsForInsert = [];
        columnsForInsert[0] = ["Title", document.getElementById("txtTitle").value];
        columnsForInsert[1] = ["Country", document.getElementById("txtCountry").value];
        columnsForInsert[2] = ["Code", document.getElementById("txtCode").value];
    
      // Create New List Item
      $(document).ready(function() {
      
      $().SPServices({
           operation: "UpdateListItems",
           webURL: "/myServer/IS/"+strSubsiteName,
           async: true,
           batchCmd: "New",
           listName: "Countries",
           valuepairs: columnsForInsert,
           completefunc: function (xData, Status) {
             alert("List Item successfully created.");
          }
        }); // End of SPServices UpdateListItems
      });
}  

function updateItem()
{
var strSubsiteName =  document.getElementById("txtSubsiteName").value
var nDeleteID = document.getElementById("txtID").value;

if (parseInt(nDeleteID, 10))
{
   alert("Item with ID of " + nDeleteID + " will be updated.");
}
else
{
   alert("Please enter a valid ID to update list data.");
   return;
}

var columnsForUpdate = [];
        columnsForUpdate [0] = ["Title", document.getElementById("txtTitle").value];
        columnsForUpdate [1] = ["Country", document.getElementById("txtCountry").value];
        columnsForUpdate [2] = ["Code", document.getElementById("txtCode").value];

// Update List Item
$(document).ready(function() {
$().SPServices({
    operation: "UpdateListItems",
          webURL: "/myServer/IS/"+strSubsiteName,
    async: true,
    batchCmd: "Update",
    listName: "Countries",
    ID: nDeleteID,
  valuepairs: columnsForUpdate,
    completefunc: function (xData, Status) {
        alert("List Item has been updated");
    }
});
});


function deleteItem()
{
var strSubsiteName =  document.getElementById("txtSubsiteName").value
var nDeleteID = document.getElementById("txtID").value;

if (parseInt(nDeleteID, 10))
{
   alert("Item with ID of " + nDeleteID + " will be deleted.");
}
else
{
   alert("Please enter a valid ID to delete from list.");
   return;
}

// Delete List Item
$(document).ready(function() {
$().SPServices({
    operation: "UpdateListItems",
    webURL: "/myServer/IS/"+strSubsiteName,
    async: true,
    batchCmd: "Delete",
    listName: "Countries",
    ID: nDeleteID,
  completefunc: function (xData, Status) {
        alert("List Item deleted");
    }
});
});



</script>

</head>
<BODY>
<div id="StatusMessages" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; margin-left:0px; font-family:Verdana; font-size:small">
<input type="button" onclick="addItem()" value="Add Item" style="font-family:inherit;font-size:small" />
<input type="button" onclick="updateItem()" value="Update Item" />
<input type="button" onclick="deleteItem()" value="Delete Item" /><br><br>

ID: <input type="text" id="txtID" name="txtID"/> Title: <input type="text" id="txtTitle" name="txtTitle"/> Country: <input type="text" id="txtCountry" name="txtCountry"/> Code: <input type="text" id="txtCode" name="txtCode"/> Subsite URL Name: <input type="text" id="txtSubsiteName" name="txtSubsiteName"/>

</div> 
<script type="text/javascript">
</script>

</BODY></html>


It turns our these SPS Services calls can work with lists, discussion boards and document libraries.  The Update commands seems to be quite generic.  The Add won't work easily with Document libraries as it does require an upload of a file.  The delete can work but requires an extra highlighted parameter (FileRef) URL to the document in the library.  See this http://joshmccarty.com/2012/02/deleting-documents-with-spservices/

Anyway adapting the DeleteFile() function like this below certainly works :

function deleteFile() 
{

var nDeleteID = document.getElementById("txtID").value;
var strFileRef = document.getElementById("txtFileRef").value;

if (strFileRef == "")
{
alert("Must enter a ref URL to the file in the library that you wish to delete.  Eg : http://myserver/document/SPS/mydoc.docx");
   return;
}

if (parseInt(nDeleteID, 10))
{
   alert("Item with ID of " + nDeleteID + " will be deleted.");
}
else
{
   alert("Please enter a valid ID to delete from list.");
   return;
}

// This is the command needed to delete the specified file. It uses the ID and the URL of the file name. These values must be passed into this function when calling it.
var batchCmd = "<Batch OnError='Continue'><Method ID='1' Cmd='Delete'><Field Name='ID'>" + nDeleteID + "</Field><Field Name='FileRef'>" + strFileRef + "</Field></Method></Batch>";

// Use SPServices to delete the file.
$().SPServices({
operation: "UpdateListItems",
async: false,
listName: "SPS",
updates: batchCmd,
completefunc: function ( xData, Status ) {

// Check the error codes for the web service call.
$( xData.responseXML ).SPFilterNode( 'ErrorCode' ).each( function(){
responseError = $( this ).text();

// If the error codes indicate that the file was successfully deleted, inform the user.
if ( responseError === '0x00000000' ) {
alert( "The file has been successfully deleted." );
}

// If the error codes indicate that the file was NOT successfully deleted, inform the user.
else {
alert( "There was an error trying to delete the file." );
}
});
}
});
}






Monday 5 January 2015

HTML form inside a SharePoint Page Viewer WebPart

Isn't it amazing when you can get whole forms working to run inside a sharepoint site by using the Page Viewer Web part.

Created a form in an html page with the code below.  The form simply took in the parameters that have been setup in SharePoint and finds the correct report for the user.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Report Finder</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="Report-box-large.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/SiteCollectionDocuments/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
getCountriesGIPS()
// Get all research PMA Funds.  
//getPMAFunds();

// get countries
getCountries();
//readFile();
//getSpacedFields();

// function to read from a text file held in SharePoint instead of SharePoint list data
function readFile()
{
jQuery.get('ReportFinderSetup.txt', function(data) {
    displayFile(data);
    //process text file line by line
    //$('#div').html(data.replace('n','<br />'));
});
}

function displayFile(strData)
{
alert(strData);
}
// End of area to read from a text file held in SharePoint instead of SharePoint list data

// function to check for all input required for a query for report names have been selected.
function checkInputSelected()
{

var bReturn = true;

if (document.forms['ValidForm'].Radio1.checked || document.forms['ValidForm'].Radio2.checked || document.forms['ValidForm'].Radio3.checked)
{
//alert("Asset Type Selected");
}
else
{
//alert("A Fund Type must be selected.");
bReturn = false;
}

if (document.forms['ValidForm'].RadioEQ.checked || document.forms['ValidForm'].RadioFI.checked || document.forms['ValidForm'].RadioMA.checked || document.forms['ValidForm'].RadioGIPS.checked)
{
//alert("Dept Type Selected");
}
else
{
//alert("An Asset Type must be selected.");
bReturn = false;
}

if (document.forms['ValidForm'].SelectCountry.value == "None")
{
//alert("A Country must be selected");
bReturn = false;
// Clear the Funds Drop Down as no country has been selected
clearFundsDropFown();
}

// If peer rank was selected then do a peer rank query but return false.  
// peer rank report are not based on country or asset type.
if (document.forms['ValidForm'].Radio2.checked)
{
getPeerRanking();
bReturn = false;
}
else if (document.forms['ValidForm'].RadioGIPS.checked)  //If GIPS was selected then do a GIPS query but return false.  
//GIPS report are not based on asset type.
{
getGIPSReports();
bReturn = false;
}

return bReturn;
}

// function called just before displayReports to check whether the essential inputs been selected.
// Purpose is to display a notification to users if they have not selected anything or all required input 
// and wondering why no response when clicking on the submit button
function checkFundTypesSelected()
{

if (!document.forms['ValidForm'].Radio2.checked)
{
if (document.forms['ValidForm'].RadioEQ.checked || document.forms['ValidForm'].RadioFI.checked || document.forms['ValidForm'].RadioMA.checked || document.forms['ValidForm'].RadioGIPS.checked)
{
//alert("Dept Type Selected");
}
else
{
alert("An asset type must be selected.");
document.forms['ValidForm'].RadioEQ.focus();
return false;
}

if (document.forms['ValidForm'].Radio1.checked || document.forms['ValidForm'].Radio2.checked || document.forms['ValidForm'].Radio3.checked || document.forms['ValidForm'].RadioGIPS.checked)
{
//alert("Asset Type Selected");
}
else
{
alert("A fund type must be selected.");
document.forms['ValidForm'].Radio1.focus();
return false;
}

if (document.forms['ValidForm'].SelectCountry.value == "None")
{
alert("A country must be selected.");
document.forms['ValidForm'].SelectCountry.focus();
return false;

}
}

return true;
}

// function that clears the fund's drop down, called when user selects None in the country dropdown.
function clearFundsDropFown()
{
//Clear the dropdown if there is anything.
document.forms['ValidForm'].Select1.options.length = 0;
document.forms['ValidForm'].Select1.options[0] = new Option("(None)", "None");

}

// main function that get parameters and builds query to get the report names from SharePoint list
function getPMAFunds()
{

var strDeptValue = "";
var strRegionValue = "";
var strReportTypeValue = "";
var strReportFinderType = "Active";

if (checkInputSelected()==false)
{
return;
}
else
{
// Set the query variable parameters

if (document.forms['ValidForm'].RadioEQ.checked)
{
strDeptValue = "Equities";
}

if (document.forms['ValidForm'].RadioFI.checked)
{
strDeptValue = "Fixed Income";
}

if (document.forms['ValidForm'].Radio1.checked)
{
strReportTypeValue = "Attribution";
}

if (document.forms['ValidForm'].Radio3.checked)
{
strReportTypeValue = "Characteristics";
}

if (document.forms['ValidForm'].RadioMA.checked)
{
strDeptValue = "Multi Asset";
}

if (document.forms['ValidForm'].RadioGIPS.checked)
{
strDeptValue = "GIPS";
}


strRegionValue = document.forms['ValidForm'].SelectCountry.value;

//alert(strDeptValue + " " + strRegionValue + " " + strReportTypeValue + " " + strReportFinderType);

}

$(document).ready(function() {
        var soapEnv =
            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>PMA Report Finder Lookup</listName> \
                        <query><Query><Where><And><And><And><Contains><FieldRef Name='Asset_Type'/><Value Type='Text'>"+strDeptValue+"</Value></Contains> \
                         <Contains><FieldRef Name='Report_Type'/><Value Type='Text'>"+strReportTypeValue+"</Value></Contains> \
                         </And> \
                         <Contains><FieldRef Name='Country'/><Value Type='Text'>"+strRegionValue+"</Value></Contains> \
                         </And> \
                         <Contains><FieldRef Name='Live'/><Value Type='Text'>"+strReportFinderType+"</Value></Contains> \
 </And> \
                         </Where><OrderBy><FieldRef Name='Display_Code' Ascending='TRUE' /></OrderBy></Query></query> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='Display_Code' /> \
                              <FieldRef Name='Asset_Type' /> \
                              <FieldRef Name='Report_Code' /> \
                              <FieldRef Name='Country' /> \
                              <FieldRef Name='Live' /> \
                              <FieldRef Name='Report_Type' /> \
                           </ViewFields> \
                        </viewFields> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

        $.ajax({
            url: "/myserver/pma/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processPMAFunds,
            contentType: "text/xml; charset=\"utf-8\""
        });
    });
}

    function processPMAFunds(xData, status) 
    {

var strForDropDown = "";   
   $(xData.responseXML).find("z\\:row, row").each(function() {
            strForDropDown = strForDropDown + $(this).attr("ows_Display_Code") + "@" + $(this).attr("ows_Report_Code") + "@" +"\n";
        });
        // Now populate the department dropdown with our extracted data
        
        //alert(strForDropDown);
        populateFunds(strForDropDown);
    }
// End of area that get parameters and builds query to get the report names from SharePoint list

// Get all Peer ranking funds
function getPeerRanking()
{
var strReportTypeValue = "Peer";
var strReportFinderType = "Active";

$(document).ready(function() {
        var soapEnv =
            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>PMA Report Finder Lookup</listName> \
                        <query><Query><Where><And><Contains><FieldRef Name='Report_Type'/><Value Type='Text'>"+strReportTypeValue+"</Value></Contains> \
                         <Contains><FieldRef Name='Live'/><Value Type='Text'>"+strReportFinderType+"</Value></Contains> \
                         </And> \
                         </Where><OrderBy><FieldRef Name='Display_Code' Ascending='TRUE' /></OrderBy></Query></query> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='Display_Code' /> \
                              <FieldRef Name='Report_Code' /> \
                              <FieldRef Name='Country' /> \
                              <FieldRef Name='Live' /> \
                              <FieldRef Name='Report_Type' /> \
                           </ViewFields> \
                        </viewFields> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

        $.ajax({
            url: "/myserver/pma/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processPeerRankFunds,
            contentType: "text/xml; charset=\"utf-8\""
        });
    });

}

function processPeerRankFunds(xData, status)
{
var strForDropDown = "";   
   $(xData.responseXML).find("z\\:row, row").each(function() {
            strForDropDown = strForDropDown + $(this).attr("ows_Display_Code") + "@" + $(this).attr("ows_Report_Code") + "@" +"\n";
        });
        // Now populate the department dropdown with our extracted data
        
        populateFunds(strForDropDown);
}

// Get all GIPS Report
function getGIPSReports()
{
var strReportTypeValue = "GIPS";
var strReportFinderType = "Active";
var strCountry = document.forms['ValidForm'].SelectCountry.value;

$(document).ready(function() {
       
        var soapEnv = ""
            
            // If no country was selected then just get all active GIPS reports.          
            if (strCountry == "None")
            {
            soapEnv =
           "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
               <soapenv:Body> \
                    <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                       <listName>PMA Report Finder Lookup</listName> \
                       <query><Query><Where><And><Contains><FieldRef Name='Report_Type'/><Value Type='Text'>"+strReportTypeValue+"</Value></Contains> \
                         <Contains><FieldRef Name='Live'/><Value Type='Text'>"+strReportFinderType+"</Value></Contains> \
                         </And> \
                         </Where><OrderBy><FieldRef Name='Display_Code' Ascending='TRUE' /></OrderBy></Query></query> \
                       <viewFields> \
                           <ViewFields> \
                              <FieldRef Name='Display_Code' /> \
                            <FieldRef Name='Report_Code' /> \
                            <FieldRef Name='Country' /> \
                            <FieldRef Name='Live' /> \
                            <FieldRef Name='Report_Type' /> \
                          </ViewFields> \
                       </viewFields> \
                   </GetListItems> \
               </soapenv:Body> \
           </soapenv:Envelope>";
            }
            else // Get current selected country into the query if one was selected.    
            {
            soapEnv =
           "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
               <soapenv:Body> \
                    <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                       <listName>PMA Report Finder Lookup</listName> \
                       <query><Query><Where><And><And><Contains><FieldRef Name='Report_Type'/><Value Type='Text'>"+strReportTypeValue+"</Value></Contains> \
                         <Contains><FieldRef Name='Live'/><Value Type='Text'>"+strReportFinderType+"</Value></Contains> \
                         </And> \
                         <Contains><FieldRef Name='Country'/><Value Type='Text'>"+strCountry+"</Value></Contains> \
                         </And> \
                         </Where><OrderBy><FieldRef Name='Display_Code' Ascending='TRUE' /></OrderBy></Query></query> \
                       <viewFields> \
                           <ViewFields> \
                              <FieldRef Name='Display_Code' /> \
                            <FieldRef Name='Report_Code' /> \
                            <FieldRef Name='Country' /> \
                            <FieldRef Name='Live' /> \
                            <FieldRef Name='Report_Type' /> \
                          </ViewFields> \
                       </viewFields> \
                   </GetListItems> \
               </soapenv:Body> \
           </soapenv:Envelope>";

            }

        $.ajax({
            url: "/myserver/pma/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processGIPSFunds,
            contentType: "text/xml; charset=\"utf-8\""
        });
    });

}

function processGIPSFunds(xData, status)
{
var strForDropDown = "";   
   $(xData.responseXML).find("z\\:row, row").each(function() {
            strForDropDown = strForDropDown + $(this).attr("ows_Display_Code") + "@" + $(this).attr("ows_Report_Code") + "@" +"\n";
        });
        // Now populate the department dropdown with our extracted data
        
        populateFunds(strForDropDown);
}


// function that populates fund drop down
function populateFunds(strForDropDown)
{
//Clear the dropdown if there is anything.
document.forms['ValidForm'].Select1.options.length = 0;
document.forms['ValidForm'].Select1.options[0] = new Option("(None)", "None");

if (strForDropDown != "")
{

var item_array = strForDropDown.split("\n");

for (var iCount = 0; iCount < (item_array.length-1); iCount++)
{
//alert(item_array[iCount].toString());
var items = item_array[iCount].split("@");

try
{
// Force "None" into all values because it needs this value to fool SharePoint into accepting it when saving 
document.forms['ValidForm'].Select1.options[iCount+1] = new Option(items[0], items[1]);
}
catch(ex)
{
alert("Possible array out of bound error - populateFunds(strForDropDown)");
}
}

}
else
{
document.forms['ValidForm'].Select1.options[0] = new Option("(None)", "None");
}

}


// Populate Country Drop Down from SharePoint List MA Report Finder Lookup Countries block //
function getCountries()
{

$(document).ready(function() {
        var soapEnv =
            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>PMA Report Finder Lookup Countries</listName> \
                        <query><Query> \
                        <OrderBy><FieldRef Name='ID' Ascending='TRUE' /></OrderBy></Query></query> \
                        <viewFields> \
                            <ViewFields> \
                              <FieldRef Name='Title' /> \
                              <FieldRef Name='Country' /> \
                              <FieldRef Name='Country_Code' /> \
                           </ViewFields> \
                        </viewFields> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

        $.ajax({
            url: "/myserver/pma/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processCountries,
            contentType: "text/xml; charset=\"utf-8\""
        });
    });
}

function processCountries(xData, status) 
    {

var strForDropDown = "";   
   $(xData.responseXML).find("z\\:row, row").each(function() {
            strForDropDown = strForDropDown + $(this).attr("ows_Country") + "@" + $(this).attr("ows_Country_Code") + "@" +"\n";
        });
        // Now populate the department dropdown with our extracted data
        
        populateCountry(strForDropDown);
    }

// Populate Country Drop Down from SharePoint List MA Report Finder Lookup Countries block //
// With Filter for GIPS Country
function getCountriesGIPS()
{

var strReportTypeValue = "1";

$(document).ready(function() {
        var soapEnv =
            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>PMA Report Finder Lookup Countries</listName> \
                        <query><Query><Where><Contains><FieldRef Name='GIPS'/><Value Type='Text'>"+strReportTypeValue+"</Value></Contains></Where>  \
                        <OrderBy><FieldRef Name='ID' Ascending='TRUE' /></OrderBy></Query></query> \
                        <viewFields> \
                            <ViewFields> \
                              <FieldRef Name='Title' /> \
                              <FieldRef Name='Country' /> \
                              <FieldRef Name='Country_Code' /> \
                              <FieldRef Name='GIPS' /> \
                           </ViewFields> \
                        </viewFields> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

        $.ajax({
            url: "/myserver/pma/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processCountriesGIPS,
            contentType: "text/xml; charset=\"utf-8\""
        });
    });
}

function processCountriesGIPS(xData, status) 
    {

var strForDropDown = "";   
   $(xData.responseXML).find("z\\:row").each(function() {
            strForDropDown = strForDropDown + $(this).attr("ows_Country") + "@" + $(this).attr("ows_Country_Code") + "@" + $(this).attr("ows_GIPS") +"\n";
        });
        // Now populate the department dropdown with our extracted data
        
        alert(strForDropDown);
    }


function populateCountry(strForDropDown)
{
//Clear the dropdown if there is anything.
document.forms['ValidForm'].SelectCountry.options.length = 0;
document.forms['ValidForm'].SelectCountry.options[0] = new Option("(None)", "None");

if (strForDropDown != "")
{

var item_array = strForDropDown.split("\n");

for (var iCount = 0; iCount < (item_array.length-1); iCount++)
{
//alert(item_array[iCount].toString());
var items = item_array[iCount].split("@");

try
{
// Force "None" into all values because it needs this value to fool SharePoint into accepting it when saving 
document.forms['ValidForm'].SelectCountry.options[iCount+1] = new Option(items[0], items[1]);
}
catch(ex)
{
alert("Possible array out of bound error - populateCountry(strForDropDown)");
}
}

}
else
{
document.forms['ValidForm'].SelectCountry.options[0] = new Option("(None)", "None");
}
}
// End of Populate Country Drop Down from SharePoint List MA Report Finder Lookup Countries block //

// function that displays the report after the submit been pressed.
function displayReport()
{
if(checkFundTypesSelected() == true)
{
if(document.forms['ValidForm'].Radio1.checked)
{
if (UrlExists('/myserver/pma/Shared%20Documents/ATTRIBUTION_PERFORMANCE/All%20Files/' + document.forms['ValidForm'].Select1.value + document.forms['ValidForm'].Select3.value + document.forms['ValidForm'].Select2.value + '.xls') == true)
{
var newwindow=window.open('/myserver/pma/Shared%20Documents/ATTRIBUTION_PERFORMANCE/All%20Files/' + document.forms['ValidForm'].Select1.value + document.forms['ValidForm'].Select3.value + document.forms['ValidForm'].Select2.value + '.xls', 'window2', 'toolbar=yes,resizable=yes,directories=no,status=no,menubar=no');
}
else
{

if (document.forms['ValidForm'].Select1.value != "None")
{
alert("PMA report that was selected for " + document.forms['ValidForm'].Select2.options[document.forms['ValidForm'].Select2.selectedIndex].text + " " + document.forms['ValidForm'].Select3.value + " : " + document.forms['ValidForm'].Select1.options[document.forms['ValidForm'].Select1.selectedIndex].text + " is not available to view yet.");
}
else
{
alert("A fund must be selected.");
document.forms['ValidForm'].Select1.focus();
}
}
}
else if(document.forms['ValidForm'].Radio2.checked)
{
if (UrlExists('/myserver/pma/Shared%20Documents/PEER_PERFORMANCE/All%20Files/' + document.forms['ValidForm'].Select1.value + document.forms['ValidForm'].Select2.value + document.forms['ValidForm'].Select3.value + '.xls') == true)
{
var newwindow=window.open('/myserver/pma/Shared%20Documents/PEER_PERFORMANCE/All%20Files/' + document.forms['ValidForm'].Select1.value + document.forms['ValidForm'].Select2.value + document.forms['ValidForm'].Select3.value + '.xls', 'window2', 'toolbar=yes,resizable=yes,directories=no,status=no,menubar=no');
}
else
{
if (document.forms['ValidForm'].Select1.value != "None")
{
alert("PMA report that was selected for " + document.forms['ValidForm'].Select2.options[document.forms['ValidForm'].Select2.selectedIndex].text + " " + document.forms['ValidForm'].Select3.value + " : " + document.forms['ValidForm'].Select1.options[document.forms['ValidForm'].Select1.selectedIndex].text + " is not available to view yet.");
}
else
{
alert("A fund must be selected.");
document.forms['ValidForm'].Select1.focus();
}

}
}
else if(document.forms['ValidForm'].Radio3.checked)
{
if (UrlExists('/myserver/pma/Shared%20Documents/CHARACTERISTICS/All%20Files/' + document.forms['ValidForm'].Select1.value + document.forms['ValidForm'].Select3.value + document.forms['ValidForm'].Select2.value + '.xls') == true)
{
var newwindow=window.open('/myserver/pma/Shared%20Documents/CHARACTERISTICS/All%20Files/' + document.forms['ValidForm'].Select1.value + document.forms['ValidForm'].Select3.value + document.forms['ValidForm'].Select2.value + '.xls', 'window2', 'toolbar=yes,resizable=yes,directories=no,status=no,menubar=no');
}
else
{
if (document.forms['ValidForm'].Select1.value != "None")
{
alert("PMA report that was selected for " + document.forms['ValidForm'].Select2.options[document.forms['ValidForm'].Select2.selectedIndex].text + " " + document.forms['ValidForm'].Select3.value + " : " + document.forms['ValidForm'].Select1.options[document.forms['ValidForm'].Select1.selectedIndex].text + " is not available to view yet.");
}
else
{
alert("A fund must be selected.");
document.forms['ValidForm'].Select1.focus();
}
}
}
else if(document.forms['ValidForm'].RadioGIPS.checked)
{

if (UrlExists('/myserver/pma/Shared%20Documents/GIPS/NEW GIPS Report/' + document.forms['ValidForm'].Select3.value + document.forms['ValidForm'].Select2.value + " " + document.forms['ValidForm'].Select1.value) == true)
{
var newwindow=window.open('/myserver/pma/Shared%20Documents/GIPS/NEW GIPS Report/' + document.forms['ValidForm'].Select3.value + document.forms['ValidForm'].Select2.value + " " + document.forms['ValidForm'].Select1.value, 'window2', 'toolbar=yes,resizable=yes,directories=no,status=no,menubar=no');
}
else
{
if (document.forms['ValidForm'].Select1.value != "None")
{
alert("PMA report that was selected for " + document.forms['ValidForm'].Select2.options[document.forms['ValidForm'].Select2.selectedIndex].text + " " + document.forms['ValidForm'].Select3.value + " : " + document.forms['ValidForm'].Select1.options[document.forms['ValidForm'].Select1.selectedIndex].text + " is not available to view yet.");
}
else
{
alert("A fund must be selected.");
document.forms['ValidForm'].Select1.focus();
}
}


}

}
}

// function that can check whether URL returns not found 404.
function UrlExists(url) 
{     
// Uncomment to view full path of report that program is trying to retrieve
//alert(url);
//document.all.Report_Name_Retrieved.innerHTML = "Report Name : " + url;

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  var http = new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  var http = new ActiveXObject("Microsoft.XMLHTTP");
  }

//var http = new XMLHttpRequest();     
http.open('HEAD', url, false);     
http.send();     
return http.status!=404; 


// Test area to get fields if they had a space or invalid character set inthename, then SharePoint replaces it with _x00xx_
function getSpacedFields()
{

var strDeptValue = "EQ";
var strRegionValue = "HK";
var strReportTypeValue = "Attribution";
var strReportFinderType = "Active";

$(document).ready(function() {
        var soapEnv =
            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>PMA Report Names</listName> \
                        <query><Query><Where><Contains><FieldRef Name='Asset_x0020_Type'/><Value Type='Text'>"+strDeptValue+"</Value></Contains> \
                        </Where><OrderBy><FieldRef Name='Title' Ascending='TRUE' /></OrderBy></Query></query> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='Title' /> \
                               <FieldRef Name='Asset_x0020_Type' /> \
                              <FieldRef Name='Region' /> \
                           </ViewFields> \
                        </viewFields> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

        $.ajax({
            url: "/myserver/pma/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processResearchDocsSpaceFields,
            contentType: "text/xml; charset=\"utf-8\""
        });
    });
}

   function processResearchDocsSpaceFields(xData, status) 
    {

var strForDropDown = "";   
   $(xData.responseXML).find("z\\:row, row").each(function() {
            strForDropDown = strForDropDown + $(this).attr("ows_Region") + "@" + $(this).attr("ows_Asset_x0020_Type") + "@" +"\n";
        });
        // Now populate the department dropdown with our extracted data
        
        alert(strForDropDown);
    }
// End of Test area to get fields if they had a space or invalid character set inthename, then SharePoint replaces it with _x00xx_

</script>

<SCRIPT language="javascript">
window.onload = function function_Select2(){
document.forms['ValidForm'].Select2.options.length = 0
document.forms['ValidForm'].Select2.options[0] =new Option('January','01');
document.forms['ValidForm'].Select2.options[1] =new Option('February','02');
document.forms['ValidForm'].Select2.options[2] =new Option('March','03');
document.forms['ValidForm'].Select2.options[3] =new Option('April','04');
document.forms['ValidForm'].Select2.options[4] =new Option('May','05');
document.forms['ValidForm'].Select2.options[5] =new Option('June','06');
document.forms['ValidForm'].Select2.options[6] =new Option('July','07');
document.forms['ValidForm'].Select2.options[7] =new Option('August','08');
document.forms['ValidForm'].Select2.options[8] =new Option('September','09');
document.forms['ValidForm'].Select2.options[9] =new Option('October','10');
document.forms['ValidForm'].Select2.options[10] =new Option('November','11');
document.forms['ValidForm'].Select2.options[11] =new Option('December','12');
var date_now = new Date();
var month_now = date_now.getMonth();
document.forms['ValidForm'].Select2.options[month_now].selected=true;

document.forms['ValidForm'].Select3.options.length = 0
document.forms['ValidForm'].Select3.options[0] =new Option('','')
document.forms['ValidForm'].Select3.options[1] =new Option('Year 2012','2012');
document.forms['ValidForm'].Select3.options[2] =new Option('Year 2013','2013');
document.forms['ValidForm'].Select3.options[3] =new Option('Year 2014','2014');
document.forms['ValidForm'].Select3.options[4] =new Option('Year 2015','2015');
document.forms['ValidForm'].Select3.options[5] =new Option('Year 2016','2016');
document.forms['ValidForm'].Select3.options[4].selected=true;

document.forms['ValidForm'].Select1.options[0] =new Option('Please SELECT your report type from above','None')
document.forms['ValidForm'].Select1.options[0].selected;

}
</SCRIPT>

</head>
<BODY>
<div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px">
<div id="login-box">
<FORM id=Form2 name=ValidForm><font face=Calibri></font>
<H2><font face=Calibri>QUICK&nbsp;REPORT FINDER : </font></H2><br>

<input id="RadioEQ" type="radio" name="assetClass"  onclick="getPMAFunds()" onchange="getPMAFunds();" size="15px"/>EQUITY  
<input id="RadioFI" type="radio" name="assetClass" onclick="getPMAFunds()" onchange="getPMAFunds();" size="15px"/>FIXED INCOME
<input id="RadioMA" type="radio" name="assetClass" onclick="getPMAFunds()" onchange="getPMAFunds();" size="15px"/>MULTI ASSET
<hr></hr>
<input id="Radio1" type="radio" name="reportype" onclick="getPMAFunds();" onchange="getPMAFunds();" size="15px" />ATTRIBUTION  
<input id="Radio2" type="radio" name="reportype" onclick="getPeerRanking()" onchange="getPMAFunds();" /> PEER RANKING 
<input id="Radio3" type="radio" name="reportype" onclick="getPMAFunds();" onchange="getPMAFunds();" />CHARACTERISTICS
<input id="RadioGIPS" type="radio" name="reportype" onclick="getGIPSReports()" onchange="getGIPSReports();" size="15px"/>GIPS<br></br>
<H5><font face=Calibri>SELECT COUNTRY: 
<SELECT id=SelectCountry name=SelectCountry style="WIDTH: 330px" onchange="getPMAFunds();" ><Option selected></Option>
</SELECT></font></H5>
<H5><font face=Calibri>SELECT FUND:
<SELECT id=Select1 name=Select1 style="WIDTH: 330px" ><Option selected></Option>
</SELECT></font></H5>
<H5><font face=Calibri>SELECT PERIOD: </font>
<SELECT id=Select2 name=Select2>
</SELECT>
<SELECT id=Select3 name=Select3> 
</SELECT><font face=Calibri>&nbsp; </font><INPUT NAME="Submit3" TYPE="button" VALUE="Submit" onclick="displayReport();" ID="Button3"></input></H5>
</FORM></div></div>
<div></div>
<div></div> 
<div id="Report_Name_Retrieved"></div>
</BODY></html>