Nuevo campo en Input Documents, dicho campo acepta las extensiones de los inputdocs permitidos. Se agregaron validaciones para que funcione correctamente
88 lines
3.2 KiB
XML
Executable File
88 lines
3.2 KiB
XML
Executable File
<?xml version="1.0" encoding="UTF-8"?>
|
|
<dynaForm type="xmlmenu">
|
|
<MNU_ADD type="link" value="" link="#" onclick="inputdocsAdd(); return false;" colAlign="left" colWidth="100">
|
|
<en><![CDATA[New]]></en>
|
|
</MNU_ADD>
|
|
<PAGED_TABLE_ID type="private"/>
|
|
<PAGED_TABLE_FAST_SEARCH type="FastSearch" label="@G::LoadTranslation(ID_SEARCH)"/>
|
|
<PRO_UID type="private"/>
|
|
<inputdocsEdit type="private" defaultValue="../inputdocs/inputdocs_Edit"/>
|
|
<inputdocsDelete type="private" defaultValue="../inputdocs/inputdocs_Delete"/>
|
|
<js type="javascript" replaceTags="1"><![CDATA[
|
|
var currentPagedTable = @#PAGED_TABLE_ID;
|
|
function inputdocsAdd(){//alert('@G::encryptlink(@#inputdocsEdit)?PRO_UID=@%PRO_UID');
|
|
popupWindow('@G::LoadTranslation(ID_NEW_INPUTDOCS)', '@G::encryptlink(@#inputdocsEdit)?PRO_UID=@%PRO_UID' , 500, 410);
|
|
}
|
|
function inputdocsEdit( uid ) {// alert('@G::encryptlink(@#inputdocsEdit)?INP_DOC_UID='+ uid);
|
|
popupWindow('@G::LoadTranslation(ID_EDIT_INPUTDOCS)', '@G::encryptlink(@#inputdocsEdit)?INP_DOC_UID='+ uid , 500, 410);
|
|
}
|
|
function validate_form(){
|
|
if(getField('INP_DOC_TITLE').value == ''){
|
|
alert('@G::LoadTranslation(ID_INPUT_DOC_TITLE_REQUIRED)');
|
|
getField('INP_DOC_TITLE').focus();
|
|
return false;
|
|
}
|
|
|
|
oTypeFile = getField('INP_DOC_TYPE_FILE');
|
|
if (oTypeFile.value == '' ){
|
|
alert('@G::LoadTranslation(ID_INPUT_DOC_TYPE_FILE_REQUIRED)');
|
|
oTypeFile.focus();
|
|
return false;
|
|
}
|
|
|
|
allowedTypes = getField('INP_DOC_TYPE_FILE').value.split(", ");
|
|
expreg = /^\*\.?[a-z]{2,8}$/;
|
|
|
|
for(i=0; i<allowedTypes.length; i++){
|
|
atype = allowedTypes[i];
|
|
|
|
if((atype=='*.*') || (expreg.test(atype)) ){
|
|
//
|
|
} else {
|
|
alert('@G::LoadTranslation(ID_UPLOAD_ERR_WRONG_ALLOWED_EXTENSION_FORMAT)');
|
|
oTypeFile.focus();
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function inputdocsSave( form ) {
|
|
var nameInput = getField('INP_DOC_TITLE').value;
|
|
var proUid = getField('PRO_UID').value;
|
|
if(getField('INP_DOC_UID').value==''){
|
|
if (validate_form()){
|
|
reqName=ajax_function(form.action,'lookForNameInput','NAMEINPUT='+encodeURIComponent(nameInput)+'&proUid='+encodeURIComponent(proUid),'POST') ;
|
|
if(reqName){
|
|
ajax_post( form.action, form, 'POST' );
|
|
currentPopupWindow.remove();
|
|
@#PAGED_TABLE_ID.refresh();
|
|
}else{
|
|
alert(G_STRINGS.ID_EXIST_INPUTDOCUMENT);return false;
|
|
}
|
|
}
|
|
}else{
|
|
if (validate_form()){
|
|
ajax_post( form.action, form, 'POST' );
|
|
currentPopupWindow.remove();
|
|
@#PAGED_TABLE_ID.refresh();
|
|
}
|
|
}
|
|
}
|
|
function inputdocsDelete( uid ) {
|
|
|
|
result = ajax_function('@G::encryptlink(@#inputdocsDelete)','getRelationInfDoc','INP_DOC_UID='+uid,'POST');
|
|
labelToshow = (result)?'@G::LoadTranslation(ID_MSG_CONFIRM_DELETE_IDOCUMENT)':'@G::LoadTranslation(ID_MSG_CONFIRM_DELETE_DOCUMENT)';
|
|
|
|
new leimnud.module.app.confirm().make({
|
|
label:labelToshow,
|
|
action:function()
|
|
{
|
|
ajax_function('@G::encryptlink(@#inputdocsDelete)','deleteInputDocument','INP_DOC_UID='+uid,'POST');
|
|
@#PAGED_TABLE_ID.refresh();
|
|
}.extend(this)
|
|
});
|
|
}
|
|
]]></js>
|
|
<SEARCH_FILTER_FORM type="private"/>
|
|
</dynaForm>
|