First install
I have installed my 1.0.7 version and the first impression was good. No errors!
Custom Toolbar Buttons (artf3368)
In the Backend my custom Toolbar-Button isn’t displayed. The cause is a bug in mosAdminMenus see artf3368 for more information’s.
Usage of mosConfig global variables
Example for a change:
form
Code: Select all
global $mosConfig_live_site;
echo $mosConfig_live_site;
Code: Select all
global $mainframe;
$live_site = $mainframe(‘live_site’);
echo $live_site;
Use an Editor in your extension.
The procedure has changed.
Old style (Backend and Frontend)
Code: Select all
getEditorContents( 'editor1', 'text' ) ;
…
// parameters : areaname, content, hidden field, width, height, rows, cols
editorArea( 'editor1', $row->text , 'text', 400, 200, '50', '10' ) ;
New style (Backend and Frontend)
Code: Select all
$editor =& JEditor::getInstance();
echo $editor->getEditorContents( 'editor1', 'text' ) ;
….
// parameters : areaname, content, hidden field, width, height, rows, cols
$editor =& JEditor::getInstance();
echo $editor->getEditor( 'editor1', $row->definition , 'definition', '100%;', '200', '75', '20' ) ;
Language file
Language files are located in the language directory and there are subdirectories for specific languages eng_GB, ger_DE, ….. Your language file must stored in one subdirectory and named for example. eng_GB.com_rd_glossary.ini or {lang_tag}.com_{componentname}.ini
If you do it in that way, the language file is loaded automatic, if you component is loaded. You don’t must do something similar that.
Code: Select all
// Get the right language if it exists
if (file_exists($mosConfig_absolute_path.'/administrator/components/'._COMP_NAME.'/languages/'.$mosConfig_lang.'_admin.php')) {
include_once($mosConfig_absolute_path.'/administrator/components/'._COMP_NAME.'/languages/'.$mosConfig_lang.'_admin.php');
} else {
include_once($mosConfig_absolute_path.'/administrator/components/'._COMP_NAME.'/languages/english_admin.php');
}
Old style:
Code: Select all
define('_RD_ERROR1','Term must be uniq');
define('_RD_GLOSSARY_ADDNEW','Add an new entry');
New style:
Code: Select all
RD ERROR1=Term must be uniq
RD GLOSSARY ADDNEW=Add an new entry
You have to change this:
Code: Select all
$addnew = "<a title=\""._RD_GLOSSARY_ADDNEW."\" href=\"". sefRelToAbs( "index.php?option=com_rd_glossary&task=new" . $Itemid ) . "\">". _RD_GLOSSARY_ADDNEW."</a>";
into this
Code: Select all
$addnew = "<a title=\"". JText::_('RD GLOSSARY ADDNEW') ."\" href=\"" . sefRelToAbs( "index.php?option=com_rd_glossary&task=new" . $Itemid ) . "\">". JText::_('RD GLOSSARY ADDNEW') ."##</a>";
no direct access
Code: Select all
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
Code: Select all
defined( '_JEXEC' ) or die( 'Restricted access' );
Toolbar and admin screen
The new class for the toolbar is JMenuBar and there is a new function title.
Example:
Code: Select all
JMenuBar::title( JText::_( 'RD GLOSSARY ITEMLISTTITLE' ), 'addedit.png' );
I have changed.
this (old 1.0.x style)
Code: Select all
echo "<table class=\"adminheading\">";
echo "<tr><th class=\"addedit\" rowspan=\"2\">"._RD_GLOSSARY_ITEMLISTTITLE."</th>";
echo "<td colspan=\"2\" align=\"right\">$lists</td></tr>";
echo "<tr><td>Filter:</td><td> <input type=\"text\" name=\"search\" value=\"" . $search . "\" class=\"text_area\" onChange=\"document.adminForm.submit();\" />";
echo "</td></tr></table>";
Code: Select all
echo "<table class=\"adminform\">";
echo "<tr><td align=\"left\" width=\"100%\">Filter: <input type=\"text\" name=\"search\" value=\"" . $search . "\" class=\"text_area\" onChange=\"document.adminForm.submit();\" />";
echo "<input type=\"button\" value=\"".JText::_('RD GO')."\" class=\"button\" onclick=\"this.form.submit();\" />";
echo "<input type=\"button\" value=\"".JText::_('RD RESET')."\" class=\"button\" onclick=\"getElementById('search').value='';this.form.submit();\" />";
echo "</td><td nowrap=\"nowrap\">$lists</td></tr></table>";
Code: Select all
echo "<div id=\"tablecell\">";
TABLE
echo “</div>”;
Some small changes
I have changed this it isn’t necessary at all but usefully.
Code: Select all
$mosConfig_absolute_path -> JPATH_SITE
$mosConfig_absolute_path . ‘/administrator/components/’ -> JPATH_ADMINISTRATOR.'/components/'