PMCORE-3839
This commit is contained in:
committed by
Mauricio Veliz
parent
3f6f6c5a30
commit
46988216f7
@@ -133,6 +133,7 @@ workflow/engine/xmlform/users/users_Options.xml
|
||||
workflow/public_html/skins/JSForms.js
|
||||
workflow/public_html/skins/ajax.js
|
||||
thirdparty/geshi
|
||||
thirdparty/html2ps_pdf
|
||||
thirdparty/libchart
|
||||
thirdparty/lime
|
||||
thirdparty/pear/Benchmark
|
||||
|
||||
1
thirdparty/html2ps_pdf/.htaccess
vendored
1
thirdparty/html2ps_pdf/.htaccess
vendored
@@ -1 +0,0 @@
|
||||
DirectoryIndex index.php
|
||||
77
thirdparty/html2ps_pdf/autofix.url.php
vendored
77
thirdparty/html2ps_pdf/autofix.url.php
vendored
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
|
||||
class AutofixUrl {
|
||||
function AutofixUrl() {
|
||||
}
|
||||
|
||||
function apply($url) {
|
||||
$parts = @parse_url($url);
|
||||
if ($parts === FALSE) {
|
||||
return null;
|
||||
};
|
||||
|
||||
/*
|
||||
* Check if path contains only RFC1738 compliant symbols and fix it
|
||||
* No graphic: 00-1F, 7F, 80-FF
|
||||
* Unsafe: 'space',<>"#%{}|\^~[]`
|
||||
* Reserved: ;/?:@=&
|
||||
*
|
||||
* Normally, slash is allowed in path part, and % may be a part of encoded character
|
||||
*/
|
||||
$no_graphic_found = preg_match('/[\x00-\x1F\x7F\x80-\xFF]/', $parts['path']);
|
||||
$unsafe_found = preg_match('/[ <>\"#{}\|\^~\[\]`]/', $parts['path']);
|
||||
$unsafe_percent_found = preg_match('/%[^\dA-F]|%\d[^\dA-F]/i', $parts['path']);
|
||||
$reserved_found = preg_match('/;\?:@=&/', $parts['path']);
|
||||
|
||||
if ($no_graphic_found ||
|
||||
$unsafe_found ||
|
||||
$unsafe_percent_found ||
|
||||
$reserved_found) {
|
||||
$parts['path'] = join('/', array_map('rawurlencode', explode('/',$parts['path'])));
|
||||
};
|
||||
|
||||
// Build updated URL
|
||||
$url_fixed = '';
|
||||
|
||||
if (isset($parts['scheme'])) {
|
||||
$url_fixed .= $parts['scheme'];
|
||||
$url_fixed .= '://';
|
||||
|
||||
if (isset($parts['user'])) {
|
||||
$url_fixed .= $parts['user'];
|
||||
if (isset($parts['pass'])) {
|
||||
$url_fixed .= ':';
|
||||
$url_fixed .= $parts['pass'];
|
||||
};
|
||||
$url_fixed .= '@';
|
||||
};
|
||||
|
||||
if (isset($parts['host'])) {
|
||||
$url_fixed .= $parts['host'];
|
||||
};
|
||||
|
||||
if (isset($parts['port'])) {
|
||||
$url_fixed .= ':';
|
||||
$url_fixed .= $parts['port'];
|
||||
};
|
||||
};
|
||||
|
||||
if (isset($parts['path'])) {
|
||||
$url_fixed .= $parts['path'];
|
||||
};
|
||||
|
||||
if (isset($parts['query'])) {
|
||||
$url_fixed .= '?';
|
||||
$url_fixed .= $parts['query'];
|
||||
};
|
||||
|
||||
if (isset($parts['fragment'])) {
|
||||
$url_fixed .= '#';
|
||||
$url_fixed .= $parts['fragment'];
|
||||
};
|
||||
|
||||
return $url_fixed;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
234
thirdparty/html2ps_pdf/background.image.php
vendored
234
thirdparty/html2ps_pdf/background.image.php
vendored
@@ -1,234 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package HTML2PS
|
||||
* @subpackage Document
|
||||
* Contains information about the background image to be rendered.
|
||||
*
|
||||
* If box does not have any background image it will still contain the
|
||||
* BackgroundImage object having $_url member set to NULL.
|
||||
*
|
||||
* @see GenericFormattedBox
|
||||
* @see CSSBackgroundImage
|
||||
|
||||
* @link http://www.w3.org/TR/CSS21/colors.html#q2 CSS 2.1 "The background"
|
||||
*/
|
||||
class BackgroundImage {
|
||||
/**
|
||||
* @var string URL of the background image file (may be NULL in case no background image specified).
|
||||
* @access private
|
||||
*/
|
||||
var $_url;
|
||||
|
||||
/**
|
||||
* @var Resource image to be displayed
|
||||
* @access private
|
||||
*/
|
||||
var $_image;
|
||||
|
||||
/**
|
||||
* Constructs new BackgroundImage object
|
||||
*
|
||||
* @param string $url URL of the image file (or NULL of no image should be rendered at all)
|
||||
* @param resource $image image object to be displayed
|
||||
*/
|
||||
function BackgroundImage($url, $image) {
|
||||
$this->_url = $url;
|
||||
$this->_image = $image;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Deep copy" routine; it is required for compatibility with PHP 5
|
||||
*
|
||||
* @return BackgroundImage A copy of current object
|
||||
*/
|
||||
function ©() {
|
||||
$value =& new BackgroundImage($this->_url, $this->_image);
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this value is equivalent to default value. According to CSS2, default value
|
||||
* if the 'background-image' is 'none' - no image at all; in this case $_url member should
|
||||
* contain NULL value.
|
||||
*
|
||||
* @link http://www.w3.org/TR/CSS21/colors.html#propdef-background-image CSS 2 'background-image' description
|
||||
*
|
||||
* @return boolean flag indicating whether this background image value is equivalent to default value
|
||||
*
|
||||
* @see CSSProperty::is_default()
|
||||
* @see CSSBackgroundImage::default_value()
|
||||
*/
|
||||
function is_default() {
|
||||
return is_null($this->_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the backgroung image using the specified output driver.
|
||||
*
|
||||
* @param OutputDriver $driver an output driver object
|
||||
* @param GenericFormattedBox $box an box owning this background image
|
||||
* @param int $repeat the 'background-repeat' value
|
||||
* @param BackgroundPosition $position the 'background-position' value
|
||||
*
|
||||
* @uses BackgroundPosition
|
||||
* @uses OutputDriver
|
||||
*/
|
||||
function show(&$driver, $box, $repeat, $position, $attachment) {
|
||||
/**
|
||||
* If no image should be rendered, just return
|
||||
* @see BackgroundImage::$_url
|
||||
*/
|
||||
if (is_null($this->_url)) {
|
||||
return;
|
||||
};
|
||||
|
||||
if (is_null($this->_image)) {
|
||||
return;
|
||||
};
|
||||
|
||||
if ($attachment == BACKGROUND_ATTACHMENT_FIXED &&
|
||||
$box->getCSSProperty(CSS_DISPLAY) == '-body') {
|
||||
$media =& $driver->get_media();
|
||||
$left = $box->get_left_background();
|
||||
$right = $box->get_right_background();
|
||||
$top = $driver->offset + mm2pt($media->margins['bottom']) + mm2pt($media->real_height());
|
||||
$bottom = $driver->offset + mm2pt($media->margins['bottom']);
|
||||
} else {
|
||||
$left = $box->get_left_background();
|
||||
$right = $box->get_right_background();
|
||||
$top = $box->get_top_background();
|
||||
$bottom = $box->get_bottom_background();
|
||||
};
|
||||
|
||||
/**
|
||||
* Setup clipping region for padding area. Note that background image is drawn in the padding
|
||||
* area which in generic case is greater than content area.
|
||||
*
|
||||
* @see OutputDriver::clip()
|
||||
*
|
||||
* @link http://www.w3.org/TR/CSS21/box.html#box-padding-area CSS 2.1 definition of padding area
|
||||
*/
|
||||
$driver->save();
|
||||
$driver->moveto($left, $top);
|
||||
$driver->lineto($right, $top);
|
||||
$driver->lineto($right, $bottom);
|
||||
$driver->lineto($left, $bottom);
|
||||
$driver->closepath();
|
||||
$driver->clip();
|
||||
|
||||
/**
|
||||
* get real image size in device points
|
||||
*
|
||||
* @see pt2pt()
|
||||
* @see px2pt()
|
||||
*/
|
||||
$image_height = px2pt(imagesy($this->_image));
|
||||
$image_width = px2pt(imagesx($this->_image));
|
||||
|
||||
/**
|
||||
* Get dimensions of the rectangle to be filled with the background image
|
||||
*/
|
||||
$padding_width = $right - $left;
|
||||
$padding_height = $top - $bottom;
|
||||
|
||||
/**
|
||||
* Calculate the vertical offset from the top padding edge to the background image top edge using current
|
||||
* 'background-position' value.
|
||||
*
|
||||
* @link file:///C:/docs/css/colors.html#propdef-background-position CSS 2 'background-position' description
|
||||
*/
|
||||
if ($position->x_percentage) {
|
||||
$x_offset = ($padding_width - $image_width) * $position->x / 100;
|
||||
} else {
|
||||
$x_offset = $position->x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the horizontal offset from the left padding edge to the background image left edge using current
|
||||
* 'background-position' value
|
||||
*
|
||||
* @link file:///C:/docs/css/colors.html#propdef-background-position CSS 2 'background-position' description
|
||||
*/
|
||||
if ($position->y_percentage) {
|
||||
$y_offset = ($padding_height - $image_height) * $position->y / 100;
|
||||
} else {
|
||||
$y_offset = $position->y;
|
||||
};
|
||||
|
||||
/**
|
||||
* Output the image (probably tiling it; depends on current value of 'background-repeat') using
|
||||
* current output driver's tiled image output functions. Note that px2pt(1) is an image scaling factor; as all
|
||||
* page element are scaled to fit the media, background images should be scaled too!
|
||||
*
|
||||
* @see OutputDriver::image()
|
||||
* @see OutputDriver::image_rx()
|
||||
* @see OutputDriver::image_ry()
|
||||
* @see OutputDriver::image_rxry()
|
||||
*
|
||||
* @link file:///C:/docs/css/colors.html#propdef-background-repeat CSS 2.1 'background-repeat' property description
|
||||
*/
|
||||
switch ($repeat) {
|
||||
case BR_NO_REPEAT:
|
||||
/**
|
||||
* 'background-repeat: no-repeat' case; no tiling at all
|
||||
*/
|
||||
$driver->image($this->_image,
|
||||
$left + $x_offset,
|
||||
$top - $image_height - $y_offset,
|
||||
px2pt(1));
|
||||
break;
|
||||
case BR_REPEAT_X:
|
||||
/**
|
||||
* 'background-repeat: repeat-x' case; horizontal tiling
|
||||
*/
|
||||
$driver->image_rx($this->_image,
|
||||
$left + $x_offset,
|
||||
$top - $image_height - $y_offset,
|
||||
$image_width,
|
||||
$right,
|
||||
$x_offset,
|
||||
$y_offset,
|
||||
px2pt(1));
|
||||
break;
|
||||
case BR_REPEAT_Y:
|
||||
/**
|
||||
* 'background-repeat: repeat-y' case; vertical tiling
|
||||
*/
|
||||
$driver->image_ry($this->_image,
|
||||
$left + $x_offset,
|
||||
$top - $image_height - $y_offset,
|
||||
$image_height,
|
||||
$bottom,
|
||||
$x_offset,
|
||||
$y_offset,
|
||||
px2pt(1));
|
||||
break;
|
||||
case BR_REPEAT:
|
||||
/**
|
||||
* 'background-repeat: repeat' case; full tiling
|
||||
*/
|
||||
$driver->image_rx_ry($this->_image,
|
||||
$left + $x_offset,
|
||||
$top - $image_height + $y_offset,
|
||||
$image_width,
|
||||
$image_height,
|
||||
$right,
|
||||
$bottom,
|
||||
$x_offset,
|
||||
$y_offset,
|
||||
px2pt(1));
|
||||
break;
|
||||
};
|
||||
|
||||
/**
|
||||
* Restore the previous clipping area
|
||||
*
|
||||
* @see OutputDriver::clip()
|
||||
* @see OutputDriver::restore()
|
||||
*/
|
||||
$driver->restore();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
88
thirdparty/html2ps_pdf/background.position.php
vendored
88
thirdparty/html2ps_pdf/background.position.php
vendored
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package HTML2PS
|
||||
* @subpackage Document
|
||||
* Represents the 'background-postitions' CSS property value
|
||||
*
|
||||
* @link http://www.w3.org/TR/CSS21/colors.html#propdef-background-position CSS 2.1 'background-position' property description
|
||||
*/
|
||||
class BackgroundPosition {
|
||||
/**
|
||||
* @var string X-offset value
|
||||
* @access public
|
||||
*/
|
||||
var $x;
|
||||
|
||||
/**
|
||||
* @var string Y-offset value
|
||||
* @access public
|
||||
*/
|
||||
var $y;
|
||||
|
||||
/**
|
||||
* @var boolean Indicates whether $x value contains absolute (false) or percentage (true) value
|
||||
* @access public
|
||||
*/
|
||||
var $x_percentage;
|
||||
|
||||
/**
|
||||
* @var boolean Indicates whether $y value contains absolute (false) or percentage (true) value
|
||||
* @access public
|
||||
*/
|
||||
var $y_percentage;
|
||||
|
||||
/**
|
||||
* Constructs new 'background-position' value object
|
||||
*
|
||||
* @param float $x X-offset value
|
||||
* @param boolean $x_percentage A flag indicating that $x value should be treated as percentage
|
||||
* @param float $y Y-offset value
|
||||
* @param boolean $y_percentage A flag indicating that $y value should be treated as percentage
|
||||
*/
|
||||
function BackgroundPosition($x, $x_percentage, $y, $y_percentage) {
|
||||
$this->x = $x;
|
||||
$this->x_percentage = $x_percentage;
|
||||
$this->y = $y;
|
||||
$this->y_percentage = $y_percentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* A "deep copy" routine; it is required for compatibility with PHP 5
|
||||
*
|
||||
* @return BackgroundPosition A copy of current object
|
||||
*/
|
||||
function ©() {
|
||||
$value =& new BackgroundPosition($this->x, $this->x_percentage,
|
||||
$this->y, $this->y_percentage);
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test is current value is equal to default 'background-position' CSS property value
|
||||
*/
|
||||
function is_default() {
|
||||
return
|
||||
$this->x == 0 &&
|
||||
$this->x_percentage &&
|
||||
$this->y == 0 &&
|
||||
$this->y_percentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the absolute lengths to the device points
|
||||
*
|
||||
* @param float $font_size Font size to use during conversion of 'ex' and 'em' units
|
||||
*/
|
||||
function units2pt($font_size) {
|
||||
if (!$this->x_percentage) {
|
||||
$this->x = units2pt($this->x, $font_size);
|
||||
};
|
||||
|
||||
if (!$this->y_percentage) {
|
||||
$this->y = units2pt($this->y, $font_size);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
159
thirdparty/html2ps_pdf/box.block.inline.php
vendored
159
thirdparty/html2ps_pdf/box.block.inline.php
vendored
@@ -1,159 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/html2ps/box.block.inline.php,v 1.20 2006/09/07 18:38:12 Konstantin Exp $
|
||||
|
||||
/**
|
||||
* @package HTML2PS
|
||||
* @subpackage Document
|
||||
*
|
||||
* Describes document elements with 'display: inline-block'.
|
||||
*
|
||||
* @link http://www.w3.org/TR/CSS21/visuren.html#value-def-inline-block CSS 2.1 description of 'display: inline-block'
|
||||
*/
|
||||
class InlineBlockBox extends GenericContainerBox {
|
||||
/**
|
||||
* Create new 'inline-block' element; add content from the parsed HTML tree automatically.
|
||||
*
|
||||
* @see InlineBlockBox::InlineBlockBox()
|
||||
* @see GenericContainerBox::create_content()
|
||||
*/
|
||||
function &create(&$root, &$pipeline) {
|
||||
$box = new InlineBlockBox();
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
$box->create_content($root, $pipeline);
|
||||
return $box;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new empty 'inline-block' element. Unlike InlineBlockBox::create(), constructor does not
|
||||
* initialize the box content.
|
||||
*
|
||||
* @see InlineBlockBox::create()
|
||||
*/
|
||||
function InlineBlockBox() {
|
||||
$this->GenericContainerBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout current inline-block element
|
||||
*
|
||||
* @param GenericContainerBox $parent The document element which should be treated as the parent of current element
|
||||
* @param FlowContext $context The flow context containing the additional layout data
|
||||
*
|
||||
* @see FlowContext
|
||||
* @see GenericContainerBox
|
||||
* @see BlockBox::reflow
|
||||
*
|
||||
* @todo this 'reflow' skeleton is common for all element types; thus, we probably should move the generic 'reflow'
|
||||
* definition to the GenericFormattedBox class, leaving only box-specific 'reflow_static' definitions in specific classes.
|
||||
*
|
||||
* @todo make relative positioning more CSS 2.1 compliant; currently, 'bottom' and 'right' CSS properties are ignored.
|
||||
*
|
||||
* @todo check whether percentage values should be really ignored during relative positioning
|
||||
*/
|
||||
function reflow(&$parent, &$context) {
|
||||
/**
|
||||
* Note that we may not worry about 'position: absolute' and 'position: fixed',
|
||||
* as, according to CSS 2.1 paragraph 9.7, these values of 'position'
|
||||
* will cause 'display' value to change to either 'block' or 'table'. Thus,
|
||||
* 'inline-block' boxes will never have 'position' value other than 'static' or 'relative'
|
||||
*
|
||||
* @link http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo CSS 2.1: Relationships between 'display', 'position', and 'float'
|
||||
*/
|
||||
|
||||
switch ($this->getCSSProperty(CSS_POSITION)) {
|
||||
case POSITION_STATIC:
|
||||
return $this->reflow_static($parent, $context);
|
||||
|
||||
case POSITION_RELATIVE:
|
||||
/**
|
||||
* CSS 2.1:
|
||||
* Once a box has been laid out according to the normal flow or floated, it may be shifted relative
|
||||
* to this position. This is called relative positioning. Offsetting a box (B1) in this way has no
|
||||
* effect on the box (B2) that follows: B2 is given a position as if B1 were not offset and B2 is
|
||||
* not re-positioned after B1's offset is applied. This implies that relative positioning may cause boxes
|
||||
* to overlap. However, if relative positioning causes an 'overflow:auto' box to have overflow, the UA must
|
||||
* allow the user to access this content, which, through the creation of scrollbars, may affect layout.
|
||||
*
|
||||
* @link http://www.w3.org/TR/CSS21/visuren.html#x28 CSS 2.1 Relative positioning
|
||||
*/
|
||||
|
||||
$this->reflow_static($parent, $context);
|
||||
$this->offsetRelative();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout current 'inline-block' element assument it has 'position: static'
|
||||
*
|
||||
* @param GenericContainerBox $parent The document element which should
|
||||
* be treated as the parent of current element
|
||||
*
|
||||
* @param FlowContext $context The flow context containing the additional layout data
|
||||
*
|
||||
* @see FlowContext
|
||||
* @see GenericContainerBox
|
||||
*
|
||||
* @todo re-check this layout routine; it seems that 'inline-block' boxes have
|
||||
* their width calculated incorrectly
|
||||
*/
|
||||
function reflow_static(&$parent, &$context) {
|
||||
GenericFormattedBox::reflow($parent, $context);
|
||||
|
||||
/**
|
||||
* Calculate margin values if they have been set as a percentage
|
||||
*/
|
||||
$this->_calc_percentage_margins($parent);
|
||||
$this->_calc_percentage_padding($parent);
|
||||
|
||||
/**
|
||||
* Calculate width value if it had been set as a percentage
|
||||
*/
|
||||
$this->_calc_percentage_width($parent, $context);
|
||||
|
||||
/**
|
||||
* Calculate 'auto' values of width and margins
|
||||
*/
|
||||
$this->_calc_auto_width_margins($parent);
|
||||
|
||||
/**
|
||||
* add current box to the parent's line-box (alone)
|
||||
*/
|
||||
$parent->append_line($this);
|
||||
|
||||
/**
|
||||
* Calculate position of the upper-left corner of the current box
|
||||
*/
|
||||
$this->guess_corner($parent);
|
||||
|
||||
/**
|
||||
* By default, child block box will fill all available parent width;
|
||||
* note that actual content width will be smaller because of non-zero padding, border and margins
|
||||
*/
|
||||
$this->put_full_width($parent->get_width());
|
||||
|
||||
/**
|
||||
* Layout element's children
|
||||
*/
|
||||
$this->reflow_content($context);
|
||||
|
||||
/**
|
||||
* Calculate element's baseline, as it should be aligned inside the
|
||||
* parent's line box vertically
|
||||
*/
|
||||
$font = $this->getCSSProperty(CSS_FONT);
|
||||
$this->default_baseline = $this->get_height() + $font->size->getPoints();
|
||||
|
||||
/**
|
||||
* Extend parent's height to fit current box
|
||||
*/
|
||||
$parent->extend_height($this->get_bottom_margin());
|
||||
|
||||
/**
|
||||
* Offset current x coordinate of parent box
|
||||
*/
|
||||
$parent->_current_x = $this->get_right_margin();
|
||||
}
|
||||
}
|
||||
?>
|
||||
465
thirdparty/html2ps_pdf/box.block.php
vendored
465
thirdparty/html2ps_pdf/box.block.php
vendored
File diff suppressed because it is too large
Load Diff
38
thirdparty/html2ps_pdf/box.body.php
vendored
38
thirdparty/html2ps_pdf/box.body.php
vendored
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
class BodyBox extends BlockBox {
|
||||
function &create(&$root, &$pipeline) {
|
||||
$box = new BodyBox();
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
$box->create_content($root, $pipeline);
|
||||
return $box;
|
||||
}
|
||||
|
||||
function get_bottom_background() {
|
||||
return $this->get_bottom_margin();
|
||||
}
|
||||
|
||||
function get_left_background() {
|
||||
return $this->get_left_margin();
|
||||
}
|
||||
|
||||
function get_right_background() {
|
||||
return $this->get_right_margin();
|
||||
}
|
||||
|
||||
function get_top_background() {
|
||||
return $this->get_top_margin();
|
||||
}
|
||||
|
||||
function reflow(&$parent, &$context) {
|
||||
parent::reflow($parent, $context);
|
||||
|
||||
// Extend the body height to fit all contained floats
|
||||
$float_bottom = $context->float_bottom();
|
||||
if (!is_null($float_bottom)) {
|
||||
$this->extend_height($float_bottom);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
201
thirdparty/html2ps_pdf/box.br.php
vendored
201
thirdparty/html2ps_pdf/box.br.php
vendored
@@ -1,201 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/html2ps/box.br.php,v 1.31 2006/11/11 13:43:51 Konstantin Exp $
|
||||
|
||||
require_once(HTML2PS_DIR.'layout.vertical.php');
|
||||
|
||||
/**
|
||||
* @package HTML2PS
|
||||
* @subpackage Document
|
||||
*
|
||||
* Class defined in this file handles the layout of "BR" HTML elements
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package HTML2PS
|
||||
* @subpackage Document
|
||||
*
|
||||
* The BRBox class dessribed the behavior of the BR HTML elements
|
||||
*
|
||||
* @link http://www.w3.org/TR/html4/struct/text.html#edef-BR HTML 4.01 Forcing a line break: the BR element
|
||||
*/
|
||||
class BRBox extends GenericBox {
|
||||
/**
|
||||
* Create new BR element
|
||||
*/
|
||||
function BRBox() {
|
||||
$this->GenericBox();
|
||||
}
|
||||
|
||||
function apply_clear($y, &$context) {
|
||||
return LayoutVertical::apply_clear($this, $y, $context);
|
||||
}
|
||||
|
||||
function out_of_flow() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function readCSS(&$state) {
|
||||
parent::readCSS($state);
|
||||
|
||||
/**
|
||||
* We treat BR as a block box; as default value of 'display' property is not 'block', we should
|
||||
* set it up manually.
|
||||
*/
|
||||
$this->setCSSProperty(CSS_DISPLAY, 'block');
|
||||
|
||||
$this->_readCSS($state,
|
||||
array(CSS_CLEAR));
|
||||
|
||||
$this->_readCSSLengths($state,
|
||||
array(CSS_MARGIN,
|
||||
CSS_LINE_HEIGHT));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new BR element
|
||||
*
|
||||
* @return BRBox new BR element object
|
||||
*/
|
||||
function &create(&$pipeline) {
|
||||
$box =& new BRBox();
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
return $box;
|
||||
}
|
||||
|
||||
/**
|
||||
* BR tags do not take any horizontal space, so if minimal width is zero.
|
||||
*
|
||||
* @param FlowContext $context The object containing auxiliary flow data; not used here/
|
||||
*
|
||||
* @return int should always return constant zero.
|
||||
*/
|
||||
function get_min_width(&$context) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* BR tags do not take any horizontal space, so if maximal width is zero.
|
||||
*
|
||||
* @param FlowContext $context The object containing auxiliary flow data; not used here.
|
||||
*
|
||||
* @return int should always return constant zero.
|
||||
*/
|
||||
function get_max_width(&$context) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout current BR element. The reflow routine is somewhat similar to the block box reflow routine.
|
||||
* As most CSS properties do not apply to BR elements, and BR element always have parent element,
|
||||
* the routine is much simpler.
|
||||
*
|
||||
* @param GenericContainerBox $parent The document element which should be treated as the parent of current element
|
||||
* @param FlowContext $context The flow context containing the additional layout data
|
||||
*
|
||||
* @see FlowContext
|
||||
* @see GenericContainerBox
|
||||
*/
|
||||
function reflow(&$parent, &$context) {
|
||||
parent::reflow($parent, $context);
|
||||
|
||||
/**
|
||||
* Apply 'clear' property; the current Y coordinate can be modified as a result of 'clear'.
|
||||
*/
|
||||
$y = $this->apply_clear($parent->_current_y, $context);
|
||||
|
||||
/**
|
||||
* Move current "box" to parent current coordinates. It is REQUIRED, in spite of the generated
|
||||
* box itself have no dimensions and will never be drawn, as several other routines uses box coordinates.
|
||||
*/
|
||||
$this->put_left($parent->_current_x);
|
||||
$this->put_top($y);
|
||||
|
||||
/**
|
||||
* If we met a sequence of BR tags (like <BR><BR>), we'll have an only one item in the parent's
|
||||
* line box - whitespace; in this case we'll need to additionally offset current y coordinate by the font size,
|
||||
* as whitespace alone does not affect the Y-coordinate.
|
||||
*/
|
||||
if ($parent->line_box_empty()) {
|
||||
/**
|
||||
* There's no elements in the parent line box at all (e.g in the following situation:
|
||||
* <div><br/> .. some text here...</div>); thus, as we're initiating
|
||||
* a new line, we need to offset current Y coordinate by the font-size value.
|
||||
*/
|
||||
|
||||
// Note that _current_y should be modified before 'close_line' call, as it checks for
|
||||
// left-floating boxes, causing an issues if line bottom will be placed below
|
||||
// float while line top is above float bottom margin
|
||||
$font = $this->getCSSProperty(CSS_FONT);
|
||||
$fs = $font->size;
|
||||
$parent->_current_y = min($this->get_bottom(),
|
||||
$parent->_current_y - $font->line_height->apply($fs->getPoints()));
|
||||
|
||||
$parent->close_line($context, true);
|
||||
} else {
|
||||
/**
|
||||
* There's at least 1 non-whitespace element in the parent line box, we do not need to use whitespace
|
||||
* height; the bottom of the line box is defined by the non-whitespace elements. Top of the new line
|
||||
* should be equal to that value.
|
||||
*/
|
||||
$parent->close_line($context, true);
|
||||
};
|
||||
|
||||
/**
|
||||
* We need to explicitly extend the parent's height, to make it contain the generated line,
|
||||
* as we don't know if it have any children _after_ this BR box. If we will not do it,
|
||||
* the following code will be rendred incorrectly:
|
||||
* <div>...some text...<br/></div>
|
||||
*/
|
||||
$parent->extend_height($parent->_current_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the BR element; as BR element is non-visual, we do nothing here.
|
||||
*
|
||||
* @param OutputDriver $driver Current output device driver object.
|
||||
*
|
||||
* @return boolean true in case the box was successfully rendered
|
||||
*/
|
||||
function show(&$driver) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* As BR element generated a line break, it means that a new line box will be started
|
||||
* (thus, any whitespaces immediately following the BR tag should not be rendered).
|
||||
* To indicate this, we reset the linebox_started flag to 'false' value.
|
||||
*
|
||||
* @param boolean $linebox_started Flag indicating that a new line box have just started and it already contains
|
||||
* some inline elements
|
||||
* @param boolean $previous_whitespace Flag indicating that a previous inline element was an whitespace element.
|
||||
*
|
||||
* @see GenericFormattedBox::reflow_whitespace()
|
||||
*/
|
||||
function reflow_whitespace(&$linebox_started, &$previous_whitespace) {
|
||||
$linebox_started = false;
|
||||
}
|
||||
|
||||
function get_height() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function get_width() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* BRBox may be placed inside InlineBox (white-space: pre)
|
||||
*/
|
||||
function get_ascender() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function get_descender() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function isLineBreak() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
149
thirdparty/html2ps_pdf/box.button.php
vendored
149
thirdparty/html2ps_pdf/box.button.php
vendored
@@ -1,149 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/html2ps/box.button.php,v 1.29 2007/01/24 18:55:43 Konstantin Exp $
|
||||
/**
|
||||
* @package HTML2PS
|
||||
* @subpackage Document
|
||||
*
|
||||
* This file contains the class desribing layout and behavior of 'input type="button"'
|
||||
* elements
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package HTML2PS
|
||||
* @subpackage Document
|
||||
*
|
||||
* The ButtonBox class desribes the HTML buttons layout. (Note that
|
||||
* button elements have 'display' CSS property set to HTML2PS-specific
|
||||
* '-button' value )
|
||||
*
|
||||
* @link http://www.w3.org/TR/html4/interact/forms.html#h-17.4 HTML 4.01 The INPUT element
|
||||
*/
|
||||
class ButtonBox extends InlineControlBox {
|
||||
function get_max_width(&$context, $limit = 10E6) {
|
||||
return
|
||||
GenericContainerBox::get_max_width($context, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new button element
|
||||
*
|
||||
* @param string $text text to be rendered on the button
|
||||
*/
|
||||
function ButtonBox() {
|
||||
$this->InlineControlBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new button element from the DOM tree element
|
||||
*
|
||||
* @param DOMElement $root pointer to the DOM tree element corresponding to the button.
|
||||
*
|
||||
* @return ButtonBox new button element
|
||||
*/
|
||||
function &create(&$root, &$pipeline) {
|
||||
/**
|
||||
* Button text is defined by its 'value' attrubute;
|
||||
* if this attribute is not specified, we should provide some
|
||||
* appropriate defaults depending on the exact button type:
|
||||
* reset, submit or generic button.
|
||||
*
|
||||
* Default button text values are specified in config file config.inc.php.
|
||||
*
|
||||
* @see config.inc.php
|
||||
* @see DEFAULT_SUBMIT_TEXT
|
||||
* @see DEFAULT_RESET_TEXT
|
||||
* @see DEFAULT_BUTTON_TEXT
|
||||
*/
|
||||
if ($root->has_attribute("value")) {
|
||||
$text = $root->get_attribute("value");
|
||||
} else {
|
||||
$text = DEFAULT_BUTTON_TEXT;
|
||||
};
|
||||
|
||||
$box =& new ButtonBox();
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
|
||||
/**
|
||||
* If button width is not constrained, then we'll add some space around the button text
|
||||
*/
|
||||
$text = " ".$text." ";
|
||||
|
||||
$box->_setup($text, $pipeline);
|
||||
|
||||
return $box;
|
||||
}
|
||||
|
||||
function _setup($text, &$pipeline) {
|
||||
/**
|
||||
* Contents of the text box are somewhat similar to the inline box:
|
||||
* a sequence of the text and whitespace boxes; we generate this sequence using
|
||||
* the InlineBox, then copy contents of the created inline box to our button.
|
||||
*
|
||||
* @todo probably, create_from_text() function should be extracted to the common parent
|
||||
* of inline boxes.
|
||||
*/
|
||||
$ibox = InlineBox::create_from_text($text, WHITESPACE_PRE, $pipeline);
|
||||
|
||||
$size = count($ibox->content);
|
||||
for ($i=0; $i<$size; $i++) {
|
||||
$this->add_child($ibox->content[$i]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Button height includes vertical padding (e.g. the following two buttons
|
||||
* <input type="button" value="test" style="padding: 10px; height: 50px;"/>
|
||||
* <input type="button" value="test" style="padding: 0px; height: 30px;"/>
|
||||
* are render by browsers with the same height!), so we'll need to adjust the
|
||||
* height constraint, subtracting the vertical padding value from the constraint
|
||||
* height value.
|
||||
*/
|
||||
$hc = $this->get_height_constraint();
|
||||
if (!is_null($hc->constant)) {
|
||||
$hc->constant[0] -= $this->get_padding_top() + $this->get_padding_bottom();
|
||||
};
|
||||
$this->put_height_constraint($hc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the form field corresponding to this button
|
||||
* (Will be overridden by subclasses; they may render more specific button types)
|
||||
*
|
||||
* @param OutputDriver $driver The output driver object
|
||||
*/
|
||||
function _render_field(&$driver) {
|
||||
$driver->field_pushbutton($this->get_left_padding(),
|
||||
$this->get_top_padding(),
|
||||
$this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
|
||||
$this->get_height() + $this->get_padding_top() + $this->get_padding_bottom());
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the button using the specified output driver
|
||||
*
|
||||
* @param OutputDriver $driver The output driver object
|
||||
*
|
||||
* @return boolean flag indicating an error (null value) or success (true)
|
||||
*/
|
||||
function show(&$driver) {
|
||||
/**
|
||||
* Set the baseline of a button box so that the button text will be aligned with
|
||||
* the line box baseline
|
||||
*/
|
||||
$this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
|
||||
$this->baseline = $this->content[0]->baseline + $this->get_extra_top();
|
||||
|
||||
|
||||
/**
|
||||
* Render the interactive button (if requested and possible)
|
||||
*/
|
||||
if ($GLOBALS['g_config']['renderforms']) {
|
||||
$status = GenericContainerBox::show($driver);
|
||||
$this->_render_field($driver);
|
||||
} else {
|
||||
$status = GenericContainerBox::show($driver);
|
||||
};
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
?>
|
||||
36
thirdparty/html2ps_pdf/box.button.reset.php
vendored
36
thirdparty/html2ps_pdf/box.button.reset.php
vendored
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
class ButtonResetBox extends ButtonBox {
|
||||
function ButtonResetBox($text) {
|
||||
$this->ButtonBox($text);
|
||||
}
|
||||
|
||||
function &create(&$root, &$pipeline) {
|
||||
if ($root->has_attribute("value")) {
|
||||
$text = $root->get_attribute("value");
|
||||
} else {
|
||||
$text = DEFAULT_RESET_TEXT;
|
||||
};
|
||||
|
||||
$box =& new ButtonResetBox($text);
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
|
||||
return $box;
|
||||
}
|
||||
|
||||
function readCSS(&$state) {
|
||||
parent::readCSS($state);
|
||||
|
||||
$this->_readCSS($state,
|
||||
array(CSS_HTML2PS_FORM_ACTION));
|
||||
}
|
||||
|
||||
function _render_field(&$driver) {
|
||||
$driver->field_pushbuttonreset($this->get_left_padding(),
|
||||
$this->get_top_padding(),
|
||||
$this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
|
||||
$this->get_height() + $this->get_padding_top() + $this->get_padding_bottom());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
91
thirdparty/html2ps_pdf/box.button.submit.php
vendored
91
thirdparty/html2ps_pdf/box.button.submit.php
vendored
@@ -1,91 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Handles INPUT type="submit" boxes generation.
|
||||
*/
|
||||
class ButtonSubmitBox extends ButtonBox {
|
||||
/**
|
||||
* @var String URL to post the form to; may be null if this is not a 'submit' button
|
||||
* @access private
|
||||
*/
|
||||
var $_action_url;
|
||||
|
||||
/**
|
||||
* Note: required for interative forms only
|
||||
*
|
||||
* @var String textual name of the input field
|
||||
* @access private
|
||||
*/
|
||||
var $_field_name;
|
||||
|
||||
/**
|
||||
* Note: required for interactive forms only
|
||||
*
|
||||
* @var String button name to display
|
||||
* @access private
|
||||
*/
|
||||
var $_value;
|
||||
|
||||
/**
|
||||
* Constructs new (possibly interactive) button box
|
||||
*
|
||||
* @param String $text text to display
|
||||
* @param String $field field name (interactive forms)
|
||||
* @param String $value field value (interactive forms)
|
||||
*/
|
||||
function ButtonSubmitBox($field, $value, $action) {
|
||||
$this->ButtonBox();
|
||||
$this->_action_url = $action;
|
||||
$this->_field_name = $field;
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create input box using DOM tree data
|
||||
*
|
||||
* @param Object $root DOM tree node corresponding to the box being created
|
||||
* @param Pipeline $pipeline reference to current pipeline object (unused)
|
||||
*
|
||||
* @return input box
|
||||
*/
|
||||
function &create(&$root, &$pipeline) {
|
||||
/**
|
||||
* If no "value" attribute is specified, display the default button text.
|
||||
* Note the difference between displayed text and actual field value!
|
||||
*/
|
||||
if ($root->has_attribute("value")) {
|
||||
$text = $root->get_attribute("value");
|
||||
} else {
|
||||
$text = DEFAULT_SUBMIT_TEXT;
|
||||
};
|
||||
|
||||
$field = $root->get_attribute('name');
|
||||
$value = $root->get_attribute('value');
|
||||
|
||||
$css_state =& $pipeline->getCurrentCSSState();
|
||||
$box =& new ButtonSubmitBox($field, $value, $css_state->getProperty(CSS_HTML2PS_FORM_ACTION));
|
||||
$box->readCSS($css_state);
|
||||
$box->_setup($text, $pipeline);
|
||||
|
||||
return $box;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render interactive field using the driver-specific capabilities;
|
||||
* button is rendered as a rectangle defined by margin and padding areas (note that unlike most other boxes,
|
||||
* borders are _outside_ the box, so we may treat
|
||||
*
|
||||
* @param OutputDriver $driver reference to current output driver object
|
||||
*/
|
||||
function _render_field(&$driver) {
|
||||
$driver->field_pushbuttonsubmit($this->get_left_padding() - $this->get_margin_left(),
|
||||
$this->get_top_padding() + $this->get_margin_top(),
|
||||
$this->get_width() + $this->get_padding_left() + $this->get_padding_right() + $this->get_margin_left() + $this->get_margin_right(),
|
||||
$this->get_height() + $this->get_padding_top() + $this->get_padding_bottom() + $this->get_margin_top() + $this->get_margin_bottom(),
|
||||
$this->_field_name,
|
||||
$this->_value,
|
||||
$this->_action_url);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
239
thirdparty/html2ps_pdf/box.checkbutton.php
vendored
239
thirdparty/html2ps_pdf/box.checkbutton.php
vendored
@@ -1,239 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/html2ps/box.checkbutton.php,v 1.20 2006/10/06 20:10:51 Konstantin Exp $
|
||||
|
||||
/**
|
||||
* @package HTML2PS
|
||||
* @subpackage Document
|
||||
*
|
||||
* This file contains the class describing layot and behavior of <input type="checkbox">
|
||||
* elements
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package HTML2PS
|
||||
* @subpackage Document
|
||||
*
|
||||
* The CheckBox class desribes the layour of HTML checkboxes (they have HTML2PS-specific
|
||||
* '-checkbox' value of 'display' property)
|
||||
*
|
||||
* Checkboxes have fixed size, which can be configured using CHECKBOX_SIZE constant
|
||||
* in config.inc.php file. If "checked" attribute is present (whatever its value is),
|
||||
* a small cross is drawn inside the checkbox.
|
||||
*
|
||||
* @see CHECKBOX_SIZE
|
||||
*
|
||||
* @todo add "disabled" state
|
||||
*/
|
||||
class CheckBox extends GenericFormattedBox {
|
||||
/**
|
||||
* @var Boolean Flag indicating whether the check mark should be drawn
|
||||
* @access private
|
||||
*/
|
||||
var $_checked;
|
||||
|
||||
/**
|
||||
* @var String name of the corresponding form field
|
||||
* @access private
|
||||
*/
|
||||
var $_name;
|
||||
|
||||
/**
|
||||
* Notes: leading and trailing spaces are removed; if value is not specified,
|
||||
* checkbox is not rendered as ineractive control
|
||||
*
|
||||
* @var String value to be posted from ineractive form for this checkbox
|
||||
* @access private
|
||||
*/
|
||||
var $_value;
|
||||
|
||||
/**
|
||||
* Create a new checkbutton element using DOM tree element to initialize
|
||||
* it.
|
||||
*
|
||||
* @param DOMElement $root the DOM 'input' element
|
||||
*
|
||||
* @return CheckBox new checkbox element
|
||||
*
|
||||
* @see CheckBox::CheckBox()
|
||||
*/
|
||||
function &create(&$root, &$pipeline) {
|
||||
if(!class_exists('G')){
|
||||
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
|
||||
$docuroot = explode( '/', $realdocuroot );
|
||||
array_pop( $docuroot );
|
||||
$pathhome = implode( '/', $docuroot ) . '/';
|
||||
array_pop( $docuroot );
|
||||
$pathTrunk = implode( '/', $docuroot ) . '/';
|
||||
require_once($pathTrunk.'gulliver/system/class.g.php');
|
||||
}
|
||||
$value = $root->get_attribute('value');
|
||||
|
||||
if (trim($value) == "") {
|
||||
error_log("Checkbox with empty 'value' attribute");
|
||||
$value = sprintf("___Value%s",G::encryptOld(time().rand()));
|
||||
};
|
||||
|
||||
$box =& new CheckBox($root->has_attribute('checked'),
|
||||
$root->get_attribute('name'),
|
||||
$value);
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
return $box;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new checkbox element with the given state
|
||||
*
|
||||
* @param $checked flag inidicating if this box should be checked
|
||||
*
|
||||
* @see CheckBox::create()
|
||||
*/
|
||||
function CheckBox($checked, $name, $value) {
|
||||
$this->GenericFormattedBox();
|
||||
|
||||
$this->_checked = $checked;
|
||||
$this->_name = trim($name);
|
||||
$this->_value = trim($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the width of the checkbox; not that max/min width does not
|
||||
* make sense for the checkbuttons, as their width is always constant.
|
||||
*
|
||||
* @param FlowContext Context object describing current flow parameters (unused)
|
||||
*
|
||||
* @return int width of the checkbox
|
||||
*
|
||||
* @see CheckBox::get_max_width
|
||||
*/
|
||||
function get_min_width(&$context) {
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the width of the checkbox; not that max/min width does not
|
||||
* make sense for the checkbuttons, as their width is always constant.
|
||||
*
|
||||
* @param FlowContext Context object describing current flow parameters (unused)
|
||||
*
|
||||
* @return int width of the checkbox
|
||||
*
|
||||
* @see CheckBox::get_min_width
|
||||
*/
|
||||
function get_max_width(&$context) {
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout current checkbox element. Note that most CSS properties do not apply to the
|
||||
* checkboxes; i.e. margin/padding values are ignored, checkboxes always aligned to
|
||||
* to bottom of current line, etc.
|
||||
*
|
||||
* @param GenericContainerBox $parent
|
||||
* @param FlowContext $context Context object describing current flow parameters
|
||||
*
|
||||
* @return Boolean flag indicating the error/success state; 'null' value in case of critical error
|
||||
*/
|
||||
function reflow(&$parent, &$context) {
|
||||
GenericFormattedBox::reflow($parent, $context);
|
||||
|
||||
/**
|
||||
* Check box size is constant (defined in config.inc.php) and is never affected
|
||||
* neither by CSS nor HTML.
|
||||
*
|
||||
* @see CHECKBOX_SIZE
|
||||
*/
|
||||
$this->default_baseline = units2pt(CHECKBOX_SIZE);
|
||||
$this->height = units2pt(CHECKBOX_SIZE);
|
||||
$this->width = units2pt(CHECKBOX_SIZE);
|
||||
|
||||
// set default baseline
|
||||
$this->baseline = $this->default_baseline;
|
||||
|
||||
// // Vertical-align
|
||||
// $this->_apply_vertical_align($parent);
|
||||
|
||||
/**
|
||||
* append to parent line box
|
||||
*/
|
||||
$parent->append_line($this);
|
||||
|
||||
/**
|
||||
* Determine coordinates of upper-left margin corner
|
||||
*/
|
||||
$this->guess_corner($parent);
|
||||
|
||||
/**
|
||||
* Offset parent current X coordinate
|
||||
*/
|
||||
$parent->_current_x += $this->get_full_width();
|
||||
|
||||
/**
|
||||
* Extend parents height to fit the checkbox
|
||||
*/
|
||||
$parent->extend_height($this->get_bottom_margin());
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the checkbox using the specified output driver
|
||||
*
|
||||
* @param OutputDriver $driver The output device driver object
|
||||
*/
|
||||
function show(&$driver) {
|
||||
/**
|
||||
* Get the coordinates of the check mark
|
||||
*/
|
||||
$x = ($this->get_left() + $this->get_right()) / 2;
|
||||
$y = ($this->get_top() + $this->get_bottom()) / 2;
|
||||
|
||||
/**
|
||||
* Calculate checkmark size; it looks nice when it takes
|
||||
* 1/3 of the box size
|
||||
*/
|
||||
$size = $this->get_width() / 3;
|
||||
|
||||
/**
|
||||
* Draw the box
|
||||
*/
|
||||
$driver->setrgbcolor(0,0,0);
|
||||
$driver->setlinewidth(0.25);
|
||||
$driver->moveto($x - $size, $y + $size);
|
||||
$driver->lineto($x + $size, $y + $size);
|
||||
$driver->lineto($x + $size, $y - $size);
|
||||
$driver->lineto($x - $size, $y - $size);
|
||||
$driver->closepath();
|
||||
$driver->stroke();
|
||||
|
||||
/**
|
||||
* Render the interactive button (if requested and possible)
|
||||
* Also, field should be rendered only if name is not empty
|
||||
*/
|
||||
global $g_config;
|
||||
if ($g_config['renderforms'] && $this->_name != "" && $this->_value != "") {
|
||||
$driver->field_checkbox($x - $size,
|
||||
$y + $size,
|
||||
2*$size,
|
||||
2*$size,
|
||||
$this->_name,
|
||||
$this->_value,
|
||||
$this->_checked);
|
||||
} else {
|
||||
/**
|
||||
* Draw check mark if needed
|
||||
*/
|
||||
if ($this->_checked) {
|
||||
$check_size = $this->get_width() / 6;
|
||||
|
||||
$driver->moveto($x - $check_size, $y + $check_size);
|
||||
$driver->lineto($x + $check_size, $y - $check_size);
|
||||
$driver->stroke();
|
||||
|
||||
$driver->moveto($x + $check_size, $y + $check_size);
|
||||
$driver->lineto($x - $check_size, $y - $check_size);
|
||||
$driver->stroke();
|
||||
}
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
1103
thirdparty/html2ps_pdf/box.container.php
vendored
1103
thirdparty/html2ps_pdf/box.container.php
vendored
File diff suppressed because it is too large
Load Diff
81
thirdparty/html2ps_pdf/box.field.pageno.php
vendored
81
thirdparty/html2ps_pdf/box.field.pageno.php
vendored
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
class BoxTextFieldPageNo extends TextBoxString {
|
||||
function BoxTextFieldPageNo() {
|
||||
$this->TextBoxString("", "iso-8859-1");
|
||||
}
|
||||
|
||||
function from_box(&$box) {
|
||||
$field = new BoxTextFieldPageNo;
|
||||
|
||||
$field->copy_style($box);
|
||||
|
||||
$field->words = array("000");
|
||||
$field->encodings = array("iso-8859-1");
|
||||
$field->_left = $box->_left;
|
||||
$field->_top = $box->_top;
|
||||
$field->baseline = $box->baseline;
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
function show(&$viewport) {
|
||||
$font = $this->getCSSProperty(CSS_FONT);
|
||||
|
||||
$this->words[0] = sprintf("%d", $viewport->current_page);
|
||||
|
||||
$field_width = $this->width;
|
||||
$field_left = $this->_left;
|
||||
|
||||
if ($font->size->getPoints() > 0) {
|
||||
$value_width = $viewport->stringwidth($this->words[0],
|
||||
$this->_get_font_name($viewport,0),
|
||||
$this->encodings[0],
|
||||
$font->size->getPoints());
|
||||
if (is_null($value_width)) { return null; };
|
||||
} else {
|
||||
$value_width = 0;
|
||||
};
|
||||
$this->width = $value_width;
|
||||
$this->_left += ($field_width - $value_width) / 2;
|
||||
|
||||
if (is_null(TextBoxString::show($viewport))) {
|
||||
return null;
|
||||
};
|
||||
|
||||
$this->width = $field_width;
|
||||
$this->_left = $field_left;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function show_fixed(&$viewport) {
|
||||
$font = $this->getCSSProperty(CSS_FONT);
|
||||
|
||||
$this->words[0] = sprintf("%d", $viewport->current_page);
|
||||
|
||||
$field_width = $this->width;
|
||||
$field_left = $this->_left;
|
||||
|
||||
if ($font->size->getPoints() > 0) {
|
||||
$value_width = $viewport->stringwidth($this->words[0],
|
||||
$this->_get_font_name($viewport, 0),
|
||||
$this->encodings[0],
|
||||
$font->size->getPoints());
|
||||
if (is_null($value_width)) { return null; };
|
||||
} else {
|
||||
$value_width = 0;
|
||||
};
|
||||
$this->width = $value_width;
|
||||
$this->_left += ($field_width - $value_width) / 2;
|
||||
|
||||
if (is_null(TextBoxString::show_fixed($viewport))) {
|
||||
return null;
|
||||
};
|
||||
|
||||
$this->width = $field_width;
|
||||
$this->_left = $field_left;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
89
thirdparty/html2ps_pdf/box.field.pages.php
vendored
89
thirdparty/html2ps_pdf/box.field.pages.php
vendored
@@ -1,89 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Handles the '##PAGES##' text field.
|
||||
*
|
||||
*/
|
||||
class BoxTextFieldPages extends TextBoxString {
|
||||
function BoxTextFieldPages() {
|
||||
$this->TextBoxString("", "iso-8859-1");
|
||||
}
|
||||
|
||||
function from_box(&$box) {
|
||||
$field = new BoxTextFieldPages;
|
||||
|
||||
$field->copy_style($box);
|
||||
|
||||
$field->words = array("000");
|
||||
$field->encodings = array("iso-8859-1");
|
||||
$field->_left = $box->_left;
|
||||
$field->_top = $box->_top;
|
||||
$field->baseline = $box->baseline;
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
function show(&$viewport) {
|
||||
$font = $this->getCSSProperty(CSS_FONT);
|
||||
|
||||
$this->words[0] = sprintf("%d", $viewport->expected_pages);
|
||||
|
||||
$field_width = $this->width;
|
||||
$field_left = $this->_left;
|
||||
|
||||
if ($font->size->getPoints() > 0) {
|
||||
$value_width = $viewport->stringwidth($this->words[0],
|
||||
$this->_get_font_name($viewport, 0),
|
||||
$this->encodings[0],
|
||||
$font->size->getPoints());
|
||||
if (is_null($value_width)) {
|
||||
return null;
|
||||
};
|
||||
} else {
|
||||
$value_width = 0;
|
||||
};
|
||||
$this->width = $value_width;
|
||||
$this->_left += ($field_width - $value_width) / 2;
|
||||
|
||||
if (is_null(TextBoxString::show($viewport))) {
|
||||
return null;
|
||||
};
|
||||
|
||||
$this->width = $field_width;
|
||||
$this->_left = $field_left;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function show_fixed(&$viewport) {
|
||||
$font = $this->getCSSProperty(CSS_FONT);
|
||||
|
||||
$this->words[0] = sprintf("%d", $viewport->expected_pages);
|
||||
|
||||
$field_width = $this->width;
|
||||
$field_left = $this->_left;
|
||||
|
||||
if ($font->size->getPoints() > 0) {
|
||||
$value_width = $viewport->stringwidth($this->words[0],
|
||||
$this->_get_font_name($viewport, 0),
|
||||
$this->encodings[0],
|
||||
$font->size->getPoints());
|
||||
if (is_null($value_width)) {
|
||||
return null;
|
||||
};
|
||||
} else {
|
||||
$value_width = 0;
|
||||
};
|
||||
$this->width = $value_width;
|
||||
$this->_left += ($field_width - $value_width) / 2;
|
||||
|
||||
if (is_null(TextBoxString::show_fixed($viewport))) {
|
||||
return null;
|
||||
};
|
||||
|
||||
$this->width = $field_width;
|
||||
$this->_left = $field_left;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
40
thirdparty/html2ps_pdf/box.form.php
vendored
40
thirdparty/html2ps_pdf/box.form.php
vendored
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
class FormBox extends BlockBox {
|
||||
/**
|
||||
* @var String form name; it will be used as a prefix for field names when submitting forms
|
||||
* @access private
|
||||
*/
|
||||
var $_name;
|
||||
|
||||
function show(&$driver) {
|
||||
global $g_config;
|
||||
if ($g_config['renderforms']) {
|
||||
$driver->new_form($this->_name);
|
||||
};
|
||||
return parent::show($driver);
|
||||
}
|
||||
|
||||
function &create(&$root, &$pipeline) {
|
||||
if ($root->has_attribute('name')) {
|
||||
$name = $root->get_attribute('name');
|
||||
} elseif ($root->has_attribute('id')) {
|
||||
$name = $root->get_attribute('id');
|
||||
} else {
|
||||
$name = "";
|
||||
};
|
||||
|
||||
$box = new FormBox($name);
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
$box->create_content($root, $pipeline);
|
||||
return $box;
|
||||
}
|
||||
|
||||
function FormBox($name) {
|
||||
$this->BlockBox();
|
||||
|
||||
$this->_name = $name;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
304
thirdparty/html2ps_pdf/box.frame.php
vendored
304
thirdparty/html2ps_pdf/box.frame.php
vendored
File diff suppressed because it is too large
Load Diff
1039
thirdparty/html2ps_pdf/box.generic.formatted.php
vendored
1039
thirdparty/html2ps_pdf/box.generic.formatted.php
vendored
File diff suppressed because it is too large
Load Diff
112
thirdparty/html2ps_pdf/box.generic.inline.php
vendored
112
thirdparty/html2ps_pdf/box.generic.inline.php
vendored
@@ -1,112 +0,0 @@
|
||||
<?php
|
||||
class GenericInlineBox extends GenericContainerBox {
|
||||
function GenericInlineBox() {
|
||||
$this->GenericContainerBox();
|
||||
}
|
||||
|
||||
// @todo this code is duplicated in box.block.php
|
||||
//
|
||||
function reflow(&$parent, &$context) {
|
||||
switch ($this->getCSSProperty(CSS_POSITION)) {
|
||||
case POSITION_STATIC:
|
||||
return $this->reflow_static($parent, $context);
|
||||
|
||||
case POSITION_RELATIVE:
|
||||
/**
|
||||
* CSS 2.1:
|
||||
* Once a box has been laid out according to the normal flow or floated, it may be shifted relative
|
||||
* to this position. This is called relative positioning. Offsetting a box (B1) in this way has no
|
||||
* effect on the box (B2) that follows: B2 is given a position as if B1 were not offset and B2 is
|
||||
* not re-positioned after B1's offset is applied. This implies that relative positioning may cause boxes
|
||||
* to overlap. However, if relative positioning causes an 'overflow:auto' box to have overflow, the UA must
|
||||
* allow the user to access this content, which, through the creation of scrollbars, may affect layout.
|
||||
*
|
||||
* @link http://www.w3.org/TR/CSS21/visuren.html#x28 CSS 2.1 Relative positioning
|
||||
*/
|
||||
|
||||
$this->reflow_static($parent, $context);
|
||||
$this->offsetRelative();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Checks if current inline box should cause a line break inside the parent box
|
||||
//
|
||||
// @param $parent reference to a parent box
|
||||
// @param $content flow context
|
||||
// @return true if line break occurred; false otherwise
|
||||
//
|
||||
function maybe_line_break(&$parent, &$context) {
|
||||
if (!$parent->line_break_allowed()) {
|
||||
return false;
|
||||
};
|
||||
|
||||
// Calculate the x-coordinate of this box right edge
|
||||
$right_x = $this->get_full_width() + $parent->_current_x;
|
||||
|
||||
$need_break = false;
|
||||
|
||||
// Check for right-floating boxes
|
||||
// If upper-right corner of this inline box is inside of some float, wrap the line
|
||||
if ($context->point_in_floats($right_x, $parent->_current_y)) {
|
||||
$need_break = true;
|
||||
};
|
||||
|
||||
// No floats; check if we had run out the right edge of container
|
||||
// TODO: nobr-before, nobr-after
|
||||
|
||||
if (($right_x > $parent->get_right() + EPSILON)) {
|
||||
// Now check if parent line box contains any other boxes;
|
||||
// if not, we should draw this box unless we have a floating box to the left
|
||||
|
||||
$first = $parent->get_first();
|
||||
|
||||
// FIXME: what's this? This condition is invariant!
|
||||
$text_indent = $parent->getCSSProperty(CSS_TEXT_INDENT);
|
||||
$indent_offset = ($first->uid == $this->uid || 1) ? $text_indent->calculate($parent) : 0;
|
||||
|
||||
if ($parent->_current_x > $parent->get_left() + $indent_offset + EPSILON) {
|
||||
$need_break = true;
|
||||
};
|
||||
}
|
||||
|
||||
// As close-line will not change the current-Y parent coordinate if no
|
||||
// items were in the line box, we need to offset this explicitly in this case
|
||||
//
|
||||
if ($parent->line_box_empty() && $need_break) {
|
||||
$parent->_current_y -= $this->get_height();
|
||||
};
|
||||
|
||||
if ($need_break) {
|
||||
$parent->close_line($context);
|
||||
|
||||
// Check if parent inline boxes have left padding/margins and add them to current_x
|
||||
$element = $this->parent;
|
||||
while (!is_null($element) && is_a($element,"GenericInlineBox")) {
|
||||
$parent->_current_x += $element->get_extra_left();
|
||||
$element = $element->parent;
|
||||
};
|
||||
};
|
||||
|
||||
return $need_break;
|
||||
}
|
||||
|
||||
function get_ascender() {
|
||||
$first =& $this->get_first();
|
||||
if (is_null($first)) { return 0; };
|
||||
return $first->get_ascender();
|
||||
}
|
||||
|
||||
function get_baseline() {
|
||||
$first =& $this->get_first();
|
||||
if (is_null($first)) { return 0; };
|
||||
return $first->get_baseline();
|
||||
}
|
||||
|
||||
function get_descender() {
|
||||
$first =& $this->get_first();
|
||||
if (is_null($first)) { return 0; };
|
||||
return $first->get_descender();
|
||||
}
|
||||
}
|
||||
?>
|
||||
454
thirdparty/html2ps_pdf/box.generic.php
vendored
454
thirdparty/html2ps_pdf/box.generic.php
vendored
File diff suppressed because it is too large
Load Diff
76
thirdparty/html2ps_pdf/box.iframe.php
vendored
76
thirdparty/html2ps_pdf/box.iframe.php
vendored
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/html2ps/box.iframe.php,v 1.14 2006/12/18 19:44:21 Konstantin Exp $
|
||||
|
||||
class IFrameBox extends InlineBlockBox {
|
||||
function &create(&$root, &$pipeline) {
|
||||
$box =& new IFrameBox($root, $pipeline);
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
return $box;
|
||||
}
|
||||
|
||||
// Note that IFRAME width is NOT determined by its content, thus we need to override 'get_min_width' and
|
||||
// 'get_max_width'; they should return the constrained frame width.
|
||||
function get_min_width(&$context) {
|
||||
return $this->get_max_width($context);
|
||||
}
|
||||
|
||||
function get_max_width(&$context) {
|
||||
return $this->get_width();
|
||||
}
|
||||
|
||||
function IFrameBox(&$root, $pipeline) {
|
||||
$this->InlineBlockBox();
|
||||
|
||||
// If NO src attribute specified, just return.
|
||||
if (!$root->has_attribute('src') ||
|
||||
trim($root->get_attribute('src')) == '') {
|
||||
return;
|
||||
};
|
||||
|
||||
// Determine the fullly qualified URL of the frame content
|
||||
$src = $root->get_attribute('src');
|
||||
$url = $pipeline->guess_url($src);
|
||||
$data = $pipeline->fetch($url);
|
||||
|
||||
/**
|
||||
* If framed page could not be fetched return immediately
|
||||
*/
|
||||
if (is_null($data)) { return; };
|
||||
|
||||
/**
|
||||
* Render only iframes containing HTML only
|
||||
*
|
||||
* Note that content-type header may contain additional information after the ';' sign
|
||||
*/
|
||||
$content_type = $data->get_additional_data('Content-Type');
|
||||
$content_type_array = explode(';', $content_type);
|
||||
if ($content_type_array[0] != "text/html") { return; };
|
||||
|
||||
$html = $data->get_content();
|
||||
|
||||
// Remove control symbols if any
|
||||
$html = preg_replace('/[\x00-\x07]/', "", $html);
|
||||
$converter = Converter::create();
|
||||
$html = $converter->to_utf8($html, $data->detect_encoding());
|
||||
$html = html2xhtml($html);
|
||||
$tree = TreeBuilder::build($html);
|
||||
|
||||
// Save current stylesheet, as each frame may load its own stylesheets
|
||||
//
|
||||
$pipeline->pushCSS();
|
||||
$css =& $pipeline->getCurrentCSS();
|
||||
$css->scan_styles($tree, $pipeline);
|
||||
|
||||
$frame_root = traverse_dom_tree_pdf($tree);
|
||||
$box_child =& create_pdf_box($frame_root, $pipeline);
|
||||
$this->add_child($box_child);
|
||||
|
||||
// Restore old stylesheet
|
||||
//
|
||||
$pipeline->popCSS();
|
||||
|
||||
$pipeline->pop_base_url();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
347
thirdparty/html2ps_pdf/box.img.php
vendored
347
thirdparty/html2ps_pdf/box.img.php
vendored
File diff suppressed because it is too large
Load Diff
69
thirdparty/html2ps_pdf/box.inline.control.php
vendored
69
thirdparty/html2ps_pdf/box.inline.control.php
vendored
@@ -1,69 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/html2ps/box.inline.control.php,v 1.7 2006/09/07 18:38:12 Konstantin Exp $
|
||||
|
||||
class InlineControlBox extends InlineBox {
|
||||
// get_max_width is inherited from GenericContainerBox
|
||||
function get_min_width(&$context, $limit = 10E6) {
|
||||
return $this->get_max_width($context, $limit);
|
||||
}
|
||||
|
||||
function get_max_width(&$context, $limit = 10E6) {
|
||||
return
|
||||
GenericContainerBox::get_max_width($context, $limit) -
|
||||
$this->_get_hor_extra();
|
||||
}
|
||||
|
||||
function show(&$viewport) {
|
||||
// Now set the baseline of a button box to align it vertically when flowing isude the
|
||||
// text line
|
||||
$this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
|
||||
$this->baseline = $this->content[0]->baseline + $this->get_extra_top();
|
||||
|
||||
return GenericContainerBox::show($viewport);
|
||||
}
|
||||
|
||||
function line_break_allowed() { return false; }
|
||||
|
||||
function reflow_static(&$parent, &$context) {
|
||||
GenericFormattedBox::reflow($parent, $context);
|
||||
|
||||
// Determine the box width
|
||||
$this->_calc_percentage_width($parent, $context);
|
||||
|
||||
$this->put_full_width($this->get_min_width($context, $parent->get_width()));
|
||||
$this->setCSSProperty(CSS_WIDTH, new WCNone());
|
||||
|
||||
// Check if we need a line break here
|
||||
$this->maybe_line_break($parent, $context);
|
||||
|
||||
// append to parent line box
|
||||
$parent->append_line($this);
|
||||
|
||||
// Determine coordinates of upper-left _margin_ corner
|
||||
$this->guess_corner($parent);
|
||||
|
||||
$this->reflow_content($context);
|
||||
|
||||
/**
|
||||
* After text content have been reflown, we may determine the baseline of the control item itself;
|
||||
*
|
||||
* As there will be some extra whitespace on the top of the control box, we must add this whitespace
|
||||
* to the calculated baseline value, so text before and after control item will be aligned
|
||||
* with the text inside the box.
|
||||
*/
|
||||
$this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
|
||||
$this->baseline = $this->content[0]->baseline + $this->get_extra_top();
|
||||
|
||||
// center the button text vertically inside the button
|
||||
$text =& $this->content[0];
|
||||
$delta = ($text->get_top() - $text->get_height()/2) - ($this->get_top() - $this->get_height()/2);
|
||||
$text->offset(0,-$delta);
|
||||
|
||||
// Offset parent current X coordinate
|
||||
$parent->_current_x += $this->get_full_width();
|
||||
|
||||
// Extends parents height
|
||||
$parent->extend_height($this->get_bottom_margin());
|
||||
}
|
||||
}
|
||||
?>
|
||||
498
thirdparty/html2ps_pdf/box.inline.php
vendored
498
thirdparty/html2ps_pdf/box.inline.php
vendored
File diff suppressed because it is too large
Load Diff
48
thirdparty/html2ps_pdf/box.inline.simple.php
vendored
48
thirdparty/html2ps_pdf/box.inline.simple.php
vendored
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once(HTML2PS_DIR.'box.generic.formatted.php');
|
||||
|
||||
class SimpleInlineBox extends GenericBox {
|
||||
function SimpleInlineBox() {
|
||||
$this->GenericBox();
|
||||
}
|
||||
|
||||
function readCSS(&$state) {
|
||||
parent::readCSS($state);
|
||||
|
||||
$this->_readCSS($state,
|
||||
array(CSS_TEXT_DECORATION,
|
||||
CSS_TEXT_TRANSFORM));
|
||||
|
||||
// '-html2ps-link-target'
|
||||
global $g_config;
|
||||
if ($g_config["renderlinks"]) {
|
||||
$this->_readCSS($state,
|
||||
array(CSS_HTML2PS_LINK_TARGET));
|
||||
};
|
||||
}
|
||||
|
||||
function get_extra_left() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function get_extra_top() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function get_extra_right() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function get_extra_bottom() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function show(&$driver) {
|
||||
parent::show($driver);
|
||||
|
||||
$strategy =& new StrategyLinkRenderingNormal();
|
||||
$strategy->apply($this, $driver);
|
||||
}
|
||||
}
|
||||
?>
|
||||
128
thirdparty/html2ps_pdf/box.input.img.php
vendored
128
thirdparty/html2ps_pdf/box.input.img.php
vendored
@@ -1,128 +0,0 @@
|
||||
<?php
|
||||
|
||||
class ButtonBrokenImageBox extends BrokenImgBox {
|
||||
var $_field_name;
|
||||
var $_field_value;
|
||||
var $_action_url;
|
||||
|
||||
function ButtonBrokenImageBox($width, $height, $alt, $field, $value, $action_url) {
|
||||
$this->BrokenImgBox($width, $height, $alt);
|
||||
|
||||
$this->_field_name = $field;
|
||||
$this->_field_value = $value;
|
||||
$this->set_action_url($action_url);
|
||||
}
|
||||
|
||||
function readCSS(&$state) {
|
||||
parent::readCSS($state);
|
||||
|
||||
$this->_readCSS($state,
|
||||
array(CSS_HTML2PS_FORM_ACTION));
|
||||
}
|
||||
|
||||
function set_action_url($action_url) {
|
||||
$this->_action_url = $action_url;
|
||||
}
|
||||
|
||||
function show(&$driver) {
|
||||
$status = parent::show($driver);
|
||||
|
||||
global $g_config;
|
||||
if ($g_config['renderforms']) {
|
||||
$driver->field_pushbuttonimage($this->get_left_padding(),
|
||||
$this->get_top_padding(),
|
||||
$this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
|
||||
$this->get_height() + $this->get_padding_top() + $this->get_padding_bottom(),
|
||||
$this->_field_name,
|
||||
$this->_field_value,
|
||||
$this->_action_url);
|
||||
};
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
class ButtonImageBox extends ImgBox {
|
||||
var $_field_name;
|
||||
var $_field_value;
|
||||
var $_action_url;
|
||||
|
||||
function ButtonImageBox($img, $field, $value, $action_url) {
|
||||
$this->ImgBox($img);
|
||||
|
||||
$this->_field_name = $field;
|
||||
$this->_field_value = $value;
|
||||
$this->set_action_url($action_url);
|
||||
}
|
||||
|
||||
function readCSS(&$state) {
|
||||
parent::readCSS($state);
|
||||
|
||||
$this->_readCSS($state,
|
||||
array(CSS_HTML2PS_FORM_ACTION));
|
||||
}
|
||||
|
||||
function set_action_url($action_url) {
|
||||
$this->_action_url = $action_url;
|
||||
}
|
||||
|
||||
function show(&$driver) {
|
||||
$status = parent::show($driver);
|
||||
|
||||
global $g_config;
|
||||
if ($g_config['renderforms']) {
|
||||
$driver->field_pushbuttonimage($this->get_left_padding(),
|
||||
$this->get_top_padding(),
|
||||
$this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
|
||||
$this->get_height() + $this->get_padding_top() + $this->get_padding_bottom(),
|
||||
$this->_field_name,
|
||||
$this->_field_value,
|
||||
$this->_action_url);
|
||||
};
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
function &create(&$root, &$pipeline) {
|
||||
$name = $root->get_attribute('name');
|
||||
$value = $root->get_attribute('value');
|
||||
|
||||
$url_autofix = new AutofixUrl();
|
||||
$src = $url_autofix->apply(trim($root->get_attribute("src")));
|
||||
|
||||
$src_img = Image::get($pipeline->guess_url($src), $pipeline);
|
||||
if (is_null($src_img)) {
|
||||
error_log(sprintf("Cannot open image at '%s'", $src));
|
||||
|
||||
if ($root->has_attribute('width')) {
|
||||
$width = px2pt($root->get_attribute('width'));
|
||||
} else {
|
||||
$width = px2pt(BROKEN_IMAGE_DEFAULT_SIZE_PX);
|
||||
};
|
||||
|
||||
if ($root->has_attribute('height')) {
|
||||
$height = px2pt($root->get_attribute('height'));
|
||||
} else {
|
||||
$height = px2pt(BROKEN_IMAGE_DEFAULT_SIZE_PX);
|
||||
};
|
||||
|
||||
$alt = $root->get_attribute('alt');
|
||||
|
||||
$css_state =& $pipeline->getCurrentCSSState();
|
||||
$box =& new ButtonBrokenImagebox($width, $height, $alt, $name, $value,
|
||||
$css_state->getProperty(CSS_HTML2PS_FORM_ACTION));
|
||||
$box->readCSS($css_state);
|
||||
return $box;
|
||||
};
|
||||
|
||||
$css_state =& $pipeline->getCurrentCSSState();
|
||||
$box =& new ButtonImageBox($src_img, $name, $value,
|
||||
$css_state->getProperty(CSS_HTML2PS_FORM_ACTION));
|
||||
$box->readCSS($css_state);
|
||||
$box->_setupSize();
|
||||
|
||||
return $box;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
66
thirdparty/html2ps_pdf/box.input.password.php
vendored
66
thirdparty/html2ps_pdf/box.input.password.php
vendored
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/html2ps/box.input.password.php,v 1.6 2006/10/06 20:10:52 Konstantin Exp $
|
||||
|
||||
class PasswordInputBox extends TextInputBox {
|
||||
function &create(&$root, &$pipeline) {
|
||||
// Text to be displayed
|
||||
if ($root->has_attribute('value')) {
|
||||
$text = str_repeat("*",strlen($root->get_attribute("value")));
|
||||
} else {
|
||||
$text = "";
|
||||
};
|
||||
|
||||
/**
|
||||
* Input field name
|
||||
*/
|
||||
$name = $root->get_attribute('name');
|
||||
|
||||
$box =& new PasswordInputBox($text, $root->get_attribute("value"), $name);
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
|
||||
$ibox = InlineBox::create_from_text(" ", WHITESPACE_PRE, $pipeline);
|
||||
for ($i=0, $size = count($ibox->content); $i<$size; $i++) {
|
||||
$box->add_child($ibox->content[$i]);
|
||||
};
|
||||
|
||||
return $box;
|
||||
}
|
||||
|
||||
function show(&$driver) {
|
||||
// Now set the baseline of a button box to align it vertically when flowing isude the
|
||||
// text line
|
||||
$this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
|
||||
$this->baseline = $this->content[0]->baseline + $this->get_extra_top();
|
||||
|
||||
/**
|
||||
* If we're rendering the interactive form, the field content should not be rendered
|
||||
*/
|
||||
global $g_config;
|
||||
if ($g_config['renderforms']) {
|
||||
/**
|
||||
* Render background/borders only
|
||||
*/
|
||||
$status = GenericFormattedBox::show($driver);
|
||||
|
||||
/**
|
||||
* @todo encoding name?
|
||||
* @todo font name?
|
||||
* @todo check if font is embedded for PDFLIB
|
||||
*/
|
||||
$driver->field_password($this->get_left_padding(),
|
||||
$this->get_top_padding(),
|
||||
$this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
|
||||
$this->get_height() + $this->get_padding_top() + $this->get_padding_bottom(),
|
||||
$this->_value,
|
||||
$this->_field_name);
|
||||
} else {
|
||||
/**
|
||||
* Render everything, including content
|
||||
*/
|
||||
$status = GenericContainerBox::show($driver);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
?>
|
||||
103
thirdparty/html2ps_pdf/box.input.text.php
vendored
103
thirdparty/html2ps_pdf/box.input.text.php
vendored
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/html2ps/box.input.text.php,v 1.28 2007/01/03 19:39:29 Konstantin Exp $
|
||||
|
||||
/// define('SIZE_SPACE_KOEFF',1.65); (defined in tag.input.inc.php)
|
||||
|
||||
class TextInputBox extends InlineControlBox {
|
||||
/**
|
||||
* @var String contains the default value of this text field
|
||||
* @access private
|
||||
*/
|
||||
var $_value;
|
||||
|
||||
function TextInputBox($value, $name) {
|
||||
// Call parent constructor
|
||||
$this->InlineBox();
|
||||
|
||||
$this->_value = $value;
|
||||
$this->_field_name = $name;
|
||||
}
|
||||
|
||||
function &create(&$root, &$pipeline) {
|
||||
// Text to be displayed
|
||||
if ($root->has_attribute('value')) {
|
||||
$text = trim($root->get_attribute("value"));
|
||||
} else {
|
||||
$text = "";
|
||||
};
|
||||
|
||||
/**
|
||||
* Input field name
|
||||
*/
|
||||
$name = $root->get_attribute('name');
|
||||
|
||||
$box =& new TextInputBox($root->get_attribute("value"), $name);
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
|
||||
/**
|
||||
* Contents of the text box are somewhat similar to the inline box:
|
||||
* a sequence of the text and whitespace boxes; we generate this sequence using
|
||||
* the InlineBox, then copy contents of the created inline box to our button.
|
||||
*
|
||||
* @todo probably, create_from_text() function should be extracted to the common parent
|
||||
* of inline boxes.
|
||||
*/
|
||||
$ibox = InlineBox::create_from_text($text, WHITESPACE_PRE, $pipeline);
|
||||
|
||||
for ($i=0, $size = count($ibox->content); $i<$size; $i++) {
|
||||
$box->add_child($ibox->content[$i]);
|
||||
};
|
||||
|
||||
return $box;
|
||||
}
|
||||
|
||||
function get_height() {
|
||||
$normal_height = parent::get_height();
|
||||
|
||||
$hc = $this->get_height_constraint();
|
||||
if ($hc->is_null()) {
|
||||
return $normal_height;
|
||||
} else {
|
||||
return $normal_height - $this->_get_vert_extra();
|
||||
};
|
||||
}
|
||||
|
||||
function show(&$driver) {
|
||||
// Now set the baseline of a button box to align it vertically when flowing isude the
|
||||
// text line
|
||||
|
||||
$this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
|
||||
$this->baseline = $this->content[0]->baseline + $this->get_extra_top();
|
||||
|
||||
/**
|
||||
* If we're rendering the interactive form, the field content should not be rendered
|
||||
*/
|
||||
global $g_config;
|
||||
if ($g_config['renderforms']) {
|
||||
/**
|
||||
* Render background/borders only
|
||||
*/
|
||||
$status = GenericFormattedBox::show($driver);
|
||||
|
||||
/**
|
||||
* @todo encoding name?
|
||||
* @todo font name?
|
||||
* @todo check if font is embedded for PDFLIB
|
||||
*/
|
||||
$driver->field_text($this->get_left_padding(),
|
||||
$this->get_top_padding(),
|
||||
$this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
|
||||
$this->get_height(),
|
||||
$this->_value,
|
||||
$this->_field_name);
|
||||
} else {
|
||||
/**
|
||||
* Render everything, including content
|
||||
*/
|
||||
$status = GenericContainerBox::show($driver);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
?>
|
||||
74
thirdparty/html2ps_pdf/box.input.textarea.php
vendored
74
thirdparty/html2ps_pdf/box.input.textarea.php
vendored
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/html2ps/box.input.textarea.php,v 1.5 2006/12/24 14:42:43 Konstantin Exp $
|
||||
|
||||
class TextAreaInputBox extends InlineBlockBox {
|
||||
var $_field_name;
|
||||
var $_value;
|
||||
|
||||
function TextAreaInputBox($value, $name) {
|
||||
$this->InlineBlockBox();
|
||||
|
||||
$this->set_value($value);
|
||||
$this->_field_name = $name;
|
||||
}
|
||||
|
||||
function &create(&$root, &$pipeline) {
|
||||
$value = $root->get_content();
|
||||
$name = $root->get_attribute('name');
|
||||
|
||||
$box = new TextAreaInputBox($value, $name);
|
||||
$box->readCSS($pipeline->getCurrentCSSState());
|
||||
$box->create_content($root, $pipeline);
|
||||
|
||||
return $box;
|
||||
}
|
||||
|
||||
function get_height() {
|
||||
$normal_height = parent::get_height();
|
||||
return $normal_height - $this->_get_vert_extra();
|
||||
}
|
||||
|
||||
function get_min_width(&$context) {
|
||||
return $this->get_max_width($context);
|
||||
}
|
||||
|
||||
function get_max_width(&$context) {
|
||||
return $this->get_width();
|
||||
}
|
||||
|
||||
function get_value() {
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
function get_width() {
|
||||
$normal_width = parent::get_width();
|
||||
return $normal_width - $this->_get_hor_extra();
|
||||
}
|
||||
|
||||
function set_value($value) {
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
function show(&$driver) {
|
||||
/**
|
||||
* If we're rendering the interactive form, the field content should not be rendered
|
||||
*/
|
||||
global $g_config;
|
||||
if ($g_config['renderforms']) {
|
||||
$status = GenericFormattedBox::show($driver);
|
||||
|
||||
$driver->field_multiline_text($this->get_left_padding(),
|
||||
$this->get_top_padding(),
|
||||
$this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
|
||||
$this->get_height() + $this->get_padding_top() + $this->get_padding_bottom(),
|
||||
$this->_value,
|
||||
$this->_field_name);
|
||||
} else {
|
||||
$status = GenericContainerBox::show($driver);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user