-
1 Attachment(s)
HAP v8.4 Problem
I've gone through all the set up and configuration documentation provided with v8.4 but when we connect to the HAP site there is hardly anything displaying. I've attached a screenshot of what the page looks like and this is happening for all types of user and it happens both on IE and Chrome. Any help with this would be greatly appreciated. Thanks.
-
There seems to be a scripting error there as you shouldn't see the header on that page. Is there any way of doing some javascript debugging using the developer tools in your browser (F12). The console tab should show you any errors.
-
Had a look at the errors. We are getting "Uncaught ReferenceError: hap is not defined" on line 86 and 102. I've attached the code and put ------- next to the error lines for you
Code:
<script type="text/javascript">
$(document).ready(function () {
hap.livetiles.Init([
-----------------------------------------------------------Uncaught ReferenceError: hap is not defined----------------------------------------------------------------
{ Type: "myfiles" , Data: { Group: "Resources", Name: "My Files", Url: "~/myfiles/", Target: "", Description: "Access your School My Files", Icon: "api/tiles/icons/64/64/images/icons/metro/folders-os/DocumentsFolder.png", Color: { Base: '#04AEDA', Light: '#1DC7F3', Dark: '#0094C0' } } },
{ Type: "" , Data: { Group: "Resources", Name: "My Emails", Url: "https://mail.towers.kent.sch.uk/owa/", Target: "", Description: "Access Email", Icon: "api/tiles/icons/64/64/images/icons/metro/office-15/outlook.png", Color: { Base: '#1E70B6', Light: '#3789CF', Dark: '#04569C' } } }
]);
});
</script>
</div>
</div>
</div>
</div>
<a id="rightscoll" href="#right"></a>
<a id="leftscroll" href="#left"></a>
</div>
<script type="text/javascript">
var scrollpos = sliding = startClientX = startPixelOffset = pixelOffset = 0;
hap.load = hap.loadtypes.help;
-----------------------------------------------Uncaught ReferenceError: hap is not defined-----------------------------------------------------------------
$(document).ready(function () {
$("#HomeButtons").mousewheel(function(event, delta) {
if (delta > 0) {
if (scrollpos < ($("#HomeButtons > div").length - 1)) {
scrollpos++;
$("#HomeButtonsOutter").animate({ scrollLeft: (scrollpos * ($("#HomeButtonsOutter").width() - 20) + (scrollpos * 20)) });
$("#HomeButtonsHeader h1").removeClass("active");
$("#HomeButtonsHeader h1")[scrollpos].className = "active";
}
}
else {
if (scrollpos > 0) {
scrollpos--;
$("#HomeButtonsOutter").animate({ scrollLeft: (scrollpos * ($("#HomeButtonsOutter").width() - 20) + (scrollpos * 20)) });
$("#HomeButtonsHeader h1").removeClass("active");
$("#HomeButtonsHeader h1")[scrollpos].className = "active";
}
}
return false;
}).on('touchstart', function(event) { if (event.originalEvent.touches) event = event.originalEvent.touches[0]; if (sliding == 0) { sliding = 1; startClientX = event.clientX; }
}).on('touchend', function (event) {
if (sliding == 2) {
sliding = 0;
scrollpos = pixelOffset < startPixelOffset ? scrollpos + 1 : scrollpos - 1;
scrollpos = Math.min(Math.max(scrollpos, 0), $("#HomeButtons > div").length - 1);
$("#HomeButtonsOutter").animate({ scrollLeft: (scrollpos * ($("#HomeButtonsOutter").width() - 20) + (scrollpos * 20)) });
$("#HomeButtonsHeader h1").removeClass("active");
$("#HomeButtonsHeader h1")[scrollpos].className = "active";
}
}).on('touchmove', function(event) {
event.preventDefault();
if (event.originalEvent.touches)
event = event.originalEvent.touches[0];
var deltaSlide = event.clientX - startClientX;
if (sliding == 2) {
var touchPixelRatio = 1;
if ((scrollpos == 0 && event.clientX > startClientX) || (scrollpos == $("#HomeButtons > div").length - 1 && event.clientX < startClientX))
touchPixelRatio = 3;
pixelOffset = startPixelOffset + deltaSlide / touchPixelRatio;
}
});
$("#HomeButtons").css("width", (($("#HomeButtons > div").length * $("#HomeButtonsOutter").width()) + 200) + "px");
if ($("#HomeButtons > div").length == 1) $("#rightscoll, #leftscroll").hide();
$("#HomeButtons .panel").css("width", $("#HomeButtonsOutter").width() + "px");
$("#leftscroll").click(function () {
if (scrollpos > 0) {
scrollpos--;
$("#HomeButtonsOutter").animate({ scrollLeft: (scrollpos * ($("#HomeButtonsOutter").width() - 20) + (scrollpos * 20)) });
$("#HomeButtonsHeader h1").removeClass("active");
$("#HomeButtonsHeader h1")[scrollpos].className = "active";
}
return false;
});
$("#rightscoll").click(function () {
if (scrollpos < ($("#HomeButtons > div").length - 1)) {
scrollpos++;
$("#HomeButtonsOutter").animate({ scrollLeft: (scrollpos * ($("#HomeButtonsOutter").width() - 20) + (scrollpos * 20)) });
$("#HomeButtonsHeader h1").removeClass("active");
$("#HomeButtonsHeader h1")[scrollpos].className = "active";
}
return false;
});
$(window).resize(function() {
$("#HomeButtons").css("width", (($("#HomeButtons > div").length * $("#HomeButtonsOutter").width()) + 200) + "px");
$("#HomeButtons .panel").css("width", $("#HomeButtonsOutter").width() + "px");
$("#HomeButtonsOutter").animate({ scrollLeft: (scrollpos * ($("#HomeButtonsOutter").width() - 20) + (scrollpos * 20)) });
$("#rightscoll, #leftscroll").css("height", $("#HomeButtonsOutter").height() + "px").css("line-height", $("#HomeButtonsOutter").height() + "px");
});
$("#HomeButtonsHeader h1 a").click(function () {
scrollpos = $(this).parent().index();
$("#HomeButtonsOutter").animate({ scrollLeft: (scrollpos * ($("#HomeButtonsOutter").width() - 20) + (scrollpos * 20)) });
$("#HomeButtonsHeader h1").removeClass("active");
this.parentNode.className = "active";
return false;
});
$("#HomeButtonsOutter").animate({ scrollLeft: (scrollpos * ($("#HomeButtonsOutter").width() - 20) + (scrollpos * 20)) });
$("#HomeButtonsHeader h1:first").addClass("active");
$('input[type=submit]').button();
$("#rightscoll, #leftscroll").css("height", $("#HomeButtonsOutter").height() + "px").css("line-height", $("#HomeButtonsOutter").height() + "px");
});
</script>
-
I have re-read the following file :- /scripts/hap.web.js.js and noticed on line 12 that there was an else statement that wasnt link to anything i changed it from this
Code:
jsonError: function (xhr, ajaxOptions, thrownError) {
try {
if (xhr.responseText.match(/\<!doctype html/gi))window.location.reload();
try { console.log(xhr.responseText); } catch (ex) { };
else {
if (document.getElementById("errorlist") == null) $("#hapContent").append('<div id="errorlist"></div>');
$("<div class=\"ui-state-error ui-corner-all\" style=\"padding: 3px 10px 3px 10px\"><span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: 5px; margin-top: 2px;\"></span><a href=\"#\" onclick=\"this.nextSibling.className = (this.nextSibling.className == 'cont') ? '' : 'cont'; return false;\">" + jQuery.parseJSON(xhr.responseText).Message + "</a><div class=\"cont\">This error has been logged on the server's event log</div></div>").appendTo("#errorlist");
setTimeout("hap.common.clearError();", 10000);
try { console.log(xhr.responseText); } catch (ex) { };
}
} catch (e) { if (thrownError != "") alert(thrownError); }
},
To this
Code:
jsonError: function (xhr, ajaxOptions, thrownError) {
try {
if (xhr.responseText.match(/\<!doctype html/gi))
{
window.location.reload();
try { console.log(xhr.responseText); } catch (ex) { };
}
else {
if (document.getElementById("errorlist") == null) $("#hapContent").append('<div id="errorlist"></div>');
$("<div class=\"ui-state-error ui-corner-all\" style=\"padding: 3px 10px 3px 10px\"><span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: 5px; margin-top: 2px;\"></span><a href=\"#\" onclick=\"this.nextSibling.className = (this.nextSibling.className == 'cont') ? '' : 'cont'; return false;\">" + jQuery.parseJSON(xhr.responseText).Message + "</a><div class=\"cont\">This error has been logged on the server's event log</div></div>").appendTo("#errorlist");
setTimeout("hap.common.clearError();", 10000);
try { console.log(xhr.responseText); } catch (ex) { };
}
} catch (e) { if (thrownError != "") alert(thrownError); }
},
and its now working, but i am now getting an error when i select myfiles i get the following error, even after copying over the new myfiles patch.
Source File: c:\inetpub\wwwroot\HAP\MyFiles\Default.aspx Line: 121
Code:
Line 119: if (window.location.href.split('#')[1] != "" && window.location.href.split('#')[1]) {
Line 120: curpath = window.location.href.split("#")[1];
Line 121: if (typeof (window.FileReader) != 'undefined') { $("#MyFiles").attr("dropzone", "copy<%=DropZoneAccepted %>"); }
Line 122: if (viewMode == 1) { $("#MyFiles").addClass("details"); $("#MyFilesHeaddings").show(); }
Line 123: else if (viewMode == 2) $("#MyFiles").addClass("small");
Stack Trace:
Code:
[ArgumentOutOfRangeException: Index and count must refer to a location within the string.
Parameter name: count]
System.String.RemoveInternal(Int32 startIndex, Int32 count) +0
HAP.Web.MyFiles.Default.get_DropZoneAccepted() +448
ASP.myfiles_default_aspx.__Render__control46(HtmlTextWriter __w, Control parameterContainer) in c:\inetpub\wwwroot\HAP\MyFiles\Default.aspx:121
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
HAP.Web.Controls.CompressJS.Render(HtmlTextWriter writer) +99
ASP.myfiles_default_aspx.__Render__control19(HtmlTextWriter __w, Control parameterContainer) in c:\inetpub\wwwroot\HAP\MyFiles\Default.aspx:77
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +315
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +48
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
System.Web.UI.Page.Render(HtmlTextWriter writer) +40
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5290