Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1072382
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 24, 6:17 PM
Size
70 KB
Mime Type
text/x-diff
Expires
Sat, Jul 26, 6:17 PM (8 h, 41 m)
Engine
blob
Format
Raw Data
Handle
694977
Attached To
rINP In-Portal
in-portal
View Options
Index: trunk/kernel/units/images/images_config.php
===================================================================
--- trunk/kernel/units/images/images_config.php (revision 8770)
+++ trunk/kernel/units/images/images_config.php (revision 8771)
@@ -1,157 +1,158 @@
<?php
$config = Array(
'Prefix' => 'img',
'Clones' => Array(
'l-img' => Array('ParentPrefix' => 'l'),
'n-img' => Array('ParentPrefix' => 'n'),
'bb-img'=> Array('ParentPrefix' => 'bb'),
+ 'bb-post-img'=> Array('ParentPrefix' => 'bb-post'),
/*'p-img' => Array('ParentPrefix' => 'p'),*/
'c-img' => Array('ParentPrefix' => 'c'),
),
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'ImageEventHandler','file'=>'image_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'ImageTagProcessor','file'=>'image_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
'AggregateTags' => Array (
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'Image',
'LocalTagName' => 'ItemImageTag',
'LocalSpecial' => '-item',
),
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'ImageSrc',
'LocalTagName' => 'ItemImageTag',
'LocalSpecial' => '-item',
),
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'ImageSize',
'LocalTagName' => 'ItemImageTag',
'LocalSpecial' => '-item',
),
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'ListImages',
'LocalTagName' => 'PrintList2',
'LocalSpecial' => 'list',
),
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'LargeImageExists',
'LocalTagName' => 'LargeImageExists',
),
),
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
),
'IDField' => 'ImageId',
'StatusField' => Array('Enabled', 'DefaultImg'), // field, that is affected by Approve/Decline events
'TitleField' => 'Name', // field, used in bluebar when editing existing item
'TableName' => TABLE_PREFIX.'Images',
'ParentTableKey'=> 'ResourceId', // linked field in master table
'ForeignKey' => 'ResourceId', // linked field in subtable
'ParentPrefix' => 'p',
'AutoDelete' => true,
'AutoClone' => true,
'FilterMenu' => Array(
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array('show_active','show_disabled'), 'type' => WHERE_FILTER),
),
'Filters' => Array(
'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => 'Enabled != 1' ),
'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => 'Enabled != 0' ),
)
),
'CalculatedFields' => Array(
'' => Array(
'Preview' => '0',
),
),
'ListSQLs' => Array( ''=>'SELECT * FROM %s',
), // key - special, value - list select sql
'ItemSQLs' => Array( ''=>'SELECT * FROM %s',
),
'ListSortings' => Array(
'' => Array(
'ForcedSorting' => Array('Priority' => 'desc'),
'Sorting' => Array('Name' => 'asc'),
)
),
'Fields' => Array(
'ImageId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'ResourceId' => Array('type'=>'int', 'not_null'=>1, 'default' => 0),
'Url' => Array('type' => 'string', 'max_len'=>255, 'default' => '', 'not_null'=>1),
'Name' => Array('type' => 'string', 'max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''),
'AltName' => Array('type' => 'string', 'max_len'=>255, 'required' => 1, 'not_null' => 1, 'default' => ''),
'ImageIndex' => Array('type'=>'int', 'default' => 0, 'not_null'=>1),
'LocalImage' => Array('type'=>'int', 'default' => 1, 'not_null'=>1),
'LocalPath' => Array('type' => 'string', 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len'=>240, 'default' => '', 'not_null' => 1, 'include_path' => 1,
'allowed_types' => Array(
0 => 'image/jpeg',
1 => 'image/pjpeg',
2 => 'image/png',
3 => 'image/gif',
4 => 'image/bmp'
),
'error_msgs' => Array( 'bad_file_format' => '!la_error_InvalidFileFormat!',
'bad_file_size' => '!la_error_FileTooLarge!',
'cant_save_file' => '!la_error_cant_save_file!'
)
),
'Enabled' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array ( 1 => 'la_Enabled', 0 => 'la_Disabled' ), 'default' => 0, 'not_null'=>1),
'DefaultImg' => Array('type'=>'int', 'default' => 0, 'not_null'=>1),
'ThumbUrl' => Array('type' => 'string', 'max_len' => 255, 'default' => null),
'Priority' => Array('type'=>'int', 'default' => 0, 'not_null'=>1),
'ThumbPath' => Array('type' => 'string', 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len' => 255, 'default' => null,
'allowed_types' => Array(
0 => 'image/jpeg',
1 => 'image/pjpeg',
2 => 'image/png',
3 => 'image/gif',
4 => 'image/bmp'
),
'error_msgs' => Array( 'bad_file_format' => '!la_error_InvalidFileFormat!',
'bad_file_size' => '!la_error_FileTooLarge!',
'cant_save_file' => '!la_error_cant_save_file!'
)
),
'LocalThumb' => Array('type'=>'int', 'default' => 1, 'not_null'=>1),
'SameImages' => Array('type'=>'int', 'default' => 1, 'not_null'=>1),
),
'VirtualFields' => Array(
'Preview' => Array(),
'ImageUrl' => Array(),
),
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon17_custom.gif','1_0'=>'icon16_image.gif','0_0'=>'icon16_image_disabled.gif','1_1'=>'icon16_image_primary.gif'),
'Fields' => Array(
'Name' => Array( 'title'=>'la_col_ImageName' , 'data_block' => 'image_caption_td'),
'AltName' => Array( 'title'=>'la_col_AltName' ),
'Url' => Array( 'title'=>'la_col_ImageUrl', 'data_block' => 'image_url_td' ),
'Enabled' => Array( 'title'=>'la_col_ImageEnabled' ),
'Preview' => Array( 'title'=>'la_col_Preview', 'data_block' => 'image_preview_td' ),
),
),
),
);
?>
\ No newline at end of file
Property changes on: trunk/kernel/units/images/images_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.10
\ No newline at end of property
+1.11
\ No newline at end of property
Index: trunk/kernel/units/images/image_tag_processor.php
===================================================================
--- trunk/kernel/units/images/image_tag_processor.php (revision 8770)
+++ trunk/kernel/units/images/image_tag_processor.php (revision 8771)
@@ -1,300 +1,320 @@
<?php
class ImageTagProcessor extends kDBTagProcessor {
/**
* Prepares all image parameters as list block parameters (for easy usage)
*
* @param kDBList $object
* @param Array $block_params
* @author Alex
*/
function PrepareListElementParams(&$object, &$block_params)
{
$image_url = $this->ImageSrc($block_params);
if (!$image_url) {
return ;
}
$block_params['img_path'] = $image_url;
$image_dimensions = $this->ImageSize($block_params);
$block_params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$block_params['DefaultWidth'].'"';
$block_params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ?
}
/**
* [AGGREGATED TAGS] works as <inp2:CatalogItemPrefix_Image, ImageSize, ImageSrc ..../>
*
* @param Array $params
* @return string
*/
function ItemImageTag($params)
{
$this->LoadItemImage($params);
return $this->$params['original_tag']($params);
}
function LargeImageExists($params)
{
$object =& $this->getObject($params);
if ($object->GetDBField('SameImages') == null || $object->GetDBField('SameImages') == 1) {
return false;
}
else {
return true;
}
}
function LoadItemImage($params)
{
$parent_item =& $this->Application->recallObject($params['PrefixSpecial']);
/* @var $parent_item kCatDBItem */
$object =& $this->Application->recallObject($this->getPrefixSpecial(), null, Array('skip_autoload' => true));
/* @var $object kDBItem */
$object->Clear();
// if we need primary thumbnail which is preloaded with category item's list
$is_primary = $this->SelectParam($params, 'primary,Primary');
$image_id = $this->Application->GetVar($this->Prefix.'_id');
if (
// is primary, when primary mark set OR name & field not given
($is_primary || !(isset($params['name']) || isset($params['field']))) &&
// primary image is preloaded AND direct id not given
isset($parent_item->Fields['ThumbPath']) && !$image_id
) {
$object->SetDefaultValues();
$object->SetDBField('Url', $parent_item->GetDBField('FullUrl'));
$object->SetDBFieldsFromHash($parent_item->GetFieldValues(), Array('SameImages', 'LocalThumb', 'ThumbPath', 'ThumbUrl', 'LocalImage', 'LocalPath'));
$object->Loaded = true;
}
else { // if requested image is not primary thumbnail - load it directly
$id_field = $this->Application->getUnitOption($this->Prefix, 'ForeignKey');
$parent_table_key = $this->Application->getUnitOption($this->Prefix, 'ParentTableKey');
$keys[$id_field] = $parent_item->GetDBField($parent_table_key);
// which image to load?
if ($is_primary) {
// by PrimaryImage mark
$keys['DefaultImg'] = 1;
}
elseif (getArrayValue($params, 'name')) {
// by ImageName
$keys['Name'] = $params['name'];
}
elseif (getArrayValue($params, 'field')) {
// by virtual field name in main object
$field_options = $parent_item->GetFieldOptions($params['field']);
$keys['Name'] = isset($field_options['original_field']) ? $field_options['original_field'] : $params['field'];
}
elseif ($image_id) {
// by ID
$keys['ImageId'] = $image_id;
}
else {
// by PrimaryImage if no other criteria given
$keys['DefaultImg'] = 1;
}
$object->Load($keys);
if (isset($params['field'])) {
$image_src = $parent_item->GetDBField($params['field']);
// when image is uploaded to virtual field in main item, but not saved to db
$object->SetDBField('ThumbPath', $image_src);
if (!$object->isLoaded()) {
// set fields for displaing new image during main item suggestion with errors
$fields_hash = Array (
'Url' => '',
'ThumbUrl' => '',
'LocalPath' => '',
'SameImages' => 1,
'LocalThumb' => 1,
'LocalImage' => 1,
);
$object->SetDBFieldsFromHash($fields_hash);
$object->Loaded = true;
}
}
}
}
function getImageDimension($type, $params)
{
$ret = isset($params['Max'.$type]) ? $params['Max'.$type] : false;
if (!$ret) {
return $ret;
}
$parent_prefix = $this->Application->getUnitOption($this->Prefix, 'ParentPrefix');
if ($ret == 'thumbnail') {
$ret = $this->Application->ConfigValue($parent_prefix.'_ThumbnailImage'.$type);
}
if ($ret == 'fullsize') {
$ret = $this->Application->ConfigValue($parent_prefix.'_FullImage'.$type);
}
return $ret;
}
+ /**
+ * Appends "/" to beginning of image path (in case when missing)
+ *
+ * @param kDBItem $object
+ * @todo old in-portal doesn't append first slash, but we do => append first slash for him :)
+ */
+ function makeRelativePaths(&$object)
+ {
+ $thumb_path = $object->GetDBField('ThumbPath');
+ if ($thumb_path && substr($thumb_path, 0, 1) != '/') {
+ $object->SetDBField('ThumbPath', '/'.$thumb_path);
+ }
+
+ $local_path = $object->GetDBField('LocalPath');
+ if ($local_path && substr($local_path, 0, 1) != '/') {
+ $object->SetDBField('LocalPath', '/'.$local_path);
+ }
+ }
+
function ImageSrc($params)
{
$object =& $this->getObject($params);
- $base_url = rtrim($this->Application->BaseURL(), '/');
+ $this->makeRelativePaths($object);
+ $base_url = rtrim($this->Application->BaseURL(), '/');
if ($object->GetDBField('SameImages') && $object->GetDBField('ThumbPath')) {
// we can auto-resize image, when source image available & we use same image for thumbnail & full image in admin
$image_helper =& $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
$max_width = $this->getImageDimension('Width', $params);
$max_height = $this->getImageDimension('Height', $params);
if ($max_width > 0 || $max_height > 0) {
// image auto-resize is required
$src_image = FULL_PATH.$object->GetDBField('ThumbPath');
list ($max_width, $max_height, $resized) = $image_helper->GetImageDimensions($src_image, $max_width, $max_height);
if ($resized) {
$src_path = FULL_PATH.($this->Application->IsAdmin() ? IMAGES_PENDING_PATH : IMAGES_PATH);
$dst_image = preg_replace('/^'.preg_quote($src_path, '/').'(.*)\.(.*)$/', $src_path.'resized/\\1_'.$max_width.'x'.$max_height.'.\\2', $src_image);
if (!file_exists($dst_image) || filemtime($src_image) > filemtime($dst_image)) {
// resized image not available OR should be recreated due source image change
$image_resized = $image_helper->ScaleImage($src_image, $dst_image, $max_width, $max_height);
if (!$image_resized) {
// resize failed, because of server error
$dst_image = $src_image;
}
}
return preg_replace('/^'.preg_quote(FULL_PATH, '/').'(.*)/', $base_url.'\\1', $dst_image);
}
}
}
$ret = '';
// if we need thumbnail, or full image is same as thumbnail
$show_thumbnail = $this->SelectParam($params, 'thumbnail,Thumbnail') || // old style
(isset($params['MaxWidth']) && $params['MaxWidth'] == 'thumbnail') || // new style
(isset($params['MaxHeight']) && $params['MaxHeight'] == 'thumbnail');
if ($show_thumbnail || $object->GetDBField('SameImages')) {
// return local image or url
$ret = $object->GetDBField('LocalThumb') ? $base_url.$object->GetDBField('ThumbPath') : $object->GetDBField('ThumbUrl');
if ($object->GetDBField('LocalThumb') && !file_exists(FULL_PATH.$object->GetDBField('ThumbPath')) && !constOn('DBG_IMAGE_RECOVERY')) {
// local thumbnail file is missing
$ret = '';
}
}
else { // if we need full which is not the same as thumb
$ret = $object->GetDBField('LocalImage') ? $base_url.$object->GetDBField('LocalPath') : $object->GetDBField('Url');
if ($object->GetDBField('LocalImage') && !file_exists(FULL_PATH.$object->GetDBField('LocalPath'))) {
// local full image file is missing
$ret = '';
}
}
$default_image = $this->SelectParam($params, 'default_image,DefaultImage');
return ($ret && $ret != $base_url) ? $ret : ($default_image ? $base_url.THEMES_PATH.'/'.$default_image : false);
}
function getFullPath($path)
{
if (!$path) {
return $path;
}
// absolute url
if (preg_match('/^(.*):\/\/(.*)$/U', $path)) {
return preg_replace('/^'.preg_quote($this->Application->BaseURL(), '/').'(.*)/', FULL_PATH.'/\\1', $path);
}
// relative url
return FULL_PATH.'/'.substr(THEMES_PATH, 1).'/'.$path;
}
/**
* Makes size clause for img tag, such as
* ' width="80" height="100"' according to max_width
* and max_heght limits.
*
* @param array $params
* @return string
*/
function ImageSize($params)
{
$img_path = $this->getFullPath($params['img_path']);
$image_helper =& $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
$max_width = $this->getImageDimension('Width', $params);
$max_height = $this->getImageDimension('Height', $params);
$image_dimensions = $image_helper->GetImageDimensions($img_path, $max_width, $max_height);
if (!$image_dimensions) {
return false;
}
return ' width="'.$image_dimensions[0].'" height="'.$image_dimensions[1].'"';
}
/**
* Prepares image parameters & parses block with them (for admin)
*
* @param Array $params
* @return string
*/
function Image($params)
{
$image_url = $this->ImageSrc($params);
if (!$image_url) {
return ;
}
$object =& $this->getObject($params);
$params['img_path'] = $image_url;
$image_dimensions = $this->ImageSize($params);
$params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$params['DefaultWidth'].'"';
$params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ?
$params['name'] = $this->SelectParam($params, 'block,render_as');
if (!$object->isLoaded() && !$this->SelectParam($params, 'default_image,DefaultImage')) {
return false;
}
return $this->Application->ParseBlock($params);
}
/**
* Returns url for image in case when image source is url (for admin)
*
* @param Array $params
* @return string
*/
function ImageUrl($params)
{
$object =& $this->getObject($params);
if ($object->GetDBField('SameImages') ? $object->GetDBField('LocalThumb') : $object->GetDBField('LocalImage') ) {
$ret = $this->Application->Phrase(getArrayValue($params,'local_phrase'));
}
else {
$ret = $object->GetDBField('SameImages') ? $object->GetDBField('ThumbUrl') : $object->GetDBField('Url');
}
return $ret;
}
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/units/images/image_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.12
\ No newline at end of property
+1.13
\ No newline at end of property
Index: trunk/themes/default2007/platform/my_account/my_favorites.tpl
===================================================================
--- trunk/themes/default2007/platform/my_account/my_favorites.tpl (revision 8770)
+++ trunk/themes/default2007/platform/my_account/my_favorites.tpl (revision 8771)
@@ -1,32 +1,18 @@
<inp2:m_RequireLogin login_template="platform/login/register"/>
<inp2:m_DefineElement name="sidebar">
<inp2:m_RenderElements
elements="
platform/elements/side_boxes/login,
"
design="blue_box"/>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="favorites_box">
- <inp2:m_param name="header"/>
- <hr /><br />
-
- <inp2:m_param name="content"/>
-</inp2:m_DefineElement>
-
<inp2:m_DefineElement name="content">
<inp2:m_include template="platform/elements/navigation_bar" titles="lu_title_MyAccount,lu_title_MyFavorites" templates="platform/my_account/my_account,platform/my_account/my_favorites"/>
<!-- my favorites -->
- <inp2:m_RenderElement design="content_box">
- <inp2:m_ModuleInclude template="elements/content_boxes/my_favorites"/>
-
- <inp2:m_Capture to_var="header">
- <inp2:m_phrase name="lu_title_MyFavorites"/>
- </inp2:m_Capture>
- </inp2:m_RenderElement>
-
+ <inp2:m_ModuleInclude template="elements/content_boxes/my_favorites"/>
<!-- // my favorites -->
</inp2:m_DefineElement>
<inp2:m_include template="platform/designs/default_design" pass_params="1"/>
\ No newline at end of file
Property changes on: trunk/themes/default2007/platform/my_account/my_favorites.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.5
\ No newline at end of property
+1.6
\ No newline at end of property
Index: trunk/themes/default2007/platform/inc/styles.css
===================================================================
--- trunk/themes/default2007/platform/inc/styles.css (revision 8770)
+++ trunk/themes/default2007/platform/inc/styles.css (revision 8771)
@@ -1,679 +1,679 @@
/* --- Golbal Usage Styles --- */
html, body {
margin: 0px;
padding: 0px;
height: 100%;
border: none;
font: 9pt Arial;
color: #000000;
}
.fullwidth {
width: 100%;
}
table {
margin: 0px;
padding: 0px;
border-collapse: collapse;
}
td {
font: 11px Arial, serif;
color: #000000;
margin: 0px;
padding: 0px;
}
img, img A {
border: 0px;
}
A:hover {
color: #FF9900;
}
A {
color: #315FAA;
}
.hor-line {
background: url(../img/dashed_line.gif) bottom repeat-x;
}
table.markup_table {
border-collapse: collapse;
width: 100%;
}
.error {
color: magenta;
}
form {
display: inline;
}
.top-background {
background: url(../img/top_background.gif) right repeat-y;
}
.top-menu {
background: url(../img/menu_background.gif) top repeat-x #1865AC;
width: 100%;
}
.languages-paddings {
padding: 0px 15px;
}
/* --- Side Box Styles --- */
.side-box-title {
background: url(../img/side_boxes_background.gif) bottom repeat-x #83AFD6;
height: 29px;
padding: 0px 8px 0px 20px;
font-size: 12px;
color: #FFFFFF;
}
.side-box-title A {
font-size: 12px;
color: #FFFFFF;
text-decoration: underline;
}
.side-box-title A:hover {
font-size: 12px;
color: #FFDC0E;
}
.side-box-content {
background: url(../img/side_boxes_content.gif) top repeat-x;
padding: 20px 20px;
}
/* --- Form Control Styles --- */
.input-text, .input-textarea {
background: url(../img/input_text_background.gif) top repeat-x #FFFFFF;
border: 1px solid #7091B9;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
.input-textarea {
overflow: auto;
}
.input-select {
color: #333333;
font-size: 11px;
}
/* --- Form Field Styles --- */
.field-name {
padding: 5px 15px;
color: #2E5679;
font-weight: bold;
font-size: 11px;
}
.field-required {
color: #FF0000;
}
.field-hint {
color: #000000;
font-size: 10px;
}
.field-error {
color: #CC0000;
font-size: 10px;
}
.field-value {
padding: 6px 5px;
}
.warning-message td {
padding: 5px;
background: #FFE5E6;
font-size: 16px;
}
.button
{
background:url(../img/input_button_background.gif) bottom repeat-x #efefef;
border: 1px solid #688bac;
padding:0px;
font-size:11px;
padding:0px 5px;
/*
width: auto;
overflow: visible;
*/
}
a.blue-small-link
{
font-size:10px;
color:#197aca;
text-decoration:underline;
}
a.blue-small-link:hover
{
font-size:10px;
color: #005ca8;
text-decoration:none;
}
.remember-login
{
color:#000000;
font-size:9px;
}
-.paddnig-right
+.padding-right
{
padding-right:8px;
}
.side-title
{
font-size:12px;
color:#FFFFFF;
}
.login-text
{
font-size:10px;
color:#FFFFFF;
}
.login-text A
{
color:#FFFFFF;
text-decoration:underline;
}
.login-text A:hover
{
color:#FFFFFF;
text-decoration: none;
}
.vertical-dashed-line
{
background:url(../img/vertical_dashed_line.gif) top center repeat-y;
}
.content-boxes-title
{
background:#f0f5fa;
height:29px;
padding:0px 20px;
font-size:15px;
font-family:Arial;
color: #000000;
}
.navigation-bar
{
background:url(../img/side_boxes_background.gif) bottom repeat-x #83afd6;
height:29px;
padding:0px 20px;
font-size:12px;
color:#FFFFFF;
}
.navigation-bar A {
color: #FFFFFF;
}
.navigation-bar A:hover {
color: #FFDC0E;
}
.content-boxes-content
{
background: #FFFFFF;
padding:20px 20px 0px 20px;
}
/* Top Menu */
.menu-top-active-icon
{
background:url(../img/top_menu_select.gif);
height:37px;
padding:0px 5px 0px 13px;
}
.menu-top-active-text
{
background:url(../img/top_menu_select.gif);
height:37px;
padding:0px 13px 0px 3px;
white-space:nowrap;
}
.menu-top-noactive-icon
{
height:37px;
padding:0px 5px 0px 13px;
white-space:nowrap
}
.menu-top-noactive-text
{
height:37px;
padding:0px 13px 0px 3px;
white-space:nowrap
}
.menu-top-active-text A
{
font-size:11px;
color:#FFFFFF;
text-decoration:none;
}
.menu-top-active-text A:hover
{
font-size:11px;
color: #CCCCCC;
text-decoration:none;
}
.menu-top-noactive-text A
{
font-size:11px;
color:#FFFFFF;
text-decoration:none;
}
.menu-top-noactive-text A:hover
{
font-size:11px;
color: #CCCCCC;
text-decoration:none;
}
/* /Top Menu */
.footer-blue
{
background:url(../img/footer_blue.gif) top repeat-x;
height:26px;
color:#f7eee4;
font-size:10px;
padding:0px 10px;
}
.footer-links
{
text-align:right;
padding:5px 10px;
}
.padding-reg
{
padding:10px;
}
.footer-links A
{
color:#333333;
font-size:10px;
text-decoration:underline;
}
.footer-links A:hover
{
color: #666666;
text-decoration: none;
}
a.details_grey
{
font-size:9px;
color:#666666;
text-decoration:none;
}
a.details_grey:hover
{
color:#000000;
text-decoration:none;
}
-
+
.image-padding-cell
{
padding-right:10px;
}
-
+
.subtitle-small-grey
{
background:#ebebeb;
text-align:right;
padding: 1px 4px;
margin:1px 0px;
font-size:10px;
color:#666666;
}
-
+
.price-msrp
{
text-decoration:line-through;
}
-
-
+
+
.price-red
{
color:#b70001;
font-size:13px;
font-weight:bold;
}
-
+
.red
{
color:#b70001;
}
-
+
.red-big
{
color:#b70001;
font-size:13px;
font-weight:bold;
}
-
-
+
+
.subtitle-small-blue
{
background:#dde7f1;
text-align:right;
padding: 1px 4px;
margin:1px 0px;
font-size:10px;
color:#165a9b;
}
-
+
.blue-title
{
color:#335c9e;
font-weight:bold;
font-size:12px;
}
-
+
a.black-link
{
color:#000000;
}
-
+
.item-cell-padding
{
padding:8px;
}
.table-padding-cell TD
{
padding:5px;
vertical-align:top;
}
.directory-icon
{
width:22px;
vertical-align:top;
padding:5px;
}
.directory-text
{
padding:5px 20px 5px 5px;
}
.gradient-background
{
background:url(../img/gradient_background.gif) top repeat-x #FFFFFF;
}
.subheader
{
background:#f4f4f4;
font-weight:bold;
padding:5px 15px;
font-size:12px;
- }
-
+ }
+
.subheaders-grey
{
background:#f4f4f4;
font-weight:bold;
padding:5px 15px;
font-size:12px;
- }
+ }
.pagenation-select
{
background: #5b97cb;
color:#FFFFFF;
padding:1px 2px;
}
a.pagenation-noselect
{
color:#000000;
text-decoration:none;
}
.link-picture-padding
{
padding:20px 5px 20px 20px;
vertical-align:top;
width:120px;
}
.link-text-padding
{
padding:20px 5px;
}
.articles-icon-cell
{
width:22px;
padding-top:5px;
vertical-align:top;
padding-right:7px;
}
.small-black
{
font-size:10px;
}
a.text-title
{
font-size:12px;
font-weight:bold;
color:#1769b5;
text-decoration:underline;
}
a.text-title:hover
{
color: #005695;
text-decoration:underline;
}
.text-title
{
font-size:12px;
font-weight:bold;
color:#1769b5;
}
.text-grey
{
font-size:10px;
color:#666666;
}
.article-picture-padding
{
padding:0px 20px 0px 30px;
width:120px;
vertical-align:top
}
.forums-icon-description TD
{
padding:10px;
vertical-align:middle;
}
.topics-icon-padding
{
width:24px;
padding-right:10px;
}
.big-text
{
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
font-weight:bold;
}
.not-dynamic {
color:#00CC66;
}
/* ---- Calendar ---- */
.calendar {
font-family: tahoma,verdana,sans-serif;
color: #000;
font-size: 11px;
border: 1px solid #83B2C5;
width: 225px;
position: relative;
z-index: 1;
display: none;
cursor: default;
}
.calendar table {
/*font-family: tahoma,verdana,sans-serif;*/
color: #000;
font-size: 11px;
background-color: #fefefe;
width: auto;
cursor: default;
border-collapse: separate;
}
.calendar table td {
text-align: center;
padding: 2px;
text-align: center;
}
.calendar tbody .disabled {
color: #999;
}
.calendar tbody .emptyrow {
display: none;
}
.calendar tbody .today {
font-weight: bold;
background-color: #eeeeee;
border: 1px solid #aaaaaa !important;
}
.calendar tbody .emptycell {
visibility: hidden;
}
.calendar tbody .active {
background-color: red;
}
.calendar thead .title {
font-weight: bold;
}
.calendar thead .headrow {
}
.calendar thead .active {
background-color: #c4c0b8;
padding: 2px 0px 0px 2px;
}
.calendar thead .hilite {
background-color: #e4e0d8;
}
.calendar tfoot .title {
font-weight: normal;
}
.combo { position: absolute; display: none; width: 4em; top: 0px; left: 0px; cursor: default; border-top: 1px solid #fff; border-right: 1px solid #000; border-bottom: 1px solid #000; border-left: 1px solid #fff; background: #e4e0d8; font-size: smaller; padding: 1px;}
.combo .label { text-align: center; padding: 1px;}
.combo .active { background: #c4c0b8; padding: 0px; border-top: 1px solid #000; border-right: 1px solid #fff; border-bottom: 1px solid #fff; border-left: 1px solid #000;}
.combo .hilite { background: #048; color: #fea;}
.dpContainer {
display: inline;
}
.list-no-squares {
padding: 0px;
list-style-type: none;
margin: 0px;
}
/* ---- /Calendar ---- */
.blue-table-header TD
{
padding:6px;
color:#21619E;
}
Property changes on: trunk/themes/default2007/platform/inc/styles.css
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.16
\ No newline at end of property
+1.17
\ No newline at end of property
Index: trunk/themes/default2007/platform/elements/side_boxes/search.tpl
===================================================================
--- trunk/themes/default2007/platform/elements/side_boxes/search.tpl (revision 8770)
+++ trunk/themes/default2007/platform/elements/side_boxes/search.tpl (revision 8771)
@@ -1,23 +1,23 @@
<inp2:m_Capture to_var="header">
<inp2:m_phrase name="lu_title_SearchBox"/>
</inp2:m_Capture>
-<form method="get" action="<inp2:m_Link template="platform/search/search_results" />">
+<form method="post" action="<inp2:m_Link template="platform/search/search_results" />">
<inp2:m_GetFormHiddens template="platform/search/search_results"/>
- <input type="text" name="keywords" id="keywords" style="width: 155px" class="input-text" value="" /><br />
+ <input type="text" name="keywords" id="keywords" style="width: 155px;" class="input-text" value="" /><br />
- <img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" alt="" width="1" height="10" border="0" /><br />
+ <br />
+ <input class="button" type="submit" style="width: 40px;" value="<inp2:m_Phrase label="lu_btn_Go"/>!" />
+ <!--<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" alt="" width="1" height="10" border="0" /><br />
<table>
<tr>
- <td class="paddnig-right" width="10">
+ <td class="padding-right" width="10">
<input class="button" type="submit" style="width: 40px;" value="<inp2:m_Phrase label="lu_comm_Go"/>!" />
</td>
<td align="left">
- <a href="<inp2:m_Link template="platform/search/advanced_search" />" class="blue-small-link"><inp2:m_Phrase label="lu_AdvancedSearch"/></a> <img src="<inp2:m_TemplatesBase module="In-Portal"/>img/side_link_str.gif" width="6" height="5" alt="" /><br />
+ <a href="<inp2:m_Link template="platform/search/advanced_search" />" class="blue-small-link"><inp2:m_Phrase label="lu_btn_AdvancedSearch"/></a> <img src="<inp2:m_TemplatesBase module="In-Portal"/>img/side_link_str.gif" width="6" height="5" alt="" /><br />
</td>
</tr>
- </table>
-
-</form>
-
+ </table>-->
+</form>
\ No newline at end of file
Property changes on: trunk/themes/default2007/platform/elements/side_boxes/search.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/themes/default2007/platform/elements/side_boxes/login.tpl
===================================================================
--- trunk/themes/default2007/platform/elements/side_boxes/login.tpl (revision 8770)
+++ trunk/themes/default2007/platform/elements/side_boxes/login.tpl (revision 8771)
@@ -1,99 +1,99 @@
<inp2:m_Capture to_var="header">
<table class="fullwidth">
<tr>
<td class="side-title" align="left">
<inp2:m_phrase name="lu_title_LoginBox"/>
</td>
<td align="right">
<inp2:m_if check="m_LoggedIn">
<a style="font-size:10px" href="<inp2:m_Link template="platform/my_account/my_profile" m_cat_id="0"/>"><inp2:u_Field name="FirstName"/> <inp2:u_Field name="LastName"/></a><br />
<inp2:m_else/>
<table>
<tr>
<td width="11">
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/not_logged.gif" alt="" width="11" height="11" border="0" /><br />
</td>
<td class="login-text">
<inp2:m_Phrase label="lu_NotLoggedIn"/>
</td>
</tr>
</table>
</inp2:m_if>
</td>
</tr>
</table>
</inp2:m_Capture>
<inp2:m_if check="m_LoggedIn">
<table width="100%" style="border-width: 0px;">
<tr>
<td colspan="2">
<!--<inp2:m_Phrase label="lu_comm_Welcome"/>,<br />-->
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" alt="" width="5" height="5" border="0" /><br />
</td>
</tr>
<inp2:m_RenderElement name="box_element" template="platform/my_account/my_profile" title="lu_MyProfile"/>
<inp2:m_RenderElement name="box_element" template="platform/my_account/my_favorites" title="lu_MyFavorites"/>
<inp2:m_RenderElement name="box_element" template="platform/my_account/my_preferences" title="lu_MyPreferences"/>
<tr>
<td>
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/menu-li-2-level.gif" alt="" width="4" height="4" border="0" /><br />
</td>
<td>
<a href="<inp2:u_LogoutLink/>"><inp2:m_Phrase label="lu_comm_Logout"/></a>
</td>
</tr>
<tr>
<td colspan="2">
<strong><inp2:m_phrase name="lu_section_MyItems"/></strong>
</td>
</tr>
<inp2:m_ModuleInclude template="my_account/my_items"/>
</table>
<inp2:m_else/>
<form method="post" action="<inp2:m_FormAction />">
<inp2:m_if check="u_UseUsernames">
<inp2:m_phrase label="lu_username"/><br />
<input class="input-text" type="text" name="login" style="width:155px" /><br />
<inp2:m_else/>
<inp2:m_phrase label="lu_email"/><br />
<input class="input-text" type="text" name="email" /><br />
</inp2:m_if>
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" width="1" height="5" alt=""/><br />
<inp2:m_Phrase label="lu_Password"/><br />
<input type="password" class="input-text" name="password" style="width:155px" /><br />
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" alt="" width="1" height="10" border="0" /><br />
<table>
<tr>
- <td class="paddnig-right" width="10">
+ <td class="padding-right" width="10">
<input class="button" name="events[u][OnLogin]" type="submit" value="<inp2:m_Phrase label="lu_comm_Login"/>" /><br />
</td>
<td align="left">
<input type="checkbox" /> <span class="remember-login">Remember login</span>
</td>
</tr>
</table>
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" alt="" width="5" height="5" border="0" /><br />
<inp2:m_if check="u_HasError" field="any">
<span class="field-error"><inp2:u_Error field="ValidateLogin"/></span><br />
</inp2:m_if>
<inp2:m_if check="u_RegistrationEnabled">
<a href="<inp2:m_Link template="platform/login/register"/>" class="blue-small-link" ><inp2:m_Phrase label="lu_Register"/></a> <img src="<inp2:m_TemplatesBase module="In-Portal"/>img/side_link_str.gif" width="6" height="5" alt="" /><br />
</inp2:m_if>
<a href="<inp2:m_Link template="platform/login/forgotpass" />" class="blue-small-link" ><inp2:m_Phrase label="lu_ForgotPassword"/>?</a> <img src="<inp2:m_TemplatesBase module="In-Portal"/>img/side_link_str.gif" width="6" height="5" alt="" />
<input type="hidden" name="next_template" value="<inp2:m_get var="next_template"/>" />
<input type="hidden" name="pending_disabled_template" value="platform/login/login_pending_disabled" />
</form>
</inp2:m_if>
Property changes on: trunk/themes/default2007/platform/elements/side_boxes/login.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.7
\ No newline at end of property
+1.8
\ No newline at end of property
Index: trunk/core/units/images/images_config.php
===================================================================
--- trunk/core/units/images/images_config.php (revision 8770)
+++ trunk/core/units/images/images_config.php (revision 8771)
@@ -1,157 +1,158 @@
<?php
$config = Array(
'Prefix' => 'img',
'Clones' => Array(
'l-img' => Array('ParentPrefix' => 'l'),
'n-img' => Array('ParentPrefix' => 'n'),
'bb-img'=> Array('ParentPrefix' => 'bb'),
+ 'bb-post-img'=> Array('ParentPrefix' => 'bb-post'),
/*'p-img' => Array('ParentPrefix' => 'p'),*/
'c-img' => Array('ParentPrefix' => 'c'),
),
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'ImageEventHandler','file'=>'image_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'ImageTagProcessor','file'=>'image_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
'AggregateTags' => Array (
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'Image',
'LocalTagName' => 'ItemImageTag',
'LocalSpecial' => '-item',
),
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'ImageSrc',
'LocalTagName' => 'ItemImageTag',
'LocalSpecial' => '-item',
),
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'ImageSize',
'LocalTagName' => 'ItemImageTag',
'LocalSpecial' => '-item',
),
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'ListImages',
'LocalTagName' => 'PrintList2',
'LocalSpecial' => 'list',
),
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'LargeImageExists',
'LocalTagName' => 'LargeImageExists',
),
),
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
),
'IDField' => 'ImageId',
'StatusField' => Array('Enabled', 'DefaultImg'), // field, that is affected by Approve/Decline events
'TitleField' => 'Name', // field, used in bluebar when editing existing item
'TableName' => TABLE_PREFIX.'Images',
'ParentTableKey'=> 'ResourceId', // linked field in master table
'ForeignKey' => 'ResourceId', // linked field in subtable
'ParentPrefix' => 'p',
'AutoDelete' => true,
'AutoClone' => true,
'FilterMenu' => Array(
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array('show_active','show_disabled'), 'type' => WHERE_FILTER),
),
'Filters' => Array(
'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => 'Enabled != 1' ),
'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => 'Enabled != 0' ),
)
),
'CalculatedFields' => Array(
'' => Array(
'Preview' => '0',
),
),
'ListSQLs' => Array( ''=>'SELECT * FROM %s',
), // key - special, value - list select sql
'ItemSQLs' => Array( ''=>'SELECT * FROM %s',
),
'ListSortings' => Array(
'' => Array(
'ForcedSorting' => Array('Priority' => 'desc'),
'Sorting' => Array('Name' => 'asc'),
)
),
'Fields' => Array(
'ImageId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'ResourceId' => Array('type'=>'int', 'not_null'=>1, 'default' => 0),
'Url' => Array('type' => 'string', 'max_len'=>255, 'default' => '', 'not_null'=>1),
'Name' => Array('type' => 'string', 'max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''),
'AltName' => Array('type' => 'string', 'max_len'=>255, 'required' => 1, 'not_null' => 1, 'default' => ''),
'ImageIndex' => Array('type'=>'int', 'default' => 0, 'not_null'=>1),
'LocalImage' => Array('type'=>'int', 'default' => 1, 'not_null'=>1),
'LocalPath' => Array('type' => 'string', 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len'=>240, 'default' => '', 'not_null' => 1, 'include_path' => 1,
'allowed_types' => Array(
0 => 'image/jpeg',
1 => 'image/pjpeg',
2 => 'image/png',
3 => 'image/gif',
4 => 'image/bmp'
),
'error_msgs' => Array( 'bad_file_format' => '!la_error_InvalidFileFormat!',
'bad_file_size' => '!la_error_FileTooLarge!',
'cant_save_file' => '!la_error_cant_save_file!'
)
),
'Enabled' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array ( 1 => 'la_Enabled', 0 => 'la_Disabled' ), 'default' => 0, 'not_null'=>1),
'DefaultImg' => Array('type'=>'int', 'default' => 0, 'not_null'=>1),
'ThumbUrl' => Array('type' => 'string', 'max_len' => 255, 'default' => null),
'Priority' => Array('type'=>'int', 'default' => 0, 'not_null'=>1),
'ThumbPath' => Array('type' => 'string', 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len' => 255, 'default' => null,
'allowed_types' => Array(
0 => 'image/jpeg',
1 => 'image/pjpeg',
2 => 'image/png',
3 => 'image/gif',
4 => 'image/bmp'
),
'error_msgs' => Array( 'bad_file_format' => '!la_error_InvalidFileFormat!',
'bad_file_size' => '!la_error_FileTooLarge!',
'cant_save_file' => '!la_error_cant_save_file!'
)
),
'LocalThumb' => Array('type'=>'int', 'default' => 1, 'not_null'=>1),
'SameImages' => Array('type'=>'int', 'default' => 1, 'not_null'=>1),
),
'VirtualFields' => Array(
'Preview' => Array(),
'ImageUrl' => Array(),
),
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon17_custom.gif','1_0'=>'icon16_image.gif','0_0'=>'icon16_image_disabled.gif','1_1'=>'icon16_image_primary.gif'),
'Fields' => Array(
'Name' => Array( 'title'=>'la_col_ImageName' , 'data_block' => 'image_caption_td'),
'AltName' => Array( 'title'=>'la_col_AltName' ),
'Url' => Array( 'title'=>'la_col_ImageUrl', 'data_block' => 'image_url_td' ),
'Enabled' => Array( 'title'=>'la_col_ImageEnabled' ),
'Preview' => Array( 'title'=>'la_col_Preview', 'data_block' => 'image_preview_td' ),
),
),
),
);
?>
\ No newline at end of file
Property changes on: trunk/core/units/images/images_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.10
\ No newline at end of property
+1.11
\ No newline at end of property
Index: trunk/core/units/images/image_tag_processor.php
===================================================================
--- trunk/core/units/images/image_tag_processor.php (revision 8770)
+++ trunk/core/units/images/image_tag_processor.php (revision 8771)
@@ -1,300 +1,320 @@
<?php
class ImageTagProcessor extends kDBTagProcessor {
/**
* Prepares all image parameters as list block parameters (for easy usage)
*
* @param kDBList $object
* @param Array $block_params
* @author Alex
*/
function PrepareListElementParams(&$object, &$block_params)
{
$image_url = $this->ImageSrc($block_params);
if (!$image_url) {
return ;
}
$block_params['img_path'] = $image_url;
$image_dimensions = $this->ImageSize($block_params);
$block_params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$block_params['DefaultWidth'].'"';
$block_params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ?
}
/**
* [AGGREGATED TAGS] works as <inp2:CatalogItemPrefix_Image, ImageSize, ImageSrc ..../>
*
* @param Array $params
* @return string
*/
function ItemImageTag($params)
{
$this->LoadItemImage($params);
return $this->$params['original_tag']($params);
}
function LargeImageExists($params)
{
$object =& $this->getObject($params);
if ($object->GetDBField('SameImages') == null || $object->GetDBField('SameImages') == 1) {
return false;
}
else {
return true;
}
}
function LoadItemImage($params)
{
$parent_item =& $this->Application->recallObject($params['PrefixSpecial']);
/* @var $parent_item kCatDBItem */
$object =& $this->Application->recallObject($this->getPrefixSpecial(), null, Array('skip_autoload' => true));
/* @var $object kDBItem */
$object->Clear();
// if we need primary thumbnail which is preloaded with category item's list
$is_primary = $this->SelectParam($params, 'primary,Primary');
$image_id = $this->Application->GetVar($this->Prefix.'_id');
if (
// is primary, when primary mark set OR name & field not given
($is_primary || !(isset($params['name']) || isset($params['field']))) &&
// primary image is preloaded AND direct id not given
isset($parent_item->Fields['ThumbPath']) && !$image_id
) {
$object->SetDefaultValues();
$object->SetDBField('Url', $parent_item->GetDBField('FullUrl'));
$object->SetDBFieldsFromHash($parent_item->GetFieldValues(), Array('SameImages', 'LocalThumb', 'ThumbPath', 'ThumbUrl', 'LocalImage', 'LocalPath'));
$object->Loaded = true;
}
else { // if requested image is not primary thumbnail - load it directly
$id_field = $this->Application->getUnitOption($this->Prefix, 'ForeignKey');
$parent_table_key = $this->Application->getUnitOption($this->Prefix, 'ParentTableKey');
$keys[$id_field] = $parent_item->GetDBField($parent_table_key);
// which image to load?
if ($is_primary) {
// by PrimaryImage mark
$keys['DefaultImg'] = 1;
}
elseif (getArrayValue($params, 'name')) {
// by ImageName
$keys['Name'] = $params['name'];
}
elseif (getArrayValue($params, 'field')) {
// by virtual field name in main object
$field_options = $parent_item->GetFieldOptions($params['field']);
$keys['Name'] = isset($field_options['original_field']) ? $field_options['original_field'] : $params['field'];
}
elseif ($image_id) {
// by ID
$keys['ImageId'] = $image_id;
}
else {
// by PrimaryImage if no other criteria given
$keys['DefaultImg'] = 1;
}
$object->Load($keys);
if (isset($params['field'])) {
$image_src = $parent_item->GetDBField($params['field']);
// when image is uploaded to virtual field in main item, but not saved to db
$object->SetDBField('ThumbPath', $image_src);
if (!$object->isLoaded()) {
// set fields for displaing new image during main item suggestion with errors
$fields_hash = Array (
'Url' => '',
'ThumbUrl' => '',
'LocalPath' => '',
'SameImages' => 1,
'LocalThumb' => 1,
'LocalImage' => 1,
);
$object->SetDBFieldsFromHash($fields_hash);
$object->Loaded = true;
}
}
}
}
function getImageDimension($type, $params)
{
$ret = isset($params['Max'.$type]) ? $params['Max'.$type] : false;
if (!$ret) {
return $ret;
}
$parent_prefix = $this->Application->getUnitOption($this->Prefix, 'ParentPrefix');
if ($ret == 'thumbnail') {
$ret = $this->Application->ConfigValue($parent_prefix.'_ThumbnailImage'.$type);
}
if ($ret == 'fullsize') {
$ret = $this->Application->ConfigValue($parent_prefix.'_FullImage'.$type);
}
return $ret;
}
+ /**
+ * Appends "/" to beginning of image path (in case when missing)
+ *
+ * @param kDBItem $object
+ * @todo old in-portal doesn't append first slash, but we do => append first slash for him :)
+ */
+ function makeRelativePaths(&$object)
+ {
+ $thumb_path = $object->GetDBField('ThumbPath');
+ if ($thumb_path && substr($thumb_path, 0, 1) != '/') {
+ $object->SetDBField('ThumbPath', '/'.$thumb_path);
+ }
+
+ $local_path = $object->GetDBField('LocalPath');
+ if ($local_path && substr($local_path, 0, 1) != '/') {
+ $object->SetDBField('LocalPath', '/'.$local_path);
+ }
+ }
+
function ImageSrc($params)
{
$object =& $this->getObject($params);
- $base_url = rtrim($this->Application->BaseURL(), '/');
+ $this->makeRelativePaths($object);
+ $base_url = rtrim($this->Application->BaseURL(), '/');
if ($object->GetDBField('SameImages') && $object->GetDBField('ThumbPath')) {
// we can auto-resize image, when source image available & we use same image for thumbnail & full image in admin
$image_helper =& $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
$max_width = $this->getImageDimension('Width', $params);
$max_height = $this->getImageDimension('Height', $params);
if ($max_width > 0 || $max_height > 0) {
// image auto-resize is required
$src_image = FULL_PATH.$object->GetDBField('ThumbPath');
list ($max_width, $max_height, $resized) = $image_helper->GetImageDimensions($src_image, $max_width, $max_height);
if ($resized) {
$src_path = FULL_PATH.($this->Application->IsAdmin() ? IMAGES_PENDING_PATH : IMAGES_PATH);
$dst_image = preg_replace('/^'.preg_quote($src_path, '/').'(.*)\.(.*)$/', $src_path.'resized/\\1_'.$max_width.'x'.$max_height.'.\\2', $src_image);
if (!file_exists($dst_image) || filemtime($src_image) > filemtime($dst_image)) {
// resized image not available OR should be recreated due source image change
$image_resized = $image_helper->ScaleImage($src_image, $dst_image, $max_width, $max_height);
if (!$image_resized) {
// resize failed, because of server error
$dst_image = $src_image;
}
}
return preg_replace('/^'.preg_quote(FULL_PATH, '/').'(.*)/', $base_url.'\\1', $dst_image);
}
}
}
$ret = '';
// if we need thumbnail, or full image is same as thumbnail
$show_thumbnail = $this->SelectParam($params, 'thumbnail,Thumbnail') || // old style
(isset($params['MaxWidth']) && $params['MaxWidth'] == 'thumbnail') || // new style
(isset($params['MaxHeight']) && $params['MaxHeight'] == 'thumbnail');
if ($show_thumbnail || $object->GetDBField('SameImages')) {
// return local image or url
$ret = $object->GetDBField('LocalThumb') ? $base_url.$object->GetDBField('ThumbPath') : $object->GetDBField('ThumbUrl');
if ($object->GetDBField('LocalThumb') && !file_exists(FULL_PATH.$object->GetDBField('ThumbPath')) && !constOn('DBG_IMAGE_RECOVERY')) {
// local thumbnail file is missing
$ret = '';
}
}
else { // if we need full which is not the same as thumb
$ret = $object->GetDBField('LocalImage') ? $base_url.$object->GetDBField('LocalPath') : $object->GetDBField('Url');
if ($object->GetDBField('LocalImage') && !file_exists(FULL_PATH.$object->GetDBField('LocalPath'))) {
// local full image file is missing
$ret = '';
}
}
$default_image = $this->SelectParam($params, 'default_image,DefaultImage');
return ($ret && $ret != $base_url) ? $ret : ($default_image ? $base_url.THEMES_PATH.'/'.$default_image : false);
}
function getFullPath($path)
{
if (!$path) {
return $path;
}
// absolute url
if (preg_match('/^(.*):\/\/(.*)$/U', $path)) {
return preg_replace('/^'.preg_quote($this->Application->BaseURL(), '/').'(.*)/', FULL_PATH.'/\\1', $path);
}
// relative url
return FULL_PATH.'/'.substr(THEMES_PATH, 1).'/'.$path;
}
/**
* Makes size clause for img tag, such as
* ' width="80" height="100"' according to max_width
* and max_heght limits.
*
* @param array $params
* @return string
*/
function ImageSize($params)
{
$img_path = $this->getFullPath($params['img_path']);
$image_helper =& $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
$max_width = $this->getImageDimension('Width', $params);
$max_height = $this->getImageDimension('Height', $params);
$image_dimensions = $image_helper->GetImageDimensions($img_path, $max_width, $max_height);
if (!$image_dimensions) {
return false;
}
return ' width="'.$image_dimensions[0].'" height="'.$image_dimensions[1].'"';
}
/**
* Prepares image parameters & parses block with them (for admin)
*
* @param Array $params
* @return string
*/
function Image($params)
{
$image_url = $this->ImageSrc($params);
if (!$image_url) {
return ;
}
$object =& $this->getObject($params);
$params['img_path'] = $image_url;
$image_dimensions = $this->ImageSize($params);
$params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$params['DefaultWidth'].'"';
$params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ?
$params['name'] = $this->SelectParam($params, 'block,render_as');
if (!$object->isLoaded() && !$this->SelectParam($params, 'default_image,DefaultImage')) {
return false;
}
return $this->Application->ParseBlock($params);
}
/**
* Returns url for image in case when image source is url (for admin)
*
* @param Array $params
* @return string
*/
function ImageUrl($params)
{
$object =& $this->getObject($params);
if ($object->GetDBField('SameImages') ? $object->GetDBField('LocalThumb') : $object->GetDBField('LocalImage') ) {
$ret = $this->Application->Phrase(getArrayValue($params,'local_phrase'));
}
else {
$ret = $object->GetDBField('SameImages') ? $object->GetDBField('ThumbUrl') : $object->GetDBField('Url');
}
return $ret;
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/images/image_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.12
\ No newline at end of property
+1.13
\ No newline at end of property
Index: trunk/core/units/general/cat_tag_processor.php
===================================================================
--- trunk/core/units/general/cat_tag_processor.php (revision 8770)
+++ trunk/core/units/general/cat_tag_processor.php (revision 8771)
@@ -1,463 +1,463 @@
<?php
class kCatDBTagProcessor extends kDBTagProcessor {
/**
* Permission Helper
*
* @var kPermissionsHelper
*/
var $PermHelper = null;
function kCatDBTagProcessor()
{
parent::kDBTagProcessor();
$this->PermHelper = $this->Application->recallObject('PermissionsHelper');
}
function ItemIcon($params)
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
$grids = $this->Application->getUnitOption($this->Prefix,'Grids');
$icons =& $grids[ $params['grid'] ]['Icons'];
$status_fields = $this->Application->getUnitOption($this->Prefix,'StatusField');
if (!$status_fields) return $icons['default'];
$value = $object->GetDBField($status_fields[0]); // sets base status icon
/* @var $object kDBItem */
if ($value == STATUS_ACTIVE) {
if( $object->HasField('IsPop') && $object->GetDBField('IsPop') ) $value = 'POP';
if( $object->HasField('IsHot') && $object->GetDBField('IsHot') ) $value = 'HOT';
if( $object->HasField('IsNew') && $object->GetDBField('IsNew') ) $value = 'NEW';
if( $object->HasField('EditorsPick') && $object->GetDBField('EditorsPick') ) $value = 'PICK';
}
return isset($icons[$value]) ? $icons[$value] : $icons['default'];
}
/**
* Allows to create valid mod-rewrite compatible link to module item
*
* @param Array $params
* @param string $id_prefix
* @return string
*/
function ItemLink($params, $id_prefix = null)
{
$params = array_merge($params, Array('pass' => 'm,'.$this->Prefix) );
$item_id = isset($params[$id_prefix.'_id']) && $params[$id_prefix.'_id'];
if (!$item_id) {
$item_id = $this->Application->GetVar($this->getPrefixSpecial().'_id');
if (!$item_id) {
$item_id = $this->Application->GetVar($this->Prefix.'_id');
}
}
$params[$this->Prefix.'_id'] = $item_id;
$object =& $this->getObject($params);
$params['m_cat_id'] = $object->GetDBField('CategoryId');
$params['pass_category'] = 1;
return $this->Application->ProcessParsedTag('m', 't', $params);
}
function CategoryPath($params)
{
if ($this->Application->IsAdmin()) {
// path for module root category in admin
if (!isset($params['cat_id'])) {
$params['cat_id'] = $this->Application->RecallVar($params['session_var'], 0);
}
}
else {
// path for category item category in front-end
$object =& $this->getObject($params);
$params['cat_id'] = $object->GetDBField('CategoryId');
}
return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
}
function BuildListSpecial($params)
{
if ($this->Special != '') return $this->Special;
if ( isset($params['parent_cat_id']) ) {
$parent_cat_id = $params['parent_cat_id'];
}
else {
$parent_cat_id = $this->Application->GetVar('c_id');
if (!$parent_cat_id) {
$parent_cat_id = $this->Application->GetVar('m_cat_id');
}
}
$recursive = isset($params['recursive']);
$types = $this->SelectParam($params, 'types');
$except = $this->SelectParam($params, 'except');
if ($types.$except.$recursive == '') {
return parent::BuildListSpecial($params);
}
$special = crc32($parent_cat_id.$types.$except.$recursive);
return $special;
}
function CatalogItemCount($params)
{
$object =& $this->GetList($params);
if (!$object->Counted) {
$object->CountRecs();
}
return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
}
function ListReviews($params)
{
$prefix = $this->Prefix.'-rev';
$review_tag_processor =& $this->Application->recallObject($prefix.'.item_TagProcessor');
return $review_tag_processor->PrintList($params);
}
function ReviewCount($params)
{
$review_tag_processor =& $this->Application->recallObject('rev.item_TagProcessor');
return $review_tag_processor->TotalRecords($params);
}
function InitCatalogTab($params)
{
$tab_params['mode'] = $this->Application->GetVar('tm'); // single/multi selection possible
$tab_params['special'] = $this->Application->GetVar('ts'); // use special for this tab
$tab_params['dependant'] = $this->Application->GetVar('td'); // is grid dependant on categories grid
// set default params (same as in catalog)
if ($tab_params['mode'] === false) $tab_params['mode'] = 'multi';
if ($tab_params['special'] === false) $tab_params['special'] = '';
if ($tab_params['dependant'] === false) $tab_params['dependant'] = 'yes';
// pass params to block with tab content
$params['name'] = $params['render_as'];
$params['prefix'] = trim($this->Prefix.'.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
$params['cat_prefix'] = trim('c.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
$params['tab_mode'] = $tab_params['mode'];
$params['tab_dependant'] = $tab_params['dependant'];
$params['show_category'] = $tab_params['special'] == 'showall' ? 1 : 0; // this is advanced view -> show category name
return $this->Application->ParseBlock($params, 1);
}
/**
* Show CachedNavbar of current item primary category
*
* @param Array $params
* @return string
*/
function CategoryName($params)
{
// show category cachednavbar of
$object =& $this->getObject($params);
$category_id = isset($params['cat_id']) ? $params['cat_id'] : $object->GetDBField('CategoryId');
$category_path = $this->Application->getCache('category_paths', $category_id);
if ($category_path === false) {
// not chached
if ($category_id > 0) {
$category_path = trim($this->CategoryName( Array('cat_id' => 0) ).' > '.str_replace('&|&', ' > ', $object->GetDBField('CachedNavbar')), ' > ');
}
else {
$category_path = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
}
$this->Application->setCache('category_paths', $category_id, $category_path);
}
return $category_path;
}
/**
* Allows to determine if original value should be shown
*
* @param Array $params
* @return bool
*/
function DisplayOriginal($params)
{
// original id found & greather then zero + show original
$display_original = isset($params['display_original']) && $params['display_original'];
$owner_field = $this->Application->getUnitOption($this->Prefix, 'OwnerField');
if (!$owner_field) {
$owner_field = 'CreatedById';
}
$object =& $this->getObject($params);
$perm_value = $this->PermHelper->ModifyCheckPermission($object->GetDBField($owner_field), $object->GetDBField('CategoryId'), $this->Prefix);
return $display_original && ($perm_value == 1) && $this->Application->GetVar($this->Prefix.'.original_id');
}
/**
* Checks if user have one of required permissions
*
* @param Array $params
* @return bool
*/
function HasPermission($params)
{
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$params['raise_warnings'] = 0;
$object =& $this->getObject($params);
/* @var $object kCatDBItem */
// 1. category restriction
$params['cat_id'] = $object->isLoaded() ? $object->GetDBField('ParentPath') : $this->Application->GetVar('m_cat_id');
// 2. owner restriction
$owner_field = $this->Application->getUnitOption($this->Prefix, 'OwnerField');
if (!$owner_field) {
$owner_field = 'CreatedById';
}
$is_owner = $object->GetDBField($owner_field) == $this->Application->RecallVar('user_id');
return $perm_helper->TagPermissionCheck($params, $is_owner);
}
/**
* Creates link to current category or to module root category, when current category is home
*
* @param Array $params
* @return string
*/
function SuggestItemLink($params)
{
if (!isset($params['cat_id'])) {
$params['cat_id'] = $this->Application->GetVar('m_cat_id');
}
if ($params['cat_id'] == 0) {
$params['cat_id'] = $this->Application->findModule('Var', $this->Prefix, 'RootCat');
}
return $this->Application->ProcessParsedTag('c', 'CategoryLink', $params);
}
/**
* Allows to detect if item has any additional images available
*
* @param Array $params
* @return string
*/
function HasAdditionalImages($params)
{
$object =& $this->getObject($params);
$sql = 'SELECT ImageId
FROM '.$this->Application->getUnitOption('img', 'TableName').'
WHERE ResourceId = '.$object->GetDBField('ResourceId').' AND DefaultImg != 1 AND Enabled = 1';
return $this->Conn->GetOne($sql) ? 1 : 0;
}
/**
* Checks that item is pending
*
* @param Array $params
* @return bool
*/
function IsPending($params)
{
$object =& $this->getObject($params);
$pending_status = Array (STATUS_PENDING, STATUS_PENDING_EDITING);
return in_array($object->GetDBField('Status'), $pending_status);
}
function IsFavorite($params)
{
- static $favorite_status = null;
+ static $favorite_status = Array ();
$object =& $this->getObject($params);
/* @var $object kDBList */
- if (!isset($favorite_status)) {
+ if (!isset($favorite_status[$this->Special])) {
$resource_ids = $object->GetCol('ResourceId');
$user_id = $this->Application->RecallVar('user_id');
$sql = 'SELECT FavoriteId, ResourceId
FROM '.$this->Application->getUnitOption('fav', 'TableName').'
WHERE (PortalUserId = '.$user_id.') AND (ResourceId IN ('.implode(',', $resource_ids).'))';
- $favorite_status = $this->Conn->GetCol($sql, 'ResourceId');
+ $favorite_status[$this->Special] = $this->Conn->GetCol($sql, 'ResourceId');
}
- return isset($favorite_status[$object->GetDBField('ResourceId')]);
+ return isset($favorite_status[$this->Special][$object->GetDBField('ResourceId')]);
}
/**
* Returns item's editors pick status (using not formatted value)
*
* @param Array $params
* @return bool
*/
function IsEditorsPick($params)
{
$object =& $this->getObject($params);
return $object->GetDBField('EditorsPick') == 1;
}
function FavoriteToggleLink($params)
{
$fav_prefix = $this->Prefix.'-fav';
$params['pass'] = implode(',', Array('m', $this->Prefix, $fav_prefix));
$params[$fav_prefix.'_event'] = 'OnFavoriteToggle';
return $this->Application->ProcessParsedTag('m', 'Link', $params);
}
/**
* Checks if item is passed in url
*
* @param Array $params
* @return bool
*/
function ItemAvailable($params)
{
return $this->Application->GetVar($this->getPrefixSpecial().'_id') > 0;
}
function SortingSelected($params)
{
$list =& $this->GetList($params);
$user_sorting_start = $this->getUserSortIndex();
$sorting = strtolower($list->GetOrderField($user_sorting_start).'|'.$list->GetOrderDirection($user_sorting_start));
if ($sorting == strtolower($params['sorting'])) return $params['selected'];
}
function CombinedSortingDropDownName($params)
{
return $this->Prefix.'_CombinedSorting';
}
/**
* Prepares name for field with event in it (used only on front-end)
*
* @param Array $params
* @return string
*/
function SubmitName($params)
{
return 'events['.$this->Prefix.']['.$params['event'].']';
}
/**
* Returns prefix + any word (used for shared between categories per page settings)
*
* @param Array $params
* @return string
*/
function VarName($params)
{
return $this->Prefix.'_'.$params['type'];
}
/**
* Checks if we are viewing module root category
*
* @param Array $params
* @return bool
*/
function IsModuleHome($params)
{
$root_category = $this->Application->findModule('Var', $this->Prefix, 'RootCat');
return $root_category == $this->Application->GetVar('m_cat_id');
}
/**
* Dynamic votes indicator
*
* @param Array $params
*
* @return string
*/
function VotesIndicator($params)
{
$blocks_params = $this->prepareTagParams($params);
$blocks_params['name'] = $params['render_as'];
$object =& $this->getObject($params);
/* @var $object kDBItem */
if ($this->Application->ConfigValue('UseFloatRating')) {
$rating = $object->GetDBField('CachedRating');
$float_rating = floor(($rating - floor($rating)) / 0.25) * 0.25;
}
else {
$rating = round( $object->GetDBField('CachedRating') );
$float_rating = 0;
}
$i = 1;
$ret = '';
while ($i <= 5) {
$blocks_params['number'] = $i;
$blocks_params['active'] = $rating >= $i ? 1 : 0;
if ($rating > $i - 1 && $rating < $i && $float_rating > 0) {
$blocks_params['active'] = 1;
$blocks_params['float_rating'] = $float_rating;
}
else {
$blocks_params['float_rating'] = '';
}
$ret .= trim($this->Application->ParseBlock($blocks_params));
$i++;
}
return $ret;
}
function RelevanceIndicator($params)
{
$object =& $this->getObject($params);
$search_results_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search';
$sql = 'SELECT Relevance
FROM '.$search_results_table.'
WHERE ResourceId = '.$object->GetDBField('ResourceId');
$percents_off = (int)(100 - (100 * $this->Conn->GetOne($sql)));
$percents_off = ($percents_off < 0) ? 0 : $percents_off;
if ($percents_off) {
$params['percent_off'] = $percents_off;
$params['percent_on'] = 100 - $percents_off;
$params['name'] = $this->SelectParam($params, 'relevance_normal_render_as,block_relevance_normal');
}
else {
$params['name'] = $this->SelectParam($params, 'relevance_full_render_as,block_relevance_full');
}
return $this->Application->ParseBlock($params);
}
function SearchResultField($params)
{
$ret = $this->Field($params);
$keywords = unserialize( $this->Application->RecallVar('highlight_keywords') );
$opening = $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'highlight_opening_render_as,block_highlight_opening')) );
$closing = $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'highlight_closing_render_as,block_highlight_closing')) );
foreach ($keywords as $index => $keyword) {
$keywords[$index] = preg_quote($keyword, '/');
}
return preg_replace('/('.implode('|', $keywords).')/i', $opening.'\\1'.$closing, $ret);
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/general/cat_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.37
\ No newline at end of property
+1.38
\ No newline at end of property
Event Timeline
Log In to Comment