Author Topic: Validate all the images in one click  (Read 7496 times)

0 Members and 1 Guest are viewing this topic.

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Validate all the images in one click
« on: April 20, 2005, 04:16:45 AM »
Hi, I have some categories where the users upload pictures and they have to wait for my validtion and sometimes I found like 500 pics waiting to be validate and I have to click 500 times to acept or delete. I there any way to put the checkboxes like in the edit images or check new images where you can check all in just one click.

Validate:                      Edit:
     

Any ideas?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Validate all the images in one click
« Reply #1 on: April 20, 2005, 04:30:39 AM »
Find in validateimage.php::
Code: [Select]
    echo "<td class=\"tableseparator\">".$lang['validate']."</td>\n<td class=\"tableseparator\">".$lang['delete']."</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";Replace with:
Code: [Select]
    echo "<script>
    var yes = false;
    var no = false;
    function CheckAllradio(num, checked) {
      for (var i=0;i<document.form.elements.length;i++) {
        var e = document.form.elements[i];
        if (e.type=='radio' && e.value == num) {
          e.checked = checked;
        }
      }
    }
    </script>";
    echo "<td class=\"tableseparator\" onClick=\"if(yes){yes=false;no=false}else{yes=true;no=false;}CheckAllradio(1, yes)\">".$lang['validate']."</td>\n<td class=\"tableseparator\" onClick=\"if(no){no=false;yes=false}else{no=true;yes=false;}CheckAllradio(0, no)\">".$lang['delete']."</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";

Now, if u click on "Validar" ("Validate") or "Borrar" ("Delete") words on top of the table, it will select all radio buttons.


Here is another little addon to it, it will remove selection if u double click on a radio button:
Find:
Code: [Select]
      echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"1\"></td>";
      echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"0\"></td>";
Replace with:
Code: [Select]
      echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"1\" onDblclick=\"this.checked=false;\"></td>";
      echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"0\" onDblclick=\"this.checked=false;\"></td>";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: Validate all the images in one click
« Reply #2 on: April 20, 2005, 04:53:00 AM »
HI V@no thanks a lot but I made the modification and I click on the words and nothing happen

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: Validate all the images in one click
« Reply #3 on: April 20, 2005, 04:58:20 AM »
The doble click addon is working but the slect all does not :s

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Validate all the images in one click
« Reply #4 on: April 20, 2005, 05:05:07 AM »
sorry, I forgot to mention, the JS code was made for IE browser.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: Validate all the images in one click
« Reply #5 on: April 20, 2005, 05:18:51 AM »
oooh ok :) thanks!

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: Validate all the images in one click
« Reply #6 on: April 20, 2005, 05:23:17 AM »
I have try on th IE and I don't see any difference :S sorry

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Validate all the images in one click
« Reply #7 on: April 20, 2005, 05:23:34 AM »
hmmm...strange some how two " } " brackets got replaced with " ) "
search for two instance of )else replace them both with }else
or use the updated code from my original post.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: Validate all the images in one click
« Reply #8 on: April 20, 2005, 05:28:29 AM »
ok :) now it is working thanks

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: Validate all the images in one click
« Reply #9 on: April 20, 2005, 05:30:36 AM »
sorry, I forgot to mention, the JS code was made for IE browser.
It does work perfectly with firefox