Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -r7391 -r7635 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 7391) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 7635) @@ -105,7 +105,12 @@ $block_params['label'] = addslashes( $this->Application->Phrase($filter_params['label']) ); if (getArrayValue($view_filter,$filter_key)) { $submit = 0; - $status = $group_params['element_type'] == 'checkbox' ? '[\'img/check_on.gif\']' : '[\'img/menu_dot.gif\']'; + if ($params['old_style']) { + $status = $group_params['element_type'] == 'checkbox' ? 1 : 2; + } + else { + $status = $group_params['element_type'] == 'checkbox' ? '[\'img/check_on.gif\']' : '[\'img/menu_dot.gif\']'; + } } else { $submit = 1; @@ -380,6 +385,9 @@ $column_number++; } + $block_params['first_col'] = $column_number == 1 ? 1 : 0; + $block_params['last_col'] = $column_number == $columns ? 1 : 0; + $block_params['column_number'] = $column_number; $o.= $this->Application->ParseBlock($block_params, 1); array_push($displayed, $list->GetDBField($id_field)); @@ -451,18 +459,18 @@ function PageLink($params) { $t = isset($params['template']) ? $param['template'] : ''; + unset($params['template']); + if (!$t) $t = $this->Application->GetVar('t'); if (isset($params['page'])) { $this->Application->SetVar($this->getPrefixSpecial().'_Page', $params['page']); + unset($params['page']); } -// $http_query =& $this->Application->recallObject('HTTPQuery'); -// $get = $http_query->getRedirectParams(); - $pass = Array('pass' => 'm,'.$this->getPrefixSpecial()); -// $pass = array_merge($get, $pass); + $params['pass'] = 'm,'.$this->getPrefixSpecial(); - return $this->Application->HREF($t, '', $pass); + return $this->Application->HREF($t, '', $params); } function ColumnWidth($params) @@ -823,6 +831,50 @@ } /** + * Returns grid padination information + * Can return links to pages + * + * @param Array $params + * @return mixed + */ + function PageInfo($params) + { + $object =& $this->GetList($params); + /* @var $object kDBList */ + + $type = $params['type']; + unset($params['type']); // remove parameters used only by current tag + + switch ($type) { + case 'current': + $ret = $object->Page; + break; + + case 'total': + $ret = $object->GetTotalPages(); + break; + + case 'prev': + $ret = $object->Page > 1 ? $object->Page - 1 : false; + break; + + case 'next': + $ret = $object->Page < $object->GetTotalPages() ? $object->Page + 1 : false; + break; + } + + if ($ret && isset($params['as_link']) && $params['as_link']) { + unset($params['as_link']); // remove parameters used only by current tag + $params['page'] = $ret; + $current_page = $object->Page; // backup current page + $ret = $this->PageLink($params); + $this->Application->SetVar($object->getPrefixSpecial().'_Page', $current_page); // restore page + } + + return $ret; + } + + /** * Print grid pagination using * block names specified * @@ -1268,7 +1320,12 @@ { $new_value = $this->getInfo( $objects[ $prefix_data['prefix_special'] ], 'titlefield' ); if(!$new_value && getArrayValue($title_info['new_titlefield'],$prefix_data['prefix_special']) ) $new_value = $this->Application->Phrase($title_info['new_titlefield'][ $prefix_data['prefix_special'] ]); - $title = str_replace('#'.$prefix_data['prefix_special'].'_titlefield#', $new_value, $title); + // old format had single quotes in the format + $title = str_replace('\'#'.$prefix_data['prefix_special'].'_titlefield#\'', "'$new_value'", $title); + // new format has no quotes and $new_value should be empty when creating items + if ($new_value) { + $title = str_replace('#'.$prefix_data['prefix_special'].'_titlefield#', "'$new_value'", $title); + } } } } @@ -1286,7 +1343,13 @@ $var_info = explode('_',$replacement_var,2); $object =& $objects[ $var_info[0] ]; $new_value = $this->getInfo($object,$var_info[1]); - $title = str_replace('#'.$replacement_var.'#', $new_value, $title); + $title = str_replace('\'#'.$replacement_var.'#\'', "'$new_value'", $title); + if ($new_value) { + $title = str_replace('#'.$replacement_var.'#', "'$new_value'", $title); + } + else { + $title = str_replace('#'.$replacement_var.'#', $new_value, $title); + } } } @@ -1317,7 +1380,7 @@ } function GridInfo($params) { - $object =& $this->getObject($params); + $object =& $this->GetList($params); /* @var $object kDBList */ switch ($params['type']) { @@ -1329,6 +1392,10 @@ return $object->RecordsCount ? $object->Offset+1 : 0; //0-based case 'to': return min($object->Offset + $object->PerPage, $object->RecordsCount); + case 'total_pages': + return ceil($object->RecordsCount / $object->PerPage); + case 'needs_pagination': + return $object->RecordsCount > $object->PerPage; } } @@ -1689,7 +1756,7 @@ { if ($this->Special == 'import') { $this->Application->StoreVar('PermCache_UpdateRequired', 1); - $this->Application->Redirect('categories/cache_updater', Array('m_opener' => 'r', 'pass' => 'm', 'continue' => 1, 'no_amp' => 1)); + $this->Application->Redirect('in-portal/categories/cache_updater', Array('m_opener' => 'r', 'pass' => 'm', 'continue' => 1, 'no_amp' => 1)); } elseif ($this->Special == 'export') { $finish_t = $this->Application->RecallVar('export_finish_t'); @@ -1735,6 +1802,11 @@ $value = $this->Field($params); $name = $this->InputName($params); + $theme_path = $this->Application->BaseURL().substr($this->Application->GetFrontThemePath(), 1); + + $bgcolor = $this->Application->GetVar('bgcolor'); + if (!$bgcolor) $bgcolor = '#ffffff'; + include_once(FULL_PATH.'/core/cmseditor/fckeditor.php'); $oFCKeditor = new FCKeditor($name); $oFCKeditor->BasePath = BASE_PATH.'/core/cmseditor/'; @@ -1747,14 +1819,38 @@ 'ProjectPath' => BASE_PATH.'/', 'CustomConfigurationsPath' => $this->Application->BaseURL().'core/admin_templates/js/inp_fckconfig.js', // 'EditorAreaCSS' => $this->Application->BaseURL().'/themes/inportal_site/inc/inportal.css', //GetThemeCSS(), - 'StylesXmlPath' => $this->Application->BaseURL().'core/admin_templates/js/inp_styles.xml', + 'StylesXmlPath' => $theme_path.'/inc/styles.xml', + 'EditorAreaCSS' => $theme_path.'/inc/style.css', + 'DefaultClass' => 'Default Text', // 'Debug' => 1, 'Admin' => 1, 'K4' => 1, + 'newBgColor' => $bgcolor, ); return $oFCKeditor->CreateHtml(); } + function IsNewItem($params) + { + $object =& $this->getObject($params); + return $object->IsNewItem(); + } + + /** + * Creates link to an item including only it's id + * + * @param Array $params + * @return string + */ + function ItemLink($params) + { + $object =& $this->getObject($params); + + $params['pass'] = 'm'; + $params[$object->getPrefixSpecial().'_id'] = $object->GetID(); + + return $this->Application->ProcessParsedTag('m', 't', $params); + } } ?> \ No newline at end of file