FINAL suepr merge step : added all modules to this super repos

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 16:46:59 +02:00
7585 changed files with 1723356 additions and 18 deletions

View File

@@ -0,0 +1,91 @@
<?php
/**
* Implementation of hook_drush_command().
*/
function entity_translation_create_drush_command() {
$items['create-translations'] = array(
'description' => 'Create translations.',
'arguments' => array(
'bundle' => 'Bundle (like node type)',
),
'options' => array(
'limit' => 'limit.',
),
'aliases' => array('etcc'),
);
return $items;
}
/**
* Command callback. Generate a number of users.
*/
function drush_entity_translation_create_create_translations( $bundle = false) {
if (!$bundle) {
return drush_set_error(t('Invalid bundle.'));
}
$entity = 'node';
$limit = 100; //drush_get_option('limit') ? drush_get_option('limit') : 0;
drush_log(t('limit : @lim', array('@lim' => $limit)), 'notice');
drush_log(t('Bundle : @bun', array('@bun' => $bundle)), 'notice');
$query = db_select('entity_translation', 'et');
$query->join('node', 'n', 'n.nid = et.entity_id');
$query->fields('et');
$query->condition('et.entity_type',$entity);
$query->condition('et.source','');
$query->condition('et.language','und', '<>');
if($bundle){
$query->condition('n.type',$bundle);
}
$entities = $query->execute();
$num_translations = 0;
$i = 0;
foreach ($entities as $row) {
$trans = db_select('entity_translation', 'et')
->fields('et')
->condition('et.entity_id',$row->entity_id)
->condition('et.entity_type',$entity)
->condition('et.source',$row->language)
->execute();
$translations = 0;
foreach ($trans as $t) {
$translations++;
}
drush_log(t('count translations : @trans', array('@trans' => $translations)), 'notice');
if(!$translations){
$nid = db_insert('entity_translation') // Table name no longer needs {}
->fields(array(
'entity_id' => $row->entity_id,
'entity_type' => $row->entity_type,
'language' => $row->language == 'en' ? 'fr' : 'en',
'source' => $row->language,
'uid' => $row->uid,
'status' => $row->status,
'translate' => $row->translate,
'created' => $row->created,
'changed' => $row->changed,
))
->execute();
$num_translations ++;
}else{
drush_log(t('Entity id : @id already have a translation', array('@id' => $row->entity_id)), 'notice');
}
}
drush_log(t('Created @number translations', array('@number' => $num_translations)), 'success');
}

View File

@@ -0,0 +1,29 @@
name = Entity Translation Create
description = "Entity Translation Create"
; Core version (required)
core = 7.x
; Package name (see http://drupal.org/node/542202 for a list of names)
package = Materio
; PHP version requirement (optional)
; php = 5.2
; Loadable code files
;files[] = materio_didactique.theme.inc
;files[] = materio_didactique.forms.inc
;files[] = materio_didactique.pages.inc
;files[] = materio_didactique.admin.inc
files[] = entity_Translation_create.module
; Module dependencies
;dependencies[] = taxonomy
;dependencies[] = search_api
dependencies[] = entity_translation
; Configuration page
; configure = admin/config/materiobasemod
; For further information about configuration options, see
; - http://drupal.org/node/542202

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

View File

@@ -0,0 +1,29 @@
name = Images Styles Generation
description = "Images Styles Generation"
; Core version (required)
core = 7.x
; Package name (see http://drupal.org/node/542202 for a list of names)
package = Files
; PHP version requirement (optional)
; php = 5.2
; Loadable code files
;files[] = materio_didactique.theme.inc
;files[] = materio_didactique.forms.inc
;files[] = materio_didactique.pages.inc
;files[] = materio_didactique.admin.inc
files[] = images_styles_gen.module
; Module dependencies
;dependencies[] = taxonomy
;dependencies[] = search_api
dependencies[] = file
; Configuration page
; configure = admin/config/materiobasemod
; For further information about configuration options, see
; - http://drupal.org/node/542202

View File

@@ -0,0 +1,94 @@
<?php
/**
* Implements hook_menu().
*/
function images_styles_gen_menu() {
$items['admin/config/media/image-styles/generate'] = array(
'title' => 'pre-generate images styles',
'page callback' => 'drupal_get_form',
'page arguments' => array('images_styles_gen_settings'),
'access arguments' => array('administer image styles'),
'type' => MENU_LOCAL_ACTION,
);
return $items;
}
function images_styles_gen_settings(){
foreach(image_styles() as $style) {
$styles_options[$style['name']] = $style['name'];
}
$form['images_styles_gen_styles'] = array(
'#type'=>'select',
'#options'=>$styles_options,
'#default_value' => variable_get('images_styles_gen_styles', array()),
'#title' => t('Images styles to pre generate'),
'#multiple' => true,
);
return system_settings_form($form);
}
/**
* Implements hook_cron().
*/
function images_styles_gen_cron() {
$result = db_query('SELECT fid, uri FROM {file_managed} WHERE filemime like :mime AND status = :status', array('mime' => 'image/%', 'status' => FILE_STATUS_PERMANENT));
$queue = DrupalQueue::get('generate_images_styles');
$n = 0;
$images_styles_gen_styles = variable_get('images_styles_gen_styles', array());
watchdog('Images Styles Generate', 'active styles variable : '. print_r($images_styles_gen_styles, true), null, WATCHDOG_INFO);
foreach(image_styles() as $style) {
if( in_array($style['name'], $images_styles_gen_styles) ){
$active_styles[] = $style;
}
}
watchdog('Images Styles Generate', 'active styles : '. print_r($active_styles, true), null, WATCHDOG_INFO);
foreach ($result as $img_info) {
foreach($active_styles as $style) {
$derivative_uri = image_style_path($style['name'], $img_info->uri);
if (file_exists($derivative_uri)) continue; // skip existing files
$data = (object) array(
'style' => $style,
'img_info' => $img_info,
'derivative_uri' => $derivative_uri
);
$queue->createItem($data);
$n ++;
}
}
watchdog('Images Styles Generate', $n .' images added on cron to queue for generation.', null, WATCHDOG_INFO);
}
/**
* Implements hook_cron_queue_info().
*/
function images_styles_gen_cron_queue_info() {
$queues['generate_images_styles'] = array(
'worker callback' => '_images_styles_gen_generate',
'time' => 30
);
return $queues;
}
function _images_styles_gen_generate($data){
if (!file_exists($data->derivative_uri)) {
try {
image_style_create_derivative($data->style, $data->img_info->uri, $data->derivative_uri);
watchdog('Images Styles Generate', 'Generated : '. $data->style['name'] .' | '.$data->img_info->uri, null, WATCHDOG_INFO);
} catch (Exception $e) {
watchdog('Images Styles Generate', 'Generation error on queue : '. $data->style['name'] .' | '. $data->img_info->uri.' | '.$e->getMessage(), null, WATCHDOG_WARNING);
}
}
return true;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

View File

@@ -0,0 +1,29 @@
// Dust project settings, you can edit it and set custom settings.
{
// The mappings of source directory and output directory
"mappings": [
// {
// "src": "path/to/source",
// "dest": "path/to/output"
// }
],
// Add the ignore rules that Koala will not search them.
// e.g. ["*.json", "*.txt", "test", "path/libs"]
"ignores": [],
// Options of Compilers.
"options": {
// "key": "val",
// "key2": "val2"
// ...
},
// Other compile options.
// e.g, ["--strict-imports", ... ,"--rootpath=URL"].
// Run the command 'lessc -h' to see more options.
"custom_options": [],
// An array of filesystem paths or importers which should be searched for LESS templates imported with the @import directive.
"include_paths": ["/home/bachir/Developer/codekitframeworks/gui_ck_fw", "/home/bachir/Developer/codekitframeworks/bootstrap/less"]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

View File

@@ -0,0 +1,29 @@
name = Translate Perms
description = "The description of this module"
; Core version (required)
core = 7.x
; Package name (see http://drupal.org/node/542202 for a list of names)
; package =
; PHP version requirement (optional)
; php = 5.2
; Loadable code files
; files[] = translate_perms.module
; files[] = translate_perms.admin.inc
; files[] = translate_perms.class.inc
; Module dependencies
; dependencies[] = mymodule
; dependencies[] = theirmodule (1.2)
; dependencies[] = anothermodule (>=2.4)
; dependencies[] = views (3.x)
; Configuration page
; configure = admin/config/translate_perms
; For further information about configuration options, see
; - http://drupal.org/node/542202

View File

@@ -0,0 +1,92 @@
<?php
/**
* @file
* This is the file description for Translate Perms module.
*
* In this more verbose, multi-line description, you can specify what this
* file does exactly. Make sure to wrap your documentation in column 78 so
* that the file can be displayed nicely in default-sized consoles.
*/
/**
* Implements hook_permission().
*/
function translate_perms_permission() {
return array(
'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')
),
'import_translations' => array(
'title' => t('Import translations')
),
'refresh_strings' => array(
'title' => t('Refresh strings')
),
'update_modules_translations' => array(
'title' => t('Update modules translations')
),
'export_translations' => array(
'title' => t('Import translations')
),
);
}
/**
* Implements hook_menu_alter().
*/
function translate_perms_menu_alter(&$items) {
if(isset($items['admin/config/regional/translate']))
$items['admin/config/regional/translate']['access arguments'] = array('access_translations_overview');
if(isset($items['admin/config/regional/translate/table']))
$items['admin/config/regional/translate/table']['access arguments'] = array('access_translation_table_fields');
if(isset($items['admin/config/regional/translate/table/nodetype']))
$items['admin/config/regional/translate/table/nodetype']['access arguments'] = array('access_translation_table_content_type');
if(isset($items['admin/config/regional/translate/table/menu']))
$items['admin/config/regional/translate/table/menu']['access arguments'] = array('access_translation_table_menu');
if(isset($items['admin/config/regional/translate/table/taxonomy']))
$items['admin/config/regional/translate/table/taxonomy']['access arguments'] = array('access_translation_table_taxonomy');
if(isset($items['admin/config/regional/translate/translate']))
$items['admin/config/regional/translate/translate']['access arguments'] = array('translate_strings');
if(isset($items['admin/config/regional/translate/import']))
$items['admin/config/regional/translate/import']['access arguments'] = array('import_translations');
if(isset($items['admin/config/regional/translate/i18n_string']))
$items['admin/config/regional/translate/i18n_string']['access arguments'] = array('refresh_strings');
if(isset($items['admin/config/regional/translate/update']))
$items['admin/config/regional/translate/update']['access arguments'] = array('update_modules_translations');
if(isset($items['admin/config/regional/translate/export']))
$items['admin/config/regional/translate/export']['access arguments'] = array('export_translations');
}