|
New to the CF scene
Join Date: Apr 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
Android Asp problem
Ok I am trying to make an app for android that accesses a website. on the website there is an option to view a schedule. that schedule is in asp. I am trying to get the data from the asp file into the android calendar. I am not quite sure how to go about doing that. any help? here is the asp file. Any help is appreciated.
i added only the data that should really be important as the whole was too long
<script type="text/javascript">
//<![CDATA[
var displayedScheduleDate = '04-16-2012';var currentWeek = 12;var scheduleTimestamp = new Date('04/17/2012 1:54:33'); $('#scheduleFooter').html(formatTime(scheduleTimestamp)); $(document).ready(function(){ lastUpdatedEmailAddy = 'buddyfoeva1@hotmail.com';});$(document).ready(function() {$('#lnkSubmit').hide();});//]]>
</script>
</form>
<script type="text/javascript">
var showAvail = false;
var showActual = false;
var menuActive = false;
var lastUpdatedEmailAddy;
var winID = 213199781;
var userID = 2711346;
var userFullName = "Buddy Harrison";
var selectedWeek;
var omnitureSuiteId = "walmartstoresmywalmartprod,walmartstorewalmartstoremywalmartsched";
$(document).ready(function() {
hideAvailability();
selectedWeek = currentWeek;
showSchedules();
$('#btnShowAvail').click(function () { toggleAvailability(); return false; });
$('#btnHideAvail').click(function () { toggleAvailability(); return false; });
//showExceptionCalendar();
$('#txtEmail, #txtEmail2').val(lastUpdatedEmailAddy);
});
function toggleSendButton() {
if($('[id$=chkAccept]').get(0).checked) {
$('#lnkSubmit').show();
}
else {
$('#lnkSubmit').hide();
}
}
function updateTab(week) {
$('#pnlWeek' + selectedWeek).hide();
$("#scheduleTab" + selectedWeek).removeClass("walSchHeaderTabs_cur");
selectedWeek = week;
$('#pnlWeek' + selectedWeek).show();
$("#scheduleTab" + selectedWeek).addClass("walSchHeaderTabs_cur");
//Code to capture stat for yesterday here...
if(currentWeek != selectedWeek)
{
var s=s_gi(omnitureSuiteId); s.tl(this, 'o', 'OTW Full Tab Click ' + getOmnitureWeekText(selectedWeek));
}
}
function getOmnitureWeekText(weekNumber)
{
var ret = '';
switch( weekNumber - currentWeek )
{
case -2:
ret = 'Two Weeks Ago';
break;
case -1:
ret = 'Last Week';
break;
case 0:
ret = 'Current Week';
break;
case 1:
ret = 'Next Week';
break;
case 2:
ret = 'Two Weeks Ahead';
break;
default:
}
return ret;
}
function showAvailability() {
//$(".workbar").hide();
$(".availbar").show();
$(".rightColHeader").css("background-color", "#337321");
//$(".rightColHeader div.w").hide();
$(".rightColHeader div.avH").show();
//$(".ActualsDetails").hide();
$(".AvailDetails").show();
}
function hideAvailability() {
$(".availbar").show();
$(".availbar").hide();
//$(".workbar").show();
//var iB = "#" + ((showActual) ? "003896" : "FFFFFF");
$(".rightColHeader").css("background-color", "#FFFFFF");
$(".rightColHeader div.avH").hide();
//$(".rightColHeader div.w").show();
$(".AvailDetails").hide();
//$(".ActualsDetails").show();
}
function toggleAvailability() {
showAvail = $('#btnShowAvail').css('display') != 'none';
if (showAvail) {
showAvailability();
$('#btnShowAvail').hide();
$('#btnHideAvail').show();
}
else {
hideAvailability();
$('#btnShowAvail').show();
$('#btnHideAvail').hide();
}
}
function showSchedules() {
$(".walSchHeader div a:lt(2)").show();
$("#timeSchedule").show();
$("#hTabHolder").show();
$(".walSchFooter").show();
$("#schIcon").hide();
$("#availIcon").show();
//Handle the problem where current week is not selected when coming back from exceptions.
updateTab(selectedWeek);
}
function hideSchedules() {
$("#timeSchedule").hide();
$("#hTabHolder").hide();
$(".walSchFooter").hide();
$(".walSchHeader div a:lt(2)").hide();
}
function showExceptionCalendar() {
$("#timeExceptions").show();
$(".assocInfo").show();
$("#availIcon").hide();
$("#schIcon").show();
var s=s_gi(omnitureSuiteId); s.tl(this, 'o', 'OTW Full Tab Click Exception Calendar');
}
function hideExceptionCalendar() {
$("#timeExceptions").hide();
$(".assocInfo").hide();
}
function showExceptionToolTip(e, elemId) {
if (!menuActive) {
var posX = 0;
var posY = 0;
var e = (!e) ? window.event : e;
if (e.pageX || e.pageY) {
posX = e.pageX;
posY = e.pageY;
}
else if (e.clientX || e.clientY) {
posX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
posY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
var iDiv = document.createElement("div");
with (iDiv) {
className = "tooltip";
style.top = posY + "px";
style.left = (posX + 5) + "px";
innerHTML = '<div class="sttt"> </div><div class="sttm">' + $('#' + elemId).html() + '</div><div class="sttb"></div>';
}
document.body.insertBefore(iDiv, document.body.firstChild);
repositionDiv(posX, posY);
menuActive = true;
}
}
function repositionDiv() {
if (arguments[0] + $("div.tooltip").width() > document.documentElement.clientWidth) {
$("div.tooltip").css("left", arguments[0] - $("div.tooltip").width());
}
if (arguments[1] + $("div.tooltip").height() > document.documentElement.clientHeight) {
$("div.tooltip").css("top", document.documentElement.clientHeight - $("div.tooltip").height());
}
}
function hideExceptionToolTip() {
$("div.tooltip").remove();
menuActive = false;
}
function printSchedule() {
window.open('printableSchedule.aspx?w=213199781&d=04-16-2012&p=' + selectedWeek, '', 'width=615,height=455,scrollbars=yes');
}
function showFeedback() {
window.open('technicalsurvey.aspx', '', 'width=520,height=460,scrollbars=yes');
}
var popupStatus = 0;
function loadPopup(popupToShow) {
if (popupStatus == 0) {
if (popupToShow == 'email') {
$(".help").hide();
$(".emailLayout").show();
}
else if (popupToShow == 'help') {
$(".emailLayout").hide();
$(".help").show();
}
this.centerPopup();
$("#backgroundPopup").css({
"opacity": "0.7"
});
$("#backgroundPopup").fadeIn("slow");
$("#popupContact").fadeIn("slow");
this.popupStatus = 1;
}
}
function disablePopup() {
if (this.popupStatus == 1) {
$(".help").hide();
$(".emailLayout").hide();
$("#backgroundPopup").fadeOut("slow");
$("#popupContact").hide();
setTimeout('emailReset()', 1000);
this.popupStatus = 0;
}
}
function centerPopup() {
var popupHeight = $("#popupContact").height();
var popupWidth = $("#popupContact").width();
$("#popupContact").css({
"position": "absolute",
"top": (document.documentElement.clientHeight / 2) - (popupHeight / 2),
"left": (document.documentElement.clientWidth / 2) - (popupWidth / 2)
});
$("#backgroundPopup").css({
"height": document.documentElement.clientHeight,
"width": document.documentElement.clientWidth
});
}
function emailReset() {
$("#divEmailError").fadeOut(1000);
$("#contactArea").show();
$("#confirmArea").hide();
$('#txtEmail').val(lastUpdatedEmailAddy);
$('#txtEmail2').val(lastUpdatedEmailAddy);
$("span.ackErr").fadeOut(1000);
if (!this.lastUpdatedEmailAddy == '') {
$("#contactArea b").html(lastUpdatedEmailAddy);
$('[id$=divAddress]').show();
$('[id$=divNoAddress]').hide();
}
else {
$('[id$=divAddress]').hide();
$('[id$=divNoAddress]').show();
}
}
// function hideConfirmEmailAddy() {
// $("#divEmailError").hide();
// $("#hideEmailAddyLink").hide();
// $("#confirmEmailAddyLink").show();
// $(".confirmEmailAddy").hide();
// centerPopup('email');
// $('#txtEmail').val(lastUpdatedEmailAddy);
// $('#txtEmail2').val('');
// }
// function showConfirmEmailAddy() {
// $("#confirmEmailAddyLink").hide();
// $("#hideEmailAddyLink").show();
// $(".confirmEmailAddy").show();
// centerPopup('email');
// $('#txtEmail').val('');
// $('#txtEmail2').val('');
// }
function confirmEmail() {
var validEmailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var iTest = false;
if ($('.confirmEmailAddy').get(0)) {
iTest = true
}
if (iTest && $('#txtEmail').val() == "") {
$("#divEmailError").html('You have not entered an email address!');
$("#divEmailError").show();
return false;
}
else if (iTest && $('#txtEmail2').val() == "") {
$("#divEmailError").html('You have not confirmed the email address!');
$("#divEmailError").show();
return false;
var s = new String();
}
else if (iTest && $('#txtEmail').val().toLowerCase() != $('#txtEmail2').val().toLowerCase()) {
$("#divEmailError").html('The email address and confirmed email address do not match!');
$("#divEmailError").show();
return false;
}
else if (iTest && (!validEmailReg.test($('#txtEmail').val()) || !validEmailReg.test($('#txtEmail2').val()))) {
$("#divEmailError").html('You have not entered a valid email address!');
$("#divEmailError").show();
return false;
}
else {
var w = parseInt(winID);
var toEmail = '';
if (iTest) {
toEmail = $('#txtEmail').val()
}
else {
toEmail = lastUpdatedEmailAddy;
}
var iTitle = 'Walmart Schedule for Walmart Week #' + selectedWeek + ' for ' + userFullName;
var parms = {
"setPrimary": false,
"optInForMyWalmartNotifications": ($("#elemOkToOptIn").get(0) != null && $("#elemOkToOptIn").attr('checked')),
"optInForScheduleNotifications": ($("#elemOkToSendSchChanges").get(0) != null && $("#elemOkToSendSchChanges").attr('checked')),
"emailAddress": toEmail,
"userID": userID,
"displayedScheduleDate": displayedScheduleDate,
"scheduleValidString": formatTime(scheduleTimestamp),
"weekToPrint": selectedWeek
};
jsonString = JSON.stringify(parms);
$.ajax({
type: "POST",
url: "/_resources/Services/UserSchedules/UserSchedule.asmx/EmailAssociateSchedule",
data: jsonString,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
$("#contactArea").hide();
$("#confirmArea").show();
$("#confirmArea").html("The schedule has been emailed to: <b>" + toEmail + "</b>");
//Omniture code to notify success of email.
var s=s_gi(omnitureSuiteId); s.tl(this, 'o', 'OTW Full Tab Click Email Schedule');
setTimeout('disablePopup()', 3000);
setTimeout('emailReset()', 4000);
},
error: function(xhr, msg) { alert('An error occurred while sending the email. Please try again.'); }
});
}
}
</script>
<script type="text/javascript">
//Send start for showing current tab when page loads.
//By the way, apparently this won't work in document.ready. I tried.
var s = s_gi(omnitureSuiteId); s.tl(this, 'o', 'OTW Full Tab Click Current Week');
</script>
</body>
</html>
|
|