[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: sitemgr/inc class.Common_UI.inc.php,1.4,1.5 clas
From: |
Patrick Walsh <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: sitemgr/inc class.Common_UI.inc.php,1.4,1.5 class.Theme_BO.inc.php,1.1.1.1,1.2 |
Date: |
Thu, 05 Sep 2002 02:54:52 -0400 |
Update of /cvsroot/phpgroupware/sitemgr/inc
In directory subversions:/tmp/cvs-serv15897/inc
Modified Files:
class.Common_UI.inc.php class.Theme_BO.inc.php
Log Message:
Added automatic theme selection stuff.
Index: class.Common_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_UI.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.Common_UI.inc.php 1 Sep 2002 04:24:27 -0000 1.4
--- class.Common_UI.inc.php 5 Sep 2002 06:54:50 -0000 1.5
***************
*** 14,17 ****
--- 14,18 ----
var $t;
var $acl;
+ var $theme;
var $prefs_so;
var $public_functions = array
***************
*** 24,27 ****
--- 25,29 ----
$this->t = $GLOBALS['phpgw']->template;
$this->acl = CreateObject('sitemgr.ACL_BO');
+ $this->theme = CreateObject('sitemgr.Theme_BO',True);
$this->prefs_so =
CreateObject('sitemgr.sitePreference_SO', True);
}
***************
*** 48,52 ****
'title'=>'Default home page ID number',
'note'=>'(This should be a page that is
readable by everyone. If you leave this blank, the site index will be shown by
default.)',
! 'size'=>10
);
$preferences['login-domain'] = array(
--- 50,54 ----
'title'=>'Default home page ID number',
'note'=>'(This should be a page that is
readable by everyone. If you leave this blank, the site index will be shown by
default.)',
! 'input_size'=>10
);
$preferences['login-domain'] = array(
***************
*** 65,71 ****
'default'=>'anonymous'
);
$preferences['themesel'] = array(
! 'title'=>'Theme select',
! 'note'=>'(Choose your site\'s them.
This corresponds to a subdirectory of sitemgr-site/themes. If you\'re not
sure, enter NukeNews. Case matters.)',
'default'=>'NukeNews'
);
--- 67,80 ----
'default'=>'anonymous'
);
+ $preferences['interface'] = array(
+ 'title'=>'Use phpNuke themes instead of
templates',
+ 'note'=>'(This is NOT recommended.)',
+ 'input'=>'checkbox'
+ );
$preferences['themesel'] = array(
! 'title'=>'Theme or template select',
! 'note'=>'(Choose your site\'s theme or
template. Note that if you changed the above checkbox you need to save before
choosing a theme or template.)',
! 'input'=>'option',
!
'options'=>$this->theme->getAvailableThemes(),
'default'=>'NukeNews'
);
***************
*** 79,83 ****
echo '<p><b>Changes Saved.</b></p>';
}
!
$this->t->set_file('sitemgr_prefs','sitemgr_preferences.tpl');
$this->t->set_var('formaction',$GLOBALS['phpgw']->link(
--- 88,92 ----
echo '<p><b>Changes Saved.</b></p>';
}
!
$this->t->set_file('sitemgr_prefs','sitemgr_preferences.tpl');
$this->t->set_var('formaction',$GLOBALS['phpgw']->link(
***************
*** 87,93 ****
while (list($name,$details) =
each($preferences))
{
! $this->PrefBlock($details['title'],
!
$this->inputtext($name,$details['size'],$details['default']),
! $details['note']);
}
$this->t->pfp('out','sitemgr_prefs');
--- 96,118 ----
while (list($name,$details) =
each($preferences))
{
! $inputbox = '';
! switch($details['input'])
! {
! case 'checkbox':
! $inputbox =
$this->inputCheck($name);
! break;
! case 'option':
! $inputbox =
$this->inputOption($name,
!
$details['options'],$details['default']);
! break;
! case 'inputbox':
! default:
! $inputbox =
$this->inputText($name,
!
$details['input_size'],$details['default']);
! }
! if ($inputbox)
! {
!
$this->PrefBlock($details['title'],$inputbox,$details['note']);
! }
}
$this->t->pfp('out','sitemgr_prefs');
***************
*** 114,117 ****
--- 139,189 ----
return '<input type="text" size="'.$size.
'" name="'.$name.'" value="'.$val.'">';
+ }
+
+ function inputCheck($name = '')
+ {
+ $val = $this->prefs_so->getPreference($name);
+ if ($val)
+ {
+ $checked_yes = ' CHECKED';
+ $checked_no = '';
+ }
+ else
+ {
+ $checked_yes = '';
+ $checked_no = ' CHECKED';
+ }
+ return '<INPUT TYPE="radio" NAME="'.$name.'" VALUE="1"'.
+ $checked_yes.'>Yes</INPUT>'."\n".
+ '<INPUT TYPE="radio" NAME="'.$name.'"
VALUE="0"'.
+ $checked_no.'>No</INPUT>'."\n";
+
+ }
+
+ function inputOption($name = '', $options='', $default = '')
+ {
+ if (!is_array($options) || count($options)==0)
+ {
+ return 'No options available.';
+ }
+ $val = $this->prefs_so->getPreference($name);
+ if(!$val)
+ {
+ $val = $default;
+ }
+ $returnValue = '<SELECT NAME="'.$name.'">'."\n";
+
+ foreach($options as $option)
+ {
+ $selected='';
+ if ($val == $option['value'])
+ {
+ $selected = 'SELECTED ';
+ }
+ $returnValue.='<OPTION
'.$selected.'VALUE="'.$option['value'].'">'.
+ $option['display'].'</OPTION>'."\n";
+ }
+ $returnValue .= '</SELECT>';
+ return $returnValue;
}
Index: class.Theme_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Theme_BO.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.Theme_BO.inc.php 29 Aug 2002 03:03:17 -0000 1.1.1.1
--- class.Theme_BO.inc.php 5 Sep 2002 06:54:50 -0000 1.2
***************
*** 14,31 ****
function setTheme($theme)
{
! if ($this->preferenceso->setPreference($theme))
! echo "theme set.";
! else
! echo "Error, theme not set.";
}
! function getTheme($theme)
{
! return $this->preferenceso->getPreference($theme);
}
! function getAvailableTheme()
{
! // TBD
}
--- 14,59 ----
function setTheme($theme)
{
! $this->preferenceso->setPreference('themesel',$theme);
}
! function getTheme()
{
! return $this->preferenceso->getPreference('themesel');
}
! function getAvailableThemes()
{
! $pref = CreateObject('sitemgr.sitePreference_SO', True);
! $sitemgr_dir = $pref->getPreference('sitemgr-site-dir');
! $themes = $pref->getPreference('interface');
! if ((int) $themes)
! {
! $interface = 'themes';
! }
! else
! {
! $interface = 'templates';
! }
! $dirname = $sitemgr_dir . '/' . $interface . '/';
! $result_array=array();
! @$handle=opendir($dirname);
!
! if ($handle)
! {
! while (($file = readdir($handle)) !== false)
! {
! if (substr($file,0,1)!='.' &&
strcmp($file,'index.html') != 0
! && strcmp($file,'CVS') != 0)
! {
!
$result_array[]=array('value'=>$file,'display'=>$file);
! }
! }
! }
! else
! {
! return array(array('value'=>'','display'=>'No
'.$interface.' found.'));
! }
! closedir($handle);
! return $result_array;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: sitemgr/inc class.Common_UI.inc.php,1.4,1.5 class.Theme_BO.inc.php,1.1.1.1,1.2,
Patrick Walsh <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/templates/NukeNews newsblock.tpl,NONE,1.1 main.tpl,1.1,1.2
- Next by Date:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-link/setup setup.inc.php,1.3,1.4
- Previous by thread:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/templates/NukeNews newsblock.tpl,NONE,1.1 main.tpl,1.1,1.2
- Next by thread:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-link/setup setup.inc.php,1.3,1.4
- Index(es):