2012-03-06 73 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")