HEX
Server: nginx/1.22.1
System: Linux VM-16-9-centos 3.10.0-1160.99.1.el7.x86_64 #1 SMP Wed Sep 13 14:19:20 UTC 2023 x86_64
User: www (1001)
PHP: 7.3.31
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/oa.sanjiangapp.com/app/sys/action/js/createrecord.js
$(document).ready(function()
{
    $.setAjaxForm('#createRecordForm', function(response)
    {
        if(response.result == 'success')
        {
            if(response.locate == '' || response.locate == 'reload')
            {
                location.reload();
            }
            else if(response.locate == 'parent.reload')
            {
                parent.location.reload();
            }
            else
            {
                location = response.locate;
            }
        }
        else
        {
            if(response.error && response.error.length)
            {
                $('#duplicateError').html($('.errorMessage').html());
                $('#duplicateError .alert').prepend(response.error).show();

                $(document).on('click', '#duplicateError #continueSubmit', function()
                {
                    $('#duplicateError').append("<input value='1' name='continue' class='hide'>");
                    $('#createRecordForm #submit').click();
                })
            }
        }
    });

    if(v.history) $('#actionBox').load(createLink('action', 'history', 'objectType=' + v.objectType + '&objectID=' + v.objectID + '&action=record&from=record'), function()
    {
        if($('#actionBox .histories .panel-body').height() > 300)
        {
          $('#actionBox .histories .panel-body').css({'height' : 300, 'overflow' : 'auto'});
        }
    });

    $('[name*=objectType]').change(function()
    {
        $('#order, #contract').attr('disabled', true).parents('tr').hide();
        if($(this).prop('checked'))
        {
            $('[name*=objectType]').not(this).attr('checked', false);
            $('#' + $(this).val()).attr('disabled', false).parents('tr').show();
        }
    });
    $('#ajaxModal .sorter').click();

    $('[name*=createContact]').change(function()
    {
        if($(this).prop('checked'))
        {
            $(this).parents('.input-group').find('select').hide();
            $('#contact_chosen').hide();
            $(this).parents('.input-group').find('input[id=realname]').show().focus();
        }
        else
        {
            $('#contact_chosen').show();
            $(this).parents('.input-group').find('input[id=realname]').hide();
        }
    });

    /* Change contact. */
    $('#contact').change(function()
    {
        var phone = $.trim($(this).find('option:selected').attr('data-phone'));
        var qq    = $.trim($(this).find('option:selected').attr('data-qq'));
        var email = $.trim($(this).find('option:selected').attr('data-email'));

        phone = phone == '' ? '' : "<i class='icon-phone'></i>" + phone;
        qq    = qq    == '' ? '' : "<i class='icon-qq'></i><a target='_blank' href='http://wpa.qq.com/msgrd?v=3&uin=" + qq + "&site=&menu=yes'>" + qq + "</a>";
        email = email == '' ? '' : "<i class='icon-mail'></i><a href='mailto:" + email + "'>" + email + "</a>";

        if(phone || qq || email)
        {
            $('#phoneTR').show();
            $('#phoneTD').html(phone + qq + email);
        }
    });

    $('#nextDate').change(function()
    {
        $('[name*=delta]').removeAttr('checked');
    });

    $('#fileform > .text-danger').remove();
});

/**
 * Compute the next contact date for action.
 *
 * @param  int    $delta
 * @access public
 * @return void
 */
function computeNextDate(delta)
{
    today = new Date();
    today = today.toString('yyyy-MM-dd');
    if(!today) return;

    nextDate = convertStringToDate(today).addDays(parseInt(delta));
    nextDate = nextDate.toString('yyyy-MM-dd');

    if(delta == 365000)
    {
        $('#createRecordForm #nextDate').val('').attr('disabled', true);
    }
    else
    {
        $('#createRecordForm #nextDate').val(nextDate).attr('disabled', false);
    }
}

/**
 * Convert a date string like 2011-11-11 to date object in js.
 *
 * @param  string $date
 * @access public
 * @return date
 */
function convertStringToDate(dateString)
{
    dateString = dateString.split('-');
    return new Date(dateString[0], dateString[1] - 1, dateString[2]);
}