From 35e914df58d74035461e7e87e03905a562ec5945 Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Wed, 25 Nov 2015 11:34:49 +0100 Subject: [PATCH] created admon taxo view --- .../entity_translation_actions/LICENSE.txt | 339 ++++++++++++++++ .../entity_translation_actions/README.txt | 67 +++ .../entity_translation_actions.info | 12 + .../entity_translation_actions.module | 248 ++++++++++++ ...tity_translation_actions.views_default.inc | 350 ++++++++++++++++ .../EntityTranslationActionsAdd.class.php | 123 ++++++ .../et_action/EntityTranslationActionsAdd.inc | 18 + .../EntityTranslationActionsBasic.class.php | 148 +++++++ .../EntityTranslationActionsBasic.inc | 17 + .../EntityTranslationActionsDelete.class.php | 74 ++++ .../EntityTranslationActionsDelete.inc | 18 + .../EntityTranslationActionsSet.class.php | 95 +++++ .../et_action/EntityTranslationActionsSet.inc | 18 + ...dministration.features.user_permission.inc | 108 +++++ .../materio_administration.info | 56 +++ .../materio_administration.strongarm.inc | 381 ++++++++++++++++++ .../materio_administration.views_default.inc | 284 +++++++++++++ .../materiobasemod/materio_taxonomy.module | 8 +- 18 files changed, 2362 insertions(+), 2 deletions(-) create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/LICENSE.txt create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/README.txt create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.info create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.module create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.views_default.inc create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsAdd.class.php create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsAdd.inc create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsBasic.class.php create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsBasic.inc create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsDelete.class.php create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsDelete.inc create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsSet.class.php create mode 100644 sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsSet.inc diff --git a/sites/all/modules/contrib/views/entity_translation_actions/LICENSE.txt b/sites/all/modules/contrib/views/entity_translation_actions/LICENSE.txt new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/LICENSE.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/sites/all/modules/contrib/views/entity_translation_actions/README.txt b/sites/all/modules/contrib/views/entity_translation_actions/README.txt new file mode 100644 index 00000000..7129c88b --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/README.txt @@ -0,0 +1,67 @@ + +INTRODUCTION +------------ + +Module provides actions for management translations of entities using Views Bulk +Operations module. + +* For a full description of the module, visit the project page: + http://drupal.org/project/entity_translation_actions +* To submit bug reports and feature suggestions, or to track changes: + http://drupal.org/project/issues/entity_translation_actions + + +REQUIREMENTS +------------ + +This module requires the following modules: + * Entity translations (https://drupal.org/project/entity_translation); + * Views Bulk Operations (https://drupal.org/project/views_bulk_operations). + + +INSTALLATION +------------ + +Install as usual, see +https://drupal.org/documentation/install/modules-themes/modules-7 +for further information. + + +CONFIGURATION +------------- + +Create new view for entities list in Administration » Structure » Views +» Add ( /admin/structure/views/add ). + + - Select type of entity. Click "Continue & edit". + - For a new view add field "Bulk operations". + - In group "Selected bulk operations" enable option "Modify entity + translations". + - Add other fields and filters for view. + + +USAGE +----- + +Got to page of created view. Select list of entities and apply operation +"Modify entity translations". On next page select operation from a list. + +* Add translation. This operation will copy existed translation and create new + translation for selected language. + +* Set translation. This operation will update entity language. + If translation for selected language doesn`t exist - it will be created based + on old entity language. + +* Delete translation. This operation will delete translation for selected + language. + If selected language equal to entity language - entity language will be set + to "und". + + +CONTACT +------- + +Current maintainers: +* Adyax (Open Source Experts) - https://drupal.org/marketplace/adyax +* Vitalii Tkachenko (vtkachenko) - https://drupal.org/user/2921049 diff --git a/sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.info b/sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.info new file mode 100644 index 00000000..24ccfb3c --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.info @@ -0,0 +1,12 @@ +name = Entity translation actions +description = Provide actions for entity translation. +core = 7.x +dependencies[] = entity_translation +dependencies[] = views_bulk_operations + +; Information added by Drupal.org packaging script on 2014-08-06 +version = "7.x-1.0" +core = "7.x" +project = "entity_translation_actions" +datestamp = "1407310128" + diff --git a/sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.module b/sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.module new file mode 100644 index 00000000..a3f71b6c --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.module @@ -0,0 +1,248 @@ + '3.0'); +} + +/** + * Implements hook_menu(). + */ +function entity_translation_actions_menu() { + + // Page with list of available views. + $items['admin/content/entity-translations'] = array( + 'title' => 'Entity translations', + 'description' => 'Manage entity translations.', + 'page callback' => 'system_admin_menu_block_page', + 'access arguments' => array('administer entity translation'), + 'file' => 'system.admin.inc', + 'file path' => drupal_get_path('module', 'system'), + ); + + return $items; +} + +/** + * Implements hook_action_info(). + * + * Registers custom VBO translation actions as Drupal actions. + */ +function entity_translation_actions_action_info() { + + $actions['entity_translation_actions_modify_action'] = array( + 'type' => 'entity', + 'label' => t('Modify entity translations'), + 'behavior' => array('changes_property'), + 'configurable' => TRUE, + 'vbo_configurable' => TRUE, + 'triggers' => array('any'), + ); + + return $actions; +} + +/** + * Implements hook_ctools_plugin_type(). + * + * Define ctools plugin type. + */ +function entity_translation_actions_ctools_plugin_type() { + return array( + 'et_action' => array( + 'use hooks' => FALSE, + 'classes' => array('handler'), + ), + ); +} + +/** + * Implements hook_ctools_plugin_directory(). + * + * Define plugins with basic translation actions. + */ +function entity_translation_actions_ctools_plugin_directory($owner, $plugin_type) { + + switch ($owner) { + case 'entity_translation_actions': + if (in_array($plugin_type, array('et_action'))) { + return 'plugins/' . $plugin_type; + } + break; + } +} + +/** + * Function returns plugin instance by it id. + */ +function entity_translation_actions_plugin($id) { + ctools_include('plugins'); + $plugin = ctools_get_plugins('entity_translation_actions', 'et_action', $id); + return $plugin; +} + +/** + * Function returns all plugin instances. + */ +function entity_translation_actions_plugins() { + ctools_include('plugins'); + $plugins = ctools_get_plugins('entity_translation_actions', 'et_action'); + + // Order list of plugins according to propertie "weight". + uasort($plugins, '_user_sort'); + return $plugins; +} + +/** + * Action callback function. + * + * Goes through list of entities and apply action of selected handler. + */ +function entity_translation_actions_modify_action($entity, $context) { + $context['action_handler']->action($entity, $context); +} + +/** + * Action form function. + * + * Form provide list of available actions. Form rebuilds according to selected + * plugin. + */ +function entity_translation_actions_modify_action_form($context, &$form_state) { + + $form = array(); + $form_state['entity_type'] = $entity_type = $context['entity_type']; + + $settings = isset($form_state['values']['settings']) ? $form_state['values']['settings'] : array( + 'action' => FALSE, + ); + + $form['settings'] = array( + '#tree' => 1, + ); + + $action_options = array( + '' => t('None'), + ); + + foreach (entity_translation_actions_plugins() as $plugin_name => $plugin) { + $class = ctools_plugin_get_class($plugin, 'handler'); + + if (!$class) { + continue; + } + + $handler = new $class($entity_type, array()); + if ($handler->available()) { + $action_options[$plugin_name] = $plugin['title']; + } + } + + $form['settings']['action'] = array( + '#type' => 'radios', + '#title' => t('Select action'), + '#options' => $action_options, + '#default_value' => $settings['action'], + '#required' => TRUE, + '#multiple' => FALSE, + '#ajax' => array( + 'callback' => 'entity_translation_actions_modify_action_ajax_callback', + ), + ); + + // Check if any plugin selected. + if (!empty($settings['action'])) { + $settings += array($settings['action'] => array()); + + // Build plugin handler. + $plugin = entity_translation_actions_plugin($settings['action']); + $class = ctools_plugin_get_class($plugin, 'handler'); + $handler = new $class($entity_type, $settings[$settings['action']]); + + // Keep handler object during whole process, + $form_state['action_handler'] = $handler; + + // Generate custom form for selected plugin. + $form['settings'][$settings['action']] = array( + '#type' => 'fieldset', + '#title' => $action_options[$settings['action']], + '#description' => $plugin['description'], + ); + $handler->formBuild($form['settings'][$settings['action']], $form_state); + } + + return $form; +} + +/** + * Ajax callback for entity_translation_actions_modify_action_form. + * + * Function rebuilds form and returns replace command. + */ +function entity_translation_actions_modify_action_ajax_callback($form, &$form_state) { + + $commands[] = ajax_command_replace('form:has(input[value="' . $form['#build_id'] . '"])', render($form)); + return array('#type' => 'ajax', '#commands' => $commands); +} + +/** + * Validate callback for entity_translation_actions_modify_action_form. + * + * Allow plugin to execute validate function. + */ +function entity_translation_actions_modify_action_validate($form, &$form_state) { + if (isset($form_state['action_handler'])) { + $form_state['action_handler']->formValidate($form, $form_state); + } +} + +/** + * Submit callback for entity_translation_actions_modify_action_form. + * + * Allow plugin to execute submit function. Return context for VBO action. + */ +function entity_translation_actions_modify_action_submit($form, $form_state) { + + if (isset($form_state['action_handler'])) { + + $settings = &$form_state['values']['settings']; + + // Name of selected action. + $action = $settings['action']; + + // Options for selected action. + $options = isset($settings[$action]) ? $settings[$action] : array(); + + // Execute plugin specific actions on submit. + $form_state['action_handler']->formSubmit($form, $form_state, $options); + + // Return handler object as context. + return array( + 'action_handler' => $form_state['action_handler'], + ); + } +} diff --git a/sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.views_default.inc b/sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.views_default.inc new file mode 100644 index 00000000..996d2118 --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/entity_translation_actions.views_default.inc @@ -0,0 +1,350 @@ +name = 'entity_translation_actions_node'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'node'; + $view->human_name = 'Entity translation actions: Node'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['title'] = 'Entity translation actions: Node'; + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['pager']['options']['items_per_page'] = '50'; + $handler->display->display_options['style_plugin'] = 'table'; + $handler->display->display_options['style_options']['columns'] = array( + 'views_bulk_operations' => 'views_bulk_operations', + 'changed_1' => 'changed_1', + 'type' => 'type', + 'title' => 'title', + 'language_1' => 'language_1', + 'source' => 'source', + 'language' => 'language', + 'translate_link' => 'translate_link', + 'edit_node' => 'edit_node', + ); + $handler->display->display_options['style_options']['default'] = 'changed_1'; + $handler->display->display_options['style_options']['info'] = array( + 'views_bulk_operations' => array( + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'changed_1' => array( + 'sortable' => 1, + 'default_sort_order' => 'desc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'type' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'title' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'language_1' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'source' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'language' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'translate_link' => array( + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'edit_node' => array( + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + ); + /* Relationship: Content: Entity translation: translations */ + $handler->display->display_options['relationships']['entity_translations']['id'] = 'entity_translations'; + $handler->display->display_options['relationships']['entity_translations']['table'] = 'node'; + $handler->display->display_options['relationships']['entity_translations']['field'] = 'entity_translations'; + /* Field: Bulk operations: Content */ + $handler->display->display_options['fields']['views_bulk_operations']['id'] = 'views_bulk_operations'; + $handler->display->display_options['fields']['views_bulk_operations']['table'] = 'node'; + $handler->display->display_options['fields']['views_bulk_operations']['field'] = 'views_bulk_operations'; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['display_type'] = '1'; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['enable_select_all_pages'] = 1; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['force_single'] = 0; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10'; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_operations'] = array( + 'action::node_assign_owner_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::views_bulk_operations_delete_item' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::views_bulk_operations_delete_revision' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::views_bulk_operations_script_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::node_make_sticky_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::node_make_unsticky_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::entity_translation_actions_modify_action' => array( + 'selected' => 1, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::views_bulk_operations_modify_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + 'settings' => array( + 'show_all_tokens' => 1, + 'display_values' => array( + '_all_' => '_all_', + ), + ), + ), + 'action::views_bulk_operations_argument_selector_action' => array( + 'selected' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + 'settings' => array( + 'url' => '', + ), + ), + 'action::node_promote_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::node_publish_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::node_unpromote_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::node_save_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::system_send_email_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::node_unpublish_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::node_unpublish_by_keyword_action' => array( + 'selected' => 0, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + ); + /* Field: Content: Updated date */ + $handler->display->display_options['fields']['changed_1']['id'] = 'changed_1'; + $handler->display->display_options['fields']['changed_1']['table'] = 'node'; + $handler->display->display_options['fields']['changed_1']['field'] = 'changed'; + $handler->display->display_options['fields']['changed_1']['date_format'] = 'raw time ago'; + /* Field: Content: Type */ + $handler->display->display_options['fields']['type']['id'] = 'type'; + $handler->display->display_options['fields']['type']['table'] = 'node'; + $handler->display->display_options['fields']['type']['field'] = 'type'; + /* Field: Content: Title */ + $handler->display->display_options['fields']['title']['id'] = 'title'; + $handler->display->display_options['fields']['title']['table'] = 'node'; + $handler->display->display_options['fields']['title']['field'] = 'title'; + $handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; + $handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; + /* Field: Content: Language */ + $handler->display->display_options['fields']['language_1']['id'] = 'language_1'; + $handler->display->display_options['fields']['language_1']['table'] = 'node'; + $handler->display->display_options['fields']['language_1']['field'] = 'language'; + $handler->display->display_options['fields']['language_1']['label'] = 'Node Language'; + /* Field: Entity translation: Source */ + $handler->display->display_options['fields']['source']['id'] = 'source'; + $handler->display->display_options['fields']['source']['table'] = 'entity_translation'; + $handler->display->display_options['fields']['source']['field'] = 'source'; + $handler->display->display_options['fields']['source']['relationship'] = 'entity_translations'; + $handler->display->display_options['fields']['source']['label'] = 'Source Language'; + /* Field: Entity translation: Language */ + $handler->display->display_options['fields']['language']['id'] = 'language'; + $handler->display->display_options['fields']['language']['table'] = 'entity_translation'; + $handler->display->display_options['fields']['language']['field'] = 'language'; + $handler->display->display_options['fields']['language']['relationship'] = 'entity_translations'; + $handler->display->display_options['fields']['language']['label'] = 'Translation Language'; + /* Field: Entity translation: Translate link */ + $handler->display->display_options['fields']['translate_link']['id'] = 'translate_link'; + $handler->display->display_options['fields']['translate_link']['table'] = 'entity_translation'; + $handler->display->display_options['fields']['translate_link']['field'] = 'translate_link'; + $handler->display->display_options['fields']['translate_link']['relationship'] = 'entity_translations'; + /* Field: Content: Edit link */ + $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node'; + $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node'; + $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node'; + /* Filter criterion: Content: Title */ + $handler->display->display_options['filters']['title']['id'] = 'title'; + $handler->display->display_options['filters']['title']['table'] = 'node'; + $handler->display->display_options['filters']['title']['field'] = 'title'; + $handler->display->display_options['filters']['title']['operator'] = 'contains'; + $handler->display->display_options['filters']['title']['group'] = 1; + $handler->display->display_options['filters']['title']['exposed'] = TRUE; + $handler->display->display_options['filters']['title']['expose']['operator_id'] = 'title_op'; + $handler->display->display_options['filters']['title']['expose']['label'] = 'Title'; + $handler->display->display_options['filters']['title']['expose']['operator'] = 'title_op'; + $handler->display->display_options['filters']['title']['expose']['identifier'] = 'title'; + + /* Filter criterion: Content: Type */ + $handler->display->display_options['filters']['type']['id'] = 'type'; + $handler->display->display_options['filters']['type']['table'] = 'node'; + $handler->display->display_options['filters']['type']['field'] = 'type'; + $handler->display->display_options['filters']['type']['group'] = 1; + $handler->display->display_options['filters']['type']['exposed'] = TRUE; + $handler->display->display_options['filters']['type']['expose']['operator_id'] = 'type_op'; + $handler->display->display_options['filters']['type']['expose']['label'] = 'Type'; + $handler->display->display_options['filters']['type']['expose']['operator'] = 'type_op'; + $handler->display->display_options['filters']['type']['expose']['identifier'] = 'type'; + $handler->display->display_options['filters']['type']['expose']['multiple'] = TRUE; + + /* Filter criterion: Content: Language */ + $handler->display->display_options['filters']['language_1']['id'] = 'language_1'; + $handler->display->display_options['filters']['language_1']['table'] = 'node'; + $handler->display->display_options['filters']['language_1']['field'] = 'language'; + $handler->display->display_options['filters']['language_1']['group'] = 1; + $handler->display->display_options['filters']['language_1']['exposed'] = TRUE; + $handler->display->display_options['filters']['language_1']['expose']['operator_id'] = 'language_1_op'; + $handler->display->display_options['filters']['language_1']['expose']['label'] = 'Node Language'; + $handler->display->display_options['filters']['language_1']['expose']['operator'] = 'language_1_op'; + $handler->display->display_options['filters']['language_1']['expose']['identifier'] = 'language_1'; + + /* Filter criterion: Entity translation: Source */ + $handler->display->display_options['filters']['source']['id'] = 'source'; + $handler->display->display_options['filters']['source']['table'] = 'entity_translation'; + $handler->display->display_options['filters']['source']['field'] = 'source'; + $handler->display->display_options['filters']['source']['relationship'] = 'entity_translations'; + $handler->display->display_options['filters']['source']['group'] = 1; + $handler->display->display_options['filters']['source']['exposed'] = TRUE; + $handler->display->display_options['filters']['source']['expose']['operator_id'] = 'source_op'; + $handler->display->display_options['filters']['source']['expose']['label'] = 'Source Language'; + $handler->display->display_options['filters']['source']['expose']['operator'] = 'source_op'; + $handler->display->display_options['filters']['source']['expose']['identifier'] = 'source'; + + /* Filter criterion: Entity translation: Language */ + $handler->display->display_options['filters']['language']['id'] = 'language'; + $handler->display->display_options['filters']['language']['table'] = 'entity_translation'; + $handler->display->display_options['filters']['language']['field'] = 'language'; + $handler->display->display_options['filters']['language']['relationship'] = 'entity_translations'; + $handler->display->display_options['filters']['language']['group'] = 1; + $handler->display->display_options['filters']['language']['exposed'] = TRUE; + $handler->display->display_options['filters']['language']['expose']['operator_id'] = 'language_op'; + $handler->display->display_options['filters']['language']['expose']['label'] = 'Translation Language'; + $handler->display->display_options['filters']['language']['expose']['operator'] = 'language_op'; + $handler->display->display_options['filters']['language']['expose']['identifier'] = 'language'; + + /* Display: Page */ + $handler = $view->new_display('page', 'Page', 'page'); + $handler->display->display_options['path'] = 'admin/content/entity-translations/node'; + $handler->display->display_options['menu']['type'] = 'normal'; + $handler->display->display_options['menu']['title'] = 'Entity translation actions: Node'; + $handler->display->display_options['menu']['name'] = 'management'; + + $export['entity_languages_node'] = $view; + + return $export; +} diff --git a/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsAdd.class.php b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsAdd.class.php new file mode 100644 index 00000000..1420fd8f --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsAdd.class.php @@ -0,0 +1,123 @@ +entityType); + } + + /** + * Function function executes plugin actions. + */ + public function action($entity, $context, $handler = NULL) { + + $handler = $handler ? $handler : entity_translation_get_handler($this->entityType, $entity); + + $lang_source = ($this->options['source'] == '-entity-') ? $this->entityLanguage($entity, $handler, FALSE) : $this->options['source']; + $language_target = ($this->options['language'] == '-entity-') ? $this->entityLanguage($entity, $handler, FALSE) : $this->options['language']; + + if ($lang_source == $language_target) { + return; + } + + $translations = $handler->getTranslations(); + + // No source translation; + if ((!$lang_source || !$translations || !isset($translations->data[$lang_source])) && $lang_source != LANGUAGE_NONE) { + return ENTITY_TRANSLATION_ACTIONS_RESULT_NO_SOURCE; + } + + // Target translation exists; + if (isset($translations->data[$language_target]) && $this->options['translation_exists'] == ENTITY_TRANSLATION_ACTIONS_TRANSLATION_SKIP) { + return ENTITY_TRANSLATION_ACTIONS_RESULT_EXISTS; + } + + list(,, $bundle_name) = entity_extract_ids($this->entityType, $entity); + + // Clone field translations. + foreach (field_info_instances($this->entityType, $bundle_name) as $instance) { + $field_name = $instance['field_name']; + $field = field_info_field($field_name); + + if ($field['translatable']) { + $original_item = isset($entity->{$field_name}[$lang_source]) ? $entity->{$field_name}[$lang_source] : NULL; + + // MERGE. Add item if not empty and no value for language. + if ($original_item && !isset($entity->{$field_name}[$language_target])) { + $entity->{$field_name}[$language_target] = $original_item; + } + + // REPLACE. Replace existing value for language. + // Or remode it if source values is empty. + elseif ($this->options['translation_exists'] == ENTITY_TRANSLATION_ACTIONS_TRANSLATION_REPLACE) { + if ($original_item) { + $entity->{$field_name}[$language_target] = $original_item; + } + else { + unset($entity->{$field_name}[$language_target]); + } + } + } + } + + // Create new translation. + if ($language_target != LANGUAGE_NONE) { + $lang_entity = $handler->getLanguage(); + $new_translation = isset($translations->data[$lang_source]) ? $translations->data[$lang_source] : array(); + $new_translation['status'] = TRUE; + $new_translation['language'] = $language_target; + $new_translation['source'] = ($lang_entity == $language_target) ? FALSE : $lang_entity; + $handler->setTranslation($new_translation); + } + return ENTITY_TRANSLATION_ACTIONS_RESULT_CREATED; + } + + /** + * Function builds form elements for action. + */ + public function formBuild(&$form, &$form_state) { + + $options = $this->languagesOptions(); + $options_keys = array_keys($options); + + $form['source'] = array( + '#type' => 'radios', + '#options' => $options, + '#title' => t('Original language:'), + '#required' => TRUE, + '#default_value' => current($options_keys), + ); + + $form['language'] = array( + '#type' => 'radios', + '#options' => $options, + '#title' => t('New language:'), + '#required' => TRUE, + ); + + $form['translation_exists'] = array( + '#type' => 'select', + '#options' => $this->translationExistsOptions(), + '#title' => t('Actions for existing translation:'), + ); + } + + /** + * Function returns options ways for resolving conflicts in translations. + */ + protected function translationExistsOptions() { + return array( + ENTITY_TRANSLATION_ACTIONS_TRANSLATION_SKIP => t('SKIP ANY actions if translation exists'), + ENTITY_TRANSLATION_ACTIONS_TRANSLATION_REPLACE => t('REPLACE ALL existing values with new'), + ENTITY_TRANSLATION_ACTIONS_TRANSLATION_MERGE => t('ADD NEW values if existing translation is empty'), + ); + } +} diff --git a/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsAdd.inc b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsAdd.inc new file mode 100644 index 00000000..d1187b95 --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsAdd.inc @@ -0,0 +1,18 @@ + t('Translation Add'), + 'description' => t('Copy existing translation for a new language.'), + 'handler' => array( + 'class' => 'EntityTranslationActionsAdd', + 'parent' => 'EntityTranslationActionsBasic', + ), + 'single' => TRUE, + 'icon' => 'no-icon.png', + 'weight' => 1, +); diff --git a/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsBasic.class.php b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsBasic.class.php new file mode 100644 index 00000000..ff15e0d8 --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsBasic.class.php @@ -0,0 +1,148 @@ +entityType = $entity_type; + $this->options = $options; + } + + /** + * Function checks if plugin available for selected entity type. + */ + public function available() { + return FALSE; + } + + /** + * Function function executes plugin actions. + */ + public function action($entity, $context, $handler = NULL) { + + } + + /** + * Function builds form elements for action. + */ + public function formBuild(&$form, &$form_state) { + + } + + /** + * Function validates form data. + */ + public function formValidate($form, &$form_state) { + + } + + /** + * Function process form data. + */ + public function formSubmit($form, &$form_state, $options) { + $this->options = $options; + } + + /** + * Function returns entity language. + */ + public function entityLanguage($entity, $handler, $default) { + + // Get name of language field. + $language_key = $handler->getLanguageKey(); + if ($language_key) { + if (isset($entity->{$language_key}) && !empty($entity->{$language_key})) { + + // Return entity language from a propertie. + return $entity->{$language_key}; + } + } + + // Get all entity translations. + $translations = $handler->getTranslations(); + + if (!empty($translations->original)) { + + // Return entity original language. + return $translations->original; + } + else { + + // Default fallback. + return $default; + } + } + + /** + * Function returns list of available languages for translations. + */ + protected function languagesList() { + + $languages = entity_translation_languages(); + + $language_none = array(LANGUAGE_NONE => t('Language neutral')); + $languages_list = $language_none; + + foreach ($languages as $language) { + $languages_list[$language->language] = $language->name; + } + + return $languages_list; + } + + /** + * Function returns options for action form. + */ + protected function languagesOptions() { + + $languages_options = array( + '-entity-' => t('Entity language'), + ) + $this->languagesList(); + + return $languages_options; + } + +} diff --git a/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsBasic.inc b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsBasic.inc new file mode 100644 index 00000000..11a2dfff --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsBasic.inc @@ -0,0 +1,17 @@ + t('Translation Basic'), + 'description' => t('Provide basic class for all translation action plugins.'), + 'handler' => array( + 'class' => 'EntityTranslationActionsBasic', + ), + 'single' => TRUE, + 'icon' => 'no-icon.png', + 'weight' => 0, +); diff --git a/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsDelete.class.php b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsDelete.class.php new file mode 100644 index 00000000..8abbb86c --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsDelete.class.php @@ -0,0 +1,74 @@ +entityType); + } + + /** + * Function function executes plugin actions. + */ + public function action($entity, $context, $handler = NULL) { + $handler = $handler ? $handler : entity_translation_get_handler($this->entityType, $entity); + + $translations = $handler->getTranslations(); + // Set new original language if replaced language was original. + $lang_entity = $this->entityLanguage($entity, $handler, FALSE); + if ($lang_entity && in_array($lang_entity, $this->options['language'])) { + + $language_key = $handler->getLanguageKey(); + $translations->original = LANGUAGE_NONE; + $entity->{$language_key} = LANGUAGE_NONE; + + foreach ($translations->data as &$translation) { + if ($translation['language'] == LANGUAGE_NONE) { + $translation['source'] = FALSE; + $handler->setTranslation($translation); + } + elseif ($translation['source'] == $lang_entity) { + $translation['source'] = LANGUAGE_NONE; + $handler->setTranslation($translation); + } + unset($translation); + } + } + + foreach ($this->options['language'] as $language) { + $handler->removeTranslation($language); + } + + return ENTITY_ACTIONS_KIT_RESULT_DELETED; + } + + /** + * Function builds form elements for action. + */ + public function formBuild(&$form, &$form_state) { + $form['language'] = array( + '#type' => 'checkboxes', + '#options' => $this->languagesList(), + '#title' => t('Select languages:'), + '#required' => TRUE, + ); + } + + /** + * Function process form data. + * + * Filter selected language options. + */ + public function formSubmit($form, &$form_state, $options) { + parent::formSubmit($form, $form_state, $options); + $this->options['language'] = array_filter($this->options['language']); + } + +} diff --git a/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsDelete.inc b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsDelete.inc new file mode 100644 index 00000000..a67d701d --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsDelete.inc @@ -0,0 +1,18 @@ + t('Translation Delete'), + 'description' => t('Delete existing translations of entity.'), + 'handler' => array( + 'class' => 'EntityTranslationActionsDelete', + 'parent' => 'EntityTranslationActionsBasic', + ), + 'single' => TRUE, + 'icon' => 'no-icon.png', + 'weight' => 3, +); diff --git a/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsSet.class.php b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsSet.class.php new file mode 100644 index 00000000..714b6470 --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsSet.class.php @@ -0,0 +1,95 @@ +entityType); + } + + /** + * Function function executes plugin actions. + */ + public function action($entity, $context, $handler = NULL) { + + $handler = $handler ? $handler : entity_translation_get_handler($this->entityType, $entity); + + $lang_source = $this->entityLanguage($entity, $handler, FALSE); + + if ($lang_source == $this->options['target']) { + return ENTITY_TRANSLATION_ACTIONS_RESULT_EQUAL; + } + + $translations = $handler->getTranslations(); + + // Add translation for new language if it doesn`t exist. + if (!isset($translations->data[$this->options['target']]) && $lang_source && $this->options['target'] != LANGUAGE_NONE) { + + $options_add = array( + 'source' => $lang_source, + 'language' => $this->options['target'], + 'translation_exists' => ENTITY_TRANSLATION_ACTIONS_TRANSLATION_REPLACE, + ); + + $add_plugin = entity_translation_actions_plugin('EntityTranslationActionsAdd'); + $add_class = ctools_plugin_get_class($add_plugin, 'handler'); + if ($add_class) { + $add_handler = new $add_class($this->entityType, $options_add); + $add_handler->action($entity, $context, $handler); + } + } + + // Set original translation for entity. + $language_key = $handler->getLanguageKey(); + $translations->original = $this->options['target']; + $entity->{$language_key} = $this->options['target']; + + // Process entity translations. + foreach ($translations->data as &$translation) { + + if ($translation['language'] == LANGUAGE_NONE && $this->options['target'] != LANGUAGE_NONE) { + + // Remove translation for language_none if new language is not empty. + $handler->removeTranslation($translation['language']); + } + elseif ($translation['language'] == $this->options['target']) { + + // Remove source from translation for new language. It will be original. + $translation['source'] = FALSE; + $handler->setTranslation($translation); + } + else { + + // Set source language for other translations. + $translation['source'] = $this->options['target']; + $handler->setTranslation($translation); + } + + // Delete reference to translation in order to prevent mix of data. + unset($translation); + } + + return ENTITY_TRANSLATION_ACTIONS_RESULT_REPLACED; + } + + /** + * Function builds form elements for action. + */ + public function formBuild(&$form, &$form_state) { + + $form['target'] = array( + '#type' => 'radios', + '#options' => $this->languagesList(), + '#title' => t('Select language:'), + '#required' => TRUE, + ); + } + +} diff --git a/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsSet.inc b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsSet.inc new file mode 100644 index 00000000..c4f1bf62 --- /dev/null +++ b/sites/all/modules/contrib/views/entity_translation_actions/plugins/et_action/EntityTranslationActionsSet.inc @@ -0,0 +1,18 @@ + t('Translation Set'), + 'description' => t('Set source language for entity.'), + 'handler' => array( + 'class' => 'EntityTranslationActionsSet', + 'parent' => 'EntityTranslationActionsBasic', + ), + 'single' => TRUE, + 'icon' => 'no-icon.png', + 'weight' => 2, +); diff --git a/sites/all/modules/features/materio_administration/materio_administration.features.user_permission.inc b/sites/all/modules/features/materio_administration/materio_administration.features.user_permission.inc index 9b91d5e5..4f6c00e4 100644 --- a/sites/all/modules/features/materio_administration/materio_administration.features.user_permission.inc +++ b/sites/all/modules/features/materio_administration/materio_administration.features.user_permission.inc @@ -29,6 +29,15 @@ function materio_administration_user_default_permissions() { 'module' => 'workflow_views', ); + // Exported permission: 'administer entity translation'. + $permissions['administer entity translation'] = array( + 'name' => 'administer entity translation', + 'roles' => array( + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + // Exported permission: 'administer workflow'. $permissions['administer workflow'] = array( 'name' => 'administer workflow', @@ -136,6 +145,66 @@ function materio_administration_user_default_permissions() { 'module' => 'admin_menu', ); + // Exported permission: 'edit node original values'. + $permissions['edit node original values'] = array( + 'name' => 'edit node original values', + 'roles' => array( + 'administrator' => 'administrator', + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + + // Exported permission: 'edit node translation shared fields'. + $permissions['edit node translation shared fields'] = array( + 'name' => 'edit node translation shared fields', + 'roles' => array( + 'administrator' => 'administrator', + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + + // Exported permission: 'edit original values'. + $permissions['edit original values'] = array( + 'name' => 'edit original values', + 'roles' => array( + 'administrator' => 'administrator', + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + + // Exported permission: 'edit taxonomy_term original values'. + $permissions['edit taxonomy_term original values'] = array( + 'name' => 'edit taxonomy_term original values', + 'roles' => array( + 'administrator' => 'administrator', + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + + // Exported permission: 'edit taxonomy_term translation shared fields'. + $permissions['edit taxonomy_term translation shared fields'] = array( + 'name' => 'edit taxonomy_term translation shared fields', + 'roles' => array( + 'administrator' => 'administrator', + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + + // Exported permission: 'edit translation shared fields'. + $permissions['edit translation shared fields'] = array( + 'name' => 'edit translation shared fields', + 'roles' => array( + 'administrator' => 'administrator', + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + // Exported permission: 'flush caches'. $permissions['flush caches'] = array( 'name' => 'flush caches', @@ -241,5 +310,44 @@ function materio_administration_user_default_permissions() { 'module' => 'materio_user', ); + // Exported permission: 'toggle field translatability'. + $permissions['toggle field translatability'] = array( + 'name' => 'toggle field translatability', + 'roles' => array( + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + + // Exported permission: 'translate any entity'. + $permissions['translate any entity'] = array( + 'name' => 'translate any entity', + 'roles' => array( + 'administrator' => 'administrator', + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + + // Exported permission: 'translate node entities'. + $permissions['translate node entities'] = array( + 'name' => 'translate node entities', + 'roles' => array( + 'administrator' => 'administrator', + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + + // Exported permission: 'translate taxonomy_term entities'. + $permissions['translate taxonomy_term entities'] = array( + 'name' => 'translate taxonomy_term entities', + 'roles' => array( + 'administrator' => 'administrator', + 'root' => 'root', + ), + 'module' => 'entity_translation', + ); + return $permissions; } diff --git a/sites/all/modules/features/materio_administration/materio_administration.info b/sites/all/modules/features/materio_administration/materio_administration.info index 9f141bbf..8e905af7 100644 --- a/sites/all/modules/features/materio_administration/materio_administration.info +++ b/sites/all/modules/features/materio_administration/materio_administration.info @@ -7,6 +7,9 @@ dependencies[] = admin_menu_source dependencies[] = admin_menu_toolbar dependencies[] = ctools dependencies[] = elysia_cron +dependencies[] = entity_translation +dependencies[] = entity_translation_actions +dependencies[] = entity_translation_export_import dependencies[] = features dependencies[] = login_destination dependencies[] = logintoboggan @@ -58,6 +61,7 @@ features[menu_links][] = navigation_users:admin/people features[menu_links][] = navigation_users:admin/users features[user_permission][] = access administration menu features[user_permission][] = access workflow summary views +features[user_permission][] = administer entity translation features[user_permission][] = administer workflow features[user_permission][] = assign Adhérent role features[user_permission][] = assign Contact opérationnel role @@ -69,6 +73,12 @@ features[user_permission][] = assign Utilisateur role features[user_permission][] = assign administrator role features[user_permission][] = assign all roles features[user_permission][] = display drupal links +features[user_permission][] = edit node original values +features[user_permission][] = edit node translation shared fields +features[user_permission][] = edit original values +features[user_permission][] = edit taxonomy_term original values +features[user_permission][] = edit taxonomy_term translation shared fields +features[user_permission][] = edit translation shared fields features[user_permission][] = flush caches features[user_permission][] = participate in workflow features[user_permission][] = schedule workflow transitions @@ -78,6 +88,10 @@ features[user_permission][] = subscribe to newsletters features[user_permission][] = subscribe to simplenews category 6274 features[user_permission][] = subscribe to simplenews category 6374 features[user_permission][] = subscribe to simplenews category 6585 +features[user_permission][] = toggle field translatability +features[user_permission][] = translate any entity +features[user_permission][] = translate node entities +features[user_permission][] = translate taxonomy_term entities features[variable][] = admin_menu_cache_client features[variable][] = admin_menu_devel_modules_enabled features[variable][] = admin_menu_devel_modules_skip @@ -92,6 +106,47 @@ features[variable][] = content_type_extras_title_hide_breve features[variable][] = content_type_extras_title_hide_company features[variable][] = content_type_extras_title_hide_didactique features[variable][] = content_type_extras_title_hide_materiau +features[variable][] = entity_translation_entity_types +features[variable][] = entity_translation_hide_translation_links_breve +features[variable][] = entity_translation_hide_translation_links_company +features[variable][] = entity_translation_hide_translation_links_didactique +features[variable][] = entity_translation_hide_translation_links_faq +features[variable][] = entity_translation_hide_translation_links_looping_embed_video +features[variable][] = entity_translation_hide_translation_links_materiau +features[variable][] = entity_translation_hide_translation_links_page +features[variable][] = entity_translation_hide_translation_links_simplenews +features[variable][] = entity_translation_hide_translation_links_static_page_plaintext +features[variable][] = entity_translation_hide_translation_links_webform +features[variable][] = entity_translation_node_metadata_breve +features[variable][] = entity_translation_node_metadata_company +features[variable][] = entity_translation_node_metadata_contact_operationnel +features[variable][] = entity_translation_node_metadata_didactique +features[variable][] = entity_translation_node_metadata_faq +features[variable][] = entity_translation_node_metadata_looping_embed_video +features[variable][] = entity_translation_node_metadata_materiau +features[variable][] = entity_translation_node_metadata_page +features[variable][] = entity_translation_node_metadata_simplenews +features[variable][] = entity_translation_node_metadata_static_page_plaintext +features[variable][] = entity_translation_node_metadata_webform +features[variable][] = entity_translation_revision_enabled +features[variable][] = entity_translation_settings_node__breve +features[variable][] = entity_translation_settings_node__company +features[variable][] = entity_translation_settings_node__didactique +features[variable][] = entity_translation_settings_node__faq +features[variable][] = entity_translation_settings_node__looping_embed_video +features[variable][] = entity_translation_settings_node__materiau +features[variable][] = entity_translation_settings_node__page +features[variable][] = entity_translation_settings_node__publication +features[variable][] = entity_translation_settings_node__webform +features[variable][] = entity_translation_settings_taxonomy_term__catalog +features[variable][] = entity_translation_settings_taxonomy_term__company +features[variable][] = entity_translation_settings_taxonomy_term__faq_categories +features[variable][] = entity_translation_settings_taxonomy_term__newsletter +features[variable][] = entity_translation_settings_taxonomy_term__onthologie +features[variable][] = entity_translation_settings_taxonomy_term__tag_libres +features[variable][] = entity_translation_shared_labels +features[variable][] = entity_translation_show_fallback_on_overview_pages +features[variable][] = entity_translation_workflow_enabled features[variable][] = login_destination_immediate_redirect features[variable][] = login_destination_preserve_destination features[variable][] = logintoboggan_confirm_email_at_registration @@ -124,5 +179,6 @@ features[variable][] = workflow_webform features[views_view][] = admin_content_node features[views_view][] = admin_contents features[views_view][] = admin_peoples +features[views_view][] = admin_taxo features[views_view][] = taxonomy_companies_manager project path = sites/all/modules/features diff --git a/sites/all/modules/features/materio_administration/materio_administration.strongarm.inc b/sites/all/modules/features/materio_administration/materio_administration.strongarm.inc index 273a3eaf..265af686 100644 --- a/sites/all/modules/features/materio_administration/materio_administration.strongarm.inc +++ b/sites/all/modules/features/materio_administration/materio_administration.strongarm.inc @@ -120,6 +120,387 @@ function materio_administration_strongarm() { $strongarm->value = 0; $export['content_type_extras_title_hide_materiau'] = $strongarm; + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_entity_types'; + $strongarm->value = array( + 'node' => 'node', + 'taxonomy_term' => 'taxonomy_term', + 'user' => 0, + ); + $export['entity_translation_entity_types'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_hide_translation_links_breve'; + $strongarm->value = 1; + $export['entity_translation_hide_translation_links_breve'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_hide_translation_links_company'; + $strongarm->value = 1; + $export['entity_translation_hide_translation_links_company'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_hide_translation_links_didactique'; + $strongarm->value = 0; + $export['entity_translation_hide_translation_links_didactique'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_hide_translation_links_faq'; + $strongarm->value = 1; + $export['entity_translation_hide_translation_links_faq'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_hide_translation_links_looping_embed_video'; + $strongarm->value = 0; + $export['entity_translation_hide_translation_links_looping_embed_video'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_hide_translation_links_materiau'; + $strongarm->value = 1; + $export['entity_translation_hide_translation_links_materiau'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_hide_translation_links_page'; + $strongarm->value = 1; + $export['entity_translation_hide_translation_links_page'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_hide_translation_links_simplenews'; + $strongarm->value = 0; + $export['entity_translation_hide_translation_links_simplenews'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_hide_translation_links_static_page_plaintext'; + $strongarm->value = 1; + $export['entity_translation_hide_translation_links_static_page_plaintext'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_hide_translation_links_webform'; + $strongarm->value = 0; + $export['entity_translation_hide_translation_links_webform'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_breve'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_breve'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_company'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_company'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_contact_operationnel'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_contact_operationnel'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_didactique'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_didactique'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_faq'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_faq'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_looping_embed_video'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_looping_embed_video'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_materiau'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_materiau'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_page'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_page'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_simplenews'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_simplenews'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_static_page_plaintext'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_static_page_plaintext'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_node_metadata_webform'; + $strongarm->value = '0'; + $export['entity_translation_node_metadata_webform'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_revision_enabled'; + $strongarm->value = FALSE; + $export['entity_translation_revision_enabled'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_node__breve'; + $strongarm->value = array( + 'default_language' => 'und', + 'hide_language_selector' => 0, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_node__breve'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_node__company'; + $strongarm->value = array( + 'default_language' => 'und', + 'hide_language_selector' => 0, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_node__company'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_node__didactique'; + $strongarm->value = array( + 'default_language' => 'und', + 'hide_language_selector' => 0, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_node__didactique'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_node__faq'; + $strongarm->value = array( + 'default_language' => 'und', + 'hide_language_selector' => 0, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_node__faq'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_node__looping_embed_video'; + $strongarm->value = array( + 'default_language' => 'und', + 'hide_language_selector' => 0, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_node__looping_embed_video'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_node__materiau'; + $strongarm->value = array( + 'default_language' => 'und', + 'hide_language_selector' => 0, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_node__materiau'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_node__page'; + $strongarm->value = array( + 'default_language' => 'und', + 'hide_language_selector' => 0, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_node__page'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_node__publication'; + $strongarm->value = array( + 'default_language' => 'und', + 'hide_language_selector' => 0, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_node__publication'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_node__webform'; + $strongarm->value = array( + 'default_language' => 'xx-et-default', + 'hide_language_selector' => 1, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_node__webform'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_taxonomy_term__catalog'; + $strongarm->value = array( + 'default_language' => 'xx-et-default', + 'hide_language_selector' => 1, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_taxonomy_term__catalog'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_taxonomy_term__company'; + $strongarm->value = array( + 'default_language' => 'und', + 'hide_language_selector' => 1, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_taxonomy_term__company'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_taxonomy_term__faq_categories'; + $strongarm->value = array( + 'default_language' => 'xx-et-default', + 'hide_language_selector' => 1, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_taxonomy_term__faq_categories'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_taxonomy_term__newsletter'; + $strongarm->value = array( + 'default_language' => 'xx-et-default', + 'hide_language_selector' => 1, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_taxonomy_term__newsletter'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_taxonomy_term__onthologie'; + $strongarm->value = array( + 'default_language' => 'xx-et-default', + 'hide_language_selector' => 0, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_taxonomy_term__onthologie'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_settings_taxonomy_term__tag_libres'; + $strongarm->value = array( + 'default_language' => 'xx-et-default', + 'hide_language_selector' => 0, + 'exclude_language_none' => 0, + 'lock_language' => 0, + 'shared_fields_original_only' => 0, + ); + $export['entity_translation_settings_taxonomy_term__tag_libres'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_shared_labels'; + $strongarm->value = 1; + $export['entity_translation_shared_labels'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_show_fallback_on_overview_pages'; + $strongarm->value = 0; + $export['entity_translation_show_fallback_on_overview_pages'] = $strongarm; + + $strongarm = new stdClass(); + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ + $strongarm->api_version = 1; + $strongarm->name = 'entity_translation_workflow_enabled'; + $strongarm->value = 1; + $export['entity_translation_workflow_enabled'] = $strongarm; + $strongarm = new stdClass(); $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ $strongarm->api_version = 1; diff --git a/sites/all/modules/features/materio_administration/materio_administration.views_default.inc b/sites/all/modules/features/materio_administration/materio_administration.views_default.inc index 56eee5a6..3c4d69a7 100644 --- a/sites/all/modules/features/materio_administration/materio_administration.views_default.inc +++ b/sites/all/modules/features/materio_administration/materio_administration.views_default.inc @@ -2377,6 +2377,290 @@ print user_pass_reset_url($account); ); $export['admin_peoples'] = $view; + $view = new view(); + $view->name = 'admin_taxo'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'taxonomy_term_data'; + $view->human_name = 'Admin Taxo'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['title'] = 'Admin Taxo'; + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['pager']['options']['items_per_page'] = '100'; + $handler->display->display_options['style_plugin'] = 'table'; + $handler->display->display_options['style_options']['columns'] = array( + 'views_bulk_operations' => 'views_bulk_operations', + 'vid' => 'vid', + 'name_1' => 'name_1', + 'tid' => 'tid', + 'name_field_et_1' => 'name_field_et_1', + 'name_field_et' => 'name_field_et', + 'synonyms_synonym_et_1' => 'synonyms_synonym_et_1', + 'synonyms_synonym_et' => 'synonyms_synonym_et', + 'edit_term' => 'edit_term', + ); + $handler->display->display_options['style_options']['default'] = 'tid'; + $handler->display->display_options['style_options']['info'] = array( + 'views_bulk_operations' => array( + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'vid' => array( + 'sortable' => 1, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'name_1' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => ' | ', + 'empty_column' => 0, + ), + 'tid' => array( + 'sortable' => 1, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'name_field_et_1' => array( + 'sortable' => 1, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'name_field_et' => array( + 'sortable' => 1, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'synonyms_synonym_et_1' => array( + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'synonyms_synonym_et' => array( + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'edit_term' => array( + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + ); + /* Field: Bulk operations: Taxonomy term */ + $handler->display->display_options['fields']['views_bulk_operations']['id'] = 'views_bulk_operations'; + $handler->display->display_options['fields']['views_bulk_operations']['table'] = 'taxonomy_term_data'; + $handler->display->display_options['fields']['views_bulk_operations']['field'] = 'views_bulk_operations'; + $handler->display->display_options['fields']['views_bulk_operations']['label'] = 'Terme de taxonomie'; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['display_type'] = '0'; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['enable_select_all_pages'] = 1; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['row_clickable'] = 1; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['force_single'] = 0; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10'; + $handler->display->display_options['fields']['views_bulk_operations']['vbo_operations'] = array( + 'action::pathauto_taxonomy_term_update_action' => array( + 'selected' => 1, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::entity_translation_actions_modify_action' => array( + 'selected' => 1, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + 'action::views_bulk_operations_delete_revision' => array( + 'selected' => 1, + 'postpone_processing' => 0, + 'skip_confirmation' => 0, + 'override_label' => 0, + 'label' => '', + ), + ); + /* Field: Taxonomy vocabulary: Vocabulary ID */ + $handler->display->display_options['fields']['vid']['id'] = 'vid'; + $handler->display->display_options['fields']['vid']['table'] = 'taxonomy_vocabulary'; + $handler->display->display_options['fields']['vid']['field'] = 'vid'; + $handler->display->display_options['fields']['vid']['label'] = 'vid'; + /* Field: Taxonomy vocabulary: Name */ + $handler->display->display_options['fields']['name_1']['id'] = 'name_1'; + $handler->display->display_options['fields']['name_1']['table'] = 'taxonomy_vocabulary'; + $handler->display->display_options['fields']['name_1']['field'] = 'name'; + $handler->display->display_options['fields']['name_1']['label'] = 'voc'; + /* Field: Taxonomy term: Term ID */ + $handler->display->display_options['fields']['tid']['id'] = 'tid'; + $handler->display->display_options['fields']['tid']['table'] = 'taxonomy_term_data'; + $handler->display->display_options['fields']['tid']['field'] = 'tid'; + $handler->display->display_options['fields']['tid']['label'] = 'tid'; + $handler->display->display_options['fields']['tid']['separator'] = ''; + /* Field: Entity translation: Nom: translated */ + $handler->display->display_options['fields']['name_field_et_1']['id'] = 'name_field_et_1'; + $handler->display->display_options['fields']['name_field_et_1']['table'] = 'field_data_name_field'; + $handler->display->display_options['fields']['name_field_et_1']['field'] = 'name_field_et'; + $handler->display->display_options['fields']['name_field_et_1']['label'] = 'Nom EN'; + $handler->display->display_options['fields']['name_field_et_1']['language'] = 'en'; + /* Field: Entity translation: Nom: translated */ + $handler->display->display_options['fields']['name_field_et']['id'] = 'name_field_et'; + $handler->display->display_options['fields']['name_field_et']['table'] = 'field_data_name_field'; + $handler->display->display_options['fields']['name_field_et']['field'] = 'name_field_et'; + $handler->display->display_options['fields']['name_field_et']['label'] = 'Nom FR'; + $handler->display->display_options['fields']['name_field_et']['hide_empty'] = TRUE; + $handler->display->display_options['fields']['name_field_et']['empty_zero'] = TRUE; + $handler->display->display_options['fields']['name_field_et']['language'] = 'fr'; + /* Field: Entity translation: Synonyms: translated */ + $handler->display->display_options['fields']['synonyms_synonym_et_1']['id'] = 'synonyms_synonym_et_1'; + $handler->display->display_options['fields']['synonyms_synonym_et_1']['table'] = 'field_data_synonyms_synonym'; + $handler->display->display_options['fields']['synonyms_synonym_et_1']['field'] = 'synonyms_synonym_et'; + $handler->display->display_options['fields']['synonyms_synonym_et_1']['label'] = 'Synonyms EN'; + $handler->display->display_options['fields']['synonyms_synonym_et_1']['delta_offset'] = '0'; + $handler->display->display_options['fields']['synonyms_synonym_et_1']['language'] = 'en'; + /* Field: Entity translation: Synonyms: translated */ + $handler->display->display_options['fields']['synonyms_synonym_et']['id'] = 'synonyms_synonym_et'; + $handler->display->display_options['fields']['synonyms_synonym_et']['table'] = 'field_data_synonyms_synonym'; + $handler->display->display_options['fields']['synonyms_synonym_et']['field'] = 'synonyms_synonym_et'; + $handler->display->display_options['fields']['synonyms_synonym_et']['label'] = 'Synonyms FR'; + $handler->display->display_options['fields']['synonyms_synonym_et']['delta_offset'] = '0'; + $handler->display->display_options['fields']['synonyms_synonym_et']['language'] = 'fr'; + /* Field: Taxonomy term: Term edit link */ + $handler->display->display_options['fields']['edit_term']['id'] = 'edit_term'; + $handler->display->display_options['fields']['edit_term']['table'] = 'taxonomy_term_data'; + $handler->display->display_options['fields']['edit_term']['field'] = 'edit_term'; + $handler->display->display_options['fields']['edit_term']['label'] = 'Lien de modification du terme'; + $handler->display->display_options['fields']['edit_term']['text'] = 'edit'; + /* Filter criterion: Taxonomy term: Vocabulary */ + $handler->display->display_options['filters']['vid']['id'] = 'vid'; + $handler->display->display_options['filters']['vid']['table'] = 'taxonomy_term_data'; + $handler->display->display_options['filters']['vid']['field'] = 'vid'; + $handler->display->display_options['filters']['vid']['value'] = array( + 15 => '15', + 4 => '4', + ); + $handler->display->display_options['filters']['vid']['exposed'] = TRUE; + $handler->display->display_options['filters']['vid']['expose']['operator_id'] = 'vid_op'; + $handler->display->display_options['filters']['vid']['expose']['label'] = 'Vocabulaire'; + $handler->display->display_options['filters']['vid']['expose']['operator'] = 'vid_op'; + $handler->display->display_options['filters']['vid']['expose']['identifier'] = 'vid'; + $handler->display->display_options['filters']['vid']['expose']['remember_roles'] = array( + 2 => '2', + 1 => 0, + 9 => 0, + 7 => 0, + 10 => 0, + 11 => 0, + 6 => 0, + 5 => 0, + 8 => 0, + 3 => 0, + 4 => 0, + ); + $handler->display->display_options['filters']['vid']['expose']['reduce'] = TRUE; + /* Filter criterion: Taxonomy term: Term ID */ + $handler->display->display_options['filters']['tid_raw']['id'] = 'tid_raw'; + $handler->display->display_options['filters']['tid_raw']['table'] = 'taxonomy_term_data'; + $handler->display->display_options['filters']['tid_raw']['field'] = 'tid_raw'; + $handler->display->display_options['filters']['tid_raw']['exposed'] = TRUE; + $handler->display->display_options['filters']['tid_raw']['expose']['operator_id'] = 'tid_raw_op'; + $handler->display->display_options['filters']['tid_raw']['expose']['label'] = 'TID'; + $handler->display->display_options['filters']['tid_raw']['expose']['operator'] = 'tid_raw_op'; + $handler->display->display_options['filters']['tid_raw']['expose']['identifier'] = 'tid_raw'; + $handler->display->display_options['filters']['tid_raw']['expose']['remember_roles'] = array( + 2 => '2', + 1 => 0, + 9 => 0, + 7 => 0, + 10 => 0, + 11 => 0, + 6 => 0, + 5 => 0, + 8 => 0, + 3 => 0, + 4 => 0, + ); + /* Filter criterion: Taxonomy term: Nom (name_field) */ + $handler->display->display_options['filters']['name_field_value']['id'] = 'name_field_value'; + $handler->display->display_options['filters']['name_field_value']['table'] = 'field_data_name_field'; + $handler->display->display_options['filters']['name_field_value']['field'] = 'name_field_value'; + $handler->display->display_options['filters']['name_field_value']['exposed'] = TRUE; + $handler->display->display_options['filters']['name_field_value']['expose']['operator_id'] = 'name_field_value_op'; + $handler->display->display_options['filters']['name_field_value']['expose']['label'] = 'Nom'; + $handler->display->display_options['filters']['name_field_value']['expose']['operator'] = 'name_field_value_op'; + $handler->display->display_options['filters']['name_field_value']['expose']['identifier'] = 'name_field_value'; + $handler->display->display_options['filters']['name_field_value']['expose']['remember_roles'] = array( + 2 => '2', + 1 => 0, + 9 => 0, + 7 => 0, + 10 => 0, + 11 => 0, + 6 => 0, + 5 => 0, + 8 => 0, + 3 => 0, + 4 => 0, + ); + + /* Display: Page */ + $handler = $view->new_display('page', 'Page', 'page'); + $handler->display->display_options['path'] = 'admin/structure/taxonomie/admin-taxo'; + $translatables['admin_taxo'] = array( + t('Master'), + t('Admin Taxo'), + t('more'), + t('Apply'), + t('Reset'), + t('Sort by'), + t('Asc'), + t('Desc'), + t('Items per page'), + t('- All -'), + t('Offset'), + t('« first'), + t('‹ previous'), + t('next ›'), + t('last »'), + t('Terme de taxonomie'), + t('- Choose an operation -'), + t('vid'), + t('.'), + t(','), + t('voc'), + t('tid'), + t('Nom EN'), + t('Nom FR'), + t('Synonyms EN'), + t('Synonyms FR'), + t('Lien de modification du terme'), + t('edit'), + t('Vocabulaire'), + t('TID'), + t('Nom'), + t('Page'), + ); + $export['admin_taxo'] = $view; + $view = new view(); $view->name = 'taxonomy_companies_manager'; $view->description = ''; diff --git a/sites/all/modules/gui/materiobasemod/materio_taxonomy.module b/sites/all/modules/gui/materiobasemod/materio_taxonomy.module index 45d4c25b..91f8017d 100755 --- a/sites/all/modules/gui/materiobasemod/materio_taxonomy.module +++ b/sites/all/modules/gui/materiobasemod/materio_taxonomy.module @@ -42,9 +42,13 @@ function materio_taxonomy_menu_alter(&$items) { * * Inutile si i18n_taxonomy module is desactivate */ -function materio_taxonomy_query_term_access_alter(QueryAlterableInterface $query) { +function DISABLED_materio_taxonomy_query_term_access_alter(QueryAlterableInterface $query) { // dsm($query, 'materio taxo query'); - $conditions =& $query->conditions(); + + if(!module_exists('i18n_taxonomy')) + return; + + $conditions =& $query->conditions(); # roll over condition first time to determine i18n_voc_mode $i18n_voc_mode = 0;