Forum Index   -   Topic Index
   Preload
     Admin-Theme Changer Preload for XC Legacy
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
wanikoo
Posted on: 2007/6/20 8:50
Home away from home
Joined: 2006/3/1
From: third rock from the sun
Posts: 323
Admin-Theme Changer Preload for XC Legacy
---------------------------------------------------------
AdminThemeSelect Preload version 1.0 by wanikoo
( http://www.wanisys.net/ )
---------------------------------------------------------
( Tested on XOOPS Cube Legacy 2.1.1 )
---------------------------------------------------------
With this preload,
You can add "admin-theme changer block" to left-column of administration section!

PS:
As you know,
gigamaster, the admin of XC french support site
has already released three fantastic admin-themes for XC Legacy!
I really recommed you test this preload with his admin-themes!
http://xoopscube.org/modules/xhnewbb/viewtopic.php?topic_id=490
http://xoopscube.org/modules/xhnewbb/viewtopic.php?topic_id=491
http://xoopscube.org/modules/xhnewbb/viewtopic.php?topic_id=492
ex)
1) download his admin-themes!
2) copy them like this!
/html/theme/admin_red/*.*
/html/theme/admin_blue/*.*
/html/theme/admin_orange/*.*
3) install this preload!
3) access admin-section!
And
you can see admin-theme changer block with 4 options!
( default, admin_red, admin_blue, admin_orange )
^^//

##NOTICE##
This preload package includes also
1) Legacy_AdminRenderSystem.class.php and css.php patched for this preload
( anyway....they will work well without this preload!
I mean they will work properly with no problem even after uninstalling/deleting this preload!
^^;; I patched those in XOOPS Cube Legacy 2.1.1
)
2) AdminBlockPlusPreload.class.php which is necessary for adding any block to left-column of admin-section.
Please refer to the topic,"AdminBlockPlusPreload for XC Legacy"!
##########

----------------------
How to customize
------------------------
Please refer to comments in AdminThemeSelectPreload.class.php

-------------
How to install
-------------

1) to install preload
Copy
AdminThemeSelectPreload.class.php into /html/modules/legacy/admin/preload/
AdminBlockPlusPreload.class.php into /html/modules/legacy/admin/preload/
like this.
( ex:
/html/modules/legacy/admin/preload/AdminThemeSelectPreload.class.php
/html/modules/legacy/admin/preload/AdminBlockPlusPreload.class.php
)

2) to install files related with block
/html/modules/legacy/admin/blocks/AdminThemeSelect.class.php
/html/modules/legacy/admin/templates/blocks/legacy_admin_block_themes.html

3) to overwrite with patched files
/html/modules/legacyRender/kernel/Legacy_AdminRenderSystem.class.php
/html/modules/legacyRender/admin/css.php (just for bug fix)

4)
That's all^^;;

-----------------
How to uninstall
-----------------
1) to uninstall preload
Just delete AdminThemeSelectPreload.class.php

2) to uninstall files related with block
Just delete newly-added files!

3) replace patched files with original files if you want to

4) That's all^^;;


-------------------
AdminThemeSelectPreload.class.php (ver1.0)

Download it here!
http://www.wanisys.net/data/adminthemechanger.zip

<?php
/**
 AdminThemeSelect Preload version 1.0 by wanikoo
 ( http://www.wanisys.net/ )
*/

if (!defined('XOOPS_ROOT_PATH')) exit();

class Legacy_AdminThemeSelectPreload extends XCube_ActionFilter
{

	var $mSelectableAdminTheme = array();
	
	function Legacy_AdminThemeSelectPreload(&$controller)
	{
		//You can specify $this->mSelectableAdminTheme here if you want to 
		//$this->mSelectableAdminTheme = array('admin_blue', 'admin_red');

		//if you didn't specify $this->mSelectableAdminTheme above,
		//it will list up admin_themes automatically
		//dirname of admin_theme must start with "admin_" like admin_red
		//ex) html/theme/admin_red
		//As you know, dirname, "admin" (html/theme/admin/ ) is reserved and used to override default admin-theme!  
		if ( empty($this->mSelectableAdminTheme) ) {
		$results = array();
		if ($handler = opendir(XOOPS_THEME_PATH)) {
			while (($dirname = readdir($handler)) !== false) {
				if ($dirname == "." || $dirname == "..") {
					continue;
				}
				if ( !preg_match("/^admin_/i", $dirname)) {
					continue;
				}				
				$themeDir = XOOPS_THEME_PATH . "/" . $dirname;
				if (is_dir($themeDir)) {
						if (file_exists($themeDir . "/admin_theme.html")) {
							$results[] = $dirname;
						}					
				}
			}
			closedir($handler);
		}
		$this->mSelectableAdminTheme = $results;
		}//empty
	$GLOBALS['xcadmintheme_allowed'] = $this->mSelectableAdminTheme;
	}
	
	function postFilter()
	{
		$xcadmintheme = "";
		if (!empty($_POST['admin_theme_select']) && trim($_POST['admin_theme_select']) !='default' && in_array($_POST['admin_theme_select'], $this->mSelectableAdminTheme)) {
       		$xcadmintheme  = $_POST['admin_theme_select'];
       		$_SESSION['XCAdminTheme'] = $_POST['admin_theme_select'];
		}
		elseif ( !empty($_POST['admin_theme_select']) && trim($_POST['admin_theme_select']) =='default' ) {
		//default admin-theme
		//as you know, you can also override it like this!
		//html/theme/admin/*.*
       		$xcadmintheme  = "";
       		$_SESSION['XCAdminTheme'] = "";
		}
		elseif (!empty($_SESSION['XCAdminTheme']) && in_array($_SESSION['XCAdminTheme'], $this->mSelectableAdminTheme)) {
       		$xcadmintheme  = $_SESSION['XCAdminTheme'];
		}
		$GLOBALS['xcadmintheme'] = $xcadmintheme;
	}	
	
}

?>


PS:
Umm...
Still..I am not good at Xoops Cube.
So...I can't guarantee this hack..^^;;
( Tested on XOOPS Cube Legacy 2.1.1 )

------------
^^;;

from wanikoo


----------------
the most educational site, wanisys.net
XOOPS Cube Korean Support Site !!

Marijuana
Posted on: 2007/6/20 19:20
Just popping in
Joined: 2006/11/30
From:
Posts: 4
Re: Admin-Theme Changer Preload for XC Legacy
Hi wanikoo.

It made it by the module without Coahaccing it the same function.
Download

But mysite is access limitation on some countries.
Here when it is not good
gigamaster
Posted on: 2007/6/21 7:30
Home away from home
Joined: 2005/12/30
From: Switzerland
Posts: 1227
Re: Admin-Theme Changer Preload for XC Legacy

Thank you !
These solutions are a really great user interface improvement.
And we, as end-users, we are free to choose from a personalized preload
and a click and go module installation.

I've tested the preload and the module, and both do the job perfectly!




P.S. Close Sourceforge Tracker task!


----------------
Xoops Cube Support

MAC OSX - Apache 2.2 - MySQL 5.5 - PHP 5.3
Free BSD - Apache 2.2 - MySQL 5.5 - PHP 5.2

Marijuana
Posted on: 2007/6/21 10:42
Just popping in
Joined: 2006/11/30
From:
Posts: 4
Re: Admin-Theme Changer Preload for XC Legacy
Because it becomes distinction difficult with general theme and admin theme,
inside module the theme directory the one which can be given is good?


The language file was forgotten.
admintheme/language/english/admin.php
<?php
define('_AD_ADMINTHEME_NAME', 'Select AdminTheme');
?>


I'm sorry in unskilled English.
plusangel
Posted on: 2007/6/21 14:40
Home away from home
Joined: 2006/3/8
From: Athens, Greece
Posts: 237
Re: Admin-Theme Changer Preload for XC Legacy
A word of advice:

"Try the admin themes!Using either the preload or the the module!!!"

Very good job...if you don't, you miss a piece of the new XOOPS Cube age that we talking about!

Thanks Marijuana for your job.
We understand your english and we are happy to have you in our party!!!


----------------
Regards Angelos,

xoopsCube.gr, the greek support site!

plusangel
Posted on: 2007/6/21 15:13
Home away from home
Joined: 2006/3/8
From: Athens, Greece
Posts: 237
Re: Admin-Theme Changer Preload for XC Legacy
and as a welcome I added

-the admin.php file to the english language folder
-version number 0.1 instead of 0
-module image inside image folder

the modified version is available here!


----------------
Regards Angelos,

xoopsCube.gr, the greek support site!

wanikoo
Posted on: 2007/6/21 22:43
Home away from home
Joined: 2006/3/1
From: third rock from the sun
Posts: 323
Re: Admin-Theme Changer Preload for XC Legacy
Umm...
I think XC Legacy 2.2 should have/implement
1)management of admin-themes
2)admin-theme changer
3)more flexible and efficient management of admin-blocks
( ex:
AdminRenderSystem needs to be improved to handle side-blocks and center-blocks flexibly and efficiently at admin-section!)
)
Quote:

gigamaster wrote:
(from legacy forum of project page)
-Legacy need a rule to manage Admin themes-
....
If it is an Admin Theme, it should be hidden or not
selectable by user.
Because if an Admin theme is activated by user,
the front-end is broken.
....

I agree!
IMHO,
I think XC Legacy should have Naming-rule on Admin-Theme!
(ex:
If admin-theme have the prefix,"admin_", we can handle it and implement the feature(requested by gigamaster above) easily!
)

PS:
Umm...
anyway...
I plan to patch legacy/legacyRender module to make these features realized!

PS2:
Admin-Theme module of Marijuana is
GREAT!!!!!
^^//


----------------
the most educational site, wanisys.net
XOOPS Cube Korean Support Site !!

wanikoo
Posted on: 2007/6/22 6:09
Home away from home
Joined: 2006/3/1
From: third rock from the sun
Posts: 323
Re: Admin-Theme Changer Preload for XC Legacy
---------------------------------------------------------
AdminThemeSelect Preload version 1.5 by wanikoo
( http://www.wanisys.net/ )
---------------------------------------------------------
( Tested on XOOPS Cube Legacy 2.1.1 )
---------------------------------------------------------
With this preload,
You can add "admin-theme changer block" to left-column of administration section!

PS:
As you know,
gigamaster, the admin of XC french support site
has already released three fantastic admin-themes for XC Legacy!
I really recommed you test this preload with his admin-themes!
ex)
1) download his admin-themes!
2) copy them like this!
/html/theme/admin_red/*.*
/html/theme/admin_blue/*.*
/html/theme/admin_orange/*.*
3) install this preload!
3) access admin-section!
And
you can see admin-theme changer block with 4 options!
( default, admin_red, admin_blue, admin_orange )
^^//

--------
change
--------
(Ver1.5)
1) Use of compile_id
To prevent admin-themes from conflicting each other
2) Taking advantage of $GLOBALS['xoopsRequestUri']
Now this theme changer will forward you to $GLOBALS['xoopsRequestUri'] when you select any theme!
*I borrowed this ideas from admin-theme module of Marijuana!
(Thanks^^//)
3) Code refined

--------
##NOTICE##
This preload package includes also
1) Legacy_AdminRenderSystem.class.php and css.php patched for this preload
( anyway....they will work well without this preload!
I mean they will work properly with no problem even after uninstalling/deleting this preload!
^^;; I patched those in XOOPS Cube Legacy 2.1.1
)
2) AdminBlockPlusPreload.class.php which is necessary for adding any block to left-column of admin-section.
Please refer to the topic,"AdminBlockPlusPreload for XC Legacy"!
##########

----------------------
How to customize
------------------------
Please refer to comments in AdminThemeSelectPreload.class.php

-------------
How to install
-------------

1) to install preload
Copy
AdminThemeSelectPreload.class.php into /html/modules/legacy/admin/preload/
AdminBlockPlusPreload.class.php into /html/modules/legacy/admin/preload/
like this.
( ex:
/html/modules/legacy/admin/preload/AdminThemeSelectPreload.class.php
/html/modules/legacy/admin/preload/AdminBlockPlusPreload.class.php
)

2) to install files related with block
/html/modules/legacy/admin/blocks/AdminThemeSelect.class.php
/html/modules/legacy/admin/templates/blocks/legacy_admin_block_themes.html

3) to overwrite with patched files
/html/modules/legacyRender/kernel/Legacy_AdminRenderSystem.class.php
/html/modules/legacyRender/admin/css.php (just for bug fix)

4)
That's all^^;;

-----------------
How to uninstall
-----------------
1) to uninstall preload
Just delete AdminThemeSelectPreload.class.php

2) to uninstall files related with block
Just delete newly-added files!

3) replace patched files with original files if you want to

4) That's all^^;;


-------------------
AdminThemeSelectPreload.class.php (ver1.5)

Download it here!
http://www.wanisys.net/data/adminthemechanger.zip

<?php
/**
 AdminThemeSelect Preload version 1.5 by wanikoo
 ( http://www.wanisys.net/ )
*/

if (!defined('XOOPS_ROOT_PATH')) exit();

class Legacy_AdminThemeSelectPreload extends XCube_ActionFilter
{

	var $mSelectableAdminTheme = array();
	
	function Legacy_AdminThemeSelectPreload(&$controller)
	{
		parent::XCube_ActionFilter($controller);

		//You can specify $this->mSelectableAdminTheme here if you want to 
		//$this->mSelectableAdminTheme = array('admin_blue', 'admin_red');

		//if you didn't specify $this->mSelectableAdminTheme above,
		//it will list up admin_themes automatically
		//dirname of admin_theme must start with "admin_" like admin_red
		//ex) html/theme/admin_red
		//As you know, dirname, "admin" (html/theme/admin/ ) is reserved and used to override default admin-theme!  
		if ( empty($this->mSelectableAdminTheme) ) {
		$results = array();
		if ($handler = opendir(XOOPS_THEME_PATH)) {
			while (($dirname = readdir($handler)) !== false) {
				if ($dirname == "." || $dirname == "..") {
					continue;
				}
				if ( !preg_match("/^admin_/i", $dirname)) {
					continue;
				}				
				$themeDir = XOOPS_THEME_PATH . "/" . $dirname;
				if (is_dir($themeDir)) {
						if (file_exists($themeDir . "/admin_theme.html")) {
							$results[] = $dirname;
						}					
				}
			}
			closedir($handler);
		}
		$this->mSelectableAdminTheme = $results;
		}//empty
	$GLOBALS['xcadmintheme_allowed'] = $this->mSelectableAdminTheme;
	}
	
	function postFilter()
	{
		$xcadmintheme = "";
		if (!empty($_POST['admin_theme_select']) && trim($_POST['admin_theme_select']) !='default' && in_array($_POST['admin_theme_select'], $this->mSelectableAdminTheme)) {
       		$xcadmintheme  = $_POST['admin_theme_select'];
       		$_SESSION['XCAdminTheme'] = $_POST['admin_theme_select'];
		$this->mController->executeForward($GLOBALS['xoopsRequestUri']);
		}
		elseif ( !empty($_POST['admin_theme_select']) && trim($_POST['admin_theme_select']) =='default' ) {
		//default admin-theme
		//as you know, you can also override it like this!
		//html/theme/admin/*.*
       		$xcadmintheme  = "";
       		$_SESSION['XCAdminTheme'] = "";
		$this->mController->executeForward($GLOBALS['xoopsRequestUri']);
		}
		elseif (!empty($_SESSION['XCAdminTheme']) && in_array($_SESSION['XCAdminTheme'], $this->mSelectableAdminTheme)) {
       		$xcadmintheme  = $_SESSION['XCAdminTheme'];
		}
		$GLOBALS['xcadmintheme'] = $xcadmintheme;
	}	
	
}

?>


PS2:
As you know,
this admin-theme changer uses $_SESSION to store the value of admin-theme(selected by you) unlike admin-theme module of Marijuana which uses DB to store it!
Umm...
And
You can't use both of this and admin-theme module of Marijuana at the same time
because the latter uses its own AdminRenderSystem!
^^//
Merit and Demerit per each

PS3:
Anyway...
I think base-module of XC Legacy should have this feature at last!
Not any preload or any third-party module!

PS:
Umm...
Still..I am not good at Xoops Cube.
So...I can't guarantee this hack..^^;;
( Tested on XOOPS Cube Legacy 2.1.1 )

------------
^^;;

from wanikoo


----------------
the most educational site, wanisys.net
XOOPS Cube Korean Support Site !!

Marijuana
Posted on: 2007/6/22 12:38
Just popping in
Joined: 2006/11/30
From:
Posts: 4
Re: Admin-Theme Changer Preload for XC Legacy
I think that I need not have it in the core.
Rewriting the admin menu is possible even by a present core.
I think that the user who wants frequently to change the theme by the admin menu unlike a general menu is few.
It ends if the requiring user installs the module because it can correspond enough by the module.
I want the mechanism that Rendersystem can be easily changed from the outside without doing override from it to some degree.
In the Analyzer for XC module that I am making, the fraud is done by the admin menu and the theme of the admin menu is rewritten. It is only for the admin menu of this module.
If admin/index.php is seen, doing fraudulent solves and thinks of though is a module for only Japanese.

I made this module because of thinking the preload of wanikoo to be wonderful.
The reason for the regrettable one is however that there is a doubt in the method of adding the block in core Huck necessary and the admin menu.

Legacy_AdminControllerStrategy::setupBlock, Derigat of Legacy_AdminControllerStrategy.SetupBlock is executed.
Naturally, it is thought that execution with Derigat is an original way though it is possible to put directly in $root->mController->_mBlockChain[].


P.S.
Thanks plusangel for following.
Greek was made to be displayed only a little on my site.
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 

Who's Online
10 user(s) are online (7 user(s) are browsing Forums)

Members: 0
Guests: 10

more...

Welcome | News | Overview | Documentation | Forum | Tutorialstop
Brasilian | French | German | Greek | Japanese | Korean | Russian | T-Chinese
Powered by XOOPS Cube © 2001-2011 The XOOPS Cube Project