<%@ Page language="C#" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<WebPartPages:AllowFraming ID="AllowFraming" runat="server" />
<html>
<head>
<title></title>
<script type="text/javascript" src="../Scripts/jquery-1.10.2.js"></script>
<script type="text/javascript" src="/_layouts/15/MicrosoftAjax.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
<script type="text/javascript" src="../Scripts/mustache.js"></script>
<link href="../Content/App.css" rel="stylesheet" />
<script type="text/javascript">
// Set the style of the client web part page to be consistent with the host web.
function setStyleSheet() {
var hostUrl = ""
if (document.URL.indexOf("?") != -1) {
var params = document.URL.split("?")[1].split("&");
for (var i = 0; i < params.length; i++) {
p = decodeURIComponent(params[i]);
if (/^SPHostUrl=/i.test(p)) {
hostUrl = p.split("=")[1];
document.write("<link rel=\"stylesheet\" href=\"" + hostUrl + "/_layouts/15/defaultcss.ashx\" />");
break;
}
}
}
if (hostUrl == "") {
document.write("<link rel=\"stylesheet\" href=\"/_layouts/15/1033/styles/themable/corev15.css\" />");
}
}
setStyleSheet();
</script>
<script type="text/javascript">
function getQueryStringParameter(param) {
var params = document.URL.split("?")[1].split("&");
var strParams = "";
for (var i = 0; i < params.length; i = i + 1) {
var singleParam = params[i].split("=");
if (singleParam[0] == param) {
return singleParam[1];
}
}
return strParams;
}
// Getting list items based on ODATA Query
function getListItems(url, listname, query, complete, failure) {
// Executing our colors ajax request
$.ajax({
url: url + "/_api/web/lists/getbytitle('" + listname + "')/items" + query,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
complete(data); // Returns JSON collection of the results
},
error: function (data) {
failure(data);
}
});
}
$(document).ready(function () {
var appweburl = decodeURIComponent(getQueryStringParameter('SPAppWebUrl'));
var displayTitle = decodeURIComponent(getQueryStringParameter('DisplayTitle'));
var appPartTitle = decodeURIComponent(getQueryStringParameter('AppPartTitle'));
var appPartLogo = decodeURIComponent(getQueryStringParameter('AppPartLogo'));
var appXAxis = decodeURIComponent(getQueryStringParameter('AppXAxis'));
var appYAxis = decodeURIComponent(getQueryStringParameter('AppYAxis'));
var sortOrder = decodeURIComponent(getQueryStringParameter('SortOrder'));
var titleUrl = decodeURIComponent(getQueryStringParameter('AppTitleUrl'));
var backGroundColor = decodeURIComponent(getQueryStringParameter('BackGroundColor'));
var appPartFeatured = decodeURIComponent(getQueryStringParameter('AppPartFeatured'));
$("#displayTitleNavigation").attr('href', appweburl+"/"+titleUrl);
$("#appPartLogo").attr('src', appPartLogo);
$("#displayTitle").html(appPartTitle);
$("#Alerts").attr("style", "background-color:" + backGroundColor);
if (!displayTitle) {
$("#titleSection").attr("style", "display:none");
}
var query = "?$orderby=" + sortOrder + "&$filter=SiteListFeatured eq '" + appPartFeatured + "'&$top=" + (appXAxis + appYAxis);
getListItems(appweburl, "SiteAppsList", query, getListSuccess, getListFailure);
});
function getListSuccess(data) {
var template = $('#Alerts_tpl').html();
var html = Mustache.to_html(template, data.d);
$('#Alerts').html(html);
}
function getListFailure(data) {
}
</script>
<script id="Alerts_tpl" type="text/template">
<div class="tools">
{{#results}}
<div class="pull-left image-indent"><a href="{{SiteListurl}}"><img alt="{{Title}}" src="{{SiteListIcon}}"> </a></div>
{{/results}}
</div>
</script>
</head>
<body>
<div class="tools-wrappers">
<div id="titleSection">
<a href="#" id="displayTitleNavigation">
<img src="" id="appPartLogo"/>
<h2 id="displayTitle">
</h2>
</a>
</div>
<div id="Alerts" class="test"></div>
</div>
</body>
</html>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<WebPartPages:AllowFraming ID="AllowFraming" runat="server" />
<html>
<head>
<title></title>
<script type="text/javascript" src="../Scripts/jquery-1.10.2.js"></script>
<script type="text/javascript" src="/_layouts/15/MicrosoftAjax.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
<script type="text/javascript" src="../Scripts/mustache.js"></script>
<link href="../Content/App.css" rel="stylesheet" />
<script type="text/javascript">
// Set the style of the client web part page to be consistent with the host web.
function setStyleSheet() {
var hostUrl = ""
if (document.URL.indexOf("?") != -1) {
var params = document.URL.split("?")[1].split("&");
for (var i = 0; i < params.length; i++) {
p = decodeURIComponent(params[i]);
if (/^SPHostUrl=/i.test(p)) {
hostUrl = p.split("=")[1];
document.write("<link rel=\"stylesheet\" href=\"" + hostUrl + "/_layouts/15/defaultcss.ashx\" />");
break;
}
}
}
if (hostUrl == "") {
document.write("<link rel=\"stylesheet\" href=\"/_layouts/15/1033/styles/themable/corev15.css\" />");
}
}
setStyleSheet();
</script>
<script type="text/javascript">
function getQueryStringParameter(param) {
var params = document.URL.split("?")[1].split("&");
var strParams = "";
for (var i = 0; i < params.length; i = i + 1) {
var singleParam = params[i].split("=");
if (singleParam[0] == param) {
return singleParam[1];
}
}
return strParams;
}
// Getting list items based on ODATA Query
function getListItems(url, listname, query, complete, failure) {
// Executing our colors ajax request
$.ajax({
url: url + "/_api/web/lists/getbytitle('" + listname + "')/items" + query,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
complete(data); // Returns JSON collection of the results
},
error: function (data) {
failure(data);
}
});
}
$(document).ready(function () {
var appweburl = decodeURIComponent(getQueryStringParameter('SPAppWebUrl'));
var displayTitle = decodeURIComponent(getQueryStringParameter('DisplayTitle'));
var appPartTitle = decodeURIComponent(getQueryStringParameter('AppPartTitle'));
var appPartLogo = decodeURIComponent(getQueryStringParameter('AppPartLogo'));
var appXAxis = decodeURIComponent(getQueryStringParameter('AppXAxis'));
var appYAxis = decodeURIComponent(getQueryStringParameter('AppYAxis'));
var sortOrder = decodeURIComponent(getQueryStringParameter('SortOrder'));
var titleUrl = decodeURIComponent(getQueryStringParameter('AppTitleUrl'));
var backGroundColor = decodeURIComponent(getQueryStringParameter('BackGroundColor'));
var appPartFeatured = decodeURIComponent(getQueryStringParameter('AppPartFeatured'));
$("#displayTitleNavigation").attr('href', appweburl+"/"+titleUrl);
$("#appPartLogo").attr('src', appPartLogo);
$("#displayTitle").html(appPartTitle);
$("#Alerts").attr("style", "background-color:" + backGroundColor);
if (!displayTitle) {
$("#titleSection").attr("style", "display:none");
}
var query = "?$orderby=" + sortOrder + "&$filter=SiteListFeatured eq '" + appPartFeatured + "'&$top=" + (appXAxis + appYAxis);
getListItems(appweburl, "SiteAppsList", query, getListSuccess, getListFailure);
});
function getListSuccess(data) {
var template = $('#Alerts_tpl').html();
var html = Mustache.to_html(template, data.d);
$('#Alerts').html(html);
}
function getListFailure(data) {
}
</script>
<script id="Alerts_tpl" type="text/template">
<div class="tools">
{{#results}}
<div class="pull-left image-indent"><a href="{{SiteListurl}}"><img alt="{{Title}}" src="{{SiteListIcon}}"> </a></div>
{{/results}}
</div>
</script>
</head>
<body>
<div class="tools-wrappers">
<div id="titleSection">
<a href="#" id="displayTitleNavigation">
<img src="" id="appPartLogo"/>
<h2 id="displayTitle">
</h2>
</a>
</div>
<div id="Alerts" class="test"></div>
</div>
</body>
</html>
No comments:
Post a Comment