Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
viewscard.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * View standalone document (without popup menu)
9  *
10  * @author Anakeen 2000
11  * @version $Id: viewscard.php,v 1.8 2005/11/04 15:38:29 marc Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 // ---------------------------------------------------------------
19 // $Id: viewscard.php,v 1.8 2005/11/04 15:38:29 marc Exp $
20 // $Source: /home/cvsroot/anakeen/freedom/freedom/Action/Fdl/viewscard.php,v $
21 // ---------------------------------------------------------------
22 include_once ("FDL/Class.Doc.php");
23 /**
24  * View a document without standard header and footer. It is display in raw format
25  * @param Action &$action current action
26  * @global id Http var : document identificator to see
27  * @global latest Http var : (Y|N) if Y force view latest revision
28  * @global abstract Http var : (Y|N) if Y view only abstract attribute
29  * @global zonebodycard Http var : if set, view other specific representation
30  * @global vid Http var : if set, view represention describe in view control (can be use only if doc has controlled view)
31  * @global ulink Http var : (Y|N)if N hyperlink are disabled
32  * @global target Http var : is set target of hyperlink can change (default _self)
33  */
34 function viewscard(&$action)
35 {
36  // GetAllParameters
37  $docid = GetHttpVars("id");
38  $abstract = (GetHttpVars("abstract", 'N') == "Y"); // view doc abstract attributes
39  $zonebodycard = GetHttpVars("zone"); // define view action
40  $ulink = (GetHttpVars("ulink", 'Y') == "Y"); // add url link
41  $target = GetHttpVars("target"); // may be mail
42  $wedit = (GetHttpVars("wedit") == "Y"); // send to be view by word editor
43  $fromedit = (GetHttpVars("fromedit", "N") == "Y"); // need to compose temporary doc
44  $latest = GetHttpVars("latest");
45  $tmime = GetHttpVars("tmime", ""); // type mime
46  $charset = GetHttpVars("chset", "UTF-8"); // charset
47  // Set the globals elements
48  $dbaccess = $action->GetParam("FREEDOM_DB");
49 
51  if (($latest == "Y") && ($doc->locked == - 1)) {
52  // get latest revision
53  $docid = $doc->latestId();
55  SetHttpVar("id", $docid);
56  }
57  $err = $doc->control("view");
58  if ($err != "") $action->exitError($err);
59  if ($fromedit) {
60  include_once ("FDL/modcard.php");
61 
62  $doc = $doc->copy(true, false, true);
64  $doc->modify();
65  setHttpVar("id", $doc->id);
66  }
67  if ($zonebodycard == "") $zonebodycard = $doc->defaultview;
68  if ($zonebodycard == "") $action->exitError(_("no zone specified"));
69 
70  $err = $doc->refresh();
71  $action->lay->Set("ZONESCARD", $doc->viewDoc($zonebodycard, $target, $ulink, $abstract));
72 
73  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/geometry.js");
74  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/subwindow.js");
75 
76  if ($wedit) {
77  $export_file = uniqid(getTmpDir() . "/export") . ".doc";
78 
79  $of = fopen($export_file, "w+");
80  fwrite($of, $action->lay->gen());
81  fclose($of);
82 
83  http_DownloadFile($export_file, chop($doc->title) . ".html", "application/msword");
84 
85  unlink($export_file);
86  exit;
87  }
88 
89  if ($tmime != "") {
90  header("Content-Type: $tmime; charset=$charset");
91  print $action->lay->gen();
92  exit;
93  }
94 }
95 ?>
← centre documentaire © anakeen - published under CC License - Dynacase