Permalink
Browse files

Merge remote-tracking branch 'origin/features' into features

  • Loading branch information...
trk
trk committed Apr 7, 2012
2 parents 399e053 + 423fc38 commit 52a250b1c3d817b3b993e88713cc6189cc5504c3
@@ -418,23 +418,26 @@ function save_ordering()
function get_element_list()
{
// Elements
- $elements = $this->element_definition_model->get_lang_list(array('name <>' => '', 'order_by' => 'ordering ASC'), Settings::get_lang('default') );
+ $elements = $this->element_definition_model->get_lang_list(array('name <>' => '', 'order_by' => 'ordering ASC'), Settings::get_lang() );
$this->template['elements'] = '';
foreach($elements as $key => &$element)
{
// Element's fields
+ // $element['fields'] = $this->element_model->get_fields_from_parent($parent, $id_parent, Settings::get_lang(), $element['id_element_definition'])
$element['fields'] = $this->extend_field_model->get_list(array('id_element_definition' => $element['id_element_definition']));
-
+ // trace($element['fields']);
foreach($element['fields'] as &$field)
{
+ // trace($field);
$field['type_name'] = self::$type_names[$field['type']];
+ $field['label'] = $this->extend_field_model->get_label($field['id_extend_field']);
}
if (count($element['fields']) == 0)
unset($elements[$key]);
}
-
+ // trace($elements);
$data['elements'] = $elements;
$data['parent'] = $this->input->post('parent');
$data['id_parent'] = $this->input->post('id_parent');
@@ -250,6 +250,89 @@ function get_active_pages($pages, $id_page)
* Uses the lib : http://signalkraft.com/sitemaps-for-codeigniter
*
*/
+ // Edited by ukyo. Original function commented under this function!
+ function build_sitemap()
+ {
+ $ci =& get_instance();
+
+ $ci->load->library('sitemaps');
+ $ci->load->model('sitemap_model', '', TRUE);
+
+ $langs = Settings::get_online_languages();
+
+ if (count($langs) > 1 OR Settings::get('force_lang_urls') == '1') {
+
+ // Get pages
+ $pages = array();
+
+ foreach($langs as $lang)
+ {
+ $pages[$lang['lang']] = $ci->sitemap_model->get_pages($lang['lang']);
+ }
+
+ foreach($langs as $lang)
+ {
+ // Prepare pages :
+ foreach($pages[$lang['lang']] as &$p)
+ {
+ $p['date'] = $p['created'];
+ if (strtotime($p['updated']) > strtotime($p['date'])) $p['date'] = $p['updated'];
+ if (strtotime($p['publish_on']) > strtotime($p['date'])) $p['date'] = $p['publish_on'];
+ if (strtotime($p['logical_date']) > strtotime($p['date'])) $p['date'] = $p['logical_date'];
+ }
+ }
+
+ foreach($langs as $lang)
+ {
+ $code = $lang['lang'];
+
+ foreach($pages[$code] as $page)
+ {
+ $item = array(
+ 'loc' => base_url().$code.'/' . $page['url'],
+ // ISO 8601 format - date("c") requires PHP5
+ 'lastmod' => date("c", strtotime($page['date'])),
+ 'changefreq' => 'weekly',
+ 'priority' => ($page['priority'] / 10)
+ );
+
+ $ci->sitemaps->add_item($item);
+ }
+ }
+ }
+ // No lang in URLs
+ else
+ {
+ // Get pages
+ $pages = $ci->sitemap_model->get_pages();
+
+ // Prepare pages :
+ //
+ foreach($pages as &$p)
+ {
+ $p['date'] = $p['created'];
+ if (strtotime($p['updated']) > strtotime($p['date'])) $p['date'] = $p['updated'];
+ if (strtotime($p['publish_on']) > strtotime($p['date'])) $p['date'] = $p['publish_on'];
+ if (strtotime($p['logical_date']) > strtotime($p['date'])) $p['date'] = $p['logical_date'];
+ }
+
+ foreach($pages as $page)
+ {
+ $item = array(
+ 'loc' => base_url().$page['url'],
+ // ISO 8601 format - date("c") requires PHP5
+ 'lastmod' => date("c", strtotime($page['date'])),
+ 'changefreq' => 'weekly',
+ 'priority' => ($page['priority'] / 10)
+ );
+
+ $ci->sitemaps->add_item($item);
+ }
+ }
+
+ $file_name = $ci->sitemaps->build('sitemap.xml');
+ }
+ /**
function build_sitemap()
{
$ci =& get_instance();
@@ -313,7 +396,7 @@ function build_sitemap()
$file_name = $ci->sitemaps->build('sitemap.xml');
}
-
+ **/
}
@@ -251,7 +251,7 @@ public static function tag_element_fields_attribute($tag)
}
// Translated Element
- if ($field['translated'] == '1')
+ if ($field['translated'] == '1' && $attr != 'label')
{
if (isset($field[Settings::get_lang('current')]['content']))
{
@@ -56,7 +56,21 @@ function get_lang_list($where = array(), $lang)
return parent::get_lang_list($where, $lang);
}
-
+ function get_label($id_extend_field){
+ if($id_extend_field != '') {
+ $this->db->select($this->lang_table . '.label');
+ $this->db->from($this->table);
+ $this->db->join($this->lang_table, $this->table . '.' . $this->pk_name . ' = ' . $this->lang_table . '.' . $this->pk_name, 'inner');
+ $this->db->where($this->lang_table . '.lang', Settings::get_lang());
+ $this->db->where($this->table . '.' . $this->pk_name, $id_extend_field);
+
+ $label = $this->db->get();
+ $label = $label->row_array();
+
+ return (!empty($label['label'])) ? $label['label'] : '';
+ }
+ return 'Need a "$id_extend_field"';
+ }
// ------------------------------------------------------------------------
@@ -42,7 +42,7 @@ public function __construct()
}
- public function get_pages()
+ public function get_pages($lang = FALSE)
{
$data = array();
@@ -56,6 +56,9 @@ public function get_pages()
'page_lang.online' =>'1'
));
+ // Added by ukyo : For lang support xml output!
+ (!empty($lang)) ? $this->{$this->db_group}->where(array('page_lang.lang' => $lang)) : '';
+
$this->{$this->db_group}->join('page_lang', 'page.id_page = page_lang.id_page');
$query = $this->{$this->db_group}->get('page');
@@ -32,6 +32,6 @@
*/
$$('#rssPageList li .unlink').each(function(item)
{
- ION.initRequestEvent(item, '<?php echo base_url() ?>admin/module/rss/rss/remove_page', {'id_page': item.getProperty('rel')});
+ ION.initRequestEvent(item, '<?php echo admin_url() ?>module/rss/rss/remove_page', {'id_page': item.getProperty('rel')});
});
</script>
@@ -50,7 +50,7 @@
$lang['module_simpleform_field_email'] = "Email";
$lang['module_simpleform_field_name'] = "Name";
-$lang['module_simpleform_field_firstname'] = "Surname";
+$lang['module_simpleform_field_firstname'] = "First name";
$lang['module_simpleform_field_lastname'] = "Last name";
$lang['module_simpleform_field_username'] = "Username";
$lang['module_simpleform_field_password'] = "Password";
@@ -17,7 +17,6 @@
$width = (100 / $nbLang);
?>
-
<ul id="elements<?= $id_def ?>" class="sortable-container">
<?php foreach($elements as $element) :?>
@@ -39,15 +38,16 @@
<li class="sortme element element<?= $id_element ?>" id="element<?= $id_element ?>" rel="<?= $id_element ?>">
<a class="icon delete right absolute mr10" rel="<?= $id_element ?>"></a>
+ <a class="icon edit right absolute mr30" rel="<?= $id_element ?>"></a>
<img class="icon drag left absolute" src="<?= theme_url() ?>images/icon_16_ordering.png" />
<div style="position:absolute;top:3px;left:40px;font-size:20px;color:#ddd;"><?= $element['ordering'] ?></div>
<div style="overflow:hidden;clear:both;" class="ml20 mr20">
<?php if(count($element['fields']) > 1) :?>
- <span class="toggler right mr10" style="display:block;height:16px;" rel="<?= $id_element ?>">
- <a class="left" rel="<?= $id_element ?>"><?= lang('ionize_label_see_element_detail') ?></a>
- </span>
+ <span class="toggler right mr40" style="display:block; height:16px;" rel="<?= $id_element ?>">
+ <a class="left" rel="<?= $id_element ?>"><?= lang('ionize_label_see_element_detail') ?></a>
+ </span>
<?php endif ;?>
<?php foreach($element['fields'] as $field) :?>
@@ -388,7 +388,7 @@
<?php endif ;?>
// Edit on each element
- $$('#elements<?= $id_def ?> li.element a.title').each(function(item)
+ $$('#elements<?= $id_def ?> li.element a.title, #elements<?= $id_def ?> li.element a.edit').each(function(item)
{
item.addEvent('click', function(e)
{

0 comments on commit 52a250b

Please sign in to comment.