[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: wcm/inc class.bosite.inc.php,1.3,1.4 class.sosit
From: |
Miles Lott <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: wcm/inc class.bosite.inc.php,1.3,1.4 class.sosite.inc.php,1.8,1.9 class.uisite.inc.php,1.11,1.12 |
Date: |
Sun, 24 Feb 2002 17:36:43 -0500 |
Update of /cvsroot/phpgroupware/wcm/inc
In directory subversions:/tmp/cvs-serv28174/inc
Modified Files:
class.bosite.inc.php class.sosite.inc.php class.uisite.inc.php
Log Message:
Add initial publishing to local files - makes nasty assumptions, but will print
the file anyway...
Index: class.bosite.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/wcm/inc/class.bosite.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.bosite.inc.php 14 Feb 2002 01:04:13 -0000 1.3
--- class.bosite.inc.php 24 Feb 2002 22:36:39 -0000 1.4
***************
*** 42,45 ****
--- 42,55 ----
);
+ var $publish_types = array(
+ 'ftp' => 'ftp',
+ 'http' => 'http',
+ 'scp' => 'scp',
+ 'local' => 'local'
+ );
+ var $site = array();
+
+ var $phpheader = '<?php /* This is where some code will go to
determine page and element expiration. */ ?>';
+
function bosite($session=False)
{
***************
*** 191,194 ****
--- 201,341 ----
}
return $newversion;
+ }
+
+ function publish($siteid='')
+ {
+ if(!$siteid)
+ {
+ return False;
+ }
+ $this->site = $this->read($siteid,True);
+
+ $out = $this->phpheader;
+
+ $elements = CreateObject('wcm.boelement');
+
+ $page = $this->site['site_pages'][0];
+
+ $SITE_ROOT = PHPGW_SERVER_ROOT . SEP . 'wcm' . SEP .
'website' . SEP . 'templates';
+ define('PHPGW_TEMPLATE_DIR',
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi'));
+
+ $tpl = CreateObject('phpgwapi.Template',$SITE_ROOT);
+
+ $tpl->set_file(array('frame' => 'frame.tpl'));
+
$tpl->set_block('frame','framing_table_start','framing_table_start');
+
$tpl->set_block('frame','framing_table_end','framing_table_end');
+ $tpl->set_block('frame','left_start','left_start');
+ $tpl->set_block('frame','left_end','left_end');
+ $tpl->set_block('frame','top_start','top_start');
+ $tpl->set_block('frame','top_end','top_end');
+ $tpl->set_block('frame','mid_start','mid_start');
+ $tpl->set_block('frame','mid_end','mid_end');
+ $tpl->set_block('frame','right_start','right_start');
+ $tpl->set_block('frame','right_end','right_end');
+ $tpl->set_block('frame','bottom_start','bottom_start');
+ $tpl->set_block('frame','bottom_end','bottom_end');
+
+ $site_left = $this->site['site_paneo'] ?
$page['page_left'] : $this->site['site_left'];
+ $site_mid = $this->site['site_paneo'] ?
$page['page_mid'] : $this->site['site_mid'];
+ $site_right = $this->site['site_paneo'] ?
$page['page_right'] : $this->site['site_right'];
+
+ $tpl->set_var('left_width', $site_left ? $site_left
: '120');
+ $tpl->set_var('mid_width', $site_mid ? $site_mid
: '*');
+ $tpl->set_var('mid_img_width', $site_mid ? $site_mid
: '350');
+ $tpl->set_var('right_width', $site_right ?
$site_right : '130');
+
+ /* Read and parse page header */
+ $header_data = $elements->read($page['page_header']);
+ $header = $header_data['element_source'];
+ $tpl->set_var('header',$header ? $header :
'<html><head>HEADER</head><body>');
+
+ /* Start of page body */
+ $out .= $tpl->fp('out','framing_table_start');
+
+ /* Now parse each top, left, middle, right, and bottom
element */
+ $_list = array('top','left','mid','right','bottom');
+
+ while(list(,$section) = each($_list))
+ {
+ $working = '';
+
+ while(list($key,$val) =
@each($page['page_elements'][$section]))
+ {
+ switch($val['element_type'])
+ {
+ case '4':
+ /* Hook */
+
$GLOBALS['phpgw']->hooks->single('website_' . $section,
$val['element_source'],True);
+ $working .=
$GLOBALS['phpgw_info']['wcm'][$section];
+ break;
+ case '3':
+ case '2':
+ /* file/image */
+
if(@stat($val['element_source']))
+ {
+ $f =
fopen($val['element_source'],'rb');
+ while($line =
fgets($f,1024))
+ {
+ $working .=
$line;
+ }
+ fclose($f);
+ unset($f);
+ unset($line);
+ }
+ break;
+ case '1':
+ /* HTML from db */
+ $working .=
$val['element_source'];
+ break;
+ default:
+ break;
+ }
+ }
+
+ $tpl->set_var($section . '_content', $working ?
$working : strtoupper($section));
+ $out .= $tpl->fp('out', $section . '_start');
+ $out .= $tpl->fp('out', $section . '_end');
+ }
+
+ /* Read and parse page footer */
+ $footer_data = $elements->read($page['page_footer']);
+ $footer = $footer_data['element_source'];
+ $tpl->set_var('footer',$footer ? $footer :
'FOOTER</body></html>');
+
+ /* end of page body */
+ $out .= $tpl->fp('out','framing_table_end');
+
+ if (PHP_OS != 'Windows' && PHP_OS != 'OS/2')
+ {
+ $out = ereg_replace("\r\n","\n",$out);
+ }
+
+ return $this->publish_local($out);
+ }
+
+ function publish_ftp()
+ {
+ }
+
+ function publish_http()
+ {
+ }
+
+ function publish_scp()
+ {
+ }
+
+ /* Write to a local file */
+ function publish_local($content='')
+ {
+ if(!$content)
+ {
+ return False;
+ }
+
+ $fp = fopen($this->site['site_puburl'] .
'/index.php','wb');
+ fwrite($fp,$content);
+ fclose($fp);
+ return True;
}
}
Index: class.sosite.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/wcm/inc/class.sosite.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.sosite.inc.php 17 Feb 2002 17:11:29 -0000 1.8
--- class.sosite.inc.php 24 Feb 2002 22:36:39 -0000 1.9
***************
*** 87,90 ****
--- 87,93 ----
$this->site['site_right'] =
$GLOBALS['phpgw']->db->f('site_right');
$this->site['site_paneo'] =
$GLOBALS['phpgw']->db->f('site_paneo');
+ $this->site['site_pubtype'] =
$GLOBALS['phpgw']->db->f('site_pubtype');
+ $this->site['site_puburl'] =
$GLOBALS['phpgw']->db->f('site_puburl');
+ $this->site['site_pubport'] =
$GLOBALS['phpgw']->db->f('site_pubport');
}
if($full)
***************
*** 131,136 ****
. "site_right=" .
intval($this->site['site_right']) . ","
. "site_version='" .
$this->site['site_version'] . "',"
! . "site_paneo=" .
intval($this->site['site_paneo'])
! . " WHERE site_id=" . intval($siteid);
$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
return True;
--- 134,142 ----
. "site_right=" .
intval($this->site['site_right']) . ","
. "site_version='" .
$this->site['site_version'] . "',"
! . "site_paneo=" .
intval($this->site['site_paneo']) . ","
! . "site_pubtype='" .
$this->site['site_pubtype'] . "',"
! . "site_puburl='" .
$this->site['site_puburl'] . "',"
! . "site_pubport=" .
intval($this->site['site_pubport'])
! . " WHERE site_id=" . intval($siteid);
$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
return True;
***************
*** 148,152 ****
$sql = "INSERT INTO $this->table
(site_name,site_title,site_url,site_root,site_security,"
.
"username,password,admin_name,admin_email,site_left,site_mid,site_right,"
! .
"site_pages,site_header,site_footer,site_version,site_paneo) VALUES('"
.
$GLOBALS['phpgw']->db->db_addslashes($site_info['site_name']) . "','"
.
$GLOBALS['phpgw']->db->db_addslashes($site_info['site_title']) . "','"
--- 154,159 ----
$sql = "INSERT INTO $this->table
(site_name,site_title,site_url,site_root,site_security,"
.
"username,password,admin_name,admin_email,site_left,site_mid,site_right,"
! .
"site_pages,site_header,site_footer,site_version,site_paneo,"
! . "site_pubtype,site_puburl,site_pubport)
VALUES('"
.
$GLOBALS['phpgw']->db->db_addslashes($site_info['site_name']) . "','"
.
$GLOBALS['phpgw']->db->db_addslashes($site_info['site_title']) . "','"
***************
*** 163,167 ****
. $site_info['site_header'] . "','"
. $site_info['site_footer'] . "','" .
$site_info['site_version'] . "',"
! . intval($site_info['site_paneo']) . ")";
$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
--- 170,177 ----
. $site_info['site_header'] . "','"
. $site_info['site_footer'] . "','" .
$site_info['site_version'] . "',"
! . intval($site_info['site_paneo']) . ",'"
! . $site_info['site_pubtype'] . "','"
! . $site_info['site_puburl'] . "',"
! . intval($site_info['site_pubport']) . ")";
$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
Index: class.uisite.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/wcm/inc/class.uisite.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** class.uisite.inc.php 24 Feb 2002 05:33:25 -0000 1.11
--- class.uisite.inc.php 24 Feb 2002 22:36:39 -0000 1.12
***************
*** 255,259 ****
'site_mid' =>
$GLOBALS['HTTP_POST_VARS']['site_mid'],
'site_right' =>
$GLOBALS['HTTP_POST_VARS']['site_right'],
! 'site_paneo' => $site_paneo
);
if($GLOBALS['HTTP_GET_VARS']['site_id'])
--- 255,261 ----
'site_mid' =>
$GLOBALS['HTTP_POST_VARS']['site_mid'],
'site_right' =>
$GLOBALS['HTTP_POST_VARS']['site_right'],
! 'site_paneo' => $site_paneo,
! 'site_puburl' =>
$GLOBALS['HTTP_POST_VARS']['site_puburl'],
! 'site_pubtype' =>
$GLOBALS['HTTP_POST_VARS']['site_pubtype']
);
if($GLOBALS['HTTP_GET_VARS']['site_id'])
***************
*** 309,312 ****
--- 311,316 ----
$GLOBALS['phpgw']->template->set_var('lang_add',lang('Add'));
$GLOBALS['phpgw']->template->set_var('lang_default',lang('Default'));
+
$GLOBALS['phpgw']->template->set_var('lang_pubtype',lang('Publish type'));
+
$GLOBALS['phpgw']->template->set_var('lang_puburl',lang('Publish URL'));
$GLOBALS['phpgw']->template->set_var('lang_reset',lang('Clear Form'));
$GLOBALS['phpgw']->template->set_var('lang_done',lang('Done'));
***************
*** 360,363 ****
--- 364,370 ----
}
+
$GLOBALS['phpgw']->template->set_var('site_pubtype',$this->formatted_list('site_pubtype',$this->bo->publish_types,$site['site_pubtype'],'',False,False));
+
$GLOBALS['phpgw']->template->set_var('site_puburl',$site['site_puburl']);
+
$GLOBALS['phpgw']->template->set_var('edithandle','');
$GLOBALS['phpgw']->template->set_var('addhandle','');
***************
*** 416,422 ****
--- 423,432 ----
if ($GLOBALS['HTTP_POST_VARS']['confirm'])
{
+ $this->bo->publish($site_id);
+ /*
echo 'Publish not working yet, but...';
$site = $this->bo->read($site_id);
_debug_array($site);
+ */
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: wcm/inc class.bosite.inc.php,1.3,1.4 class.sosite.inc.php,1.8,1.9 class.uisite.inc.php,1.11,1.12,
Miles Lott <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: wcm/website/templates frame.tpl,1.6,1.7
- Next by Date:
[Phpgroupware-cvs] CVS: wcm/setup setup.inc.php,1.6,1.7 tables_current.inc.php,1.4,1.5 tables_update.inc.php,1.3,1.4
- Previous by thread:
[Phpgroupware-cvs] CVS: wcm/website/templates frame.tpl,1.6,1.7
- Next by thread:
[Phpgroupware-cvs] CVS: wcm/setup setup.inc.php,1.6,1.7 tables_current.inc.php,1.4,1.5 tables_update.inc.php,1.3,1.4
- Index(es):