Location: PHPKode > projects > phlyMail Lite > phlymail/frontend/templates/calendar.task.edit.tpl
<script type="text/javascript" src="{frontend_path}/js/datetimecontrols.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
RemindersCount = 1;
reminders = [];<!-- START multi_reminders -->
reminders.push({'time' : '{time}', 'range' : '{range}', 'mode' : '{mode}', 'mail' : '{mail}', 'sms' : '{sms}', 'text' : '{text}'});<!-- END multi_reminders -->
EditMode = '{editmode}';

function adjust_height()
{
    var wh = $(window).height();
    var dh = $(document).height();
    var ww = $(window).width();
    var dw = $(document).width();
    window.resizeBy(ww < dw ? dw-ww : 0, wh < dh ? dh-wh : 0);
}

function delete_task()
{
    if (confirm('{msg_reallydelete}') == true) {
        $.ajax({url:'{delete_link}', success: save_done, dataType: 'json'});
    }
}

function disable_warn(active)
{
    $('#warndisable').css('display', (active) ? 'block' : 'none');
}

function disable_start()
{
    if ($(this).attr('checked')) {
        $('.task_start').removeAttr('disabled').css('visibility', 'visible');
    } else {
        $('.task_start').attr('disabled', 'disabled').css('visibility', 'hidden');
    }
}

function disable_end()
{
    if ($(this).attr('checked')) {
        $('.task_end').removeAttr('disabled').css('visibility', 'visible');
    } else {
        $('.task_end').attr('disabled', 'disabled').css('visibility', 'hidden');
    }
}

function transfer_date(f)
{
    if (EditMode != 'add') return true;
    $('#end_' + f).val($('#start_' + f).val());
}

function transfer_year()
{
    if (EditMode != 'add') return true;
    transfer_date('y');
}

function check_dates()
{
    var error, s_d, s_m, s_y, s_h, s_i, e_d, e_m, e_y, e_h, e_i, r_d, r_m, r_y, r_h, r_i;
    error = false;
    s_d = document.getElementsByName('start_d')[0].value;
    s_m = document.getElementsByName('start_m')[0].value;
    s_y = document.getElementById('start_y').value;
    s_h = document.getElementsByName('start_h')[0].value;
    s_i = document.getElementsByName('start_mi')[0].value;
    e_d = document.getElementsByName('end_d')[0].value;
    e_m = document.getElementsByName('end_m')[0].value;
    e_y = document.getElementById('end_y').value;
    e_h = document.getElementsByName('end_h')[0].value;
    e_i = document.getElementsByName('end_mi')[0].value;
    if (s_m == 2) {
        if (s_d > 29) {
            s_d = 29;
            document.getElementsByName('start_d')[0].value = s_d;
            error = true;
        }
        if (s_d > 28) {
            schalt = (s_y%400 == 0) ? (1) : ((s_y%100 == 0) ? (0) : ((s_y%4 == 0) ? (1) : (0)));
            if (!schalt) {
                s_d = 28;
                document.getElementsByName('start_d')[0].value = s_d;
                error = true;
            }
        }
    } else if (s_m == 4 || s_m == 6 || s_m == 9 || s_m == 11) {
        if (s_d == 31) {
            s_d = 30;
            document.getElementsByName('start_d')[0].value = s_d;
            error = true;
        }
    }
    if (e_m == 2) {
        if (e_d > 29) {
            e_d = 29;
            document.getElementsByName('end_d')[0].value = e_d;
            error = true;
        }
        if (e_d > 28) {
            schalt = (e_y%400 == 0) ? (1) : ((e_y%100 == 0) ? (0) : ((e_y%4 == 0) ? (1) : (0)));
            if (!schalt) {
                e_d = 28;
                document.getElementsByName('end_d')[0].value = e_d;
                error = true;
            }
        }
    } else if (e_m == 4 || e_m == 6 || e_m == 9 || e_m == 11) {
        if (e_d == 31) {
            e_d = 30;
            document.getElementsByName('end_d')[0].value = e_d;
            error = true;
        }
    }
    // End >= Beginning
    var nowd   = new Date();
    var startd = new Date(s_y, (s_m-1), s_d, s_h, s_i, 0);
    var endd   = new Date(e_y, (e_m-1), e_d, e_h, e_i, 0);
    if (startd.getTime() > endd.getTime()
            && $('#has_start:checked').length
            && $('#has_end:checked').length) {
        alert('{msg_endlaterbegin}');
        return false;
    }
    if (error) {
        alert('{msg_invalidcorrected}');
        return false;
    }
    return true;
}

function save_task()
{
    if (!check_dates()) return false;
    $.ajax({url:'{form_target}', data: $(document.forms[0]).serialize(), type: 'POST', success: save_done, dataType: 'json'});
    return false;
}

function save_done(next)
{
    if (next['error']) {
        status_window();
        if (!confirm(next['error'])) done();
    }
    if (next['done']) {
        done();
    }
}

function done()
{
    if (opener.parent.parent.frames && opener.parent.parent.frames.PHM_tr) {
        try {
            opener.parent.parent.frames.PHM_tr.refreshlist();
        } catch (e) {
            opener.parent.parent.frames.PHM_tr.location.reload();
        }
    } else if (opener.frames && opener.frames.PHM_tr) {
        try {
            opener.frames.PHM_tr.refreshlist();
        } catch (e) {
            opener.frames.PHM_tr.location.reload();
        }
    } else {
        try { opener.refreshlist(); } catch (e) { opener.location.reload(); }
    }
    self.close();
}

function select_date(arg)
{
    date_to_select = arg;
    datecontrols.onselect = 'date_selected';
    var s_d = document.getElementById(arg + '_d').value;
    var s_m = document.getElementById(arg + '_m').value;
    var s_y = document.getElementById(arg + '_y').value;
    var sel = datecontrols.draw_selector('cal_', s_y, s_m, s_d);
    document.getElementById('dateselectorcont_' + arg).appendChild(sel);
    datecontrols.shadow();
}

function date_selected(jahr, monat, tag)
{
    var arg = date_to_select;
    $('#' + arg + '_y').val(jahr);
    $('#' + arg + '_m').val(monat);
    $('#' + arg + '_d').val(tag);
    if (arg == 'start') {
        transfer_date('d');
        transfer_date('m');
        transfer_year();
    }
}

function select_time(arg)
{
    time_to_select = arg;
    timecontrols.onselect = 'time_selected';
    var sel = timecontrols.draw_selector('cal_');
    document.getElementById('timeselectorcont_' + arg).appendChild(sel);
    timecontrols.shadow();
}

function time_selected(stund, minut)
{
    var arg = time_to_select;
    $('#' + arg + '_h').val(stund);
    $('#' + arg + '_mi').val(minut);
    if (arg == 'start') {
        transfer_date('h');
        transfer_date('mi');
    }
}

function draw_all_reminders()
{
    var pointer, i, j, worker;
    pointer = document.getElementById('reminders_template').parentNode;
    for (j = 1; j < reminders.length; ++j) {
        i = RemindersCount;
        worker = document.getElementById('reminders_template').cloneNode(true);
        worker.id = 'reminder_' + i;
        worker.insertBefore(document.createElement('hr'), worker.firstChild);
        $(worker).find('#reminders_mail_0_txt').attr('id', 'reminders_mail_' + i + '_txt').val(reminders[j].mail);
        $(worker).find('#reminders_mail_0_btn').attr('id', 'reminders_mail_' + i + '_btn').click(function() {
                combo_active('reminders_mail_'+i+'_txt','reminders_mail_'+i+'_sel','reminders_mail_'+i+'_btn')
                });
        $(worker).find('#reminders_mail_0_sel').attr('id', 'reminders_mail_' + i + '_sel');
        $(worker).find('#reminders_time_0').attr('id', 'reminders_time_' + i).val(reminders[j].time);
        $(worker).find('#reminders_mode_0').attr('id', 'reminders_mode_' + i).val(reminders[j].mode);
        $(worker).find('#reminders_range_0').attr('id', 'reminders_range_' + i).val(reminders[j].range);
        $(worker).find('#reminders_text_0').attr('id', 'reminders_text_' + i).val(reminders[j].text);
        $(worker).find('#reminders_delete_0').attr('id', 'reminders_delete_' + i).css('display', 'block').click(function() {$('#reminder_'+i).remove();});
        try { // SMS might be disabled
            $(worker).find('#reminders_sms_0_btn');
            $(worker).find('#reminders_sms_0_txt').attr('id', 'reminders_sms_' + i + '_txt').val(reminders[j].sms);
            $(worker).find('#reminders_sms_0_btn').attr('id', 'reminders_sms_' + i + '_btn').click(function() {
                    combo_active('reminders_sms_'+i+'_txt','reminders_sms_'+i+'_sel','reminders_sms_'+i+'_btn')
                    });
            $(worker).find('#reminders_sms_0_sel').attr('id', 'reminders_sms_' + i + '_sel');
        } catch (e) {}
        pointer.appendChild(worker);
        RemindersCount++;
    }
}

function add_new_reminder(data)
{
    var pointer, i, worker;
    i = RemindersCount;
    pointer = document.getElementById('reminders_template').parentNode;
    worker = document.getElementById('reminders_template').cloneNode(true);
    worker.id = 'reminder_' + i;
    worker.insertBefore(document.createElement('hr'), worker.firstChild);
    $(worker).find('#reminders_mail_0_txt').attr('id', 'reminders_mail_' + i + '_txt');
    $(worker).find('#reminders_mail_0_btn').attr('id', 'reminders_mail_' + i + '_btn').click(function() { combo_active('reminders_mail_'+i+'_txt','reminders_mail_'+i+'_sel','reminders_mail_'+i+'_btn')});
    $(worker).find('#reminders_mail_0_sel').attr('id', 'reminders_mail_' + i + '_sel');
    $(worker).find('#reminders_time_0').attr('id', 'reminders_time_' + i);
    $(worker).find('#reminders_mode_0').attr('id', 'reminders_mode_' + i);
    $(worker).find('#reminders_range_0').attr('id', 'reminders_range_' + i);
    $(worker).find('#reminders_text_0').attr('id', 'reminders_text_' + i);
    $(worker).find('#reminders_delete_0').attr('id', 'reminders_delete_' + i).css('display', 'block').click(function() {$('#reminder_'+i).remove();});
    try { // SMS might be disabled
        $(worker).find('#reminders_sms_0_txt').attr('id', 'reminders_sms_' + i + '_txt');
        $(worker).find('#reminders_sms_0_btn').attr('id', 'reminders_sms_' + i + '_btn').click(function() { combo_active('reminders_sms_'+i+'_txt','reminders_sms_'+i+'_sel','reminders_sms_'+i+'_btn')});
        $(worker).find('#reminders_sms_0_sel').attr('id', 'reminders_sms_' + i + '_sel');
    } catch (e) {}
    pointer.appendChild(worker);
    RemindersCount++;
}

function status_window(message)
{
    if (message) {
        $('#sendstatus').show();
        $('#sendstat_msg').text(message);
    } else {
        $('#sendstatus').hide();
    }
}

$(document).ready(function (e) {
    disable_warn($('#warn').attr('checked'));
    combo_disable('reminders_mail_0_sel', 'reminders_mail_0_btn');
    try { combo_disable('reminders_sms_0_sel', 'reminders_sms_0_btn'); } catch (e) {}
    adjust_height();
    window.title = '{head_edit}';
    datecontrols.longmonth = ['{title_jan}', '{title_feb}', '{title_mar}', '{title_apr}', '{title_may}', '{title_jun}', '{title_jul}', '{title_aug}', '{title_sep}', '{title_oct}', '{title_nov}', '{title_dec}'];
    datecontrols.longwday = ['{title_sunday}', '{title_monday}', '{title_tuesday}', '{title_wednesday}', '{title_thursday}', '{title_friday}', '{title_saturday}'];
    datecontrols.firstday = {week_firstday};
    timecontrols.msg = ['{msg_hours}', '{msg_minutes}'];
    $('#tabpane').tabs().tabs('select', 0);
    $('#has_start').bind('keyup change', disable_start).change();
    $('#has_end').bind('keyup change', disable_end).change();
    $('#completionslider').slider(
            {"min": 0
            ,"max": 100
            ,"stepping": 1
            ,"value": $('#inp_completion').val()
            ,"slide": function (e, ui) { $('#inp_completion').val(ui.value); }
            });
    $('#inp_completion').bind('keyup change', function () { $('#completionslider').slider("value", $(this).val()) });
    draw_all_reminders();
});
/*]]>*/
</script>
<div style="width:455px;">
<form id="masterform" action="#" method="post" onsubmit="return save_task();">
    <div id="tabpane" class="ui-tabpane" style="height:16px;margin-top:4px;">
        <ul>
            <li><a href="#generic"><span>{msg_general}</span></a></li>
            <li><a href="#reminders"><span>{msg_reminder}</span></a></li><!-- START vielspaeter -->
            <li><a href="#attachments"><span>{msg_attachments}</span></a></li><!-- END vielspaeter -->
        </ul>
    </div>
    <div class="sendmenubut topopen" style="height:440px;overflow:auto;">

        <div id="generic">
            <table border="0" cellpadding="2" cellspacing="0" width="100%">
                <tr>
                    <td class="l">{msg_title}</td>
                    <td class="l"><input type="text" name="title" value="{title}" size="36" maxlength="255" style="width:310px;" /></td>
                </tr>
                <tr>
                    <td class="l">{msg_loc}</td>
                    <td class="l"><input type="text" name="location" value="{location}" size="36" maxlength="255" style="width:310px;" /></td>
                </tr>
                <tr>
                    <td class="l">{msg_type} / {msg_group}</td>
                    <td class="l">
                        <select size="1" name="type"><!-- START typeline -->
                            <option value="{id}"<!-- START sel --> selected="selected"<!-- END sel -->>{name}</option><!-- END typeline -->
                        </select>
                        /
                        <select size="1" name="gid">
                            <option value="">&lt; {msg_none} &gt;</option><!-- START groupline -->
                            <option value="{id}"<!-- START selected --> selected="selected"<!-- END selected -->>{name}</option><!-- END groupline -->
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="l">{msg_status} / {msg_prio}</td>
                    <td class="l">
                        <select size="1" name="status"><!-- START statusline -->
                            <option value="{id}"<!-- START sel --> selected="selected"<!-- END sel -->>{name}</option><!-- END statusline -->
                        </select>
                        /
                        <select size="1" name="importance"><!-- START prioline -->
                            <option value="{id}"<!-- START sel --> selected="selected"<!-- END sel -->>{name}</option><!-- END prioline -->
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="l">{msg_completion}</td>
                    <td class="l">
                        <div id="completionslider" class="ui-slider" style="float:left;margin:0;"></div>
                        &nbsp;
                        <input type="text" size="3" maxlength="3" class="r" id="inp_completion" name="completion" value="{completion}" /> %
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td class="l" rowspan="3">
                        <table border="0" cellspacing="0" cellpadding="2">
                            <tr>
                                <td class="l"></td>
                                <td class="l">{msg_day}</td>
                                <td class="l">{msg_month}</td>
                                <td class="l">{msg_year}</td>
                                <td class="l"></td>
                                <td class="l">{msg_hour}</td>
                                <td class="l">{msg_minute}</td>
                                <td class="l"></td>
                            </tr>
                            <tr>
                                <td class="l">
                                    <input type="checkbox" id="has_start" name="has_start" value="1"<!-- START has_start --> checked="checked"<!-- END has_start --> />
                                </td>
                                <td class="l">
                                    <select class="task_start" onchange="transfer_date('d');" size="1" name="start_d" id="start_d"><!-- START start_d -->
                                        <option value="{d}"<!-- START sel --> selected="selected"<!-- END sel -->>{dd}</option><!-- END start_d -->
                                    </select>
                                </td>
                                <td class="l">
                                    <select class="task_start" onchange="transfer_date('m');" size="1" name="start_m" id="start_m"><!-- START start_m -->
                                        <option value="{m}"<!-- START sel --> selected="selected"<!-- END sel -->>{mm}</option><!-- END start_m -->
                                    </select>
                                </td>
                                <td class="l">
                                    <input class="task_start" type="text" onkeyup="transfer_year()" id="start_y" name="start_y" value="{start_y}" size="4" maxlength="4" />
                                </td>
                                <td class="l">
                                    <div class="task_start" id="dateselectorcont_start" style="position:relative;">
                                        <img src="{theme_path}/icons/select_date.gif" alt="" title="{msg_select}" onclick="select_date('start')" />
                                    </div>
                                </td>
                                <td class="l">
                                    <select class="task_start" onchange="transfer_date('h');" size="1" name="start_h" id="start_h"><!-- START start_h -->
                                        <option value="{h}"<!-- START sel --> selected="selected"<!-- END sel -->>{hh}</option><!-- END start_h -->
                                    </select>
                                </td>
                                <td class="l">
                                    <select class="task_start" onchange="transfer_date('mi');" size="1" name="start_mi" id="start_mi"><!-- START start_mi -->
                                        <option value="{mi}"<!-- START sel --> selected="selected"<!-- END sel -->>{mmi}</option><!-- END start_mi -->
                                    </select>
                                </td>
                                <td class="l">
                                    <div class="task_start" id="timeselectorcont_start" style="position:relative;">
                                        <img src="{theme_path}/icons/select_time.gif" alt="" title="{msg_select}" onclick="select_time('start')" />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="l">
                                    <input type="checkbox" id="has_end" name="has_end" value="1"<!-- START has_end --> checked="checked"<!-- END has_end --> />
                                </td>
                                <td class="l">
                                    <select class="task_end" size="1" name="end_d" id="end_d"><!-- START end_d -->
                                        <option value="{d}"<!-- START sel --> selected="selected"<!-- END sel -->>{dd}</option><!-- END end_d -->
                                    </select>
                                </td>
                                <td class="l">
                                    <select class="task_end" size="1" name="end_m" id="end_m"><!-- START end_m -->
                                        <option value="{m}"<!-- START sel --> selected="selected"<!-- END sel -->>{mm}</option><!-- END end_m -->
                                    </select>
                                </td>
                                <td class="l">
                                    <input class="task_end" type="text" id="end_y" name="end_y" value="{end_y}" size="4" maxlength="4" />
                                </td>
                                <td class="l">
                                    <div class="task_end" id="dateselectorcont_end" style="position:relative;">
                                        <img src="{theme_path}/icons/select_date.gif" alt="" title="{msg_select}" onclick="select_date('end')" />
                                    </div>
                                </td>
                                <td class="l">
                                    <select class="task_end" size="1" name="end_h" id="end_h"><!-- START end_h -->
                                        <option value="{h}"<!-- START sel --> selected="selected"<!-- END sel -->>{hh}</option><!-- END end_h -->
                                    </select>
                                </td>
                                <td class="l">
                                    <select class="task_end" size="1" name="end_mi" id="end_mi"><!-- START end_mi -->
                                        <option value="{mi}"<!-- START sel --> selected="selected"<!-- END sel -->>{mmi}</option><!-- END end_mi -->
                                    </select>
                                </td>
                                <td class="l">
                                    <div class="task_end" id="timeselectorcont_end" style="position:relative;">
                                        <img src="{theme_path}/icons/select_time.gif" alt="" title="{msg_select}" onclick="select_time('end')" />
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="l t">{msg_start}</td>
                </tr>
                <tr>
                    <td class="l t">{msg_end}</td>
                </tr>
                <tr>
                    <td class="l t">{msg_desc}</td>
                    <td class="l">
                        <textarea cols="36" rows="10" name="description" style="width:310px;">{description}</textarea>
                   </td>
                </tr>
            </table>
        </div>

        <div id="reminders" class="l t">
            <input type="checkbox" id="warn" name="warn" onchange="disable_warn((this.checked)?true:false)" onclick="disable_warn((this.checked)?true:false)" value="1"<!-- START warn --> checked="checked"<!-- END warn --> />
            <label for="warn">{head_warn}</label><br />
            <div id="warndisable">
                <div id="reminders_template" style="position:relative;">
                    <button type="button" id="reminders_delete_0" style="display:none;position:absolute;top:10px;right:8px;">{msg_dele}</button>
                    <input type="text" name="reminders[time][]" id="reminders_time_0" value="{warn_time}" size="6" maxlength="6" class="r" />
                    <select size="1" name="reminders[range][]" id="reminders_range_0">
                        <option value="m"<!-- START s_w_m --> selected="selected"<!-- END s_w_m -->>{msg_minutes}</option>
                        <option value="h"<!-- START s_w_h --> selected="selected"<!-- END s_w_h -->>{msg_hours}</option>
                        <option value="d"<!-- START s_w_d --> selected="selected"<!-- END s_w_d -->>{msg_days}</option>
                        <option value="w"<!-- START s_w_w --> selected="selected"<!-- END s_w_w -->>{msg_weeks}</option>
                    </select>
                    <select size="1" name="reminders[mode][]" id="reminders_mode_0">
                        <option value="s"<!-- START s_w_s --> selected="selected"<!-- END s_w_s -->>{msg_warnbeforestart}</option>
                        <option value="e"<!-- START s_w_e --> selected="selected"<!-- END s_w_e -->>{msg_warnbeforeend}</option>
                    </select><br />
                    {msg_additionalalerts}:<br />
                    <table border="0" cellpadding="2" cellspacing="0">
                        <tr>
                            <td class="l">{msg_title}</td>
                            <td class="l">
                                <input type="text" name="reminders[text][]" id="reminders_text_0" value="{warn_text}" size="32" maxlength="255" />
                            </td>
                        </tr>
                        <tr>
                            <td class="l">{msg_mailto}</td>
                            <td class="l">
                                <input type="text" name="reminders[mail][]" id="reminders_mail_0_txt" value="{warn_mail}" size="32" maxlength="255" />
                                <img src="{theme_path}/icons/combobox_activator.gif" id="reminders_mail_0_btn" alt="" style="vertical-align:bottom;cursor:pointer;" onclick="combo_active('reminders_mail_0_txt','reminders_mail_0_sel','reminders_mail_0_btn');" />
                                <select size="1" id="reminders_mail_0_sel" style="display:none;"><!-- START warnmail_profiles -->
                                    <option>{email}</option><!-- END warnmail_profiles -->
                                </select>
                            </td>
                        </tr><!-- START external_alerting -->
                        <tr>
                            <td class="l">{msg_smsto}</td>
                            <td class="l">
                                <input type="text" name="reminders[sms][]" id="reminders_sms_0_txt" value="{warn_sms}" size="32" maxlength="255" />
                                <img src="{theme_path}/icons/combobox_activator.gif" id="reminders_sms_0_btn" alt="" style="vertical-align:bottom;cursor:pointer;" onclick="combo_active('reminders_sms_0_txt','reminders_sms_0_sel','reminders_sms_0_btn');" />
                                <select size="1" id="reminders_sms_0_sel" style="display:none;"><!-- START warnsms_profiles -->
                                    <option>{sms}</option><!-- END warnsms_profiles -->
                                </select>
                            </td>
                        </tr><!-- END external_alerting -->
                    </table>
                    <br />
                </div>
                <button type="button" onclick="add_new_reminder();">&nbsp;+&nbsp;</button>
            </div>
        </div>

        <div id="attachments" class="l t" style="display:none;">

        </div>

    </div>
    <div style="margin:2px 4px 4px 4px;;height:24p;"><!-- START delete_button -->
        <div style="float:right;margin-top:3px;">
            <button type="button" onclick="delete_task()" class="error">{msg_dele}</button>
        </div><!-- END delete_button -->
        <div style="float:left;"><!-- START save_button -->
            <input type="submit" value="{msg_save}" />&nbsp;<!-- END save_button --><!-- START saveascopy -->
            <input type="checkbox" name="copytask" value="1" id="copytask" />
            <label for="copytask">{msg_copytask}</label>&nbsp;<!-- END saveascopy -->
            <img id="busy" src="{theme_path}/images/busy.gif" style="visibility:hidden" alt="" title="Please wait" />
        </div>
    </div>
</form>
</div>
Return current item: phlyMail Lite