[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: sitemgr/inc class.ManageTranslations_UI.inc.php,
From: |
Michael Totschnig <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: sitemgr/inc class.ManageTranslations_UI.inc.php,1.1,1.2 class.Admin_ManageCategories_UI.inc.php,1.5,1.6 class.Categories_BO.inc.php,1.4,1.5 class.Categories_SO.inc.php,1.10,1.11 class.Common_UI.inc.php,1.6,1.7 class.MainMenu_UI.inc.php,1.3,1.4 class.Page_SO.inc.php,1.3,1.4 class.Pages_BO.inc.php,1.2,1.3 class.Pages_SO.inc.php,1.8,1.9 class.admin_ManageSiteContent_UI.inc.php,1.1.1.1,1.2 class.contributor_ManagePage_UI.inc.php,1.7,1.8 class.headerFooter_BO.inc.php,1.1.1.1,1.2 |
Date: |
Thu, 05 Dec 2002 17:15:33 -0500 |
Update of /cvsroot/phpgroupware/sitemgr/inc
In directory subversions:/tmp/cvs-serv27375/inc
Modified Files:
class.Admin_ManageCategories_UI.inc.php
class.Categories_BO.inc.php class.Categories_SO.inc.php
class.Common_UI.inc.php class.MainMenu_UI.inc.php
class.Page_SO.inc.php class.Pages_BO.inc.php
class.Pages_SO.inc.php
class.admin_ManageSiteContent_UI.inc.php
class.contributor_ManagePage_UI.inc.php
class.headerFooter_BO.inc.php
Added Files:
class.ManageTranslations_UI.inc.php
Log Message:
bringing head up to sync with 0.9.14 branch
Index: class.Admin_ManageCategories_UI.inc.php
===================================================================
RCS file:
/cvsroot/phpgroupware/sitemgr/inc/class.Admin_ManageCategories_UI.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.Admin_ManageCategories_UI.inc.php 13 Sep 2002 21:07:34 -0000
1.5
--- class.Admin_ManageCategories_UI.inc.php 5 Dec 2002 22:15:00 -0000
1.6
***************
*** 18,21 ****
--- 18,23 ----
var $acl;
var $t;
+ var $preferenceso;
+ var $sitelanguages;
var $public_functions = array
***************
*** 29,39 ****
$this->cat_bo = CreateObject('sitemgr.Categories_BO',
True);
$this->acl = CreateObject('sitemgr.ACL_BO', True);
}
function _manageCategories()
{
global
$btnSaveCategory,$btnAddCategory,$btnEditCategory,$btnDelete,$btnPermission;
! global
$category_id,$catname,$catdesc,$catid,$sort_order,$parent;
global $groupaccessread, $groupaccesswrite,
$individualaccessread, $individualaccesswrite;
$common_ui = CreateObject('sitemgr.Common_UI',True);
--- 31,68 ----
$this->cat_bo = CreateObject('sitemgr.Categories_BO',
True);
$this->acl = CreateObject('sitemgr.ACL_BO', True);
+ $this->preferenceso =
CreateObject('sitemgr.sitePreference_SO', true);
+ $this->sitelanguages =
explode(',',$this->preferenceso->getPreference('sitelanguages'));
}
+ function globalize($varname)
+ {
+ if (is_array($varname))
+ {
+ foreach($varname as $var)
+ {
+ $GLOBALS[$var] = $_POST[$var];
+ }
+ }
+ else
+ {
+ $GLOBALS[$varname] = $_POST[$varname];
+ }
+ }
+
+ //this has to be moved somewhere else later
+ function getlangname($lang)
+ {
+ $GLOBALS['phpgw']->db->query("select lang_name from
languages where lang_id = '$lang'",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+ return $GLOBALS['phpgw']->db->f('lang_name');
+ }
+
function _manageCategories()
{
+
$this->globalize(array('btnSaveCategory','btnAddCategory','btnEditCategory','btnDelete','btnPermission','category_id','catname','catdesc','catid','sort_order','parent','parent_old','groupaccessread','groupaccesswrite','individualaccessread','individualaccesswrite','savelanguage'));
global
$btnSaveCategory,$btnAddCategory,$btnEditCategory,$btnDelete,$btnPermission;
! global
$category_id,$catname,$catdesc,$catid,$sort_order,$parent,$parent_old;
global $groupaccessread, $groupaccesswrite,
$individualaccessread, $individualaccesswrite;
+ global $savelanguage;
$common_ui = CreateObject('sitemgr.Common_UI',True);
***************
*** 42,46 ****
if (!$this->acl->is_admin())
{
! echo "You must be an admin to edit categories.";
$common_ui->DisplayFooter();
}
--- 71,75 ----
if (!$this->acl->is_admin())
{
! echo lang('You must be an admin to edit
categories.');
$common_ui->DisplayFooter();
}
***************
*** 73,81 ****
$groupaccess =
array_merge_recursive($groupaccessread, $groupaccesswrite);
$individualaccess =
array_merge_recursive($individualaccessread, $individualaccesswrite);
!
$this->cat_bo->saveCategoryInfo($catid, $catname, $catdesc, $sort_order,
$parent);
$this->cat_bo->saveCategoryPerms($catid, $groupaccess, $individualaccess);
}
!
$this->t->set_var('category_manager','Category Manager');
$this->t->set_file('ManageCategories',
'manage_categories.tpl');
$this->t->set_block('ManageCategories',
'CategoryBlock', 'CBlock');
--- 102,113 ----
$groupaccess =
array_merge_recursive($groupaccessread, $groupaccesswrite);
$individualaccess =
array_merge_recursive($individualaccessread, $individualaccesswrite);
! $savelanguage = $savelanguage ?
$savelanguage : $this->sitelanguages[0];
!
$this->cat_bo->saveCategoryInfo($catid, $catname, $catdesc, $savelanguage,
$sort_order, $parent, $parent_old);
$this->cat_bo->saveCategoryPerms($catid, $groupaccess, $individualaccess);
}
!
$this->t->set_var(Array('category_manager' => lang('Category Manager'),
! 'lang_catname'
=> lang('Category Name'),
! 'lang_goto' =>
lang('Go to Page Manager')));
$this->t->set_file('ManageCategories',
'manage_categories.tpl');
$this->t->set_block('ManageCategories',
'CategoryBlock', 'CBlock');
***************
*** 86,90 ****
for($i = 0; $i <
sizeof($this->cat_list); $i++)
{
! $this->cat =
$this->cat_bo->getCategory($this->cat_list[$i]);
if ($this->cat->depth)
{
--- 118,122 ----
for($i = 0; $i <
sizeof($this->cat_list); $i++)
{
! $this->cat =
$this->cat_bo->getCategory($this->cat_list[$i],$this->sitelanguages[0]);
if ($this->cat->depth)
{
***************
*** 106,110 ****
'menuaction=sitemgr.Admin_ManageCategories_UI._manageCategories').
'"
method="POST">
! <input
type="submit" name="btnEditCategory" value="Edit">
<input
type="hidden" name="category_id" value="'.$category_id.'">
</form>');
--- 138,142 ----
'menuaction=sitemgr.Admin_ManageCategories_UI._manageCategories').
'"
method="POST">
! <input
type="submit" name="btnEditCategory" value="' . lang('Edit') .'">
<input
type="hidden" name="category_id" value="'.$category_id.'">
</form>');
***************
*** 115,119 ****
'menuaction=sitemgr.Admin_ManageCategories_UI._manageCategories').
'"
method="POST">
! <input
type=submit name=btnDelete value = "Delete">
<input type=
hidden name = "category_id" value="'. $category_id .'">
</form>');
--- 147,151 ----
'menuaction=sitemgr.Admin_ManageCategories_UI._manageCategories').
'"
method="POST">
! <input
type=submit name=btnDelete value="' . lang('Delete') .'">
<input type=
hidden name = "category_id" value="'. $category_id .'">
</form>');
***************
*** 131,135 ****
'menuaction=sitemgr.Admin_ManageCategories_UI._manageCategories').
'" method="POST">
! <input type=submit
name=btnAddCategory value = "Add a category">
</form>'
);
--- 163,167 ----
'menuaction=sitemgr.Admin_ManageCategories_UI._manageCategories').
'" method="POST">
! <input type=submit
name=btnAddCategory value = "' . lang('Add a category') .'">
</form>'
);
***************
*** 160,164 ****
if($error)
{
! $this->t->set_var('error_msg','You failed to
fill in one or more required fields');
$this->cat->name = $catname;
$this->cat->description = $catdesc;
--- 192,196 ----
if($error)
{
! $this->t->set_var('error_msg',lang('You failed
to fill in one or more required fields.'));
$this->cat->name = $catname;
$this->cat->description = $catdesc;
***************
*** 168,175 ****
if ($cat_id)
{
! $this->cat =
$this->cat_bo->getCategory($cat_id);
$permissionlist =
$this->acl->get_group_permission_list($cat_id);
//print_r($permissionlist);
! $this->t->set_var('add_edit','Edit
Category');
}
else
--- 200,207 ----
if ($cat_id)
{
! $this->cat =
$this->cat_bo->getCategory($cat_id,$this->sitelanguages[0]);
$permissionlist =
$this->acl->get_group_permission_list($cat_id);
//print_r($permissionlist);
! $this->t->set_var('add_edit',lang('Edit
Category'));
}
else
***************
*** 177,185 ****
$this->cat->name = '';
$this->cat->description = '';
! $this->t->set_var('add_edit','Add
Category');
$permissionlist = array();
}
}
$this->t->set_var(array(
'catid' => $cat_id,
--- 209,228 ----
$this->cat->name = '';
$this->cat->description = '';
! $this->t->set_var('add_edit',lang('Add
Category'));
$permissionlist = array();
}
}
+ if (count($this->sitelanguages))
+ {
+ $select = lang('as') . ' <select
name="savelanguage">';
+ foreach ($this->sitelanguages as $lang)
+ {
+ $select .= '<option value="' . $lang . '">'.
$this->getlangname($lang) . '</option>';
+ }
+ $select .= '</select> ';
+ $this->t->set_var('savelang',$select);
+ }
+
$this->t->set_var(array(
'catid' => $cat_id,
***************
*** 188,193 ****
'sort_order' => $this->cat->sort_order,
'parent_dropdown' =>
$this->getParentOptions($this->cat->parent,$cat_id),
'actionurl' =>
$GLOBALS['phpgw']->link('/index.php',
!
'menuaction=sitemgr.Admin_ManageCategories_UI._manageCategories')
));
--- 231,250 ----
'sort_order' => $this->cat->sort_order,
'parent_dropdown' =>
$this->getParentOptions($this->cat->parent,$cat_id),
+ 'old_parent' => $this->cat->parent,
'actionurl' =>
$GLOBALS['phpgw']->link('/index.php',
!
'menuaction=sitemgr.Admin_ManageCategories_UI._manageCategories'),
! 'lang_basic' => lang('Basic Settings'),
! 'lang_catname' => lang('Category Name'),
! 'lang_catsort' => lang('Sort Order'),
! 'lang_catparent' => lang('Parent'),
! 'lang_catdesc' => lang('Category Description'),
! 'lang_groupaccess' => lang('Group Access
Permissions'),
! 'lang_groupname' => lang('Group Name'),
! 'lang_readperm' => lang('Read Permission'),
! 'lang_writeperm' => lang('Write Permission'),
! 'lang_useraccess' => lang('Individual Access
Permission'),
! 'lang_username' => lang('User Name'),
! 'lang_reset' => lang('Reset'),
! 'lang_save' => lang('Save')
));
***************
*** 240,244 ****
else
{
! $this->t->set_var('groupname',"No groups
defined");
}
--- 297,301 ----
else
{
! $this->t->set_var('groupname',lang("No groups
defined."));
}
***************
*** 288,292 ****
else
{
! $this->t->set_var('username',"No users
defined.");
}
--- 345,349 ----
else
{
! $this->t->set_var('username',lang("No users
defined."));
}
***************
*** 325,328 ****
--- 382,386 ----
function _deleteCategory($cat_id)
{
+ $this->globalize('deleteconfirmed');
global $deleteconfirmed;
if ($deleteconfirmed==$cat_id)
***************
*** 332,339 ****
else
{
! $cat = $this->cat_bo->getCategory($cat_id);
$this->t->set_file('ConfirmDelete','confirmdelete.tpl');
! $this->t->set_var('category',$cat->name);
$this->t->set_var('category_id',$cat_id);
$this->t->set_var('actionurl',
$GLOBALS['phpgw']->link('/index.php',
--- 390,399 ----
else
{
! $cat =
$this->cat_bo->getCategory($cat_id,$this->sitelanguages[0]);
$this->t->set_file('ConfirmDelete','confirmdelete.tpl');
! $this->t->set_var('deleteheader',lang('Are you
sure you want to delete the category %1 and all of its associated pages? You
cannot retrieve the deleted pages if you continue.',$cat->name));
$this->t->set_var('category_id',$cat_id);
+ $this->t->set_var('lang_yes',lang('Yes, please
delete it'));
+ $this->t->set_var('lang_no',lang('Cancel the
delete'));
$this->t->set_var('actionurl',
$GLOBALS['phpgw']->link('/index.php',
Index: class.Categories_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_BO.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.Categories_BO.inc.php 7 Sep 2002 05:57:28 -0000 1.4
--- class.Categories_BO.inc.php 5 Dec 2002 22:15:00 -0000 1.5
***************
*** 14,18 ****
{
$prefs = CreateObject('sitemgr.sitePreference_SO');
! return !$prefs->getPreference('catsupdated');
}
--- 14,35 ----
{
$prefs = CreateObject('sitemgr.sitePreference_SO');
! if ($prefs->getPreference('catsupdated'))
! {
! return False;
! }
! else
! {
! // if there is no table
phpgw_sitemgr_categories we do not need and update
! $table_names =
$GLOBALS['phpgw']->db->table_names();
! foreach ($table_names as $table)
! {
! if ($table['table_name'] ==
'phpgw_sitemgr_categories')
! {
! return True;
! }
! }
! $prefs->setPreference('catsupdated','True');
! return False;
! }
}
***************
*** 172,176 ****
}
! function saveCategoryInfo($cat_id, $cat_name, $cat_description,
$sort_order=0, $parent=0)
{
$cat_info = CreateObject('sitemgr.Category_SO', True);
--- 189,193 ----
}
! function saveCategoryInfo($cat_id, $cat_name, $cat_description,
$lang, $sort_order=0, $parent=0, $old_parent=0)
{
$cat_info = CreateObject('sitemgr.Category_SO', True);
***************
*** 180,191 ****
$cat_info->sort_order = $sort_order;
$cat_info->parent = $parent;
if ($this->acl->can_write_category($cat_id))
{
! if($this->so->saveCategory($cat_info))
! {
! return True;
! }
! return False;
}
else
--- 197,220 ----
$cat_info->sort_order = $sort_order;
$cat_info->parent = $parent;
+ if ($old_parent!='')
+ {
+ $cat_info->old_parent = $old_parent;
+ }
+ else
+ {
+ $cat_info->old_parent = $parent;
+ }
if ($this->acl->can_write_category($cat_id))
{
! if ($this->so->saveCategory($cat_info));
! {
! if ($this->so->saveCategoryLang($cat_id, $cat_name,
$cat_description, $lang))
! {
! return True;
! }
! return false;
! }
! return false;
}
else
***************
*** 195,203 ****
}
! function getCategory($cat_id)
{
if ($this->acl->can_read_category($cat_id))
{
! return $this->so->getCategory($cat_id);
}
else
--- 224,241 ----
}
! function saveCategoryLang($cat_id, $cat_name, $cat_description,
$lang)
! {
! if ($this->so->saveCategoryLang($cat_id, $cat_name,
$cat_description, $lang))
! {
! return True;
! }
! return false;
! }
!
! function getCategory($cat_id,$lang=False)
{
if ($this->acl->can_read_category($cat_id))
{
! return $this->so->getCategory($cat_id,$lang);
}
else
***************
*** 206,210 ****
}
}
!
function saveCategoryPerms($cat_id, $group_access, $user_access)
{
--- 244,253 ----
}
}
!
! function getlangarrayforcategory($cat_id)
! {
! return $this->so->getlangarrayforcategory($cat_id);
! }
!
function saveCategoryPerms($cat_id, $group_access, $user_access)
{
***************
*** 261,264 ****
--- 304,317 ----
echo 'wth!';
}
+ }
+
+ function removealllang($lang)
+ {
+ $this->so->removealllang($lang);
+ }
+
+ function migratealllang($oldlang,$newlang)
+ {
+ $this->so->migratealllang($oldlang,$newlang);
}
}
Index: class.Categories_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_SO.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.Categories_SO.inc.php 15 Sep 2002 22:02:23 -0000 1.10
--- class.Categories_SO.inc.php 5 Dec 2002 22:15:00 -0000 1.11
***************
*** 3,10 ****
{
var $cats;
!
function Categories_SO()
{
$this->cats =
CreateObject('phpgwapi.categories',-1,'sitemgr');
}
--- 3,12 ----
{
var $cats;
! var $db;
!
function Categories_SO()
{
$this->cats =
CreateObject('phpgwapi.categories',-1,'sitemgr');
+ $this->db = $GLOBALS['phpgw']->db;
}
***************
*** 70,74 ****
'descr' => $description,
'access' => 'public',
! 'parent' => $parent
);
--- 72,77 ----
'descr' => $description,
'access' => 'public',
! 'parent' => $parent,
! 'old_parent' => $parent
);
***************
*** 91,95 ****
'access' => 'public',
'id' => $cat_info->id,
! 'parent' => $cat_info->parent
);
--- 94,99 ----
'access' => 'public',
'id' => $cat_info->id,
! 'parent' => $cat_info->parent,
! 'old_parent' => $cat_info->old_parent
);
***************
*** 97,101 ****
}
! function getCategory($cat_id)
{
$cat = $this->cats->return_single($cat_id);
--- 101,128 ----
}
! function saveCategoryLang($cat_id, $cat_name, $cat_description,
$lang)
! {
! $this->db->query("SELECT * FROM
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id' and lang='$lang'",
__LINE__,__FILE__);
! if ($this->db->next_record())
! {
! $this->db->query("UPDATE phpgw_sitemgr_categories_lang
SET name='$cat_name', description='$cat_description' WHERE cat_id='$cat_id' and
lang='$lang'", __LINE__,__FILE__);
! }
! else
! {
! $this->db->query("INSERT INTO
phpgw_sitemgr_categories_lang (cat_id,lang,name,description) VALUES
('$cat_id','$lang','$cat_name','$cat_description')", __LINE__,__FILE__);
! }
! }
!
! function getlangarrayforcategory($cat_id)
! {
! $this->db->query("SELECT lang FROM
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id'");
! while ($this->db->next_record())
! {
! $retval[] = $this->db->f('lang');
! }
! return $retval;
! }
!
! function getCategory($cat_id,$lang=False)
{
$cat = $this->cats->return_single($cat_id);
***************
*** 105,114 ****
$cat_info =
CreateObject('sitemgr.Category_SO', True);
$cat_info->id = $cat[0]['id'];
! $cat_info->name =
stripslashes($cat[0]['name']);
$cat_info->sort_order = $cat[0]['data'];
! $cat_info->description =
stripslashes($cat[0]['description']);
$cat_info->parent =
$cat[0]['parent'];
$cat_info->depth =
$cat[0]['level'];
$cat_info->root =
$cat[0]['main'];
return $cat_info;
}
--- 132,173 ----
$cat_info =
CreateObject('sitemgr.Category_SO', True);
$cat_info->id = $cat[0]['id'];
! //$cat_info->name =
stripslashes($cat[0]['name']);
$cat_info->sort_order = $cat[0]['data'];
! //$cat_info->description =
stripslashes($cat[0]['description']);
$cat_info->parent =
$cat[0]['parent'];
$cat_info->depth =
$cat[0]['level'];
$cat_info->root =
$cat[0]['main'];
+
+ if ($lang)
+ {
+ $this->db->query("SELECT * FROM
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id' and lang='$lang'");
+ if ($this->db->next_record())
+ {
+ $cat_info->name =
$this->db->f('name');
+ $cat_info->description =
$this->db->f('description');
+ }
+ else
+ {
+ //return False;
+ $cat_info->name = lang("not yet
translated");
+ }
+ }
+
+ //if there is no lang argument we return the
content in whatever languages turns up first
+ else
+ {
+ $this->db->query("SELECT * FROM
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id'");
+ if ($this->db->next_record())
+ {
+ $cat_info->name =
$this->db->f('name');
+ $cat_info->description =
$this->db->f('description');
+ $cat_info->lang = $this->db->f('lang');
+ }
+ else
+ {
+ $cat_info->name = "This category has no
data in any langugage: this should not happen";
+ }
+ }
+
return $cat_info;
}
***************
*** 117,120 ****
--- 176,191 ----
return false;
}
+ }
+
+ function removealllang($lang)
+ {
+ $sql = "DELETE FROM phpgw_sitemgr_categories_lang WHERE
lang='$lang'";
+ $this->db->query($sql, __LINE__,__FILE__);
+ }
+
+ function migratealllang($oldlang,$newlang)
+ {
+ $sql = "UPDATE phpgw_sitemgr_categories_lang SET
lang='$newlang' WHERE lang='$oldlang'";
+ $this->db->query($sql, __LINE__,__FILE__);
}
}
Index: class.Common_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_UI.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.Common_UI.inc.php 5 Sep 2002 09:06:03 -0000 1.6
--- class.Common_UI.inc.php 5 Dec 2002 22:15:00 -0000 1.7
***************
*** 12,16 ****
class Common_UI
{
! var $t, $acl, $theme, $prefs_so, $pages_bo;
var $public_functions = array
(
--- 12,16 ----
class Common_UI
{
! var $t, $acl, $theme, $prefs_so, $pages_bo, $cat_bo;
var $public_functions = array
(
***************
*** 25,30 ****
--- 25,40 ----
$this->prefs_so =
CreateObject('sitemgr.sitePreference_SO', True);
$this->pages_bo = CreateObject('sitemgr.Pages_BO');
+ $this->cat_bo = CreateObject('sitemgr.Categories_BO');
}
+ //this has to be moved somewhere else later
+ function getlangname($lang)
+ {
+ $GLOBALS['phpgw']->db->query("select lang_name from
languages where lang_id = '$lang'",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+ return $GLOBALS['phpgw']->db->f('lang_name');
+ }
+
+
function DisplayPrefs()
{
***************
*** 32,50 ****
if ($this->acl->is_admin())
{
! $preferences['sitemgr-site-name'] = array(
! 'title'=>'Site name',
! 'note'=>'(This is used chiefly for meta
data and the title bar.)',
'default'=>'New sitemgr site'
! );
$preferences['sitemgr-site-url']=array(
! 'title'=>'URL to sitemgr-site',
'note'=>'(The URL can be relative or
absolute. Name must end in a slash.)'
);
$preferences['sitemgr-site-dir']=array(
! 'title'=>'Filesystem path to
sitemgr-site directory',
'note'=>'(This must be an absolute
directory location. <b>No trailing slash</b>.)'
);
$preferences['home-page-id'] = array(
! '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'=>'option',
--- 42,153 ----
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',$this->getlangname($oldlang)) . '</b><br>';
!
$this->pages_bo->removealllang($oldlang);
!
$this->cat_bo->removealllang($oldlang);
! }
! else
! {
! echo '<b>' .
lang('Migrating data for %1 to %2',
!
$this->getlangname($oldlang),
!
$this->getlangname($newlang)) .
! '</b><br>';
!
$this->pages_bo->migratealllang($oldlang,$newlang);
!
$this->cat_bo->migratealllang($oldlang,$newlang);
! }
! }
! echo '</p>';
! }
!
! if ($_POST['btnSave'])
! {
! $preferences = array(
!
'sitemgr-site-url','sitemgr-site-dir','home-page-id','login-domain',
!
'anonymous-user','anonymous-passwd','interface','themesel','sitelanguages');
!
! $oldsitelanguages =
$this->prefs_so->getPreference('sitelanguages');
! if ($oldsitelanguages &&
($oldsitelanguages != $_POST['sitelanguages']))
! {
! $oldsitelanguages =
explode(',',$oldsitelanguages);
! $newsitelanguages =
explode(',',$_POST['sitelanguages']);
! $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 =
$this->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 ' .
!
$this->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");
! foreach ($oldsitelanguages as $lang)
! {
!
array_push($preferences,'sitemgr-site-name-' . $lang);
! }
!
! foreach ($preferences as $name)
! {
!
$this->prefs_so->setPreference($name,$_POST[$name]);
! }
! echo '<p><b>' . lang('Changes Saved.')
. '</b></p>';
! unset($preferences);
! }
!
! $sitelanguages =
explode(',',$this->prefs_so->getPreference('sitelanguages'));
! $sitelanguages = $sitelanguages ?
$sitelanguages : array("en");
!
! foreach ($sitelanguages as $lang)
! {
! $preferences['sitemgr-site-name-' . $lang]
= array(
! 'title'=>lang('Site name'). ' ' .
$this->getlangname($lang),
! 'note'=>'(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'=>'New sitemgr site'
! );
! }
!
$preferences['sitemgr-site-url']=array(
! 'title'=>lang('URL to sitemgr-site'),
'note'=>'(The URL can be relative or
absolute. Name must end in a slash.)'
);
$preferences['sitemgr-site-dir']=array(
! 'title'=>lang('Filesystem path to
sitemgr-site directory'),
'note'=>'(This must be an absolute
directory location. <b>No trailing slash</b>.)'
);
$preferences['home-page-id'] = array(
! 'title'=>lang('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'=>'option',
***************
*** 52,76 ****
);
$preferences['login-domain'] = array(
! 'title'=>'Anonymous user login domain',
'note'=>'If you\'re not sure, enter
Default.',
'default'=>'Default'
);
$preferences['anonymous-user'] = array(
! 'title'=>'Anonymous user\'s username',
'note'=>'(If you haven\'t done so
already, create a user that will be used for public viewing of the site.
Recommended name: anonymous.)',
'default'=>'anonymous'
);
$preferences['anonymous-passwd'] = array(
! 'title'=>'Anonymous user\'s password',
'note'=>'(Password that you assigned
for the aonymous user account.)',
'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',
--- 155,179 ----
);
$preferences['login-domain'] = array(
! 'title'=>lang('Anonymous user login
domain'),
'note'=>'If you\'re not sure, enter
Default.',
'default'=>'Default'
);
$preferences['anonymous-user'] = array(
! 'title'=>lang('Anonymous user\'s
username'),
'note'=>'(If you haven\'t done so
already, create a user that will be used for public viewing of the site.
Recommended name: anonymous.)',
'default'=>'anonymous'
);
$preferences['anonymous-passwd'] = array(
! 'title'=>lang('Anonymous user\'s
password'),
'note'=>'(Password that you assigned
for the aonymous user account.)',
'default'=>'anonymous'
);
$preferences['interface'] = array(
! 'title'=>lang('Use phpNuke themes
instead of templates'),
'note'=>'(This is NOT recommended.)',
'input'=>'checkbox'
);
$preferences['themesel'] = array(
! 'title'=>lang('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',
***************
*** 78,94 ****
'default'=>'NukeNews'
);
! if ($GLOBALS['btnSave'])
! {
! reset($preferences);
! while (list($name,$details) =
each($preferences))
! {
!
$this->prefs_so->setPreference($name,$GLOBALS[$name]);
! }
! echo '<p><b>Changes Saved.</b></p>';
! }
!
$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_block('sitemgr_prefs','PrefBlock','PBlock');
reset($preferences);
--- 181,198 ----
'default'=>'NukeNews'
);
! $preferences['sitelanguages'] = array(
! 'title'=>lang('Languages the site user
can choose from'),
! 'note'=>'(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')
+ ));
+
$this->t->set_block('sitemgr_prefs','PrefBlock','PBlock');
reset($preferences);
***************
*** 119,123 ****
else
{
! echo "You must be an administrator to setup the
Site Manager.<br><br>";
}
$this->DisplayFooter();
--- 223,227 ----
else
{
! echo lang("You must be an administrator to
setup the Site Manager.") . "<br><br>";
}
$this->DisplayFooter();
***************
*** 164,168 ****
if (!is_array($options) || count($options)==0)
{
! return 'No options available.';
}
$val = $this->prefs_so->getPreference($name);
--- 268,272 ----
if (!is_array($options) || count($options)==0)
{
! return lang('No options available.');
}
$val = $this->prefs_so->getPreference($name);
***************
*** 206,209 ****
--- 310,317 ----
);
$this->t->set_var('sitemgr-site',
$GLOBALS['phpgw']->link('/sitemgr-link/'));
+ $this->t->set_var(Array('sitemgr_administration' =>
lang('Web Content Manager Administration'),
+ 'view_menu' => lang('View
Administrative Menu'),
+ 'view_site' => lang('View
Generated Site')
+ ));
$this->t->pfp('out','sitemgr_header');
}
Index: class.MainMenu_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.MainMenu_UI.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.MainMenu_UI.inc.php 11 Sep 2002 22:39:28 -0000 1.3
--- class.MainMenu_UI.inc.php 5 Dec 2002 22:15:00 -0000 1.4
***************
*** 33,43 ****
if ($this->acl->is_admin())
{
! $this->t->set_var('menutitle','Administrative
Menu');
$catbo = CreateObject('sitemgr.Categories_BO');
if ($catbo->needUpdateCategories())
{
$updatemsg = $catbo->updateCategories();
! $updatemsg = "\n".'<br><b>Updating to
new category system:</b><br>'.
!
$updatemsg.'<br><b>Done.</b><br>';
$this->t->set_var('updatecats',$updatemsg);
}
--- 33,47 ----
if ($this->acl->is_admin())
{
! $this->t->set_var(Array('menutitle' =>
lang('Administrative Menu'),
! 'lang_configure' =>
lang('Configure SiteMgr'),
! 'lang_check' =>
lang('check here after every upgrade'),
! 'lang_editheadfoot' =>
lang('Edit Site Header and Footer'),
! 'lang_managecat' =>
lang('Manage Categories')));
$catbo = CreateObject('sitemgr.Categories_BO');
if ($catbo->needUpdateCategories())
{
$updatemsg = $catbo->updateCategories();
! $updatemsg = "\n".'<br><b>' .
lang('Updating to new category system') . ':</b><br>'.
! $updatemsg.'<br><b>' .
lang('Done') . '</b><br>';
$this->t->set_var('updatecats',$updatemsg);
}
***************
*** 50,54 ****
else
{
! $this->t->set_var('menutitle','Contributor
Menu');
}
--- 54,58 ----
else
{
! $this->t->set_var('menutitle',lang('Contributor
Menu'));
}
***************
*** 57,60 ****
--- 61,72 ----
'menuaction=sitemgr.contributor_ManagePage_UI._managePage')
);
+
+ $this->t->set_var('managetranslations',
+ $GLOBALS['phpgw']->link('/index.php',
+
'menuaction=sitemgr.ManageTranslations_UI._manageTranslations')
+ );
+ $this->t->set_var(Array('lang_managepage' =>
lang('Manage Pages'),
+ 'lang_managetranslations' =>
lang('Manage Translations')));
+
if ($this->acl->is_admin())
{
Index: class.Page_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Page_SO.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.Page_SO.inc.php 1 Sep 2002 22:19:02 -0000 1.3
--- class.Page_SO.inc.php 5 Dec 2002 22:15:00 -0000 1.4
***************
*** 10,13 ****
--- 10,14 ----
var $sort_order;
var $hidden;
+ var $lang;
function Page_SO()
Index: class.Pages_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Pages_BO.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.Pages_BO.inc.php 5 Sep 2002 09:06:03 -0000 1.2
--- class.Pages_BO.inc.php 5 Dec 2002 22:15:00 -0000 1.3
***************
*** 14,18 ****
{
$pagelist = $this->pageso->getPageIDList();
! $retval[]=array('value'=>'','display'=>'[Show Site
Index]');
foreach($pagelist as $page_id)
{
--- 14,18 ----
{
$pagelist = $this->pageso->getPageIDList();
! $retval[]=array('value'=>'','display'=>'[' .lang('Show
Site Index') . ']');
foreach($pagelist as $page_id)
{
***************
*** 59,67 ****
}
! function getPage($page_id)
{
if ($this->acl->can_read_page($page_id))
{
! return $this->pageso->getPage($page_id);
}
else
--- 59,67 ----
}
! function getPage($page_id,$lang=False)
{
if ($this->acl->can_read_page($page_id))
{
! return $this->pageso->getPage($page_id,$lang);
}
else
***************
*** 69,85 ****
$page = CreateObject('sitemgr.Page_SO');
$page->name = 'Error';
! $page->title = 'Error accessing page';
$page->subtitle = '';
! $page->content = 'There was an error accessing
the requested page.
! Either you do not have permission to
view this page, or the page does not exist.';
return $page;
}
}
! function savePageInfo($page_Info)
{
if (!$this->acl->can_write_category($page_Info->cat_id))
{
! return 'You don\'t have permission to write to
that category.';
}
$fixed_name = strtr($page_Info->name,
'address@hidden&*()-_=+ /?><,.\\\'":;|`~{}[]','
');
--- 69,89 ----
$page = CreateObject('sitemgr.Page_SO');
$page->name = 'Error';
! $page->title = lang('Error accessing page');
$page->subtitle = '';
! $page->content = lang('There was an error
accessing the requested page. Either you do not have permission to view this
page, or the page does not exist.');
return $page;
}
}
! function getlangarrayforpage($page_id)
! {
! return $this->pageso->getlangarrayforpage($page_id);
! }
!
! function savePageInfo($page_Info,$lang)
{
if (!$this->acl->can_write_category($page_Info->cat_id))
{
! return lang("You don't have permission to write
to that category.");
}
$fixed_name = strtr($page_Info->name,
'address@hidden&*()-_=+ /?><,.\\\'":;|`~{}[]','
');
***************
*** 93,109 ****
$page_Info->name = $fixed_name;
$this->pageso->savePageInfo($page_Info);
! return 'The Name field cannot contain
punctuation or spaces (field modified).';
}
if ($this->pageso->savePageInfo($page_Info))
{
! return 'The page was successfully
saved.';
}
else
{
! return 'There was an error writing to
the database.';
}
$page_Info->name = $fixed_name;
$this->pageso->savePageInfo($page_Info);
! return 'The Name field cannot contain
punctuation or spaces (field modified).';
}
if
($this->pageso->pageExists($page_Info->name,$page_Info->id))
--- 97,116 ----
$page_Info->name = $fixed_name;
$this->pageso->savePageInfo($page_Info);
!
$this->pageso->savePageLang($page_Info,$lang);
! return lang('The Name field cannot
contain punctuation or spaces (field modified).');
}
if ($this->pageso->savePageInfo($page_Info))
{
!
$this->pageso->savePageLang($page_Info,$lang);
! return lang('The page was successfully
saved.');
}
else
{
! return lang('There was an error writing
to the database.');
}
+ //MT: are the following three lines ever
executed?
$page_Info->name = $fixed_name;
$this->pageso->savePageInfo($page_Info);
! return lang('The Name field cannot contain
punctuation or spaces (field modified).');
}
if
($this->pageso->pageExists($page_Info->name,$page_Info->id))
***************
*** 111,124 ****
$page_Info->name .= '--FIX-DUPLICATE-NAME';
$this->pageso->savePageInfo($page_Info);
! return 'The page name must be unique.';
}
if ($this->pageso->savePageInfo($page_Info))
{
return True;
}
else
{
! return 'There was an error writing to the
database.';
}
}
}
--- 118,148 ----
$page_Info->name .= '--FIX-DUPLICATE-NAME';
$this->pageso->savePageInfo($page_Info);
! $this->pageso->savePageLang($page_Info,$lang);
! return lang('The page name must be unique.');
}
if ($this->pageso->savePageInfo($page_Info))
{
+ $this->pageso->savePageLang($page_Info,$lang);
return True;
}
else
{
! return lang('There was an error writing to the
database.');
}
+ }
+
+ function savePageLang($page_Info,$lang)
+ {
+ $this->pageso->savePageLang($page_Info,$lang);
+ }
+
+ function removealllang($lang)
+ {
+ $this->pageso->removealllang($lang);
+ }
+
+ function migratealllang($oldlang,$newlang)
+ {
+ $this->pageso->migratealllang($oldlang,$newlang);
}
}
Index: class.Pages_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Pages_SO.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.Pages_SO.inc.php 15 Sep 2002 22:32:35 -0000 1.8
--- class.Pages_SO.inc.php 5 Dec 2002 22:15:00 -0000 1.9
***************
*** 40,43 ****
--- 40,51 ----
function removePagesInCat($cat_id)
{
+ $db2 = $this->db;
+ $sql = 'SELECT page_id FROM phpgw_sitemgr_pages WHERE
cat_id=\''.$cat_id.'\'';
+ $db2->query($sql,__LINE__,__FILE__);
+ while ($db2->next_record())
+ {
+ $page_id = $db2->f('page_id');
+ $this->db->query("DELETE FROM
phpgw_sitemgr_pages_lang WHERE page_id='$page_id'");
+ }
$sql = 'DELETE FROM phpgw_sitemgr_pages WHERE
cat_id=\''.$cat_id.'\'';
$this->db->query($sql,__LINE__,__FILE__);
***************
*** 48,51 ****
--- 56,61 ----
$sql = 'DELETE FROM phpgw_sitemgr_pages WHERE
page_id=\'' . $page_id . '\'';
$this->db->query($sql, __LINE__,__FILE__);
+ $sql = 'DELETE FROM phpgw_sitemgr_pages_lang WHERE
page_id=\'' . $page_id . '\'';
+ $this->db->query($sql, __LINE__,__FILE__);
}
***************
*** 68,72 ****
}
! function getPageByName($page_name)
{
$sql = 'SELECT * FROM phpgw_sitemgr_pages WHERE
name=\'' . $page_name . '\'';
--- 78,93 ----
}
!
! function getlangarrayforpage($page_id)
! {
! $this->db->query("SELECT lang FROM
phpgw_sitemgr_pages_lang WHERE page_id='$page_id'");
! while ($this->db->next_record())
! {
! $retval[] = $this->db->f('lang');
! }
! return $retval;
! }
!
! function getPageByName($page_name,$lang)
{
$sql = 'SELECT * FROM phpgw_sitemgr_pages WHERE
name=\'' . $page_name . '\'';
***************
*** 78,86 ****
$page->cat_id = $this->db->f('cat_id');
$page->name =
stripslashes($this->db->f('name'));
- $page->title=
stripslashes($this->db->f('title'));
- $page->subtitle =
stripslashes($this->db->f('subtitle'));
$page->sort_order = (int)
$this->db->f('sort_order');
- $page->content =
stripslashes($this->db->f('content'));
$page->hidden = $this->db->f('hide_page');
return $page;
}
--- 99,118 ----
$page->cat_id = $this->db->f('cat_id');
$page->name =
stripslashes($this->db->f('name'));
$page->sort_order = (int)
$this->db->f('sort_order');
$page->hidden = $this->db->f('hide_page');
+
+ $sql = "SELECT * FROM phpgw_sitemgr_pages_lang
WHERE page_id='" . $page->id . "' and lang='$lang'";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ if ($this->db->next_record())
+ {
+ $page->title=
stripslashes($this->db->f('title'));
+ $page->subtitle =
stripslashes($this->db->f('subtitle'));
+ $page->content =
stripslashes($this->db->f('content'));
+ }
+ else
+ {
+ $page->title = lang("The page %1 has not
yet been translated to %2",$page->name, $lang);
+ }
return $page;
}
***************
*** 91,95 ****
}
! function getPage($page_id)
{
$sql = 'SELECT * FROM phpgw_sitemgr_pages WHERE
page_id=\'' . $page_id . '\'';
--- 123,127 ----
}
! function getPage($page_id,$lang=False)
{
$sql = 'SELECT * FROM phpgw_sitemgr_pages WHERE
page_id=\'' . $page_id . '\'';
***************
*** 102,109 ****
$page->sort_order = (int)
$this->db->f('sort_order');
$page->name =
stripslashes($this->db->f('name'));
- $page->title=
stripslashes($this->db->f('title'));
- $page->subtitle =
stripslashes($this->db->f('subtitle'));
- $page->content =
stripslashes($this->db->f('content'));
$page->hidden = $this->db->f('hide_page');
return $page;
}
--- 134,176 ----
$page->sort_order = (int)
$this->db->f('sort_order');
$page->name =
stripslashes($this->db->f('name'));
$page->hidden = $this->db->f('hide_page');
+
+ if ($lang)
+ {
+ $sql = "SELECT * FROM
phpgw_sitemgr_pages_lang WHERE page_id='$page_id' and lang='$lang'";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ if ($this->db->next_record())
+ {
+ $page->title=
stripslashes($this->db->f('title'));
+ $page->subtitle =
stripslashes($this->db->f('subtitle'));
+ $page->content =
stripslashes($this->db->f('content'));
+ $page->lang = $lang;
+ }
+ else
+ {
+ $page->title = lang("not yet
translated");
+ }
+ }
+
+ //if there is no lang argument we return the
content in whatever languages turns up first
+ else
+ {
+ $sql = "SELECT * FROM
phpgw_sitemgr_pages_lang WHERE page_id='" . $page->id . "'";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ if ($this->db->next_record())
+ {
+ $page->title=
stripslashes($this->db->f('title'));
+ $page->subtitle =
stripslashes($this->db->f('subtitle'));
+ $page->content =
stripslashes($this->db->f('content'));
+ $page->lang = $this->db->f('lang');
+ }
+ else
+ {
+ $page->title = "This page has no data
in any langugage: this should not happen";
+ }
+ }
+
return $page;
}
***************
*** 120,130 ****
'name=\'' . addslashes($pageInfo->name) . '\','
.
'sort_order=\'' . (int) $pageInfo->sort_order .
'\',' .
'title=\'' . addslashes($pageInfo->title) .
'\',' .
'subtitle=\'' . addslashes($pageInfo->subtitle)
. '\',' .
! 'content=\'' . addslashes($pageInfo->content) .
'\', ' .
! 'hide_page=\'' . $pageInfo->hidden . '\' ' .
! 'WHERE page_id=\'' . $pageInfo->id . '\'';
$this->db->query($sql, __LINE__,__FILE__);
return true;
}
}
--- 187,231 ----
'name=\'' . addslashes($pageInfo->name) . '\','
.
'sort_order=\'' . (int) $pageInfo->sort_order .
'\',' .
+ 'hide_page=\'' . $pageInfo->hidden . '\' ' .
+ 'WHERE page_id=\'' . $pageInfo->id . '\'';
+ $this->db->query($sql, __LINE__,__FILE__);
+ return true;
+ }
+
+ function savePageLang($pageInfo,$lang)
+ {
+ $page_id = $pageInfo->id;
+ $this->db->query("SELECT * FROM phpgw_sitemgr_pages_lang
WHERE page_id='$page_id' and lang='$lang'", __LINE__,__FILE__);
+ if ($this->db->next_record())
+ {
+ $sql = 'UPDATE phpgw_sitemgr_pages_lang SET ' .
'title=\'' . addslashes($pageInfo->title) .
'\',' .
'subtitle=\'' . addslashes($pageInfo->subtitle)
. '\',' .
! 'content=\'' . addslashes($pageInfo->content) .
'\' ' .
! "WHERE page_id='$page_id' and lang='$lang'";
! $this->db->query($sql, __LINE__,__FILE__);
! return true;
! }
! else
! {
! $sql = "INSERT INTO phpgw_sitemgr_pages_lang
(page_id,lang,title,subtitle,content) VALUES ('$page_id','$lang','" .
! addslashes($pageInfo->title) . "','" .
! addslashes($pageInfo->subtitle) . "','" .
! addslashes($pageInfo->content) ."')";
$this->db->query($sql, __LINE__,__FILE__);
return true;
+ }
+ }
+
+ function removealllang($lang)
+ {
+ $sql = "DELETE FROM phpgw_sitemgr_pages_lang WHERE
lang='$lang'";
+ $this->db->query($sql, __LINE__,__FILE__);
+ }
+
+ function migratealllang($oldlang,$newlang)
+ {
+ $sql = "UPDATE phpgw_sitemgr_pages_lang SET
lang='$newlang' WHERE lang='$oldlang'";
+ $this->db->query($sql, __LINE__,__FILE__);
}
}
Index: class.admin_ManageSiteContent_UI.inc.php
===================================================================
RCS file:
/cvsroot/phpgroupware/sitemgr/inc/class.admin_ManageSiteContent_UI.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.admin_ManageSiteContent_UI.inc.php 29 Aug 2002 03:03:17 -0000
1.1.1.1
--- class.admin_ManageSiteContent_UI.inc.php 5 Dec 2002 22:15:00 -0000
1.2
***************
*** 5,8 ****
--- 5,9 ----
var $headerfooterbo;
var $acl;
+ var $prefs_so;
var $public_functions = array
***************
*** 11,16 ****
--- 12,41 ----
);
+ function globalize($varname)
+ {
+ if (is_array($varname))
+ {
+ foreach($varname as $var)
+ {
+ $GLOBALS[$var] = $_POST[$var];
+ }
+ }
+ else
+ {
+ $GLOBALS[$varname] = $_POST[$varname];
+ }
+ }
+
+ //this has to be moved somewhere else later
+ function getlangname($lang)
+ {
+ $GLOBALS['phpgw']->db->query("select lang_name from
languages where lang_id = '$lang'",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+ return $GLOBALS['phpgw']->db->f('lang_name');
+ }
+
function admin_ManageSiteContent_UI()
{
+
$this->globalize(array('btnSave','btnReset','btnHome','header','footer'));
global $btnSave;
global $btnReset;
***************
*** 22,29 ****
--- 47,57 ----
$this->headerfooterbo =
CreateObject('sitemgr.headerFooter_BO', True);
$this->acl = CreateObject('sitemgr.ACL_BO');
+ $this->prefs_so =
CreateObject('sitemgr.sitePreference_SO', True);
+ $this->sitelanguages =
explode(',',$this->prefs_so->getPreference('sitelanguages'));
}
function _editHeaderAndFooter()
{
+ $this->globalize(array('btnSave','header','footer'));
global $btnSave;
global $header;
***************
*** 36,57 ****
{
$this->t->set_file('EditHeaderAndFooter',
'site_format_manager.tpl');
if ($btnSave)
{
!
$this->headerfooterbo->SetSiteHeader($header);
!
$this->headerfooterbo->SetSiteFooter($footer);
!
$this->t->set_var('message','<b>Saved.</b> <a
href="'.$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.MainMenu_UI.DisplayMenu').'">Return
to main menu.</a><br>');
//$this->headerfooterbo->SetTheme($this->theme);
}
!
! $this->header =
$this->headerfooterbo->getSiteHeader();
! $this->footer =
$this->headerfooterbo->getSiteFooter();
!
$this->t->set_var(array
(
! 'header' => $this->header,
! 'footer' => $this->footer
));
!
if ($btnReset)
{
--- 64,100 ----
{
$this->t->set_file('EditHeaderAndFooter',
'site_format_manager.tpl');
+
$this->t->set_block('EditHeaderAndFooter','Header_Editor','HBlock');
+
$this->t->set_block('EditHeaderAndFooter','Footer_Editor','FBlock');
if ($btnSave)
{
! foreach ($this->sitelanguages as $lang)
! {
!
$this->headerfooterbo->SetSiteHeader($header[$lang],$lang);
!
$this->headerfooterbo->SetSiteFooter($footer[$lang],$lang);
! }
! $this->t->set_var('message','<b>'
.lang('Saved') . '</b>. <a
href="'.$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.MainMenu_UI.DisplayMenu').'">'
. lang('Return to main menu.') . '</a><br>');
//$this->headerfooterbo->SetTheme($this->theme);
}
!
$this->t->set_var(array
(
! 'site_format_manager' => lang('Site
Format Manager'),
! 'lang_reset' => lang('Reset'),
! 'lang_save' => lang('Save')
));
!
! foreach ($this->sitelanguages as $lang)
! {
! $this->t->set_var(array('header_editor' =>
lang('Header Editor') . ' - ' . $this->getlangname($lang),
! 'footer_editor' =>
lang('Footer Editor') . ' - ' . $this->getlangname($lang),
! 'header' =>
$this->headerfooterbo->getSiteHeader($lang),
! 'footer' =>
$this->headerfooterbo->getSiteFooter($lang),
! 'textarea_header'
=> 'header[' . $lang . ']',
! 'textarea_footer'
=> 'footer[' . $lang . ']'));
!
$this->t->parse('HBlock','Header_Editor',True);
!
$this->t->parse('FBlock','Footer_Editor',True);
! }
!
if ($btnReset)
{
***************
*** 64,68 ****
else
{
! echo "You must be an admin to edit the site
header and footer.<br><br>";
}
$common_ui->DisplayFooter();
--- 107,111 ----
else
{
! echo lang("You must be an admin to edit the
site header and footer.") ."<br><br>";
}
$common_ui->DisplayFooter();
Index: class.contributor_ManagePage_UI.inc.php
===================================================================
RCS file:
/cvsroot/phpgroupware/sitemgr/inc/class.contributor_ManagePage_UI.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.contributor_ManagePage_UI.inc.php 11 Sep 2002 22:39:28 -0000
1.7
--- class.contributor_ManagePage_UI.inc.php 5 Dec 2002 22:15:00 -0000
1.8
***************
*** 21,25 ****
var $cat_list;
var $page_list;
!
var $public_functions=array
(
--- 21,27 ----
var $cat_list;
var $page_list;
! var $preferenceso;
! var $sitelanguages;
!
var $public_functions=array
(
***************
*** 32,37 ****
--- 34,48 ----
$this->pagebo = CreateObject('sitemgr.Pages_BO', True);
$this->categorybo =
CreateObject('sitemgr.Categories_BO',True);
+ $this->preferenceso =
CreateObject('sitemgr.sitePreference_SO', true);
+ $this->sitelanguages =
explode(',',$this->preferenceso->getPreference('sitelanguages'));
}
+ function getlangname($lang)
+ {
+ $GLOBALS['phpgw']->db->query("select lang_name from
languages where lang_id = '$lang'",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+ return $GLOBALS['phpgw']->db->f('lang_name');
+ }
+
function _addPage($category_id)
{
***************
*** 44,49 ****
--- 55,76 ----
}
+ function globalize($varname)
+ {
+ if (is_array($varname))
+ {
+ foreach($varname as $var)
+ {
+ $GLOBALS[$var] = $_POST[$var];
+ }
+ }
+ else
+ {
+ $GLOBALS[$varname] = $_POST[$varname];
+ }
+ }
+
function _editPage($category_id,
$page_id,$cname='',$ctitle='',$csubtitle='',$cmain='')
{
+
$this->globalize(array('title','name','subtitle','main','sort_order','parent','hidden','btnEditPage','savelanguage'));
global $title;
global $name;
***************
*** 54,62 ****
global $hidden;
global $btnEditPage;
$this->t->set_file('EditPage', 'page_editor.tpl');
if($page_id)
{
! $this->page = $this->pagebo->getPage($page_id);
if ($cname)
{
--- 81,90 ----
global $hidden;
global $btnEditPage;
+ global $savelanguage;
$this->t->set_file('EditPage', 'page_editor.tpl');
if($page_id)
{
! $this->page =
$this->pagebo->getPage($page_id,$this->sitelanguages[0]);
if ($cname)
{
***************
*** 75,79 ****
$this->page->content=$cmain;
}
! $this->t->set_var('add_edit','Edit Page');
$this->t->set_var('move_to',$this->getParentOptions($this->page->cat_id));
}
--- 103,107 ----
$this->page->content=$cmain;
}
! $this->t->set_var('add_edit',lang('Edit Page'));
$this->t->set_var('move_to',$this->getParentOptions($this->page->cat_id));
}
***************
*** 86,91 ****
$this->page->sort_order = $sort_order;
$this->page->cat_id = $category_id;
! $this->t->set_var('add_edit','Add Page');
! $move_msg = 'Cannot move page until it has been
saved.';
$move_msg .= '<INPUT TYPE="hidden"
name="parent" value="'.
$category_id.'">';
--- 114,119 ----
$this->page->sort_order = $sort_order;
$this->page->cat_id = $category_id;
! $this->t->set_var('add_edit',lang('Add Page'));
! $move_msg = lang('Cannot move page until it has
been saved.');
$move_msg .= '<INPUT TYPE="hidden"
name="parent" value="'.
$category_id.'">';
***************
*** 102,113 ****
$this->t->set_var('hidden', '');
}
$this->t->set_var(array(
'title' =>$this->page->title,
'subtitle' => $this->page->subtitle,
! 'main'=>strtr($this->page->content,$trans),
'name'=>$this->page->name,
'sort_order'=>$this->page->sort_order,
'pageid'=>$page_id,
! 'category_id' => $category_id
));
--- 130,170 ----
$this->t->set_var('hidden', '');
}
+
+ if (count($this->sitelanguages))
+ {
+ $select = lang('as') . ' <select
name="savelanguage">';
+
+ foreach ($this->sitelanguages as $lang)
+ {
+ $selected= '';
+ if ($lang == $page->lang)
+ {
+ $selected = 'selected="selected" ';
+ }
+ $select .= '<option ' . $selected .'value="' .
$lang . '">'. $this->getlangname($lang) . '</option>';
+ }
+ $select .= '</select> ';
+ $this->t->set_var('savelang',$select);
+ }
+
$this->t->set_var(array(
'title' =>$this->page->title,
'subtitle' => $this->page->subtitle,
!
'main'=>strtr($GLOBALS['phpgw']->strip_html($this->page->content),$trans),
'name'=>$this->page->name,
'sort_order'=>$this->page->sort_order,
'pageid'=>$page_id,
! 'category_id' => $category_id,
! 'lang_name' => lang('Name'),
! 'lang_title' => lang('Title'),
! 'lang_subtitle' => lang('Subtitle'),
! 'lang_sort' => lang('Sort order'),
! 'lang_move' => lang('Move to'),
! 'lang_maincontent' => lang('Main content'),
! 'lang_hide' => lang('Check to hide from
condensed site index.'),
! 'lang_required' => lang('Required Fields'),
! 'lang_goback' => lang('Go back to Page
Manager'),
! 'lang_reset' => lang('Reset'),
! 'lang_save' => lang('Save')
));
***************
*** 124,131 ****
function _managePage()
{
global $hidden;
global $btnAddPage, $btnDelete, $btnEditPage;
global $btnPrev;
- global $pageid;
global $btnSave;
global $pageid;
--- 181,188 ----
function _managePage()
{
+
$this->globalize(array('hidden','btnAddPage','btnDelete','btnEditPage','btnPrev','pageid','btnSave','category_id','sort_order','parent','title','name','subtitle','main','error','savelanguage'));
global $hidden;
global $btnAddPage, $btnDelete, $btnEditPage;
global $btnPrev;
global $btnSave;
global $pageid;
***************
*** 138,141 ****
--- 195,199 ----
global $main;
global $error;
+ global $savelanguage;
$common_ui = CreateObject('sitemgr.Common_UI',True);
***************
*** 146,150 ****
if ($name == '' || $title == '' || $main == '')
{
! $this->t->set_var('message','You failed
to fill in one or more required fields.');
$this->_editPage($category_id,$pageid,$name,$title,$subtitle,$main);
exit;
--- 204,208 ----
if ($name == '' || $title == '' || $main == '')
{
! $this->t->set_var('message',lang('You
failed to fill in one or more required fields.'));
$this->_editPage($category_id,$pageid,$name,$title,$subtitle,$main);
exit;
***************
*** 160,164 ****
if(!$this->page->id)
{
! $save_msg = 'You don\'t have
permission to write in the category';
}
}
--- 218,222 ----
if(!$this->page->id)
{
! $save_msg = lang("You don't
have permission to write in the category");
}
}
***************
*** 181,189 ****
$this->page->hidden = 0;
}
! $save_msg =
$this->pagebo->savePageInfo($this->page);
}
if (!is_string($save_msg))
{
! echo('<p><b><font color="red">Page
saved.</font></b></p>');
}
else
--- 239,248 ----
$this->page->hidden = 0;
}
! $savelanguage = $savelanguage ?
$savelanguage : $this->sitelanguages[0];
! $save_msg =
$this->pagebo->savePageInfo($this->page,$savelanguage);
}
if (!is_string($save_msg))
{
! echo('<p><b><font color="red">' .
lang('Page saved.') . '</font></b></p>');
}
else
***************
*** 198,202 ****
if($btnPrev)
{
! echo 'Go back to the category manager';
$btnEditPage = False;
$btnPrev = False;
--- 257,261 ----
if($btnPrev)
{
! echo lang('Go back to the category manager.');
$btnEditPage = False;
$btnPrev = False;
***************
*** 220,223 ****
--- 279,283 ----
$this->t->set_block('ManagePage', 'PageBlock',
'PBlock');
$this->t->set_block('ManagePage',
'CategoryBlock', 'CBlock');
+ $this->t->set_var('page_manager', lang('Page
Manager'));
$this->cat_list =
$this->categorybo->getPermittedCategoryIDWriteList();
***************
*** 235,240 ****
{
$this->page_id
=$this->page_list[$j];
! $this->page =
$this->pagebo->getPage($this->page_id);
!
$page_description = '<b>Name: </b>'.$this->page->name.'<br><b>Title:
</b>'.$this->page->title;
$this->t->set_var('page', $page_description);
$this->t->set_var('edit',
--- 295,300 ----
{
$this->page_id
=$this->page_list[$j];
! $this->page =
$this->pagebo->getPage($this->page_id,$this->sitelanguages[0]);
!
$page_description = '<b>' . lang('Name') . ': </b>'.$this->page->name.'<br><b>'
. lang('Title') . ': </b>'.$this->page->title;
$this->t->set_var('page', $page_description);
$this->t->set_var('edit',
***************
*** 243,247 ****
'menuaction=sitemgr.contributor_ManagePage_UI._managePage').
'" method="POST">
! <input
type="submit" name="btnEditPage" value = "Edit">
<input
type="hidden" name="category_id" value="'.
$this->cat_id.'">
--- 303,307 ----
'menuaction=sitemgr.contributor_ManagePage_UI._managePage').
'" method="POST">
! <input
type="submit" name="btnEditPage" value="' . lang('Edit') .'">
<input
type="hidden" name="category_id" value="'.
$this->cat_id.'">
***************
*** 256,260 ****
'menuaction=sitemgr.contributor_ManagePage_UI._managePage').
'" method="POST">
! <input
type="submit" name="btnDelete" value="Delete">
<input
type="hidden" name="pageid" value="'.$this->page_id.'">
<input
type="hidden" name="category_id" value="'.
--- 316,320 ----
'menuaction=sitemgr.contributor_ManagePage_UI._managePage').
'" method="POST">
! <input
type="submit" name="btnDelete" value="' . lang('Delete') .'">
<input
type="hidden" name="pageid" value="'.$this->page_id.'">
<input
type="hidden" name="category_id" value="'.
***************
*** 268,275 ****
else
{
! $this->t->set_var('msg'
, 'This category has no pages.');
}
$this->t->set_var('number',
$i+1);
! $this->t->set_var('category',
'<b>'.$this->category->name.'</b>');
$this->t->set_var('add',
'<form action="'.
--- 328,336 ----
else
{
! $this->t->set_var('msg'
, lang('This category has no pages.'));
}
+ $padding =
str_pad('',12*$this->category->depth,' ');
$this->t->set_var('number',
$i+1);
! $this->t->set_var('category',
$padding.'<b>'.$this->category->name.'</b>');
$this->t->set_var('add',
'<form action="'.
***************
*** 277,281 ****
'menuaction=sitemgr.contributor_ManagePage_UI._managePage').
'" method="POST">
! <input type=submit
name="btnAddPage" value ="Add new page to this category">
<input type=hidden
name="category_id" value ="'.$this->cat_id .'">
</form>');
--- 338,342 ----
'menuaction=sitemgr.contributor_ManagePage_UI._managePage').
'" method="POST">
! <input type=submit
name="btnAddPage" value="' . lang('Add new page to this category') . '">
<input type=hidden
name="category_id" value ="'.$this->cat_id .'">
</form>');
***************
*** 287,291 ****
else
{
! echo 'I\'m sorry, you do not have write
permissions for any site categories.<br><br>';
}
}
--- 348,352 ----
else
{
! echo lang("I'm sorry, you do not have
write permissions for any site categories.") . '<br><br>';
}
}
Index: class.headerFooter_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.headerFooter_BO.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.headerFooter_BO.inc.php 29 Aug 2002 03:03:17 -0000 1.1.1.1
--- class.headerFooter_BO.inc.php 5 Dec 2002 22:15:00 -0000 1.2
***************
*** 13,31 ****
}
! function getSiteHeader()
{
! return $this->preferenceso->getPreference('siteheader');
}
! function getSiteFooter()
{
! return
$this->preferenceso->getPreference('sitefooter');
}
! function setSiteHeader($header)
{
if ($this->acl->is_admin())
{
!
if($this->preferenceso->setPreference('siteheader',$header))
{
return true;
--- 13,31 ----
}
! function getSiteHeader($lang)
{
! return
$this->preferenceso->getPreference('siteheader-'. $lang);
}
! function getSiteFooter($lang)
{
! return
$this->preferenceso->getPreference('sitefooter-'. $lang);
}
! function setSiteHeader($header,$lang)
{
if ($this->acl->is_admin())
{
!
if($this->preferenceso->setPreference('siteheader-'. $lang,$header))
{
return true;
***************
*** 42,50 ****
}
! function setSiteFooter($footer)
{
if ($this->acl->is_admin())
{
!
if($this->preferenceso->setPreference('sitefooter',$footer))
{
return true;
--- 42,50 ----
}
! function setSiteFooter($footer,$lang)
{
if ($this->acl->is_admin())
{
!
if($this->preferenceso->setPreference('sitefooter-'. $lang,$footer))
{
return true;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: sitemgr/inc class.ManageTranslations_UI.inc.php,1.1,1.2 class.Admin_ManageCategories_UI.inc.php,1.5,1.6 class.Categories_BO.inc.php,1.4,1.5 class.Categories_SO.inc.php,1.10,1.11 class.Common_UI.inc.php,1.6,1.7 class.MainMenu_UI.inc.php,1.3,1.4 class.Page_SO.inc.php,1.3,1.4 class.Pages_BO.inc.php,1.2,1.3 class.Pages_SO.inc.php,1.8,1.9 class.admin_ManageSiteContent_UI.inc.php,1.1.1.1,1.2 class.contributor_ManagePage_UI.inc.php,1.7,1.8 class.headerFooter_BO.inc.php,1.1.1.1,1.2,
Michael Totschnig <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site blockconfig.inc.php,1.3,1.4 config.inc.php.template,1.5,1.6 functions.inc.php,1.2,1.3 index.php,1.4,1.5 relocate.php,1.2,1.3
- Next by Date:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/inc class.blocks_bo.inc.php,1.1,1.2 class.Template2.inc.php,1.1,1.2 class.bo.inc.php,1.7,1.8 class.so.inc.php,1.1.1.1,1.2 class.ui.inc.php,1.8,1.9 phpnuke.compat.inc.php,1.5,1.6
- Previous by thread:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site blockconfig.inc.php,1.3,1.4 config.inc.php.template,1.5,1.6 functions.inc.php,1.2,1.3 index.php,1.4,1.5 relocate.php,1.2,1.3
- Next by thread:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/inc class.blocks_bo.inc.php,1.1,1.2 class.Template2.inc.php,1.1,1.2 class.bo.inc.php,1.7,1.8 class.so.inc.php,1.1.1.1,1.2 class.ui.inc.php,1.8,1.9 phpnuke.compat.inc.php,1.5,1.6
- Index(es):