Skip to content

Commit

Permalink
мелочи и недочеты
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzegit committed Sep 15, 2017
1 parent c388bbe commit 386d32a
Show file tree
Hide file tree
Showing 15 changed files with 335 additions and 199 deletions.
4 changes: 2 additions & 2 deletions install/languages/en/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ CREATE TABLE `{#}controllers` (
`version` varchar(8) NOT NULL COMMENT 'Version',
`is_backend` tinyint(1) unsigned DEFAULT NULL COMMENT 'Admin panel?',
`is_external` tinyint(1) unsigned DEFAULT NULL COMMENT 'Third-party component',
`files` varchar(4000) DEFAULT NULL,
`files` varchar(10000) DEFAULT NULL,
`addon_id` int(11) UNSIGNED DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `name` (`name`),
Expand Down Expand Up @@ -1556,7 +1556,7 @@ CREATE TABLE `{#}widgets` (
`url` varchar(250) DEFAULT NULL COMMENT 'Author site',
`version` varchar(8) DEFAULT NULL COMMENT 'Version',
`is_external` tinyint(1) DEFAULT '1',
`files` varchar(4000) DEFAULT NULL,
`files` varchar(10000) DEFAULT NULL,
`addon_id` int(11) UNSIGNED DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `version` (`version`),
Expand Down
4 changes: 2 additions & 2 deletions install/languages/ru/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ CREATE TABLE `{#}controllers` (
`version` varchar(8) NOT NULL COMMENT 'Версия',
`is_backend` tinyint(1) unsigned DEFAULT NULL COMMENT 'Есть админка?',
`is_external` tinyint(1) unsigned DEFAULT NULL COMMENT 'Сторонний компонент',
`files` varchar(4000) DEFAULT NULL COMMENT 'Список файлов контроллера (для стороних компонентов)',
`files` varchar(10000) DEFAULT NULL COMMENT 'Список файлов контроллера (для стороних компонентов)',
`addon_id` int(11) UNSIGNED DEFAULT NULL COMMENT 'ID дополнения в официальном каталоге',
PRIMARY KEY (`id`),
KEY `name` (`name`),
Expand Down Expand Up @@ -1555,7 +1555,7 @@ CREATE TABLE `{#}widgets` (
`url` varchar(250) DEFAULT NULL COMMENT 'Сайт автора',
`version` varchar(8) DEFAULT NULL COMMENT 'Версия',
`is_external` tinyint(1) DEFAULT '1',
`files` varchar(4000) DEFAULT NULL COMMENT 'Список файлов виджета (для стороних виджетов)',
`files` varchar(10000) DEFAULT NULL COMMENT 'Список файлов виджета (для стороних виджетов)',
`addon_id` int(11) UNSIGNED DEFAULT NULL COMMENT 'ID дополнения в официальном каталоге',
PRIMARY KEY (`id`),
KEY `version` (`version`),
Expand Down
29 changes: 13 additions & 16 deletions system/controllers/admin/actions/content_cats_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

class actionAdminContentCatsAdd extends cmsAction {

public function run($ctype_id=false, $parent_id=1){
public function run($ctype_id = false, $parent_id = 1){

if (!$ctype_id) { $this->redirectBack(); }
if (!$ctype_id) { return cmsCore::error404(); }

$content_model = cmsCore::getModel('content');

$ctype = $content_model->getContentType($ctype_id);
if (!$ctype) { return cmsCore::error404(); }

$form = $this->getForm('content_category');

Expand All @@ -22,7 +23,7 @@ public function run($ctype_id=false, $parent_id=1){
// Парсим форму и получаем поля записи
$category = $form->parse($this->request, $is_submitted);

$back_url = $this->request->get('back');
$back_url = $this->request->get('back', '');

if (!$is_submitted && $parent_id) { $category['parent_id'] = $parent_id; }

Expand Down Expand Up @@ -53,12 +54,12 @@ public function run($ctype_id=false, $parent_id=1){
cmsUser::addSessionMessage(sprintf(LANG_CP_CTYPE_CATEGORIES_OFF, href_to($this->name, 'ctypes', array('edit', $ctype['id'])).'#tab-categories'));
}

return cmsTemplate::getInstance()->render('content_cats_add', array(
'ctype' => $ctype,
return $this->cms_template->render('content_cats_add', array(
'ctype' => $ctype,
'category' => $category,
'form' => $form,
'form' => $form,
'back_url' => $back_url,
'errors' => isset($errors) ? $errors : false
'errors' => isset($errors) ? $errors : false
));

}
Expand All @@ -67,14 +68,14 @@ private function createCategories($content_model, $ctype, $data){

$list = explode("\n", $data['title']);

$levels_ids = array();
$cats_ids = array();
$levels_ids = array();
$cats_ids = array();
$is_first = true;
$remove_level_offset = 0;

$parent_props = $content_model->getContentPropsBinds($ctype['name'], $data['parent_id']);
$parent_props = array_collection_to_list($parent_props, 'id', 'prop_id');

$is_first = true;
$remove_level_offset = 0;

foreach($list as $category_title){

$category_title = trim($category_title);
Expand All @@ -83,8 +84,6 @@ private function createCategories($content_model, $ctype, $data){

$level = mb_strlen(str_replace(' ', '', $category_title)) - mb_strlen(ltrim(str_replace(' ', '', $category_title), '- '));

// dump($level.': '.ltrim($category_title, '- '), false);

if ($is_first && $level > 0){ $remove_level_offset = $level; }

$level = $level - $remove_level_offset;
Expand Down Expand Up @@ -123,8 +122,6 @@ private function createCategories($content_model, $ctype, $data){
$levels_ids[$level] = $result['id'];
$cats_ids[] = $result['id'];



}

if (!empty($data['is_inherit_binds']) && $parent_props && $cats_ids){
Expand Down
18 changes: 12 additions & 6 deletions system/controllers/admin/actions/content_cats_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,27 @@ public function run($ctype_id){
$content_model = cmsCore::getModel('content');

$ctype = $content_model->getContentType($ctype_id);
if (!$ctype) { return cmsCore::error404(); }

$categories = $content_model->getCategoriesTree($ctype['name'], false);

$is_submitted = $this->request->has('submit');
if ($this->request->has('submit')){

$hash = $this->request->get('hash', '');

if ($is_submitted){
$hash = $this->request->get('hash');
cmsUser::setCookiePublic('content_tree_path', "{$ctype_id}.1");

$this->reorderCategoriesTree($content_model, $ctype, $categories, $hash);

cmsUser::addSessionMessage(LANG_CP_ORDER_SUCCESS, 'success');

$this->redirectBack();

}

return cmsTemplate::getInstance()->render('content_cats_order', array(
'ctype' => $ctype,
'categories' => $categories,
return $this->cms_template->render('content_cats_order', array(
'ctype' => $ctype,
'categories' => $categories
));

}
Expand Down
2 changes: 1 addition & 1 deletion templates/default/content/albums_list.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</div>
</a>
<?php } ?>
<?php unset($item['fields']['cover_image'], $item['fields']['content'], $item['fields']['is_public']); ?>
<?php unset($item['fields']['cover_image'], $item['fields']['content'], $item['fields']['is_public'], $item['fields']['title']); ?>
</div>

<div class="fields">
Expand Down
1 change: 1 addition & 0 deletions templates/default/css/theme-widgets.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
font-weight: bold;
font-size:18px;
color:#FFF;
margin: 0;
}

.widget > .title .links {
Expand Down
17 changes: 8 additions & 9 deletions templates/default/widgets/wrapper.tpl.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<div class="widget<?php if ($widget['class_wrap']) { ?> <?php echo ltrim($widget['class_wrap'], '.'); } ?>">

<div class="widget<?php if ($widget['class_wrap']) { ?> <?php echo $widget['class_wrap']; } ?>">
<?php if ($widget['title'] && $is_titles){ ?>
<div class="title<?php if ($widget['class_title']) { ?> <?php echo ltrim($widget['class_title'], '.'); } ?>">
<h4 class="title<?php if ($widget['class_title']) { ?> <?php echo $widget['class_title']; } ?>">
<?php echo $widget['title']; ?>
<?php if (!empty($widget['links'])) { ?>
<div class="links">
<?php $links = string_parse_list($widget['links']); ?>
<?php foreach($links as $link){ ?>
<a href="<?php echo (mb_strpos($link['value'], 'http://')===0) ? $link['value'] : href_to($link['value']); ?>"><?php echo $link['id']; ?></a>
<a href="<?php echo (strpos($link['value'], 'http') === 0) ? $link['value'] : href_to($link['value']); ?>">
<?php echo $link['id']; ?>
</a>
<?php } ?>
</div>
<?php } ?>
</div>
</h4>
<?php } ?>

<div class="body<?php if ($widget['class']) { ?> <?php echo ltrim($widget['class'], '.'); } ?>">
<div class="body<?php if ($widget['class']) { ?> <?php echo $widget['class']; } ?>">
<?php echo $widget['body']; ?>
</div>

</div>
</div>
12 changes: 4 additions & 8 deletions templates/default/widgets/wrapper_tabbed.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,34 @@
<div class="widget_tabbed">
<div class="tabs">
<ul>
<?php foreach($widgets as $index=>$widget) { ?>
<li class="tab">
<?php foreach($widgets as $index => $widget) { ?>
<li class="tab<?php if ($widget['class_title']) { ?> <?php echo $widget['class_title']; } ?>">
<a <?php if ($index==0) { ?>class="active"<?php } ?> data-id="<?php echo $widget['id']; ?>">
<?php echo $widget['title'] ? $widget['title'] : ($index+1); ?>
</a>
</li>
<?php } ?>

<li class="links">
<?php foreach($widgets as $index=>$widget) { ?>
<?php foreach($widgets as $index => $widget) { ?>
<?php if (!empty($widget['links'])) { ?>
<div class="links-wrap" id="widget-links-<?php echo $widget['id']; ?>" <?php if ($index>0) { ?>style="display: none"<?php } ?>>
<?php $links = string_parse_list($widget['links']); ?>
<?php foreach($links as $link){ ?>
<a href="<?php echo (mb_strpos($link['value'], 'http') === 0) ? $link['value'] : href_to($link['value']); ?>">
<a href="<?php echo (strpos($link['value'], 'http') === 0) ? $link['value'] : href_to($link['value']); ?>">
<?php echo $link['id']; ?>
</a>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
</li>

</ul>
</div>
<div class="widgets">
<?php foreach($widgets as $index=>$widget) { ?>

<div id="widget-<?php echo $widget['id']; ?>" class="body<?php if ($widget['class']) { ?> <?php echo $widget['class']; } ?>" <?php if ($index>0) { ?>style="display: none"<?php } ?>>
<?php echo $widget['body']; ?>
</div>

<?php } ?>
</div>
</div>
Loading

0 comments on commit 386d32a

Please sign in to comment.