global.js

来自「一个很好的开源项目管理系统源代码」· JavaScript 代码 · 共 93 行

JS
93
字号
/* 
* Javascript for application
* author: Antony Joseph
*/
function confirmSubmit(form, dispatch)
{
var agree=confirm("Do you want to continue?");
   if (agree) {
       form.dispatch.value=dispatch;
       form.submit();
   }
}
function resetForm(form)
{
   form.dispatch.value="reset";
   form.submit();
}

/*
 * Sets the index value in  'collectionIdx' field, sets dispatch to 'ignoreRow'
 * and submits the form
 * form    : the form
 * index   : Index into the collection
 */
function ignoreRow(form) {
   form.dispatch.value= "ignoreRow";
   form.submit();
}

function editRow(form) {
    form.dispatch.value= "editRow";
    form.submit();
}

/*
 * Sets the index value in  'collectionIdx' field, sets dispatch to 'startFlowSetValue'
 * sets the targetPropertyName
 * form                  : the form
 * index                 : Index into the collection
 * targetPropertyNameForValue : the target property name of the collection 
 * subFlow               : the sub flow url.
 */
function startFlowSetValue(form, index, targetPropertyNameForValue, subFlow) {
   form.collectionIdx.value=index;
   form.targetPropertyNameForValue.value= targetPropertyNameForValue;
   form.dispatch.value= "startFlowSetValue";
   form.subFlow.value = subFlow;
}


function makeFieldsEditable(form, collectionName, index, fields) {
    for(i=0;i<fields.length;i++){
       propertyName = collectionName + "[" + index + "]." + fields[i];
       form[propertyName].readOnly = false;
       form[propertyName].disabled = false;
       form[propertyName].className = "";
    }
}

// help window
function OpenWin(
    url,
    windowName,
    width,
    height,
    toolbar,
    scrollbars,
    statusbar) {
    var windowName = (windowName ? windowName : "Popup");
    // Following parameters built to be enabled by default: 
    var toolbar = (toolbar != false ? "yes" : "no");
    var scrollbars = (scrollbars != false ? "yes" : "no");
    var statusbar = (statusbar != false ? "yes" : "no");
    if (url) {
        var parameters =
            "toolbar="
                + toolbar
                + ",location=no,directories=no,statusbar="
                + statusbar
                + ",menubar=no,scrollbars="
                + scrollbars
                + ",resizable=yes,width="
                + width
                + ",height="
                + height;
        window.openWinRef = window.open(url, windowName, parameters);
    }
    else {
        status = "Error: Unable to open pop-up window " + url;
    }
    return false;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?