Jump to content

ike

Retired Forum Member
  • Posts

    6
  • Joined

  • Last visited

About ike

ike's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. I noticed this on my WHMCS installation as well, except it was only applying to one client. I just went to that client's profile page, made sure the proper currency was selected, and clicked save, and now i only have one income projection displayed. Not sure what the issue was but that seems to have fixed it.
  2. Actually, it just occurred to me that I think you meant you're using the "default" client-side theme as opposed to the "portal" theme. In that case, just edit the /templates/default/header.tpl file the same way you would edit the /templates/portal/header.tpl file.
  3. Did you copy my file for the "cart" orderform into your "default" orderform? If so, that would cause a problem. I didn't make examples for the other carts provided by the system, I could though if you want. Upload a copy of the file you modified and I'll take a look.
  4. Hi everyone, I have just submitted the addon to the community contributions system and it is awaiting approval. In the mean time, you can download the new version of the addon here: http://ike.to/whmcs_addons/password_generator/pwgen_1.0.zip Note that I changed the Javascript file's name and location for consistency. Also, the header.tpl modification in the admin area has changed slightly. Full installation instructions are included in the zip file. Other changes: Added client-side integration instructions for the checkout page Fixed the IE bug mentioned by ipglobe Changed the "Generate" button placement so it will always be next to the password field
  5. Good idea. The current version can't be implemented as-is on the customer portal for a couple reasons but it will definitely be possible with a few changes. I should have a new version later tonight or tomorrow. I'll post an update here and submit it to the community contributions when it's ready.
  6. I thought it would be useful to have a quick "generate random password" button on a few admin pages. I couldn't find editable template files for the admin pages (other than a few of the basic .tpl files), so I decided to implement it with Javascript. Basically, the JS looks for password input boxes, and then adds a "Generate" button after them. This should be considered experimental as I just wrote it tonight, but it seems to be working very well in my tests. Here's what it looks like: Here's what you do: Create a new file, /whmcs_path/admin/autoPassword.js Content: // AddAutoPasswordButtons: Look for password boxes and add a generate password button next to tehm function AddAutoPasswordButtons() { // Don't add the Generate button to certain pages where it wouldn't make sense var NoGenerate = [ 'WHMCS - Servers', 'WHMCS - Support Ticket Departments' ]; for (i=0; i<NoGenerate.length; i++) if (document.title == NoGenerate[i]) return; // Get the Password text box, if there is one var e = document.getElementsByName("password"); if (e.length>0) { var b = document.createElement("input"); b.type = "button"; b.value = "Generate"; b.onclick = GeneratePassword; e[0].parentNode.appendChild(b); } } // GeneratePassword: Generate a password and place it in a textbox function GeneratePassword() { var p = GetRandomPassword(); var e = document.getElementsByName("password"); if (e.length>0) { e[0].value = p; if (e[0].type == "password") e[0].type = "text"; } // For a "confirm password" field e = document.getElementsByName("password2"); if (e.length>0) { e[0].value = p; if (e[0].type == "password") e[0].type = "text"; } } // GetRandomNumber: Get a random number between two specified numbers function GetRandomNumber(lbound,ubound) { return (Math.floor(Math.random() * (ubound-lbound)) + lbound); } // GetRandomCharacter: Get a random character function GetRandomCharacter() { var chars = ""; // Choose your character sets below chars += "0123456789"; chars += "abcdefghijklmnopqrstuvwxyz"; chars += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; return chars.charAt(GetRandomNumber(0,chars.length)); } // GetRandomPassword: Get a random password function GetRandomPassword() { var p = ""; for (i=0; i<8; i++) p += GetRandomCharacter(); return p; } //------------------------------------------------------------------------------ // Adding events to onLoad // Source: http://onlinetools.org/articles/unobtrusivejavascript/chapter4.html function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } // Hook AddAutoPasswordButtons to window load addEvent(window,'load',AddAutoPasswordButtons); Then, we just need to edit /whmcs_path/admin/templates/v4/header.tpl to reference the new .js file. I added the following on line 39 just before </head>: <script type="text/javascript" src="autoPassword.js"></script> This is what it looks like in context: });{/literal} {$jscode} </script> [b]<script type="text/javascript" src="autoPassword.js"></script>[/b] </head> <body> <div id="topnav"> That's it! Let me know if you find this useful or see any problems. I'll update this thread if I make any changes.
×
×
  • 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