CMSModule->AdminStyle() - Does it work ?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
Lahuindai
Forum Members
Forum Members
Posts: 66
Joined: Mon Aug 01, 2005 11:00 am

CMSModule->AdminStyle() - Does it work ?

Post by Lahuindai »

Hello Gang,

I'm running beta6 and i'm busy developing the ShopMadeSimple module. I need to add some style to make things prettier (it's almost ready for release, just polish required) and discovered above function. However nothing is output in the page when you load the admin section. Below is some code that is in the action.defaultadmin.php file

Code: Select all

<?php
if (!isset ($gCms))
    exit;
/*
 * Check that the user has access to the shop
 */
if (!$this->CheckPermission('Use ShopMadeSimple'))
{
    // @TODO: Kick them out with an error message
    return false;
}
/*
 * Load the stylesheet for our display
 */
$this->AdminStyle('.category_column {width:100px;}');

I'm happy to dig in and fix it if somebody will point me in the right direction ....

G
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm
Location: Finland

Re: CMSModule->AdminStyle() - Does it work ?

Post by tsw »

It looks like a nice feature however looking at lib/classes/class.module.inc.php

Code: Select all

         /**
          *
          * Module can spit out extra CSS for the admin side
          *
          */
        function AdminStyle()
        {
          return '';
        }
so no go yet ;)

as a workaround until this gets fully supported you can echo extra css at the beginning of your module output (but not in frontend) just do a

Code: Select all

echo '
{literal}
<style type="text/css">
  .category_column { width:100px; }
</style>
{/literal}'
but if you can live without it please try, as changing admin styles becomes pretty hard if every module outputs its own styles...
User avatar
Lahuindai
Forum Members
Forum Members
Posts: 66
Joined: Mon Aug 01, 2005 11:00 am

Re: CMSModule->AdminStyle() - Does it work ?

Post by Lahuindai »

I should have checked the code, thanks though for replying. The reason i need to put some style in is that there are no existing style for "tree" display and i need that to ease the category and product browsing/editing/adding.

I'll try keep it to the minimum ... hope to have a realease by the end of this weekend, wheee
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm
Location: Finland

Re: CMSModule->AdminStyle() - Does it work ?

Post by tsw »

Cool, I for one have been waiting for these modules ;)
User avatar
Lahuindai
Forum Members
Forum Members
Posts: 66
Joined: Mon Aug 01, 2005 11:00 am

Re: CMSModule->AdminStyle() - Does it work ?

Post by Lahuindai »

tsw wrote: Cool, I for one have been waiting for these modules ;)
They are taking a while, i'm terribly slack, my apology :) Just be aware this is just for the ShopMadeSimple module not Payment or Cart yet, but they should not take too long now that i have a more intricate understanding of module development. Aslo it's a very basic shop interface that still has a long way to go to be "perfect", but with you guys commenting and suggesting i'll happily implement features ....
User avatar
sjg
Power Poster
Power Poster
Posts: 310
Joined: Thu Jan 27, 2005 5:11 pm
Location: Los Angeles, CA

Re: CMSModule->AdminStyle() - Does it work ?

Post by sjg »

Actually, it does work.

Override this method in your module.

For example:

Code: Select all

    function AdminStyle()
    {
      return "\n.myclass{text-decoration:underline;}\n";
    }

It gets appended to the admin stylesheet.
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
User avatar
Lahuindai
Forum Members
Forum Members
Posts: 66
Joined: Mon Aug 01, 2005 11:00 am

Re: CMSModule->AdminStyle() - Does it work ?

Post by Lahuindai »

sjg wrote: Actually, it does work.

Override this method in your module.

For example:

Code: Select all

    function AdminStyle()
    {
      return "\n.myclass{text-decoration:underline;}\n";
    }

It gets appended to the admin stylesheet.
Great i'm going to have it read from a default.css rather that put code directly in the Module. Prefer to keep things seperate.
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm
Location: North West England

Re: CMSModule->AdminStyle() - Does it work ?

Post by Russ »

Putting CSS 'code' in Module / PHP defeats the object and make it much trickier to maintain. Same applies to table or form formatting! I think it is a definate no-no!

Russ
User avatar
sjg
Power Poster
Power Poster
Posts: 310
Joined: Thu Jan 27, 2005 5:11 pm
Location: Los Angeles, CA

Re: CMSModule->AdminStyle() - Does it work ?

Post by sjg »

Putting CSS 'code' in Module / PHP defeats the object and make it much trickier to maintain. Same applies to table or form formatting! I think it is a definate no-no!
True, it's not ideal. But it was a necessary expedient until the next version of the module API where it can be implemented right.
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
User avatar
Lahuindai
Forum Members
Forum Members
Posts: 66
Joined: Mon Aug 01, 2005 11:00 am

Re: CMSModule->AdminStyle() - Does it work ?

Post by Lahuindai »

sjg wrote:
Putting CSS 'code' in Module / PHP defeats the object and make it much trickier to maintain. Same applies to table or form formatting! I think it is a definate no-no!
True, it's not ideal. But it was a necessary expedient until the next version of the module API where it can be implemented right.
I'll be happy to implement this if you guys let me know exactly what it's meant to do and submit it to the source tree ....

g
User avatar
matterhornpat
Forum Members
Forum Members
Posts: 49
Joined: Wed Jul 11, 2007 7:55 pm

Re: CMSModule->AdminStyle() - Does it work ?

Post by matterhornpat »

Anything further with this module? When will it be released?
Post Reply

Return to “Developers Discussion”