| 1 |
<?php
|
| 2 |
|
| 3 |
// $Header: /cvsroot/tikiwiki/tiki/tiki-export_sheet.php,v 1.3.2.2 2005/04/13 23:07:24 lphuberdeau Exp $
|
| 4 |
|
| 5 |
// Based on tiki-galleries.php
|
| 6 |
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
|
| 7 |
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
|
| 8 |
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
|
| 9 |
|
| 10 |
// Initialization
|
| 11 |
require_once ('tiki-setup.php');
|
| 12 |
require_once ('lib/sheet/grid.php');
|
| 13 |
|
| 14 |
// Now check permissions to access this page
|
| 15 |
/*
|
| 16 |
if($tiki_p_view != 'y') {
|
| 17 |
$smarty->assign('msg',tra("Permission denied you cannot view pages like this page"));
|
| 18 |
$smarty->display("error.tpl");
|
| 19 |
die;
|
| 20 |
}
|
| 21 |
*/
|
| 22 |
|
| 23 |
if ($feature_sheet != 'y') {
|
| 24 |
$smarty->assign('msg', tra("This feature is disabled").": feature_sheets");
|
| 25 |
|
| 26 |
$smarty->display("error.tpl");
|
| 27 |
die;
|
| 28 |
}
|
| 29 |
|
| 30 |
if ($tiki_p_view_sheet != 'y' && $tiki_p_admin != 'y' && $tiki_p_admin_sheet != 'y') {
|
| 31 |
$smarty->assign('msg', tra("Access Denied").": feature_sheets");
|
| 32 |
|
| 33 |
$smarty->display("error.tpl");
|
| 34 |
die;
|
| 35 |
}
|
| 36 |
|
| 37 |
$smarty->assign('sheetId', $_REQUEST["sheetId"]);
|
| 38 |
|
| 39 |
// Individual permissions are checked because we may be trying to edit the gallery
|
| 40 |
|
| 41 |
// Init smarty variables to blank values
|
| 42 |
//$smarty->assign('theme','');
|
| 43 |
|
| 44 |
$info = $sheetlib->get_sheet_info( $_REQUEST["sheetId"] );
|
| 45 |
|
| 46 |
$smarty->assign('title', $info['title']);
|
| 47 |
$smarty->assign('description', $info['description']);
|
| 48 |
|
| 49 |
$smarty->assign('page_mode', 'form' );
|
| 50 |
|
| 51 |
// Process the insertion or modification of a gallery here
|
| 52 |
|
| 53 |
$grid = &new TikiSheet;
|
| 54 |
|
| 55 |
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
| 56 |
{
|
| 57 |
$smarty->assign('page_mode', 'submit' );
|
| 58 |
|
| 59 |
$sheetId = $_REQUEST['sheetId'];
|
| 60 |
|
| 61 |
$handler = &new TikiSheetDatabaseHandler( $sheetId );
|
| 62 |
$grid->import( $handler );
|
| 63 |
|
| 64 |
$handler = $_REQUEST['handler'];
|
| 65 |
|
| 66 |
if( !in_array( $handler, TikiSheet::getHandlerList() ) )
|
| 67 |
{
|
| 68 |
$smarty->assign('msg', "Handler is not allowed.");
|
| 69 |
|
| 70 |
$smarty->display("error.tpl");
|
| 71 |
die;
|
| 72 |
}
|
| 73 |
|
| 74 |
$handler = &new $handler( "php://stdout" );
|
| 75 |
$grid->export( $handler );
|
| 76 |
|
| 77 |
exit;
|
| 78 |
}
|
| 79 |
else
|
| 80 |
{
|
| 81 |
$list = array();
|
| 82 |
|
| 83 |
$handlers = TikiSheet::getHandlerList();
|
| 84 |
|
| 85 |
foreach( $handlers as $key=>$handler )
|
| 86 |
{
|
| 87 |
$temp = &new $handler;
|
| 88 |
if( !$temp->supports( TIKISHEET_SAVE_DATA | TIKISHEET_SAVE_CALC ) )
|
| 89 |
continue;
|
| 90 |
|
| 91 |
$list[$key] = array(
|
| 92 |
"name" => $temp->name(),
|
| 93 |
"version" => $temp->version(),
|
| 94 |
"class" => $handler
|
| 95 |
);
|
| 96 |
}
|
| 97 |
|
| 98 |
$smarty->assign_by_ref( "handlers", $list );
|
| 99 |
}
|
| 100 |
|
| 101 |
$cat_type = 'sheet';
|
| 102 |
$cat_objid = $_REQUEST["sheetId"];
|
| 103 |
include_once ("categorize_list.php");
|
| 104 |
|
| 105 |
$section = 'sheet';
|
| 106 |
include_once ('tiki-section_options.php');
|
| 107 |
ask_ticket('sheet');
|
| 108 |
// Display the template
|
| 109 |
$smarty->assign('mid', 'tiki-export-sheets.tpl');
|
| 110 |
$smarty->display("tiki.tpl");
|
| 111 |
|
| 112 |
?>
|