var objHtmlBox; var uploadID; var blnFirstShow = true; var isAdmin = false; var save_tool = { icon:"save.gif", tooltop:"Save the feedback", command: function(){uploadResponse(objHtmlBox.get_html());} }; $(document).ready(function(){ $('#wbMode').live('click', function(e){ e.preventDefault(); whiteboardMode(); }); $('.wbchange').live('click',function(e){ e.preventDefault(); whiteboardChanges($(this).attr("rel")); }); if (isAdmin) {$('#content').prepend('');} }); function whiteboardMode() { $('#wbMode,#wbModeLinkContainer').remove(); $('#content').appendTo('body'); $('#content').siblings().hide(); $('.admin_attachmentListing').hide(); $('#content').before('
Text SizeNormalMediumLargeSite Colour SchemeStandardYellow/BlueBlack/YellowBlue/BlueExit Whiteboard ModeExit
'); $('#content').css({ 'font-size':'100%', 'padding':'40px 20px 20px', 'float':'none', 'width':'auto' }); $('p').css({ 'font-size':'100%', 'line-height':'130%', 'font-weight':'normal' }); $('body').css("overflow","auto"); disableLoadedInterface(); whiteboardChanges('font_normal'); whiteboardChanges('white_black'); } function whiteboardChanges(strChange) { if (strChange != '') { switch (strChange) { case 'font_normal': $('#content').css({ 'font-size':'100%' }); $('p').css({ 'font-size':'100%', 'line-height':'130%', 'font-weight':'normal' }); break; case 'font_med': $('#content').css({ 'font-size':'130%' }); $('p').css({ 'font-size':'130%', 'line-height':'170%', 'font-weight':'bold' }); break; case 'font_lg': $('#content').css({ 'font-size':'140%' }); $('p').css({ 'font-size':'150%', 'line-height':'200%', 'font-weight':'bold' }); break; case 'white_black': $('#content,#content *').css({ 'background-color':'#fff', 'color':'#000' }); break; case 'yellow_blue': $('#content,#content *').css({ 'background-color':'#FEF57E', 'color':'#002351' }); break; case 'black_yellow': $('#content,#content *').css({ 'background-color':'#000', 'color':'#F4EF00' }); break; case 'blue_blue': $('#content,#content *').css({ 'background-color':'#81CAFF', 'color':'#002351' }); break; case 'exit_wb': window.location.reload(); break; } } } function uploadResponse(strData) { $.ajax({ url: '/admin/vle/client_side/assignments/feedback.asp', dataType: 'html', type: 'POST', data: { u: uploadID, fb: strData }, success: function(data){ if (data === 'success') { alert("Your feedback has been received and saved."); $('#responseContainer').dialog('close'); } else { alert("There was a problem saving your feedback, please try again."); } } }); } $(document).ready(function () { $('#editPupilPage').live('click', function(e){ $("#pupilPageInfo").unbind('edit-postSet.e4e').bind('edit-postSet.e4e',function() { strPostURL = "/admin/vle/client_side/savePupilPage.asp"; aryPostData = "itemTitle="+escape($('h1.cms-title').text())+"&itemContent="+escape($('#pupilPageInfo').html())+"&intReviewerID="+$('#intReviewerID').text()+"&intPageParentID="+$('#intPageParentID').text()+"&intItemID="+$('#intItemID').text()+"&pageStyleSheet="+escape($('#pageStyleSheet').text())+"&commentsOn="+$('#commentsOn').text(); $.e4eLoaderScreen.show("Sending your page for approval", undefined, undefined, true); $.e4eLoaderScreen.setProgress(50); $.ajax({ url: strPostURL, data: aryPostData, type: 'POST', dataType: 'json', success: function (data) { $.e4eLoaderScreen.setProgress(100); window.location.reload(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { var errorMessage = 'Sorry, there was a problem saving this item.
Please close this message and try again.'; $.e4eLoaderScreen.setProgress('error', errorMessage); } }); $.e4eLoaderScreen.hide(); }); var strPupilPageHTML = $('#pupilPageInfo').clone(); $('.vle-clearer',strPupilPageHTML).remove(); $(strPupilPageHTML).e4eDialog({ diagTitle: 'About Me', bind: false, editor: true, resizeable: false, sourceID: '#pupilPageInfo', toolBarSet: 'VLEPupil' }); }); $('#editPupilDraftPage').live('click', function(e){ strPostURL = "/admin/vle/client_side/getPupilDraftPage.asp"; aryPostData = "intItemID="+$('#intItemID').text(); $.ajax({ url: strPostURL, data: aryPostData, type: 'POST', dataType: 'html', success: function (retdata) { $("#pupilPageInfo").html(retdata); $("#pupilPageInfo").unbind('edit-postSet.e4e').bind('edit-postSet.e4e',function() { strPostURL = "/admin/vle/client_side/savePupilDraftPage.asp"; aryPostData = "itemTitle="+escape($('h1.cms-title').text())+"&itemContent="+escape($('#pupilPageInfo').html())+"&intReviewerID="+$('#intReviewerID').text()+"&intPageParentID="+$('#intPageParentID').text()+"&intItemID="+$('#intItemID').text()+"&intItemLiveID="+$('#intItemLiveID').text()+"&pageStyleSheet="+escape($('#pageStyleSheet').text())+"&commentsOn="+$('#commentsOn').text(); $.e4eLoaderScreen.show("Sending your page for approval", undefined, undefined, true); $.e4eLoaderScreen.setProgress(50); $.ajax({ url: strPostURL, data: aryPostData, type: 'POST', dataType: 'html', success: function (retdata) { $.e4eLoaderScreen.setProgress(100); window.location.reload(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { var errorMessage = 'Sorry, there was a problem saving this item.
Please close this message and try again.'; $.e4eLoaderScreen.setProgress('error', errorMessage); } }); }); var strPupilPageHTML = $('#pupilPageInfo').clone(); $('.vle-clearer',strPupilPageHTML).remove(); $(strPupilPageHTML).e4eDialog({ diagTitle: 'Edit Draft Page', bind: false, editor: true, resizeable: false, sourceID: '#pupilPageInfo', toolBarSet: 'VLEPupil' }); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert('Sorry, there was a problem getting the contents of your draft page, please close this message and try again.'); } }); }); $('#deletePupilDraftPage').live('click', function(e){ var blnConfirm = confirm("Are you sure you wish to delete this draft?"); if (blnConfirm) { strPostURL = "/admin/vle/client_side/deletePupilDraftPage.asp"; aryPostData = "intItemID="+$('#intItemID').text(); $.e4eLoaderScreen.show("Deleting your draft page", undefined, undefined, true); $.e4eLoaderScreen.setProgress(50); $.ajax({ url: strPostURL, data: aryPostData, type: 'POST', dataType: 'json', success: function (data) { $.e4eLoaderScreen.setProgress(100); window.location.reload(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { var errorMessage = 'Sorry, there was a problem deleting the item.
Please close this message and try again.'; $.e4eLoaderScreen.setProgress('error', errorMessage); } }); } }); $('.pupil-avatar-container').hover(function () { $('a.change-student-avatar', this).stop(true, true).fadeIn(300); }, function () { $('a.change-student-avatar:not(.clicked)', this).stop(true,true).fadeOut(300); }); $('.available-avatars-close').live('click', function(e){ setTimeout(function () { $('.available-avatars-container').remove(); $('a.change-student-avatar').removeClass('clicked').stop(true,true).fadeOut(300); }, 200) }); $('a.change-student-avatar').click(function (e) {e.preventDefault();$('a.change-student-avatar').focus();}).focus(function (e) { e.preventDefault(); $(this).addClass('clicked'); $('.available-avatars-container').remove(); var c = $('
'), cme = $('
X
'), ic = $('
'), a = $('
'), self = this; ic.addClass('loading'); c.append(a).append(cme).append(ic).appendTo('body').css({ 'top' : $(this).offset().top + $(this).outerHeight(true) - $(a).outerHeight(true) * 0.5 - 2, 'left' : ($(this).offset().left + $(this).outerWidth(true) * 0.5) - c.outerWidth(true) * 0.5 }); $.ajax({ url:'/admin/vle/avatar.list.json.asp', dataType:'json', success:function (data) { ic.removeClass('loading'); if($.type(data.avatars) == 'array' && data.avatars.length > 0) { for(var i = 0; i < data.avatars.length; i++) { ic.append(''); if (blnFirstShow) { blnFirstShow = false; ic.width(($('.available-avatar:first',ic).outerWidth(true) + 20) * (data.avatars.length)); } } c.animate({'width' : ic.outerWidth(true), 'left' : ($(self).offset().left + $(self).outerWidth(true) * 0.5) - ic.outerWidth(true) * 0.5}); $('.available-avatar').click(function (e) { e.preventDefault(); if(!$(this).hasClass('selected')) { var newSrc = $(this).find('img').attr('src'); $('.pupil-avatar-container img').attr('src', newSrc); $.ajax({ url:'/admin/vle/avatar.set.json.asp', data : {'image' : newSrc,'page': intCurrentItemID} }); $('a.change-student-avatar').blur(); } }); } } }); }).blur(function () { setTimeout(function () { $('.available-avatars-container').remove(); $('a.change-student-avatar').removeClass('clicked').stop(true,true).fadeOut(300); }, 200) }) $('#assignmentsUploadsContainer a#btnContainer').click(function (e) { e.preventDefault(); SWFUploadObject.cancelQueue(); }) $('.assignmentList li').each(function () { $(this).not(':contains("View Response")').append(''); if($(this).index() %2 == 0) $(this).addClass('odd'); }).find('a.delete-submission').click(function (e) { e.preventDefault(); $(this).hide(); var con = $(this).parent(); con.append('

are you sure you want to delete this?

NoYes').addClass('confirm-delete'); $('.confirm-delete-sbumission', con).click(function (e) { e.preventDefault(); var submissionLink = con.closest('li').find('a:first').attr('href'); $.ajax({ url:'/admin/vle/submission.remove.json.asp', dataType: 'json', data : { submissionID : submissionLink.substr(submissionLink.indexOf('submissionID=') + 13), pid : intCurrentItemID }, success : function (ret) { if (ret.status == 'true') { con.closest('li').slideUp(300); } else { alert(ret.message); } } }); }); $('.cancel-delete-sbumission', con).click(function (e) { e.preventDefault(); con.find('>*:not(.delete-submission)').fadeOut(200, function () { $(this).remove(); $('.delete-submission', con).show(); con.removeClass('confirm-delete') }); }); }) $('#pupilHomeworkContainer li, #classNewsContainer li, #schoolNewsContainer li, #classHomeworkContainer li').each(function () { if($(this).index() %2 == 0) $(this).addClass('odd'); }) $('.ajaxLoadResponse').live('click',function(event){ event.preventDefault(); $this = $(this); var strHref = $this.attr("href"); if($this.closest('li').next('li').hasClass('response-holder')) { if($this.hasClass('open')) { $this.closest('li').next('li.response-holder').slideUp(300); $this.removeClass('open'); $this.text('View Response'); } else { $this.closest('li').next('li.response-holder').slideDown(300); $this.addClass('open'); $this.text('Hide Response'); } } else { if (strHref != '') { uploadID = $this.attr("rel"); $.ajax({ url: strHref, dataType: 'html', success: function(data){ var response = $('
  • ' + data + '
  • '); $this.closest('li').after(response); $this.addClass('open'); $this.text('Hide Response'); response.slideDown(300); if (isAdmin) { objHtmlBox = $("#responseContainer", response).htmlbox({ skin: "orange", about: false, idir: "/admin/vle/client_side/_includes/js/htmlbox/images/", toolbars:[ [save_tool,"separator","bold","italic","underline"] ] }); } }, error: function(){ alert('There was a problem retrieving the teachers response, please try again.'); } }); } } }); });