+100, As always, I hope all xoops developers could work together in one place. Also please dont work on your modules in local and commit any pre-alpha (not working) versions of modules to SVN.
If i understand you correctly. you say your file is utf-8 and xoops save it as ansi. 1- you should not have utf-8 or multi-byte characters in themes/templates. It is hard-code. move them to language files and use them like this using smarty.
<{$smarty.const._NO}>
2- "/modules/system/admin.php?Fct=tplsets" only will copy the templates from: modules/MODULE/templates/my_template.html to: themes/THEME/modules/my_template.html It dont do anything else. so it is just useful when a webmaster dont have access to Cpanel and/or ftp. Therefor if you have access to root or Cpanel or FTP you can do it yourself using ftp.
In 2.5.6 XoopsForm ajax is not using at all. Even there are many limitations for module developers in xoops.js and Xoopsform classes. Quote:
are there some tricks?
I am very basic in js and didnt know JQuery at all so I had to search a lot to find some very needed js functions for my needs in newbb and userlog:
function isOneChecked($name) { // All tags... var chx = document.getElementsByName($name); for (var i=0; i<chx.length; i++) { // If you have more than one checkbox group, also check the name attribute // for the one you want as in && chx[i].name == 'choose' // Return true from the function on first match of a checked item if (chx[i].type == 'checkbox' && chx[i].checked) { return true; } } // End of the loop, return false return false; } // http://stackoverflow.com/questions/2617480/how-to-get-all-elements-which-name-starts-with-some-string function preventSubmitEmptyInput($prefix) { var eles = []; var inputs = document.getElementsByTagName("input"); for(var i = 0; i < inputs.length; i++) { if(inputs[i].name.indexOf($prefix) == 0) { eles.push(inputs[i]); } } for(var i = 0; i < eles.length; i++) { if (eles[i].value =='') { eles[i].setAttribute('name', ''); } } return true; } // START irmtfan - improve: add alt, title, id and innerHTML - recognize a IMG tag for src function ToggleBlock(blockid, icon, src_expand, src_collapse, alt_expand, alt_collapse, class_expand, class_collapse) { var Img_tag='IMG'; var el=document.getElementById(blockid); if (el.className == class_expand) { el.className = class_collapse; if (icon.nodeName == Img_tag) { icon.src = src_collapse; } icon.alt= alt_collapse; icon.id = findBaseName(src_collapse); SaveCollapsed(blockid, true); } else { el.className = class_expand; if (icon.nodeName == Img_tag) { icon.src = src_expand; } icon.alt= alt_expand; icon.id = findBaseName(src_expand); SaveCollapsed(blockid, false); } icon.title = icon.alt; if (icon.nodeName != Img_tag){ icon.innerHTML=icon.alt; // to support IE7&8 use innerHTML istead of textContent } document.getElementById(blockid + "text").innerHTML=icon.alt; } // source: http://stackoverflow.com/questions/1991608/find-base-name-in-url-in-javascript function findBaseName(url) { var fileName = url.substring(url.lastIndexOf('/') + 1); var dot = fileName.lastIndexOf('.'); return dot == -1 ? fileName : fileName.substring(0, dot); } // END irmtfan - improve: add alt, title and innerHTML - recognize a IMG tag for src function SaveCollapsed(objid, addcollapsed) { var collapsed = GetCookie(toggle_cookie); var tmp = ""; if (collapsed != null) { collapsed = collapsed.split(","); for (i in collapsed) { if (collapsed[i] != objid && collapsed[i] != "") { tmp = tmp + collapsed[i]; tmp = tmp + ","; } } }
/** * Function for validation of xoops forms: prevent user select nothing or disable some options * @param elName : elements name * @param elType : element type eg: select, checkbox * @param prevent: prevent user select nothing: true or false * @param disablecat: disable categories in forum select box: true or false * @param elMsg: the message */
function validate(elName, elType , prevent, disablecat, elMsg) { var i = 0; var el=document.getElementsByName(elName); var is_valid = true; switch (elType) { case 'checkbox': var hasChecked = false; if (el.length) { for (i = 0; i < el.length; i++) { if (el[i].checked == true) { hasChecked = true; break; } } } else { if (el.checked == true) { hasChecked = true; } } if (!hasChecked) { if (el.length) { if (prevent) {el[0].checked = true;} el[0].focus(); }else{ if (prevent) {el.checked = true;} el.focus(); } is_valid = false; } break; case 'select': el = el[0]; if (disablecat) { for (i = 0; i < el.options.length; i++ ) { if (el.options[i].value < 0) { el.options[i].disabled = true; el.options[i].value = ''; } } }
if (el.value == '') { is_valid = false; if(prevent) { for (i = 0; i < el.options.length; i++ ) { if (el.options[i].value != '') { el.value = el.options[i].value; break; // loop exit } } } } break; } return is_valid; }
As you can see there are very basic and common needs: 1- check if at least one checkbox is selected in a multi-checkbox. It is useful if you want to submit only when one selected.
2- prevent to submit empty input elements. it is very useful when you have many $_GET in the URL and you dont want to end up with a messy URI with some empty arguments like this:
/index.php?id=&time=&select=&cat=&post=234
using the above js function in this URI it remove all empty arguments and only post=234 is remained.
/index.php?post=234
3- toggle (show/hide) very needed just having the ability to change a css class is enough.
4- set and get cookie in browser.
5- prevent user select nothing in multiselect checkbox or select form. It is a common bug in all xoops modules like publisher, news, ... which user can select nothing and break the module from working.
I didnt review 2.6 fully. but there are many limitations in 2.6 too. I hope core team add more useful js functions with document and instruction for general usage of module developers.
which "Module" is the module dirname with uppercase of the first letter. for example in userlog (with dirname = "userlog") you just need to have this in any other module:
$Userlog = Userlog::getInstance();
then you have access to all functions and handlers and can use it with ease:
$Userlog->getHandler('log')->getCounts($criteria)
the above means you access to table mod_userlog_log so for any other standard module you just need to know the table name suffix.
all functions to work with database like "getCounts" can be found in XoopsObject class. so all modules have a unify interface functions.
even you can delete table rows or drop fields (and damage the userlog module) from any other module using that handler
In 2.6 it turns to a core helper class that makes usage of another module class/functions more simpler for module developers. I show the way to write that helper for 2.5.5 modules in how to write standard module for xoops tutorial. so instead of what you propose for a module class (Xoopspoll) we have this: http://svn.code.sf.net/p/xoops/svn/XoopsModules/publisher/trunk/publisher/class/publisher.php but you should know: - one table in a module needs one class extend the XoopsObject Core class to work with its own table. Im still reading this long topic. I will add my comments.
It is just temporary because it will execute the pre functions whenever user goes to moduelsadmin link: eg: modules/system/admin.php?fct=modulesadmin&op=update&module=$dirname
Now the wish to clone modules by simple folder renaming is accomplished. without using eval. even we can update a clone module using the original module. (which is not possible in current SmartClone) meanwhile we should send a core request to remove dirname from all Oninstall,Onupdate or Onuninstall functions at least in core 2.6 It seems previous core developers had a bad habit to add dirname to all instance of module functions to avoid conflict. But they didnt think while in some core operations like blocks and search functions core will face conflict between modules, in update and install and uninstall it is not needed and now it makes troubles for cloning.
@bosco: It seems you are a well experience user of Xoops, php and mysql and you can solve upgrade issues sooner or later. but I mainly recommend dont use old upgrade packages. they are not reliable. I always will use the latest full version for upgrade.
Xhelp is a very old module. Trabis did some great attempts to fix bugs but still there are some bugs. unfortunately we didnt have many developers like Trabis in Xoops. Most developers had been envolved in some useless projects for creating content modules like news, download or gallery. Xhelp is a big module and needs many time to be bug free.