我已经尝试制作一个 webbapp,它可以使用 googlescript 在我的 googlecalendar 中输入,但它不起作用,它从文本框中获取开始日期和结束日期并将其发送到 googlecalendar,有人可以告诉我我的错误在哪里?
function doGet() {
var app=UiApp.createApplication().setTitle('test app');
var pan1=app.createHorizontalPanel();
app.add(pan1);
var txt1=app.createTextBox().setId('txt1').setName('txt1');
var btn1=app.createButton().setText('Start').setId('btn1');
btn1.addClickHandler(app.createServerHandler("start"));
var pan2=app.createHorizontalPanel();
app.add(pan2);
var txt2=app.createTextBox().setId('txt2').setName('txt2');
var btn2=app.createButton().setText('End').setId('btn2');
btn2.addClickHandler(app.createServerHandler("ende"));
pan1.add(txt1);
pan1.add(btn1);
pan2.add(txt2);
pan2.add(btn2);
var pan3=app.createHorizontalPanel();
var btn3=app.createButton().setText('Eintragen').setId('btn3');
btn3.addClickHandler(app.createServerHandler("stunde_eintragen"));
pan3.add(btn3);
app.add(pan3);
return app;
}
function start() {
var app =UiApp.getActiveApplication();
app.getElementById("txt1").setText(new Date());
return app;
}
function ende() {
var app =UiApp.getActiveApplication();
app.getElementById("txt2").setText(new Date());
return app;
}
function stunde_eintragen (e){
var app=UiApp.getActiveApplication();
var cal=CalendarApp.getDefaultCalendar();
var txt11= e.parameter.txt1;
var txt22= e.parameter.txt2;
cal.createEvent("Arbeit", new Date('txt11.toString()'), new Date('txt22.toString()'), {location:'Nap room'});
return app;
}