Jump to content

Intelligent Search All pages (mod)


Recommended Posts

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);

} 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.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);

 

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);

}

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

Link to comment
Share on other sites

  • 2 weeks later...

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... :)

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated