0

我目前正在开发一个日历系统,我希望将一些事件/日期直接发送到网络日历中的 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>

如果你能帮助我,那就太好了。谢谢。抱歉,帖子看起来有点奇怪。这是我第一篇有代码的帖子......

4

1 回答 1

0

上面的代码同时从 2 个源加载数据,这会导致问题,因为一个源是基于 xml 的,另一个是 ical 数据。

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

需要替换为单独的数据加载

scheduler.load("php/events.php", "xml")
scheduler.load("ics/schedule.ics", "ical")
于 2012-12-05T12:06:56.583 回答