Wednesday, July 23, 2014

Get all Site and Subsites collection from other Web Application within the server

<div id="divContainer"></div>
<script src="/jquery.js/" type="text/javascript"></script><script src="//SPAPI_Core.js" type="text/javascript"></script><script src="/SPAPI_Webs.js" type="text/javascript"></script>

<script type="text/javascript">
s = new SPAPI_Webs(siteURL);
var xmlhttp= webs.getAllSubWebCollection();
if(xmlhttp.status == 200){
var xmlDoc = xmlhttp.responseXML;
var Webid= xmlDoc.getElementsByTagName("Web");
var html= '<table>';
for (i=0;i<Webid.length;i++) {
   var linkTitle = Webid[i].attributes.getNamedItem("Title").nodeValue;
   var linkURL = Webid[i].attributes.getNamedItem("Url").nodeValue;
   html = html + '<tr><td>';
   html = html + '<p style="border-radius:10px;background-color:Silver;border:2px solid black"><a href="' + linkURL + '">' + linkTitle + ' <img src="PlayButton.jpg" style="height:15px;width:15px;float:right" alt="linkButton"/></a></p>';
   html = html + '</td></tr>';
   }
}
html=html + "</table>";
document.getElementById("divContainer").innerHTML=html;

</script>

Get DDM values from SharePoint List in CEWP

Get DDM values from SharePoint List in CEWP

<div id="divContainer" ></div>

<script src="jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="SPAPI_Core.js" type="text/javascript"></script>
<script src="SPAPI_Lists.js" type="text/javascript"></script>
<script type="text/javascript">

function getDDMValues() {
var pcSites = new SPAPI_Lists(siteUrl );
var pcList = pcSites.getList(listName);
html = '<table width="100%">';
$(pcList.responseXML).find("Field[DisplayName='Community Type'] CHOICE").each(function () {
var fieldValue = $(this).text();
html = html + '<tr>';
html = html + '<td  onclick="getByType(this.innerText);">' + fieldValue + ' <img  src="/sites/myparagon/MIX/ImageLibrary/PlayGreen.jpg"
style="height:20px;width:20px;border:none;float:right;" alt=""/></td>';
html = html + '</tr>';
html = html + '<tr><td></td></tr>';
});
html = html + '</table>';
document.getElementById("divContainer").innerHTML = html;
}
</script>

How TO GET THE CURRENT SITE in CEWP using SPServices

How TO GET THE CURRENT SITE in CEWP
<script src="//JSFiles/jquery-1.11.1.min.js"></script>
<script src="//JSFiles/jquery.SPServices-2014.01.min.js"></script>

<script type="text/javascript">      

            var thisSite = $().SPServices.SPGetCurrentSite();
          alert(thisSite);
            document.write("The Current Site is " + thisSite);

</script>

Hide DIV when click outside of the specific div with jQuery

Hide DIV when click outside of the specific div with jQuery


<html>
<head>
    <title>GETTYPES</title>
</head>
<script src="\JSFiles\jquery-1.11.1.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
    var imageClicked = 0;
     document.onclick = function () {
        var menuList = document.getElementById("divMenuListContainer");
        if (imageClicked == 1) {
            //do nothing
            imageClicked = 0;
        }
        // Click was outside the box, hide it.
        else {
            //hide specific div
            html = '<p></p>';
            document.getElementById("divMenuListContainer").innerHTML = html;
        }
    }

    function getCommunitiesByType(type) {
         imageClicked = 1;
        var html = '<table width="100%">';
         html = html + '</table>';
         document.getElementById("divMenuListContainer").innerHTML = html;
        
    }

    function getCommunitiesChoices() {
        var html="<table onclick='getCommunitiesByType(this.innerText)'>";
           html = html + "</table>";
        document.getElementById("divContainer").innerHTML = html;
    }
</script>
<body>
<button onclick="getCommunitiesChoices();" type="button" value="button">Click ME to Get PC types</button>
<table id="tableID">
<tbody><tr>
<td valign="top"><div id="divContainer" style="border-top: cadetblue 1px solid; border-right: 1px solid; border-bottom: 1px solid; border-left: 1px solid"></div></td>
<td valign="top"><div id="divMenuListContainer"></div></td>
</tr></tbody></table>
</body>
</html>

Introduction of Preferred Integrated Development Environments (IDEs)

Getting Started with IDE Dear Developer, a preferred set of industry-leading, fully-managed Integrated Development Environments (IDEs)—savin...