예제 #1
0
function language_select_list($module, $id, $current_language, $translated_languages)
{
    $mobile_version = c2cTools::mobileVersion();
    $items = array();
    foreach (Language::getAll() as $language => $value) {
        $lang = format_language_c2c($language);
        if ($current_language == $language) {
            $items[] = '<div class="current_lang">' . ($mobile_version ? $language : $lang) . '</div>';
        } else {
            $existing_lang = in_array($language, $translated_languages);
            $options = $existing_lang ? array('class' => 'translated') : array('class' => 'not_translated', 'rel' => 'nofollow');
            if (!$mobile_version) {
                $items[] = link_to($lang, "@document_by_id_lang?module={$module}&id={$id}&lang={$language}", $options);
            } else {
                $items[] = $existing_lang ? link_to($language, "@document_by_id_lang?module={$module}&id={$id}&lang={$language}", $options) : '<span class="not_translated">' . $language . '</span>';
            }
        }
    }
    return implode(' |&nbsp;', $items);
}
예제 #2
0
    }
    if (isset($associated_books)) {
        $i18n_args['associated_books'] = $associated_books;
        $i18n_args['main_id'] = $document->get('id');
    }
    if (isset($associated_areas)) {
        $i18n_args['associated_areas'] = $associated_areas;
    }
    if (isset($associated_routes)) {
        $i18n_args['associated_routes'] = $associated_routes;
    }
    if (!isset($ids)) {
        $ids = $document->get('id');
    }
    $i18n_args['ids'] = $ids;
    include_partial('i18n', $i18n_args);
    ?>
    </div>
    
<?php 
} else {
    ?>
    <p class="separator">
    <?php 
    // do not let google index this page, but let it follow the links
    $response = sfContext::getInstance()->getResponse()->addMeta('robots', 'noindex, follow');
    echo __('This document is not available in %1%', array('%1%' => format_language_c2c($document->getCulture()))) . ' ' . link_to(__('Create it!'), "@document_edit?module={$module}&id=" . $document->get('id') . '&lang=' . $document->getCulture());
    ?>
    </p>
<?php 
}
예제 #3
0
<?php

use_helper('Object', 'Language');
?>

<?php 
echo start_group_tag();
?>
  <?php 
echo label_tag('culture', 'lang');
?>
  <?php 
if ($new_document) {
    echo select_language_c2c_tag();
} else {
    echo format_language_c2c($document->getCulture()) . '&nbsp;(' . link_to(__('choose an other language'), '@document_by_id_lang?module=' . $sf_context->getModuleName() . '&id=' . $sf_params->get('id') . '&lang=' . $sf_params->get('lang')) . ')' . '<input type="text" name="culture" id="culture" style="display: none;"/>';
    // last line is useful to prevent an XHTML validation error (lacking 'culture' id field).
}
?>
  
<?php 
echo end_group_tag();
예제 #4
0
$is_moderator = $sf_user->hasCredential(sfConfig::get('app_credentials_moderator'));
$module = $sf_context->getModuleName();
$model = c2cTools::module2model($module);
$i18n_archive = $model . 'I18nArchive';
$lang = $sf_params->get('lang');
$id = $sf_params->get('id');
$table_list_even_odd = 0;
$slug = make_slug($document[$i18n_archive]['name']);
echo display_title(isset($title_prefix) ? $title_prefix . __('&nbsp;:') . ' ' . $document_name : $document_name, $module);
echo '<div id="nav_space">&nbsp;</div>';
echo tabs_list_tag($id, $lang, $exists_in_lang, 'history', null, $slug, $nb_comments);
echo display_content_top('doc_content');
echo start_content_tag($module . '_content');
?>
<p><?php 
echo __('Viewing history from %1% in %2%', array('%1%' => $document_name, '%2%' => format_language_c2c($lang)));
?>
</p>

<p><?php 
echo __('Legend:') . ' * = ' . __('current version') . ', <strong>' . __('minor_tag') . '</strong> = ' . __('minor modification');
?>
</p>

<?php 
echo form_tag("@document_diff_post?module={$module}&id={$id}&lang={$lang}", array('method' => 'post'));
$versions_nb = count($versions);
$submit_options = array('title' => __('Show differences between selected versions'), 'value' => __('Compare'), 'picto' => 'action_filter', 'class' => 'c2cui_btnr single_button');
?>

<p><?php 
echo customization_nav('langpref');
?>

<div id="customize" class="form-row">
<?php 
echo fieldset_tag('Favorite language:');
?>
    <ol id="languages-order">
        <?php 
foreach ($sf_user->getPreferedLanguageList() as $language_code) {
    ?>
          <li id="<?php 
    echo "lang_" . $language_code;
    ?>
"><?php 
    echo format_language_c2c($language_code);
    ?>
</li>
        <?php 
}
?>
    </ol>
<?php 
echo end_fieldset_tag();
echo __('Reorder these languages according to your preferences, using drag-and-drop');
// html5sortable is fine for desktop version, but it has no supprot for touch. It is very small and
// follows the same api as jquery sortable
// on the other hand, slip.js has touch support, but is a bit bigger
// We don't show js feedback on mobile version (would be janky)
if (c2cTools::mobileVersion()) {
    echo javascript_queue("\$.ajax({\n  url: '" . minify_get_combined_files_url('/static/js/slip.js') . "',\n  dataType: 'script',\n  cache: true })\n.done(function() {\n  var ol = document.getElementById('languages-order');\n  ol.addEventListener('slip:beforeswipe', function(e) {\n    e.preventDefault();\n  }, false);\n  ol.addEventListener('slip:beforewait', function(e) {\n    e.preventDefault();\n  }, false);\n  ol.addEventListener('slip:reorder', function(e) {\n    e.target.parentNode.insertBefore(e.target, e.detail.insertBefore);\n    \$.post('" . url_for('users/sortPreferedLanguages') . "',\n                \$('#languages-order li').map(function() { return 'order[]=' + this.id.match(/^lang_(.*)\$/)[1]; }).get().join('&'));\n    return false;\n  }, false);\n  new Slip(ol);\n});");
예제 #6
0
$version = $new_document->getVersion() != $current_version ? $new_document->getVersion() : NULL;
$id = $sf_params->get('id');
$lang = $sf_params->get('lang');
$module = $sf_context->getModuleName();
$mobile_version = c2cTools::mobileVersion();
echo display_title(isset($title_prefix) ? $title_prefix . __('&nbsp;:') . ' ' . $new_document->get('name') : $new_document->get('name'), $module);
if (!$mobile_version) {
    echo '<div id="nav_space">&nbsp;</div>';
    echo tabs_list_tag($id, $lang, 1, 'history', null, get_slug($new_document), $nb_comments);
}
echo display_content_top('doc_content');
echo start_content_tag($module . '_content');
?>
<p>
<?php 
echo __('Diffing versions of %1% in %2%.', array('%1%' => isset($title_prefix) ? $title_prefix . __('&nbsp;:') . ' ' . $new_document->get('name') : $new_document->get('name'), '%2%' => format_language_c2c($new_document->getCulture())));
echo ' <strong>' . __('minor_tag') . '</strong> = ' . __('minor modification');
?>
</p>

<?php 
$documents = array('old' => $old_document, 'new' => $new_document);
$metadatas = array('old' => $old_metadata, 'new' => $new_metadata);
?>

<table class="diff_metas">
  <tr>
  <?php 
foreach ($documents as $rank => $document) {
    ?>
    <?php 
예제 #7
0
<?php

use_helper('Date', 'Language', 'SmartFormat', 'sfBBCode');
//$id = $document->getId();
$module = $sf_context->getModuleName();
?>

<p class="important_message">
<?php 
echo __('Warning: archived version:') . ' ' . __('version %1%', array('%1%' => $document->getVersion())) . ' (' . format_language_c2c($document->getCulture()) . ')' . ' - ' . format_datetime($metadata->get('written_at')) . ' ' . __('by') . ' ' . link_to($metadata->get('user_private_data')->get('topo_name'), '@document_by_id?module=users&id=' . $metadata->get('user_id'));
?>
<br />
<?php 
if ($metadata->get('is_minor')) {
    $change_comment = '<strong>' . __('minor modification') . '</strong>';
} else {
    $change_comment = '';
}
if (trim($metadata->get('comment'))) {
    if (!$metadata->get('is_minor')) {
        $change_comment = '<strong>' . __('modification') . '</strong>';
    }
    $change_comment .= __(' :') . ' ' . parse_bbcode_simple(smart_format(__($metadata->get('comment'))));
}
echo $change_comment;
?>
<br />
    <?php 
if ($document->getVersion() > 1) {
    echo link_to('&laquo; ' . __('version %1%', array('%1%' => $document->getVersion() - 1)), "@document_by_id_lang_version?module={$module}&id=" . $id . '&version=' . ($document->getVersion() - 1) . '&lang=' . $document->getCulture());
    echo ' | ';