I have a new mod that I would like to enter into the Mod of the Month Contest. It totally changes the way IndexU validates links. In reality, it makes it easier and quicker to validate a large number of links.
I have set this mod up at my demo website. I have added 16 links to the demo, feel free to test it out for yourself. The demo is reset every hour and is limited to functions related to my mods. The links are:
User Area: http://www.scriptdragon.com/demo/
Admin Area http://www.scriptdragon.com/demo/admin/
Admin area login:
U:admin
P:admin
Details
Right now when you validate links, you need to:
- Click the checkbox next to each item you want to "Approve".
- Click on the "Approve" button.
- Click the checkbox next to each item you want to "Reject with Notice".
- Click on the "Reject with Notice" button.
- Click the checkbox next to each item you want to "Reject Silently".
- Click on the "Reject Silently" button.
If you had 40 links to validate, you would need to validate 3 pages of links. If they were all approved, you would have to submit the page 3 times to validate them all. If you wanted to approve some, reject some with notice, and reject silently a few others, you could maybe have to submit the form 10 or more times. This is not efficient.
With this mod, when you validate links, you need to:
- Click the radio box to either "Approve", "Reject with Notice", or "Reject Silently" each link.
- Click on the "Submit" button.
If you had 40 links to validate, you could show all 40 on one page and validate them all in 1-click. Now, that is efficient.
Now for the fun part, installing the mod.... Here we go.
Step 1 - Make a backup of the following files:
- IndexU\indexu_5_4_0\upload\admin\link_validate.php
- IndexU\indexu_5_4_0\upload\admin_tpl\link_validate .html
- IndexU\indexu_5_4_0\upload\admin_tpl\link_validate _rows.html
- IndexU\indexu_5_4_0\upload\lib\link.class.php
Note: Please do not skip making a backup of your files. If you need to uninstall the mod or have a conflict with another mod, these backup files will be needed.
Step 2 - IndexU\indexu_5_4_0\upload\admin\link_validate.php :
This file had major changes to it, therefore editing may not be appropriate for you. For this reason, I have added this file as an attachment to this thread. This file should replace your exising link_validate.php file. Please Note: If you have made any prior modifications to your link_validate.php, you should add those modifications to this file. If you have downloaded this file, you can skip this step. If not, here is what you need to do.
Open up the file admin\link_validate.php and select everything (ctrl+a), now hit the delete key. Once you have a blank file to work with, insert this code into the file:
Now save this file, we are done with it.Code:<?php /** * * INDEXU * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved. * * INDEXU(tm) is protected by Indonesia and International copyright laws. * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited, * violators will be prosecuted. To obtain a license for using INDEXU(tm), * please register at Nicecoder home page at http://www.nicecoder.com * * Author: * Dody Rachmat Wicaksono (dody@nicecoder.com) * M. Zuber (zubby@nicecoder.com) * */ /*=================================================== ViewLink() ===================================================*/ function ViewLink() { // vars global configuration global $dbConn, $category_separator, $admin_template_path; // vars url & form global $cat, $pg_which, $spam; // vars messages global $msg; // vars template global $link, $pagination, $chk_box, $num_rows, $param, $vid, $nvl_results, $adds, $adds_link, $approved, $denied, $denied_silent; $results_number = 15; if ((!$nvl_results) || ($nvl_results == "1")) { $nvl_results = 1; $number_results = $nvl_results * $results_number; } else { $number_results = $nvl_results * $results_number; } $num_results = $number_results; $links_obj = new clsLink; if (!$spam) { $links_obj->query = "select * from idx_link_temp where spam = '0' order by date desc, vid desc"; } else { $links_obj->query = "select * from idx_link_temp where spam = '1' order by date desc, vid desc"; } $links_obj->table_name = "idx_link_temp"; // temp table $links_obj->category_table_name = "idx_category"; $links_obj->template_file = $admin_template_path . "link_validate_rows.html"; $links_obj->date_format = $msg["20081"]; $links_obj->custom_field_offset++; $links_obj->custom_field_offset++; $links_obj->paging = true; $links_obj->pg_size = $num_results; $links_obj->href = "link_validate.php?nvl_results=$nvl_results"; $links_obj->more_param = ""; $links_obj->category_file = "../browse.php"; $links_obj->category_separator = $category_separator; $links_obj->new_link_number=1; $link = $links_obj->Display(true); $pagination = $links_obj->pagination; $num_rows = $links_obj->new_link_number-1; $param = "pg_which=$pg_which&nvl_results=$nvl_results"; DisplayTemplate($admin_template_path . "link_validate.html", "\$num_rows,\$pagination,\$link,\$param,\$vid,\$spam,\$nvl_results,\$adds,\$adds_link,\$approved,\$denied,\$denied_silent"); } /*=================================================== ValidateLinks() ===================================================*/ function ValidateLinks() { // vars global configuration global $dbConn, $admin_template_path, $email_address, $theme_path, $active_theme; // vars url & form global $num_rows, $spam; // vars messages global $msg; // vars template global $message, $back, $link_id, $title, $url, $description, $contact_name, $email, $bid, $category, $category_id, $approved_count, $denied_count, $denied_silent_count; $tpl = new Template(); $theme_path = $theme_path . $active_theme; $links_obj = new clsLink; $links_obj->table_name = "idx_link"; $links_obj->category_table_name = "idx_category"; $links_obj->editor_table_name = "idx_editor"; $links_obj->user_table_name = "idx_users"; $addslink = $_REQUEST['addslink']; $approved_count = 0; $rejected_count = 0; $rejected_silently_count = 0; if(!empty($addslink)) { foreach($addslink as $k=>$v) { $id = $k; if ($v == 1) { $category_obj = new clsCategory; $category_obj->table_name = "idx_category"; $category_obj->user_table_name = "idx_users"; $query = "select vid, link_id, title from idx_link_temp where vid = '$id'"; $result = $dbConn->Execute($query); $lid = $result->Fields("link_id"); $title = $result->Fields("title"); $vid = $result->Fields("vid"); if(empty($lid)) $flag = 0; else $flag = 1; if(!empty($vid)) { $links_obj->ApproveLink($id,$flag); // update new flag if($flag==0) $links_obj->UpdateNewFlag(); // update updated flag elseif($flag==1) $links_obj->UpdateUpdatedFlag(); // send email submitter $body = EvalTemplate($theme_path . "/mail/approved.mail", $links_obj->email_template_fields); $from = $email_address; mail($email, $msg["20131"], $body, "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0"); // send email to all editors $emails = $links_obj->GetEditorEmail($category_id); $j = 0; $count_emails = @count($emails); while ($j < $count_emails) { $body = EvalTemplate($theme_path . "/mail/approved_editor.mail", $links_obj->email_template_fields); $from = $email_address; mail($emails[$j], $msg["20133"], $body, "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0"); $j++; } // send email to all subscriber $subscribe_emails = $category_obj->GetSubscriberEmail($category_id); $j = 0; $count_subscribe_emails = @count($subscribe_emails); while ($j < $count_subscribe_emails) { $body = EvalTemplate($theme_path . "/mail/approved_subscriber.mail", $links_obj->email_template_fields); $from = $email_address; mail($subscribe_emails[$j], $msg["20133"], $body, "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0"); $j++; } } $approved_count++; } if ($v == 2) { $query = "select vid, title from idx_link_temp where vid = '$id'"; $result = $dbConn->Execute($query); $title = $result->Fields("title"); $vid = $result->Fields("vid"); if(!empty($vid)) { $links_obj->RejectLink($id); // send email submitter $body = EvalTemplate($theme_path . "/mail/rejected.mail",$links_obj->email_template_fields); $from = $email_address; mail($email,$msg["20135"],$body, "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0"); // send email to all editors $emails = $links_obj->GetEditorEmail($category_id); $j = 0; $count_emails = @count($emails); while ($j < $count_emails) { $body = EvalTemplate($theme_path . "/mail/rejected_editor.mail",$links_obj->email_template_fields); $from = $email_address; mail($emails[$j],$msg["20137"],$body, "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0"); $j++; } } $rejected_count++; } if ($v == 3) { $query = "select vid, title from idx_link_temp where vid = '$id'"; $result = $dbConn->Execute($query); $title = $result->Fields("title"); $vid = $result->Fields("vid"); if(!empty($vid)) { $links_obj->RejectLink($id); // send email to all editors $emails = $links_obj->GetEditorEmail($category_id); $j = 0; $count_emails = @count($emails); while ($j < $count_emails) { $body = EvalTemplate($theme_path . "/mail/rejected_editor.mail",$links_obj->email_template_fields); $from = $email_address; mail($emails[$j],$msg["20137"],$body, "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0"); $j++; } } $rejected_silently_count++; } } if ($approved_count >= 1) { $message = $approved_count ." Links Accepted <br />" .$rejected_count. " Links Rejected <br />" .$rejected_silently_count. " Links Rejected Silently <br />"; $message .= $msg['30015']; } else { $message = $approved_count ." Links Accepted <br />" .$rejected_count. " Links Rejected <br />" .$rejected_silently_count. " Links Rejected Silently <br />"; } $back = "<a href=link_validate.php?spam=$spam>Back</a>"; DisplayTemplate($admin_template_path . "message.html", "\$message,\$back,\$approved_count,\$rejected_count,\$rejected_silently_count"); } else { $message = $msg["20122"]; $back = "<a href=link_validate.php?spam=$spam>Back</a>"; DisplayTemplate($admin_template_path . "message.html", "\$message,\$back,\$approved_count,\$rejected_count,\$rejected_silently_count"); } } /*=================================================== main ===================================================*/ include "../application.php"; RunPreFilter(__FILE__); DisplayTemplate($admin_template_path . "header.html"); if (empty($pflag)) { ViewLink(); } elseif ($pflag == 'submit') { ValidateLinks(); } DisplayTemplate($admin_template_path . "footer.html"); RunPostFilter(__FILE__); ?>
Step 3 - Editing IndexU\indexu_5_4_0\upload\admin_tpl\link_validate .html:
Find this code:
And replace it with this code:Code:<%if $link%> <tr> <td class="tbl_light2" colspan="2"> <input type="button" name="select_all_1" value="Select All" class="button" onclick="ToggleSelect(this)"> </td> </tr> <%$link%>
Code:<%if $link%> <tr> <td class="tbl_light2" colspan="2" align="center"> <b>Show <select name="nvl_results" onChange="this.form.submit()"><option value="1"<%if $nvl_results == 1%> selected<%/if%>>15</option> <option value="2"<%if $nvl_results == 2%> selected<%/if%>>30</option> <option value="3"<%if $nvl_results == 3%> selected<%/if%>>45</option> <option value="4"<%if $nvl_results == 4%> selected<%/if%>>60</option> <option value="5"<%if $nvl_results == 5%> selected<%/if%>>75</option> </select> Results Per Page</b> </td> </tr> <%$link%>
Now, find this code:
And replace it with this code:Code:<td class="tbl_light2" colspan="2" align="center"> <div align="left"> <input type="button" name="select_all_2" value="Select All" class="button" onclick="ToggleSelect(this)"> </div> <input type="button" value="Approve" class="button" onclick="if(confirm('Are you sure want to approve these links?')) SetProcessFlag(this, 'approve')"> <input type="button" value="Reject with Notice" class="button" onclick="if(confirm('Are you sure want to reject these links?')) SetProcessFlag(this, 'reject')"> <input type="button" value="Reject Silently" class="button" onclick="if(confirm('Are you sure want to reject these links?')) SetProcessFlag(this, 'rejectsilent')"> <input type="reset" value="Reset" class="button"> </td>
What we did above:Code:<td class="tbl_light2" colspan="2" align="center"> <input type="submit" value="Submit" class="button" onclick="SetProcessFlag(this, 'submit')"> <input type="reset" value="Reset" class="button"> </td>
- We removed the "Select All" buttons from both the top and bottom of the page.
- We added a dropdown to select the number of results to display on the page.
- We removed the "Approve", "Reject with Notice", and "Reject Silently" buttons from the bottom of the page.
- We replaced those buttons with a "Submit" button.
You are done with this file, save it.
Step 4 - Editing IndexU\indexu_5_4_0\upload\admin_tpl\link_validate _rows.html:
Find the code like this:
Replace it with this:Code:<%$chk_box%> <a href="link_validate_edit.php?id=<%$vid%>" title="Edit" alt="Edit"><img src="../admin_tpl/images/pen.gif" border="0"></a>
Code:<a href="link_validate_edit.php?id=<%$vid%>" title="Edit" alt="Edit"><img src="../admin_tpl/images/pen.gif" border="0"></a>
Then find this code:
Directly below it, insert this:Code:<b>Contact</b>: <%$contact_name%><br> <b>Email</b>: <%$email%><br> </font>
This section should now look like this:Code:<b><%$adds%></b>
What we did above:Code:<b>Contact</b>: <%$contact_name%><br> <b>Email</b>: <%$email%><br> </font> <b><%$adds%></b>
- We removed the checkbox next to each link.
- We added radio buttons below each link listing.
You are done with this file, save it.
Step 5 - Editing IndexU\indexu_5_4_0\upload\lib\link.class.php:
Find the code like this: Hint: It's near line 1027
Replace it with this code:Code:$chk_box = "<input type=checkbox name=chkbox_$number value=$link_id>"; if ($validation) $chk_box = "<input type=checkbox name=chkbox_$number value=$vid>"; $tpl->assign('chk_box', $chk_box);
Code:$chk_box = "<input type=checkbox name=chkbox_$number value=$link_id>"; $adds = "<input type=\"radio\" name=\"addslink[$link_id]\" value=\"1\" />Approve <input type=\"radio\" name=\"addslink[$link_id]\" value=\"2\" />Reject with Notice <input type=\"radio\" name=\"addslink[$link_id]\" value=\"3\" />Reject Silently "; if ($validation) $chk_box = "<input type=checkbox name=chkbox_$number value=$vid>"; $adds = "<input type=\"radio\" name=\"addslink[$vid]\" value=\"1\" />Approve <input type=\"radio\" name=\"addslink[$vid]\" value=\"2\" />Reject with Notice <input type=\"radio\" name=\"addslink[$vid]\" value=\"3\" />Reject Silently "; $tpl->assign('chk_box', $chk_box); $tpl->assign('adds', $adds);
What we did above:
- We added the variable "$adds" which is called from the link_validate_rows.html file. It displays the radio buttons.
- We assigned the variable "$adds" so the template file knows what to do when "<%$adds%>" is called.
You are done with this file, save it.
Step 6 - Uploading:
Upload all the files you edited. If you downloaded the file (link_validate.php) attached to this thread, make sure you upload it too.
You are done installing this mod. It should now look like my demo.
I want to thank FSGDAG for the idea to create this mod. He gave me the idea and tested it on his website at http://www.Web4URL.com.
This mod is also available for Free at my mod store at http://store.scriptdragon.com. I have many more mods, both paid and Free, available and installation is always free (I will also install my Free mods for Free).


LinkBack URL
About LinkBacks

).
