Various tips and tricks

From Niversoft
Jump to: navigation, search

WSSP

ENUMMENU replacement

If you need to use an ENUMMENU, but need some control over the contents displayed by the structure, you can replace

<!--%%ENUMMENU value DEFAULT default IN array DISPLAY dictionary-->

by

<option value="-1"<!--%%IF NOT(EXISTS(value))--> selected="selected"<!--%%ENDIF-->>
  %%HTMLSUBST(TRANSLATE(default USING dictionary)):STRING("DefaultValuePicture")%%
</option>
<!--%%FORALL iterator IN array-->
  <option value="%%INDEX:iterator%%" <!--%%IF EXISTS(value) & EQUALS(value AND iterator[])--> selected="selected"<!--%%ENDIF-->>
    %%TRANSLATE(iterator[] USING dictionary)%%
  </option>
<!--%%ENDFOR iterator-->

This code will produce the exact same HTML code than the ENUMMENU structure (with a few more spacing), but will allow you to put conditions on individual items of the drop-down. A similar translation could be applied on other *MENU structures of the WSSP language.

HTML and Javascript

Password verification in Communigate Pro skins

You may want to secure a bit the passwords created by the users. Using this script, you can force the user to set a long password, to include letters and numbers, to avoid having the account name in the password or vice-versa.

This script is intended to be merged to the password.wssp file in your webskin. Basic instructions are included.

Communigate Pro webadmin skins page

Again, this is not wssp, but everyone who used the CGP WebAdmin skins page faced the same problem: It takes several minutes and a lot of wrist pain to click all those tiny checkboxes when you want to delete all files in a skin folder. Well, here's the solution!

Using Internet Explorer, Firefox (2.0 ) or Safari, go to the skins page of CGP webadmin. Once it's loaded, replace the URL in the address bar by this:

javascript:(function(){for(i=0;o=document.getElementsByTagName("INPUT")[i]; i++){o.checked=1}})()

Bingo! all checkboxes are checked. However, be careful: all checkboxes are checked, including the other skins folders'.