PDA

View Full Version : Intelligent Search All pages (mod)



ServerTweak.com
05-16-08, 07:34 PM
works for me, should for you (WHMCS v3.6.1)

backup files:
admin/javascript/menu.js
admin/templates/homepage.tpl
admin/templates/topmenu.tpl

Open file admin/javascript/menu.js
*********** FIND

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu
*********** ADD AFTER

// ServerTweak Mod Intelligent Search all pages //*





var whmcsajax_debug_mode = false;
var whmcsajax_request_type = "GET";
var whmcsajax_target_id = "";
var whmcsajax_failure_redirect = "";

function whmcsajax_debug(text) {
if (whmcsajax_debug_mode)
alert(text);
}

function whmcsajax_init_object() {
whmcsajax_debug("whmcsajax_init_object() called..")

var A;

var msxmlhttp = new Array(
'Msxml2.XMLHTTP.5.0',
'Msxml2.XMLHTTP.4.0',
'Msxml2.XMLHTTP.3.0',
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP');
for (var i = 0; i < msxmlhttp.length; i++) {
try {
A = new ActiveXObject(msxmlhttp[i]);
} catch (e) {
A = null;
}
}

if(!A && typeof XMLHttpRequest != "undefined")
A = new XMLHttpRequest();
if (!A)
whmcsajax_debug("Could not create connection object.");
return A;
}

var whmcsajax_requests = new Array();

function whmcsajax_cancel() {
for (var i = 0; i < whmcsajax_requests.length; i++)
whmcsajax_requests[i].abort();
}

function whmcsajax_do_call(func_name, args) {
var i, x, n;
var uri;
var post_data;
var target_id;

whmcsajax_debug("in whmcsajax_do_call().." + whmcsajax_request_type + "/" + whmcsajax_target_id);
target_id = whmcsajax_target_id;
if (typeof(whmcsajax_request_type) == "undefined" || whmcsajax_request_type == "")
whmcsajax_request_type = "GET";

uri = "/vip/admin/index.php";
if (whmcsajax_request_type == "GET") {

if (uri.indexOf("?") == -1)
uri += "?rs=" + escape(func_name);
else
uri += "&rs=" + escape(func_name);
uri += "&rst=" + escape(whmcsajax_target_id);
uri += "&rsrnd=" + new Date().getTime();

for (i = 0; i < args.length-1; i++)
uri += "&rsargs[]=" + escape(args[i]);

post_data = null;
}
else if (whmcsajax_request_type == "POST") {
post_data = "rs=" + escape(func_name);
post_data += "&rst=" + escape(whmcsajax_target_id);
post_data += "&rsrnd=" + new Date().getTime();

for (i = 0; i < args.length-1; i++)
post_data = post_data + "&rsargs[]=" + escape(args[i]);
}
else {
alert("Illegal request type: " + whmcsajax_request_type);
}

x = whmcsajax_init_object();
if (x == null) {
if (whmcsajax_failure_redirect != "") {
location.href = whmcsajax_failure_redirect;
return false;
} else {
whmcsajax_debug("NULL whmcsajax object for user agent:\n" + navigator.userAgent);
return false;
}
} else {
x.open(whmcsajax_request_type, uri, true);
// window.open(uri);

whmcsajax_requests[whmcsajax_requests.length] = x;

if (whmcsajax_request_type == "POST") {
x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");
x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}

x.onreadystatechange = function() {
if (x.readyState != 4)
return;

whmcsajax_debug("received " + x.responseText);

var status;
var data;
var txt = x.responseText.replace(/^\s*|\s*$/g,"");
status = txt.charAt(0);
data = txt.substring(2);

if (status == "") {
// let's just assume this is a pre-response bailout and let it slide for now
} else if (status == "-")
alert("Error: " + data);
else {
if (target_id != "")
document.getElementById(target_id).innerHTML = eval(data);
else {
try {
var callback;
var extra_data = false;
if (typeof args[args.length-1] == "object") {
callback = args[args.length-1].callback;
extra_data = args[args.length-1].extra_data;
} else {
callback = args[args.length-1];
}
callback(eval(data), extra_data);
} catch (e) {
whmcsajax_debug("Caught error " + e + ": Could not eval " + data );
}
}
}
}
}

whmcsajax_debug(func_name + " uri = " + uri + "/post = " + post_data);
x.send(post_data);
whmcsajax_debug(func_name + " waiting..");
delete x;
return true;
}


// wrapper for find_matches
function x_find_matches() {
whmcsajax_do_call("find_matches",
x_find_matches.arguments);
}


function run_query() {
var x;
x = document.getElementById("intellisearchval").value;
x_find_matches(x, do_cb);
}
function do_cb(result) {
eval(result);
}

Save file

Open file admin/templates/homepage.tpl
*********** FIND & Remove

<div align="right" style="position:absolute;top:157px;left:590px;width:400px ;">
<img src="images/icons/search.png" align="absmiddle" /> <strong>Intelligent Search</strong> <input type="text" name="intellisearchval" id="intellisearchval" onKeyUp="run_query();" style="width:120px;" /> <a href="#" onclick="document.getElementById('intellisearchval').value= '';document.getElementById('searchresults').style. display='none';return false"><img src="images/delete.gif" align="absmiddle" border="0" /></a>
<div align="left" id="searchresults" style="border:1px solid #DFDCCE;background-color:#F7F7F2;padding:5px;margin-right:10px;display:none;" nowrap></div>
</div>

Save file

Open file admin/templates/topmenu.tpl
*********** FIND

<span class="navbutton" onMouseOver="this.className='navbuttonover


*********** Add Above

<div align="right" style="position:absolute;top:157px;left:590px;width:400px ;">
<img src="images/icons/search.png" align="absmiddle" /> <strong>Intelligent Search</strong> <input type="text" name="intellisearchval" id="intellisearchval" onKeyUp="run_query();" style="width:120px;" /> <a href="#" onclick="document.getElementById('intellisearchval').value= '';document.getElementById('searchresults').style. display='none';return false"><img src="images/delete.gif" align="absmiddle" border="0" /></a>
<div align="left" id="searchresults" style="border:1px solid #DFDCCE;background-color:#F7F7F2;padding:5px;margin-right:10px;display:none;" nowrap></div>
</div>

Save file


Let me know how it goes

MACscr
05-16-08, 08:18 PM
i havent tried it yet, but should definitely be added to the core.

NH-Andrew
05-27-08, 03:31 PM
This doesn't work for me, the search appears but doesn't work on any pages except the home page.

impactgc
05-27-08, 03:46 PM
I get the same issue as NH-Andrew -- works on the home page -- not on the others.

Adam

minadreapta
05-27-08, 05:16 PM
i confirm this, it doesn't work on my v3.6.1 except for the homepage

ServerTweak.com
05-27-08, 05:39 PM
let me check into this, i have it working on all pages on my end

ServerTweak.com
05-27-08, 05:43 PM
clear your cache, let me know while im finding out the reason why this mod isn't working

minadreapta
05-27-08, 08:04 PM
cleared the browser cache and the templates_c folder, still doesn't work, confirmed with IE7 and FF 2.0.0.14

whmfan
05-27-08, 08:52 PM
This is for WHMCS developers: Hi, do you think the intelligent search on each admin page will be in your 3.6.2 update? Just curious, as Ive just seen it in the list of planned features in your dev pages. Also interested in Add Sorting to Client Area... :)

bill
07-10-08, 01:48 AM
ive updated to 3.6.2 however dont see search on all admin pages

magga
07-10-08, 02:20 AM
This is on the dev tracker it's not in 3.6.2

deltatech
09-04-08, 12:03 AM
This is an old thread but did anyone ever get this to work?

It displays on all pages but only works on the home page on 3.62