Page 1 of 1
CMSModule->AdminStyle() - Does it work ?
Posted: Fri Sep 08, 2006 1:09 am
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
Re: CMSModule->AdminStyle() - Does it work ?
Posted: Fri Sep 08, 2006 8:06 am
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...
Re: CMSModule->AdminStyle() - Does it work ?
Posted: Fri Sep 08, 2006 8:19 am
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
Re: CMSModule->AdminStyle() - Does it work ?
Posted: Fri Sep 08, 2006 1:07 pm
by tsw
Cool, I for one have been waiting for these modules

Re: CMSModule->AdminStyle() - Does it work ?
Posted: Fri Sep 08, 2006 10:12 pm
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 ....
Re: CMSModule->AdminStyle() - Does it work ?
Posted: Fri Sep 08, 2006 11:25 pm
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.
Re: CMSModule->AdminStyle() - Does it work ?
Posted: Sat Sep 09, 2006 1:42 am
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.
Re: CMSModule->AdminStyle() - Does it work ?
Posted: Sat Sep 09, 2006 6:44 am
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
Re: CMSModule->AdminStyle() - Does it work ?
Posted: Sat Sep 09, 2006 5:56 pm
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.
Re: CMSModule->AdminStyle() - Does it work ?
Posted: Sat Sep 09, 2006 11:59 pm
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
Re: CMSModule->AdminStyle() - Does it work ?
Posted: Mon Oct 29, 2007 2:15 pm
by matterhornpat
Anything further with this module? When will it be released?