Compare commits
15
Commits
7.53
...
translators
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83cbcefff9 | ||
|
|
0d940c99db | ||
|
|
2334eb741b | ||
|
|
ddc28956c4 | ||
|
|
abbcb19838 | ||
|
|
024afdfd3d | ||
|
|
b9f2b16d24 | ||
|
|
3f9ba49255 | ||
|
|
7563311a19 | ||
|
|
669341f1d6 | ||
|
|
e24eec56e7 | ||
|
|
eba58a57bf | ||
|
|
e190f5f47d | ||
|
|
ec6f23e149 | ||
|
|
fdd842fe19 |
@@ -2356,14 +2356,26 @@ function user_external_login_register($name, $module) {
|
||||
* following properties:
|
||||
* - uid: The user ID number.
|
||||
* - login: The UNIX timestamp of the user's last login.
|
||||
* @param array $options
|
||||
* (optional) A keyed array of settings. Supported options are:
|
||||
* - langcode: A language code to be used when generating locale-sensitive
|
||||
* urls. If langcode is NULL the users preferred language is used.
|
||||
*
|
||||
* @return
|
||||
* A unique URL that provides a one-time log in for the user, from which
|
||||
* they can change their password.
|
||||
*/
|
||||
function user_pass_reset_url($account) {
|
||||
function user_pass_reset_url($account, $options = array()) {
|
||||
$timestamp = REQUEST_TIME;
|
||||
return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), array('absolute' => TRUE));
|
||||
$url_options = array('absolute' => TRUE);
|
||||
if (isset($options['langcode'])) {
|
||||
$languages = language_list();
|
||||
$url_options['language'] = $languages[$options['langcode']];
|
||||
}
|
||||
else {
|
||||
$url_options['language'] = user_preferred_language($account);
|
||||
}
|
||||
return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), $url_options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2375,6 +2387,10 @@ function user_pass_reset_url($account) {
|
||||
* - uid: The user ID number.
|
||||
* - pass: The hashed user password string.
|
||||
* - login: The UNIX timestamp of the user's last login.
|
||||
* @param array $options
|
||||
* (optional) A keyed array of settings. Supported options are:
|
||||
* - langcode: A language code to be used when generating locale-sensitive
|
||||
* urls. If langcode is NULL the users preferred language is used.
|
||||
*
|
||||
* @return
|
||||
* A unique URL that may be used to confirm the cancellation of the user
|
||||
@@ -2383,9 +2399,17 @@ function user_pass_reset_url($account) {
|
||||
* @see user_mail_tokens()
|
||||
* @see user_cancel_confirm()
|
||||
*/
|
||||
function user_cancel_url($account) {
|
||||
function user_cancel_url($account, $options = array()) {
|
||||
$timestamp = REQUEST_TIME;
|
||||
return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), array('absolute' => TRUE));
|
||||
$url_options = array('absolute' => TRUE);
|
||||
if (isset($options['langcode'])) {
|
||||
$languages = language_list();
|
||||
$url_options['language'] = $languages[$options['langcode']];
|
||||
}
|
||||
else {
|
||||
$url_options['language'] = user_preferred_language($account);
|
||||
}
|
||||
return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), $url_options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2875,7 +2899,7 @@ Your account on [site:name] has been canceled.
|
||||
if ($replace) {
|
||||
// We do not sanitize the token replacement, since the output of this
|
||||
// replacement is intended for an e-mail message, not a web browser.
|
||||
return token_replace($text, $variables, array('language' => $language, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
return token_replace($text, $variables, array('language' => $language, 'langcode' => $langcode, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
}
|
||||
|
||||
return $text;
|
||||
@@ -2902,8 +2926,8 @@ Your account on [site:name] has been canceled.
|
||||
*/
|
||||
function user_mail_tokens(&$replacements, $data, $options) {
|
||||
if (isset($data['user'])) {
|
||||
$replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user']);
|
||||
$replacements['[user:cancel-url]'] = user_cancel_url($data['user']);
|
||||
$replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user'], $options);
|
||||
$replacements['[user:cancel-url]'] = user_cancel_url($data['user'], $options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2258,6 +2258,26 @@ class UserTokenReplaceTestCase extends DrupalWebTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp('locale');
|
||||
|
||||
$account = $this->drupalCreateUser(array('access administration pages', 'administer languages'));
|
||||
$this->drupalLogin($account);
|
||||
|
||||
// Add language.
|
||||
$edit = array('langcode' => 'de');
|
||||
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
|
||||
|
||||
// Enable URL language detection and selection.
|
||||
$edit = array('language[enabled][locale-url]' => 1);
|
||||
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
|
||||
|
||||
// Reset static caching.
|
||||
drupal_static_reset('language_list');
|
||||
drupal_static_reset('locale_url_outbound_alter');
|
||||
drupal_static_reset('locale_language_url_rewrite_url');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a user, then tests the tokens generated from it.
|
||||
*/
|
||||
@@ -2308,6 +2328,39 @@ class UserTokenReplaceTestCase extends DrupalWebTestCase {
|
||||
$output = token_replace($input, array('user' => $account), array('language' => $language, 'sanitize' => FALSE));
|
||||
$this->assertEqual($output, $expected, format_string('Unsanitized user token %token replaced.', array('%token' => $input)));
|
||||
}
|
||||
|
||||
$languages = language_list();
|
||||
|
||||
// Generate login and cancel link.
|
||||
$tests = array();
|
||||
$tests['[user:one-time-login-url]'] = user_pass_reset_url($account);
|
||||
$tests['[user:cancel-url]'] = user_cancel_url($account);
|
||||
|
||||
// Generate tokens with interface language.
|
||||
$link = url('user', array('absolute' => TRUE));
|
||||
foreach ($tests as $input => $expected) {
|
||||
$output = token_replace($input, array('user' => $account), array('langcode' => $language->language, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
$this->assertTrue(strpos($output, $link) === 0, 'Generated URL is in interface language.');
|
||||
}
|
||||
|
||||
// Generate tokens with the user's preferred language.
|
||||
$edit['language'] = 'de';
|
||||
$account = user_save($account, $edit);
|
||||
$link = url('user', array('language' => $languages[$account->language], 'absolute' => TRUE));
|
||||
foreach ($tests as $input => $expected) {
|
||||
$output = token_replace($input, array('user' => $account), array('callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
$this->assertTrue(strpos($output, $link) === 0, "Generated URL is in the user's preferred language.");
|
||||
}
|
||||
|
||||
// Generate tokens with one specific language.
|
||||
$link = url('user', array('language' => $languages['de'], 'absolute' => TRUE));
|
||||
foreach ($tests as $input => $expected) {
|
||||
foreach (array($user1, $user2) as $account) {
|
||||
$output = token_replace($input, array('user' => $account), array('langcode' => 'de', 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
$this->assertTrue(strpos($output, $link) === 0, "Generated URL in in the requested language.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,13 @@ function elysia_cron_drush_die() {
|
||||
/**
|
||||
* Wrapper for drush_invoke().
|
||||
*/
|
||||
function elysia_cron_drush_invoke($replace_core_cron = FALSE) {
|
||||
function elysia_cron_drush_invoke() {
|
||||
$args = drush_get_arguments();
|
||||
array_shift($args);
|
||||
|
||||
// If invoked like 'core-cron' I do the same as that: execute 'run'.
|
||||
if ($replace_core_cron && empty($args)) {
|
||||
// If drush command has no arguments or the first argument is not in the
|
||||
// list of allowed operations then we assume the cron execution.
|
||||
if (empty($args) || !in_array($args[0], array('list', 'run', 'enable', 'disable'))) {
|
||||
$args = array('run');
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ core = 7.x
|
||||
|
||||
configure = admin/config/system/cron
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-10-10
|
||||
version = "7.x-2.3"
|
||||
; Information added by Drupal.org packaging script on 2016-11-23
|
||||
version = "7.x-2.4"
|
||||
core = "7.x"
|
||||
project = "elysia_cron"
|
||||
datestamp = "1476088169"
|
||||
datestamp = "1479877741"
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ function elysia_cron_permission() {
|
||||
'administer elysia_cron' => array(
|
||||
'title' => t('Administer elysia cron'),
|
||||
'description' => t('Perform changes to cron jobs timings, disable cron or single jobs and access cron execution statistics'),
|
||||
'restrict access' => TRUE,
|
||||
),
|
||||
'execute elysia_cron' => array(
|
||||
'title' => t('Execute elysia cron jobs'),
|
||||
@@ -142,9 +143,11 @@ function elysia_cron_exit() {
|
||||
function elysia_cron_cron() {
|
||||
global $_elysia_cron_exit_phase, $_elysia_cron_drush;
|
||||
|
||||
// If invoked "core-cron" via drush i'll redirect to elysia-cron handler.
|
||||
// If cron has been executed via "drush core-cron" or any other custom drush
|
||||
// command then we run internal cron handler which is designed to handle
|
||||
// cron executions from drush.
|
||||
if (function_exists('elysia_cron_drush_detect') && elysia_cron_drush_detect()) {
|
||||
elysia_cron_drush_invoke(TRUE);
|
||||
elysia_cron_drush_invoke();
|
||||
}
|
||||
|
||||
// First cron run is executed in standard drupal way.
|
||||
@@ -1039,8 +1042,8 @@ function elysia_cron_module_jobs() {
|
||||
|
||||
$jobs[$job] = $jobs[$job] + array(
|
||||
'module' => $module,
|
||||
'callback' => is_callable($job) ? $job : $function,
|
||||
'arguments' => is_callable($job) ? array() : array('execute', $job),
|
||||
'callback' => $job,
|
||||
'arguments' => array(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1445,8 +1448,11 @@ function elysia_cron_internal_execute_job($job) {
|
||||
|
||||
try {
|
||||
if (!empty($_elysia_cron_settings[$job]['file'])) {
|
||||
include_once((!empty($_elysia_cron_settings[$job]['file path']) ? $_elysia_cron_settings[$job]['file path'] : drupal_get_path('module', $_elysia_cron_settings[$job]['module'])) . DIRECTORY_SEPARATOR . $_elysia_cron_settings[$job]['file']);
|
||||
$file_path = !empty($_elysia_cron_settings[$job]['file path']) ? $_elysia_cron_settings[$job]['file path'] : drupal_get_path('module', $_elysia_cron_settings[$job]['module']);
|
||||
$file_path .= DIRECTORY_SEPARATOR . $_elysia_cron_settings[$job]['file'];
|
||||
include_once $file_path;
|
||||
}
|
||||
|
||||
if (!empty($_elysia_cron_settings[$job]['expression'])) {
|
||||
eval($_elysia_cron_settings[$job]['expression']);
|
||||
}
|
||||
@@ -1454,7 +1460,15 @@ function elysia_cron_internal_execute_job($job) {
|
||||
call_user_func_array($_elysia_cron_settings[$job]['callback'], $_elysia_cron_settings[$job]['arguments']);
|
||||
}
|
||||
else {
|
||||
elysia_cron_error('Execution of ' . $job . ' failed, can\'t find function!', array(), TRUE);
|
||||
$function = $_elysia_cron_settings[$job]['module'] . '_cronapi';
|
||||
$arguments = array('execute', $job);
|
||||
|
||||
if (is_callable($function)) {
|
||||
call_user_func_array($function, $arguments);
|
||||
}
|
||||
else {
|
||||
elysia_cron_error('Execution of ' . $job . ' failed, can\'t find function!', array(), TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
|
||||
@@ -8,9 +8,9 @@ core = 7.x
|
||||
files[] = views_send.rules.inc
|
||||
files[] = views/views_send_handler_field_selector.inc
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-03-29
|
||||
version = "7.x-1.2"
|
||||
; Information added by Drupal.org packaging script on 2016-11-09
|
||||
version = "7.x-1.3"
|
||||
core = "7.x"
|
||||
project = "views_send"
|
||||
datestamp = "1459239847"
|
||||
datestamp = "1478685242"
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ function views_send_confirm_form($form, &$form_state, $view, $output) {
|
||||
'#type' => 'item',
|
||||
'#title' => t('From'),
|
||||
'#markup' => '<div class="views-send-preview-value">' .
|
||||
(empty($from_name) ? $from_mail : $from_name . check_plain(' <' . $from_mail . '>')) .
|
||||
check_plain(_views_send_format_address($from_mail, $from_name, FALSE)) .
|
||||
'</div>',
|
||||
);
|
||||
|
||||
@@ -517,7 +517,7 @@ function views_send_confirm_form($form, &$form_state, $view, $output) {
|
||||
}
|
||||
$mail_addresses = _views_send_get_field_value_from_views_row($view, $row_id, $to_mail_field, 'mail');
|
||||
foreach ($mail_addresses as $mail_address) {
|
||||
$recipients[] = check_plain(empty($to_name) ? $mail_address : trim($to_name) . ' <' . $mail_address . '>');
|
||||
$recipients[] = check_plain(_views_send_format_address($mail_address, $to_name, FALSE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ function views_send_confirm_form($form, &$form_state, $view, $output) {
|
||||
$form['subject'] = array(
|
||||
'#type' => 'item',
|
||||
'#title' => t('Subject'),
|
||||
'#markup' => '<div class="views-send-preview-value">' . $configuration['views_send_subject'] . '</div>',
|
||||
'#markup' => '<div class="views-send-preview-value">' . check_plain($configuration['views_send_subject']) . '</div>',
|
||||
);
|
||||
$form['message'] = array(
|
||||
'#type' => 'item',
|
||||
@@ -539,7 +539,7 @@ function views_send_confirm_form($form, &$form_state, $view, $output) {
|
||||
|
||||
$headers = array();
|
||||
foreach (_views_send_headers($configuration['views_send_receipt'], $configuration['views_send_priority'], $configuration['views_send_from_mail'], $configuration['views_send_headers']) as $key => $value) {
|
||||
$headers[] = $key . ': ' . $value;
|
||||
$headers[] = check_plain($key . ': ' . $value);
|
||||
}
|
||||
|
||||
$form['headers'] = array(
|
||||
|
||||
+6
-6
@@ -237,7 +237,7 @@ function materio_administration_menu_default_menu_links() {
|
||||
'customized' => 1,
|
||||
'language' => 'und',
|
||||
'menu_links_customized' => 1,
|
||||
'parent_identifier' => 'navigation_translation:admin/config/regional/translate/table',
|
||||
'parent_identifier' => 'navigation_translation:admin/config/regional/translate/translate',
|
||||
);
|
||||
// Exported menu link: navigation_customers:admin/store/customers.
|
||||
$menu_links['navigation_customers:admin/store/customers'] = array(
|
||||
@@ -292,7 +292,7 @@ function materio_administration_menu_default_menu_links() {
|
||||
$menu_links['navigation_duplicate-mails:admin/users/duplicatemails'] = array(
|
||||
'menu_name' => 'navigation',
|
||||
'link_path' => 'admin/users/duplicatemails',
|
||||
'router_path' => 'admin/users/duplicatemails',
|
||||
'router_path' => 'admin/users',
|
||||
'link_title' => 'Duplicate mails',
|
||||
'options' => array(
|
||||
'attributes' => array(),
|
||||
@@ -610,7 +610,7 @@ function materio_administration_menu_default_menu_links() {
|
||||
'customized' => 1,
|
||||
'language' => 'und',
|
||||
'menu_links_customized' => 1,
|
||||
'parent_identifier' => 'navigation_translation:admin/config/regional/translate/table',
|
||||
'parent_identifier' => 'navigation_translation:admin/config/regional/translate/translate',
|
||||
);
|
||||
// Exported menu link: navigation_merge-duplicates:admin/structure/taxonomy/tag_libres/merge/duplicates.
|
||||
$menu_links['navigation_merge-duplicates:admin/structure/taxonomy/tag_libres/merge/duplicates'] = array(
|
||||
@@ -1009,11 +1009,11 @@ function materio_administration_menu_default_menu_links() {
|
||||
'external' => 0,
|
||||
'has_children' => 0,
|
||||
'expanded' => 0,
|
||||
'weight' => -45,
|
||||
'weight' => -50,
|
||||
'customized' => 1,
|
||||
'language' => 'und',
|
||||
'menu_links_customized' => 1,
|
||||
'parent_identifier' => 'navigation_translation:admin/config/regional/translate/table',
|
||||
'parent_identifier' => 'navigation_translation:admin/config/regional/translate/translate',
|
||||
);
|
||||
// Exported menu link: navigation_students:admin/students.
|
||||
$menu_links['navigation_students:admin/students'] = array(
|
||||
@@ -1168,7 +1168,7 @@ function materio_administration_menu_default_menu_links() {
|
||||
'customized' => 1,
|
||||
'language' => 'und',
|
||||
'menu_links_customized' => 1,
|
||||
'parent_identifier' => 'navigation_translation:admin/config/regional/translate/table',
|
||||
'parent_identifier' => 'navigation_translation:admin/config/regional/translate/translate',
|
||||
);
|
||||
// Exported menu link: navigation_taxonomy:admin/structure/taxonomie/admin-taxo.
|
||||
$menu_links['navigation_taxonomy:admin/structure/taxonomie/admin-taxo'] = array(
|
||||
|
||||
+28
-12
@@ -77,39 +77,43 @@ function materio_administration_user_default_permissions() {
|
||||
$permissions['access_translation_table_content_type'] = array(
|
||||
'name' => 'access_translation_table_content_type',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'translate_perms',
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'access_translation_table_fields'.
|
||||
$permissions['access_translation_table_fields'] = array(
|
||||
'name' => 'access_translation_table_fields',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'translate_perms',
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'access_translation_table_menu'.
|
||||
$permissions['access_translation_table_menu'] = array(
|
||||
'name' => 'access_translation_table_menu',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'translate_perms',
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'access_translation_table_taxonomy'.
|
||||
$permissions['access_translation_table_taxonomy'] = array(
|
||||
'name' => 'access_translation_table_taxonomy',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'translate_perms',
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'access_translations_overview'.
|
||||
@@ -118,7 +122,7 @@ function materio_administration_user_default_permissions() {
|
||||
'roles' => array(
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'translate_perms',
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'administer content types'.
|
||||
@@ -225,6 +229,15 @@ function materio_administration_user_default_permissions() {
|
||||
'module' => 'role_delegation',
|
||||
);
|
||||
|
||||
// Exported permission: 'assign Translator role'.
|
||||
$permissions['assign Translator role'] = array(
|
||||
'name' => 'assign Translator role',
|
||||
'roles' => array(
|
||||
'administrator' => 'administrator',
|
||||
),
|
||||
'module' => 'role_delegation',
|
||||
);
|
||||
|
||||
// Exported permission: 'assign Unverified role'.
|
||||
$permissions['assign Unverified role'] = array(
|
||||
'name' => 'assign Unverified role',
|
||||
@@ -389,6 +402,7 @@ function materio_administration_user_default_permissions() {
|
||||
$permissions['edit any breve content'] = array(
|
||||
'name' => 'edit any breve content',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
@@ -409,6 +423,7 @@ function materio_administration_user_default_permissions() {
|
||||
'name' => 'edit any materiau content',
|
||||
'roles' => array(
|
||||
'Admin showroom' => 'Admin showroom',
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
@@ -430,7 +445,6 @@ function materio_administration_user_default_permissions() {
|
||||
'name' => 'edit node translation shared fields',
|
||||
'roles' => array(
|
||||
'Admin showroom' => 'Admin showroom',
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
@@ -502,7 +516,6 @@ function materio_administration_user_default_permissions() {
|
||||
'name' => 'edit translation shared fields',
|
||||
'roles' => array(
|
||||
'Admin showroom' => 'Admin showroom',
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
@@ -515,7 +528,7 @@ function materio_administration_user_default_permissions() {
|
||||
'roles' => array(
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'translate_perms',
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'flush caches'.
|
||||
@@ -533,7 +546,7 @@ function materio_administration_user_default_permissions() {
|
||||
'roles' => array(
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'translate_perms',
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'participate in workflow'.
|
||||
@@ -563,7 +576,7 @@ function materio_administration_user_default_permissions() {
|
||||
'roles' => array(
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'translate_perms',
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'revert revisions'.
|
||||
@@ -652,6 +665,7 @@ function materio_administration_user_default_permissions() {
|
||||
$permissions['translate admin strings'] = array(
|
||||
'name' => 'translate admin strings',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
@@ -703,6 +717,7 @@ function materio_administration_user_default_permissions() {
|
||||
$permissions['translate user-defined strings'] = array(
|
||||
'name' => 'translate user-defined strings',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
@@ -713,10 +728,11 @@ function materio_administration_user_default_permissions() {
|
||||
$permissions['translate_strings'] = array(
|
||||
'name' => 'translate_strings',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'translate_perms',
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'update_modules_translations'.
|
||||
@@ -725,7 +741,7 @@ function materio_administration_user_default_permissions() {
|
||||
'roles' => array(
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'translate_perms',
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'view own unpublished content'.
|
||||
|
||||
@@ -13,12 +13,12 @@ dependencies[] = i18n_string
|
||||
dependencies[] = login_destination
|
||||
dependencies[] = logintoboggan_rules
|
||||
dependencies[] = logintoboggan_variable
|
||||
dependencies[] = materio_translator
|
||||
dependencies[] = materio_user
|
||||
dependencies[] = remove_duplicates
|
||||
dependencies[] = simplenews
|
||||
dependencies[] = taxonomy_csv
|
||||
dependencies[] = taxonomy_wrangler
|
||||
dependencies[] = translate_perms
|
||||
dependencies[] = translation
|
||||
dependencies[] = views_data_export
|
||||
dependencies[] = workflow
|
||||
@@ -110,6 +110,7 @@ features[user_permission][] = assign Adhérent role
|
||||
features[user_permission][] = assign Contact opérationnel role
|
||||
features[user_permission][] = assign Premium role
|
||||
features[user_permission][] = assign Student role
|
||||
features[user_permission][] = assign Translator role
|
||||
features[user_permission][] = assign Unverified role
|
||||
features[user_permission][] = assign Utilisateur Alpha Tester role
|
||||
features[user_permission][] = assign Utilisateur role
|
||||
|
||||
+46
-9
@@ -453,6 +453,7 @@ function materio_administration_views_default_views() {
|
||||
$handler->display->display_options['fields']['translate_node']['id'] = 'translate_node';
|
||||
$handler->display->display_options['fields']['translate_node']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['translate_node']['field'] = 'translate_node';
|
||||
$handler->display->display_options['fields']['translate_node']['alter']['alter_text'] = TRUE;
|
||||
$handler->display->display_options['fields']['translate_node']['alter']['text'] = '<span class="button">[translate_node]</span>';
|
||||
/* Field: Content translation: Translation status */
|
||||
$handler->display->display_options['fields']['translate']['id'] = 'translate';
|
||||
@@ -623,9 +624,10 @@ function materio_administration_views_default_views() {
|
||||
$handler->display->display_options['defaults']['access'] = FALSE;
|
||||
$handler->display->display_options['access']['type'] = 'role';
|
||||
$handler->display->display_options['access']['role'] = array(
|
||||
13 => '13',
|
||||
3 => '3',
|
||||
4 => '4',
|
||||
13 => '13',
|
||||
12 => '12',
|
||||
);
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'full';
|
||||
@@ -661,6 +663,7 @@ function materio_administration_views_default_views() {
|
||||
'field_memo' => 'field_memo',
|
||||
'field_attachments' => 'field_attachments',
|
||||
'field_localisation' => 'field_localisation',
|
||||
'field_location' => 'field_location',
|
||||
'sid' => 'sid',
|
||||
'delete_node' => 'sid',
|
||||
);
|
||||
@@ -716,7 +719,7 @@ function materio_administration_views_default_views() {
|
||||
),
|
||||
'nothing' => array(
|
||||
'align' => '',
|
||||
'separator' => '<br />',
|
||||
'separator' => '',
|
||||
'empty_column' => 0,
|
||||
),
|
||||
'field_company_fab' => array(
|
||||
@@ -762,8 +765,11 @@ function materio_administration_views_default_views() {
|
||||
'empty_column' => 0,
|
||||
),
|
||||
'field_localisation' => array(
|
||||
'sortable' => 0,
|
||||
'default_sort_order' => 'asc',
|
||||
'align' => '',
|
||||
'separator' => '',
|
||||
'empty_column' => 0,
|
||||
),
|
||||
'field_location' => array(
|
||||
'align' => '',
|
||||
'separator' => '',
|
||||
'empty_column' => 0,
|
||||
@@ -855,12 +861,14 @@ function materio_administration_views_default_views() {
|
||||
$handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
|
||||
$handler->display->display_options['fields']['edit_node']['alter']['alter_text'] = TRUE;
|
||||
$handler->display->display_options['fields']['edit_node']['alter']['text'] = '<span class="node-edit">[edit_node]</span>';
|
||||
$handler->display->display_options['fields']['edit_node']['element_wrapper_type'] = 'span';
|
||||
$handler->display->display_options['fields']['edit_node']['element_wrapper_class'] = 'node-edit';
|
||||
/* Field: Global: Custom text */
|
||||
$handler->display->display_options['fields']['nothing']['id'] = 'nothing';
|
||||
$handler->display->display_options['fields']['nothing']['table'] = 'views';
|
||||
$handler->display->display_options['fields']['nothing']['field'] = 'nothing';
|
||||
$handler->display->display_options['fields']['nothing']['label'] = 'Translation';
|
||||
$handler->display->display_options['fields']['nothing']['alter']['text'] = '<span class="node-edit"><a href="/node/[nid]/translate">translate</a></span>';
|
||||
$handler->display->display_options['fields']['nothing']['label'] = 'Translate';
|
||||
$handler->display->display_options['fields']['nothing']['alter']['text'] = '<a class="node-edit" href="/node/[nid]/translate">Translate</a>';
|
||||
/* Field: Content: Manufacturer */
|
||||
$handler->display->display_options['fields']['field_company_fab']['id'] = 'field_company_fab';
|
||||
$handler->display->display_options['fields']['field_company_fab']['table'] = 'field_data_field_company_fab';
|
||||
@@ -1167,6 +1175,12 @@ function materio_administration_views_default_views() {
|
||||
$handler->display->display_options['title'] = 'Companies';
|
||||
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
|
||||
$handler->display->display_options['defaults']['group_by'] = FALSE;
|
||||
$handler->display->display_options['defaults']['access'] = FALSE;
|
||||
$handler->display->display_options['access']['type'] = 'role';
|
||||
$handler->display->display_options['access']['role'] = array(
|
||||
3 => '3',
|
||||
4 => '4',
|
||||
);
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'full';
|
||||
$handler->display->display_options['pager']['options']['items_per_page'] = '25';
|
||||
@@ -1436,6 +1450,13 @@ function materio_administration_views_default_views() {
|
||||
'postpone_processing' => 0,
|
||||
),
|
||||
);
|
||||
/* Field: Content: Nid */
|
||||
$handler->display->display_options['fields']['nid']['id'] = 'nid';
|
||||
$handler->display->display_options['fields']['nid']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['nid']['field'] = 'nid';
|
||||
$handler->display->display_options['fields']['nid']['label'] = '';
|
||||
$handler->display->display_options['fields']['nid']['exclude'] = TRUE;
|
||||
$handler->display->display_options['fields']['nid']['element_label_colon'] = FALSE;
|
||||
/* Field: Content: Type */
|
||||
$handler->display->display_options['fields']['type']['id'] = 'type';
|
||||
$handler->display->display_options['fields']['type']['table'] = 'node';
|
||||
@@ -1455,6 +1476,12 @@ function materio_administration_views_default_views() {
|
||||
$handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
|
||||
$handler->display->display_options['fields']['edit_node']['alter']['alter_text'] = TRUE;
|
||||
$handler->display->display_options['fields']['edit_node']['alter']['text'] = '<span class="node-edit">[edit_node]</span>';
|
||||
/* Field: Global: Custom text */
|
||||
$handler->display->display_options['fields']['nothing']['id'] = 'nothing';
|
||||
$handler->display->display_options['fields']['nothing']['table'] = 'views';
|
||||
$handler->display->display_options['fields']['nothing']['field'] = 'nothing';
|
||||
$handler->display->display_options['fields']['nothing']['label'] = 'Translate';
|
||||
$handler->display->display_options['fields']['nothing']['alter']['text'] = '<a class="node-edit" href="/node/[nid]/translate">Translate</a>';
|
||||
/* Field: Field: Mémo */
|
||||
$handler->display->display_options['fields']['field_memo']['id'] = 'field_memo';
|
||||
$handler->display->display_options['fields']['field_memo']['table'] = 'field_data_field_memo';
|
||||
@@ -1493,11 +1520,13 @@ function materio_administration_views_default_views() {
|
||||
$handler->display->display_options['filters']['type_1']['value'] = array(
|
||||
'breve' => 'breve',
|
||||
'company' => 'company',
|
||||
'simplenews' => 'simplenews',
|
||||
'materiau' => 'materiau',
|
||||
'panel' => 'panel',
|
||||
'product' => 'product',
|
||||
'simplenews' => 'simplenews',
|
||||
'showroom' => 'showroom',
|
||||
'webform' => 'webform',
|
||||
'looping_embed_video' => 'looping_embed_video',
|
||||
);
|
||||
$handler->display->display_options['filters']['type_1']['group'] = 1;
|
||||
/* Filter criterion: Content: Title */
|
||||
@@ -1592,6 +1621,12 @@ function materio_administration_views_default_views() {
|
||||
$handler->display->display_options['defaults']['title'] = FALSE;
|
||||
$handler->display->display_options['title'] = 'Materiaux/brèves';
|
||||
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
|
||||
$handler->display->display_options['defaults']['access'] = FALSE;
|
||||
$handler->display->display_options['access']['type'] = 'role';
|
||||
$handler->display->display_options['access']['role'] = array(
|
||||
3 => '3',
|
||||
4 => '4',
|
||||
);
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'full';
|
||||
$handler->display->display_options['pager']['options']['items_per_page'] = '50';
|
||||
@@ -1904,8 +1939,8 @@ function materio_administration_views_default_views() {
|
||||
t('- Choose an operation -'),
|
||||
t('Image'),
|
||||
t('Titre'),
|
||||
t('Translation'),
|
||||
t('<span class="node-edit"><a href="/node/[nid]/translate">translate</a></span>'),
|
||||
t('Translate'),
|
||||
t('<a class="node-edit" href="/node/[nid]/translate">Translate</a>'),
|
||||
t('Fabricants/Distributeurs'),
|
||||
t('Fab :<br/>
|
||||
[field_company_fab] '),
|
||||
@@ -1944,6 +1979,8 @@ function materio_administration_views_default_views() {
|
||||
t('Title/Name'),
|
||||
t('Page : showrooms'),
|
||||
t('Showroom'),
|
||||
t('Translation'),
|
||||
t('<span class="node-edit"><a href="/node/[nid]/translate">translate</a></span>'),
|
||||
t('Phone'),
|
||||
t('Corps'),
|
||||
);
|
||||
|
||||
+52
@@ -289,6 +289,16 @@ function materio_content_types_user_default_permissions() {
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
// Exported permission: 'create field_used_on_advanced_search'.
|
||||
$permissions['create field_used_on_advanced_search'] = array(
|
||||
'name' => 'create field_used_on_advanced_search',
|
||||
'roles' => array(
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
// Exported permission: 'create field_video_filter'.
|
||||
$permissions['create field_video_filter'] = array(
|
||||
'name' => 'create field_video_filter',
|
||||
@@ -401,6 +411,7 @@ function materio_content_types_user_default_permissions() {
|
||||
$permissions['edit field_description'] = array(
|
||||
'name' => 'edit field_description',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
@@ -490,6 +501,7 @@ function materio_content_types_user_default_permissions() {
|
||||
$permissions['edit field_nature_titre'] = array(
|
||||
'name' => 'edit field_nature_titre',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
@@ -576,6 +588,16 @@ function materio_content_types_user_default_permissions() {
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
// Exported permission: 'edit field_used_on_advanced_search'.
|
||||
$permissions['edit field_used_on_advanced_search'] = array(
|
||||
'name' => 'edit field_used_on_advanced_search',
|
||||
'roles' => array(
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
// Exported permission: 'edit field_video_filter'.
|
||||
$permissions['edit field_video_filter'] = array(
|
||||
'name' => 'edit field_video_filter',
|
||||
@@ -848,6 +870,16 @@ function materio_content_types_user_default_permissions() {
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
// Exported permission: 'edit own field_used_on_advanced_search'.
|
||||
$permissions['edit own field_used_on_advanced_search'] = array(
|
||||
'name' => 'edit own field_used_on_advanced_search',
|
||||
'roles' => array(
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
// Exported permission: 'edit own field_video_filter'.
|
||||
$permissions['edit own field_video_filter'] = array(
|
||||
'name' => 'edit own field_video_filter',
|
||||
@@ -1295,6 +1327,16 @@ function materio_content_types_user_default_permissions() {
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
// Exported permission: 'view field_used_on_advanced_search'.
|
||||
$permissions['view field_used_on_advanced_search'] = array(
|
||||
'name' => 'view field_used_on_advanced_search',
|
||||
'roles' => array(
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
// Exported permission: 'view field_video_filter'.
|
||||
$permissions['view field_video_filter'] = array(
|
||||
'name' => 'view field_video_filter',
|
||||
@@ -1563,6 +1605,16 @@ function materio_content_types_user_default_permissions() {
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
// Exported permission: 'view own field_used_on_advanced_search'.
|
||||
$permissions['view own field_used_on_advanced_search'] = array(
|
||||
'name' => 'view own field_used_on_advanced_search',
|
||||
'roles' => array(
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'field_permissions',
|
||||
);
|
||||
|
||||
// Exported permission: 'view own field_video_filter'.
|
||||
$permissions['view own field_video_filter'] = array(
|
||||
'name' => 'view own field_video_filter',
|
||||
|
||||
@@ -223,6 +223,7 @@ features[user_permission][] = create field_public_phone
|
||||
features[user_permission][] = create field_reference_materio
|
||||
features[user_permission][] = create field_tags_libres
|
||||
features[user_permission][] = create field_tode_company
|
||||
features[user_permission][] = create field_used_on_advanced_search
|
||||
features[user_permission][] = create field_video_filter
|
||||
features[user_permission][] = create field_website
|
||||
features[user_permission][] = create field_weight
|
||||
@@ -252,6 +253,7 @@ features[user_permission][] = edit field_public_phone
|
||||
features[user_permission][] = edit field_reference_materio
|
||||
features[user_permission][] = edit field_tags_libres
|
||||
features[user_permission][] = edit field_tode_company
|
||||
features[user_permission][] = edit field_used_on_advanced_search
|
||||
features[user_permission][] = edit field_video_filter
|
||||
features[user_permission][] = edit field_website
|
||||
features[user_permission][] = edit field_weight
|
||||
@@ -280,6 +282,7 @@ features[user_permission][] = edit own field_public_phone
|
||||
features[user_permission][] = edit own field_reference_materio
|
||||
features[user_permission][] = edit own field_tags_libres
|
||||
features[user_permission][] = edit own field_tode_company
|
||||
features[user_permission][] = edit own field_used_on_advanced_search
|
||||
features[user_permission][] = edit own field_video_filter
|
||||
features[user_permission][] = edit own field_website
|
||||
features[user_permission][] = edit own field_weight
|
||||
@@ -316,6 +319,7 @@ features[user_permission][] = view field_public_phone
|
||||
features[user_permission][] = view field_reference_materio
|
||||
features[user_permission][] = view field_tags_libres
|
||||
features[user_permission][] = view field_tode_company
|
||||
features[user_permission][] = view field_used_on_advanced_search
|
||||
features[user_permission][] = view field_video_filter
|
||||
features[user_permission][] = view field_website
|
||||
features[user_permission][] = view field_weight
|
||||
@@ -344,6 +348,7 @@ features[user_permission][] = view own field_public_phone
|
||||
features[user_permission][] = view own field_reference_materio
|
||||
features[user_permission][] = view own field_tags_libres
|
||||
features[user_permission][] = view own field_tode_company
|
||||
features[user_permission][] = view own field_used_on_advanced_search
|
||||
features[user_permission][] = view own field_video_filter
|
||||
features[user_permission][] = view own field_website
|
||||
features[user_permission][] = view own field_weight
|
||||
@@ -511,9 +516,6 @@ features[variable][] = print_pdf_display_urllist_webform
|
||||
features[variable][] = print_pdf_display_webform
|
||||
features[variable][] = print_pdf_dompdf_unicode
|
||||
features[variable][] = print_pdf_filename
|
||||
features[variable][] = print_pdf_font_family
|
||||
features[variable][] = print_pdf_font_size
|
||||
features[variable][] = print_pdf_font_subsetting
|
||||
features[variable][] = print_pdf_images_via_file
|
||||
features[variable][] = print_pdf_link_class
|
||||
features[variable][] = print_pdf_link_pos
|
||||
@@ -536,7 +538,6 @@ features[variable][] = print_urls
|
||||
features[variable][] = print_urls_anchors
|
||||
features[views_view][] = entity_reference_materiaux_breves
|
||||
features_exclude[dependencies][i18n_taxonomy] = i18n_taxonomy
|
||||
features_exclude[dependencies][showroom] = showroom
|
||||
features_exclude[dependencies][materio_showroom] = materio_showroom
|
||||
features_exclude[field_base][field_showroom] = field_showroom
|
||||
features_exclude[field_base][field_location] = field_location
|
||||
|
||||
@@ -2328,27 +2328,6 @@ function materio_content_types_strongarm() {
|
||||
$strongarm->value = '[site:name]-[node:title]-[node:changed:custom:Y-m-d]';
|
||||
$export['print_pdf_filename'] = $strongarm;
|
||||
|
||||
$strongarm = new stdClass();
|
||||
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
|
||||
$strongarm->api_version = 1;
|
||||
$strongarm->name = 'print_pdf_font_family';
|
||||
$strongarm->value = 'dejavusans';
|
||||
$export['print_pdf_font_family'] = $strongarm;
|
||||
|
||||
$strongarm = new stdClass();
|
||||
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
|
||||
$strongarm->api_version = 1;
|
||||
$strongarm->name = 'print_pdf_font_size';
|
||||
$strongarm->value = '10';
|
||||
$export['print_pdf_font_size'] = $strongarm;
|
||||
|
||||
$strongarm = new stdClass();
|
||||
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
|
||||
$strongarm->api_version = 1;
|
||||
$strongarm->name = 'print_pdf_font_subsetting';
|
||||
$strongarm->value = 0;
|
||||
$export['print_pdf_font_subsetting'] = $strongarm;
|
||||
|
||||
$strongarm = new stdClass();
|
||||
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
|
||||
$strongarm->api_version = 1;
|
||||
|
||||
@@ -10,6 +10,25 @@
|
||||
function translations_user_default_permissions() {
|
||||
$permissions = array();
|
||||
|
||||
// Exported permission: 'access selected languages'.
|
||||
$permissions['access selected languages'] = array(
|
||||
'name' => 'access selected languages',
|
||||
'roles' => array(
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'administer content translations'.
|
||||
$permissions['administer content translations'] = array(
|
||||
'name' => 'administer content translations',
|
||||
'roles' => array(
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'i18n_node',
|
||||
);
|
||||
|
||||
// Exported permission: 'administer languages'.
|
||||
$permissions['administer languages'] = array(
|
||||
'name' => 'administer languages',
|
||||
@@ -19,10 +38,30 @@ function translations_user_default_permissions() {
|
||||
'module' => 'locale',
|
||||
);
|
||||
|
||||
// Exported permission: 'administer user translation language access'.
|
||||
$permissions['administer user translation language access'] = array(
|
||||
'name' => 'administer user translation language access',
|
||||
'roles' => array(
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'delete_strings'.
|
||||
$permissions['delete_strings'] = array(
|
||||
'name' => 'delete_strings',
|
||||
'roles' => array(
|
||||
'root' => 'root',
|
||||
),
|
||||
'module' => 'materio_translator',
|
||||
);
|
||||
|
||||
// Exported permission: 'translate interface'.
|
||||
$permissions['translate interface'] = array(
|
||||
'name' => 'translate interface',
|
||||
'roles' => array(
|
||||
'Translator' => 'Translator',
|
||||
'administrator' => 'administrator',
|
||||
'root' => 'root',
|
||||
),
|
||||
|
||||
@@ -2,20 +2,27 @@ name = Translations
|
||||
core = 7.x
|
||||
package = Materio
|
||||
version = 7.x-1.0-beta
|
||||
dependencies[] = i18n_node
|
||||
dependencies[] = locale
|
||||
dependencies[] = materio_translator
|
||||
dependencies[] = strongarm
|
||||
features[ctools][] = strongarm:strongarm:1
|
||||
features[features_api][] = api:2
|
||||
features[language][] = en
|
||||
features[language][] = fr
|
||||
features[user_permission][] = access selected languages
|
||||
features[user_permission][] = administer content translations
|
||||
features[user_permission][] = administer languages
|
||||
features[user_permission][] = administer user translation language access
|
||||
features[user_permission][] = delete_strings
|
||||
features[user_permission][] = translate interface
|
||||
features[user_role][] = Translator
|
||||
features[variable][] = i18n_node_translation_switch
|
||||
features[variable][] = locale_field_language_fallback
|
||||
features[variable][] = locale_language_negotiation_url_part
|
||||
features[variable][] = locale_language_providers_weight_language
|
||||
features[variable][] = materio_translator_languages
|
||||
features[variable][] = taxonomy_csv_locale_custom
|
||||
features_exclude[dependencies][ctools] = ctools
|
||||
features_exclude[dependencies][features] = features
|
||||
features_exclude[dependencies][locale] = locale
|
||||
features_exclude[dependencies][strongarm] = strongarm
|
||||
project path = sites/all/modules/features
|
||||
|
||||
@@ -44,6 +44,19 @@ function translations_strongarm() {
|
||||
);
|
||||
$export['locale_language_providers_weight_language'] = $strongarm;
|
||||
|
||||
$strongarm = new stdClass();
|
||||
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
|
||||
$strongarm->api_version = 1;
|
||||
$strongarm->name = 'materio_translator_languages';
|
||||
$strongarm->value = array(
|
||||
'und' => 'und',
|
||||
'en' => 'en',
|
||||
'fr' => 'fr',
|
||||
'zh-hans' => 'zh-hans',
|
||||
'cs' => 'cs',
|
||||
);
|
||||
$export['materio_translator_languages'] = $strongarm;
|
||||
|
||||
$strongarm = new stdClass();
|
||||
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
|
||||
$strongarm->api_version = 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name = Materio Tranlator
|
||||
description = "Materio translator dedicated module"
|
||||
description = "Materio translator dedicated module, based on i18n_access"
|
||||
|
||||
; Core version (required)
|
||||
core = 7.x
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* file_description
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_schema().
|
||||
*/
|
||||
function materio_translator_schema() {
|
||||
$schema['materio_translator'] = array(
|
||||
'description' => 'Store language permissions per user',
|
||||
'fields' => array(
|
||||
'uid' => array(
|
||||
'description' => 'The primary identifier for a user.',
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
),
|
||||
'perm' => array(
|
||||
'description' => 'List of languages that the user has permission for.',
|
||||
'type' => 'text',
|
||||
'not null' => FALSE,
|
||||
'size' => 'big',
|
||||
),
|
||||
),
|
||||
'primary key' => array('uid'),
|
||||
);
|
||||
return $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_install().
|
||||
*/
|
||||
function materio_translator_install() {
|
||||
// Set module weight for it to run after core and i18n modules
|
||||
db_query("UPDATE {system} SET weight = 90 WHERE name = 'materio_translator' AND type = 'module'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_uninstall().
|
||||
*/
|
||||
// function materio_translator_uninstall() {
|
||||
// variable_del('materio_translator_languages');
|
||||
// }
|
||||
@@ -1,61 +1,582 @@
|
||||
<?php
|
||||
|
||||
// __ __ __ __ _
|
||||
// / / / /_______ __________ ________ / /_/ /_(_)___ ____ ______
|
||||
// / / / / ___/ _ \/ ___/ ___/ / ___/ _ \/ __/ __/ / __ \/ __ `/ ___/
|
||||
// / /_/ (__ ) __/ / (__ ) (__ ) __/ /_/ /_/ / / / / /_/ (__ )
|
||||
// \____/____/\___/_/ /____/ /____/\___/\__/\__/_/_/ /_/\__, /____/
|
||||
// /____/
|
||||
|
||||
/**
|
||||
* Implements hook_init().
|
||||
* Implements hook_user_insert().
|
||||
*/
|
||||
// function materio_translator_init() {
|
||||
// drupal_add_js(drupal_get_path('module', 'materio_translator').'/js/materio_translator.js');
|
||||
// }
|
||||
function materio_translator_user_insert(&$edit, &$account, $category = NULL) {
|
||||
materio_translator_user_update($edit, $account, $category);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_user_update().
|
||||
*/
|
||||
function materio_translator_user_update(&$edit, &$account, $category = NULL) {
|
||||
if ($category == 'account') {
|
||||
// see user_admin_perm_submit()
|
||||
if (isset($edit['materio_translator'])) {
|
||||
db_delete('materio_translator')
|
||||
->condition('uid', $account->uid)
|
||||
->execute();
|
||||
$edit['materio_translator'] = array_filter($edit['materio_translator']);
|
||||
if (count($edit['materio_translator'])) {
|
||||
db_insert('materio_translator')
|
||||
->fields(array(
|
||||
'uid' => $account->uid,
|
||||
'perm' => implode(', ', array_keys($edit['materio_translator'])),
|
||||
))->execute();
|
||||
}
|
||||
unset($edit['materio_translator']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_user_delete().
|
||||
*/
|
||||
function materio_translator_user_delete($account) {
|
||||
db_delete('materio_translator')
|
||||
->condition('uid', $account->uid)
|
||||
->execute();
|
||||
}
|
||||
|
||||
// __ __ __
|
||||
// / / / /__ / /___ ___ __________
|
||||
// / /_/ / _ \/ / __ \/ _ \/ ___/ ___/
|
||||
// / __ / __/ / /_/ / __/ / (__ )
|
||||
// /_/ /_/\___/_/ .___/\___/_/ /____/
|
||||
// /_/
|
||||
/**
|
||||
* Load the language permissions for a given user
|
||||
*/
|
||||
function materio_translator_load_permissions($uid = NULL) {
|
||||
$perms = &drupal_static(__FUNCTION__);
|
||||
|
||||
// use the global user id if none is passed
|
||||
if (!isset($uid)) {
|
||||
$uid = $GLOBALS['user']->uid;
|
||||
$account = NULL;
|
||||
}else {
|
||||
$account = user_load($uid);
|
||||
}
|
||||
|
||||
if (!isset($perms[$uid])) {
|
||||
$perm_string = db_query('SELECT perm FROM {materio_translator} WHERE uid = :uid', array(':uid' => $uid))->fetchField();
|
||||
|
||||
if ($perm_string) {
|
||||
$perms[$uid] = drupal_map_assoc(explode(', ', $perm_string));
|
||||
}else {
|
||||
$perms[$uid] = array();
|
||||
}
|
||||
}
|
||||
|
||||
// adding the default languages if permission has been granted
|
||||
if (user_access('access selected languages', $account)) {
|
||||
$perms[$uid] = array_merge($perms[$uid], drupal_map_assoc(variable_get('materio_translator_languages', array())));
|
||||
}
|
||||
|
||||
return $perms[$uid];
|
||||
}
|
||||
|
||||
|
||||
// ________ __ __
|
||||
// / ____/ /___ / /_ ____ _/ / ____ ___ _________ ___ _____
|
||||
// / / __/ / __ \/ __ \/ __ `/ / / __ \/ _ \/ ___/ __ `__ \/ ___/
|
||||
// / /_/ / / /_/ / /_/ / /_/ / / / /_/ / __/ / / / / / / (__ )
|
||||
// \____/_/\____/_.___/\__,_/_/ / .___/\___/_/ /_/ /_/ /_/____/
|
||||
// /_/
|
||||
/**
|
||||
* Implements hook_permission().
|
||||
*/
|
||||
// function materio_translator_permission() {
|
||||
// $perms = array(
|
||||
// 'add showroom localisation' => array(
|
||||
// 'title' => t('add showroom localisation'),
|
||||
// 'description' => t('add showroom localisation'),
|
||||
// ),
|
||||
// );
|
||||
//
|
||||
// return $perms;
|
||||
// }
|
||||
function materio_translator_permission() {
|
||||
return array(
|
||||
'access selected languages' => array(
|
||||
'title' => t('Access selected languages'),
|
||||
'description' => t('This permission gives this role edit/delete access to all content which are in the <a href="!url" target="_blank">selected language</a>. View/create access needs a different access level.', array('!url' => url('admin/config/regional/language/access'))),
|
||||
'restrict access' => TRUE,
|
||||
),
|
||||
'administer user translation language access' => array(
|
||||
'title' => t('Administer user translation language access'),
|
||||
'description' => t('administer user translation language access'),
|
||||
'restrict access' => TRUE,
|
||||
),
|
||||
'access_translations_overview' => array(
|
||||
'title' => t('Access translations overview')
|
||||
),
|
||||
|
||||
'access_translation_table_fields' => array(
|
||||
'title' => t('Access translation Fields table')
|
||||
),
|
||||
'access_translation_table_content_type' => array(
|
||||
'title' => t('Access translation Content types table')
|
||||
),
|
||||
'access_translation_table_menu' => array(
|
||||
'title' => t('Access translation menu table')
|
||||
),
|
||||
'access_translation_table_taxonomy' => array(
|
||||
'title' => t('Access translation taxonomy table')
|
||||
),
|
||||
|
||||
'translate_strings' => array(
|
||||
'title' => t('Translate strings')
|
||||
),
|
||||
'delete_strings' => array(
|
||||
'title' => t('Delete strings')
|
||||
),
|
||||
'refresh_strings' => array(
|
||||
'title' => t('Refresh strings')
|
||||
),
|
||||
|
||||
'import_translations' => array(
|
||||
'title' => t('Import translations')
|
||||
),
|
||||
'export_translations' => array(
|
||||
'title' => t('Import translations')
|
||||
),
|
||||
'update_modules_translations' => array(
|
||||
'title' => t('Update modules translations')
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_alter().
|
||||
*/
|
||||
function DISABLED_materio_translator_form_alter(&$form, &$form_state, $form_id) {
|
||||
// act only on node edit form
|
||||
if(isset($form['#node_edit_form'])){
|
||||
function materio_translator_form_alter(&$form, &$form_state, $form_id) {
|
||||
// dsm($form_id);
|
||||
|
||||
// Add materio_translator things to user/edit /user/add
|
||||
if ($form_id == 'user_register_form' || $form_id == 'user_profile_form' ) {
|
||||
// dsm($form_id, 'form_id');
|
||||
// dsm($form, 'form');
|
||||
// dsm($form_state, 'form_state');
|
||||
|
||||
$form['materio_translator'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Translation access'),
|
||||
'#tree' => 0,
|
||||
'#access' => user_access('administer user translation language access'),
|
||||
);
|
||||
$form['materio_translator']['materio_translator'] = array(
|
||||
'#type' => 'checkboxes',
|
||||
'#options' => array(LANGUAGE_NONE => t('Language neutral')) + locale_language_list('name'),
|
||||
'#default_value' => materio_translator_load_permissions($form['#user']->uid),
|
||||
'#description' => t('The user get edit, delete access to all content which are in this enabled languages. Create, view access needs a different access level.'),
|
||||
);
|
||||
}
|
||||
|
||||
// limit fields in string translation
|
||||
if($form_id == 'i18n_string_locale_translate_edit_form'){
|
||||
// dsm($form, 'form');
|
||||
// dsm($form_state, 'form_state');
|
||||
global $user;
|
||||
$perms = materio_translator_load_permissions($user->uid);
|
||||
// dsm($perms);
|
||||
foreach ($form['translations'] as $langcode => $item) {
|
||||
// disable field if langcode not in perms
|
||||
if(!in_array($langcode, $perms) && isset($form['translations'][$langcode])){
|
||||
$form['translations'][$langcode]['#disabled'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// limit fields in string translation
|
||||
if($form_id == 'field_translation_table_form'
|
||||
|| $form_id == "node_translation_table_nodetype_form"
|
||||
|| $form_id == "menu_translation_table_menu_form"
|
||||
|| $form_id == "taxonomy_translation_table_taxonomy_form"){
|
||||
// dsm($form, 'form');
|
||||
// dsm($form_state, 'form_state');
|
||||
global $user;
|
||||
$perms = materio_translator_load_permissions($user->uid);
|
||||
// dsm($perms);
|
||||
foreach ($form['filtered_form']['strings'] as $id => $row) {
|
||||
foreach ($row as $langcode => $field) {
|
||||
// disable field if langcode not in perms
|
||||
if(!in_array($langcode, $perms)){
|
||||
$form['filtered_form']['strings'][$id][$langcode]['#disabled'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_field_access().
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function DISABLED_materio_translator_field_access($op, $field, $entity_type, $entity, $account) {
|
||||
// dsm($op,'op');
|
||||
// dsm($entity_type,'entity_type');
|
||||
// if($op == "edit" && $entity_type == 'node'){
|
||||
// if($field['translatable'] == 0){
|
||||
// if($field['field_permissions']['type'] == FIELD_PERMISSIONS_CUSTOM){
|
||||
// dsm($field,$field['field_name']);
|
||||
// // dsm($entity,'entity');
|
||||
// // dsm($account,'account');
|
||||
//
|
||||
// // check if field permissions are handled by field_permissions module
|
||||
//
|
||||
// // return FALSE;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return TRUE;
|
||||
function materio_translator_menu() {
|
||||
$items['admin/config/regional/language/access'] = array(
|
||||
'title' => 'Access',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('materio_translator_admin_settings'),
|
||||
'access arguments' => array('administer site configuration'),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
'weight' => 10,
|
||||
);
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin settings form.
|
||||
*/
|
||||
function materio_translator_admin_settings($form) {
|
||||
$form['materio_translator_languages'] = array(
|
||||
'#title' => t('Select the default access languages'),
|
||||
'#type' => 'select',
|
||||
'#multiple' => TRUE,
|
||||
'#options' => array(LANGUAGE_NONE => t('Language neutral')) + locale_language_list('name'),
|
||||
'#default_value' => variable_get('materio_translator_languages', array()),
|
||||
'#description' => t("This selection of languages will be connected with the 'access selected languages' permission which you can use to grant a role access to these languages at once.")
|
||||
);
|
||||
return system_settings_form($form);
|
||||
}
|
||||
|
||||
// __ ___ ___ ____
|
||||
// / |/ /__ ____ __ __ / | / / /____ _____
|
||||
// / /|_/ / _ \/ __ \/ / / / / /| | / / __/ _ \/ ___/
|
||||
// / / / / __/ / / / /_/ / / ___ |/ / /_/ __/ /
|
||||
// /_/ /_/\___/_/ /_/\__,_/ /_/ |_/_/\__/\___/_/
|
||||
|
||||
/**
|
||||
* Implements hook_menu_alter().
|
||||
*/
|
||||
function materio_translator_menu_alter(&$items) {
|
||||
// due to hook_module_implementation_alter calling entity translation last, we can't change the callback here, i've done it in entity_translation.node.inc - consider calling it here?
|
||||
// $items['node/%node/translate']['page callback'] = 'materio_translator_translation_node_overview';
|
||||
//
|
||||
foreach ($items as $path => $item) {
|
||||
// if(strpos($path, 'node/%node/translate') !== false){
|
||||
if(preg_match('/^node\/%node\/translate$/', $path)){
|
||||
// dsm($path);
|
||||
// dsm($item);
|
||||
|
||||
// create new page arguments
|
||||
$pargs = $item['page arguments'];
|
||||
// add page call back for entity_translation call
|
||||
// and memorize old page callback (i18n) for entity_translation call args
|
||||
$pargs[2]['page callback'] = $item['page callback'];
|
||||
$pargs[2]['file'] = $item['file'];
|
||||
$pargs[2]['module'] = $item['module'];
|
||||
$pargs[2]['page arguments'] = $item['page arguments'];
|
||||
// dsm($pargs, "pargs");
|
||||
|
||||
// change page callback for our own function
|
||||
$items[$path]['page callback'] = "materio_translator_translation_node_overview";
|
||||
// add our own page raguments
|
||||
$items[$path]['page arguments'] = $pargs;
|
||||
}
|
||||
|
||||
// translation edit link
|
||||
if(preg_match('/^node\/%node\/edit\/%entity_translation_language$/', $path)){
|
||||
// dsm($item, $path);
|
||||
|
||||
// create new page arguments
|
||||
$access_args = $item['access arguments'];
|
||||
// dsm($access_args, 'access_args avt');
|
||||
// add page call back for entity_translation call
|
||||
// and memorize old page callback (i18n) for entity_translation call args
|
||||
$access_args[3]['access callback'] = $item['access callback'];
|
||||
$access_args[3]['file'] = 'entity_translation.node.inc';
|
||||
$access_args[3]['module'] = 'entity_translation';
|
||||
$access_args[3]['access arguments'] = $item['access arguments'];
|
||||
// dsm($access_args, "access_args");
|
||||
|
||||
// change access callback for our own function
|
||||
$items[$path]['access callback'] = 'materio_translator_node_edit_access';
|
||||
// add our own page raguments
|
||||
$items[$path]['access arguments'] = $access_args;
|
||||
// dsm($access_args, 'access_args apr');
|
||||
|
||||
// dsm($items[$path], $path);
|
||||
}
|
||||
|
||||
// translation add link
|
||||
// if(preg_match('/^node\/%node\/edit\/add\/%entity_translation_language/', $path)){
|
||||
// dsm($item, $path);
|
||||
// }
|
||||
|
||||
// translation add link
|
||||
if(preg_match('/^admin\/config\/regional\/translate$/', $path)){
|
||||
$items[$path]['access arguments'] = array('access_translations_overview');
|
||||
}
|
||||
if(preg_match('/^admin\/config\/regional\/translate\/table$/', $path)){
|
||||
$items[$path]['access arguments'] = array('access_translation_table_fields');
|
||||
}
|
||||
if(preg_match('/^admin\/config\/regional\/translate\/table\/nodetype$/', $path)){
|
||||
$items[$path]['access arguments'] = array('access_translation_table_content_type');
|
||||
}
|
||||
if(preg_match('/^admin\/config\/regional\/translate\/table\/menu$/', $path)){
|
||||
$items[$path]['access arguments'] = array('access_translation_table_menu');
|
||||
}
|
||||
if(preg_match('/^admin\/config\/regional\/translate\/table\/taxonomy$/', $path)){
|
||||
$items[$path]['access arguments'] = array('access_translation_table_taxonomy');
|
||||
}
|
||||
if(preg_match('/^admin\/config\/regional\/translate\/translate$/', $path)){
|
||||
$items[$path]['access arguments'] = array('translate_strings');
|
||||
}
|
||||
if(preg_match('/^admin\/config\/regional\/translate\/import$/', $path)){
|
||||
$items[$path]['access arguments'] = array('import_translations');
|
||||
}
|
||||
if(preg_match('/^admin\/config\/regional\/translate\/i18n_string$/', $path)){
|
||||
$items[$path]['access arguments'] = array('refresh_strings');
|
||||
}
|
||||
if(preg_match('/^admin\/config\/regional\/translate\/update$/', $path)){
|
||||
$items[$path]['access arguments'] = array('update_modules_translations');
|
||||
}
|
||||
if(preg_match('/^admin\/config\/regional\/translate\/export$/', $path)){
|
||||
$items[$path]['access arguments'] = array('export_translations');
|
||||
}
|
||||
if(preg_match('/^admin\/config\/regional\/translate\/delete$/', $path)){
|
||||
$items[$path]['access arguments'] += array("delete_strings");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function materio_translator_node_edit_access($entity_type, $entity, $langcode, $callback = null){
|
||||
$args = func_get_args();
|
||||
// dsm($args, '1 -- materio_translator_node_edit_access args');
|
||||
|
||||
// dsm($entity_type, "entity_type");
|
||||
// dsm($entity, "entity");
|
||||
// dsm($langcode, 'langcode');
|
||||
// dsm($callback, "2 -- callback");
|
||||
|
||||
if (module_exists($callback['module'])) {
|
||||
// dsm('module_exists');
|
||||
if (isset($callback['file'])) {
|
||||
$path = isset($callback['file path']) ? $callback['file path'] : drupal_get_path('module', $callback['module']);
|
||||
// dsm($path, 'path');
|
||||
require_once DRUPAL_ROOT . '/' . $path . '/' . $callback['file'];
|
||||
}
|
||||
// dsm($callback['access callback'], 'access callback');
|
||||
$callback['access arguments'][1] = $entity;
|
||||
$callback['access arguments'][2] = $langcode;
|
||||
$callback['access arguments'][5] = $entity;
|
||||
// dsm($callback['access arguments'], "callback['access arguments']");
|
||||
$callbackaccess = call_user_func_array($callback['access callback'], $callback['access arguments']);
|
||||
// dsm($callbackaccess, '3 -- callbackaccess');
|
||||
|
||||
if($callbackaccess){
|
||||
global $user;
|
||||
$perms = materio_translator_load_permissions($user->uid);
|
||||
// dsm($perms, '4 -- perms');
|
||||
// remove link if langcode not in perms
|
||||
if(in_array($langcode, $perms)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// $callbackaccess = call_user_func_array($callback['access callback'], $callback['access arguments']);
|
||||
|
||||
// return $callbackaccess;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// _ __ __ _
|
||||
// / | / /___ ____/ /__ ____ _ _____ ______ __(_)__ _ __
|
||||
// / |/ / __ \/ __ / _ \ / __ \ | / / _ \/ ___/ | / / / _ \ | /| / /
|
||||
// / /| / /_/ / /_/ / __/ / /_/ / |/ / __/ / | |/ / / __/ |/ |/ /
|
||||
// /_/ |_/\____/\__,_/\___/ \____/|___/\___/_/ |___/_/\___/|__/|__/
|
||||
|
||||
/**
|
||||
* Implements hook_module_implements_alter().
|
||||
*/
|
||||
function materio_translator_module_implements_alter(&$implementations, $hook) {
|
||||
switch ($hook) {
|
||||
case 'menu_alter':
|
||||
// Move our hook_menu_alter implementation to the end of the list.
|
||||
$group = $implementations['materio_translator'];
|
||||
unset($implementations['materio_translator']);
|
||||
$implementations['materio_translator'] = $group;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Most logic comes from translation/i18n_node module.
|
||||
*
|
||||
* We removes here only the "add translation" links for languages which are not your selected language.
|
||||
*
|
||||
* @see translation_node_overview
|
||||
* @see i18n_node_translation_overview
|
||||
*
|
||||
* @param object $node
|
||||
*
|
||||
* @return array.
|
||||
*/
|
||||
function materio_translator_translation_node_overview($entity_type, $entity, $callback = NULL) {
|
||||
// dsm('materio_translator_translation_node_overview');
|
||||
// dsm($entity_type, "entity_type");
|
||||
// dsm($entity, "entity");
|
||||
// dsm($callback, "callback");
|
||||
|
||||
// first call entity_translation original callback
|
||||
// we retrieve the original build object of translation overview
|
||||
if ($callback) {
|
||||
$callback['page arguments'][1] = $entity;
|
||||
$build = materio_translator_overview_callback($callback);
|
||||
// dsm($build, "build");
|
||||
|
||||
global $user;
|
||||
$perms = materio_translator_load_permissions($user->uid);
|
||||
// dsm($perms, 'perms');
|
||||
|
||||
$i = 0;
|
||||
foreach ($build['entity_translation_overview']['#rows'] as $row) {
|
||||
// retrieve teh translation link
|
||||
$link = $row['data'][4];
|
||||
// dsm($link, "link");
|
||||
|
||||
// retrieve the langcode from link
|
||||
preg_match('/xml:lang="([^"]+)"/', $link, $matches);
|
||||
$langcode = $matches[1];
|
||||
// dsm($langcode, 'langcode');
|
||||
|
||||
// remove link if langcode not in perms
|
||||
if(!in_array($langcode, $perms)){
|
||||
$build['entity_translation_overview']['#rows'][$i]['data'][4] = "";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $build;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calls the appropriate translation overview callback.
|
||||
*/
|
||||
function materio_translator_overview_callback($callback) {
|
||||
if (module_exists($callback['module'])) {
|
||||
if (isset($callback['file'])) {
|
||||
$path = isset($callback['file path']) ? $callback['file path'] : drupal_get_path('module', $callback['module']);
|
||||
require_once DRUPAL_ROOT . '/' . $path . '/' . $callback['file'];
|
||||
}
|
||||
return call_user_func_array($callback['page callback'], $callback['page arguments']);
|
||||
}
|
||||
}
|
||||
|
||||
// _ __ __ __
|
||||
// / | / /___ ____/ /__ / /___ _____ ____ ___ ______ _____ ____
|
||||
// / |/ / __ \/ __ / _ \ / / __ `/ __ \/ __ `/ / / / __ `/ __ `/ _ \
|
||||
// / /| / /_/ / /_/ / __/ / / /_/ / / / / /_/ / /_/ / /_/ / /_/ / __/
|
||||
// /_/ |_/\____/\__,_/\___/ __/\__,_/_/ /_/\__, /\__,_/\__,_/\__, /\___/
|
||||
// ________ / /__ _____/ /_(_)___ ___/____/ /____/
|
||||
// / ___/ _ \/ / _ \/ ___/ __/ / __ \/ __ \
|
||||
// (__ ) __/ / __/ /__/ /_/ / /_/ / / / /
|
||||
// /____/\___/_/\___/\___/\__/_/\____/_/ /_/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu_local_tasks_alter().
|
||||
*/
|
||||
function materio_translator_menu_local_tasks_alter(&$data, $router_item, $root_path) {
|
||||
// dsm($data, 'data');
|
||||
|
||||
global $user;
|
||||
$perms = materio_translator_load_permissions($user->uid);
|
||||
|
||||
foreach ($data['tabs'] as $t => $tab) {
|
||||
foreach ($tab['output'] as $l => $link) {
|
||||
if($link['#language_tab']){
|
||||
// dsm($link, $link["#link"]["title"]);
|
||||
$langcode = $link["#link"]['localized_options']['language']->language;
|
||||
if(!in_array($langcode, $perms)){
|
||||
unset($data['tabs'][$t]['output'][$l]);
|
||||
}
|
||||
// dsm($data['tabs'][$t]['output'][$l]['#link']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_form_node_form_alter().
|
||||
*/
|
||||
function materio_translator_form_node_form_alter(&$form) {
|
||||
$form['#after_build'][] = '_materio_translator_form_node_form_alter';
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset's languages from language options if user does not have permission to
|
||||
* use.
|
||||
*
|
||||
* @param $form
|
||||
* @param $form_state
|
||||
* @return mixed
|
||||
*/
|
||||
function _materio_translator_form_node_form_alter($form, &$form_state) {
|
||||
if (isset($form['language']['#options']) && !user_access('bypass node access')) {
|
||||
$perms = materio_translator_load_permissions();
|
||||
foreach ($form['language']['#options'] as $key => $value) {
|
||||
if (empty($perms[$key])) {
|
||||
unset($form['language']['#options'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function materio_translator_node_tab_access(){
|
||||
$args = func_get_args();
|
||||
// dsm($args, '1 -- materio_translator_node_tab_access args');
|
||||
|
||||
// dsm($entity_type, "entity_type");
|
||||
// dsm($entity, "entity");
|
||||
// dsm($langcode, 'langcode');
|
||||
// dsm($callback, "2 -- callback");
|
||||
/*
|
||||
if (module_exists($callback['module'])) {
|
||||
// dsm('module_exists');
|
||||
if (isset($callback['file'])) {
|
||||
$path = isset($callback['file path']) ? $callback['file path'] : drupal_get_path('module', $callback['module']);
|
||||
// dsm($path, 'path');
|
||||
require_once DRUPAL_ROOT . '/' . $path . '/' . $callback['file'];
|
||||
}
|
||||
// dsm($callback['access callback'], 'access callback');
|
||||
$callback['access arguments'][1] = $entity;
|
||||
$callback['access arguments'][2] = $langcode;
|
||||
$callback['access arguments'][5] = $entity;
|
||||
// dsm($callback['access arguments'], "callback['access arguments']");
|
||||
$callbackaccess = call_user_func_array($callback['access callback'], $callback['access arguments']);
|
||||
// dsm($callbackaccess, '3 -- callbackaccess');
|
||||
|
||||
if($callbackaccess){
|
||||
global $user;
|
||||
$perms = materio_translator_load_permissions($user->uid);
|
||||
// dsm($perms, '4 -- perms');
|
||||
// remove link if langcode not in perms
|
||||
if(in_array($langcode, $perms)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// $callbackaccess = call_user_func_array($callback['access callback'], $callback['access arguments']);
|
||||
|
||||
// return $callbackaccess;
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ select.form-select:disabled {
|
||||
border-width: 0px;
|
||||
border-style: solid;
|
||||
border-color: none;
|
||||
background: #fff;
|
||||
background: #f0f0f0;
|
||||
color: #1A1A1A;
|
||||
max-width: 100%;
|
||||
}
|
||||
@@ -84,6 +84,17 @@ select.form-select:focus:disabled {
|
||||
border-color: #fff;
|
||||
box-shadow: #fff 0 0 0px;
|
||||
}
|
||||
#i18n-string-locale-translate-edit-form {
|
||||
position: relative;
|
||||
}
|
||||
#i18n-string-locale-translate-edit-form #edit-original {
|
||||
font-size: 1.2em;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
#i18n-string-locale-translate-edit-form .form-item.form-type-textarea {
|
||||
width: 24%;
|
||||
display: inline-block;
|
||||
}
|
||||
span.autocomplete-deluxe-button {
|
||||
top: 0.25em;
|
||||
}
|
||||
@@ -206,6 +217,14 @@ li {
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
#user-profile-form .form-item-language,
|
||||
.node-form .form-item-language,
|
||||
#user-profile-form .form-type-select,
|
||||
.node-form .form-type-select {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
#user-profile-form .form-item-language > label,
|
||||
.node-form .form-item-language > label,
|
||||
#user-profile-form .form-type-select > label,
|
||||
@@ -219,18 +238,33 @@ li {
|
||||
vertical-align: top;
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#user-profile-form .form-item-language > label,
|
||||
.node-form .form-item-language > label,
|
||||
#user-profile-form .form-type-select > label,
|
||||
.node-form .form-type-select > label {
|
||||
width: 35%;
|
||||
width: 38%;
|
||||
text-align: left;
|
||||
}
|
||||
#user-profile-form .form-item-language > select,
|
||||
.node-form .form-item-language > select,
|
||||
#user-profile-form .form-type-select > select,
|
||||
.node-form .form-type-select > select {
|
||||
max-width: 60%;
|
||||
width: 60%;
|
||||
text-align: left;
|
||||
}
|
||||
#user-profile-form .form-item-language.form-disabled label,
|
||||
.node-form .form-item-language.form-disabled label,
|
||||
#user-profile-form .form-type-select.form-disabled label,
|
||||
.node-form .form-type-select.form-disabled label {
|
||||
margin-right: 3em;
|
||||
}
|
||||
#user-profile-form .form-item-language.form-disabled select,
|
||||
.node-form .form-item-language.form-disabled select,
|
||||
#user-profile-form .form-type-select.form-disabled select,
|
||||
.node-form .form-type-select.form-disabled select {
|
||||
margin-right: -3em;
|
||||
}
|
||||
#user-profile-form .form-type-textfield > label,
|
||||
.node-form .form-type-textfield > label,
|
||||
|
||||
@@ -64,7 +64,7 @@ select.form-select:disabled{
|
||||
border-width:0px;
|
||||
border-style:solid;
|
||||
border-color:none;
|
||||
background:#fff;
|
||||
background:#f0f0f0;
|
||||
color:#1A1A1A;
|
||||
max-width:100%;
|
||||
}
|
||||
@@ -89,6 +89,18 @@ select.form-select:focus:disabled{
|
||||
box-shadow: #fff 0 0 0px;
|
||||
}
|
||||
|
||||
#i18n-string-locale-translate-edit-form{
|
||||
position: relative;
|
||||
#edit-original{
|
||||
font-size: 1.2em;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.form-item.form-type-textarea{
|
||||
width:24%; display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
span.autocomplete-deluxe-button{top:0.25em;}
|
||||
|
||||
.fieldset {
|
||||
@@ -190,10 +202,25 @@ li{list-style: none inside url();}
|
||||
}
|
||||
|
||||
.form-item-language, .form-type-select{
|
||||
&>label, &>select{.inlineblock();}
|
||||
&>label{width:35%;}
|
||||
&>select{max-width:60%;}
|
||||
// width:100%;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
overflow-x: hidden;
|
||||
// text-align: right;
|
||||
|
||||
&>label, &>select{.inlineblock(); vertical-align: middle;}
|
||||
&>label{width:38%; text-align: left;}
|
||||
&>select{
|
||||
width:60%;
|
||||
text-align: left
|
||||
}
|
||||
|
||||
&.form-disabled{
|
||||
label{margin-right:3em; }
|
||||
select{
|
||||
margin-right:-3em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-type-textfield{
|
||||
|
||||
@@ -96,21 +96,21 @@ function guibik_preprocess_page(&$vars) {
|
||||
}
|
||||
|
||||
function guibik_preprocess_html(&$vars){
|
||||
|
||||
|
||||
$heads['icon'] = array(
|
||||
'#tag' => 'link',
|
||||
'#attributes' => array(
|
||||
'href' => base_path() . path_to_theme() .'/icon.png',
|
||||
'href' => base_path() . path_to_theme() .'/icon.png',
|
||||
'rel' => 'shortcut icon',
|
||||
'type' => 'image/png',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
$heads['apple-touch-icon'] = array(
|
||||
'#tag' => 'link',
|
||||
'#attributes' => array(
|
||||
'href' => base_path() . path_to_theme() .'/apple-touch-icon.png',
|
||||
'href' => base_path() . path_to_theme() .'/apple-touch-icon.png',
|
||||
'rel' => 'apple-touch-icon',
|
||||
),
|
||||
);
|
||||
@@ -124,7 +124,7 @@ function guibik_preprocess_views_view_table(&$vars){
|
||||
if($vars['title'] != ''){
|
||||
$vars['classes_array'][] = 'has-caption';
|
||||
}
|
||||
// dsm($vars);
|
||||
// dsm($vars);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,7 +134,7 @@ function OUT_guibik_form_element($variables) {
|
||||
$element = &$variables['element'];
|
||||
// This is also used in the installer, pre-database setup.
|
||||
$t = get_t();
|
||||
|
||||
|
||||
//dsm($element);
|
||||
|
||||
// This function is invoked as theme wrapper, but the rendered form element
|
||||
@@ -150,7 +150,7 @@ function OUT_guibik_form_element($variables) {
|
||||
// Add element's #type and #name as class to aid with JS/CSS selectors.
|
||||
if(!isset($element["#attributes"]['class']))
|
||||
$element["#attributes"]['class'] = array();
|
||||
|
||||
|
||||
$attributes['class'] = $element["#attributes"]['class'] + array('form-item');
|
||||
if (!empty($element['#type'])) {
|
||||
$attributes['class'][] = 'form-type-' . strtr($element['#type'], '_', '-');
|
||||
@@ -218,8 +218,79 @@ function guibik_field_widget_form_alter(&$element, &$form_state, $context) {
|
||||
foreach ($element as $delta => $item) {
|
||||
if(!isset($element[$delta]['#process']) || !is_array($element[$delta]['#process']))
|
||||
continue;
|
||||
|
||||
|
||||
$element[$delta]['#process'][] = "guibik_image_field_widget_process";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Theme function for the translation table.
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
function guibik_translation_table($variables) {
|
||||
$form = $variables['form'];
|
||||
$rows = array();
|
||||
$header = $form['header']['#value'];
|
||||
$languages = $form['languages']['#value'];
|
||||
|
||||
foreach (element_children($form['strings']) as $key) {
|
||||
// Build the table row.
|
||||
$row = array();
|
||||
$row['data'][] = array('data' => drupal_render($form['strings'][$key]['source']), 'class' => 'translation-source');
|
||||
|
||||
foreach ($languages as $lang_code => $lang_name) {
|
||||
$row['data'][] = array('data' => drupal_render($form['strings'][$key][$lang_code]), 'class' => 'translation-'. $lang_code);
|
||||
};
|
||||
$location = explode(':', $form['strings'][$key]['location']['#value']);
|
||||
if (count($location) == 4) {
|
||||
switch ($location[1]) {
|
||||
case 'term':
|
||||
$row['data'][] = l(t('Edit source'), 'admin/content/taxonomy/edit/term/'. $location[1], array('attributes' => array('title' => t('Edit term (@property)', array('@property' => t($location[2]))))));
|
||||
break;
|
||||
|
||||
case 'vocabulary':
|
||||
$row['data'][] = l(t('Edit source'), 'admin/content/taxonomy/edit/vocabulary/'. $location[1], array('attributes' => array('title' => t('Edit vocabulary (@property)', array('@property' => t($location[2]))))));
|
||||
break;
|
||||
|
||||
case 'item':
|
||||
$row['data'][] = l(t('Edit source'), 'admin/build/menu/item/'. $location[1] .'/edit', array('attributes' => array('title' => t('Edit menu item (@property)', array('@property' => t($location[2]))))));
|
||||
break;
|
||||
|
||||
case 'type':
|
||||
$node_types = node_type_get_names();
|
||||
$node_type = isset($node_types[$location[1]]) ? $node_types[$location[1]] : $location[1];
|
||||
$row['data'][] = l(t('Edit source'), 'admin/content/node-type/'. $location[1], array('attributes' => array('title' => t('Edit @node_type (@property)', array('@node_type' => $node_type, '@property' => t($location[2]))))));
|
||||
break;
|
||||
|
||||
default:
|
||||
$row['data'][] = '';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$row['data'][] = '';
|
||||
}
|
||||
$row['data'][] = l(t('Translate'), 'admin/config/regional/translate/edit/'. $key);
|
||||
if(user_access('delete_strings'))
|
||||
$row['data'][] = l(t('Delete string'), 'admin/config/regional/translate/delete/'. $key);
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$output = theme('table', array(
|
||||
'header' => $header,
|
||||
'rows' => $rows,
|
||||
'attributes' => array('id' => 'translation-table')
|
||||
));
|
||||
|
||||
if ($form['pager']['#markup']) {
|
||||
$output .= drupal_render($form['pager']);
|
||||
}
|
||||
$output .= drupal_render_children($form);
|
||||
|
||||
drupal_add_css(drupal_get_path('module', 'translation_table') .'/css/translation-table-admin.css');
|
||||
return $output;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user