2012-03-06 75 views
0

我目前正在開發一個日曆系統,我希望一些事件/日期直接發送到Web日曆和ics文件。DHTMLXScheduler導出和導入到和來自ics不起作用

Dhtmlxscheduler正是我所需要的。將數據寫入mysql可以工作,它也在讀取數據,但不是ics和ics。

這裏是我到目前爲止的代碼:

<script src="../../codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script> 
<script src="../../codebase/ext/dhtmlxscheduler_serialize.js" type="text/javascript" charset="utf-8"></script> 
<script src="../../codebase/ext/dhtmlxscheduler_multisource.js" type="text/javascript" charset="utf-8"></script> 

<link rel="stylesheet" href="../../codebase/dhtmlxscheduler.css" type="text/css" title="no title" charset="utf-8"> 




<script type="text/javascript" charset="utf-8"> 
    function init() { 

     scheduler.config.xml_date="%Y-%m-%d %H:%i"; 
     scheduler.config.prevent_cache = true; 

     scheduler.config.lightbox.sections=[  
      {name:"description", height:130, map_to:"text", type:"textarea" , focus:true}, 
      {name:"location", height:43, type:"textarea", map_to:"details" }, 
      {name:"time", height:72, type:"time", map_to:"auto"} 
     ] 

     scheduler.config.first_hour=4; 
     scheduler.locale.labels.section_location="Location"; 
     //scheduler.config.details_on_create=true; 
     //scheduler.config.details_on_dblclick=true; 



     scheduler.init('scheduler',new Date(2009,10,1),"month"); 
     scheduler.setLoadMode("month"); 
     scheduler.load(["php/events.php","/ics/schedule.ics"]); 

     var dp = new dataProcessor("php/events.php"); 
     dp.init(scheduler); 



    } 


    function show(){ 
     alert(scheduler.toICal()); 
    } 

    function save(){ 
     var form = document.forms[0]; 
     form.elements.data.value = scheduler.toICal(); 
     form.submit(); 
    } 
    function get(){ 
     var form = document.forms[1]; 
     form.elements.data.value = scheduler.toICal(); 
     form.submit(); 
    } 

    </script> 

    </head> 

<body onload="init();"> 

    <form action="../04_export/php/ical_writer.php" method="post" target="hidden_frame" accept-charset="utf-8"> 
     <input type="hidden" name="data" value="" id="data"> 
    </form> 

這將是很好,如果你能幫助我。謝謝。對不起,這篇文章看起來有點奇怪。這是我的第一個代碼的帖子....

回答

0

上面的代碼在同一時間從兩個來源加載數據,這導致問題作爲一個來源是基於XML和其他數據。

scheduler.load(["php/events.php","/ics/schedule.ics"]); 

需要與獨立的數據加載代替

scheduler.load("php/events.php", "xml") 
scheduler.load("ics/schedule.ics", "ical")