LetoDMS Community Forum
Automatic file naming - Printable Version

+- LetoDMS Community Forum (https://community.letodms.com)
+-- Forum: LetoDMS Support (https://community.letodms.com/forumdisplay.php?fid=4)
+--- Forum: Feature Request (https://community.letodms.com/forumdisplay.php?fid=7)
+--- Thread: Automatic file naming (/showthread.php?tid=332)



Automatic file naming - netco - 06-16-2011

Hello,

is there anyway, that an uploaded document gets its filename automaticly when entering no specific name for it (and not uploading multiple files)?

Best regards,
netCo


RE: Automatic file naming - kotikov_a - 06-16-2011

(06-16-2011, 01:22 PM)netco Wrote: Hello,

is there anyway, that an uploaded document gets its filename automaticly when entering no specific name for it (and not uploading multiple files)?

Best regards,
netCo

I think it is very required feature. I ask for it, too
Quote:http://forums.letodms.com/showthread.php?tid=489
I always click add multiply file and add only one (because i rarely need to write any name of file).


RE: Automatic file naming - kotikov_a - 06-18-2011

(06-16-2011, 01:22 PM)netco Wrote: Hello,

is there anyway, that an uploaded document gets its filename automaticly when entering no specific name for it (and not uploading multiple files)?

Best regards,
netCo

I decide to do this feature by my own because it is much convenient )
You can simple use linked out.AddDocument.php from attachment.
The changes are:
Quote:<td><?php printMLText("name");?>:</td>
<td><input name="name" size="60">
<input type="checkbox" id="nameused" name="nameused" disabled="disabled" checked="checked" value="1">
<a href="javascript:disableName()"><?php printMLtext("selection") ?></a>
</td>
and
Quote:function disableName()
{
if(document.getElementsByName("userfile[]").length==1){
if(document.form1.nameused.checked==true){
document.form1.nameused.checked=true;
document.form1.name.disabled=true;
}else{
document.form1.nameused.checked=false;
document.form1.name.disabled=false;
}
}
}
Add one line in addFiles function
Quote:function addFiles()
{
document.getElementById("files").innerHTML += '<br><input type="File" name="userfile[]" size="60">';
document.form1.name.disabled=true;
document.form1.nameused.checked=false;
}
And change one line in the function checkform
Quote://if (document.form1.userfile[].value == "") msg += "<?php printMLText("js_no_file");?>\n";
if(!document.form1.name.disabled){
if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
}
The main concepts are
1) to add checkbox to see if name field is used or not, default checkbox value checked,
2) to add link that will disable use of name field.
It is better to use new text varaible for link but it will need to make changes in all language files.



RE: Automatic file naming - steinm - 07-20-2011

It will be part of the next release. If _strictFormCheck in the settings is set to false it will no longer ask for a name.

If you want to fix it in your local copy, just comment out the line

if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";

in out/out.AddDocument.php.

The code itself for uploading a document can handle missing names, but the form validation will not allow to submit the form. If the above line is taken out, it should work.

Uwe


RE: Automatic file naming - kotikov_a - 07-21-2011

(07-20-2011, 05:09 PM)steinm Wrote: It will be part of the next release. If _strictFormCheck in the settings is set to false it will no longer ask for a name.

If you want to fix it in your local copy, just comment out the line

if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";

in out/out.AddDocument.php.

The code itself for uploading a document can handle missing names, but the form validation will not allow to submit the form. If the above line is taken out, it should work.

Uwe

Sorry, i forget to copy one small part of code about this from function checkForm()
Quote:if(!document.form1.name.disabled){
if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
}