diff --git a/sites/all/modules/features/LICENSE.txt b/sites/all/modules/features/LICENSE.txt index 2c095c8d3f42488e8168f9710a4ffbfc4125a159..d159169d1050894d3ea3b98e1c965c4058208fe1 100644 --- a/sites/all/modules/features/LICENSE.txt +++ b/sites/all/modules/features/LICENSE.txt @@ -1,274 +1,339 @@ -GNU GENERAL PUBLIC LICENSE - - Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, -Cambridge, MA 02139, 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 Library 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. + 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.) +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 +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 +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. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/features/README.txt b/sites/all/modules/features/README.txt index 197a2dabc13e1dbe1d795617cf08fed92db62759..0ccabd942ba055457bd55020e94a0adef54f2c50 100644 --- a/sites/all/modules/features/README.txt +++ b/sites/all/modules/features/README.txt @@ -76,14 +76,14 @@ You can build features in Drupal by using site building tools that are supported Once you've built and configured functionality on a site, you can export it into a feature module by using the feature create page at -`admin/build/features/create`. +`admin/structure/features/create`. ### Task 2: Manage features The features module also provides a way to manage features through a more -targeted interface than `admin/build/modules`. The interface at -`admin/build/features` shows you only feature modules, and will also inform you +targeted interface than `admin/modules`. The interface at +`admin/structure/features` shows you only feature modules, and will also inform you if any of their components have been overridden. If this is the case, you can also re-create features to bring the module code up to date with any changes that have occurred in the database. @@ -140,6 +140,13 @@ Features provides several useful drush commands: - `drush features-export [feature name] [component list]` Write a new feature in code containing the components listed. + If called with no arguments, display a list of available components. + If called with one argument, take the argument as a component name and + attempt to create a feature with the same name. + + The option '--destination=foo' may be used to specify the path (from Drupal + root) where the feature should be created. The default destination is + 'sites/all/modules'. - `drush features-update [feature name]` diff --git a/sites/all/modules/features/features.admin.inc b/sites/all/modules/features/features.admin.inc index b86ddda308d527178e7c90c512a3d807c667d8fc..b2024918d375178df9d9848faa45ffa7b7d16bea 100644 --- a/sites/all/modules/features/features.admin.inc +++ b/sites/all/modules/features/features.admin.inc @@ -106,7 +106,8 @@ function features_export_form($form, $form_state, $feature = NULL) { foreach ($options as $k => $v) { $options[$k] = check_plain($v); } - $form['export']['components']['#options'][$component] = (isset($component_info['name']) ? $component_info['name'] : $component); + $label = (isset($component_info['name']) ? $component_info['name'] . ": " . $component : $component); + $form['export']['components']['#options'][$component] = $label; if (!empty($options)) { $form['export']['sources'][$component] = array( '#type' => 'checkboxes', @@ -326,7 +327,7 @@ function features_admin_form($form, $form_state) { $modules = array_filter(features_get_modules(), 'features_filter_hidden'); $features = array_filter(features_get_features(), 'features_filter_hidden'); $conflicts = features_get_conflicts(); - + foreach ($modules as $key => $module) { if ($module->status && !empty($module->info['dependencies'])) { foreach ($module->info['dependencies'] as $dependent) { @@ -348,7 +349,8 @@ function features_admin_form($form, $form_state) { $form = array('#features' => $features); - // Generate features form. + // Generate features form. Features are sorted by dependencies, resort alpha + ksort($features); foreach ($features as $name => $module) { $package_title = !empty($module->info['package']) ? $module->info['package'] : t('Other'); $package = strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', $package_title)); @@ -478,6 +480,11 @@ function features_admin_form($form, $form_state) { * Display the components of a feature. */ function features_admin_components($form, $form_state, $feature) { + // Breadcrumb navigation + $breadcrumb[] = l(t('Home'), NULL); + $breadcrumb[] = l(t('Features'), 'admin/structure/features'); + drupal_set_breadcrumb($breadcrumb); + module_load_include('inc', 'features', 'features.export'); $form = array(); @@ -487,18 +494,33 @@ function features_admin_components($form, $form_state, $feature) { $form['#dependencies'] = array(); if (!empty($feature->info['dependencies'])) { foreach ($feature->info['dependencies'] as $dependency) { + $parsed_dependency = drupal_parse_dependency($dependency); + $dependency = $parsed_dependency['name']; $status = features_get_module_status($dependency); $form['#dependencies'][$dependency] = $status; } } - $review = $revert = FALSE; + $conflicts = features_get_conflicts(); + if (!module_exists($form['module']['#value']) && isset($form['module']['#value']) && !empty($conflicts[$form['module']['#value']])) { + $module_conflicts = $conflicts[$form['module']['#value']]; + $conflicts = array(); + foreach ($module_conflicts as $conflict) { + $conflicts = array_merge_recursive($conflict, $conflicts); + } + } + else { + $conflicts = array(); + } + $form['#conflicts'] = $conflicts; + $review = $revert = FALSE; + // Iterate over components and retrieve status for display $states = features_get_component_states(array($feature->name), FALSE); $form['revert']['#tree'] = TRUE; foreach ($feature->info['features'] as $component => $items) { - if (user_access('administer features') && in_array($states[$feature->name][$component], array(FEATURES_OVERRIDDEN, FEATURES_NEEDS_REVIEW))) { + if (user_access('administer features') && array_key_exists($component, $states[$feature->name]) && in_array($states[$feature->name][$component], array(FEATURES_OVERRIDDEN, FEATURES_NEEDS_REVIEW))) { switch ($states[$feature->name][$component]) { case FEATURES_OVERRIDDEN: $revert = TRUE; @@ -519,8 +541,16 @@ function features_admin_components($form, $form_state, $feature) { else { $path = NULL; } + + $storage = FEATURES_DEFAULT; + if (array_key_exists($component, $states[$feature->name])) { + $storage = $states[$feature->name][$component]; + } + else if (array_key_exists($component, $conflicts)) { + $storage = FEATURES_CONFLICT; + } $form['components'][$component] = array( - '#markup' => theme('features_storage_link', array('storage' => $states[$feature->name][$component], 'path' => $path)), + '#markup' => theme('features_storage_link', array('storage' => $storage, 'path' => $path)), ); } diff --git a/sites/all/modules/features/features.api.php b/sites/all/modules/features/features.api.php index ac54ec612b8e931033f101b52660f6ba3f550b26..4c4aea3501a052da41287b399649a41ec88fc6d9 100644 --- a/sites/all/modules/features/features.api.php +++ b/sites/all/modules/features/features.api.php @@ -218,8 +218,8 @@ function hook_features_export_rebuild($module_name) { */ function hook_features_export_alter(&$export, $module_name) { // Example: do not allow the page content type to be exported, ever. - if (!empty($export['node']['page'])) { - unset($export['node']['page']); + if (!empty($export['features']['node']['page'])) { + unset($export['features']['node']['page']); } } diff --git a/sites/all/modules/features/features.css b/sites/all/modules/features/features.css index 3d5f5f8b6c654e3e27dd383a1eff9c74263803b4..9b89c86fe6a8646fe466381d4d02a9dabe774f43 100644 --- a/sites/all/modules/features/features.css +++ b/sites/all/modules/features/features.css @@ -4,12 +4,12 @@ div.features-form-links { width:20%; float:left; - } +} div.features-form-content { width:80%; float:right; - } +} /** * Package links. @@ -21,25 +21,27 @@ div.features-form-links ul#features-form-links li a { float:none; padding:0px; margin:0px; - } +} - div.features-form-links ul#features-form-links { margin:0px 0px 10px; } +div.features-form-links ul#features-form-links { + margin:0px 0px 10px; +} - div.features-form-links ul#features-form-links li a { - background:#f8f8f8; - padding:5px 5px 4px 4px; - border-left:1px solid #eee; - border-bottom:1px solid #eee; - cursor:pointer; - } - - div.features-form-links ul#features-form-links li a.features-package-active { - padding:4px 5px 4px 4px; - background:#fff; - border:1px solid #ccc; - border-right:0px; - margin-right:-1px; - } +div.features-form-links ul#features-form-links li a { + background:#f8f8f8; + padding:5px 5px 4px 4px; + border-left:1px solid #eee; + border-bottom:1px solid #eee; + cursor:pointer; +} + +div.features-form-links ul#features-form-links li a.features-package-active { + padding:4px 5px 4px 4px; + background:#fff; + border:1px solid #ccc; + border-right:0px; + margin-right:-1px; +} /* Packages */ div.features-form-package { @@ -48,9 +50,11 @@ div.features-form-package { padding:10px; margin:0px 0px 20px; display:none; - } +} - div.features-package-active { display:block; } +div.features-package-active { + display:block; +} /** * Features management form (admin/build/features). @@ -60,52 +64,95 @@ div.features-empty { font-size:1.5em; text-align:center; color:#999; - } +} -form div.buttons { text-align:center; } +form div.buttons { + text-align:center; +} table.features .admin-loading, -table.features tr.disabled { color:#999; } - - table.features a.configure { float:right; font-style:italic; } - table.features div.feature { float:left; width:85%; } - table.features div.feature strong { font-size:13px; } - table.features div.feature div.description { font-size:11px; margin:0px; } - - table.features-manage td.name { width:80%; } - table.features-manage td.sign { width:20%; } +table.features tr.disabled { + color:#999; +} - table.features-admin td.name { width:60%; } - table.features-admin td.sign { width:20%; } - table.features-admin td.state { width:10%; } - table.features-admin td.actions { width:10%; } +table.features a.configure { + float:right; + font-style:italic; +} +table.features div.feature { + float:left; width:85%; +} +table.features div.feature strong { + font-size:13px; +} +table.features div.feature div.description { + font-size:11px; margin:0px; +} + +table.features-manage td.name { + width:80%; +} +table.features-manage td.sign { + width:20%; +} - table.features td.sign { - font-size:9px; - line-height:15px; - white-space:nowrap; - } +table.features-admin td.name { + width:60%; +} +table.features-admin td.sign { + width:20%; +} +table.features-admin td.state { + width:10%; +} +table.features-admin td.actions { + width:10%; +} + +table.features td.sign { + font-size:9px; + line-height:15px; + white-space:nowrap; +} - table.features td.sign * { margin:0px; } +table.features td.sign * { + margin:0px; +} - table.features .admin-check, - table.features .admin-default, - table.features .admin-overridden, - table.features .admin-rebuilding, - table.features .admin-needs-review { display:none; } +table.features .admin-check, +table.features .admin-default, +table.features .admin-overridden, +table.features .admin-rebuilding, +table.features .admin-needs-review { + display:none; +} /** * Feature export form (admin/build/features/export). */ -form.features-export-form table td { width:50%; } -form.features-export-form table td { vertical-align:top; } -form.features-export-form table div.description { white-space:normal; } - -table.features-export div.form-item { white-space:normal; } -table.features-export select { width:90%; } -table.features-export td { vertical-align:top; } - -form.features-export-form div.features-select { display:none; } +form.features-export-form table td { + width:50%; +} +form.features-export-form table td { + vertical-align:top; +} +form.features-export-form table div.description { + white-space:normal; +} + +table.features-export div.form-item { + white-space:normal; +} +table.features-export select { + width:90%; +} +table.features-export td { + vertical-align:top; +} + +form.features-export-form div.features-select { + display:none; +} form.features-export-form div.form-checkboxes { overflow-x:hidden; @@ -114,7 +161,9 @@ form.features-export-form div.form-checkboxes { } form.features-export-form div#edit-components-wrapper, -form.features-export-form div.features-select { padding-right:20px; } +form.features-export-form div.features-select { + padding-right:20px; +} /** * Feature component display (admin/build/features/%feature). @@ -122,10 +171,14 @@ form.features-export-form div.features-select { padding-right:20px; } div.features-components div.column { float:left; width:50%; - } +} -div.features-components div.column div.info { padding-right:20px; } -div.features-components div.column div.components { padding-left:20px; } +div.features-components div.column div.info { + padding-right:20px; +} +div.features-components div.column div.components { + padding-left:20px; +} h3.features-download, div.features-comparison h3, @@ -134,22 +187,30 @@ div.features-components h3 { font-weight:bold; letter-spacing:-1px; margin:15px 0px; - } +} - h3.features-download { text-align:center; } +h3.features-download { + text-align:center; +} div.features-components div.description { font-size:11px; margin:15px 0px; - } +} -div.features-components table td { font-size:11px; } -div.features-components table td.component { padding-left:20px; } +div.features-components table td { + font-size:11px; +} +div.features-components table td.component { + padding-left:20px; +} /** * Features component lists. */ -span.features-component-key { font-size:11px; } +span.features-component-key { + font-size:11px; +} a.admin-update, a.features-storage, @@ -159,69 +220,74 @@ span.features-component-list span { margin-right:5px; padding:2px 5px; background:#eee; - -moz-border-radius:5px; -webkit-border-radius:5px; - } - - div.features-key span.admin-conflict, - span.features-component-list span.features-conflict { - background-color: #c30; - color: #fff; - } - - a.admin-update { background:transparent; } - - /* These pseudo selectors are necessary for themes like Garland. */ - a.admin-overridden:link, - a.admin-overridden:visited, - span.admin-overridden { - color:#fff; - background:#666; - } - - a.admin-needs-review:link, - a.admin-needs-review:visited, - span.admin-needs-review { - color:#963; - background:#fe6; - } - - a.admin-rebuilding:link, - a.admin-rebuilding:visited, - span.admin-rebuilding { - color:#fff; - background:#699; - } - - a.admin-conflict:link, - a.admin-conflict:visited, - span.admin-conflict { - color:#c30; - } +} + +div.features-key span.admin-conflict, +span.features-component-list span.features-conflict { + background-color: #c30; + color: #fff; +} + +a.admin-update { + background:transparent; +} + +/* These pseudo selectors are necessary for themes like Garland. */ +a.admin-overridden:link, +a.admin-overridden:visited, +span.admin-overridden { + color:#fff; + background:#666; +} + +a.admin-needs-review:link, +a.admin-needs-review:visited, +span.admin-needs-review { + color:#963; + background:#fe6; +} + +a.admin-rebuilding:link, +a.admin-rebuilding:visited, +span.admin-rebuilding { + color:#fff; + background:#699; +} + +a.admin-conflict:link, +a.admin-conflict:visited, +span.admin-conflict { + color:#c30; +} table.features-diff td.diff-addedline, span.features-component-list .features-detected { color:#68a; background:#def; - } +} table.features-diff td.diff-deletedline, span.features-component-list .features-dependency { color:#999; background:#f8f8f8; - } +} /** * Features diff. */ -table.features-diff { font-size:11px; } +table.features-diff { + font-size:11px; +} -table.features-diff td { padding:0px 5px; } +table.features-diff td { + padding:0px 5px; +} table.features-diff td.diff-deletedline, table.features-diff td.diff-addedline, table.features-diff td.diff-context { width:50%; font-family:'Andale Mono',monospace; - } +} diff --git a/sites/all/modules/features/features.drush.inc b/sites/all/modules/features/features.drush.inc index fe02c516137097597dbff4f2fe36ebee7cbb84ec..4b79e768dcaec2343e693ea2f385dbb33a1accce 100644 --- a/sites/all/modules/features/features.drush.inc +++ b/sites/all/modules/features/features.drush.inc @@ -6,7 +6,7 @@ */ /** - * Implementation of hook_drush_command(). + * Implements hook_drush_command(). * * @See drush_parse_command() for a list of recognized keys. * @@ -24,7 +24,11 @@ function features_drush_command() { $items['features-export'] = array( 'description' => "Export a feature from your site into a module.", 'arguments' => array( - 'feature' => 'Feature name to export.', + 'feature' => 'Feature name to export or a single component.', + 'components' => '(optional) List of components to include, like source:component [source2:component2]...' + ), + 'options' => array( + '--destination' => "Destination path (from Drupal root) of the exported feature. Defaults to 'sites/all/modules'", ), 'drupal dependencies' => array('features'), 'aliases' => array('fe'), @@ -80,14 +84,14 @@ function features_drush_command() { } /** - * Implementation of hook_drush_help(). + * Implements hook_drush_help(). */ function features_drush_help($section) { switch ($section) { case 'drush:features': return dt("List all the available features for your site."); case 'drush:features-export': - return dt("Export a feature from your site into a module."); + return dt("Export a feature from your site into a module. If called with no arguments, display a list of available components. If called with a single argument, attempt to create a feature including the given component with the same name. The option '--destination=foo' may be used to specify the path (from Drupal root) where the feature should be created. The default destination is 'sites/all/modules'."); case 'drush:features-update': return dt("Update a feature module on your site."); case 'drush:features-update-all': @@ -143,7 +147,14 @@ function drush_features_export() { // "value" of the component. list($source, $component) = explode(':', $args[0]); $stub = array($source => array($component)); - _drush_features_export($stub, $component); + $sources = features_get_components(); + if (empty($component) || empty($sources[$source])) { + _features_drush_set_error($args[0], 'FEATURES_COMPONENT_NOT_FOUND'); + exit; + } + else { + _drush_features_export($stub, $component); + } } elseif (count($args) > 1) { // Assume that the user intends to create a new module based on a list of @@ -230,7 +241,8 @@ function drush_features_update_all() { function _drush_features_export($stub, $dependencies, $module_name = NULL, $directory = NULL) { $root = drush_get_option(array('r', 'root'), drush_locate_root()); if ($root) { - $directory = isset($directory) ? $directory : 'sites/all/modules/' . $module_name; + $destination = drush_get_option(array('destination'), 'sites/all/modules'); + $directory = isset($directory) ? $directory : $destination . '/' . $module_name; if (is_dir($directory)) { drush_print(dt('Module appears to already exist in !dir', array('!dir' => $directory))); if (!drush_confirm(dt('Do you really want to continue?'))) { @@ -333,6 +345,7 @@ function drush_features_revert() { function drush_features_revert_all() { $features_to_revert = array(); $features_to_exclude = func_get_args(); + $force = drush_get_option('force'); foreach (features_get_features() as $module) { if ($module->status && !in_array($module->name, $features_to_exclude)) { $features_to_revert[] = $module->name; @@ -341,7 +354,7 @@ function drush_features_revert_all() { drush_print(dt('The following modules will be reverted: !modules', array('!modules' => implode(', ', $features_to_revert)))); if (drush_confirm(dt('Do you really want to continue?'))) { foreach ($features_to_revert as $module_name) { - drush_backend_invoke('features-revert '. $module_name); + drush_backend_invoke('features-revert '. $module_name, array('force' => $force)); } } else { @@ -395,18 +408,25 @@ function drush_features_diff() { $formatter->trailing_context_lines = 2; $formatter->show_header = FALSE; + if (drush_get_context('DRUSH_NOCOLOR')) { + $red = $green = "%s"; + } + else { + $red = "\033[31;40m\033[1m%s\033[0m"; + $green = "\033[0;32;40m\033[1m%s\033[0m"; + } + + // Print key for colors + drush_print(dt('Legend: ')); + drush_print(sprintf($red, dt('Code: drush features-revert will remove the overrides.'))); + drush_print(sprintf($green, dt('Overrides: drush features-update will update the exported feature with the displayed overrides'))); + drush_print(); + foreach ($overrides as $component => $items) { $diff = new Diff(explode("\n", $items['default']), explode("\n", $items['normal'])); drush_print(); drush_print(dt("Component: !component", array('!component' => $component))); $rows = explode("\n", $formatter->format($diff)); - if (drush_get_context('DRUSH_NOCOLOR')) { - $red = $green = "%s"; - } - else { - $red = "\033[31;40m\033[1m%s\033[0m"; - $green = "\033[0;32;40m\033[1m%s\033[0m"; - } foreach ($rows as $row) { if (strpos($row, '>') === 0) { drush_print(sprintf($green, $row)); @@ -438,6 +458,9 @@ function _features_drush_set_error($feature, $error = '') { case 'FEATURES_FEATURE_NOT_ENABLED': $message = 'The feature !feature is not enabled.'; break; + case 'FEATURES_COMPONENT_NOT_FOUND': + $message = 'The given component !feature could not be found.'; + break; default: $error = 'FEATURES_FEATURE_NOT_FOUND'; $message = 'The feature !feature could not be found.'; diff --git a/sites/all/modules/features/features.export.inc b/sites/all/modules/features/features.export.inc index cc11478892065a1a3d42bd47948d15843bcb4b2f..dca3e60664954b74238d322d79644454b7988e30 100644 --- a/sites/all/modules/features/features.export.inc +++ b/sites/all/modules/features/features.export.inc @@ -106,9 +106,11 @@ function _features_export_minimize_dependencies($dependencies, $module_name = '' */ function _features_export_maximize_dependencies($dependencies, $module_name = '', $maximized = array(), $first = TRUE) { foreach ($dependencies as $k => $v) { - if (!in_array($v, $maximized)) { - $maximized[] = $v; - $module = features_get_modules($v); + $parsed_dependency = drupal_parse_dependency($v); + $name = $parsed_dependency['name']; + if (!in_array($name, $maximized)) { + $maximized[] = $name; + $module = features_get_modules($name); if ($module && !empty($module->info['dependencies'])) { $maximized = array_merge($maximized, _features_export_maximize_dependencies($module->info['dependencies'], $module_name, $maximized, FALSE)); } @@ -327,7 +329,7 @@ function features_get_default_hooks($component = NULL, $reset = FALSE) { function features_export_render_defaults($module, $hook, $code) { $output = array(); $output[] = "/**"; - $output[] = " * Implementation of hook_{$hook}()."; + $output[] = " * Implements hook_{$hook}()."; $output[] = " */"; $output[] = "function {$module}_{$hook}() {"; $output[] = $code; diff --git a/sites/all/modules/features/features.info b/sites/all/modules/features/features.info index 0517218cee73714bcd283f934cd6a319eaffe3d3..9c33092418f30b46c777eb39243c341001a67c55 100644 --- a/sites/all/modules/features/features.info +++ b/sites/all/modules/features/features.info @@ -4,9 +4,9 @@ core = 7.x package = "Features" files[] = tests/features.test -; Information added by drupal.org packaging script on 2011-04-06 -version = "7.x-1.0-beta2" +; Information added by drupal.org packaging script on 2011-09-21 +version = "7.x-1.0-beta4" core = "7.x" project = "features" -datestamp = "1302049346" +datestamp = "1316565919" diff --git a/sites/all/modules/features/features.js b/sites/all/modules/features/features.js index ce32920ccbf3d4afd67e0e06a7c19ca7b06fab5f..520e98e5b88820414eff320a08439ccb31b9bdb9 100644 --- a/sites/all/modules/features/features.js +++ b/sites/all/modules/features/features.js @@ -38,7 +38,7 @@ .after(' <small class="feature-module-name-suffix"> </small>'); if ($('.feature-module-name').val() === $('.feature-name').val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_') || $('.feature-module-name').val() === '') { $('.feature-module-name').parents('.form-item').hide(); - $('.feature-name').keyup(function() { + $('.feature-name').bind('keyup change', function() { var machine = $(this).val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_'); if (machine !== '_' && machine !== '') { $('.feature-module-name').val(machine); diff --git a/sites/all/modules/features/features.module b/sites/all/modules/features/features.module index f85cf4c49d113f0fa6247bf4f9b35b7a39e74bd0..785a16bd814a07eb60f058c78417e1c8e4123dac 100644 --- a/sites/all/modules/features/features.module +++ b/sites/all/modules/features/features.module @@ -187,7 +187,7 @@ function features_theme() { ) + $base; $items['features_storage_link'] = array( - 'variables' => array('storage' => null, 'path' => null, 'options' => array()), + 'variables' => array('storage' => null, 'text' => null, 'path' => null, 'options' => array()), ) + $base; $items['features_form_components'] = @@ -249,7 +249,7 @@ function features_permission() { } /** - * Implementation of hook_help(). + * Implements hook_help(). */ function features_help($path, $arg) { switch ($path) { @@ -261,6 +261,30 @@ function features_help($path, $arg) { } } +/** + * Implements hook_modules_disabled(). + */ +function features_modules_disabled($modules) { + // Find any features modules that were disabled. + if ($modules = array_intersect(array_keys(features_get_features()), $modules)) { + foreach ($modules as $module) { + features_disable_feature($module); + } + } +} + +/** + * Implements hook_modules_enabled(). + */ +function features_modules_enabled($modules) { + // Find any features modules that were enabled. + if ($modules = array_intersect(array_keys(features_get_features()), $modules)) { + foreach ($modules as $module) { + features_enable_feature($module); + } + } +} + /** * Load includes for any modules that implement the features API and * load includes for those provided by features. @@ -329,7 +353,8 @@ function features_include_defaults($components = NULL, $reset = FALSE) { // Inclusion of defaults for Views. if ($component === 'views') { views_include('view'); - views_include_default_views(); + views_include_handlers(); + views_module_include('views_default.inc'); } // Inclusion of defaults for CTools. else if (isset($info['api'], $info['module'], $info['current_version'])) { @@ -445,6 +470,9 @@ function features_install_modules($modules) { // Build maximal list of dependencies. $install = array(); foreach ($modules as $name) { + // Parse the dependency string into the module name and version information. + $parsed_name = drupal_parse_dependency($name); + $name = $parsed_name['name']; if ($file = $files[$name]) { $install[] = $name; if (!empty($file->info['dependencies'])) { @@ -484,8 +512,8 @@ function features_get_info($type = 'module', $name = NULL, $reset = FALSE) { if (empty($cache) || $reset) { $data = array(); $ignored = variable_get('features_ignored_orphans', array()); - $result = system_rebuild_module_data(); - foreach ($result as $row) { + $files = system_rebuild_module_data(); + foreach ($files as $row) { // If module is no longer enabled, remove it from the ignored orphans list. if (in_array($row->name, $ignored, TRUE) && !$row->status) { $key = array_search($row->name, $ignored, TRUE); @@ -493,10 +521,51 @@ function features_get_info($type = 'module', $name = NULL, $reset = FALSE) { } if (!empty($row->info['features'])) { + // Fix css/js paths + if (!empty($row->info['stylesheets'])) { + foreach($row->info['stylesheets'] as $media => $css) { + $row->info['stylesheets'][$media] = array_keys($css); + } + } + if (!empty($row->info['scripts'])) { + $row->info['scripts'] = array_keys($row->info['scripts']); + } $data['feature'][$row->name] = $row; } $data['module'][$row->name] = $row; } + + // Sort features according to dependencies. + // @see install_profile_modules() + $required = array(); + $non_required = array(); + + $modules = array_keys($data['feature']); + foreach ($modules as $module) { + if ($files[$module]->requires) { + $modules = array_merge($modules, array_keys($files[$module]->requires)); + } + } + $modules = array_unique($modules); + foreach ($modules as $module) { + if (!empty($files[$module]->info['features'])) { + if (!empty($files[$module]->info['required'])) { + $required[$module] = $files[$module]->sort; + } + else { + $non_required[$module] = $files[$module]->sort; + } + } + } + arsort($required); + arsort($non_required); + + $sorted = array(); + foreach ($required + $non_required as $module => $weight) { + $sorted[$module] = $data['feature'][$module]; + } + $data['feature'] = $sorted; + variable_set('features_ignored_orphans', $ignored); cache_set("features_module_info", $data); $cache = new stdClass(); @@ -681,10 +750,24 @@ function _features_restore($op, $items = array()) { $restore_hook = 'features_rebuild'; $log_action = 'Rebuild'; break; + case 'disable': + $restore_hook = 'features_disable_feature'; + $log_action = 'Disable'; + break; + case 'enable': + $restore_hook = 'features_enable_feature'; + $log_action = 'Enable'; + break; } if (empty($items)) { - $states = features_get_component_states(array(), ($op == 'rebuild')); + // Drush may execute a whole chain of commands that may trigger feature + // rebuilding multiple times during a single request. Make sure we do not + // rebuild the same cached list of modules over and over again by setting + // $reset to TRUE. + // Note: this may happen whenever more than one feature will be enabled + // in chain, for example also using features_install_modules(). + $states = features_get_component_states(array(), ($op == 'rebuild'), defined('DRUSH_BASE_PATH')); foreach ($states as $module_name => $components) { foreach ($components as $component => $state) { if (in_array($state, $restore_states)) { @@ -725,6 +808,24 @@ function features_rebuild($rebuild = array()) { return _features_restore('rebuild', $rebuild); } +/** + * Wrapper around _features_restore(). + */ +function features_disable_feature($module) { + $feature = feature_load($module); + $items[$module] = array_keys($feature->info['features']); + return _features_restore('disable', $items); +} + +/** + * Wrapper around _features_restore(). + */ +function features_enable_feature($module) { + $feature = feature_load($module); + $items[$module] = array_keys($feature->info['features']); + return _features_restore('enable', $items); +} + /** * Utility functions ================================================== */ diff --git a/sites/all/modules/features/includes/features.block.inc b/sites/all/modules/features/includes/features.block.inc index 9a168b90942f6b7c8b9f13120d51e1d9878cc059..3d0db3be5c76ab2459ee4878ec97051000c44ecd 100644 --- a/sites/all/modules/features/includes/features.block.inc +++ b/sites/all/modules/features/includes/features.block.inc @@ -1,14 +1,14 @@ <?php /** - * Implementation of hook_features_api(). + * Implements hook_features_api(). */ function block_features_api() { return array(); } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). */ function block_features_export($data, &$export) { $pipe = array(); diff --git a/sites/all/modules/features/includes/features.context.inc b/sites/all/modules/features/includes/features.context.inc index 120bd49f3aab54b8fceaa498cd9d9bf6f2f23b10..2da59a73f6574b0dc9e7c350babc22227a70ff69 100644 --- a/sites/all/modules/features/includes/features.context.inc +++ b/sites/all/modules/features/includes/features.context.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). */ function context_features_export($data, &$export, $module_name = '') { $pipe = ctools_component_features_export('context', $data, $export, $module_name); @@ -42,7 +42,7 @@ function context_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_revert(). + * Implements hook_features_revert(). * * @param $module * name of module to revert content for diff --git a/sites/all/modules/features/includes/features.ctools.inc b/sites/all/modules/features/includes/features.ctools.inc index 80e5e9c78ad6a41d3bd9dd8ededb39e2012418a1..08b932121938c1001417fb718d78462629498384 100644 --- a/sites/all/modules/features/includes/features.ctools.inc +++ b/sites/all/modules/features/includes/features.ctools.inc @@ -25,7 +25,7 @@ foreach (_ctools_features_get_info() as $component => $info) { } /** - * Implementation of hook_features_api(). + * Implements hook_features_api(). */ function ctools_features_api() { return array( @@ -41,7 +41,7 @@ function ctools_features_api() { } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). * Adds references to the ctools mothership hook, ctools_plugin_api(). */ function ctools_features_export($data, &$export, $module_name = '') { @@ -62,7 +62,7 @@ function ctools_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_export_render(). + * Implements hook_features_export_render(). * Adds the ctools mothership hook, ctools_plugin_api(). */ function ctools_features_export_render($module, $data) { @@ -77,10 +77,10 @@ function ctools_features_export_render($module, $data) { if ($info = _ctools_features_get_info($component)) { $code[] = ' if ($module == "'. $info['module'] .'" && $api == "'. $info['api'] .'") {'; - $code[] = ' return array("version" => '. $info['current_version'] .');'; + $code[] = ' return array("version" => "'. $info['current_version'] .'");'; $code[] = ' }'; } - + ctools_include('plugins'); $plugin_api_hook_name = ctools_plugin_api_get_hook($info['module'], $info['api']); if (key_exists($plugin_api_hook_name, $component_exports)) { @@ -104,9 +104,7 @@ function ctools_features_export_render($module, $data) { function ctools_component_features_api($module_name) { $api = array(); foreach (_ctools_features_get_info() as $component => $info) { - if ($info['module'] === $module_name) { - $api[$component] = $info; - } + $api[$component] = $info; } return $api; } @@ -198,7 +196,10 @@ function ctools_component_features_export_render($component, $module, $data) { */ function ctools_component_features_revert($component, $module) { if ($objects = features_get_default($component, $module)) { - foreach ($objects as $object) { + foreach ($objects as $name => $object) { + // Some things (like views) do not use the machine name as key + // and need to be loaded explicitly in order to be deleted. + $object = ctools_export_crud_load($component, $name); _ctools_features_export_crud_delete($component, $object); } } @@ -311,7 +312,7 @@ function _ctools_features_export_crud_delete($table, $object) { } /** - * Implementation of hook_features_export_render() for page_manager. + * Implements hook_features_export_render() for page_manager. */ function page_manager_pages_features_export_render($module, $data) { // Ensure that handlers have their code included before exporting. diff --git a/sites/all/modules/features/includes/features.features.inc b/sites/all/modules/features/includes/features.features.inc index dceee31856d60ab616668cdd717989940c228022..c657bc849f00efc6bf6d868d6489de5012732fa9 100644 --- a/sites/all/modules/features/includes/features.features.inc +++ b/sites/all/modules/features/includes/features.features.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_features_api(). + * Implements hook_features_api(). */ function features_features_api() { return array( @@ -14,7 +14,7 @@ function features_features_api() { } /** - * Implementation of hook_features_export_options(). + * Implements hook_features_export_options(). */ function dependencies_features_export_options() { // Excluded modules. @@ -29,7 +29,7 @@ function dependencies_features_export_options() { } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). */ function dependencies_features_export($data, &$export, $module_name = '') { // Don't allow a module to depend upon itself. @@ -44,14 +44,14 @@ function dependencies_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_revert(). + * Implements hook_features_revert(). */ function dependencies_features_revert($module) { dependencies_features_rebuild($module); } /** - * Implementation of hook_features_rebuild(). + * Implements hook_features_rebuild(). * Ensure that all of a feature's dependencies are enabled. */ function dependencies_features_rebuild($module) { @@ -59,6 +59,9 @@ function dependencies_features_rebuild($module) { if (!empty($feature->info['dependencies'])) { $install = array(); foreach ($feature->info['dependencies'] as $dependency) { + // Parse the dependency string into the module name and version information. + $parsed_dependency = drupal_parse_dependency($dependency); + $dependency = $parsed_dependency['name']; if (!module_exists($dependency)) { $install[] = $dependency; } diff --git a/sites/all/modules/features/includes/features.field.inc b/sites/all/modules/features/includes/features.field.inc index c11d0d0fcf90dfbc2d76eae64215d3d1af9cf550..96b22b435783eb959c7236be6c9b2dc15d80163e 100644 --- a/sites/all/modules/features/includes/features.field.inc +++ b/sites/all/modules/features/includes/features.field.inc @@ -66,13 +66,22 @@ function field_features_export($data, &$export, $module_name = '') { // @TODO: handle the pipe to image styles } } + // If taxonomy field, add in the vocabulary + if ($field['field_config']['type'] == 'taxonomy_term_reference' && !empty($field['field_config']['settings']['allowed_values'])) { + foreach ($field['field_config']['settings']['allowed_values'] as $allowed_values) { + if (!empty($allowed_values['vocabulary'])) { + $pipe['taxonomy'][] = $allowed_values['vocabulary']; + } + } + } } } } + return $pipe; } /** - * Implementation of hook_features_export_render(). + * Implements hook_features_export_render(). */ function field_features_export_render($module, $data, $export = NULL) { $translatables = $code = array(); @@ -83,7 +92,17 @@ function field_features_export_render($module, $data, $export = NULL) { if ($field = features_field_load($identifier)) { unset($field['field_config']['columns']); unset($field['field_config']['locked']); - unset($field['field_config']['storage']); + // Only remove the 'storage' declaration if the field is using the default + // storage type. + if ($field['field_config']['storage']['type'] == variable_get('field_storage_default', 'field_sql_storage')) { + unset($field['field_config']['storage']); + } + // If we still have a storage declaration here it means that a non-default + // storage type was altered into to the field definition. And noone would + // never need to change the 'details' key, so don't render it. + if (isset($field['field_config']['storage']['details'])) { + unset($field['field_config']['storage']['details']); + } _field_features_export_sort($field); $field_export = features_var_export($field, ' '); @@ -110,11 +129,17 @@ function field_features_export_render($module, $data, $export = NULL) { } // Helper to enforce consistency in field export arrays. -function _field_features_export_sort(&$field) { - ksort($field); +function _field_features_export_sort(&$field, $sort = TRUE) { + + // Some arrays are not sorted to preserve order (for example allowed_values). + static $sort_blacklist = array('allowed_values'); + + if ($sort) { + ksort($field); + } foreach ($field as $k => $v) { if (is_array($v)) { - _field_features_export_sort($field[$k]); + _field_features_export_sort($field[$k], !in_array($k, $sort_blacklist)); } } } diff --git a/sites/all/modules/features/includes/features.filter.inc b/sites/all/modules/features/includes/features.filter.inc index 7fa654a232d33915273cbe56894cae2d5f323062..5ec18e10cedad9de916f7cfd2c762f8ce7333e81 100644 --- a/sites/all/modules/features/includes/features.filter.inc +++ b/sites/all/modules/features/includes/features.filter.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_features_api(). + * Implements hook_features_api(). */ function filter_features_api() { return array( @@ -15,7 +15,7 @@ function filter_features_api() { } /** - * Implementation of hook_features_export_options(). + * Implements hook_features_export_options(). */ function filter_features_export_options() { $options = array(); @@ -26,7 +26,7 @@ function filter_features_export_options() { } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). */ function filter_features_export($data, &$export, $module_name = '') { // The filter_default_formats() hook integration is provided by the @@ -54,7 +54,7 @@ function filter_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_export_render(). + * Implements hook_features_export_render(). */ function filter_features_export_render($module, $data, $export = NULL) { $code = array(); @@ -77,14 +77,14 @@ function filter_features_export_render($module, $data, $export = NULL) { } /** - * Implementation of hook_features_revert(). + * Implements hook_features_revert(). */ function filter_features_revert($module) { return filter_features_rebuild($module); } /** - * Implementation of hook_features_rebuild(). + * Implements hook_features_rebuild(). */ function filter_features_rebuild($module) { if ($defaults = features_get_default('filter', $module)) { diff --git a/sites/all/modules/features/includes/features.image.inc b/sites/all/modules/features/includes/features.image.inc index 2d6bfcdfaea6496310c0a20a2fb3f17113b16942..713a93a6af9a7e13361b8fd3d2aacb24a0c1e5d5 100644 --- a/sites/all/modules/features/includes/features.image.inc +++ b/sites/all/modules/features/includes/features.image.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_features_api(). + * Implements hook_features_api(). */ function image_features_api() { return array( @@ -14,7 +14,7 @@ function image_features_api() { } /** - * Implementation of hook_features_export_options(). + * Implements hook_features_export_options(). */ function image_features_export_options() { $options = array(); @@ -25,7 +25,7 @@ function image_features_export_options() { } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). */ function image_features_export($data, &$export, $module_name = '') { $pipe = array(); @@ -46,7 +46,7 @@ function image_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_export_render(). + * Implements hook_features_export_render(). */ function image_features_export_render($module_name, $data, $export = NULL) { $code = array(); @@ -68,7 +68,7 @@ function image_features_export_render($module_name, $data, $export = NULL) { } /** - * Implementation of hook_features_revert(). + * Implements hook_features_revert(). */ function image_features_revert($module) { if ($default_styles = features_get_default('image')) { diff --git a/sites/all/modules/features/includes/features.menu.inc b/sites/all/modules/features/includes/features.menu.inc index 5b8345379a51d760e7339ff7101176cffd35f61d..3060aa075904aa699b51e5c861ea2e09c5e2356c 100644 --- a/sites/all/modules/features/includes/features.menu.inc +++ b/sites/all/modules/features/includes/features.menu.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_features_api(). + * Implements hook_features_api(). */ function menu_features_api() { return array( @@ -28,7 +28,7 @@ function menu_features_api() { } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). * DEPRECATED: This implementation simply migrates deprecated `menu` items * to the `menu_links` type. */ @@ -41,7 +41,7 @@ function menu_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_export_options(). + * Implements hook_features_export_options(). */ function menu_custom_features_export_options() { $options = array(); @@ -53,7 +53,7 @@ function menu_custom_features_export_options() { } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). */ function menu_custom_features_export($data, &$export, $module_name = '') { // Default hooks are provided by the feature module so we need to add @@ -77,7 +77,7 @@ function menu_custom_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_export_render() + * Implements hook_features_export_render() */ function menu_custom_features_export_render($module, $data) { $code = array(); @@ -110,14 +110,14 @@ function menu_custom_features_export_render($module, $data) { } /** - * Implementation of hook_features_export_revert(). + * Implements hook_features_export_revert(). */ function menu_custom_features_revert($module) { menu_custom_features_rebuild($module); } /** - * Implementation of hook_features_export_rebuild(). + * Implements hook_features_export_rebuild(). */ function menu_custom_features_rebuild($module) { if ($defaults = features_get_default('menu_custom', $module)) { @@ -128,9 +128,13 @@ function menu_custom_features_rebuild($module) { } /** - * Implementation of hook_features_export_options(). + * Implements hook_features_export_options(). */ function menu_links_features_export_options() { + global $menu_admin; + // Need to set this to TRUE in order to get menu links that the + // current user may not have access to (i.e. user/login) + $menu_admin = TRUE; $menu_links = menu_parent_options(menu_get_menus(), array('mlid' => 0)); $options = array(); foreach ($menu_links as $key => $name) { @@ -141,6 +145,7 @@ function menu_links_features_export_options() { $options[$identifier] = "{$menu_name}: {$name}"; } } + $menu_admin = FALSE; return $options; } @@ -152,7 +157,7 @@ function menu_links_features_identifier($link) { } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). */ function menu_links_features_export($data, &$export, $module_name = '') { // Default hooks are provided by the feature module so we need to add @@ -184,7 +189,7 @@ function menu_links_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_export_render() + * Implements hook_features_export_render() */ function menu_links_features_export_render($module, $data) { $code = array(); @@ -217,14 +222,14 @@ function menu_links_features_export_render($module, $data) { } /** - * Implementation of hook_features_export_revert(). + * Implements hook_features_export_revert(). */ function menu_links_features_revert($module) { menu_links_features_rebuild($module); } /** - * Implementation of hook_features_export_rebuild(). + * Implements hook_features_export_rebuild(). */ function menu_links_features_rebuild($module) { if ($menu_links = features_get_default('menu_links', $module)) { diff --git a/sites/all/modules/features/includes/features.node.inc b/sites/all/modules/features/includes/features.node.inc index 8e54827c32b633299d4f52188c3567a07dc3fe5e..af35e252f0b8baa0cfe88f9cc56a6b8e446bf72e 100644 --- a/sites/all/modules/features/includes/features.node.inc +++ b/sites/all/modules/features/includes/features.node.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_features_api(). + * Implements hook_features_api(). */ function node_features_api() { return array( @@ -14,14 +14,14 @@ function node_features_api() { } /** - * Implementation of hook_features_export_options(). + * Implements hook_features_export_options(). */ function node_features_export_options() { return node_type_get_names(); } /** - * Implementation of hook_features_export. + * Implements hook_features_export. */ function node_features_export($data, &$export, $module_name = '') { $pipe = array(); @@ -52,7 +52,7 @@ function node_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_export_render(). + * Implements hook_features_export_render(). */ function node_features_export_render($module, $data, $export = NULL) { $elements = array( @@ -92,7 +92,7 @@ function node_features_export_render($module, $data, $export = NULL) { } /** - * Implementation of hook_features_revert(). + * Implements hook_features_revert(). * * @param $module * name of module to revert content for @@ -113,3 +113,49 @@ function node_features_revert($module = NULL) { menu_rebuild(); } } + +/** + * Implements hook_features_disable(). + * + * When a features module is disabled, modify any node types it provides so + * they can be deleted manually through the content types UI. + * + * @param $module + * Name of module that has been disabled. + */ +function node_features_disable($module) { + if ($default_types = features_get_default('node', $module)) { + foreach ($default_types as $type_name => $type_info) { + $type_info = node_type_load($type_name); + $type_info->module = 'node'; + $type_info->custom = 1; + $type_info->modified = 1; + $type_info->locked = 0; + node_type_save($type_info); + } + } +} + +/** + * Implements hook_features_enable(). + * + * When a features module is enabled, modify any node types it provides so + * they can no longer be deleted manually through the content types UI. + * + * @param $module + * Name of module that has been enabled. + */ +function node_features_enable($module) { + if ($default_types = features_get_default('node', $module)) { + foreach ($default_types as $type_name => $type_info) { + // Ensure the type exists. + if ($type_info = node_type_load($type_name)) { + $type_info->module = $module; + $type_info->custom = 0; + $type_info->modified = 0; + $type_info->locked = 1; + node_type_save($type_info); + } + } + } +} diff --git a/sites/all/modules/features/includes/features.taxonomy.inc b/sites/all/modules/features/includes/features.taxonomy.inc index dbb71d3a04242334882050bf728a5b0b1c9570ae..5ac4ec504dae521dfa904dcdd7491526701eb11b 100644 --- a/sites/all/modules/features/includes/features.taxonomy.inc +++ b/sites/all/modules/features/includes/features.taxonomy.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_features_api(). + * Implements hook_features_api(). */ function taxonomy_features_api() { return array( @@ -15,7 +15,7 @@ function taxonomy_features_api() { } /** - * Implementation of hook_features_export_options(). + * Implements hook_features_export_options(). */ function taxonomy_features_export_options() { $vocabularies = array(); @@ -26,7 +26,7 @@ function taxonomy_features_export_options() { } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). * * @todo Test adding existing dependencies. */ @@ -56,7 +56,7 @@ function taxonomy_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_export_render(). + * Implements hook_features_export_render(). */ function taxonomy_features_export_render($module, $data) { $vocabularies = taxonomy_get_vocabularies(); @@ -77,14 +77,14 @@ function taxonomy_features_export_render($module, $data) { } /** - * Implementation of hook_features_revert(). + * Implements hook_features_revert(). */ function taxonomy_features_revert($module) { taxonomy_features_rebuild($module); } /** - * Implementation of hook_features_rebuild(). + * Implements hook_features_rebuild(). * * Rebuilds Taxonomy vocabularies from code defaults. */ diff --git a/sites/all/modules/features/includes/features.user.inc b/sites/all/modules/features/includes/features.user.inc index 4b0c7e9ad96c22a8ac01df1dfe1d3734ed2eaed1..c76455de3300d25130acee76be860f161af87b06 100644 --- a/sites/all/modules/features/includes/features.user.inc +++ b/sites/all/modules/features/includes/features.user.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_features_api(). + * Implements hook_features_api(). */ function user_features_api() { return array( @@ -21,7 +21,7 @@ function user_features_api() { } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). */ function user_permission_features_export($data, &$export, $module_name = '') { $export['dependencies']['features'] = 'features'; @@ -40,7 +40,7 @@ function user_permission_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_export_options(). + * Implements hook_features_export_options(). */ function user_permission_features_export_options() { $modules = array(); @@ -62,7 +62,7 @@ function user_permission_features_export_options() { } /** - * Implementation of hook_features_export_render(). + * Implements hook_features_export_render(). */ function user_permission_features_export_render($module, $data) { $perm_modules = &drupal_static(__FUNCTION__ . '_perm_modules'); @@ -100,14 +100,14 @@ function user_permission_features_export_render($module, $data) { } /** - * Implementation of hook_features_revert(). + * Implements hook_features_revert(). */ function user_permission_features_revert($module) { user_permission_features_rebuild($module); } /** - * Implementation of hook_features_rebuild(). + * Implements hook_features_rebuild(). * Iterate through default permissions and update the permissions map. * * @param $module @@ -115,6 +115,11 @@ function user_permission_features_revert($module) { */ function user_permission_features_rebuild($module) { if ($defaults = features_get_default('user_permission', $module)) { + // Make sure the list of available node types is up to date, especially when + // installing multiple features at once, for example from an install profile + // or via drush. + node_types_rebuild(); + $roles = _user_features_get_roles(); $permissions_by_role = _user_features_get_permissions(FALSE); foreach ($defaults as $permission) { @@ -138,7 +143,7 @@ function user_permission_features_rebuild($module) { } /** - * Implementation of hook_features_export(). + * Implements hook_features_export(). */ function user_role_features_export($data, &$export, $module_name = '') { $export['dependencies']['features'] = 'features'; @@ -157,14 +162,14 @@ function user_role_features_export($data, &$export, $module_name = '') { } /** - * Implementation of hook_features_export_options(). + * Implements hook_features_export_options(). */ function user_role_features_export_options() { return drupal_map_assoc(_user_features_get_roles(FALSE)); } /** - * Implementation of hook_features_export_render(). + * Implements hook_features_export_render(). */ function user_role_features_export_render($module, $data) { $code = array(); @@ -188,14 +193,14 @@ function user_role_features_export_render($module, $data) { } /** - * Implementation of hook_features_revert(). + * Implements hook_features_revert(). */ function user_role_features_revert($module) { user_role_features_rebuild($module); } /** - * Implementation of hook_features_rebuild(). + * Implements hook_features_rebuild(). */ function user_role_features_rebuild($module) { if ($defaults = features_get_default('user_role', $module)) { diff --git a/sites/all/modules/features/tests/features.test b/sites/all/modules/features/tests/features.test index 3e90296fa8f858a77aa91d73d8073f9d310f1f17..5057a2b3efb695742168e78b12e3353f41af98fe 100644 --- a/sites/all/modules/features/tests/features.test +++ b/sites/all/modules/features/tests/features.test @@ -50,7 +50,7 @@ class FeaturesUserTestCase extends DrupalWebTestCase { 'image' => 'image', 'node' => 'node', 'user_permission' => 'user', - 'views' => 'views', + 'views_view' => 'views', ), 'module_exists'); foreach (array_keys($components) as $component) { @@ -78,6 +78,8 @@ class FeaturesUserTestCase extends DrupalWebTestCase { } drupal_flush_all_caches(); foreach (array_keys($components) as $component) { + // Reload so things like Views can clear it's cache + $this->$callback('load'); $states = features_get_component_states(array('features_test'), FALSE, TRUE); $this->assertTrue($states['features_test'][$component] === FEATURES_DEFAULT, t('@component reverted.', array('@component' => $component))); } @@ -139,7 +141,7 @@ class FeaturesUserTestCase extends DrupalWebTestCase { } } - protected function _test_views($op = 'load') { + protected function _test_views_view($op = 'load') { switch ($op) { case 'load': return views_get_view('features_test', TRUE); @@ -148,6 +150,8 @@ class FeaturesUserTestCase extends DrupalWebTestCase { $view->set_display('default'); $view->display_handler->override_option('title', 'Foo bar'); $view->save(); + // Clear the load cache from above + views_get_view('features_test', TRUE); break; } } diff --git a/sites/all/modules/features/tests/features_test.features.field.inc b/sites/all/modules/features/tests/features_test.features.field.inc index c82fcd118b535701332dfc50e0167581cef30442..614f05afb9b668ac843480b3d122654c3a362655 100644 --- a/sites/all/modules/features/tests/features_test.features.field.inc +++ b/sites/all/modules/features/tests/features_test.features.field.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_field_default_fields(). + * Implements hook_field_default_fields(). */ function features_test_field_default_fields() { $fields = array(); diff --git a/sites/all/modules/features/tests/features_test.features.filter.inc b/sites/all/modules/features/tests/features_test.features.filter.inc index 2fe81962bac33c3c521c84040b4405e41bd75a5a..d9a001a432a8a8a7a51420b8d4bc4298f70866ae 100644 --- a/sites/all/modules/features/tests/features_test.features.filter.inc +++ b/sites/all/modules/features/tests/features_test.features.filter.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_filter_default_formats(). + * Implements hook_filter_default_formats(). */ function features_test_filter_default_formats() { $formats = array(); diff --git a/sites/all/modules/features/tests/features_test.features.inc b/sites/all/modules/features/tests/features_test.features.inc index 5a77ea0a055448bc8ee04034eba48bb390322265..623c08f9a9fddb201dda8887735b8db077fdc695 100644 --- a/sites/all/modules/features/tests/features_test.features.inc +++ b/sites/all/modules/features/tests/features_test.features.inc @@ -1,17 +1,17 @@ <?php /** - * Implementation of hook_ctools_plugin_api(). + * Implements hook_ctools_plugin_api(). */ function features_test_ctools_plugin_api() { list($module, $api) = func_get_args(); if ($module == "strongarm" && $api == "strongarm") { - return array("version" => 1); + return array("version" => "1"); } } /** - * Implementation of hook_image_default_styles(). + * Implements hook_image_default_styles(). */ function features_test_image_default_styles() { $styles = array(); @@ -42,7 +42,7 @@ function features_test_image_default_styles() { } /** - * Implementation of hook_node_info(). + * Implements hook_node_info(). */ function features_test_node_info() { $items = array( @@ -59,10 +59,11 @@ function features_test_node_info() { } /** - * Implementation of hook_views_api(). + * Implements hook_views_api(). */ function features_test_views_api() { - return array( - 'api' => '3.0-alpha1', - ); + list($module, $api) = func_get_args(); + if ($module == "views" && $api == "views_default") { + return array("version" => "3.0"); + } } diff --git a/sites/all/modules/features/tests/features_test.features.user_permission.inc b/sites/all/modules/features/tests/features_test.features.user_permission.inc index 185509ad070a9592c251cb1ec5f4123d5d6192bd..a789c2f80aaf53991794ba1be8861b813dc5998a 100644 --- a/sites/all/modules/features/tests/features_test.features.user_permission.inc +++ b/sites/all/modules/features/tests/features_test.features.user_permission.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_user_default_permissions(). + * Implements hook_user_default_permissions(). */ function features_test_user_default_permissions() { $permissions = array(); diff --git a/sites/all/modules/features/tests/features_test.info b/sites/all/modules/features/tests/features_test.info index 0d6b941089a83111245e9c4459912de60f50bd68..0e926c8a5db1785a7914cec4e860775d1dcba706 100644 --- a/sites/all/modules/features/tests/features_test.info +++ b/sites/all/modules/features/tests/features_test.info @@ -5,21 +5,21 @@ dependencies[] = "strongarm" dependencies[] = "views" description = "Test module for Features testing." features[ctools][] = "strongarm:strongarm:1" +features[ctools][] = "views:views_default:3.0" features[field][] = "node-features_test-field_features_test" features[filter][] = "features_test" features[image][] = "features_test" features[node][] = "features_test" features[user_permission][] = "create features_test content" -features[views][] = "features_test" -features[views_api][] = "api:3.0-alpha1" +features[views_view][] = "features_test" hidden = TRUE name = "Features Tests" package = "Testing" php = "5.2.0" -; Information added by drupal.org packaging script on 2011-04-06 -version = "7.x-1.0-beta2" +; Information added by drupal.org packaging script on 2011-09-21 +version = "7.x-1.0-beta4" core = "7.x" project = "features" -datestamp = "1302049346" +datestamp = "1316565919" diff --git a/sites/all/modules/features/tests/features_test.views_default.inc b/sites/all/modules/features/tests/features_test.views_default.inc index abc88d77916bb3d1c13e93ac0e9479a93592842c..5d6427ede5695b4117c2c99de848910dd591edbb 100644 --- a/sites/all/modules/features/tests/features_test.views_default.inc +++ b/sites/all/modules/features/tests/features_test.views_default.inc @@ -1,7 +1,7 @@ <?php /** - * Implementation of hook_views_default_views(). + * Implements hook_views_default_views(). */ function features_test_views_default_views() { $views = array(); @@ -11,13 +11,13 @@ function features_test_views_default_views() { $view->name = 'features_test'; $view->description = 'Test view provided by Features testing module.'; $view->tag = 'testing'; - $view->view_php = ''; $view->base_table = 'node'; - $view->is_cacheable = FALSE; + $view->human_name = ''; + $view->core = 0; $view->api_version = '3.0-alpha1'; $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ - -/* Display: Defaults */ + + /* Display: Defaults */ $handler = $view->new_display('default', 'Defaults', 'default'); $handler->display->display_options['title'] = 'Test'; $handler->display->display_options['access']['type'] = 'none'; @@ -27,6 +27,19 @@ function features_test_views_default_views() { $handler->display->display_options['pager']['type'] = 'full'; $handler->display->display_options['style_plugin'] = 'default'; $handler->display->display_options['row_plugin'] = 'node'; + $translatables['features_test'] = array( + t('Defaults'), + t('Test'), + t('more'), + t('Apply'), + t('Reset'), + t('Sort by'), + t('Asc'), + t('Desc'), + t('Items per page'), + t('- All -'), + t('Offset'), + ); $views[$view->name] = $view; diff --git a/sites/all/modules/features/theme/features-admin-components.tpl.php b/sites/all/modules/features/theme/features-admin-components.tpl.php index ecb69497cfcd0d13d733e5ed070e3a79d5e985d6..4b52dd6eeadc942acb5188559d71e9d6339ae3c4 100644 --- a/sites/all/modules/features/theme/features-admin-components.tpl.php +++ b/sites/all/modules/features/theme/features-admin-components.tpl.php @@ -12,7 +12,7 @@ <div class='components'> <?php print $components ?> <?php if (!empty($key)): ?> - <div class='clear-block features-key'><?php print theme('links', $key) ?></div> + <div class='clear-block features-key'><?php print theme('links', array('links' => $key)) ?></div> <?php endif; ?> <?php if (!empty($buttons)): ?> <div class='buttons clear-block'><?php print $buttons ?></div> diff --git a/sites/all/modules/features/theme/theme.inc b/sites/all/modules/features/theme/theme.inc index 1971090cd411713c3260d236d2496802b5a891d5..d1502b21035a2326fa792fd24dfd0b7966c255e1 100644 --- a/sites/all/modules/features/theme/theme.inc +++ b/sites/all/modules/features/theme/theme.inc @@ -31,21 +31,11 @@ function template_preprocess_features_admin_components(&$vars) { // Components $rows = array(); $components = features_get_components(); - $conflicts = features_get_conflicts(); - if (!module_exists($form['module']['#value']) && isset($form['module']['#value']) && !empty($conflicts[$form['module']['#value']])) { - $module_conflicts = $conflicts[$form['module']['#value']]; - $conflicts = array(); - foreach ($module_conflicts as $conflict) { - $conflicts = array_merge_recursive($conflict, $conflicts); - } - } - else { - $conflicts = array(); - } + // Display key for conflicting elements. - if (!empty($conflicts)) { + if (!empty($form['#conflicts'])) { $vars['key'][] = array( - 'title' => theme('features_storage_link', FEATURES_CONFLICT, t('Conflicts with another feature')), + 'title' => theme('features_storage_link', array('storage' => FEATURES_CONFLICT, 'text' => t('Conflicts with another feature'))), 'html' => TRUE, ); } @@ -53,6 +43,10 @@ function template_preprocess_features_admin_components(&$vars) { if (!empty($form['#info']['features'])) { foreach ($form['#info']['features'] as $component => $items) { if (!empty($items)) { + $conflicts = array_key_exists($component, $form['#conflicts']) + ? $form['#conflicts'][$component] + : NULL; + $header = $data = array(); if (element_children($form['revert'])) { $header[] = array( @@ -74,7 +68,7 @@ function template_preprocess_features_admin_components(&$vars) { $data[] = ''; } $data[] = array( - 'data' => theme('features_component_list', array('components' => $items, 'source' => $items)), + 'data' => theme('features_component_list', array('components' => $items, 'source' => $items, 'conflicts' => $conflicts)), 'colspan' => 2, 'class' => 'component' ); @@ -128,7 +122,7 @@ function theme_features_storage_link($vars) { FEATURES_CONFLICT => t('Conflict'), FEATURES_DISABLED => t('Disabled'), ); - $text = isset($text) ? $text : $default_text[$vars['storage']]; + $text = isset($vars['text']) ? $vars['text'] : $default_text[$vars['storage']]; if ($vars['path']) { $vars['options']['attributes']['class'][] = $classes[$vars['storage']]; $vars['options']['attributes']['class'][] = 'features-storage'; diff --git a/sites/all/modules/unl/features/unl_content_types/unl_content_types.features.field.inc b/sites/all/modules/unl/features/unl_content_types/unl_content_types.features.field.inc deleted file mode 100644 index 409a73715efe339c6761c65119e76fb5892c28d9..0000000000000000000000000000000000000000 --- a/sites/all/modules/unl/features/unl_content_types/unl_content_types.features.field.inc +++ /dev/null @@ -1,385 +0,0 @@ -<?php -/** - * @file - * unl_content_types.features.field.inc - */ - -/** - * Implementation of hook_field_default_fields(). - */ -function unl_content_types_field_default_fields() { - $fields = array(); - - // Exported field: 'node-unl_carousel-body' - $fields['node-unl_carousel-body'] = array( - 'field_config' => array( - 'active' => '1', - 'cardinality' => '1', - 'deleted' => '0', - 'entity_types' => array( - 0 => 'node', - ), - 'field_name' => 'body', - 'foreign keys' => array( - 'format' => array( - 'columns' => array( - 'format' => 'format', - ), - 'table' => 'filter_format', - ), - ), - 'indexes' => array( - 'format' => array( - 0 => 'format', - ), - ), - 'module' => 'text', - 'settings' => array(), - 'translatable' => '1', - 'type' => 'text_with_summary', - ), - 'field_instance' => array( - 'bundle' => 'unl_carousel', - 'default_value' => NULL, - 'deleted' => '0', - 'description' => '', - 'display' => array( - 'default' => array( - 'label' => 'hidden', - 'module' => 'text', - 'settings' => array(), - 'type' => 'text_default', - 'weight' => '0', - ), - 'teaser' => array( - 'label' => 'hidden', - 'module' => 'text', - 'settings' => array( - 'trim_length' => 600, - ), - 'type' => 'text_summary_or_trimmed', - 'weight' => 0, - ), - ), - 'entity_type' => 'node', - 'field_name' => 'body', - 'label' => 'Body', - 'required' => FALSE, - 'settings' => array( - 'display_summary' => TRUE, - 'text_processing' => 1, - 'user_register_form' => FALSE, - ), - 'widget' => array( - 'module' => 'text', - 'settings' => array( - 'rows' => 20, - 'summary_rows' => 5, - ), - 'type' => 'text_textarea_with_summary', - 'weight' => '-4', - ), - 'widget_type' => 'text_textarea_with_summary', - ), - ); - - // Exported field: 'node-unl_carousel-field_carouselcaptions' - $fields['node-unl_carousel-field_carouselcaptions'] = array( - 'field_config' => array( - 'active' => '1', - 'cardinality' => '-1', - 'deleted' => '0', - 'entity_types' => array(), - 'field_name' => 'field_carouselcaptions', - 'foreign keys' => array( - 'format' => array( - 'columns' => array( - 'format' => 'format', - ), - 'table' => 'filter_format', - ), - ), - 'indexes' => array( - 'format' => array( - 0 => 'format', - ), - ), - 'module' => 'text', - 'settings' => array( - 'max_length' => '512', - ), - 'translatable' => '1', - 'type' => 'text', - ), - 'field_instance' => array( - 'bundle' => 'unl_carousel', - 'default_value' => NULL, - 'deleted' => '0', - 'description' => '', - 'display' => array( - 'default' => array( - 'label' => 'hidden', - 'module' => 'text', - 'settings' => array(), - 'type' => 'text_default', - 'weight' => '2', - ), - 'teaser' => array( - 'label' => 'above', - 'settings' => array(), - 'type' => 'hidden', - 'weight' => 0, - ), - ), - 'entity_type' => 'node', - 'field_name' => 'field_carouselcaptions', - 'label' => 'Image Captions', - 'required' => 0, - 'settings' => array( - 'text_processing' => '0', - 'user_register_form' => FALSE, - ), - 'widget' => array( - 'active' => 1, - 'module' => 'text', - 'settings' => array( - 'size' => '128', - ), - 'type' => 'text_textfield', - 'weight' => '-2', - ), - ), - ); - - // Exported field: 'node-unl_carousel-field_carouselimages' - $fields['node-unl_carousel-field_carouselimages'] = array( - 'field_config' => array( - 'active' => '1', - 'cardinality' => '-1', - 'deleted' => '0', - 'entity_types' => array(), - 'field_name' => 'field_carouselimages', - 'foreign keys' => array( - 'fid' => array( - 'columns' => array( - 'fid' => 'fid', - ), - 'table' => 'file_managed', - ), - ), - 'indexes' => array( - 'fid' => array( - 0 => 'fid', - ), - ), - 'module' => 'image', - 'settings' => array( - 'default_image' => 0, - 'uri_scheme' => 'public', - ), - 'translatable' => '1', - 'type' => 'image', - ), - 'field_instance' => array( - 'bundle' => 'unl_carousel', - 'deleted' => '0', - 'description' => 'Add captions in the same order as the photos below. \'Title\' is used for the photo credit.', - 'display' => array( - 'default' => array( - 'label' => 'hidden', - 'module' => 'image', - 'settings' => array( - 'image_link' => '', - 'image_style' => '', - ), - 'type' => 'image', - 'weight' => '1', - ), - 'teaser' => array( - 'label' => 'above', - 'settings' => array(), - 'type' => 'hidden', - 'weight' => 0, - ), - ), - 'entity_type' => 'node', - 'field_name' => 'field_carouselimages', - 'label' => 'Images', - 'required' => 1, - 'settings' => array( - 'alt_field' => 1, - 'file_directory' => 'images/carousel', - 'file_extensions' => 'png gif jpg jpeg', - 'max_filesize' => '1 MB', - 'max_resolution' => '960x960', - 'min_resolution' => '', - 'title_field' => 1, - 'user_register_form' => FALSE, - ), - 'widget' => array( - 'active' => 1, - 'module' => 'image', - 'settings' => array( - 'preview_image_style' => 'thumbnail', - 'progress_indicator' => 'throbber', - ), - 'type' => 'image_image', - 'weight' => '-3', - ), - ), - ); - - // Exported field: 'node-unl_people_directory-body' - $fields['node-unl_people_directory-body'] = array( - 'field_config' => array( - 'active' => '1', - 'cardinality' => '1', - 'deleted' => '0', - 'entity_types' => array( - 0 => 'node', - ), - 'field_name' => 'body', - 'foreign keys' => array( - 'format' => array( - 'columns' => array( - 'format' => 'format', - ), - 'table' => 'filter_format', - ), - ), - 'indexes' => array( - 'format' => array( - 0 => 'format', - ), - ), - 'module' => 'text', - 'settings' => array(), - 'translatable' => '1', - 'type' => 'text_with_summary', - ), - 'field_instance' => array( - 'bundle' => 'unl_people_directory', - 'default_value' => NULL, - 'deleted' => '0', - 'description' => 'Optional explanatory text that will appear at the top of the page above the listings. ', - 'display' => array( - 'default' => array( - 'label' => 'hidden', - 'module' => 'text', - 'settings' => array(), - 'type' => 'text_default', - 'weight' => '0', - ), - 'teaser' => array( - 'label' => 'hidden', - 'module' => 'text', - 'settings' => array( - 'trim_length' => 600, - ), - 'type' => 'text_summary_or_trimmed', - 'weight' => 0, - ), - ), - 'entity_type' => 'node', - 'field_name' => 'body', - 'label' => 'Body', - 'required' => 0, - 'settings' => array( - 'display_summary' => 0, - 'text_processing' => '0', - 'user_register_form' => FALSE, - ), - 'widget' => array( - 'active' => 1, - 'module' => 'text', - 'settings' => array( - 'rows' => '4', - 'summary_rows' => 5, - ), - 'type' => 'text_textarea_with_summary', - 'weight' => '-4', - ), - 'widget_type' => 'text_textarea_with_summary', - ), - ); - - // Exported field: 'node-unl_people_directory-field_hrorgunit' - $fields['node-unl_people_directory-field_hrorgunit'] = array( - 'field_config' => array( - 'active' => '1', - 'cardinality' => '1', - 'deleted' => '0', - 'entity_types' => array(), - 'field_name' => 'field_hrorgunit', - 'foreign keys' => array( - 'format' => array( - 'columns' => array( - 'format' => 'format', - ), - 'table' => 'filter_format', - ), - ), - 'indexes' => array( - 'format' => array( - 0 => 'format', - ), - ), - 'module' => 'text', - 'settings' => array( - 'max_length' => '255', - ), - 'translatable' => '1', - 'type' => 'text', - ), - 'field_instance' => array( - 'bundle' => 'unl_people_directory', - 'default_value' => NULL, - 'deleted' => '0', - 'description' => 'Enter the number that is shown, without the parenthesis, when the name of the department is hovered over on a directory.unl.edu department listing. For example, when Human Resources is hovered over on directory.unl.edu/departments/19 the HR Org Unit Number of 50000821 is visible.', - 'display' => array( - 'default' => array( - 'label' => 'hidden', - 'module' => 'text', - 'settings' => array(), - 'type' => 'text_default', - 'weight' => '1', - ), - 'teaser' => array( - 'label' => 'above', - 'settings' => array(), - 'type' => 'hidden', - 'weight' => 0, - ), - ), - 'entity_type' => 'node', - 'field_name' => 'field_hrorgunit', - 'label' => 'UNL HR Org Unit Number', - 'required' => 1, - 'settings' => array( - 'text_processing' => '0', - 'user_register_form' => FALSE, - ), - 'widget' => array( - 'active' => 1, - 'module' => 'text', - 'settings' => array( - 'size' => '10', - ), - 'type' => 'text_textfield', - 'weight' => '-3', - ), - ), - ); - - // Translatables - // Included for use with string extractors like potx. - t('Add captions in the same order as the photos below. \'Title\' is used for the photo credit.'); - t('Body'); - t('Enter the number that is shown, without the parenthesis, when the name of the department is hovered over on a directory.unl.edu department listing. For example, when Human Resources is hovered over on directory.unl.edu/departments/19 the HR Org Unit Number of 50000821 is visible.'); - t('Image Captions'); - t('Images'); - t('Optional explanatory text that will appear at the top of the page above the listings. '); - t('UNL HR Org Unit Number'); - - return $fields; -} diff --git a/sites/all/modules/unl/features/unl_content_types/unl_content_types.features.inc b/sites/all/modules/unl/features/unl_content_types/unl_content_types.features.inc deleted file mode 100644 index 4f3eb56c0384befeae43d228e2081f1dbed7a988..0000000000000000000000000000000000000000 --- a/sites/all/modules/unl/features/unl_content_types/unl_content_types.features.inc +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * @file - * unl_content_types.features.inc - */ - -/** - * Implementation of hook_node_info(). - */ -function unl_content_types_node_info() { - $items = array( - 'unl_carousel' => array( - 'name' => t('Carousel'), - 'base' => 'node_content', - 'description' => t('A slideshow of photos.'), - 'has_title' => '1', - 'title_label' => t('Title'), - 'help' => '', - ), - 'unl_people_directory' => array( - 'name' => t('People Directory'), - 'base' => 'node_content', - 'description' => t('A directory listing of staff and/or faculty members of the specified unit pulled from directory.unl.edu.'), - 'has_title' => '1', - 'title_label' => t('Title'), - 'help' => '', - ), - ); - return $items; -} diff --git a/sites/all/modules/unl/features/unl_content_types/unl_content_types.info b/sites/all/modules/unl/features/unl_content_types/unl_content_types.info deleted file mode 100644 index 78caacbe8ac167d66f99483bb8c4ff09e75f5837..0000000000000000000000000000000000000000 --- a/sites/all/modules/unl/features/unl_content_types/unl_content_types.info +++ /dev/null @@ -1,15 +0,0 @@ -core = "7.x" -dependencies[] = "features" -dependencies[] = "image" -description = "Content types shared across all UNL templated sites." -features[field][] = "node-unl_carousel-body" -features[field][] = "node-unl_carousel-field_carouselcaptions" -features[field][] = "node-unl_carousel-field_carouselimages" -features[field][] = "node-unl_people_directory-body" -features[field][] = "node-unl_people_directory-field_hrorgunit" -features[node][] = "unl_carousel" -features[node][] = "unl_people_directory" -name = "UNL Content Types" -package = "Features" -project = "unl_content_types" -version = "7.x-1.0" diff --git a/sites/all/modules/unl/features/unl_content_types/unl_content_types.module b/sites/all/modules/unl/features/unl_content_types/unl_content_types.module deleted file mode 100644 index e4815c6f55c5fbb74a2d8e01aebd82e18082240b..0000000000000000000000000000000000000000 --- a/sites/all/modules/unl/features/unl_content_types/unl_content_types.module +++ /dev/null @@ -1,7 +0,0 @@ -<?php -/** - * @file - * Code for the UNL Content Types feature. - */ - -include_once('unl_content_types.features.inc'); diff --git a/sites/all/modules/unl/features/unl_news/unl_news.features.field.inc b/sites/all/modules/unl/features/unl_news/unl_news.features.field.inc new file mode 100644 index 0000000000000000000000000000000000000000..f2ec4660612c84a0149afa71f9ea1ad94bb7095a --- /dev/null +++ b/sites/all/modules/unl/features/unl_news/unl_news.features.field.inc @@ -0,0 +1,312 @@ +<?php +/** + * @file + * unl_news.features.field.inc + */ + +/** + * Implements hook_field_default_fields(). + */ +function unl_news_field_default_fields() { + $fields = array(); + + // Exported field: 'node-unl_newsitem-body' + $fields['node-unl_newsitem-body'] = array( + 'field_config' => array( + 'active' => '1', + 'cardinality' => '1', + 'deleted' => '0', + 'entity_types' => array( + 0 => 'node', + ), + 'field_name' => 'body', + 'foreign keys' => array( + 'format' => array( + 'columns' => array( + 'format' => 'format', + ), + 'table' => 'filter_format', + ), + ), + 'indexes' => array( + 'format' => array( + 0 => 'format', + ), + ), + 'module' => 'text', + 'settings' => array(), + 'translatable' => '1', + 'type' => 'text_with_summary', + ), + 'field_instance' => array( + 'bundle' => 'unl_newsitem', + 'default_value' => NULL, + 'deleted' => '0', + 'description' => '', + 'display' => array( + 'abbr_teaser' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => '2', + ), + 'default' => array( + 'label' => 'hidden', + 'module' => 'text', + 'settings' => array(), + 'type' => 'text_default', + 'weight' => '0', + ), + 'full' => array( + 'label' => 'hidden', + 'module' => 'text', + 'settings' => array(), + 'type' => 'text_default', + 'weight' => '1', + ), + 'rss' => array( + 'label' => 'hidden', + 'module' => 'text', + 'settings' => array(), + 'type' => 'text_default', + 'weight' => '0', + ), + 'teaser' => array( + 'label' => 'hidden', + 'module' => 'text', + 'settings' => array( + 'trim_length' => '1000', + ), + 'type' => 'text_summary_or_trimmed', + 'weight' => '0', + ), + 'view_teaser' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => '2', + ), + ), + 'entity_type' => 'node', + 'field_name' => 'body', + 'label' => 'Body', + 'required' => FALSE, + 'settings' => array( + 'display_summary' => TRUE, + 'text_processing' => 1, + 'user_register_form' => FALSE, + ), + 'widget' => array( + 'module' => 'text', + 'settings' => array( + 'rows' => 20, + 'summary_rows' => 5, + ), + 'type' => 'text_textarea_with_summary', + 'weight' => '1', + ), + 'widget_type' => 'text_textarea_with_summary', + ), + ); + + // Exported field: 'node-unl_newsitem-field_unl_imgcar' + $fields['node-unl_newsitem-field_unl_imgcar'] = array( + 'field_config' => array( + 'active' => '1', + 'cardinality' => '-1', + 'deleted' => '0', + 'entity_types' => array(), + 'field_name' => 'field_unl_imgcar', + 'foreign keys' => array( + 'fid' => array( + 'columns' => array( + 'fid' => 'fid', + ), + 'table' => 'file_managed', + ), + ), + 'indexes' => array( + 'fid' => array( + 0 => 'fid', + ), + ), + 'module' => 'image', + 'settings' => array( + 'default_image' => 0, + 'uri_scheme' => 'public', + ), + 'translatable' => '0', + 'type' => 'image', + ), + 'field_instance' => array( + 'bundle' => 'unl_newsitem', + 'deleted' => '0', + 'description' => '', + 'display' => array( + 'abbr_teaser' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => '1', + ), + 'default' => array( + 'label' => 'hidden', + 'module' => 'image', + 'settings' => array( + 'image_link' => '', + 'image_style' => '', + ), + 'type' => 'image', + 'weight' => '2', + ), + 'rss' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => '2', + ), + 'teaser' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => '2', + ), + ), + 'entity_type' => 'node', + 'field_name' => 'field_unl_imgcar', + 'label' => 'Photo Carousel', + 'required' => 0, + 'settings' => array( + 'alt_field' => 1, + 'file_directory' => 'images', + 'file_extensions' => 'png gif jpg jpeg', + 'max_filesize' => '', + 'max_resolution' => '', + 'min_resolution' => '', + 'title_field' => 1, + 'user_register_form' => FALSE, + ), + 'widget' => array( + 'active' => 1, + 'module' => 'image', + 'settings' => array( + 'preview_image_style' => 'thumbnail', + 'progress_indicator' => 'throbber', + ), + 'type' => 'image_image', + 'weight' => '3', + ), + ), + ); + + // Exported field: 'node-unl_newsitem-field_unl_newsimg' + $fields['node-unl_newsitem-field_unl_newsimg'] = array( + 'field_config' => array( + 'active' => '1', + 'cardinality' => '-1', + 'deleted' => '0', + 'entity_types' => array(), + 'field_name' => 'field_unl_newsimg', + 'foreign keys' => array( + 'fid' => array( + 'columns' => array( + 'fid' => 'fid', + ), + 'table' => 'file_managed', + ), + ), + 'indexes' => array( + 'fid' => array( + 0 => 'fid', + ), + ), + 'module' => 'image', + 'settings' => array( + 'default_image' => 0, + 'uri_scheme' => 'public', + ), + 'translatable' => '0', + 'type' => 'image', + ), + 'field_instance' => array( + 'bundle' => 'unl_newsitem', + 'deleted' => '0', + 'description' => 'The first image will appear at the top of the page with the story text. Additional images will appear in a gallery at the bottom of the story.', + 'display' => array( + 'abbr_teaser' => array( + 'label' => 'hidden', + 'module' => 'image', + 'settings' => array( + 'image_link' => 'content', + 'image_style' => 'square_thumbnail', + ), + 'type' => 'image', + 'weight' => '0', + ), + 'default' => array( + 'label' => 'above', + 'module' => 'image', + 'settings' => array( + 'image_link' => 'file', + 'image_style' => 'medium', + ), + 'type' => 'image', + 'weight' => '1', + ), + 'rss' => array( + 'label' => 'hidden', + 'module' => 'image', + 'settings' => array( + 'image_link' => 'file', + 'image_style' => 'medium', + ), + 'type' => 'image', + 'weight' => '1', + ), + 'teaser' => array( + 'label' => 'hidden', + 'module' => 'image', + 'settings' => array( + 'image_link' => 'content', + 'image_style' => 'thumbnail', + ), + 'type' => 'image', + 'weight' => '1', + ), + ), + 'entity_type' => 'node', + 'field_name' => 'field_unl_newsimg', + 'label' => 'Images', + 'required' => 0, + 'settings' => array( + 'alt_field' => 1, + 'file_directory' => 'images/news', + 'file_extensions' => 'png gif jpg jpeg', + 'max_filesize' => '', + 'max_resolution' => '', + 'min_resolution' => '', + 'title_field' => 1, + 'user_register_form' => FALSE, + ), + 'widget' => array( + 'active' => 1, + 'module' => 'image', + 'settings' => array( + 'preview_image_style' => 'thumbnail', + 'progress_indicator' => 'throbber', + ), + 'type' => 'image_image', + 'weight' => '2', + ), + ), + ); + + // Translatables + // Included for use with string extractors like potx. + t('Body'); + t('Images'); + t('Photo Carousel'); + t('The first image will appear at the top of the page with the story text. Additional images will appear in a gallery at the bottom of the story.'); + + return $fields; +} diff --git a/sites/all/modules/unl/features/unl_news/unl_news.features.inc b/sites/all/modules/unl/features/unl_news/unl_news.features.inc new file mode 100644 index 0000000000000000000000000000000000000000..69547b84d902c8cb041052bc98d8c80706d58fee --- /dev/null +++ b/sites/all/modules/unl/features/unl_news/unl_news.features.inc @@ -0,0 +1,62 @@ +<?php +/** + * @file + * unl_news.features.inc + */ + +/** + * Implements hook_views_api(). + */ +function unl_news_views_api() { + list($module, $api) = func_get_args(); + if ($module == "views" && $api == "views_default") { + return array("version" => "3.0"); + } +} + +/** + * Implements hook_image_default_styles(). + */ +function unl_news_image_default_styles() { + $styles = array(); + + // Exported image style: square_thumbnail + $styles['square_thumbnail'] = array( + 'name' => 'square_thumbnail', + 'effects' => array( + 2 => array( + 'label' => 'Scale and crop', + 'help' => 'Scale and crop will maintain the aspect-ratio of the original image, then crop the larger dimension. This is most useful for creating perfectly square thumbnails without stretching the image.', + 'effect callback' => 'image_scale_and_crop_effect', + 'form callback' => 'image_resize_form', + 'summary theme' => 'image_resize_summary', + 'module' => 'image', + 'name' => 'image_scale_and_crop', + 'data' => array( + 'width' => '60', + 'height' => '60', + ), + 'weight' => '-10', + ), + ), + ); + + return $styles; +} + +/** + * Implements hook_node_info(). + */ +function unl_news_node_info() { + $items = array( + 'unl_newsitem' => array( + 'name' => t('News item'), + 'base' => 'node_content', + 'description' => t('A news article with byline and associated imagery. <em>(Provided by the UNLcms project.)</em>'), + 'has_title' => '1', + 'title_label' => t('Title'), + 'help' => '', + ), + ); + return $items; +} diff --git a/sites/all/modules/unl/features/unl_news/unl_news.info b/sites/all/modules/unl/features/unl_news/unl_news.info new file mode 100644 index 0000000000000000000000000000000000000000..68885c2d95fe9298547d9e97a737ea0fece99ee6 --- /dev/null +++ b/sites/all/modules/unl/features/unl_news/unl_news.info @@ -0,0 +1,17 @@ +core = "7.x" +dependencies[] = "features" +dependencies[] = "image" +dependencies[] = "views" +description = "News content type and views provided by central UNLcms project." +features[ctools][] = "views:views_default:3.0" +features[field][] = "node-unl_newsitem-body" +features[field][] = "node-unl_newsitem-field_unl_imgcar" +features[field][] = "node-unl_newsitem-field_unl_newsimg" +features[image][] = "square_thumbnail" +features[node][] = "unl_newsitem" +features[views_view][] = "news_items" +name = "UNL News" +package = "Features" +php = "5.2.4" +project = "unl_news" +version = "7.x-1.0-beta5" diff --git a/sites/all/modules/unl/features/unl_news/unl_news.module b/sites/all/modules/unl/features/unl_news/unl_news.module new file mode 100644 index 0000000000000000000000000000000000000000..3d5047475ee3bfee3ee1ca271b17f5458c63320e --- /dev/null +++ b/sites/all/modules/unl/features/unl_news/unl_news.module @@ -0,0 +1,7 @@ +<?php +/** + * @file + * Code for the UNL News feature. + */ + +include_once('unl_news.features.inc'); diff --git a/sites/all/modules/unl/features/unl_news/unl_news.views_default.inc b/sites/all/modules/unl/features/unl_news/unl_news.views_default.inc new file mode 100644 index 0000000000000000000000000000000000000000..70fad5e850d76732946661c3f343bcb9a00a1a19 --- /dev/null +++ b/sites/all/modules/unl/features/unl_news/unl_news.views_default.inc @@ -0,0 +1,125 @@ +<?php +/** + * @file + * unl_news.views_default.inc + */ + +/** + * Implements hook_views_default_views(). + */ +function unl_news_views_default_views() { + $export = array(); + + $view = new view; + $view->name = 'news_items'; + $view->description = 'A listing of nodes of type unl_newsitem'; + $view->tag = 'unlcms, news'; + $view->base_table = 'node'; + $view->human_name = 'News Items (UNLcms)'; + $view->core = 7; + $view->api_version = '3.0-alpha1'; + $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['access']['type'] = 'perm'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['query']['options']['query_comment'] = FALSE; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['pager']['options']['items_per_page'] = '10'; + $handler->display->display_options['pager']['options']['offset'] = '0'; + $handler->display->display_options['pager']['options']['id'] = '0'; + $handler->display->display_options['pager']['options']['expose']['items_per_page_options_all'] = 0; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'node'; + $handler->display->display_options['row_options']['links'] = 1; + $handler->display->display_options['row_options']['comments'] = 0; + /* 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']['label'] = ''; + $handler->display->display_options['fields']['title']['alter']['alter_text'] = 0; + $handler->display->display_options['fields']['title']['alter']['make_link'] = 0; + $handler->display->display_options['fields']['title']['alter']['absolute'] = 0; + $handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0; + $handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0; + $handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0; + $handler->display->display_options['fields']['title']['alter']['trim'] = 0; + $handler->display->display_options['fields']['title']['alter']['html'] = 0; + $handler->display->display_options['fields']['title']['hide_empty'] = 0; + $handler->display->display_options['fields']['title']['empty_zero'] = 0; + $handler->display->display_options['fields']['title']['link_to_node'] = 1; + /* Sort criterion: Content: Post date */ + $handler->display->display_options['sorts']['created']['id'] = 'created'; + $handler->display->display_options['sorts']['created']['table'] = 'node'; + $handler->display->display_options['sorts']['created']['field'] = 'created'; + $handler->display->display_options['sorts']['created']['order'] = 'DESC'; + /* Filter criterion: Content: Published */ + $handler->display->display_options['filters']['status']['id'] = 'status'; + $handler->display->display_options['filters']['status']['table'] = 'node'; + $handler->display->display_options['filters']['status']['field'] = 'status'; + $handler->display->display_options['filters']['status']['value'] = '1'; + $handler->display->display_options['filters']['status']['group'] = 0; + $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; + /* 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']['value'] = array( + 'unl_newsitem' => 'unl_newsitem', + ); + + /* Display: Page */ + $handler = $view->new_display('page', 'Page', 'page'); + $handler->display->display_options['defaults']['title'] = FALSE; + $handler->display->display_options['title'] = 'News'; + $handler->display->display_options['defaults']['css_class'] = FALSE; + $handler->display->display_options['css_class'] = 'view-teaser'; + $handler->display->display_options['path'] = 'news/list'; + + /* Display: Feed */ + $handler = $view->new_display('feed', 'Feed', 'feed'); + $handler->display->display_options['pager']['type'] = 'some'; + $handler->display->display_options['pager']['options']['items_per_page'] = '20'; + $handler->display->display_options['pager']['options']['offset'] = '0'; + $handler->display->display_options['style_plugin'] = 'rss'; + $handler->display->display_options['row_plugin'] = 'node_rss'; + $handler->display->display_options['path'] = 'news.xml'; + $handler->display->display_options['displays'] = array( + 'default' => 'default', + 'page' => 'page', + 'unl_newsitem' => 'unl_newsitem', + ); + $handler->display->display_options['sitename_title'] = 1; + + /* Display: Block */ + $handler = $view->new_display('block', 'Block', 'unl_newsitem'); + $handler->display->display_options['defaults']['title'] = FALSE; + $handler->display->display_options['title'] = 'News'; + $handler->display->display_options['defaults']['css_class'] = FALSE; + $handler->display->display_options['css_class'] = 'view-teaser-abbr'; + $handler->display->display_options['defaults']['use_more'] = FALSE; + $handler->display->display_options['use_more'] = TRUE; + $handler->display->display_options['use_more_text'] = 'more news...'; + $handler->display->display_options['defaults']['pager'] = FALSE; + $handler->display->display_options['pager']['type'] = 'some'; + $handler->display->display_options['pager']['options']['items_per_page'] = '6'; + $handler->display->display_options['pager']['options']['offset'] = '0'; + $handler->display->display_options['defaults']['style_plugin'] = FALSE; + $handler->display->display_options['style_plugin'] = 'list'; + $handler->display->display_options['style_options']['class'] = 'unlcms-newslist'; + $handler->display->display_options['defaults']['style_options'] = FALSE; + $handler->display->display_options['defaults']['row_plugin'] = FALSE; + $handler->display->display_options['row_plugin'] = 'node'; + $handler->display->display_options['row_options']['view_mode'] = 'abbr_teaser'; + $handler->display->display_options['row_options']['links'] = 0; + $handler->display->display_options['row_options']['comments'] = 0; + $handler->display->display_options['defaults']['row_options'] = FALSE; + $handler->display->display_options['block_description'] = 'News Items (UNLcms provided)'; + $export['news_items'] = $view; + + return $export; +} diff --git a/sites/all/modules/unl/unl.module b/sites/all/modules/unl/unl.module index 8386c0f48b4e1511298aabd3f5e6a8488c1c0e99..ffe99ef174b19a3982dee28eeca062d3dd01f2d0 100644 --- a/sites/all/modules/unl/unl.module +++ b/sites/all/modules/unl/unl.module @@ -34,6 +34,17 @@ function unl_field_attach_view_alter(&$output, $context) { require_once dirname(__FILE__) . '/includes/common.php'; +/** + * Implementation of hook_entity_info_alter(). + */ +function unl_entity_info_alter(&$entity_info) { + // Add additional view_mode to admin/structure/types/manage/CONTENTTYPE/display for an abbriviated teaser (for use in sidebars, etc) + $entity_info['node']['view modes']['abbr_teaser'] = array( + 'label' => t('Abbriviated teaser'), + 'custom settings' => TRUE, + ); +} + /** * Implementation of hook_html_head_alter(). */ @@ -476,7 +487,7 @@ function unl_form_field_ui_display_overview_form_alter(&$form, &$form_state, $fo /** * Implementation of hook_form_alter(). */ -function unl_form_alter(&$form, &$form_state, $form_id) { +function unl_form_alter(&$form, $form_state, $form_id) { // Make new menu items expanded by default. if ($form_id == 'menu_edit_item' && $form['mlid']['#value'] == 0) { $form['expanded']['#default_value'] = TRUE; @@ -510,14 +521,14 @@ function unl_form_alter(&$form, &$form_state, $form_id) { if (!in_array($admin_role_id, array_keys($GLOBALS['user']->roles))) { switch ($form_id) { // Don't allow editing of non-custom content types on admin/structure/types, i.e. don't allow subsites to edit the content types coming from modules or the UNL shared content types - case 'node_type_form' : - case 'field_ui_field_overview_form' : - case 'field_ui_display_overview_form' : - if (!$form['custom']['#value']) { - drupal_access_denied(); - exit; - } - break; +// case 'node_type_form' : +// case 'field_ui_field_overview_form' : +// case 'field_ui_display_overview_form' : +// if (!$form['custom']['#value']) { +// drupal_access_denied(); +// exit; +// } +// break; // Add additional validation on admin/people/permissions/roles/edit/% case 'user_admin_role' : $form['#validate'][] = 'unl_user_admin_role_validate'; @@ -605,7 +616,7 @@ function unl_form_alter(&$form, &$form_state, $form_id) { * determine whether or not the menu link is visible or not. */ if (substr($form_id, -10) == '_node_form') { - $form['menu']['#title'] = 'Site hierarchy'; + $form['menu']['#title'] = 'Site hierachy'; $form['menu']['enabled']['#default_value'] = TRUE; $form['menu']['enabled']['#prefix'] = '<div style="display: none;">'; @@ -643,7 +654,7 @@ function unl_form_alter(&$form, &$form_state, $form_id) { $form['options']['sticky']['#suffix'] = '</div>'; } - // Add the Roles checkboxes to the user edit form for users with ability to 'Administer users' but not 'Administer permissions' + // Add the Roles checkboxes to the user edit form for users with ability to 'Administer users' but not 'Administer permissions' (Code below partially taken from user.module) if (in_array($form_id, array('user_register_form', 'user_profile_form')) && user_access('administer users') && !user_access('administer permissions')) { $roles = array_map('check_plain', user_roles(TRUE)); // Unset the adminsitrator checkbox, validation code that prevents a user who is not an administrator from granting the administrator role is in the unl_cas module diff --git a/sites/all/themes/unl_wdn/field--field-unl-imgcar.tpl.php b/sites/all/themes/unl_wdn/field--field-unl-imgcar.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..eae709548141cf6f18325055cdcbc448cd28256f --- /dev/null +++ b/sites/all/themes/unl_wdn/field--field-unl-imgcar.tpl.php @@ -0,0 +1,60 @@ +<?php + +/** + * @file field.tpl.php + * unl_wdn template implementation to display a field_unl_imagecarousel field. + * + * Available variables: + * - $items: An array of field values. Use render() to output them. + * - $label: The item label. + * - $label_hidden: Whether the label display is set to 'hidden'. + * - $label_html_tag: The html tag to use for the label, h2, h3, div, etc. + * - $classes: String of classes that can be used to style contextually through + * CSS. It can be manipulated through the variable $classes_array from + * preprocess functions. The default values can be one or more of the + * following: + * - field: The current template type, i.e., "theming hook". + * - field-name-[field_name]: The current field name. For example, if the + * field name is "field_description" it would result in + * "field-name-field-description". + * - field-type-[field_type]: The current field type. For example, if the + * field type is "text" it would result in "field-type-text". + * - field-label-[label_display]: The current label position. For example, if + * the label position is "above" it would result in "field-label-above". + * + * Other variables: + * - $element['#object']: The entity to which the field is attached. + * - $element['#view_mode']: View mode, e.g. 'full', 'teaser'... + * - $element['#field_name']: The field name. + * - $element['#field_type']: The field type. + * - $element['#field_language']: The field language. + * - $element['#field_translatable']: Whether the field is translatable or not. + * - $element['#label_display']: Position of label display, inline, above, or + * hidden. + * - $field_name_css: The css-compatible field name. + * - $field_type_css: The css-compatible field type. + * - $classes_array: Array of html class attribute values. It is flattened + * into a string within the variable $classes. + * + * @see template_preprocess_field() + * @see theme_field() + */ +?> +<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>> + <?php if (!$label_hidden) : ?> + <<?php print $label_html_tag; ?> class="field-label"<?php print $title_attributes; ?>><?php print $label ?>: </<?php print $label_html_tag; ?>> + <?php endif; ?> + <div id="wdn_Carousel"> + <ul class="field-items"<?php print $content_attributes; ?>> + <?php foreach ($items as $delta => $item) : ?> + <li class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?> + <p><?php print $item["#item"]["title"]; ?></p> + </li> + <?php endforeach; ?> + </ul> + </div> +</div> + +<script type="text/javascript"> +WDN.initializePlugin('carousel'); +</script> \ No newline at end of file diff --git a/sites/all/themes/unl_wdn/node--unl-carousel.tpl.php b/sites/all/themes/unl_wdn/node--unl-carousel.tpl.php deleted file mode 100644 index d5fc9257907093ec4ee09a94426cea6561c05c98..0000000000000000000000000000000000000000 --- a/sites/all/themes/unl_wdn/node--unl-carousel.tpl.php +++ /dev/null @@ -1,121 +0,0 @@ -<?php - -/** - * @file - * unl_wdn theme implementation to display a carousel node. - * - * Available variables: - * - $title: the (sanitized) title of the node. - * - $content: An array of node items. Use render($content) to print them all, - * or print a subset such as render($content['field_example']). Use - * hide($content['field_example']) to temporarily suppress the printing of a - * given element. - * - $user_picture: The node author's picture from user-picture.tpl.php. - * - $date: Formatted creation date. Preprocess functions can reformat it by - * calling format_date() with the desired parameters on the $created variable. - * - $name: Themed username of node author output from theme_username(). - * - $node_url: Direct url of the current node. - * - $display_submitted: Whether submission information should be displayed. - * - $submitted: Submission information created from $name and $date during - * template_preprocess_node(). - * - $classes: String of classes that can be used to style contextually through - * CSS. It can be manipulated through the variable $classes_array from - * preprocess functions. The default values can be one or more of the - * following: - * - node: The current template type, i.e., "theming hook". - * - node-[type]: The current node type. For example, if the node is a - * "Blog entry" it would result in "node-blog". Note that the machine - * name will often be in a short form of the human readable label. - * - node-teaser: Nodes in teaser form. - * - node-preview: Nodes in preview mode. - * The following are controlled through the node publishing options. - * - node-promoted: Nodes promoted to the front page. - * - node-sticky: Nodes ordered above other non-sticky nodes in teaser - * listings. - * - node-unpublished: Unpublished nodes visible only to administrators. - * - $title_prefix (array): An array containing additional output populated by - * modules, intended to be displayed in front of the main title tag that - * appears in the template. - * - $title_suffix (array): An array containing additional output populated by - * modules, intended to be displayed after the main title tag that appears in - * the template. - * - * Other variables: - * - $node: Full node object. Contains data that may not be safe. - * - $type: Node type, i.e. story, page, blog, etc. - * - $comment_count: Number of comments attached to the node. - * - $uid: User ID of the node author. - * - $created: Time the node was published formatted in Unix timestamp. - * - $classes_array: Array of html class attribute values. It is flattened - * into a string within the variable $classes. - * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in - * teaser listings. - * - $id: Position of the node. Increments each time it's output. - * - * Node status variables: - * - $view_mode: View mode, e.g. 'full', 'teaser'... - * - $teaser: Flag for the teaser state (shortcut for $view_mode == 'teaser'). - * - $page: Flag for the full page state. - * - $promote: Flag for front page promotion state. - * - $sticky: Flags for sticky post setting. - * - $status: Flag for published status. - * - $comment: State of comment settings for the node. - * - $readmore: Flags true if the teaser content of the node cannot hold the - * main body content. - * - $is_front: Flags true when presented in the front page. - * - $logged_in: Flags true when the current user is a logged-in member. - * - $is_admin: Flags true when the current user is an administrator. - * - * Field variables: for each field instance attached to the node a corresponding - * variable is defined, e.g. $node->body becomes $body. When needing to access - * a field's raw values, developers/themers are strongly encouraged to use these - * variables. Otherwise they will have to explicitly specify the desired field - * language, e.g. $node->body['en'], thus overriding any language negotiation - * rule that was previously applied. - * - * @see template_preprocess() - * @see template_preprocess_node() - * @see template_process() - */ -?> -<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>> - - <?php print $user_picture; ?> - - <?php print render($title_prefix); ?> - <?php if (!$page): ?> - <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2> - <?php endif; ?> - <?php print render($title_suffix); ?> - - <?php if ($display_submitted): ?> - <div class="submitted"> - <?php print $submitted; ?> - </div> - <?php endif; ?> - - <div class="content"<?php print $content_attributes; ?>> - <?php print render($content['body']); ?> - <script type="text/javascript">WDN.initializePlugin('carousel');</script> - <div class="zenbox" style="display: inline-block;"><div id="wdn_Carousel"> - <ul> - <?php - foreach ($content['field_carouselimages']['#object']->field_carouselimages['und'] as $key => $image) { - $image_info = image_get_info($image['uri']); - print '<li> - <img alt="'.$image['alt'].'" title="'.$image['title'].'" src="'.file_create_url($image['uri']).'" width="'.$image_info['width'].'" height="'.$image_info['height'].'" /> - '.(isset($content['field_carouselcaptions']['#object']->field_carouselcaptions['und'][$key]['value']) ? - '<p>'.$content['field_carouselcaptions']['#object']->field_carouselcaptions['und'][$key]['value']. - ' <span style="font-size:0.6em;font-style:italic">'.$image['title'].'</span></p>' : "").' - </li>'; - } - ?> - </ul> - </div></div> - </div> - - <?php print render($content['links']); ?> - - <?php print render($content['comments']); ?> - -</div> diff --git a/sites/all/themes/unl_wdn/node--unl-newsitem.tpl.php b/sites/all/themes/unl_wdn/node--unl-newsitem.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..f906141a0b9c732cf0b2c042c8b8102fa20bccbf --- /dev/null +++ b/sites/all/themes/unl_wdn/node--unl-newsitem.tpl.php @@ -0,0 +1,71 @@ +<?php +/** + * @file + * unl_wdn theme implementation to display a news item node. + */ +?> +<div id="node-<?php print $node->nid; ?><?php print ($view_mode != 'full' ? '-teaser' : ''); ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>> + + <?php print render($title_prefix); ?> + <?php if ($view_mode != 'full'): ?> + <h4<?php print $title_attributes; ?>> + <?php if ($view_mode == 'abbr_teaser'): ?> + <?php + print render($content["field_unl_newsimg"][0]); + ?> + <?php endif; ?> + <a href="<?php print $node_url; ?>"><?php print $title; ?></a> + </h4> + <?php endif; ?> + <?php print render($title_suffix); ?> + + <?php if ($view_mode == 'full'): ?> + <?php print render($content["field_unl_imgcar"]); ?> + <?php endif; ?> + + <?php if ($view_mode == 'full' || $view_mode == 'teaser' && $display_submitted): ?> + <div class="meta submitted"> + <?php print $submitted; ?> + </div> + <?php endif; ?> + + <div class="content clearfix"<?php print $content_attributes; ?>> + <?php if ($view_mode == 'full'): ?> + <div class="field field-type-image"> + <div class="field-items"> + <div class="field-item even primary-image"> + <?php + $content["field_unl_newsimg"][0]["#image_style"] = 'large'; + $content["field_unl_newsimg"][0]["#item"]["attributes"]["class"] = array('frame'); + print render($content["field_unl_newsimg"][0]); + ?> + <?php if ($page && !empty($content["field_unl_newsimg"][0]["#item"]["title"])): ?> + <p class="caption"> + <?php print $content["field_unl_newsimg"][0]["#item"]["title"]; ?> + </p> + <?php endif; ?> + </div> + </div> + </div> + <?php endif; ?> + <?php + // We hide the comments and links now so that we can render them later. + hide($content['comments']); + hide($content['links']); + print render($content["body"]); + + // If more than one image is available, show the addtional images + if ($view_mode == 'full' && isset($content["field_unl_newsimg"][1])) { + unset($content["field_unl_newsimg"][0]); + print render($content["field_unl_newsimg"]); + } else if ($view_mode == 'teaser') { + print render($content["field_unl_newsimg"]); + } + ?> + </div> + + <?php print render($content['links']); ?> + + <?php print render($content['comments']); ?> + +</div> diff --git a/sites/all/themes/unl_wdn/style.css b/sites/all/themes/unl_wdn/style.css index 3a5112f5b0bb68175e32bda6302c148074c13432..093610608810c5f71f7585be17da60e179ac1b51 100644 --- a/sites/all/themes/unl_wdn/style.css +++ b/sites/all/themes/unl_wdn/style.css @@ -1,50 +1,26 @@ -/* +/** * Most unl_wdn css comes from all.css in the WDNTemplates project. * CSS that does appear here is for CMS specific items or modifications * that need to be made for WDN styles to work with CMS DOM structure. */ /* Position tabs at the top right of maincontent */ -body.fixed #maincontent { - min-width: 960px; -} -#maincontent ul.wdn_tabs.cms_tabs { - position: absolute; - right: 0; - top: -60px; -} - +body.fixed #maincontent {min-width: 960px;} +#maincontent ul.wdn_tabs.cms_tabs {position: absolute; right: 0; top: -60px;} /* Fix for a Views page */ -#wdn_content_wrapper.contextual-links-region { - position: static; -} - +#pagetitle {position: relative;} +#wdn_content_wrapper.contextual-links-region {position: static;} /* Hide the contextual links in the UNL nav */ -#navigation div.contextual-links-wrapper { - display: none; -} - +#navigation div.contextual-links-wrapper {display: none;} /* UNL css displays all ul in copyright area as inline, need to hide this */ -#wdn_copyright ul.contextual-links { - display: none; -} - +#wdn_copyright ul.contextual-links {display: none;} /* Overrides of system.menus.css due to conflicts with UNL navigation */ -#navigation ul li.expanded, #navigation ul li.collapsed , #navigation ul li.leaf { - list-style-image: none; - list-style-type: none; -} -#navigation li.expanded, #navigation li.collapsed, #navigation li.leaf { - margin: 0; - padding: 0; -} - +#navigation ul li.expanded, #navigation ul li.collapsed , #navigation ul li.leaf {list-style-image: none; list-style-type: none;} +#navigation li.expanded, #navigation li.collapsed, #navigation li.leaf {margin: 0; padding: 0;} /* Override for unl #maincontent specificity */ -ul.links.inline { - padding-left: 0 !important; -} +ul.links.inline {padding-left: 0 !important;} -/* Book +/* book *********/ .book-navigation ul { border-top: 1px solid #E1E1DB; @@ -65,4 +41,153 @@ ul.links.inline { #block-book-navigation ul li, #wdn_content_wrapper #block-book-navigation .first { margin: 0 0 0 0.5em; +} + +/* unl_newsitem full page +*********/ +.page-node .node-unl-newsitem .submitted { + border-color: #F2EDDE; + border-width: 0 0 2px 0; + border-style: solid; + margin: 0 0 15px 0; + padding: 3px 0; + color: #666; +} +.page-node .node-unl-newsitem .submitted .username { + color: #666 !important; +} +.page-node .node-unl-newsitem .submitted .username:hover { + text-decoration: underline !important; +} +.page-node .node-unl-newsitem .submitted .datetime { + font-style: italic; + margin-left: 10px; +} +.page-node .node-unl-newsitem .field-name-field-unl-newsimg { + border-color: #F2EDDE; + border-width: 1px 0; + border-style: solid; + margin: 0 0 15px 0; + padding: 3px 0; +} +.page-node .node-unl-newsitem .primary-image { + float: right; + margin-left: 10px; + width: 50%; +} +.page-node .node-unl-newsitem .primary-image img, +.page-node .node-unl-newsitem .primary-image .caption { + width: 96%; +} +.page-node .node-unl-newsitem .field-name-field-unl-newsimg .field-item { + display: inline; +} +.page-node .node-unl-newsitem .field-name-field-unl-newsimg .field-item img { + max-height: 120px; + margin: 0 10px 10px 0; +} + +/* sidebar blocks +*********/ +.sidebar .block { + padding-bottom: 30px; + margin-bottom: 30px; +} +.sidebar .block:after { + clear: both; + content: "."; + display: block; + height: 0; + visibility: hidden; +} +.sidebar .block-views { + padding: 10px; + box-shadow: 0 1px 3px #999; +} +.sidebar .block-views .view-teaser-abbr .feed-icon { + top: 8px; +} + +/* .view-teaser-abbr +*********/ +.view-teaser-abbr .feed-icon { + position: absolute; + right: 5px; + top: 3px; +} +.view-teaser-abbr ul { + list-style: none !important; + padding: 0 !important; +} +.view-teaser-abbr ul li:first-child { + border-top: 3px solid #444; +} +.view-teaser-abbr ul li { + border-top: 1px solid #aaa; + padding: 5px 0 10px 0; +} +.view-teaser-abbr ul h4 a.imagelink { + float: right; + margin-left: 10px; +} +.view-teaser-abbr ul h4 img { + border: 1px solid #ccc; + padding: 1px; +} +.view-teaser-abbr ul h4 a { + font-size: 14px; + color: #555 !important; +} +.view-teaser-abbr .more-link a { + float: right; + background: #3388bb; + padding: 3px 8px; + color: #eee !important; +} + +/* .view-teaser +*********/ +.view-teaser .views-row { + margin-bottom: 5px; + padding: 10px; +} +.view-teaser .views-row-even { + background-color: #f7f7f7; +} +.view-teaser .content { + margin-bottom: 5px; +} +.view-teaser .node-teaser h2 a, .view-teaser .node-teaser h3 a, .view-teaser .node-teaser h4 a, .view-teaser .node-teaser h5 a, .view-teaser .node-teaser h6 a { + color: #444 !important; + font-size: 18px !important; +} +.view-teaser .node-teaser h2 a:hover, .view-teaser .node-teaser h3 a:hover, .view-teaser .node-teaser h4 a:hover, .view-teaser .node-teaser h5 a:hover, .view-teaser .node-teaser h6 a:hover { + text-decoration: underline !important; +} +.view-teaser .meta.submitted { + font-size: .95em; + color: #888; + margin-bottom: 15px; +} +.view-teaser .meta.submitted .username { + color: #888 !important; +} +.view-teaser .meta.submitted .username:hover { + text-decoration: underline !important; +} +.view-teaser .meta.submitted .datetime { + font-style: italic; + margin-left: 10px; +} +.view-teaser .links { + float: right; +} +.view-teaser .node-readmore a { + background: #3388bb; + padding: 3px 8px; + color: #eee !important; +} +.view-teaser .field-type-image .field-item { + float: left; + margin-right: 20px; } \ No newline at end of file diff --git a/sites/all/themes/unl_wdn/template.php b/sites/all/themes/unl_wdn/template.php index c3cc2490bb2198e9e5ff23cb938653a8ef67bd1e..9d584274431757078b1cace919f09fdef2207c6c 100644 --- a/sites/all/themes/unl_wdn/template.php +++ b/sites/all/themes/unl_wdn/template.php @@ -98,10 +98,44 @@ function unl_wdn_preprocess_node(&$vars) { if (isset($vars['elements']['#node']->op) && $vars['elements']['#node']->op == 'Preview') { $vars['page'] = true; } + // Change the format of the byline + if ($vars['uid']) { + $vars['submitted'] = t('By !username <span class="datetime">!datetime</span>', array('!username' => $vars['name'], '!datetime' => $vars['date'])); + } else { + $vars['submitted'] = t('!datetime ', array('!datetime' => $vars['date'])); + } +} + +/** + * Implements template_preprocess_username(). + */ +function unl_wdn_preprocess_username(&$vars) { + // Link the displayed name to UNL Directory rather than Drupal user page + $vars['link_path'] = 'http://directory.unl.edu/?uid=' . user_load($vars['account']->uid)->name; + $vars['link_attributes'] = array('title' => t('View user in the UNL Directory.')); +} + +/** + * Implements hook_username_alter(). + */ +function unl_wdn_username_alter(&$name, $account) { + // Drupal does not support "display names" so convert the user name (jdoe2 to Jane Doe) using UNL Directory service + $context = stream_context_create(array( + 'http' => array('timeout' => 1) + )); + $result = json_decode(@file_get_contents('http://directory.unl.edu/service.php?format=json&uid='.$name, 0, $context)); + if (!empty($result) && $result->sn) { + $zero = '0'; + $firstname = ($result->eduPersonNickname ? $result->eduPersonNickname->$zero : $result->givenName->$zero); + $name = $firstname . ' ' . $result->sn->$zero; + } } +/** + * Implements template_preprocess_page(). + */ function unl_wdn_preprocess_page(&$vars, $hook) { - //Unset the sidebars if on a user page (i.e. user profile or imce file browser) + // Unset the sidebars if on a user page (i.e. user profile or imce file browser) if (arg(0) == 'user') { $vars['page']['sidebar_first'] = array(); $vars['page']['sidebar_second'] = array();