[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] sitemgr inc/class.Common_UI.inc.php inc/class.S... [s
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] sitemgr inc/class.Common_UI.inc.php inc/class.S... [skwashd-16-compat] |
Date: |
Tue, 09 May 2006 05:04:50 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: sitemgr
Branch: skwashd-16-compat
Changes by: Dave Hall <address@hidden> 06/05/09 05:04:50
Modified files:
inc : class.Common_UI.inc.php class.Sites_UI.inc.php
inc/api : class.richtext.inc.php
templates/default: listsites.tpl
Log message:
more tweaks
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sitemgr/inc/class.Common_UI.inc.php.diff?only_with_tag=skwashd-16-compat&tr1=1.8.2.5&tr2=1.8.2.5.4.1&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sitemgr/inc/class.Sites_UI.inc.php.diff?only_with_tag=skwashd-16-compat&tr1=1.6.2.1&tr2=1.6.2.1.4.1&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sitemgr/inc/api/class.richtext.inc.php.diff?only_with_tag=skwashd-16-compat&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sitemgr/templates/default/listsites.tpl.diff?only_with_tag=skwashd-16-compat&tr1=1.2.2.1&tr2=1.2.2.1.4.1&r1=text&r2=text
Patches:
Index: sitemgr/inc/api/class.richtext.inc.php
diff -u sitemgr/inc/api/class.richtext.inc.php:1.1.2.1
sitemgr/inc/api/class.richtext.inc.php:1.1.2.2
--- sitemgr/inc/api/class.richtext.inc.php:1.1.2.1 Mon Mar 27 13:13:24 2006
+++ sitemgr/inc/api/class.richtext.inc.php Tue May 9 05:04:50 2006
@@ -9,7 +9,7 @@
* @license http://www.fsf.org/licenses/gpl.html GNU General Public
License
* @package phpgwapi
* @subpackage gui
- * @version $Id: class.richtext.inc.php,v 1.1.2.1 2006/03/27 13:13:24
skwashd Exp $
+ * @version $Id: class.richtext.inc.php,v 1.1.2.2 2006/05/09 05:04:50
skwashd Exp $
*/
//This is done here for 16 support
@@ -52,7 +52,6 @@
$GLOBALS['phpgw']->js =
createObject('phpgwapi.javascript');
}
$this->_init_head();
- $GLOBALS['phpgw']->js->validate_file('jscalendar',
'calendar_stripped');
}
/**
Index: sitemgr/inc/class.Common_UI.inc.php
diff -u /dev/null sitemgr/inc/class.Common_UI.inc.php:1.8.2.5.4.1
--- /dev/null Tue May 9 05:04:50 2006
+++ sitemgr/inc/class.Common_UI.inc.php Tue May 9 05:04:50 2006
@@ -0,0 +1,442 @@
+<?php
+
/***************************************************************************\
+ * http://www.phpgroupware.org
*
+ * -------------------------------------------------
*
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by the
*
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\***************************************************************************/
+ /* $Id: class.Common_UI.inc.php,v 1.8.2.5.4.1 2006/05/09 05:04:50
skwashd Exp $ */
+
+ class Common_UI
+ {
+ var $t;
+ var $acl;
+ var $theme;
+ var $do_sites_exist;
+ var $menu;
+
+ /**
+ * @var bool $header_included makes sure the phpgw header
doesn't get included twice
+ */
+ var $header_included = false;
+
+ /**
+ * @var array $public_functions the publicly accessible methods
of this class
+ */
+ var $public_functions = array
+ (
+ 'DisplayPrefs' => True,
+ 'DisplayMenu' => True
+ );
+
+ function Common_UI()
+ {
+ global $Common_BO;
+ $Common_BO = CreateObject('sitemgr.Common_BO');
+ $this->do_sites_exist =
$Common_BO->sites->set_currentsite(False,'Administration');
+ $this->t = $GLOBALS['phpgw']->template;
+ $this->acl = &$Common_BO->acl;
+ $this->theme = &$Common_BO->theme;
+ $this->pages_bo = &$Common_BO->pages;
+ $this->cat_bo = &$Common_BO->cats;
+ $Common_BO->set_menus();
+ }
+
+
+ function DisplayMenu()
+ {
+ $this->DisplayHeader();
+ $this->t->set_file('MainMenu','mainmenu.tpl');
+ $this->t->set_block('MainMenu','switch','switchhandle');
+ $this->t->set_block('MainMenu','menuentry','entry');
+ $this->t->set_var('lang_sitemenu',lang('Website') . ' '
. $GLOBALS['Common_BO']->sites->current_site['site_name']);
+ reset($GLOBALS['Common_BO']->sitemenu);
+ foreach($GLOBALS['Common_BO']->sitemenu as $ignored =>
$values)
+ {
+ if ($values['text'] == '_NewLine_')
+ {
+ continue;
+ }
+
$this->t->set_var(array('value'=>$values['url'],'display'=>lang($values['text'])));
+ $this->t->parse('sitemenu','menuentry', true);
+ }
+ if ($GLOBALS['Common_BO']->othermenu)
+ {
+ $this->t->set_var('lang_othermenu',lang('Other
websites'));
+ reset($GLOBALS['Common_BO']->othermenu);
+ foreach($GLOBALS['Common_BO']->othermenu as
$ignored => $values)
+ {
+ if ($values['text'] == '_NewLine_')
+ {
+ continue;
+ }
+
$this->t->set_var(array('value'=>$values['url'],'display'=>lang($values['text'])));
+
$this->t->parse('othermenu','menuentry', true);
+ }
+ $this->t->parse('switchhandle','switch');
+ }
+ else
+ {
+
$this->t->set_var('switchhandle','testtesttest');
+ }
+ $this->t->pfp('out','MainMenu');
+ $this->DisplayFooter();
+ }
+
+
+ function DisplayPrefs()
+ {
+ $this->DisplayHeader();
+ if ($this->acl->is_admin())
+ {
+ if ($_POST['btnlangchange'])
+ {
+ echo '<p>';
+ while (list($oldlang,$newlang) =
each($_POST['change']))
+ {
+ if ($newlang == "delete")
+ {
+ echo '<b>' .
lang('Deleting all data for %1',$GLOBALS['Common_BO']->getlangname($oldlang)) .
'</b><br>';
+
$this->pages_bo->removealllang($oldlang);
+
$this->cat_bo->removealllang($oldlang);
+ }
+ else
+ {
+ echo '<b>' .
lang('Migrating data for %1 to %2',
+
$GLOBALS['Common_BO']->getlangname($oldlang),
+
$GLOBALS['Common_BO']->getlangname($newlang)) .
+ '</b><br>';
+
$this->pages_bo->migratealllang($oldlang,$newlang);
+
$this->cat_bo->migratealllang($oldlang,$newlang);
+ }
+ }
+ echo '</p>';
+ }
+
+ if ($_POST['btnSave'])
+ {
+ $oldsitelanguages =
$GLOBALS['Common_BO']->sites->current_site['site_languages'];
+
+ $langs = @explode(',',
$_POST['pref']['site_languages']);
+ if(is_array($langs))
+ {
+ foreach($langs as $id => $lang)
+ {
+ $langs[$id] =
trim($lang);
+ }
+ $langs = implode(',', $langs);
+ }
+ else
+ {
+ trim($langs);
+ }
+ $_POST['pref']['site_languages'] =
$langs;
+ unset($langs);
+
+ if ($oldsitelanguages &&
($oldsitelanguages != $_POST['pref']['site_languages']))
+ {
+ $oldsitelanguages =
explode(',',$oldsitelanguages);
+ $newsitelanguages =
explode(',',$_POST['pref']['site_languages']);
+ $replacedlang =
array_diff($oldsitelanguages,$newsitelanguages);
+ $addedlang =
array_diff($newsitelanguages,$oldsitelanguages);
+ if ($replacedlang)
+ {
+ echo lang('You removed
one ore more languages from your site languages.') . '<br>' .
+ lang('What do you want
to do with existing translations of categories and pages for this language?') .
'<br>';
+ if ($addedlang)
+ {
+ echo lang('You
can either migrate them to a new language or delete them') . '<br>';
+ }
+ else
+ {
+ echo lang('Do
you want to delete them?'). '<br>';
+ }
+ echo '<form action="' .
+
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Common_UI.DisplayPrefs')
.
+ '"
method="post"><table>';
+ foreach ($replacedlang
as $oldlang)
+ {
+ $oldlangname =
$GLOBALS['Common_BO']->getlangname($oldlang);
+ echo "<tr><td>"
. $oldlangname . "</td>";
+ if ($addedlang)
+ {
+ foreach
($addedlang as $newlang)
+ {
+
echo '<td><input type="radio" name="change[' . $oldlang .
+
']" value="' . $newlang . '"> Migrate to ' .
+
$GLOBALS['Common_BO']->getlangname($newlang) . "</td>";
+ }
+ }
+ echo
'<td><input type="radio" name="change[' . $oldlang . ']" value="delete">
delete</td></tr>';
+ }
+ echo '<tr><td><input
type="submit" name="btnlangchange" value="' .
+ lang('Submit') .
'"></td></tr></table></form>';
+ }
+ }
+
+ $oldsitelanguages = $oldsitelanguages ?
explode(',',$oldsitelanguages) : array("en");
+
+
$GLOBALS['Common_BO']->sites->saveprefs($_POST['pref']);
+
+ echo '<p><b>' . lang('Changes Saved.')
. '</b></p>';
+ }
+
+ foreach
($GLOBALS['Common_BO']->sites->current_site['sitelanguages'] as $lang)
+ {
+ $langname =
$GLOBALS['Common_BO']->getlangname($lang);
+ $preferences['site_name_' . $lang] =
array(
+ 'title'=>lang('Site name'). ' '
. $langname,
+ 'note'=>lang('This is used
chiefly for meta data and the title bar. If you change the site languages below
you have to save before being able to set this preference for a new language.'),
+ 'default'=>lang('New sitemgr
site')
+ );
+ $preferences['site_desc_' . $lang] =
array(
+ 'title'=>lang('Site
description'). ' ' . $langname,
+ 'note'=>lang('This is used
chiefly for meta data. If you change the site languages below you have to save
before being able to set this preference for a new language.'),
+ 'input'=>'textarea'
+ );
+ }
+
+ $preferences['home_page_id'] = array(
+ 'title'=>lang('Default home page ID
number'),
+ 'note'=>lang('This should be a page
that is readable by everyone. If you leave this blank, the site index will be
shown by default.'),
+ 'input'=>'option',
+
'options'=>$this->pages_bo->getPageOptionList()
+ );
+ $preferences['themesel'] = array(
+ 'title'=>lang('Template select'),
+ 'note'=>lang('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'
+ );
+ $preferences['site_languages'] = array(
+ 'title'=>lang('Languages the site user
can choose from'),
+ 'note'=>lang('This should be a
comma-separated list of language-codes.'),
+ 'default'=>'en'
+ );
+
+
$this->t->set_file('sitemgr_prefs','sitemgr_preferences.tpl');
+
$this->t->set_var('formaction',$GLOBALS['phpgw']->link(
+
'/index.php','menuaction=sitemgr.Common_UI.DisplayPrefs'));
+ $this->t->set_var(Array('setup_instructions' =>
lang('SiteMgr Setup Instructions'),
+ 'options' =>
lang('SiteMgr Options'),
+ 'lang_save' =>
lang('Save'),
+ 'lang_subdir' =>
lang('There are two subdirectories off of your sitemgr directory that you
should move before you do anything else. You don\'t <i>have</i> to move either
of these directories, although you will probably want to.'),
+ 'lang_first_directory'
=> lang('The first directory to think about is sitemgr-link. If you move this
to the parent directory of sitemgr (your phpgroupware root directory) then you
can use setup to install the app and everyone with access to the app will get
an icon on their navbar that links them directly to the public web site. If
you don\'t want this icon, there\'s no reason to ever bother with the
directory.'),
+ 'lang_second_directory'
=> lang('The second directory is the sitemgr-site directory. This can be moved
<i>anywhere</i>. It can also be named <i>anything</i>. Wherever it winds up,
when you point a web browser to it, you will get the generated website.
Assuming, of course, that you\'ve accurately completed the setup fields below
and also <b><i>edited the config.inc.php</i></b> file.'),
+ 'lang_edit_config_inc}'
=> lang('The config.inc.php file needs to be edited to point to the
phpGroupWare directory. Copy the config.inc.php.template file to config.inc.php
and then edit it.')
+ ));
+
+
$this->t->set_block('sitemgr_prefs','PrefBlock','PBlock');
+ reset($preferences);
+ while (list($name,$details) =
each($preferences))
+ {
+ $inputbox = '';
+ switch($details['input'])
+ {
+ case 'textarea':
+ $inputbox =
$this->inputtextarea($name);
+ break;
+ 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');
+ }
+ else
+ {
+ echo lang("You must be an administrator to
setup the Site Manager.") . "<br><br>";
+ }
+ $this->DisplayFooter();
+ }
+
+ function inputText($name='',$size=40,$default='')
+ {
+ if (!is_int($size))
+ {
+ $size=40;
+ }
+ $val =
$GLOBALS['Common_BO']->sites->current_site[$name];
+ if (!$val)
+ {
+ $val = $default;
+ }
+
+ return '<input type="text" size="'.$size.
+ '" name="pref['.$name.']" value="'.$val.'">';
+ }
+
+ function inputtextarea($name='',$cols=40,$rows=5,$default='')
+ {
+ $val =
$GLOBALS['Common_BO']->sites->current_site[$name];
+ if (!$val)
+ {
+ $val = $default;
+ }
+
+ return '<textarea cols="' . $cols . '" rows="' . $rows
.
+ '" name="pref['.$name.']">'.
$GLOBALS['phpgw']->strip_html($val).'</textarea>';
+ }
+
+ function inputCheck($name = '')
+ {
+ $val =
$GLOBALS['Common_BO']->sites->current_site[$name];
+ if ($val)
+ {
+ $checked_yes = ' CHECKED';
+ $checked_no = '';
+ }
+ else
+ {
+ $checked_yes = '';
+ $checked_no = ' CHECKED';
+ }
+ return '<INPUT TYPE="radio" NAME="pref['.$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 lang('No options available.');
+ }
+ $val =
$GLOBALS['Common_BO']->sites->current_site[$name];
+ if(!$val)
+ {
+ $val = $default;
+ }
+ $returnValue = '<SELECT NAME="pref['.$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;
+ }
+
+ function PrefBlock($title,$input,$note)
+ {
+ //$this->t->set_var('PBlock','');
+ $this->t->set_var('pref-title',$title);
+ $this->t->set_var('pref-input',$input);
+ $this->t->set_var('pref-note',$note);
+ $this->t->parse('PBlock','PrefBlock',true);
+ }
+
+ function DisplayHeader()
+ {
+ if ( $this->header_included )
+ {
+ return false;//already done
+ }
+
+ $this->header_included = true;
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
$GLOBALS['phpgw_info']['apps']['sitemgr']['title'];
+
+ if ($this->do_sites_exist)
+ {
+ if
($GLOBALS['phpgw_info']['server']['template_set'] == 'idots')
+ {
+
$GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ return true;
+ }
+
$this->t->set_file('sitemgr_header','sitemgr_header.tpl');
+
$this->t->set_block('sitemgr_header','switch','switchhandle');
+
$this->t->set_var('menulist',$this->menuselectlist());
+ if ($GLOBALS['Common_BO']->othermenu)
+ {
+
$this->t->set_var('sitelist',$this->siteselectlist());
+
$this->t->parse('switchhandle','switch');
+ }
+ else
+ {
+ $this->t->set_var('switchhandle','');
+ }
+ $GLOBALS['phpgw_info']['flags']['app_header']
.= $this->t->parse('out','sitemgr_header');
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ }
+ else
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ echo lang('No websites defined');
+ $GLOBALS['phpgw']->common->phpgw_exit(True);
+ }
+ }
+
+ function DisplayFooter()
+ {
+
$this->t->set_file('sitemgr_footer','sitemgr_footer.tpl');
+ $this->t->pfp('out','sitemgr_footer');
+ }
+
+ function siteselectlist()
+ {
+ $selectlist= '<option>' . lang('Other websites') .
'</option>';
+ if(!is_array($GLOBALS['Common_BO']->othermenu))
+ {
+ return $selectlist;
+ }
+
+ foreach($GLOBALS['Common_BO']->othermenu as $ign =>
$values)
+ {
+ if ($values['text'] == '_NewLine_')
+ {
+ continue;
+ }
+ else
+ {
+ $selectlist .= '<option
onClick="location.href=this.value" value="' . $values['url'] . '">' .
lang($values['text']) . '</option>' . "\n";
+ }
+ }
+ return $selectlist;
+ }
+
+ function menuselectlist()
+ {
+ $selectlist= '<option>' . lang('Website') . ' ' .
$GLOBALS['Common_BO']->sites->current_site['site_name'] . '</option>';
+ if(!is_array($GLOBALS['Common_BO']->sitemenu))
+ {
+ return $selectlist;
+ }
+
+ foreach($GLOBALS['Common_BO']->sitemenu as $ign =>
$values)
+ {
+ if ($values['text'] == '_NewLine_')
+ {
+ continue;
+ }
+ $selectlist .= '<option
onClick="location.href=this.value" value="' . $values['url'] . '">' .
lang($values['text']) . '</option>' . "\n";
+ }
+ return $selectlist;
+ }
+ }
+?>
Index: sitemgr/inc/class.Sites_UI.inc.php
diff -u /dev/null sitemgr/inc/class.Sites_UI.inc.php:1.6.2.1.4.1
--- /dev/null Tue May 9 05:04:50 2006
+++ sitemgr/inc/class.Sites_UI.inc.php Tue May 9 05:04:50 2006
@@ -0,0 +1,306 @@
+<?php
+ /**************************************************************************\
+ * phpGroupWare - phpgroupware SiteMgr *
+ * http://www.phpgroupware.org *
+ * ----------------------------------------------- *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version. *
+ \**************************************************************************/
+
+ /* $Id: class.Sites_UI.inc.php,v 1.6.2.1.4.1 2006/05/09 05:04:50 skwashd Exp
$ */
+
+ //copied from class admin.uiservers
+ class Sites_UI
+ {
+ var $common_ui;
+ var $public_functions = array(
+ 'list_sites' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ var $start = 0;
+ var $query = '';
+ var $sort = '';
+ var $order = '';
+
+ var $debug = False;
+
+ var $bo = '';
+ var $nextmatchs = '';
+
+ function Sites_UI()
+ {
+ $this->common_ui =
CreateObject('sitemgr.Common_UI',True);
+ $this->bo = &$GLOBALS['Common_BO']->sites;
+ $this->nextmatchs = createobject('phpgwapi.nextmatchs');
+
+ $this->start = $this->bo->start;
+ $this->query = $this->bo->query;
+ $this->order = $this->bo->order;
+ $this->sort = $this->bo->sort;
+ if($this->debug) { $this->_debug_sqsof(); }
+ /* _debug_array($this); */
+ }
+
+ function _debug_sqsof()
+ {
+ $data = array(
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order
+ );
+ echo '<br>UI:';
+ _debug_array($data);
+ }
+
+ function save_sessiondata()
+ {
+ $data = array(
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function list_sites()
+ {
+ $this->common_ui->DisplayHeader();
+
+ if (!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
+ {
+ $this->deny();
+ }
+
+
$GLOBALS['phpgw']->template->set_file(array('site_list_t' => 'listsites.tpl'));
+
$GLOBALS['phpgw']->template->set_block('site_list_t','site_list','list');
+
+
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.edit'));
+
$GLOBALS['phpgw']->template->set_var('lang_add',lang('Add'));
+
$GLOBALS['phpgw']->template->set_var('title_sites',lang('Sitemgr Websites'));
+
$GLOBALS['phpgw']->template->set_var('lang_search',lang('Search'));
+
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.list_sites'));
+
$GLOBALS['phpgw']->template->set_var('lang_done',lang('Done'));
+
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/admin/index.php'));
+
+ if(!$this->start)
+ {
+ $this->start = 0;
+ }
+
+ $this->save_sessiondata();
+ $sites = $this->bo->list_sites();
+
+ $left =
$this->nextmatchs->left('/index.php',$this->start,$this->bo->total,'menuaction=sitemgr.Sites_UI.list_sites');
+ $right =
$this->nextmatchs->right('/index.php',$this->start,$this->bo->total,'menuaction=sitemgr.Sites_UI.list_sites');
+
+ $GLOBALS['phpgw']->template->set_var(array
+ (
+ 'left' => $left,
+ 'right' => $right,
+ 'lang_showing' =>
$this->nextmatchs->show_hits($this->bo->total,$this->start),
+ 'lang_edit' => lang('Edit'),
+ 'lang_delete' => lang('Delete'),
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(
+
$this->sort,'site_name',$this->order,'/index.php',lang('Name'),'&menuaction=sitemgr.Sites_UI.list_sites'
+ ),
+ 'sort_url' =>
$this->nextmatchs->show_sort_order(
+
$this->sort,'site_url',$this->order,'/index.php',lang('URL'),'&menuaction=sitemgr.Sites_UI.list_sites'
+ )
+ ));
+
+ while(list($site_id,$site) = @each($sites))
+ {
+ $tr_color =
$this->nextmatchs->alternate_row_color($tr_color);
+
+ $GLOBALS['phpgw']->template->set_var(array(
+ 'tr_color' => $tr_color,
+ 'site_name' =>
$GLOBALS['phpgw']->strip_html($site['site_name']),
+ 'site_url' => $site['site_url'],
+ 'edit' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.edit&site_id='
. $site_id),
+ 'lang_edit_entry' => lang('Edit'),
+ 'delete' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.delete&site_id='
. $site_id),
+ 'lang_delete_entry' => lang('Delete')
+ ));
+
$GLOBALS['phpgw']->template->parse('list','site_list', true);
+ }
+
+ $GLOBALS['phpgw']->template->parse('out','site_list_t',
true);
+ $GLOBALS['phpgw']->template->p('out');
+ $this->common_ui->DisplayFooter();
+ }
+
+ /* This function handles add or edit */
+ function edit()
+ {
+ if ($_POST['done'])
+ {
+ return $this->list_sites();
+ }
+ $this->common_ui->DisplayHeader();
+
+ if (!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
+ {
+ $this->deny();
+ }
+ if ($_POST['delete'])
+ {
+ return $this->delete();
+ }
+
+ $site_id = get_var('site_id',array('POST','GET'));
+
+ $GLOBALS['phpgw']->template->set_file(array('form' =>
'site_form.tpl'));
+
$GLOBALS['phpgw']->template->set_block('form','add','addhandle');
+
$GLOBALS['phpgw']->template->set_block('form','edit','edithandle');
+
+ if ($_POST['save'])
+ {
+ if (!$_POST['site']['name'])
+ {
+
$GLOBALS['phpgw']->template->set_var('message',lang('Please enter a name for
that site !'));
+ }
+ elseif ($site_id)
+ {
+
$this->bo->update($site_id,$_POST['site']);
+
$GLOBALS['phpgw']->template->set_var('message',lang('Site %1 has been
updated',$_POST['site']['_name']));
+ }
+ else
+ {
+ $site_id =
$this->bo->add($_POST['site']);
+
$GLOBALS['phpgw']->template->set_var('message',lang('Site %1 has been
added',$_POST['site']['_name']));
+ }
+ }
+ else
+ {
+
$GLOBALS['phpgw']->template->set_var('message','');
+ }
+ if ($site_id)
+ {
+ $site = $this->bo->read($site_id);
+ }
+
+
$GLOBALS['phpgw']->template->set_var('title_sites',$site_id ? lang('Edit
Website') : lang('Add Website'));
+
+
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.edit'));
+
+ $GLOBALS['phpgw']->template->set_var(array(
+ 'lang_name' => lang('Site name'),
+ 'lang_sitedir' => lang('Filesystem path to
sitemgr-site directory'),
+ 'lang_siteurl' => lang('URL to sitemgr-site'),
+ 'lang_anonuser' => lang('Anonymous user\'s
username'),
+ 'lang_anonpasswd' => lang('Anonymous user\'s
password'),
+ 'note_name' => lang('This is only used as an
internal name for the website.'),
+ 'note_dir' => lang('This must be an absolute
directory location. <b>No trailing slash</b>.'),
+ 'note_url' => lang('The URL must be absolute
and end in a slash, for example http://mydomain.com/mysite/'),
+ 'note_anonuser' => lang('If you haven\'t done
so already, create a user that will be used for public viewing of the site.
Recommended name: anonymous.'),
+ 'note_anonpasswd' => lang('Password that you
assigned for the anonymous user account.'),
+ 'note_adminlist' => lang('Select persons and
groups that are entitled to configure the website.')
+ ));
+
+
$GLOBALS['phpgw']->template->set_var('lang_adminlist',lang('Site
administrators'));
+
$GLOBALS['phpgw']->template->set_var('lang_save',lang('Save'));
+
$GLOBALS['phpgw']->template->set_var('lang_add',lang('Add'));
+
$GLOBALS['phpgw']->template->set_var('lang_default',lang('Default'));
+
$GLOBALS['phpgw']->template->set_var('lang_reset',lang('Clear Form'));
+
$GLOBALS['phpgw']->template->set_var('lang_done',lang('Cancel'));
+
$GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete'));
+
+ $GLOBALS['phpgw']->template->set_var(array(
+ 'site_name' => $site['site_name'],
+ 'site_dir' => $site['site_dir'],
+ 'site_url' => $site['site_url'],
+ 'site_anonuser' => $site['anonymous_user'],
+ 'site_anonpasswd' => $site['anonymous_passwd']
+ ));
+
$GLOBALS['phpgw']->template->set_var('site_adminlist',$this->adminselectlist($site_id));
+
$GLOBALS['phpgw']->template->set_var('site_id',$site_id);
+
+ $GLOBALS['phpgw']->template->set_var(array(
+ 'th' =>
$GLOBALS['phpgw_info']['theme']['th_bg'],
+ 'row_on' =>
$GLOBALS['phpgw_info']['theme']['row_on'],
+ 'row_off' =>
$GLOBALS['phpgw_info']['theme']['row_off']
+ ));
+ if ($site_id)
+ {
+
$GLOBALS['phpgw']->template->parse('edithandle','edit');
+
$GLOBALS['phpgw']->template->set_var('addhandle','');
+ }
+ else
+ {
+
$GLOBALS['phpgw']->template->set_var('edithandle','');
+
$GLOBALS['phpgw']->template->parse('addhandle','add');
+ }
+
$GLOBALS['phpgw']->template->pparse('phpgw_body','form');
+ $this->common_ui->DisplayFooter();
+
+ }
+
+ function adminselectlist($site_id)
+ {
+ $accounts = $GLOBALS['phpgw']->accounts->get_list();
+ $admin_list = $this->bo->get_adminlist($site_id);
+
+ while (list($null,$account) = each($accounts))
+ {
+ $selectlist .= '<option value="' .
$account['account_id'] . '"';
+ if($admin_list[$account['account_id']] ==
SITEMGR_ACL_IS_ADMIN)
+ {
+ $selectlist .= ' selected="selected"';
+ }
+ $selectlist .= '>' .
$account['account_firstname'] . ' ' . $account['account_lastname']
+
. ' [ ' . $account['account_lid'] . ' ]' . '</option>' . "\n";
+ }
+ return $selectlist;
+ }
+
+ function delete()
+ {
+ if (!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ $this->deny();
+ }
+
+ $site_id = get_var('site_id',array('POST','GET'));
+ if ($_POST['yes'] || $_POST['no'])
+ {
+ if ($_POST['yes'])
+ {
+ $this->bo->delete($site_id);
+ }
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=sitemgr.Sites_UI.list_sites');
+ }
+ else
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+
+ $site = $this->bo->read($site_id);
+
+
$GLOBALS['phpgw']->template->set_file(array('site_delete' =>
'delete_common.tpl'));
+
+ $GLOBALS['phpgw']->template->set_var(array(
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.delete'),
+ 'hidden_vars' => '<input type="hidden"
name="site_id" value="' . $site_id .
'"><script>document.yesbutton.yesbutton.focus()</script>',
+ 'messages' => lang('Are you sure you
want to delete site %1 and all its content? You cannot retrieve it if you
continue.',$site['site_name']),
+ 'no' => lang('No'),
+ 'yes' => lang('Yes'),
+ ));
+
$GLOBALS['phpgw']->template->pparse('phpgw_body','site_delete');
+ }
+ }
+
+ function deny()
+ {
+ echo '<p><strong>'.lang('Access not
permitted').'</strong></p>';
+ $GLOBALS['phpgw']->common->phpgw_exit(True);
+ }
+ }
+?>
Index: sitemgr/templates/default/listsites.tpl
diff -u /dev/null sitemgr/templates/default/listsites.tpl:1.2.2.1.4.1
--- /dev/null Tue May 9 05:04:50 2006
+++ sitemgr/templates/default/listsites.tpl Tue May 9 05:04:50 2006
@@ -0,0 +1,49 @@
+ <table border="0" cellspacing="2" cellpadding="2">
+ <tr>
+ <td colspan="6" align="center" bgcolor="#c9c9c9"><b>{title_sites}<b/></td>
+ </tr>
+ <tr>
+ <td colspan="6" align="left">
+ <table border="0" width="100%">
+ <tr>
+ {left}
+ <td align="center">{lang_showing}</td>
+ {right}
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td colspan="6" align="right">
+ <form method="post" action="{actionurl}">
+ <input type="text" name="query"> <input type="submit" name="search"
value="{lang_search}"></form></td>
+ </tr>
+ <tr class="th">
+ <td>{sort_name}</td>
+ <td>{sort_url}</td>
+ <td align="center">{lang_edit}</td>
+ <td align="center">{lang_delete}</td>
+ </tr>
+
+<!-- BEGIN site_list -->
+ <tr bgcolor="{tr_color}">
+ <td>{site_name}</td>
+ <td>{site_url}</td>
+ <td align="center"><a href="{edit}">{lang_edit_entry}</a></td>
+ <td align="center"><a href="{delete}">{lang_delete_entry}</a></td>
+ </tr>
+<!-- END site_list -->
+
+<!-- BEGIN add -->
+</form>
+ <tr valign="bottom">
+ <td><form method="POST" action="{add_action}">
+ <input type="submit" name="add" value="{lang_add}"></form></td>
+ </form></td>
+ <td><form method="POST" action="{doneurl}">
+ <input type="submit" name="done" value="{lang_done}">
+ </form></td>
+ </tr>
+<!-- END add -->
+ </table>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sitemgr inc/class.Common_UI.inc.php inc/class.S... [skwashd-16-compat],
Dave Hall <=