2011-01-06 5 views
0

저는 Scorm MVC 프로젝트를 진행하고 있습니다. 기본적으로 cs 클래스 파일에서 부분 뷰를 업데이트해야합니다.MVC Scorm sequencing PartialView 관련 문제

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 
    <h2>Table of Contents Test</h2> 
    <br /> 
    <div id="SCONavBar"> 
     <% XElement item = (XElement) Model; 
      String rootID = (String) ViewData["courseRoot"]; 
      String resource = (String) ViewData["resource"]; %> 
     <button id="prev" onclick="javascript:NavigationRequest('', '<%: resource %>', 'previous');">Previous</button> 
     <button id="cont" onclick="javascript:NavigationRequest('', '<%: resource %>', 'continue');">Continue</button> 
     <button id="start" onclick="javascript:NavigationRequest('', '<%: resource %>', 'start');">Start Course</button> 
    </div> 
    <div id="scoContainer"> 
     <div id="treeContainter" style="display:inline-block; outline:black solid 1px; height:600px; width:300px; overflow:scroll; padding:2px;"> 
      <ul id="treeview"> 
       <% Html.RenderPartial("~/Views/Content/ActivityTreeUserControl.ascx", item); %> 
      </ul> 
     </div> 
     <div id="contentContainer" style="vertical-align:top; display:inline-block; outline:black solid 1px;"> 
      <% Html.RenderPartial("~/Views/Content/ContentFrame.ascx"); %> 
     </div> 
    </div> 
    <script type="text/javascript" src="../../Scripts/TreeView/TOCControlScript.js"></script> 
    <script type="text/javascript" src="../../Scripts/TreeView/resizeFrame.js"></script> 
    <script type="text/javascript" src="../../Scripts/Scorm/loungeScormMethods.js"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      startTree(); 
     }); 
    </script>  
</asp:Content> 

위의 내용은 내보기 용 코드입니다. 첫 번째로드시 목차 부분 뷰 및 Iframe 부분 뷰가로드됩니다. 내 개인 시작, 계속 및 이전 버튼을 클릭하면 AJAX 요청은 시퀀서를 통해 이동하여 다음 컨텐트로 연결되는 링크를 반환하고 javascript에서 iframe의 소스를 업데이트합니다. 이것은 잘 작동합니다.

자바 스크립트

function sendToFrame(source) { 
window.frames.SCODisplay.location.href = source; 

}

function NavigationRequest(id, resource, type) { 
    var result = null; 
    $.ajax({ 
     type: 'POST', 
     url: '/Content/NavigationRequest/', 
     data: {type : type}, 
     async: false, 
     success: function (data) { 
      result = data; 
     } 
    }); 
    if (result != null && result != "") { 
     var source = "../Content/" + resource + "/" + result; 
     sendToFrame(source, id) 
    } 
} 

은 이제 내용이 때때로 콘텐츠에 내부적으로 버튼을 통해 탐색 할 수 있습니다. 이 컨텐트는 API 래퍼 (wrapper)를 호출합니다.이 래퍼는 데이터 모델에 종료 후에 계속 요청을 따라야한다는 사실을 보냅니다. 어느 것이 좋습니다.

내 문제는 내 시스템을 종료 할 때 계속 요청이 필요하다는 것을 알고 있기 때문에 다음 내용의 내용과 링크를 파악합니다. 여기에서 iframe 소스를 업데이트하는 방법을 찾아야합니다 ....

public static String Terminate() { 
      //set entry to "" or resume, available to next learner session in current learner attempt 
      //if exit is set to suspend via nav request suspend all then entry set to resume upon next attempt on activity 
      //if exit anything other than suspend or no value set entry to "" 
      //when exit = suspend - save cmi.suspend_data to session 
      //decide whether to persist data 
      //save info to db using entities then call commit() 
      cocdType cmi; 
      try { 
       cmi = (cocdType)HttpContext.Current.Session["cmi"]; 
      } catch { 
       return "false"; 
      } 
      if (cmi.adlNavRequest != "_none_") { 
       SeqObject seqObj = new SeqObject(); 
       seqObj.currentRequestType = SeqObject.type.Navigation; 
       seqObj.data.Navigation = cmi.adlNavRequest; 
       seqObj = loungeScormSeqNavHandler.SequencingProcess(seqObj); 

       NEED TO FIRE OFF IFRAME CHANGE SOURCE FROM HERE 
      } 
      return "true"; 
     } 

이해가 되니 도움이 되셨습니까?

답변

0

나는 해결 방법을 생각해 냈다.

내 종료 함수는 iframe 및 원래 아약스 호출에 필요한 전체 링크를 반환합니다. 결과가 true 또는 false, 공백 또는 null 인 경우 해당 링크가 다음과 같아야합니다. 그곳에. 그런 다음 result를 true 또는 false로 설정하십시오.