Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: How to force users to fill in all fields during uploading files?  (Read 2808 times)

0 Members and 1 Guest are viewing this topic.

yacenty

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 73

Hi, is there any method to force user to fill in all fields when he is uploading picture?
I would like to have anything in title, description and keywords,
Is it hard to modify uploading process to check if there is something in this field?

There is one rule in my gallery that picture has to have all this filed filled in, now I have a lot of work to check if picture has this field when I'm accepting pictures.

I hope sb can help me :)

Kind regards,
YacentY
« Last Edit: August 21, 2006, 08:09:09 pm by Nibbler »
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: How to force users to fill in all fields during uploading files?
« Reply #1 on: August 20, 2006, 03:44:07 pm »

You need to put custom javascript:
Disable upload button and check the value of those fields with javascript and enable button when all fields have a value
Logged
‍I don't answer to PM with support question
Please post your issue to related board

yacenty

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 73
Re: How to force users to fill in all fields during uploading files?
« Reply #2 on: August 20, 2006, 03:55:23 pm »

I have no experince in JS, could You give some exapmle how to do it?
Kind regards,
YacentY
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: How to force users to fill in all fields during uploading files?
« Reply #3 on: August 20, 2006, 07:59:05 pm »

okey you need to change upload.php

- first of all you need to change this (under text_box_input function around line 112)
Code: [Select]
<input type="text" style="width: 100%" name="$name" maxlength="$max_length" value="$default" class="textinput" />
with this
Code: [Select]
<input type="text" style="width: 100%" name="$name" maxlength="$max_length" value="$default" class="textinput" onKeyUP="formcheck();" onfocus="formcheck();"/>

- Then you should change this (under text_area_input function around line 159 )
Code: [Select]
<textarea name="$name" rows="5" cols="40" class="textinput" style="width: 100%;" onKeyDown="textCounter(this, $max_length);" onKeyUp="textCounter(this, $max_length);">$default</textarea>
with this
Code: [Select]
<textarea name="$name" rows="5" cols="40" class="textinput" style="width: 100%;" onKeyDown="textCounter(this, $max_length);" onKeyUp="textCounter(this, $max_length);formcheck();" onfocus="formcheck();">$default</textarea>

- Then you should change this (under form_alb_list_box function around line 185)
Code: [Select]
<select name="$name" class="listbox">
with this
Code: [Select]
<select name="$name" class="listbox" onchange="formcheck();">

- and You need to replace the  open_form function with this new function
Code: [Select]
function open_form($path) {

    echo <<<EOT
    <script language="javascript" type="text/javascript">
    function textCounter(field, maxlimit) {
            if (field.value.length > maxlimit) // if too long...trim it!
            field.value = field.value.substring(0, maxlimit);
    }
function formcheck(){ // added for fill all fields mod by b.mossavari
for(i=0;i<3;i++){
d=document.forms[i];
if(x=d.caption){
if(d.title.value!='' && d.caption.value!='' && d.keywords.value!=''){
d.sub_button.disabled=false;
}else{
d.sub_button.disabled=true;
}
}
}
}

    </script>
    <form method="post" action="$path" enctype="multipart/form-data" onmouseover="formcheck();">
EOT;
}
and then replace (under close_form function around line 354 )
Code: [Select]
<input type="submit" value="{$button_value}" class="button" />
with this
Code: [Select]
<input type="submit" value="{$button_value}" class="button" id="sub_button" name="sub_button"/>

This will disable continue button on http upload form with default setting ;)
« Last Edit: August 20, 2006, 11:10:04 pm by bmossavari »
Logged
‍I don't answer to PM with support question
Please post your issue to related board

yacenty

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 73
Re: How to force users to fill in all fields during uploading files?
« Reply #4 on: August 20, 2006, 09:49:49 pm »

I did it but unfortunately wrong button is disabled :(
Continue button on page where only files are selected is blocked. even if i put all ten files button is blocked :(

I would like to block button on the page where picture and title, description and keywords are shown :)
is it possible to do it?

Kind regards
YacentY
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: How to force users to fill in all fields during uploading files?
« Reply #5 on: August 20, 2006, 11:11:51 pm »

Sorry I didn't check that with my test bed ::)
I update my last post and if you follow the steps you'll be fine ;)
Logged
‍I don't answer to PM with support question
Please post your issue to related board

yacenty

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 73
Re: How to force users to fill in all fields during uploading files?
« Reply #6 on: August 21, 2006, 06:40:07 pm »

now it works perfect:)
thank you very much :)
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.