1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-16 23:00:51 +03:00

Компонент property

This commit is contained in:
Denis Shakhov 2014-10-21 20:58:28 +07:00
parent 8c8df613ef
commit 756e7cdc62
40 changed files with 203 additions and 210 deletions

View file

@ -54,9 +54,11 @@ class BlockPropertyUpdate extends Block
}
$aProperties = $this->Property_GetPropertiesForUpdate($oBehavior->getPropertyTargetType(),
$oTarget->getId());
$this->Viewer_Assign('aProperties', $aProperties);
$this->Viewer_Assign('properties', $aProperties, true);
break;
}
}
$this->SetTemplate('components/property/input/list.tpl');
}
}

View file

@ -1,10 +0,0 @@
{*
Вывод дополнительных полей для ввода данных на странице создания нового объекта
*}
{if $aProperties}
{foreach $aProperties as $oProperty}
{include "forms/property/form.field_render.tpl" oProperty=$oProperty}
{/foreach}
{/if}

View file

@ -0,0 +1,6 @@
# Компонент property
Свойства добавленные пользователем.
**input** — Поля форм.
**output** — Вывод значений полей.

View file

@ -0,0 +1,12 @@
/**
* Media
*/
.property-list {
margin-bottom: 30px;
}
.property {
padding: 15px 15px;
border-bottom: 1px solid #eee;
}

View file

@ -0,0 +1 @@
{include "./property.{$property->getType()}.tpl" property=$property}

View file

@ -0,0 +1,7 @@
{**
* Вывод дополнительных полей для ввода данных на странице создания нового объекта
*}
{foreach $smarty.local.properties as $property}
{include './item.tpl' property=$property}
{/foreach}

View file

@ -6,14 +6,12 @@
{extends 'components/modal/modal.tpl'}
{block 'modal_id'}modal-property-type-video-{$oValue->getId()}{/block}
{block 'modal_id'}modal-property-type-video-{$value->getId()}{/block}
{block 'modal_class'}modal-property js-modal-default{/block}
{block 'modal_title'}Предпросмотр видео{/block}
{block 'modal_content'}
<div>
{$oValue->getValueTypeObject()->getVideoCodeFrame()}
</div>
{$value->getValueTypeObject()->getVideoCodeFrame()}
{/block}
{block 'modal_footer'}{/block}

View file

@ -0,0 +1,6 @@
{include "components/field/field.checkbox.tpl"
name = "property[{$property->getId()}]"
value = 1
checked = $property->getValue()->getValueInt()
note = $property->getDescription()
label = $property->getTitle()}

View file

@ -0,0 +1,6 @@
{include "components/field/field.date.tpl"
name = "property[{$property->getId()}][date]"
value = $property->getValue()->getValueForForm()
note = $property->getDescription()
label = $property->getTitle()
useTime = $property->getParam( 'use_time' )}

View file

@ -0,0 +1,7 @@
{include 'components/field/field.file.tpl'
name = "property[{$property->getId()}][file]"
removeName = "property[{$property->getId()}][remove]"
classes = 'width-300'
note = $property->getDescription()
label = $property->getTitle()
uploadedFiles = $property->getValue()->getDataOne( 'file' )}

View file

@ -0,0 +1,6 @@
{include "components/field/field.text.tpl"
name = "property[{$property->getId()}]"
value = $property->getValue()->getValueFloat()
classes = 'width-150'
note = $property->getDescription()
label = $property->getTitle()}

View file

@ -0,0 +1,9 @@
{$valueType = $property->getValue()->getValueTypeObject()}
{$uploadedFiles = $valueType->getImageWebPath( $valueType->getImageSizeFirst() )}
{include 'components/field/field.image.tpl'
name = "property[{$property->getId()}][file]"
removeName = "property[{$property->getId()}][remove]"
uploadedFiles = ( $uploadedFiles ) ? [ $uploadedFiles ] : false
note = $property->getDescription()
label = $property->getTitle()}

View file

@ -0,0 +1,6 @@
{include "components/field/field.text.tpl"
name = "property[{$property->getId()}]"
value = $property->getValue()->getValueInt()
classes = 'width-150'
note = $property->getDescription()
label = $property->getTitle()}

View file

@ -0,0 +1,27 @@
{* Формируем массив с активными пунктами *}
{$selectedValues = []}
{foreach $property->getValue()->getValueForForm() as $value}
{$selectedValues[] = $value@key}
{/foreach}
{* Формируем значения для селекта *}
{$items = [[
'value' => 0,
'text' => '&mdash;'
]]}
{foreach $property->getSelects() as $item}
{$items[] = [
'value' => $item->getId(),
'text' => $item->getValue()
]}
{/foreach}
{include 'components/field/field.select.tpl'
name = "property[{$property->getId()}][]"
label = $property->getTitle()
note = $property->getDescription()
items = $items
isMultiple = $property->getValidateRuleOne('allowMany')
selectedValue = $selectedValues}

View file

@ -0,0 +1,19 @@
{$value = $property->getValue()}
{include "components/field/field.text.tpl"
name = "property[{$property->getId()}]"
value = $value->getValueVarchar()
id = "property-value-tags-{$property->getId()}"
note = $property->getDescription()
label = $property->getTitle()}
<script>
jQuery(function($) {
ls.autocomplete.add(
$( "#property-value-tags-{$property->getId()}" ),
aRouter.ajax + 'property/tags/autocompleter/',
true,
{ property_id: '{$value->getPropertyId()}' }
);
});
</script>

View file

@ -0,0 +1,6 @@
{include "components/field/field.textarea.tpl"
name = "property[{$property->getId()}]"
value = $property->getValue()->getValueForForm()
rows = 10
note = $property->getDescription()
label = $property->getTitle()}

View file

@ -0,0 +1,5 @@
{include "components/field/field.text.tpl"
name = "property[{$property->getId()}]"
value = $property->getValue()->getValueVarchar()
note = $property->getDescription()
label = $property->getTitle()}

View file

@ -0,0 +1,13 @@
{$value = $property->getValue()}
{include "components/field/field.text.tpl"
name = "property[{$property->getId()}]"
value = $value->getValueVarchar()
note = $property->getDescription()
label = $property->getTitle()}
{include './modal.property-input-video.tpl' value=$value}
<p class="mb-20">
<a href="#" class="link-dotted" data-modal-target="modal-property-type-video-{$value->getId()}">Смотреть</a>
</p>

View file

@ -0,0 +1,22 @@
{* TODO: Viewer_TemplateExists не работает *}
{$property = $smarty.local.property}
{if $property}
{* Проверяем наличие кастомного шаблона item.[type].[target_type].tpl *}
{$template = "./property.{$property->getType()}.{$property->getTargetType()}.tpl"}
{if $LS->Viewer_TemplateExists( $template )}
{include "{$template}" property=$property}
{else}
{* Проверяем наличие кастомного шаблона item.[type].tpl *}
{$template = "./property.{$property->getType()}.tpl"}
{if $LS->Viewer_TemplateExists( $template )}
{include "{$template}" property=$property}
{else}
{* Показываем стандартный шаблон *}
{include "./property.default.tpl"}
{/if}
{/if}
{/if}

View file

@ -0,0 +1,7 @@
{if $smarty.local.properties}
<div class="property-list">
{foreach $smarty.local.properties as $property}
{include './item.tpl' property=$property}
{/foreach}
</div>
{/if}

View file

@ -0,0 +1,9 @@
<div class="property">
<div class="property-list-item-label">
{$property->getTitle()}
</div>
<strong class="property-list-item-content">
{$property->getValue()->getValueForDisplay()}
</strong>
</div>

View file

@ -0,0 +1,13 @@
{$value = $property->getValue()}
<div class="property">
<div class="property-list-item-label">
{$property->getTitle()}
</div>
{if $oUserCurrent || ! $property->getParam('access_only_auth')}
<a href="{router page="property/download"}{$value->getValueVarchar()}/">{$value->getValueForDisplay()}</a>
{else}
Для доступа к файлу <a href="#" class="js-modal-toggle-login">необходимо авторизоваться</a>
{/if}
</div>

View file

@ -0,0 +1,11 @@
{$valueType = $property->getValue()->getValueTypeObject()}
<div class="property">
<div class="property-list-item-label">
{$property->getTitle()}
</div>
<a href="{$valueType->getImageWebPath()}" class="js-lbx" target="_blank">
<img src="{$valueType->getImageWebPath( $valueType->getImageSizeFirst() )}" >
</a>
</div>

View file

@ -1,8 +0,0 @@
{$oValue = $oProperty->getValue()}
{include "components/field/field.checkbox.tpl"
name = "property[{$oProperty->getId()}]"
value = 1
checked = $oValue->getValueInt()
note = $oProperty->getDescription()
label = $oProperty->getTitle()}

View file

@ -1,28 +0,0 @@
{$oValue = $oProperty->getValue()}
{$oValueType = $oValue->getValueTypeObject()}
{include "components/field/field.text.tpl"
name = "property[{$oProperty->getId()}][date]"
value = $oValue->getValueForForm()
inputClasses = 'width-150 js-date-picker'
note = $oProperty->getDescription()
label = $oProperty->getTitle()}
{if $oProperty->getParam('use_time')}
<select name="property[{$oProperty->getId()}][time][h]">
{section name=time_h start=0 loop=24 step=1}
<option value="{$smarty.section.time_h.index}" {if $oValueType->getValueTimeH()==$smarty.section.time_h.index}selected="selected" {/if}>{$smarty.section.time_h.index}</option>
{/section}
</select>
:
<select name="property[{$oProperty->getId()}][time][m]">
{section name=time_m start=0 loop=60 step=5}
<option value="{$smarty.section.time_m.index}" {if $oValueType->getValueTimeM()==$smarty.section.time_m.index}selected="selected" {/if}>{$smarty.section.time_m.index}</option>
{/section}
</select>
<br/>
<br/>
{/if}

View file

@ -1,18 +0,0 @@
{$value = $oProperty->getValue()}
{$valueType = $value->getValueTypeObject()}
{include 'components/field/field.file.tpl'
name = "property[{$oProperty->getId()}][file]"
classes = 'width-300'
note = $oProperty->getDescription()
label = $oProperty->getTitle()}
{$file = $value->getDataOne('file')}
{if $file}
Загружен файл: {$file.name}.{$file.extension} <br/>
<label>
<input type="checkbox" name="property[{$oProperty->getId()}][remove]" value="1"> &mdash; удалить файл
</label>
<br/>
{/if}

View file

@ -1,8 +0,0 @@
{$oValue = $oProperty->getValue()}
{include "components/field/field.text.tpl"
name = "property[{$oProperty->getId()}]"
value = $oValue->getValueFloat()
classes = 'width-150'
note = $oProperty->getDescription()
label = $oProperty->getTitle()}

View file

@ -1,18 +0,0 @@
{$value = $oProperty->getValue()}
{$valueType = $value->getValueTypeObject()}
{include 'components/field/field.file.tpl'
name = "property[{$oProperty->getId()}][file]"
classes = 'width-300'
note = $oProperty->getDescription()
label = $oProperty->getTitle()}
{$file = $value->getDataOne('file')}
{if $file}
<a href="{$valueType->getImageWebPath()}" class="js-lbx" target="_blank"><img src="{$valueType->getImageWebPath($valueType->getImageSizeFirst())}" ></a> <br/>
<label>
<input type="checkbox" name="property[{$oProperty->getId()}][remove]" value="1"> &mdash; удалить изображение
</label>
<br/>
{/if}

View file

@ -1,8 +0,0 @@
{$oValue = $oProperty->getValue()}
{include "components/field/field.text.tpl"
name = "property[{$oProperty->getId()}]"
value = $oValue->getValueInt()
classes = 'width-150'
note = $oProperty->getDescription()
label = $oProperty->getTitle()}

View file

@ -1,20 +0,0 @@
{* TODO: Форма с селектом не отправляется (аякс ошибка) *}
{$oValue=$oProperty->getValue()}
{$aValues=$oValue->getValueForForm()}
{$aSelectItems=$oProperty->getSelects()}
{$oProperty->getTitle()}:
<br>
<select name="property[{$oProperty->getId()}][]" {if $oProperty->getValidateRuleOne('allowMany')}multiple="multiple" class="select-multiple" {/if}>
{if $oProperty->getValidateRuleOne('allowEmpty')}
<option value=""></option>
{/if}
{foreach $aSelectItems as $oSelectItem}
<option value="{$oSelectItem->getId()}" {if isset($aValues[$oSelectItem->getId()])}selected="selected"{/if}>{$oSelectItem->getValue()}</option>
{/foreach}
</select>
<br/><br/>

View file

@ -1,14 +0,0 @@
{$oValue = $oProperty->getValue()}
{include "components/field/field.text.tpl"
name = "property[{$oProperty->getId()}]"
value = $oValue->getValueVarchar()
id = "property-value-tags-{$oProperty->getId()}"
note = $oProperty->getDescription()
label = $oProperty->getTitle()}
<script>
jQuery(function($){
ls.autocomplete.add($("#property-value-tags-{$oProperty->getId()}"), aRouter['ajax']+'property/tags/autocompleter/', true, { property_id: '{$oValue->getPropertyId()}' });
});
</script>

View file

@ -1,8 +0,0 @@
{$oValue = $oProperty->getValue()}
{include "components/field/field.textarea.tpl"
name = "property[{$oProperty->getId()}]"
value = $oValue->getValueForForm()
rows = 10
note = $oProperty->getDescription()
label = $oProperty->getTitle()}

View file

@ -1,7 +0,0 @@
{$oValue = $oProperty->getValue()}
{include "components/field/field.text.tpl"
name = "property[{$oProperty->getId()}]"
value = $oValue->getValueVarchar()
note = $oProperty->getDescription()
label = $oProperty->getTitle()}

View file

@ -1,11 +0,0 @@
{$oValue = $oProperty->getValue()}
{include "components/field/field.text.tpl"
name = "property[{$oProperty->getId()}]"
value = $oValue->getValueVarchar()
classes = 'width-300'
note = $oProperty->getDescription()
label = $oProperty->getTitle()}
{include "modals/modal.property_type_video.tpl" oValue=$oValue}
<p class="mb-20"><a href="#" class="link-dotted" data-modal-target="modal-property-type-video-{$oValue->getId()}">Смотреть</a></p>

View file

@ -1,5 +0,0 @@
{$type = $oProperty->getType()}
<div class="js-property-field-area property-type-{$oProperty->getType()} property-type-{$oProperty->getTargetType()}-{$oProperty->getType()}" data-property-id="{$oProperty->getId()}">
{include "forms/property/form.field.{$type}.tpl" oProperty=$oProperty}
</div>

View file

@ -1,4 +0,0 @@
<div class="property-list-item">
<div class="property-list-item-label">{$oPropertyItem->getTitle()}</div>
<strong class="property-list-item-content">{$oPropertyItem->getValue()->getValueForDisplay()}</strong>
</div>

View file

@ -1,9 +0,0 @@
{$oValue=$oPropertyItem->getValue()}
<div class="property-list-item">
<div class="property-list-item-label">{$oPropertyItem->getTitle()}</div>
{if $oUserCurrent or !$oPropertyItem->getParam('access_only_auth')}
<a href="{router page="property/download"}{$oValue->getValueVarchar()}/">{$oValue->getValueForDisplay()}</a>
{else}
Для доступа к файлу <a href="#" class="js-modal-toggle-login">необходимо авторизоваться</a>
{/if}
</div>

View file

@ -1,6 +0,0 @@
{$oValue=$oPropertyItem->getValue()}
{$oValueType = $oValue->getValueTypeObject()}
<div class="property-list-item">
<div class="property-list-item-label">{$oPropertyItem->getTitle()}</div>
<a href="{$oValueType->getImageWebPath()}" class="js-lbx" target="_blank"><img src="{$oValueType->getImageWebPath($oValueType->getImageSizeFirst())}" ></a> <br/>
</div>

View file

@ -1,16 +0,0 @@
{if $oPropertyItem}
{* Проверяем наличие кастомного шаблона item.[type].[target_type].tpl *}
{$sTemplateType="property/item.{$oPropertyItem->getType()}.{$oPropertyItem->getTargetType()}.tpl"}
{if $LS->Viewer_TemplateExists($sTemplateType)}
{include $sTemplateType}
{else}
{* Проверяем наличие кастомного шаблона item.[type].tpl *}
{$sTemplateType="property/item.{$oPropertyItem->getType()}.tpl"}
{if $LS->Viewer_TemplateExists($sTemplateType)}
{include $sTemplateType}
{else}
{* Показываем стандартный шаблон *}
{include 'property/item.base.tpl'}
{/if}
{/if}
{/if}

View file

@ -1,7 +0,0 @@
{if $aPropertyItems}
<div class="property-list">
{foreach $aPropertyItems as $oPropertyItem}
{include 'property/render.item.tpl'}
{/foreach}
</div>
{/if}