Skip to content

Commit

Permalink
Merge branch 'template' of github.com:imagecms/ImageCMS into template
Browse files Browse the repository at this point in the history
  • Loading branch information
koloda committed Mar 4, 2013
2 parents f86bfc7 + 156a6be commit f89f09b
Show file tree
Hide file tree
Showing 14 changed files with 119 additions and 277 deletions.
7 changes: 4 additions & 3 deletions application/modules/CMSFactory/assetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class assetManager {
protected static $_BehaviorInstance;

private function __construct() {


defined('DS') OR define('DS', '/');
}

private function __clone() {
Expand Down Expand Up @@ -40,7 +41,7 @@ public function registerScript($name) {
$trace = debug_backtrace();
$paths = explode(DS, $trace[0]['file']);
$paths = $paths[count($paths) - 2];
\CI_Controller::get_instance()->template->registerJsFile(APPPATH . 'modules/' . $paths . '/assets/js/' . $name . '.js', 'after');
\CI_Controller::get_instance()->template->registerJsFile(APPPATH . 'modules/' . $name . '/assets/js/' . $name . '.js', 'after');
return $this;
}

Expand Down Expand Up @@ -114,7 +115,7 @@ public function render($tpl, $ignoreWrap = FALSE) {
public function fetchTemplate($tpl) {
$trace = debug_backtrace();
$paths = explode(DS, $trace[0]['file']);
$paths = $paths[count($paths) - 2];
$paths = $paths[count($paths) - 2];
try {
$tplPath = APPPATH . '/modules/' . $paths . '/assets/' . $tpl;
file_exists($tplPath . '.tpl') OR throwException('Can\'t load template file: <i>' . $paths . DS . $tpl . '.tpl</i>');
Expand Down
2 changes: 1 addition & 1 deletion application/modules/admin/categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function cat_list() {
$cats = array();

//$tree = $this->lib_category->build();
$tree = $this->lib_category->buildForAdmin();
$tree = $this->lib_category->_build();

$cats = $this->sub_cats($tree);

Expand Down
16 changes: 15 additions & 1 deletion application/modules/comments/assets/css/comments.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,18 @@
#comment__icsi-css textarea, #comment__icsi-css input{font-style: normal;font-size: 12px;font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;background-color:#fff;}
#comment__icsi-css textarea, #comment__icsi-css input[type="text"]{height: 30px;border-color: #ababab;-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);}
#comment__icsi-css textarea{height: 134px; padding-top: 5px}
#comment__icsi-css a:focus, #comment__icsi-css input:focus, #comment__icsi-css button:focus, #comment__icsi-css textarea:focus{outline: 2px solid #f1ca7f;outline-offset: -1px;}
#comment__icsi-css a:focus, #comment__icsi-css input:focus, #comment__icsi-css button:focus, #comment__icsi-css textarea:focus{outline: 2px solid #f1ca7f;outline-offset: -1px;}
.msg .success, .msg .error {border-radius: 5px 5px 5px 5px;margin-bottom: 15px;padding: 8px;}
.error {background-color: #FFE8E8;border: 1px solid #F27676;}
.success {background-color: #ECFFE8;border: 1px solid #80C232;}
.error, .success {border-radius: 3px 3px 3px 3px;}
.msg .success *, .msg .notice {font-size: 13px;}
.msg .error *, .msg .error {font-size: 13px;}
.msg h1, .msg h2, .msg h3 {font-size: 16px !important;font-weight: bold;margin-top: 5px !important;}
.msg h1 {font-size: 20px !important;}
.msg h2 {font-size: 18px !important;}
.msg p {margin-bottom: 5px !important;}
.success, .success * {color: #5FA335;}
label.success {margin-top: 7px;padding: 2px 11px;}
label.error {margin-top: 7px;padding: 2px 11px;}
.error, .error * {color: #E42E2E;}
46 changes: 32 additions & 14 deletions application/modules/comments/commentsapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function renderPosts() {

echo json_encode(array(
'comments' => $comments,
'total_comments' => $comments_count . ' ' . SStringHelper::Pluralize('0', array(lang('s_review_on'), lang('s_review_tw'), lang('s_review_tre'))),
'total_comments' => $comments_count . ' ' . $this->Pluralize($comments_count, array(lang('s_review_on'), lang('s_review_tw'), lang('s_review_tre'))),
'validation_errors' => $this->validation_errors
));
}
Expand All @@ -103,6 +103,8 @@ public function renderPosts() {
* if product - return id
*/
public function parsUrl($url) {
defined('DS') OR define('DS', '/');

if (strstr($url, '/product/')) {
$url = parse_url($url);
$search = array('shop', 'product', '/');
Expand All @@ -116,12 +118,11 @@ public function parsUrl($url) {
}

if (strstr($url, '/bloh/')) {
$url = parse_url($url);
$search = array('bloh', '/');
$replace = array('', '');
$url = str_replace($search, $replace, $url['path']);
$paths = explode(DS, $url);
$paths = $paths[count($paths)-1];

$id = $this->db->select('id')
->where('url', $url)
->where('url', $paths)
->get('content')
->row();
return $id->id;
Expand Down Expand Up @@ -151,12 +152,13 @@ public function newPost() {
$item_id = $this->parsUrl($_SERVER['HTTP_REFERER']);

// Check if page comments status.
if ($this->getModule($_SERVER['HTTP_REFERER']) == 'core') {
if ($this->base->get_item_comments_status($item_id) == FALSE) {
($hook = get_hook('comments_page_comments_disabled')) ? eval($hook) : NULL;
$this->core->error(lang('error_comments_diabled'));
}
}
// if ($this->getModule($_SERVER['HTTP_REFERER']) == 'core') {
// var_dump($item_id);
// if ($this->base->get_item_comments_status($item_id) == FALSE) {
// ($hook = get_hook('comments_page_comments_disabled')) ? eval($hook) : NULL;
// $this->core->error(lang('error_comments_diabled'));
// }
// }

if ($this->period > 0)
if ($this->check_comment_period() == FALSE) {
Expand Down Expand Up @@ -431,14 +433,30 @@ public function getTotalCommentsForProducts($ids, $status = 0) {
$result = array();

foreach ($query as $q)
$result[$q['item_id']] = $q['count'] . ' ' . SStringHelper::Pluralize((int) $q['count'], array(lang('s_review_on'), lang('s_review_tw'), lang('s_review_tre')));
$result[$q['item_id']] = $q['count'] . ' ' . $this->Pluralize((int) $q['count'], array(lang('s_review_on'), lang('s_review_tw'), lang('s_review_tre')));

foreach ((array) $ids as $id)
if (!$result[$id])
$result[$id] = 0 . ' ' . SStringHelper::Pluralize('0', array(lang('s_review_on'), lang('s_review_tw'), lang('s_review_tre')));
$result[$id] = 0 . ' ' . $this->Pluralize('0', array(lang('s_review_on'), lang('s_review_tw'), lang('s_review_tre')));

return $result;
}

public static function Pluralize($count = 0, array $words = array()) {
if (empty($words))
$words = array(' ', ' ', ' ');

$numeric = (int) abs($count);
if ($numeric % 100 == 1 || ($numeric % 100 > 20) && ( $numeric % 10 == 1 ))
return $words[0];
if ($numeric % 100 == 2 || ($numeric % 100 > 20) && ( $numeric % 10 == 2 ))
return $words[1];
if ($numeric % 100 == 3 || ($numeric % 100 > 20) && ( $numeric % 10 == 3 ))
return $words[1];
if ($numeric % 100 == 4 || ($numeric % 100 > 20) && ( $numeric % 10 == 4 ))
return $words[1];
return $words[2];
}

}

2 changes: 1 addition & 1 deletion templates/commerce/js/shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ $(document).ready(function() {

$('.findincats').live('click', function() {
var id = $(this).attr('data-id');
$('[name="categoryId"]').attr('value', id);
$('[name="category"]').attr('value', id);
$('#orderForm').submit();
});

Expand Down
51 changes: 5 additions & 46 deletions templates/commerce/main.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<script type="text/javascript" src="{$THEME}js/jquery.validate.js"></script>
<script type="text/javascript" src="{$THEME}js/imagecms.api.js"></script>
<script type="text/javascript" src="{$THEME}/js/jquery-ui-1.8.15.custom.min.js"></script>
<script type="text/javascript" src="{$THEME}js/autocomplete.js"></script>
{$renderGA}
</head>
<body>
Expand All @@ -47,52 +48,10 @@
</a>
{$CI->load->module('mailer')}
<div class="frame_form_search">
<form action="{shop_url('search')}" method="get" class="clearfix">
<!-- <input type="text" value="Поиск по сайту" name="text" />-->
<input type="text" size="30" name="text" value="{lang('s_search')} {lang('s_po')} {lang('s_site')}" onfocus="if (this.value == '{lang('s_search')} {lang('s_po')} {lang('s_site')}')
this.value = '';" onblur="if (this.value == '')
this.value = '{lang('s_search')} {lang('s_po')} {lang('s_site')}';" />
<input type="submit" class="submit" value="{lang('s_search')}" />
<div class="search_drop d_n">
<ul>
<li class="smallest_item">
<a href="#" class="photo_block">
<img src="{$THEME}/images/temp/small_img.jpg"/>
</a>
<div class="func_description">
<a href="#" class="title">Asus X54C (X54C-SX006D) Black</a>
<div class="buy">
<div class="price f-s_14">4528 <sub>грн.</sub><span>859 $</span></div>
</div>
</div>
</li>


<li class="smallest_item">
<a href="#" class="photo_block">
<img src="{$THEME}/images/temp/small_img.jpg"/>
</a>
<div class="func_description">
<a href="#" class="title">Asus X54C (X54C-SX006D) Black</a>
<div class="buy">
<div class="price f-s_14">4528 <sub>грн.</sub><span>859 $</span></div>
</div>
</div>
</li>
<li class="smallest_item">
<a href="#" class="photo_block">
<img src="{$THEME}/images/temp/small_img.jpg"/>
</a>
<div class="func_description">
<a href="#" class="title">Asus X54C (X54C-SX006D) Black</a>
<div class="buy">
<div class="price f-s_14">4528 <sub>грн.</sub><span>859 $</span></div>
</div>
</div>
</li>
</ul>
<a href="#" class="all_result">Показать все результаты</a>
</div>
<form name="search" class="clearfix" action="{shop_url('search')}" method="get" id="autocomlete">
<input type="text" name="text" value="{lang('s_se_thi_sit')}" onfocus="if(this.value=='{lang('s_se_thi_sit')}') this.value='';" onblur="if(this.value=='') this.value='{lang('s_se_thi_sit')}';" id="inputString" autocomplete="off" onkeyup="lookup(event);" class="place_hold"/>
<input type="submit" id="search_submit" value="{lang('s_search')}" class="icon"/>
<span id="suggestions" style="display: none; width: 0px; right: 0px;"></span>
</form>
</div>
<div class="phone">
Expand Down
38 changes: 19 additions & 19 deletions templates/commerce/shop/brand.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@
<div class="content">
<div class="center">
<div class="filter">
{if count($incats)>0}
{if count($categoriesInBrand)>0}
<form id="orderForm" method="get">
<input type="hidden" name="user_per_page" value="{echo $_GET['user_per_page']}"/>
<input type="hidden" name="order" value="{echo $_GET['order']}"/>
<input type="hidden" name="categoryId" />
<input type="hidden" name="category" />
<div class="title">{lang('s_found_in_categories')}</div>
<div class="padding_filter check_frame">
<ul class="menu_fiter">
{foreach $categories_names as $item}
{foreach $categoriesInBrand as $item}
<li>
{if ShopCore::$_GET['categoryId'] == $item.id}<b class="c_d">{$cat_name = $item.name}{/if}
<span class="{if ShopCore::$_GET['categoryId']!=$item.id}findincats{/if} js gray" data-id="{echo $item.id}">{$item.name} ({echo $incats[$item.id]})</span>
{if ShopCore::$_GET['categoryId'] == $item.id}</b>{/if}
</li>
{/foreach}
</ul>
</div>
{if ShopCore::$_GET['categoryId']}<a href="{site_url($CI->uri->uri_string())}"><span class="icon-reset"></span>{lang('s_cancel')}</a><br/>{/if}
</form>
{else:}
<div class="title padding_filter">В категориях ничего не найдено</div>
{/if}
</div>
{if ShopCore::$_GET['category'] == $item->category_id}<b class="c_d">{$cat_name = $item->name}{/if}
<span class="{if ShopCore::$_GET['category']!=$item->category_id}findincats{/if} js gray" data-id="{echo $item->category_id}">{echo $item->name} ({echo $item->countProducts})</span>
{if ShopCore::$_GET['category'] == $item->category_id}</b>{/if}
</li>
{/foreach}
</ul>
</div>
{if ShopCore::$_GET['category']}<a href="{site_url($CI->uri->uri_string())}"><span class="icon-reset"></span>{lang('s_cancel')}</a><br/>{/if}
</form>
{else:}
<div class="title padding_filter">В категориях ничего не найдено</div>
{/if}
</div>
<div class="catalog_content">
<!-- Right sidebar -->
<div class="nowelty_auction">
Expand Down Expand Up @@ -109,7 +109,7 @@
<div class="box_title clearfix">
<div class="f-s_24">
<h1 class="d_i">{echo ShopCore::encode($model->getName())}
{if ShopCore::$_GET['categoryId'] != ''}
{if ShopCore::$_GET['category'] != ''}
- {echo $cat_name}
{/if}</h1>
<span class="count_search">({$totalProducts})</span>
Expand Down Expand Up @@ -140,8 +140,8 @@
</select>
</div>
</div>
{if isset($_GET['categoryId'])}
<input type="hidden" name="categoryId" value="{echo $_GET['categoryId']}">
{if isset($_GET['category'])}
<input type="hidden" name="category" value="{echo $_GET['category']}">
{/if}
</form>
<ul>
Expand Down
8 changes: 4 additions & 4 deletions templates/commerce/shop/search.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
{$forCompareProducts = $CI->session->userdata('shopForCompare')}

<!-- BEGIN STAR RATING -->
<link rel="stylesheet" type="text/css" href="{$SHOP_THEME}js/rating/jquery.rating-min.css" />
<script src="{$SHOP_THEME}js/rating/jquery.rating-min.js" type="text/javascript"></script>
<script src="{$SHOP_THEME}js/rating/jquery.MetaData-min.js" type="text/javascript"></script>
<script src="{$SHOP_THEME}js/search.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="{$THEME}js/rating/jquery.rating-min.css" />
<script src="{$THEME}js/rating/jquery.rating-min.js" type="text/javascript"></script>
<script src="{$THEME}js/rating/jquery.MetaData-min.js" type="text/javascript"></script>
<script src="{$THEME}js/search.js" type="text/javascript"></script>
<!-- END STAR RATING -->
<!--
{include_tpl('sidebar')}
Expand Down
2 changes: 1 addition & 1 deletion templates/default/blog.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@

<div class="pagination" align="center">
{$pagination}
</div>
</div>
Loading

0 comments on commit f89f09b

Please sign in to comment.