Page 1 of 1

newbie is stuck on module.xml format

Posted: Tue Aug 28, 2007 5:08 am
by N6REJ
:'( I'm running myself in circles.  I've followed the hello world example and the one thing it leaves out is what to do with images that you need to place.
How does it know where to put them.  I ASSUME you must tell it to put them using the directive followed by the path/filename then
but thats just a guess.
What I'm trying to do is create a secondary set of "quickicons" that will be a subset of the main set.  In otherwords the original quickicons will still be there but mine will follow afterwards.  I've modified my .xml and .php to account for this.
I think I've got everything worked out but still am confused on this point.
Could someone please help me out.
The only other option I know of would be to unpublish the original mod_quickicon.php file and publish mine all during the install.
Please give me some pointers.
Here is my code....

.xml file =

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<mosinstall type="module" client="administrator">
   <name>VM Quick Icons</name>
   <author>N6REJ</author>
   <creationDate>August 27, 2007</creationDate>
   <copyright>(C) 2005 Open Source Matters. All rights reserved.</copyright>
   <license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
   <authorEmail>[email protected]</authorEmail>
   <authorUrl>www.n6rej.com</authorUrl>
   <version>1.0.0</version>
   <description>This module shows the Virtuemart quickicon buttons in the Admin homepage or `Control Panel`</description>
   <files>
      <filename module="mod_vmquickicon">mod_vmquickicon.php</filename>
      <filename images/shop_customers.png</filename>
      <filename images/shop_products.png</filename>
      <filename images/shop_orders.png</filename>

   </files>
   <params>
      <param name="securitycheck" type="radio" default="1" label="Security Check" description="Select whether to show the Security Check warning">
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
   </params>
</mosinstall>


and then my .php is...

Code: Select all

<?php
/**
* @version $Id: mod_quickicon.php 5571 2006-10-26 05:20:13Z Saka $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );

if (!defined( '_JOS_VMQUICKICON_MODULE' )) {
   /** ensure that functions are declared only once */
   define( '_JOS_VMQUICKICON_MODULE', 1 );

   function quickiconButton( $link, $image, $text ) {
      ?>
      <div style="float:left;">
         <div class="icon">
            <a href="<?php echo $link; ?>">
               <?php echo mosAdminMenus::imageCheckAdmin( $image, '/administrator/images/', NULL, NULL, $text ); ?>
               <span><?php echo $text; ?></span>
            </a>
         </div>
      </div>
      <?php
   }

   $securitycheck    = intval( $params->get( 'securitycheck', 1 ) );
   ?>
   <div id="cpanel">
      <?php
      
        $link = 'index2.php?option=com_joomlaxplorer';
        quickiconButton( $link, 'jxplorer.png', 'JoomlaXplorer' );

      $link = 'index2.php?option=com_virtuemart';
      quickiconButton( $link, 'vm_logo.gif', 'Store' );

      $link = 'index2.php?pshop_mode=admin&page=admin.user_list&option=com_virtuemart';
      quickiconButton( $link, 'shop_users.png', 'Customers' );

      $link = 'index2.php?pshop_mode=admin&page=order.order_list&option=com_virtuemart';
      quickiconButton( $link, 'shop_orders.png', 'Orders' );
      
      $link = 'index2.php?pshop_mode=admin&page=product.product_list&option=com_virtuemart';
      quickiconButton( $link, 'shop_products.png', 'Products' );

      $link = 'index2.php?pshop_mode=admin&page=product.product_category_list&option=com_virtuemart';
      quickiconButton( $link, 'shop_categories.png', 'Categories' );
      
      if ($securitycheck) {
      // show security setting check
         josSecurityCheck('88%');
      }
     ?>
   </div>
   <div style="clear:both;"> </div>
   <?php
}
?>


Again, thanks in advance.  I anxiously awaity your guidance.

Re: newbie is stuck on module.xml format

Posted: Tue Aug 28, 2007 6:10 am
by MvBrakel
Hey,

I found the problem, it has to do with basic XML rules. look at the filename parts and notice the ">"

.xml file =

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<mosinstall type="module" client="administrator">
   <name>VM Quick Icons</name>
   <author>N6REJ</author>
   <creationDate>August 27, 2007</creationDate>
   <copyright>(C) 2005 Open Source Matters. All rights reserved.</copyright>
   <license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
   <authorEmail>[email protected]</authorEmail>
   <authorUrl>www.n6rej.com</authorUrl>
   <version>1.0.0</version>
   <description>This module shows the Virtuemart quickicon buttons in the Admin homepage or `Control Panel`</description>
   <files>
      <filename module="mod_vmquickicon">mod_vmquickicon.php</filename>
      <filename>images/shop_customers.png</filename>
      <filename>images/shop_products.png</filename>
      <filename>images/shop_orders.png</filename>

   </files>
   <params>
      <param name="securitycheck" type="radio" default="1" label="Security Check" description="Select whether to show the Security Check warning">
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
   </params>
</mosinstall>


That should do it. Given the files and stuff are all correct.

Re: newbie is stuck on module.xml format

Posted: Tue Aug 28, 2007 6:16 am
by N6REJ
you were right, except for one tiny thing.  Its saying now that
No file is marked as module file
which I don't get at all.
that first part was driving me nuts and I just found it a few minutes ago, so you were'nt far behind me or visa versa.
Troy

Oh, xml now looks like this...

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<mosinstall type="module" client="administrator">
   <name>Virtuemart Quick Icons</name>
   <author>N6REJ</author>
   <creationDate>August 2007</creationDate>
   <copyright>(C) 2005 Open Source Matters. All rights reserved.</copyright>
   <license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
   <authorEmail>[email protected]</authorEmail>
   <authorUrl>www.n6rej.com</authorUrl>
   <version>1.0.0</version>
   <description>This module shows the Virtuemart quickicon buttons in the Admin homepage or `Control Panel`</description>
   
   <files>
      <filename> module="mod_vmquickicon">mod_vmquickicon.php</filename>
   
      <filename> /administrator/images/shop_users.png</filename>
      <filename> /administrator/images/shop_products.png</filename>
      <filename> /administrator/images/shop_orders.png</filename>
      <filename> /administrator/images/jxplorer.png</filename>
      <filename> /administrator/images/shop_categories.png</filename>
      <filename> /administrator/images/vm_logo.gif</filename>
      
   </files>
   <params>
      <param name="securitycheck" type="radio" default="1" label="Security Check" description="Select whether to show the Security Check warning">
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>
   </params>
</mosinstall>

Re: newbie is stuck on module.xml format

Posted: Tue Aug 28, 2007 6:47 am
by N6REJ
progress, I had a > in the wrong place.  Now it installs but tells me I can't have 2 "quickicon" files, and its defaulting to the left position.
So I'm going to have to figure out how to "automagically" unpublish the normal one and publish mine. and then publish it to the proper place.
Also the images aren't getting put in the administrator/images/ folder.
Progress but still ALPHA stage.

Re: newbie is stuck on module.xml format

Posted: Tue Aug 28, 2007 6:52 am
by MvBrakel
Now u put in one ">" to many. note the filename module="mod_vmquickicon" part.
the module="" is an attribute to filename so should be placed inside the tag

Oh, xml now looks like this...

Code: Select all

   <files>
      <filename module="mod_vmquickicon">mod_vmquickicon.php</filename>
   
      <filename> /administrator/images/shop_users.png</filename>
      <filename> /administrator/images/shop_products.png</filename>
      <filename> /administrator/images/shop_orders.png</filename>
      <filename> /administrator/images/jxplorer.png</filename>
      <filename> /administrator/images/shop_categories.png</filename>
      <filename> /administrator/images/vm_logo.gif</filename>
      
   </files>
   

Re: newbie is stuck on module.xml format

Posted: Tue Aug 28, 2007 7:21 am
by N6REJ
yeah, I had to change

Code: Select all

<filename> module="mod_vmquickicon">mod_vmquickicon.php</filename>
to

Code: Select all

<filename module="mod_vmquickicon">mod_vmquickicon.php</filename>
but that still doesn't fix the publishing and positioning.
Haven't figured that out yet.
and imagery

Re: newbie is stuck on module.xml format

Posted: Tue Aug 28, 2007 8:56 am
by N6REJ
Well, everything is working EXCEPT, I can't get the images to go into the administrator/images folder with the rest of the quickicon images, and I can't seem to figure out how to print out a little blurb telling them to unpublish the old one and publish the new.
Troy

Re: newbie is stuck on module.xml format

Posted: Tue Aug 28, 2007 9:08 am
by MvBrakel
Sorry for the late response, but i am currently at work and not able to reply with a full answer. More info in an hour or 2.

Re: newbie is stuck on module.xml format

Posted: Tue Aug 28, 2007 9:24 am
by N6REJ
thats fine.  I'm needing a brain break anyway.  I've attached a zip with my work so far.  Everything installs, but I have the following issues.
  • Cannot put new images into the existing "/administrator/images" folder during install.  It only wants to make a sub folder under administrator/modules/ but then that isn't referenced in the .xml to look there.
  • Cannot tell joomla to unpublish the existing quickicons module
  • Cannot tell my program to use the "icon" position and publish itself.

Oh, I added the original icons to the .xml only because I couldn't figure out how to get mine where they belonged.

Other then that everything works!  So at least I'm in alpha2 now!

Re: newbie is stuck on module.xml format

Posted: Tue Aug 28, 2007 3:54 pm
by ianmac
Just change:


to:



And that should solve your problem.

Ian