Browse Source

merged views submodule

Bachir Soussi Chiadmi 9 years ago
parent
commit
ad76968844
100 changed files with 15239 additions and 0 deletions
  1. 2 0
      sites/all/modules/contrib/views/views/D7UPGRADE.txt
  2. 339 0
      sites/all/modules/contrib/views/views/LICENSE.txt
  3. 19 0
      sites/all/modules/contrib/views/views/README.txt
  4. 91 0
      sites/all/modules/contrib/views/views/css/ie/views-admin.ie7.css
  5. 98 0
      sites/all/modules/contrib/views/views/css/views-admin-rtl.css
  6. 24 0
      sites/all/modules/contrib/views/views/css/views-admin.advanced_help.css
  7. 12 0
      sites/all/modules/contrib/views/views/css/views-admin.bartik-rtl.css
  8. 233 0
      sites/all/modules/contrib/views/views/css/views-admin.bartik.css
  9. 63 0
      sites/all/modules/contrib/views/views/css/views-admin.contextual.css
  10. 361 0
      sites/all/modules/contrib/views/views/css/views-admin.css
  11. 82 0
      sites/all/modules/contrib/views/views/css/views-admin.ctools-rtl.css
  12. 232 0
      sites/all/modules/contrib/views/views/css/views-admin.ctools.css
  13. 13 0
      sites/all/modules/contrib/views/views/css/views-admin.garland-rtl.css
  14. 263 0
      sites/all/modules/contrib/views/views/css/views-admin.garland.css
  15. 43 0
      sites/all/modules/contrib/views/views/css/views-admin.seven-rtl.css
  16. 552 0
      sites/all/modules/contrib/views/views/css/views-admin.seven.css
  17. 208 0
      sites/all/modules/contrib/views/views/css/views-admin.theme-rtl.css
  18. 1083 0
      sites/all/modules/contrib/views/views/css/views-admin.theme.css
  19. 5 0
      sites/all/modules/contrib/views/views/css/views-rtl.css
  20. 42 0
      sites/all/modules/contrib/views/views/css/views.css
  21. 5 0
      sites/all/modules/contrib/views/views/documentation-standards.txt
  22. 496 0
      sites/all/modules/contrib/views/views/drush/views.drush.inc
  23. 133 0
      sites/all/modules/contrib/views/views/handlers/views_handler_area.inc
  24. 96 0
      sites/all/modules/contrib/views/views/handlers/views_handler_area_result.inc
  25. 110 0
      sites/all/modules/contrib/views/views/handlers/views_handler_area_text.inc
  26. 56 0
      sites/all/modules/contrib/views/views/handlers/views_handler_area_text_custom.inc
  27. 83 0
      sites/all/modules/contrib/views/views/handlers/views_handler_area_view.inc
  28. 1240 0
      sites/all/modules/contrib/views/views/handlers/views_handler_argument.inc
  29. 101 0
      sites/all/modules/contrib/views/views/handlers/views_handler_argument_date.inc
  30. 63 0
      sites/all/modules/contrib/views/views/handlers/views_handler_argument_formula.inc
  31. 29 0
      sites/all/modules/contrib/views/views/handlers/views_handler_argument_group_by_numeric.inc
  32. 185 0
      sites/all/modules/contrib/views/views/handlers/views_handler_argument_many_to_one.inc
  33. 67 0
      sites/all/modules/contrib/views/views/handlers/views_handler_argument_null.inc
  34. 116 0
      sites/all/modules/contrib/views/views/handlers/views_handler_argument_numeric.inc
  35. 274 0
      sites/all/modules/contrib/views/views/handlers/views_handler_argument_string.inc
  36. 1630 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field.inc
  37. 110 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_boolean.inc
  38. 102 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_contextual_links.inc
  39. 50 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_counter.inc
  40. 55 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_custom.inc
  41. 101 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_date.inc
  42. 104 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_entity.inc
  43. 73 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_machine_name.inc
  44. 59 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_markup.inc
  45. 84 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_math.inc
  46. 137 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_numeric.inc
  47. 158 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_prerender_list.inc
  48. 65 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_serialized.inc
  49. 37 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_time_interval.inc
  50. 46 0
      sites/all/modules/contrib/views/views/handlers/views_handler_field_url.inc
  51. 1410 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter.inc
  52. 179 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_boolean_operator.inc
  53. 35 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_boolean_operator_string.inc
  54. 170 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_combine.inc
  55. 183 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_date.inc
  56. 122 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_entity_bundle.inc
  57. 45 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_equality.inc
  58. 56 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_group_by_numeric.inc
  59. 426 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_in_operator.inc
  60. 125 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_many_to_one.inc
  61. 325 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_numeric.inc
  62. 338 0
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_string.inc
  63. 186 0
      sites/all/modules/contrib/views/views/handlers/views_handler_relationship.inc
  64. 382 0
      sites/all/modules/contrib/views/views/handlers/views_handler_relationship_groupwise_max.inc
  65. 240 0
      sites/all/modules/contrib/views/views/handlers/views_handler_sort.inc
  66. 74 0
      sites/all/modules/contrib/views/views/handlers/views_handler_sort_date.inc
  67. 38 0
      sites/all/modules/contrib/views/views/handlers/views_handler_sort_group_by_numeric.inc
  68. 54 0
      sites/all/modules/contrib/views/views/handlers/views_handler_sort_menu_hierarchy.inc
  69. 22 0
      sites/all/modules/contrib/views/views/handlers/views_handler_sort_random.inc
  70. 0 0
      sites/all/modules/contrib/views/views/help/about.html
  71. 43 0
      sites/all/modules/contrib/views/views/help/advanced-settings.html
  72. 30 0
      sites/all/modules/contrib/views/views/help/advanced-style-settings.html
  73. 1 0
      sites/all/modules/contrib/views/views/help/aggregation.html
  74. 31 0
      sites/all/modules/contrib/views/views/help/alter-exposed-filter.html
  75. 24 0
      sites/all/modules/contrib/views/views/help/analyze-theme.html
  76. 0 0
      sites/all/modules/contrib/views/views/help/api-default-views.html
  77. 179 0
      sites/all/modules/contrib/views/views/help/api-example.html
  78. 88 0
      sites/all/modules/contrib/views/views/help/api-forms.html
  79. 45 0
      sites/all/modules/contrib/views/views/help/api-handler-area.html
  80. 238 0
      sites/all/modules/contrib/views/views/help/api-tables.html
  81. 224 0
      sites/all/modules/contrib/views/views/help/api-upgrading.html
  82. 4 0
      sites/all/modules/contrib/views/views/help/api.html
  83. 0 0
      sites/all/modules/contrib/views/views/help/argument.html
  84. 11 0
      sites/all/modules/contrib/views/views/help/basic-settings.html
  85. 5 0
      sites/all/modules/contrib/views/views/help/demo-video.html
  86. 1 0
      sites/all/modules/contrib/views/views/help/display-attachment.html
  87. 11 0
      sites/all/modules/contrib/views/views/help/display-block.html
  88. 3 0
      sites/all/modules/contrib/views/views/help/display-default.html
  89. 1 0
      sites/all/modules/contrib/views/views/help/display-feed.html
  90. 7 0
      sites/all/modules/contrib/views/views/help/display-page.html
  91. 4 0
      sites/all/modules/contrib/views/views/help/display.html
  92. 13 0
      sites/all/modules/contrib/views/views/help/drush.html
  93. 24 0
      sites/all/modules/contrib/views/views/help/embed.html
  94. 3 0
      sites/all/modules/contrib/views/views/help/empty-text.html
  95. 47 0
      sites/all/modules/contrib/views/views/help/example-author-block.html
  96. 46 0
      sites/all/modules/contrib/views/views/help/example-filter-by-current-user.html
  97. 55 0
      sites/all/modules/contrib/views/views/help/example-recent-stories.html
  98. 54 0
      sites/all/modules/contrib/views/views/help/example-slideshow-thumb-pager.html
  99. 1 0
      sites/all/modules/contrib/views/views/help/example-user-feed.html
  100. 6 0
      sites/all/modules/contrib/views/views/help/example-users-by-role.html

+ 2 - 0
sites/all/modules/contrib/views/views/D7UPGRADE.txt

@@ -0,0 +1,2 @@
+Information about upgrading existing views from Drupal 6 to Drupal 7 is located
+in the module's advanced help under api upgrading.

+ 339 - 0
sites/all/modules/contrib/views/views/LICENSE.txt

@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <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.

+ 19 - 0
sites/all/modules/contrib/views/views/README.txt

@@ -0,0 +1,19 @@
+
+Welcome to Views 3. Please see the advanced help for more information.
+
+If you're having trouble installing this module, please ensure that your
+tar program is not flattening the directory tree, truncating filenames
+or losing files.
+
+Installing Views:
+
+Place the entirety of this directory in sites/all/modules/views
+You must also install the CTools module (http://www.drupal.org/project/ctools)  to use Views.
+
+Navigate to administer >> build >> modules. Enable Views and Views UI.
+
+If you're new to Views, try the Simple Views module which can create some
+often used Views for you, this might save you some time.
+
+Here you can find many modules extending the functionality of Views:
+  http://drupal.org/taxonomy/term/89

+ 91 - 0
sites/all/modules/contrib/views/views/css/ie/views-admin.ie7.css

@@ -0,0 +1,91 @@
+/**
+ * The query details collapsible divs are not visible in IE7 because has-layout
+ * is not being triggered. Trigger has-layout with height: 1%;
+ */
+.views-edit-view .collapsible > .fieldset-wrapper {
+  height: 1%;
+}
+
+/**
+ * The column width for the bucket containers in the query details section
+ * is not being calculated to 32% correctly. Give IE7 a slightly smaller
+ * width so that the three columns line up next to each other
+ */
+.views-edit-view .views-display-column {
+  width: 31.95%;
+}
+
+/**
+ * IE7 has no idea how large this container should be and it doesn't
+ * apply has-layout. Expand it's width to 100% and trigger has-layout.
+ */
+.views-edit-view .views-displays {
+  height: 1%;
+  width: 100%;
+}
+
+/**
+ * IE7 isn't positioning the span correctly as a display-inline element
+ */
+.views-edit-view .views-displays .icon {
+  display: block;
+  float: left;
+}
+
+.views-edit-view .views-displays .icon-add {
+  top: 2px;
+}
+
+/**
+ * The add display query dropdown needs a lot of help
+ */
+
+.views-edit-view .views-displays .tabs.secondary {
+  position: relative;
+  z-index: 100;
+}
+
+.views-edit-view .views-displays .secondary .open > a {
+  border-bottom: 1px solid #f1f1f1;
+}
+
+.views-edit-view .views-displays .secondary .action-list {
+  border-bottom: 1px solid #cbcbcb;
+  top: 30px;
+}
+
+.views-edit-view .views-displays .secondary input {
+  text-align: left;
+}
+
+/**
+ * IE7 does not interpret div > * correctly
+ */
+.page-admin-structure-views #content .views-ui-display-tab-bucket {
+  padding-left: 0;
+  padding-right: 0;
+  zoom: 1;
+}
+
+.page-admin-structure-views #content .views-display-column + .views-display-column {
+  margin-top: 0;
+}
+
+/**
+ * IE7 is interpreting a top margin of 18px from somewhere. remove it
+ */
+
+.page-admin-structure-views #content .views-display-setting {
+  margin-top: 0;
+}
+
+/**
+ * IE7 can't handle the + selector that indents form wrappers after a checkbox on the add page
+ * zoom is necessary to trigger has layout. !imporant is necessary because IE7 is precedent
+ * to the theme.css stylesheet, even though it is included before this file.
+ */
+
+.page-admin-structure-views #content .form-type-checkbox + .form-wrapper {
+  margin-left: 27px !important;
+  zoom: 1;
+}

+ 98 - 0
sites/all/modules/contrib/views/views/css/views-admin-rtl.css

@@ -0,0 +1,98 @@
+/**
+ * The .css file is intended to only contain positioning and size declarations
+ * For example: display, position, float, clear, and overflow.
+ */
+
+/* @group Inline lists */
+
+.horizontal > * {
+  float: right;
+}
+
+.horizontal.right {
+  float: left;
+}
+
+/* @end */
+
+/* @group Attachment details
+ *
+ * The attachment details section, its tabs for each section and the buttons
+ * to add a new section
+ */
+
+.form-actions {
+  float: left;
+}
+
+/* @end */
+
+/* @group Attachment details tabs
+ *
+ * The tabs that switch between sections
+ */
+
+.views-displays .secondary > li {
+  float: right;
+}
+
+/* @end */
+
+/* @group Attachment details new section button */
+
+.views-displays .secondary .action-list {
+  left: auto;
+  right: 0;
+}
+
+/* @end */
+
+/* @group Attachment details collapsible fieldset */
+
+.views-display-tab .fieldset-legend {
+  left: auto;
+  right: -5px;
+}
+
+/* @end */
+
+/* @group Attachment details actions
+ *
+ * Display the "Delete" and "Duplicate" buttons to the right.
+ */
+.views-display-tab .fieldset-wrapper > .views-ui-display-tab-bucket .actions {
+  left: 0;
+  right: auto;
+}
+
+/* @end */
+
+/* @group Attachment configuration columns */
+
+.views-display-columns > * {
+  float: right;
+  margin-left: 0;
+  margin-right: 1%;
+  padding-left: 0;
+  padding-right: 1%;
+}
+
+.views-display-columns > *:first-child {
+  margin-right: 0;
+  padding-right: 0;
+}
+
+/* @end */
+
+/* @group Settings forms */
+
+.views-dependent {
+  margin-right: 1.5em;
+}
+
+.views-display-setting .label,
+.views-display-setting .views-ajax-link {
+  float: right;
+}
+
+/* @end */

+ 24 - 0
sites/all/modules/contrib/views/views/css/views-admin.advanced_help.css

@@ -0,0 +1,24 @@
+/**
+ * The .advanced_help.css file is intended to contain styles that override declarations
+ * in the Advanced Help module.
+ */
+
+/**
+ * Adjust the advanced help icons
+ */
+.views-ui-display-tab-bucket .advanced-help-link {
+  padding: 0;
+  margin: 5px 3px 0px 6px; /* LTR */
+}
+
+.views-ui-display-tab-bucket .icon-text {
+  padding-left: 25px; /* LTR */
+}
+
+.views-ui-display-tab-bucket .icon-linked {
+  background-position: 6px -151px; /* LTR */
+}
+
+.views-ui-display-tab-bucket .icon-unlinked {
+  background-position: 6px -193px; /* LTR */
+}

+ 12 - 0
sites/all/modules/contrib/views/views/css/views-admin.bartik-rtl.css

@@ -0,0 +1,12 @@
+/**
+ * The .bartik.css file is intended to contain styles that override declarations
+ * in the Bartik theme.
+ */
+
+ /* @group Lists */
+
+.views-display-top .secondary .action-list {
+  padding-right: 0;
+}
+
+/* @end */

+ 233 - 0
sites/all/modules/contrib/views/views/css/views-admin.bartik.css

@@ -0,0 +1,233 @@
+/**
+ * The .bartik.css file is intended to contain styles that override declarations
+ * in the Bartik theme.
+ */
+
+/* @group Lists */
+
+.views-display-top .secondary .action-list {
+  padding-left: 0; /* LTR */
+}
+
+/* @end */
+
+/* @group Attachment details tabs
+ *
+ * The tabs that switch between sections
+ */
+
+.views-displays .region-content .secondary,
+.views-displays .region-content .secondary {
+  padding-bottom: 0;
+  padding-left: 0;
+}
+
+.views-displays .secondary a {
+  font-size: smaller;
+}
+
+.views-displays .secondary > li a {
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  border-radius: 5px;
+}
+
+.views-displays .secondary > li.open a {
+  -moz-border-radius: 5px 5px 0 0;
+  -webkit-border-bottom-left-radius: 0;
+  -webkit-border-bottom-right-radius: 0;
+  -webkit-border-top-left-radius: 5px;
+  -webkit-border-top-right-radius: 5px;
+  border-radius: 5px 5px 0 0;
+}
+
+.views-displays .secondary .open > a:hover {
+  color: #0071B3;
+}
+
+.views-displays .secondary input.form-submit {
+  font-size: smaller;
+}
+
+/* @end */
+
+/* @group Modal dialog box
+ *
+ * The contents of the popup dialog on the views edit form.
+ */
+
+.views-filterable-options .even .form-type-checkbox {
+  background-color: #F9F9F9;
+}
+
+.views-ui-dialog .ui-dialog-titlebar-close,
+.views-ui-dialog #views-ajax-title,
+.views-ui-dialog .views-override,
+.views-ui-dialog .form-buttons {
+  background-color: #f6f6f6;
+}
+
+.views-ui-dialog a {
+  color: #0071b3;
+}
+
+.views-ui-dialog a:hover,
+.views-ui-dialog a:focus {
+  color: #018fe2;
+}
+
+/* @end */
+
+/* @group CTools */
+
+/* @group Buttons */
+
+.ctools-button-processed {
+  background-image:
+    -moz-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    -webkit-gradient(
+      linear,
+      left top,
+      left bottom,
+      color-stop(0.0, rgba(255, 255, 255, 1.0)),
+      color-stop(1.0, rgba(249, 249, 249, 1.0))
+    );
+  background-image:
+    -webkit-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  border-radius: 5px;
+  padding-bottom: 1px;
+  padding-top: 1px;
+}
+
+.ctools-button-processed:hover {
+  background-image:
+    -moz-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f1f1f1 100%);
+  background-image:
+    -webkit-gradient(
+      linear,
+      left top,
+      left bottom,
+      color-stop(0.0, rgba(255, 255, 255, 1.0)),
+      color-stop(1.0, rgba(241, 241, 241, 1.0))
+    );
+  background-image:
+    -webkit-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f1f1f1 100%);
+  background-image:
+    linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f1f1f1 100%);
+}
+
+.ctools-button-processed li a,
+.views-ui-display-tab-actions .ctools-button-processed input {
+  padding-left: 9px;
+  padding-right: 9px;
+}
+
+.ctools-content ul.actions {
+  padding-bottom: 0;
+}
+
+.ctools-dropbutton-processed.open:hover {
+  background-image:
+    -moz-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    -webkit-gradient(
+      linear,
+      left top,
+      left bottom,
+      color-stop(0.0, rgba(255, 255, 255, 1.0)),
+      color-stop(1.0, rgba(249, 249, 249, 1.0))
+    );
+  background-image:
+    -webkit-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+}
+
+.ctools-dropbutton-processed.open {
+  -moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
+  -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
+  box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
+}
+
+.ctools-twisty {
+  top: 0.6667em;
+}
+
+.ctools-dropbutton-processed.open .ctools-twisty {
+  top: 0.3333em;
+}
+
+.ctools-dropbutton-processed li a,
+.views-ui-display-tab-actions .ctools-dropbutton-processed input {
+  padding-right: 7px;
+}
+
+.views-ui-display-tab-actions .ctools-button-processed input.form-submit {
+  margin-right: 0;
+  margin-top: 0;
+}
+
+/* @end */
+
+/* @group Collapsible */
+
+.ctools-toggle {
+  margin-top: 0.9em;
+}
+
+.ctools-toggle.ctools-toggle-collapsed {
+  margin-top: 0.72em;
+}
+
+.views-display-column > .ctools-toggle {
+  margin-top: 14px;
+}
+
+.views-display-column > .ctools-toggle.ctools-toggle-collapsed {
+  margin-top: 12px;
+}
+
+.views-ui-display-tab-actions .ctools-button input {
+  color: #0071B3;
+}
+
+.views-ui-display-tab-actions .ctools-button input:hover,
+.views-ui-display-tab-actions .ctools-button input:focus {
+  color: #018FE2;
+}
+
+/* @end */
+
+/* @end */

+ 63 - 0
sites/all/modules/contrib/views/views/css/views-admin.contextual.css

@@ -0,0 +1,63 @@
+/**
+ * The .contextual.css file is intended to contain styles that override declarations
+ * in the Contextual module.
+ */
+
+/* @group Wrapper */
+
+#views-live-preview .contextual-links-region-active {
+  outline: medium none;
+}
+
+#views-live-preview div.contextual-links-wrapper {
+  right: auto;
+  top: auto;
+}
+
+html.js #views-live-preview div.contextual-links-wrapper {
+  display: inline;
+}
+
+/* @end */
+
+/* @group Trigger */
+
+#views-live-preview a.contextual-links-trigger {
+  display: block;
+}
+
+/* @end */
+
+/* @group List */
+
+div.contextual-links-wrapper ul.contextual-links {
+  -moz-border-radius: 0 4px 4px 4px;
+  -webkit-border-radius: 0 4px 4px 4px;
+  border-radius: 0 4px 4px 4px;
+  min-width: 10em;
+  padding: 6px 6px 9px 6px;
+  right: auto;
+}
+
+ul.contextual-links li a,
+ul.contextual-links li span {
+  padding-bottom: 0.25em;
+  padding-right: 0.1667em;
+  padding-top: 0.25em;
+}
+
+ul.contextual-links li span {
+  font-weight: bold;
+}
+
+ul.contextual-links li a {
+  color: #666666 !important;
+  margin: 0.25em 0;
+  padding-left: 1em;
+}
+
+ul.contextual-links li a:hover {
+  background-color: #badbec;
+}
+
+/* @end */

+ 361 - 0
sites/all/modules/contrib/views/views/css/views-admin.css

@@ -0,0 +1,361 @@
+/**
+ * The .css file is intended to only contain positioning and size declarations
+ * For example: display, position, float, clear, and overflow.
+ */
+
+/* @group Resets */
+
+.views-admin ul,
+.views-admin menu,
+.views-admin dir {
+  padding-left: 0; /* LTR for IE */
+  /* padding-start is used so that RTL works out of the box */
+  -moz-padding-start: 0;
+  -webkit-padding-start: 0;
+  padding-start: 0;
+}
+
+.views-admin pre {
+  margin-bottom: 0;
+  margin-top: 0;
+  white-space: pre-wrap;
+}
+
+/* @end */
+
+/* @group Inline lists */
+
+.horizontal > * {
+  clear: none;
+  float: left; /* LTR */
+}
+
+.horizontal.right {
+  float: right;
+}
+
+.horizontal label {
+  position: absolute;
+}
+
+.horizontal .form-item > [class] {
+  margin-top: 25px;
+}
+
+.horizontal .form-item > [class] + [class] {
+  margin-top: 0;
+}
+
+/* @end */
+
+/* @group Columns */
+
+.views-left-25 {
+  float: left;
+  width: 25%;
+}
+
+.views-left-30 {
+  float: left;
+  width: 30%;
+}
+
+.views-left-40 {
+  float: left;
+  width: 40%;
+}
+
+.views-left-50 {
+  float: left;
+  width: 50%;
+}
+
+.views-left-75 {
+  float: left;
+  width: 75%;
+}
+
+.views-right-50 {
+  float: right;
+  width: 50%;
+}
+
+.views-right-60 {
+  float: right;
+  width: 60%;
+}
+
+.views-right-70 {
+  float: right;
+  width: 70%;
+}
+
+.views-group-box .form-item {
+  margin-left: 3px;
+  margin-right: 3px;
+}
+
+/* @end */
+
+/* @group Attachment details
+ *
+ * The attachment details section, its tabs for each section and the buttons
+ * to add a new section
+ */
+
+.form-edit .form-actions {
+  float: right; /* LTR */
+}
+
+.views-displays {
+  clear: both;
+}
+
+/* @end */
+
+/* @group Attachment details tabs
+ *
+ * The tabs that switch between sections
+ */
+ .views-displays .secondary {
+   border-bottom: 0 none;
+   margin: 0;
+   overflow: visible;
+   padding: 0;
+ }
+
+.views-displays .secondary > li {
+  border-right: 0 none;
+  display: inline-block;
+  float: left; /* LTR */
+  padding: 0;
+}
+
+.views-displays .secondary .open > a {
+  position: relative;
+  z-index: 51;
+}
+
+.views-displays .views-display-deleted-link {
+  text-decoration: line-through;
+}
+
+.views-display-deleted > fieldset > legend,
+.views-display-deleted .fieldset-wrapper > .views-ui-display-tab-bucket > *,
+.views-display-deleted .views-display-columns {
+  opacity: 0.25;
+}
+
+.views-display-disabled > fieldset > legend,
+.views-display-disabled .fieldset-wrapper > .views-ui-display-tab-bucket > *,
+.views-display-disabled .views-display-columns {
+  opacity: 0.5;
+}
+
+.views-display-tab .fieldset-wrapper > .views-ui-display-tab-bucket .actions {
+  opacity: 1.0;
+}
+/* @end */
+
+/* @group Attachment details new section button */
+
+.views-displays .secondary li.add {
+  position: relative;
+}
+
+.views-displays .secondary .action-list {
+  left: 0; /* LTR */
+  margin: 0;
+  position: absolute;
+  top: 23px;
+  z-index: 50;
+}
+
+.views-displays .secondary .action-list  li {
+  display: block;
+}
+
+/* @end */
+
+/* @group Attachment details collapsible fieldset */
+
+.views-display-tab .fieldset-legend {
+  left: -5px; /* LTR */
+  position: relative;
+}
+
+.views-display-tab .fieldset-wrapper {
+  position: relative;
+}
+
+/* @end */
+
+/* @group Attachment details actions
+ *
+ * Display the "Delete" and "Duplicate" buttons to the right.
+ */
+.views-display-tab .fieldset-wrapper > .views-ui-display-tab-bucket .actions {
+  position: absolute;
+  right: 0; /* LTR */
+  top: -5px;
+}
+
+/* @end */
+
+/* @group Attachment configuration columns */
+
+.views-display-columns > * {
+  float: left; /* LTR */
+  margin-left: 1%; /* LTR */
+  padding-left: 1%; /* LTR */
+  width: 32%;
+}
+
+.views-display-columns > *:first-child {
+  margin-left: 0; /* LTR */
+  padding-left: 0; /* LTR */
+}
+
+/* @end */
+
+/* @group Modal dialog box */
+
+.views-ui-dialog {
+  /* We need this so the button is visible. */
+  overflow: visible;
+  position: fixed;
+}
+
+.views-ui-dialog .ui-dialog-titlebar-close {
+  border: 1px solid transparent;
+  display: block;
+  margin: 0;
+  padding: 0;
+  position: absolute;
+  right: 0;
+  top: 2px;
+  /* Make sure this is in front of the modal backdrop. */
+  z-index: 1002;
+}
+
+.views-ui-dialog .ui-dialog-titlebar {
+  padding: 0;
+  margin: 0;
+}
+
+.views-ui-dialog .ui-dialog-title {
+  display: none;
+}
+
+.views-ui-dialog #views-ajax-popup {
+  padding: 0;
+  overflow: hidden;
+}
+
+.views-ui-dialog #views-ajax-title,
+.views-ui-dialog #views-ajax-body {
+  margin: 0;
+  padding: 0;
+}
+
+.views-ui-dialog #views-ajax-popup {
+  overflow: hidden;
+}
+
+.views-ui-dialog .scroll {
+  max-height: 400px;
+  overflow: auto;
+}
+
+#views-filterable-options-controls {
+  display: none;
+}
+
+.views-ui-dialog #views-filterable-options-controls {
+  display: block;
+}
+
+/* Don't let the messages overwhelm the modal */
+.views-ui-dialog .views-messages {
+  max-height: 200px;
+  overflow: auto;
+}
+
+/* @end */
+
+/* @group Settings forms */
+
+.views-display-setting .label,
+.views-display-setting .views-ajax-link {
+  display: inline-block;
+  float: left; /* LTR */
+}
+
+/* @end */
+
+/* @group Filter Settings form */
+
+div.form-item-options-value-all {
+  display: none;
+}
+/* @end */
+
+/* @group Drupal overrides */
+
+/* The .progress-disabled class added to the form on submit floats the element
+ * left and causes the form width to shrink-wrap to the content. Setting the
+ * width to 100% prevents this.
+ */
+#views-ajax-body form {
+  width: 100%;
+}
+
+/* @end */
+
+
+
+/* @group Javascript dependent styling */
+
+.js-only {
+  display: none;
+}
+
+html.js .js-only {
+  display: inherit;
+}
+
+html.js span.js-only {
+  display: inline;
+}
+
+/* @end */
+
+/* @group AJAX throbber */
+
+/* Base Page */
+#views-ui-list-page .ajax-progress-throbber,
+.views-admin .ajax-progress-throbber {
+  /* Can't do center:50% middle: 50%, so approximate it for a typical window size. */
+  left: 49%;
+  position: fixed;
+  top: 48.5%;
+  z-index: 1000;
+}
+#views-ui-list-page .ajax-progress-throbber .message,
+.views-admin .ajax-progress-throbber .message {
+  display: none;
+}
+
+/* Modal */
+#views-ajax-popup .ajax-progress-throbber {
+  /* Can't do center:50% middle: 50%, so approximate it for a typical window size. */
+  left: 49%;
+  position: fixed;
+  top: 48.5%;
+  z-index: 1000;
+}
+#views-ajax-popup .ajax-progress-throbber .message {
+  display: none;
+}
+
+/* @end */

+ 82 - 0
sites/all/modules/contrib/views/views/css/views-admin.ctools-rtl.css

@@ -0,0 +1,82 @@
+/* @group Buttons */
+
+.ctools-dropbutton .ctools-content {
+  border-left: 1px solid #e8e8e8;
+}
+
+.ctools-content ul.actions {
+  padding-left: auto;
+  padding-right: 0;
+}
+
+.ctools-dropbutton .ctools-link {
+  border-right: 1px solid #ffffff;
+}
+
+.ctools-dropbutton li {
+  padding-left: 9px;
+  padding-left: auto;
+}
+
+.views-display-top .ctools-button {
+  left: 12px;
+  right: auto;
+}
+
+.views-ui-display-tab-bucket .ctools-button {
+  left: 5px;
+  right: auto;
+}
+
+/* @end */
+
+/* @group Collapsible */
+
+.ctools-toggle {
+  float: right;
+  margin-left: 2px;
+  margin-right: 0;
+}
+
+.ctools-toggle.ctools-toggle-collapsed {
+  border-left: 0;
+  border-right: 4px solid;
+  border-left-color: transparent;
+  border-width: 5px 5px 5px 0;
+  margin-left: 5px;
+  margin-right: 2px;
+}
+
+.ctools-export-ui-row label {
+  float: right;
+}
+
+.views-display-column > .ctools-toggle {
+  margin-left: 3px;
+  margin-right: 6px;
+}
+.views-display-column > .ctools-toggle.ctools-toggle-collapsed {
+  margin-left: 5px;
+  margin-right: 9px;
+}
+
+/* @end */
+
+/* @group Dependent */
+
+.dependent-options {
+  margin-left: 0;
+  margin-right: 18px;
+}
+
+/* @end */
+
+/* @group Export */
+
+/* Override for filter button on the views list screen */
+#ctools-export-ui-list-form .form-submit {
+  margin-left: 0em;
+  margin-right: auto;
+}
+
+/* @end */

+ 232 - 0
sites/all/modules/contrib/views/views/css/views-admin.ctools.css

@@ -0,0 +1,232 @@
+/* @group Buttons */
+
+.ctools-button-processed {
+  background-color: #ffffff;
+  border-color: #cccccc;
+  font-size: 11px;
+  padding-bottom: 2px;
+  padding-top: 2px;
+}
+
+.ctools-button-processed:hover {
+  border-color: #b8b8b8;
+}
+
+.ctools-button-processed:active {
+  border-color: #a0a0a0;
+}
+
+.ctools-button-processed .ctools-content {
+  padding-bottom: 0;
+  padding-top: 0;
+}
+
+.ctools-dropbutton-processed {
+  position: absolute;
+}
+
+.ctools-dropbutton-processed .ctools-content {
+  border-right: 1px solid #e8e8e8;
+}
+
+.ctools-dropbutton-processed .ctools-content ul {
+  margin: 0;
+  padding: 0;
+}
+
+.ctools-content ul.actions {
+  margin-top: 0;
+  margin-bottom: 0;
+  padding-left: 0;
+}
+
+.ctools-button-processed .ctools-content a {
+  background-image: none;
+  border: medium none;
+}
+
+.ctools-dropbutton-processed.open:hover {
+  border-color: #D0D0D0;
+}
+
+.ctools-dropbutton-processed.open {
+  z-index: 100;
+}
+
+.ctools-dropbutton-processed .ctools-link {
+  border-left: 1px solid #ffffff;
+}
+
+.ctools-dropbutton-processed.open .ctools-content {
+    padding-bottom: 4px;
+}
+
+.ctools-dropbutton-processed li a,
+.ctools-dropbutton-processed li input {
+  padding-right: 9px;
+}
+
+.ctools-dropbutton-processed.open li + li {
+  border-top: 1px solid #efefef;
+  margin-top: 4px;
+  padding-bottom: 0;
+  padding-top: 4px;
+}
+
+.ctools-twisty:focus {
+  outline: medium none;
+}
+
+.ctools-no-js .ctools-content ul {
+  margin-bottom: 0;
+  margin-top: 0;
+  padding-left: 0;
+}
+
+.views-display-top .ctools-button-processed {
+  font-size: 12px;
+  position: absolute;
+  right: 12px;
+  top: 7px;
+}
+
+.views-ui-display-tab-bucket .ctools-button-processed {
+  position: absolute;
+  right: 5px;
+  top: 4px;
+}
+
+.views-ui-display-tab-actions .ctools-button-processed li a,
+.views-ui-display-tab-actions .ctools-button-processed input {
+  background: none;
+  border: medium;
+  font-family: inherit;
+  font-size: 12px;
+  padding-bottom: 0;
+  padding-left: 12px;
+  padding-top: 0;
+  margin-bottom: 0;
+}
+
+.views-ui-display-tab-actions .ctools-button-processed input:hover {
+  background: none;
+}
+
+/* @end */
+
+/* @group Collapsible */
+
+.ctools-toggle {
+  border-bottom-color: transparent;
+  border-left-color: transparent;
+  border-right-color: transparent;
+  border-style: solid;
+  border-width: 5px 5px 0;
+  display: inline-block;
+  float: left;
+  height: 0;
+  margin-right: 2px;
+  margin-top: 0.4545em;
+  width: 0;
+}
+
+.ctools-toggle.ctools-toggle-collapsed {
+  border-bottom-color: transparent;
+  border-left:  4px solid;
+  border-right-color: transparent;
+  border-top-color: transparent;
+  border-width: 5px 0 5px 5px;
+  margin-left: 2px;
+  margin-right: 5px;
+  margin-top: 0.3333em;
+}
+
+.ctools-toggle:hover,
+.ctools-collapsible-handle:hover {
+  cursor: pointer;
+}
+
+.ctools-export-ui-row {
+  margin-bottom: 0;
+  padding-top: 0;
+}
+
+.ctools-export-ui-row label {
+  display: block;
+  float: left;
+  width: 55px;
+}
+
+.views-display-settings .ctools-toggle {
+  color: #000000;
+}
+
+.views-display-column > .ctools-toggle {
+  margin-left: 6px;
+  margin-right: 3px;
+  margin-top: 10px;
+}
+.views-display-column > .ctools-toggle.ctools-toggle-collapsed {
+  margin-left: 9px;
+  margin-right: 5px;
+  margin-top: 8px;
+}
+
+.views-display-column > .ctools-collapsible-handle {
+  border-color: #F3F3F3;
+  border-style: solid;
+  border-width: 1px 1px 0;
+  font-size: 13px;
+  font-weight: normal;
+  margin: 0;
+  padding: 6px 3px;
+}
+
+.views-display-column > .ctools-toggle.ctools-toggle-collapsed + .ctools-collapsible-handle {
+  border-width: 1px;
+}
+
+.views-display-column > .ctools-collapsible-content > .views-ui-display-tab-bucket:first-child {
+  border-top: medium none;
+}
+
+h2.ctools-collapsible-handle {
+  display: inline;
+  clear: both;
+}
+
+/* @end */
+
+/* @group Dependent */
+
+.dependent-options {
+  margin-left: 18px; /* LTR */
+}
+
+/* @end */
+
+/* @group Export */
+
+/* Override for filter button on the views list screen */
+#ctools-export-ui-list-form .form-submit {
+  margin-top: 0em !important;
+  margin-right: 0em;
+}
+
+.ctools-export-ui-row + .ctools-export-ui-row {
+  margin-top: 1em;
+}
+
+.ctools-export-ui-fourth-row input {
+  margin-top: 5px !important;
+}
+
+/* @end */
+
+/* @group Jump list */
+
+#views-live-preview .ctools-jump-menu-select{
+  max-width: 450px;
+}
+
+/* @end */

+ 13 - 0
sites/all/modules/contrib/views/views/css/views-admin.garland-rtl.css

@@ -0,0 +1,13 @@
+/**
+ * The .garland.css file is intended to contain styles that override declarations
+ * in the Garland theme.
+ */
+
+ /* @group Lists */
+
+.views-displays .secondary .action-list {
+  left: auto;
+  right: 1px;
+}
+
+ /* @end */

+ 263 - 0
sites/all/modules/contrib/views/views/css/views-admin.garland.css

@@ -0,0 +1,263 @@
+/**
+ * The .garland.css file is intended to contain styles that override declarations
+ * in the Garland theme.
+ */
+
+/* @group Attachment details tabs
+ *
+ * The tabs that switch between sections
+ */
+
+.views-displays .region-content .secondary,
+.views-displays .region-content .secondary {
+  padding-bottom: 0;
+  padding-left: 0;
+}
+
+.views-displays .secondary .action-list {
+  left: 1px;
+  top: 20px;
+}
+
+.views-displays .secondary .action-list li,
+.views-displays .secondary a {
+  border-color: #e9e9e9;
+}
+
+.views-displays .secondary a {
+  font-size: 12px;
+  padding: 2px 7px;
+}
+
+.views-displays ul.secondary li a:hover,
+.views-displays ul.secondary li.active a {
+  border: 1px solid transparent;
+  padding: 2px 7px;
+}
+
+.views-displays .secondary > li a {
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  border-radius: 5px;
+}
+
+.views-displays .secondary > li.open a {
+  background-image: none;
+  -moz-border-radius: 5px 5px 0 0;
+  -webkit-border-bottom-left-radius: 0;
+  -webkit-border-bottom-right-radius: 0;
+  -webkit-border-top-left-radius: 5px;
+  -webkit-border-top-right-radius: 5px;
+  border-radius: 5px 5px 0 0;
+}
+
+.views-displays .secondary .open > a:hover {
+  border-color: #e9e9e9 #e9e9e9 #f1f1f1 #e9e9e9;
+  border-width: 1px 1px 1px 1px;
+  color: #0071B3;
+}
+
+.views-displays .secondary input.form-submit {
+  font-size: 11px;
+}
+
+/* @end */
+
+/* @group Attachment buckets
+ *
+ * These are the individual "buckets," or boxes, inside the display settings area
+ */
+
+.views-ui-display-tab-bucket h3 {
+  font-weight: bold;
+}
+
+/* @end */
+
+/* @group Modal dialog box
+ *
+ * The contents of the popup dialog on the views edit form.
+ */
+
+.views-filterable-options .form-type-checkbox {
+  margin: 0;
+}
+
+.views-filterable-options .even .form-type-checkbox {
+  background-color: #F9F9F9;
+}
+
+.views-ui-dialog .ui-dialog-titlebar-close,
+.views-ui-dialog #views-ajax-title,
+.views-ui-dialog .views-override,
+.views-ui-dialog .form-buttons {
+  background-color: #f6f6f6;
+}
+
+/* @end */
+
+/* @group CTools */
+
+/* @group Buttons */
+
+.ctools-button-processed {
+  background-image:
+    -moz-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    -webkit-gradient(
+      linear,
+      left top,
+      left bottom,
+      color-stop(0.0, rgba(255, 255, 255, 1.0)),
+      color-stop(1.0, rgba(249, 249, 249, 1.0))
+    );
+  background-image:
+    -webkit-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  border-radius: 5px;
+  padding-bottom: 1px;
+  padding-top: 1px;
+}
+
+.ctools-button-processed:hover {
+  background-image:
+    -moz-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f1f1f1 100%);
+  background-image:
+    -webkit-gradient(
+      linear,
+      left top,
+      left bottom,
+      color-stop(0.0, rgba(255, 255, 255, 1.0)),
+      color-stop(1.0, rgba(241, 241, 241, 1.0))
+    );
+  background-image:
+    -webkit-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f1f1f1 100%);
+  background-image:
+    linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f1f1f1 100%);
+}
+
+.ctools-button-processed ol li,
+.ctools-button-processed ul li {
+  margin: 0;
+  padding-bottom: 0;
+}
+
+.views-ui-display-tab-actions .ctools-button-processed input {
+  margin-right: 0;
+}
+
+.ctools-content ul.actions {
+  padding-bottom: 0;
+}
+
+.ctools-dropbutton-processed.open:hover {
+  background-image:
+    -moz-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    -webkit-gradient(
+      linear,
+      left top,
+      left bottom,
+      color-stop(0.0, rgba(255, 255, 255, 1.0)),
+      color-stop(1.0, rgba(249, 249, 249, 1.0))
+    );
+  background-image:
+    -webkit-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+}
+
+.ctools-dropbutton-processed.open {
+  -moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
+  -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
+  box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
+}
+
+.ctools-twisty {
+  top: 0.6667em;
+}
+
+.ctools-dropbutton-processed.open .ctools-twisty {
+  top: 0.3333em;
+}
+
+/* @end */
+
+/* @group Dependent */
+
+.dependent-options,
+.form-checkboxes.dependent-options,
+.form-radios.dependent-options,
+.form-checkboxes .form-item.dependent-options,
+.form-radios .form-item.dependent-options {
+  margin-left: 25px;
+}
+
+/* @end */
+
+/* @group Collapsible */
+
+.ctools-toggle {
+  margin-top: 0.5em;
+}
+
+.ctools-toggle,
+.views-display-settings .ctools-toggle {
+  color: #494949;
+}
+
+.ctools-toggle.ctools-toggle-collapsed {
+  margin-top: 0.25em;
+}
+
+.views-display-column > .ctools-toggle {
+  margin-top: 14px;
+}
+
+.views-display-column > .ctools-toggle.ctools-toggle-collapsed {
+  margin-top: 12px;
+}
+
+.views-ui-display-tab-actions .ctools-button input {
+  color: #027AC6;
+  font-size: 12px;
+}
+
+.views-ui-display-tab-actions .ctools-button input:hover,
+.views-ui-display-tab-actions .ctools-button input:focus {
+  color: #0062A0;
+}
+
+/* @end */
+
+/* @end */

+ 43 - 0
sites/all/modules/contrib/views/views/css/views-admin.seven-rtl.css

@@ -0,0 +1,43 @@
+/**
+ * The .seven.css file is intended to contain styles that override declarations
+ * in the Seven admin theme.
+ */
+
+/* @group Forms */
+
+.views-admin .form-submit,
+.views-admin a.button {
+  margin-left: 0;
+}
+
+/* @end */
+
+/* @group Lists */
+
+.views-admin .links li {
+  padding-left: 0;
+}
+
+/* @end */
+
+/* @group Attachments */
+
+.views-displays .secondary {
+  text-align: right;
+}
+
+/* @end */
+
+/* @group Attachment details tabs */
+
+.views-display-top ul.secondary {
+  float: right;
+}
+
+.views-displays .secondary .action-list  li:first-child {
+  -moz-border-radius: 7px 0 0 0;
+  -webkit-border-radius: 7px 0 0 0;
+  border-radius: 7px 0 0 0;
+}
+
+/* @end */

+ 552 - 0
sites/all/modules/contrib/views/views/css/views-admin.seven.css

@@ -0,0 +1,552 @@
+/**
+ * The .seven.css file is intended to contain styles that override declarations
+ * in the Seven admin theme.
+ */
+
+/* @group Content */
+
+.views-ui-display-tab-bucket h1,
+.views-ui-display-tab-bucket h2,
+.views-ui-display-tab-bucket h3,
+.views-ui-display-tab-bucket h4,
+.views-ui-display-tab-bucket h5 {
+  margin-bottom: 0;
+  margin-top: 0;
+}
+
+/* @end */
+
+/* @group Forms */
+
+.views-ui-dialog fieldset {
+  padding-top: 2.5em;
+}
+
+fieldset fieldset {
+  border: medium none;
+}
+
+/**
+ * Seven positions the legend absolutely, but does not have a way to ignore
+ * fieldsets without a legend so we make one up.
+ */
+fieldset.fieldset-no-legend {
+  padding-top: 0;
+}
+
+/**
+ * Being extra safe here and scoping this to the add view wizard form (where
+ * a layout problem occurs for the Display format fieldset if we don't fix its
+ * padding), but it's probably safe to just let it apply everywhere.
+ */
+#views-ui-add-form fieldset fieldset .fieldset-wrapper {
+  padding-left: 0;
+  padding-right: 0;
+}
+
+.views-display-tab fieldset {
+  padding: 0 12px;
+}
+
+.views-display-tab .fieldset-wrapper {
+  padding: 10px 12px 12px;
+}
+
+.views-display-tab fieldset.box-padding .fieldset-wrapper {
+  padding: 0;
+}
+
+.views-display-tab legend + .fieldset-wrapper {
+  padding-top: 2.5em;
+}
+
+.views-admin .form-item label.option,
+#views-ui-preview-form .form-item label.option {
+  font-size: 1em;
+}
+
+#views-ui-preview-form .form-submit {
+  margin-top: 3px;
+}
+
+.views-admin input.form-submit,
+.views-ui-dialog input.form-submit,
+.views-admin a.button,
+.views-ui-dialog a.button {
+  margin-bottom: 0;
+  margin-right: 0; /* LTR */
+  margin-top: 0;
+}
+
+/* Override for a button on the edit display screen */
+#edit-displays-preview-controls .form-submit {
+  display: inline-block;
+  margin-right: 1em;
+}
+
+/* Override for filter button on the views list screen */
+#ctools-export-ui-list-form .form-submit {
+  margin-bottom: 0;
+}
+
+#ctools-export-ui-list-form .ctools-export-ui-first-row .form-item {
+  margin-top: 3px;
+  margin-right: 5px; /* LTR */
+}
+
+.form-item,
+.form-item .form-item {
+  margin-bottom: 0;
+  margin-top: 9px;
+  padding-bottom: 0;
+  padding-top: 0;
+}
+
+.form-actions {
+  margin-bottom: 0;
+  margin-top: 0;
+}
+
+.form-item .form-item {
+  padding-bottom: 0;
+  padding-top: 0;
+}
+
+.form-radios > .form-item {
+  margin-top: 3px;
+}
+
+/* @group Dependent options
+ *
+ * Dependent options are identified in CTools dependent.js
+ */
+
+/* The .dependent-options.form-item is necessary to supercede the Seven .form-item
+ * reset declaration that sets the margin to zero.
+ */
+.dependent-options,
+.dependent-options.form-item,
+.form-item-options-expose-required,
+.form-item-options-expose-label,
+.form-item-options-expose-description {
+  margin-left: 1.5em;
+}
+
+.views-admin-dependent .form-item .form-item,
+.views-admin-dependent .form-type-checkboxes,
+.views-admin-dependent .form-type-radios,
+.views-admin-dependent .dependent-options,
+.views-admin-dependent .form-item .form-item,
+.views-admin-dependent .dependent-options .form-type-select,
+.views-admin-dependent .dependent-options .form-type-textfield,
+.form-item-options-expose-required,
+.form-item-options-expose-label,
+.form-item-options-expose-description {
+  margin-bottom: 6px;
+  margin-top: 6px;
+}
+
+.views-admin-dependent .form-type-radio,
+.views-admin-dependent .form-radios .form-item {
+  margin-bottom: 2px;
+  margin-top: 2px;
+}
+
+/* @end */
+
+/* @end */
+
+/* @group Lists */
+
+.views-admin ul.secondary,
+.views-admin .item-list ul {
+  margin: 0;
+  padding: 0;
+}
+
+.views-admin ul.secondary {
+  clear: none;
+}
+
+.views-displays ul.secondary li a,
+.views-displays ul.secondary li.active a,
+.views-displays ul.secondary li.active a.active {
+  padding: 2px 7px 3px;
+}
+
+.views-displays ul.secondary li.active a,
+.views-displays ul.secondary li.active a.active {
+  border: 1px solid transparent;
+}
+
+.views-admin .links li {
+  padding-right: 0; /* LTR */
+}
+
+.views-admin .button .links li {
+  padding-right: 12px; /* LTR */
+}
+
+.page-admin-structure-views #content ul.action-links {
+  padding-left: 0;
+  padding-right: 0;
+}
+
+.views-display-top ul.secondary {
+  background-color: transparent;
+  float: left
+}
+
+.views-display-top .secondary .action-list li {
+  float: none;
+  margin: 0;
+}
+
+/* @end */
+
+/* @group Buttons */
+
+.ctools-button-processed ul {
+  margin: 0;
+}
+
+/* Override for input elements that are themed like ctools-buttons */
+.ctools-button-processed input.form-submit:hover {
+  background-image: none;
+  color: #0074BD;
+  text-shadow: none;
+}
+
+.ctools-button-processed input.form-submit:active {
+  background: none;
+  border: medium none;
+  color: #0074BD;
+  text-shadow: none;
+}
+
+/* @end */
+
+/* @group Tables */
+
+table td,
+table th {
+  vertical-align: top;
+}
+
+/* @end */
+
+/* @group Attachment details */
+
+#edit-display-settings-title {
+  color: #008BCB;
+}
+
+/* @end */
+
+/* @group Attachment details tabs
+ *
+ * The tabs that switch between sections
+ */
+
+.views-displays .secondary {
+ text-align: left; /* LTR */
+}
+
+.views-displays .secondary > li:first-child {
+ padding-left: 0;
+}
+
+.views-admin .icon.add {
+  background-position: center 3px;
+}
+
+.views-displays .secondary a {
+  background-color: #f1f1f1;
+  -moz-border-radius: 7px;
+  -webkit-border-radius: 7px;
+  border-radius: 7px;
+  color: #008BCB;
+}
+
+.views-displays .secondary a:hover > .icon.add {
+  background-position: center -25px;
+}
+
+.views-displays .secondary .open > a {
+  -moz-border-radius: 7px 7px 0 0;
+  -webkit-border-radius: 7px 7px 0 0;
+  border-radius: 7px 7px 0 0;
+}
+
+.views-displays .secondary .open > a:hover {
+  background-color: #f1f1f1;
+  color: #008BCB;
+}
+
+.views-displays .secondary .action-list  li:first-child {
+  -moz-border-radius: 0 7px 0 0;
+  -webkit-border-radius: 0 7px 0 0;
+  border-radius: 0 7px 0 0;
+}
+
+.views-displays .secondary .action-list  li:last-child {
+  -moz-border-radius: 0 0 7px 7px;
+  -webkit-border-radius: 0 0 7px 7px;
+  border-radius: 0 0 7px 7px;
+}
+
+.views-displays .secondary .action-list input.form-submit {
+  -moz-border-radius: 0;
+  -webkit-border-radius: 0;
+  border-radius: 0;
+  color: #008BCB;
+}
+
+/* @end */
+
+/* @group Attachment buckets
+ *
+ * These are the individual "buckets," or boxes, inside the display settings area
+ */
+
+.views-ui-display-tab-bucket h3 {
+  font-size: 12px;
+  text-transform: uppercase;
+}
+
+.views-ui-display-tab-bucket .links {
+  padding: 2px 6px 4px;
+}
+
+.views-ui-display-tab-bucket .links li + li {
+  margin-left: 3px;
+}
+
+/* @end */
+
+/* @group Rearrange filter criteria */
+
+#views-ui-rearrange-filter-form .action-links {
+  margin: 0;
+  padding: 0;
+}
+
+#views-ui-rearrange-filter-form table {
+  border: medium none;
+}
+
+#views-ui-rearrange-filter-form [id^="views-row"] {
+  border: medium none;
+}
+
+#views-ui-rearrange-filter-form tr td:last-child {
+  border-right: medium none;
+}
+
+#views-ui-rearrange-filter-form .filter-group-operator-row {
+  border-left: 1px solid transparent !important;
+  border-right: 1px solid transparent !important;
+}
+
+#views-ui-rearrange-filter-form tr.drag td {
+  background-color: #FFEE77 !important;
+}
+
+#views-ui-rearrange-filter-form tr.drag-previous td {
+  background-color: #FFFFBB !important;
+}
+
+/* @end */
+
+/* @group Live preview elements */
+
+.views-query-info pre {
+  margin-bottom: 0;
+  margin-top: 0;
+}
+
+/* @group Query info table */
+
+.views-query-info table {
+  -moz-border-radius: 7px;
+  -webkit-border-radius: 7px;
+  border-radius: 7px;
+  -webkit-border-horizontal-spacing: 1px;
+  -webkit-border-vertical-spacing: 1px;
+}
+
+.views-query-info table tr td:last-child {
+  /* Fixes a Seven style that bleeds down into this table unnecessarily */
+  border-right: 0 none;
+}
+
+/* @end */
+
+/* @end */
+
+/* @group Add view */
+
+.form-item-page-create,
+.form-item-block-create {
+  margin-top: 13px;
+}
+
+/* @end */
+
+/* @group Modal dialog box
+ *
+ * The contents of the popup dialog on the views edit form.
+ */
+
+.views-ui-dialog .ui-dialog-titlebar-close {
+  -moz-box-shadow: none;
+  -webkit-box-shadow: none;
+  box-shadow: none;
+  border-color: #cccccc;
+  right: -27px;
+  top: -1px;
+}
+
+.views-ui-dialog fieldset.collapsible {
+  padding-top: 1.5em;
+}
+
+.views-ui-dialog fieldset.collapsed {
+  padding-top: 2.5em;
+}
+
+.filterable-option .form-item.form-type-checkbox {
+  /* This selector is aggressive because Seven's reset for .form-items is aggressive. */
+  padding-bottom: 4px;
+  padding-left: 4px;
+  padding-top: 4px;
+}
+
+/* @end */
+
+/* @group CTools */
+
+/* @group Buttons */
+
+.ctools-button-processed {
+  background-image:
+    -moz-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    -webkit-gradient(
+      linear,
+      left top,
+      left bottom,
+      color-stop(0.0, rgba(255, 255, 255, 1.0)),
+      color-stop(1.0, rgba(249, 249, 249, 1.0))
+    );
+  background-image:
+    -webkit-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  -moz-border-radius: 11px 11px 11px 11px;
+  -webkit-border-radius: 11px 11px 11px 11px;
+  border-radius: 11px 11px 11px 11px;
+}
+
+.ctools-button-processed:hover {
+  background-image:
+    -moz-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f1f1f1 100%);
+  background-image:
+    -webkit-gradient(
+      linear,
+      left top,
+      left bottom,
+      color-stop(0.0, rgba(255, 255, 255, 1.0)),
+      color-stop(1.0, rgba(241, 241, 241, 1.0))
+    );
+  background-image:
+    -webkit-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f1f1f1 100%);
+  background-image:
+    linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f1f1f1 100%);
+}
+
+.ctools-dropbutton-processed.open:hover {
+  background-image:
+    -moz-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    -webkit-gradient(
+      linear,
+      left top,
+      left bottom,
+      color-stop(0.0, rgba(255, 255, 255, 1.0)),
+      color-stop(1.0, rgba(249, 249, 249, 1.0))
+    );
+  background-image:
+    -webkit-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+  background-image:
+    linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #f9f9f9 100%);
+}
+
+.ctools-dropbutton-processed.open {
+  -moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
+  -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
+  box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
+}
+
+/* @end */
+
+/* @group Collapsible */
+
+.ctools-toggle {
+  margin-top: 0.6667em;
+}
+
+.ctools-toggle.ctools-toggle-collapsed {
+  margin-top: 0.5em;
+}
+
+.views-display-settings .ctools-toggle {
+  color: #008BCB;
+}
+
+.views-display-column > .ctools-toggle {
+  margin-top: 14px;
+}
+
+.views-display-column > .ctools-toggle.ctools-toggle-collapsed {
+  margin-top: 12px;
+}
+
+.views-display-column > .ctools-collapsible-handle {
+  color: #008BCB;
+}
+
+.views-ui-display-tab-actions .ctools-button-processed input {
+  color: #0074BD;
+}
+
+/* @end */
+
+/* @end */

+ 208 - 0
sites/all/modules/contrib/views/views/css/views-admin.theme-rtl.css

@@ -0,0 +1,208 @@
+/**
+ * The .theme.css file is intended to contain presentation declarations including
+ * images, borders, colors, and fonts.
+ */
+
+/* @end */
+
+/* @group Icons */
+
+.actions a,
+.views-admin .icon,
+.views-admin .icon-text {
+  background-position: right top;
+}
+
+/* Targets any element with an icon -> text combo */
+.views-admin .icon-text {
+  padding-right: 19px;
+}
+
+.views-admin .icon-linked {
+  background-position: right -153px;
+}
+
+.views-admin .icon-unlinked {
+  background-position: right -195px;
+}
+
+.actions .views-button-add {
+  background-position: right -39px;
+}
+
+.actions .views-button-rearrange {
+  background-position: right -96px;
+}
+
+.actions .views-button-add:hover {
+  background-position: right -58px;
+}
+
+.actions .views-button-rearrange:hover {
+  background-position: right -115px;
+}
+
+.actions .views-button-add:active {
+  background-position: right -77px;
+}
+
+.actions .views-button-rearrange:active {
+  background-position: right -134px;
+}
+
+.views-displays .icon-add {
+  background-position: right -3px;
+}
+
+.views-displays .secondary a:hover > .icon-add {
+  background-position: right -21px;
+}
+
+.views-displays .secondary .open a:hover > .icon-add {
+  background-position: right -3px;
+}
+
+/* @end */
+
+/* @group Forms */
+
+.form-submit + .form-submit,
+.views-admin a.button + a.button {
+  margin-right: 1em;
+}
+
+.container-inline > * + *,
+.container-inline .fieldset-wrapper > * + * {
+  padding-left: 0;
+  padding-right: 4pt;
+}
+
+.views-admin .form-type-checkbox + .form-wrapper {
+  margin-right: 16px;
+}
+
+/* @end */
+
+/* @group Lists */
+
+.horizontal > * + * {
+  margin-right: 9px;
+  padding-right: 9px;
+}
+
+/* @end */
+
+/* @group Attachments */
+
+.views-displays .secondary {
+  padding: 6px 8px 8px;
+}
+
+.views-displays .views-display-top > ul > li + li {
+  margin-right: 3px;
+}
+
+.views-displays .views-extra-actions {
+  left: 10px;
+}
+
+/* @end */
+
+/* @group Attachment details tabs
+ *
+ * The tabs that switch between sections
+ */
+
+.views-displays .secondary .action-list  li:first-child {
+  -moz-border-radius: 7px 0 0 0;
+  -webkit-border-top-left-radius: 7px;
+  -webkit-border-top-right-radius: 0;
+  border-radius: 7px 0 0 0;
+}
+
+/* @end */
+
+/* @group Attachment details collapsible fieldset
+ *
+ * The attachment details section is a collapsible fieldset, but should not
+ * have a border around it.
+ */
+
+.views-display-tab .fieldset-legend {
+  left: auto;
+  right: -5px;
+}
+
+/* @end */
+
+/* @group Auto preview
+ *
+ * The auto-preview checkbox line. This may have more stuff added to it.
+ */
+
+div.form-item-displays-live-preview {
+  text-align: left;
+}
+
+/* @end */
+
+/* @group Attachment buckets
+ *
+ * These are the individual "buckets," or boxes, inside the three columns in the
+ * attachment details section.
+ */
+
+.views-ui-display-tab-bucket .icon-text {
+  padding-right: 25px;
+}
+
+/* @end */
+
+/* @group Attachment bucket rows
+ *
+ * This is each row within one of the "boxes."
+ */
+
+.views-display-setting .label {
+  margin-left: 3pt;
+}
+
+/* @end */
+
+/* @group Modal dialog box
+ *
+ * The contents of the popup dialog on the views edit form.
+ */
+
+#views-filterable-options-controls .form-item {
+  margin-left: 2%;
+}
+
+.views-ui-dialog #views-progress-indicator {
+  left: 10px;
+  right: auto;
+}
+
+/* @end */
+
+/* @group Rearrange filters
+ *
+ * Styling for the form that allows views filters to be rearranged.
+ */
+.views-operator-label {
+  padding-right: 0.5em;
+}
+
+/* @end */
+
+/* @group Live preview elements */
+
+/* @group HTML list */
+
+#views-live-preview .view-content > .item-list > ul {
+  padding-right: 21px;
+}
+
+/* @end */
+
+/* @end */

+ 1083 - 0
sites/all/modules/contrib/views/views/css/views-admin.theme.css

@@ -0,0 +1,1083 @@
+/**
+ * The .theme.css file is intended to contain presentation declarations including
+ * images, borders, colors, and fonts.
+ */
+
+/* @group Reset */
+
+.views-admin .links {
+  list-style: none outside none;
+  margin: 0;
+}
+
+.views-admin a:hover {
+  text-decoration: none;
+}
+
+/* @end */
+
+/* @group Layout */
+
+.box-padding {
+  padding-left: 12px;
+  padding-right: 12px;
+}
+
+.box-margin {
+  margin: 12px 12px 0 12px;
+}
+
+/* @end */
+
+/* @group Icons */
+
+.views-admin .icon {
+  height: 16px;
+  width: 16px;
+}
+
+.views-admin .icon,
+.views-admin .icon-text {
+  background-attachment: scroll;
+  background-image: url("../images/sprites.png");
+  background-position: left top; /* LTR */
+  background-repeat: no-repeat;
+}
+
+.views-admin a.icon {
+  background-image:
+    url("../images/sprites.png"),
+    -moz-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #e8e8e8 100%);
+  background-image:
+    url("../images/sprites.png"),
+    -webkit-gradient(
+      linear,
+      left top,
+      left bottom,
+      color-stop(0.0, rgba(255, 255, 255, 1.0)),
+      color-stop(1.0, rgba(232, 232, 232, 1.0))
+    );
+  background-image:
+    url("../images/sprites.png"),
+    -webkit-linear-gradient(
+      -90deg,
+      #ffffff 0px,
+      #e8e8e8 100%);
+  background-repeat: no-repeat, repeat-y;
+  border: 1px solid #dddddd;
+  -moz-border-radius: 4px;
+  -webkit-border-radius: 4px;
+  border-radius: 4px;
+  -moz-box-shadow: 0 0 0 rgba(0,0,0,0.3333) inset;
+  -webkit-box-shadow: 0 0 0 rgba(0,0,0,0.3333) inset;
+  box-shadow: 0 0 0 rgba(0,0,0,0.3333) inset;
+}
+
+.views-admin a.icon:hover {
+  border-color: #d0d0d0;
+  -moz-box-shadow: 0 0 1px rgba(0,0,0,0.3333) inset;
+  -webkit-box-shadow: 0 0 1px rgba(0,0,0,0.3333) inset;
+  box-shadow: 0 0 1px rgba(0,0,0,0.3333) inset;
+}
+
+.views-admin a.icon:active {
+  border-color: #c0c0c0;
+}
+
+/**
+ * Targets a <span> element inside an <a> element.
+ * This assumes no visible text from the span.
+ */
+.views-admin span.icon {
+  display: inline-block;
+  float: left;
+  position: relative;
+}
+
+.views-admin .icon.compact {
+  display: block;
+  overflow: hidden;
+  text-indent: -9999px;
+}
+
+/* Targets any element with an icon -> text combo */
+.views-admin .icon-text {
+  padding-left: 19px; /* LTR */
+}
+
+.views-admin .icon.linked {
+  background-position: center -153px;
+}
+
+.views-admin .icon.unlinked {
+  background-position: center -195px;
+}
+
+.views-admin .icon.add {
+  background-position: center 3px;
+}
+
+.views-admin a.icon.add {
+  background-position: center 3px, left top;
+}
+
+.views-admin .icon.delete {
+  background-position: center -52px;
+}
+
+.views-admin a.icon.delete {
+  background-position: center -52px, left top;
+}
+
+.views-admin .icon.rearrange {
+  background-position: center -111px;
+}
+
+.views-admin a.icon.rearrange {
+  background-position: center -111px, left top;
+}
+
+.views-displays .secondary a:hover > .icon.add {
+  background-position: center -25px;
+}
+
+.views-displays .secondary .open a:hover > .icon.add {
+  background-position: center 3px;
+}
+
+/* @end */
+
+/* @group Forms */
+
+fieldset.box-padding {
+  border: none;
+}
+
+.views-admin fieldset fieldset {
+  margin-bottom: 0;
+}
+
+.form-item {
+  margin-top: 9px;
+  padding-bottom: 0;
+  padding-top: 0;
+}
+
+.form-type-checkbox {
+  margin-top: 6px;
+}
+
+input.form-checkbox,
+input.form-radio {
+  vertical-align: baseline;
+}
+
+.form-submit:not(.js-hide) + .form-submit,
+.views-admin a.button:not(.js-hide) + a.button {
+  margin-left: 1em; /* LTR */
+}
+
+.container-inline {
+  padding-top: 15px;
+}
+
+.container-inline > * + *,
+.container-inline .fieldset-wrapper > * + * {
+  padding-left: 4pt; /* LTR */
+}
+
+.views-admin fieldset fieldset.container-inline {
+  margin-bottom: 1em;
+  margin-top: 1em;
+  padding-top: 0;
+}
+
+.views-admin fieldset fieldset.container-inline > .fieldset-wrapper {
+  padding-bottom: 0;
+}
+
+/* Indent form elements so they're directly underneath the label of the checkbox that reveals them */
+.views-admin .form-type-checkbox + .form-wrapper {
+  margin-left: 16px; /* LTR */
+}
+
+/* Hide 'remove' checkboxes. */
+.views-remove-checkbox {
+    display: none;
+}
+
+/* sizes the labels of checkboxes and radio button to the height of the text */
+.views-admin .form-type-checkbox label,
+.views-admin .form-type-radio label {
+  line-height: 2;
+}
+
+/* @group Dependent options */
+
+.views-admin-dependent .form-item {
+  margin-bottom: 6px;
+  margin-top: 6px;
+}
+
+/* @end */
+
+/* @end */
+
+/* @group Lists */
+
+.horizontal > * + * {
+  margin-left: 9px; /* LTR */
+  padding-left: 9px; /* LTR */
+}
+
+.views-ui-view-title {
+  font-weight: bold;
+}
+
+/* @end */
+
+/* @group Messages */
+
+.view-changed {
+  margin-bottom: 21px;
+}
+
+/* @end */
+
+/* @group Headings */
+
+/* Intentionally targeting h1 */
+.views-admin h1.unit-title {
+  font-size: 15px;
+  line-height: 1.6154;
+  margin-bottom: 0;
+  margin-top: 18px;
+}
+
+/* @end */
+
+/* @group Tables */
+
+table td,
+table th {
+  vertical-align: top;
+}
+
+/* @end */
+
+/* @group List views */
+
+/* These header classes are ambiguous and should be scoped to th elements */
+
+th.views-ui-name {
+  width: 18%;
+}
+
+th.views-ui-description {
+  width: 26%;
+}
+
+th.views-ui-tag {
+  width: 8%;
+}
+
+th.views-ui-path {
+  width: auto;
+}
+
+th.views-ui-operations {
+  width: 24%;
+}
+
+/* @end */
+
+/* @group Add view */
+
+/**
+ * Drupal core forces AJAX triggering elements to float left when they are
+ * disabled due to AJAX processing. On the add view page, we have inline
+ * containers where we don't want that behavior; it causes the select dropdown
+ * which is triggered to jump to the left while the AJAX throbber is active.
+ *
+ * See also http://drupal.org/node/769936 (Drupal core issue); when that is
+ * fixed it may no longer be necessary to do this.
+ */
+.views-admin .container-inline .progress-disabled {
+  float: none;
+}
+
+/**
+ * I wish this didn't have to be so specific
+ */
+.form-item-description-enable + .form-item-description {
+  margin-top: 0;
+}
+
+.form-item-description-enable label {
+  font-weight: bold;
+}
+
+.form-item-page-create,
+.form-item-block-create {
+  margin-top: 13px;
+}
+
+.form-item-page-create label,
+.form-item-block-create label {
+  font-weight: bold;
+}
+
+/* This makes the form elements after the "Display Format" label flow underneath the label */
+.form-item-page-style-style-plugin > label,
+.form-item-block-style-style-plugin > label {
+  display: block;
+}
+
+.views-attachment .options-set label {
+  font-weight: normal;
+}
+
+/* @end */
+
+/* @group Rearrange filters
+ *
+ * Styling for the form that allows views filters to be rearranged.
+ */
+
+.group-populated {
+  display: none;
+}
+
+td.group-title {
+  font-weight: bold;
+}
+
+.views-ui-dialog td.group-title {
+  margin: 0;
+  padding: 0;
+}
+
+.views-ui-dialog td.group-title span {
+  display: block;
+  height: 1px;
+  overflow: hidden;
+}
+
+.group-message .form-submit,
+.views-remove-group-link,
+#views-add-group {
+  float: right;
+  clear: both;
+}
+
+.views-operator-label {
+  font-style: italic;
+  font-weight: bold;
+  padding-left: 0.5em; /* LTR */
+  text-transform: uppercase;
+}
+
+.grouped-description,
+.exposed-description {
+  float: left;
+  padding-top: 3px;
+  padding-right: 10px;
+}
+
+/* This keeps the collapsible fieldsets of options from crashing into the bottom
+ * of the edit option columns. Because the edit option columns are floated, the collapsible
+ * fieldsets need to be floated as well so that the margin above the fieldset interacts with
+ * the float edit option columns.
+ */
+#edit-options .collapsible {
+  float: left;
+  width: 100%;
+}
+
+#edit-options-more {
+  clear: both;
+}
+
+/* @end */
+
+/* @group Attachments */
+
+.views-displays {
+  border: 1px solid #CCC;
+  padding-bottom: 36px;
+}
+
+.views-display-top {
+  background-color: #F9F9F9;
+  border-bottom: 1px solid #CCCCCC;
+  padding: 8px 8px 8px; /* LTR */
+  position: relative;
+}
+
+.views-display-top .secondary {
+  margin-right: 18em;
+}
+
+.views-display-top .secondary > li {
+  margin-right: 6px;
+  padding-left: 0;
+}
+
+.views-display-top .secondary > li:last-child {
+  margin-right: 0;
+}
+
+#views-display-extra-actions li {
+  padding: 3px 9px;
+}
+
+.views-display-top #views-display-top {
+  max-width: 180px;
+}
+
+/* @end */
+
+/* @group Attachment details tabs
+ *
+ * The tabs that switch between sections
+ */
+
+ul#views-display-menu-tabs {
+  margin-right: 200px;
+}
+
+ul#views-display-menu-tabs li {
+  margin-bottom: 5px;
+}
+
+ul#views-display-menu-tabs li.add ul.action-list li{
+  margin: 0;
+}
+
+.views-displays .secondary a {
+  border: 1px solid #cbcbcb;
+  display: inline-block;
+  font-size: small;
+  line-height: 1.3333;
+  padding: 3px 7px;
+}
+
+/**
+ * Display a red border if the display doesn't validate.
+ */
+.views-displays ul.secondary li.active a.active.error,
+.views-displays .secondary a.error {
+  border: 2px solid #ED541D;
+  padding: 1px 6px;
+}
+
+.views-displays .secondary a:focus {
+  outline: none;
+}
+
+.views-displays .secondary a:hover,
+.views-displays .secondary .active a {
+  background-color: #666666;
+  color: #ffffff;
+  border-bottom-width: 1px;
+}
+
+.views-displays .secondary .open > a {
+  background-color: #f1f1f1;
+  border-bottom: 1px solid transparent;
+  position: relative;
+}
+
+.views-displays .secondary .open > a:hover {
+  background-color: #f1f1f1;
+}
+
+.views-displays .secondary .action-list  li {
+  background-color: #f1f1f1;
+  border-color: #cbcbcb;
+  border-style: solid;
+  border-width: 0 1px;
+  padding: 2px 9px;
+}
+
+.views-displays .secondary .action-list  li:first-child {
+  border-width: 1px 1px 0;
+}
+
+.views-displays .secondary .action-list  li.last {
+  border-width: 0 1px 1px;
+}
+
+.views-displays .secondary .action-list  li:last-child {
+  border-width: 0 1px 1px;
+}
+
+.views-displays .secondary .action-list input.form-submit {
+  background: none repeat scroll 0 0 transparent;
+  border: medium none;
+  margin: 0;
+  padding: 0;
+}
+
+.views-displays .secondary .action-list li:hover {
+  background-color: #dddddd;
+}
+
+/* @end */
+
+/* @group Attachment details */
+
+#edit-display-settings-title {
+  font-size: 14px;
+  line-height: 1.5;
+  margin: 0;
+}
+
+#edit-display-settings-top {
+  padding-bottom: 4px;
+}
+
+#edit-display-settings-content {
+  margin-top: 12px;
+}
+
+#edit-display-settings-main {
+  margin-top: 15px;
+}
+
+/* @end */
+
+/* @group Attachment columns
+ *
+ * The columns that contain the option buckets e.g. Format and Basic Settings
+ */
+
+.views-display-column + .views-display-column {
+   margin-top: 0;
+ }
+
+ /* @end */
+
+/* @group Auto preview
+ *
+ * The auto-preview checkbox line.
+ */
+
+#views-ui-preview-form > div > div,
+#views-ui-preview-form > div > input {
+  float: left;
+}
+
+#views-ui-preview-form .form-type-checkbox {
+  margin-top: 2px;
+  margin-left: 2px;
+}
+
+#views-ui-preview-form .form-type-textfield {
+  margin-top: 5px;
+}
+
+#views-ui-preview-form .arguments-preview {
+  font-size: 1em;
+}
+
+#views-ui-preview-form .arguments-preview,
+#views-ui-preview-form .form-type-textfield {
+  margin-left: 14px;
+}
+
+#views-ui-preview-form .form-type-textfield label {
+  display: inline-block;
+  float: left;
+  font-weight: normal;
+  height: 6ex;
+  margin-right: 0.75em;
+}
+
+#views-ui-preview-form .form-type-textfield .description {
+  white-space: nowrap;
+}
+
+/* @end */
+
+/* @group Attachment buckets
+ *
+ * These are the individual "buckets," or boxes, inside the display settings area
+ */
+
+.views-ui-display-tab-bucket {
+  border: 1px solid #f3f3f3;
+  line-height: 20px;
+  margin: 0;
+  padding-top: 4px;
+}
+
+.views-ui-display-tab-bucket + .views-ui-display-tab-bucket {
+  border-top: medium none;
+}
+
+.views-ui-display-tab-bucket > h3,
+.views-ui-display-tab-bucket > .views-display-setting {
+  padding: 2px 6px 4px;
+}
+
+.views-ui-display-tab-bucket h3 {
+  font-size: small;
+  margin: 0;
+}
+
+.views-ui-display-tab-bucket .horizontal.actions {
+  margin-right: 6px;
+}
+
+.views-ui-display-tab-bucket .actions.horizontal li + li {
+  margin-left: 3px;
+  padding-left: 3px;
+}
+
+.views-ui-display-tab-bucket.access {
+  padding-top: 0;
+}
+
+.views-ui-display-tab-bucket.page-settings {
+  border-bottom: medium none;
+}
+
+.views-display-setting .views-ajax-link {
+  margin-left: 0.2083em;
+  margin-right: 0.2083em;
+}
+
+/* @end */
+
+/* @group Attachment bucket overridden
+ *
+ * Applies a overriden(italics) font style to overridden buckets.
+ * The better way to implement this would be to add the overridden class
+ * to the bucket header when the bucket is overridden and style it as a
+ * generic icon classed element. For the moment, we'll style the bucket
+ * header specifically with the overriden font style.
+ */
+
+.views-ui-display-tab-setting.overridden,
+.views-ui-display-tab-bucket.overridden > h3 {
+  font-style: italic;
+}
+
+/* @end */
+
+/* @group Attachment bucket drop button */
+
+.views-ui-display-tab-bucket {
+  position: relative;
+}
+
+/* @end */
+
+/* @group Attachment bucket rows
+ *
+ * This is each row within one of the "boxes."
+ */
+
+.views-ui-display-tab-bucket .views-display-setting {
+  color: #666666;
+  font-size: 12px;
+  padding-bottom: 2px;
+}
+
+.views-ui-display-tab-bucket .even {
+  background-color: #f9f9f9;
+}
+
+.views-ui-display-tab-bucket .views-group-text {
+  margin-top: 6px;
+  margin-bottom: 6px;
+}
+
+.views-display-setting .label {
+  margin-right: 3pt; /* LTR */
+}
+
+/* @end */
+
+/* @group Preview
+ *
+ * The preview controls and the preview pane
+ */
+
+#edit-displays-preview-controls .fieldset-wrapper > * {
+  float: left;
+}
+
+#edit-displays-preview-controls .fieldset-wrapper > .form-item {
+  margin-top: 0.3333em;
+}
+
+#edit-displays-preview-controls .form-submit {
+  display: inline-block;
+  margin-right: 1em;
+}
+
+#edit-displays-preview-controls .form-type-textfield {
+  margin-left: 1em;
+  position: relative;
+}
+
+#edit-displays-preview-controls .form-type-textfield label {
+  border-left: 1px solid #999;
+  padding-left: 1em;
+  position: absolute;
+}
+
+#edit-displays-preview-controls .form-type-textfield label:after {
+  content: ":";
+}
+
+#edit-displays-preview-controls .form-type-textfield label ~ * {
+  margin-left: 105px;
+}
+
+/* @end */
+
+/* @group Modal dialog box
+ *
+ * The contents of the popup dialog on the views edit form.
+ */
+
+.views-ui-dialog {
+  font-size: small;
+  padding: 0;
+}
+
+.views-ui-dialog .ui-dialog-titlebar-close {
+  background: url("../images/close.png") no-repeat scroll 6px 3px #F3F4EE;
+  border-color: #aaaaaa;
+  -moz-border-radius: 0 10px 12px 0;
+  -webkit-border-radius: 0 10px 12px 0;
+  border-radius: 0 10px 12px 0;
+  border-style: solid;
+  border-width: 1px 1px 1px 0;
+  -moz-box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.1);
+  -webkit-box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.1);
+  box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.1);
+  height: 22px;
+  right: -28px;
+  top: 0;
+  width: 26px;
+}
+
+.views-ui-dialog .ui-dialog-titlebar-close span {
+  display: none;
+}
+
+.views-filterable-options .form-type-checkbox {
+  border: 1px solid #CCC;
+  padding: 5px 8px;
+  border-top: none;
+}
+
+.views-filterable-options {
+  border-top:  1px solid #CCC;
+}
+
+.views-filterable-options .even .form-type-checkbox {
+  background-color: #F3F4EE;
+}
+
+.filterable-option .form-item {
+  margin-bottom: 0;
+  margin-top: 0;
+}
+
+.views-filterable-options .form-type-checkbox .description {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+
+#views-filterable-options-controls {
+  margin: 1em 0;
+}
+
+#views-filterable-options-controls .form-item {
+  width: 45%;
+  margin-right: 2%; /* LTR */
+}
+
+#views-filterable-options-controls input,
+#views-filterable-options-controls select {
+  width: 200px;
+}
+
+.views-ui-dialog .views-filterable-options {
+  margin-bottom: 10px;
+}
+
+.views-ui-dialog .views-add-form-selected.container-inline {
+  padding-top: 0;
+}
+
+.views-ui-dialog .views-add-form-selected.container-inline > div {
+  display: block;
+}
+
+.views-ui-dialog #edit-selected {
+  margin: 0;
+  padding: 6px 16px;
+}
+
+.views-ui-dialog #views-ajax-title,
+.views-ui-dialog .views-override {
+  background-color: #F3F4EE;
+}
+
+.views-ui-dialog .views-override {
+  padding: 0 13px 8px;
+}
+
+.views-ui-dialog .views-override > * {
+  margin: 0;
+}
+
+.views-ui-dialog #views-ajax-title {
+  font-size: 15px;
+  padding: 8px 13px;
+}
+
+.views-ui-dialog #views-progress-indicator {
+  font-size: 11px;
+  position: absolute;
+  right: 10px; /* LTR */
+  top: 8px;
+}
+
+.views-ui-dialog #views-progress-indicator:before {
+  content: "\003C\00A0";
+}
+
+.views-ui-dialog #views-progress-indicator:after {
+  content: "\00A0\003E";
+}
+
+.views-ui-dialog .scroll {
+  border: 1px solid #CCC;
+  border-width: 1px 0;
+  padding: 8px 13px;
+}
+
+.views-ui-dialog fieldset .item-list {
+  padding-left: 2em;
+}
+
+.views-ui-dialog .form-buttons {
+  background-color: #F3F4EE;
+  padding: 8px 13px;
+}
+.views-ui-dialog .form-buttons input {
+  margin-bottom: 0;
+  margin-right: 0;
+}
+
+/* @end */
+
+/* @group Configure filter criteria */
+
+/* @todo the width and border info could be moved into a more generic class */
+/* @todo Make this a class to be used anywhere there's node types? */
+.form-type-checkboxes #edit-options-value,
+.form-type-checkboxes #edit-options-validate-options-node-types {
+  border-color: #CCCCCC;
+  border-style: solid;
+  border-width: 1px;
+  max-height: 210px;
+  overflow: auto;
+  margin-top: 5px;
+  padding: 0 5px;
+  width: 190px;
+}
+
+/* @end */
+
+/* @group Rearrange filter criteria */
+
+#views-ui-rearrange-filter-form table {
+  border-collapse: collapse;
+}
+
+#views-ui-rearrange-filter-form tr td[rowspan] {
+  border-color: #CDCDCD;
+  border-style: solid;
+  border-width: 0 1px 1px 1px;
+}
+
+#views-ui-rearrange-filter-form tr[id^="views-row"] {
+  border-right: 1px solid #CDCDCD;
+}
+
+#views-ui-rearrange-filter-form tr[id^="views-row"].even td {
+  background-color: #F3F4ED;
+}
+
+#views-ui-rearrange-filter-form .views-group-title {
+  border-top: 1px solid #CDCDCD;
+}
+
+#views-ui-rearrange-filter-form .group-empty {
+  border-bottom: 1px solid #CDCDCD;
+}
+
+/* @end */
+
+/* @group Expose filter form items */
+
+.form-item-options-expose-required,
+.form-item-options-expose-label,
+.form-item-options-expose-description {
+  margin-bottom: 6px;
+  margin-left: 18px;
+  margin-top: 6px;
+}
+
+/* @end */
+
+/* @group Live preview elements */
+
+#views-preview-wrapper {
+  border: 1px solid #CCC;
+  border-top: 2px solid #CCC;
+  padding-bottom: 12px;
+  padding-top: 12px;
+}
+
+#views-ui-preview-form {
+  margin: 12px;
+}
+
+#views-live-preview {
+  margin: 0 12px;
+}
+
+#views-live-preview .views-query-info {
+  overflow: auto;
+}
+
+/* Intentionally targeting h1 */
+#views-live-preview h1.section-title {
+  color: #818181;
+  display: inline-block;
+  font-size: 13px;
+  font-weight: normal;
+  line-height: 1.6154;
+  margin-bottom: 0;
+  margin-top: 0;
+}
+
+#views-live-preview .view > * {
+  margin-top: 18px;
+}
+
+#views-live-preview .preview-section {
+  border: 1px dashed #DEDEDE;
+  margin: 0 -5px;
+  padding: 3px 5px;
+}
+
+#views-live-preview li.views-row + li.views-row {
+  margin-top: 18px;
+}
+
+/* The div.views-row is intentional and excludes li.views-row, for example */
+#views-live-preview div.views-row + div.views-row {
+  margin-top: 36px;
+}
+
+/* @group Query info table */
+
+.views-query-info table {
+  border-collapse: separate;
+  border-color: #dddddd;
+  border-spacing: 0;
+  margin: 10px 0;
+}
+
+.views-query-info table tr {
+  background-color: #f9f9f9;
+}
+
+.views-query-info table th,
+.views-query-info table td {
+  color: #666666;
+  padding: 4px 10px;
+}
+
+/* @end */
+
+/* @group Grid */
+
+#views-live-preview .views-view-grid th,
+#views-live-preview .views-view-grid td {
+  vertical-align: top;
+}
+
+/* @end */
+
+/* @group HTML list */
+
+#views-live-preview .view-content > .item-list > ul {
+  list-style-position: outside;
+  padding-left: 21px; /* LTR */
+}
+
+/* @end */
+
+/* @end */
+
+/* @group Add/edit argument form */
+
+#edit-options-default-action {
+  width: 300px;
+  float: left;
+}
+
+#edit-options-exception.collapsible {
+  float: right;
+  width: 250px;
+  margin-top: -2px;
+}
+
+/* @end */
+
+/* @group AJAX */
+
+/* Hide the drupal system throbber image */
+.ajax-progress .throbber {
+  display: none;
+}
+
+.ajax-progress-throbber {
+  background-color: #232323;
+  background-image: url("../images/loading-small.gif");
+  background-position: center center;
+  background-repeat: no-repeat;
+  -moz-border-radius: 7px;
+  -webkit-border-radius: 7px;
+  border-radius: 7px;
+  height: 24px;
+  opacity: .9;
+  padding: 4px;
+  width: 24px;
+}
+
+/* @end */
+
+/* @group Drupal
+ *
+ * Overrides to Drupal system CSS
+ */
+div.messages {
+  margin-bottom: 18px;
+}
+
+/* @end */

+ 5 - 0
sites/all/modules/contrib/views/views/css/views-rtl.css

@@ -0,0 +1,5 @@
+
+.views-exposed-form .views-exposed-widget {
+  float: right; /* RTL */
+  padding: .5em 1em 0 0; /* RTL */
+}

+ 42 - 0
sites/all/modules/contrib/views/views/css/views.css

@@ -0,0 +1,42 @@
+.views-exposed-form .views-exposed-widget {
+  float: left; /* LTR */
+  padding: .5em 1em 0 0; /* LTR */
+}
+
+.views-exposed-form .views-exposed-widget .form-submit {
+  margin-top: 1.6em;
+}
+
+.views-exposed-form .form-item,
+.views-exposed-form .form-submit {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+
+.views-exposed-form label {
+  font-weight: bold;
+}
+
+.views-exposed-widgets {
+  margin-bottom: .5em;
+}
+
+/* table style column align */
+.views-align-left {
+  text-align: left;
+}
+.views-align-right {
+  text-align: right;
+}
+.views-align-center {
+  text-align: center;
+}
+
+/* Remove the border on tbody that system puts in */
+.views-view-grid tbody {
+  border-top: none;
+}
+
+.view .progress-disabled {
+  float: none;
+}

+ 5 - 0
sites/all/modules/contrib/views/views/documentation-standards.txt

@@ -0,0 +1,5 @@
+- If the interface text is *bolded*, it got strong tags.
+- If it's a button they need to click, that's *bold* too.
+- If the text is not bolded (ex: links to click, options to check), it
+got /italicized/.
+- If it's user-entered text it got 'single quotes'.

+ 496 - 0
sites/all/modules/contrib/views/views/drush/views.drush.inc

@@ -0,0 +1,496 @@
+<?php
+
+/**
+ * @file
+ * Drush integration of views.
+ *
+ * drush cache-clear views - Clears the views specific caches.
+ * views-revert - Drush command to revert views overridden in the system.
+ */
+
+/**
+ * Implement hook_drush_help().
+ */
+function views_drush_help($section) {
+  switch ($section) {
+    case 'drush:views-revert':
+      $help = dt('Reverts views in the drupal installation that have been overriden. ');
+      $help .= dt('If no view names are specified, you will be presented with a list of overridden views to choose from. ');
+      $help .= dt('To revert all views, do not specify any view names, and choose the option "All" from the options presented.');
+      return $help;
+    case 'drush:views-list':
+      return dt('Show a list of available views with information about them.');
+    case 'drush:views-enable':
+      return dt('Enable the specified views. Follow the command with a space delimited list of view names');
+    case 'drush:views-disable':
+      return dt('Disable the specified views. Follow the command with a space delimited list of view names');
+  }
+}
+
+/**
+ * Implement hook_drush_command().
+ */
+function views_drush_command() {
+  $items = array();
+
+  $items['views-revert'] = array(
+    'callback' => 'views_revert_views',
+    'drupal dependencies' => array('views'),
+    'description' => 'Revert overridden views to their default state. Make sure to backup first.',
+    'arguments' => array(
+      'views' => 'A space delimited list of view names.',
+    ),
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
+    'aliases' => array('vr'),
+    'examples' => array(
+      'drush vr archive' => 'Reverts the "archive" view.',
+      'drush rln archive frontpage' => 'Reverts the "archive" and "frontpage" view.',
+      'drush vr' => 'Will present you with a list of overridden views to choose from, and an option to revert all overridden views.',
+    ),
+  );
+  $items['views-dev'] = array(
+    'callback' => 'views_development_settings',
+    'drupal dependencies' => array('views'),
+    'description' => 'Set the Views settings to more developer-oriented values.',
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
+    'aliases' => array('vd'),
+  );
+
+  $items['views-list'] = array(
+    'drupal dependencies' => array('views'),
+    'description' => 'Get a list of all views in the system.',
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
+    'aliases' => array('vl'),
+    'options' => array(
+      'name' => 'String contained in view\'s name by which filter the results.',
+      'tags' => 'A comma-separated list of views tags by which to filter the results.',
+      'status' => 'Status of the views by which to filter the results. Choices: enabled, disabled.',
+      'type' => 'Type of the views by which to filter the results. Choices: normal, default or overridden.',
+      ),
+    'examples' => array(
+      'drush vl' => 'Show a list of all available views.',
+      'drush vl --name=blog' => 'Show a list of views which names contain "blog".',
+      'drush vl --tags=tag1,tag2' => 'Show a list of views tagged with "tag1" or "tag2".',
+      'drush vl --status=enabled' => 'Show a list of enabled views.',
+      'drush vl --type=overridden' => 'Show a list of overridden views.',
+    ),
+  );
+  $items['views-analyze'] = array(
+    'drupal dependencies' => array('views', 'views_ui'),
+    'description' => 'Get a list of all Views analyze warnings',
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
+    'aliases' => array('va'),
+  );
+  $items['views-enable'] = array(
+    'drupal dependencies' => array('views'),
+    'description' => 'Enable the specified views.',
+    'arguments' => array(
+      'views' => 'A space delimited list of view names.',
+    ),
+    'aliases' => array('ven'),
+    'examples' => array(
+      'drush ven frontpage taxonomy_term' => 'Enable the frontpage and taxonomy_term views.',
+    ),
+  );
+  $items['views-disable'] = array(
+    'drupal dependencies' => array('views'),
+    'description' => 'Disable the specified views.',
+    'arguments' => array(
+      'views' => 'A space delimited list of view names.',
+    ),
+    'aliases' => array('vdis'),
+    'examples' => array(
+      'drush vdis frontpage taxonomy_term' => 'Disable the frontpage and taxonomy_term views.',
+    ),
+  );
+
+  return $items;
+}
+
+/**
+ * Callback function for views-revert command.
+ */
+function views_revert_views() {
+  $views = views_get_all_views();
+  $i = 0;
+  // The provided views names specified in the command.
+  $viewnames = _convert_csv_to_array(func_get_args());
+
+  // Find all overridden views.
+  foreach ($views as $view) {
+    if ($view->disabled) {
+      continue;
+    }
+    if ($view->type == dt('Overridden')) {
+      $overridden[$view->name] = $view->name;
+    }
+  }
+
+  // Return early if there are no overridden views in the system.
+  if (empty($overridden)) {
+    return drush_set_error(dt('There are no overridden views in the system.'));
+  }
+
+  // If the user specified in the command the views to be overridden.
+  if (!empty($viewnames)) {
+    foreach ($viewnames as $key => $viewname) {
+      $is_overridden = key_exists($viewname, $overridden);
+      // Check if the provided view name is in the system
+      if ($viewname && !key_exists($viewname, $views)) {
+        drush_set_error(dt("'@viewname' view is not present in the system.", array('@viewname' => $viewname)));
+      }
+      // Check if the provided view is overridden.
+      elseif (!$is_overridden) {
+        drush_set_error(dt("The view specified '@viewname' is not overridden.", array('@viewname' => $viewname)));
+      }
+      // If the view is overriden, revert it.
+      elseif ($is_overridden){
+        views_revert_view($views[$viewname]);
+        $i++;
+      }
+      // We should never get here but well...
+      else {
+        drush_set_error(dt("The view specified '@viewname' is not provided in code, and thus cannot be reverted.", array('@viewname' => $viewname)));
+      }
+    }
+  }
+
+  // The user did not specify any views in the command, prompt the user
+  else {
+    // list of choices for the user
+    $overridden['all'] = dt('Revert all overridden views'); // add a choice at the end
+    $choice = drush_choice($overridden, 'Enter a number to choose which view to revert.', '!key'); // prompt the user
+
+    if ($choice !== FALSE) {
+      // revert all views option
+      if ($choice == 'all') {
+        $i = views_revert_allviews($views);
+      }
+      // else the user specified a single view
+      else {
+        views_revert_view($views[$choice]);
+        $i++;
+      }
+    }
+
+  }
+
+  // final results output
+  if ($i == 0) {
+    drush_log(dt('No views were reverted.'), 'ok');
+  }
+  else {
+    drush_log(dt('Reverted a total of @count views.', array('@count' => $i)), 'ok');
+  }
+}
+
+/**
+ * Reverts all views
+ * @param $views
+ * All views in the system as provided by views_get_all_views().
+ */
+function views_revert_allviews($views) {
+  $i = 0;
+  foreach ($views as $view) {
+    if ($view->disabled) {
+      continue;
+    }
+
+    if ($view->type == t('Overridden')) {
+      views_revert_view($view);
+      $i++;
+    }
+  }
+  return $i;
+}
+
+/**
+ * Revert a specified view
+ * @param $view
+ * The view object to be reverted
+ *
+ * Checks on wether or not the view is overridden is handled in views_revert_views_revert()
+ * We perform a check here anyway in case someone somehow calls this function on their own...
+ */
+function views_revert_view($view) {
+  // check anyway just in case
+  if ($view->type == t('Overridden')) {
+    // Revert the view.
+    $view->delete();
+    // Clear its cache.
+    ctools_include('object-cache');
+    ctools_object_cache_clear('view', $view->name);
+    // Give feedback.
+    $message = dt("Reverted the view '@viewname'", array('@viewname' => $view->name));
+    drush_log($message, 'success');
+    // Reverted one more view.
+  }
+  else {
+    drush_set_error(dt("The view '@viewname' is not overridden.", array('@viewname' => $view->name)));
+  }
+}
+
+/**
+ * Change the settings to a more developer oriented value.
+ */
+function views_development_settings() {
+  variable_set('views_ui_show_listing_filters', TRUE);
+  variable_set('views_ui_show_master_display', TRUE);
+  variable_set('views_ui_show_advanced_column', TRUE);
+  variable_set('views_ui_always_live_preview', FALSE);
+  variable_set('views_ui_always_live_preview_button', TRUE);
+  variable_set('views_ui_show_preview_information', TRUE);
+  variable_set('views_ui_show_sql_query', TRUE);
+  variable_set('views_ui_show_performance_statistics', TRUE);
+  variable_set('views_show_additional_queries', TRUE);
+  variable_set('views_devel_output', TRUE);
+  variable_set('views_devel_region', 'message');
+  variable_set('views_ui_display_embed', TRUE);
+  $message = dt("Setup the new views settings.");
+  drush_log($message, 'success');
+}
+
+
+/**
+ * Callback function for views-list command.
+ */
+function drush_views_list() {
+  // Initialize stuf
+  $rows = array();
+  $disabled_views = array();
+  $enabled_views = array();
+  $overridden = 0;
+  $indb = 0;
+  $incode = 0;
+  $disabled = 0;
+  $total = 0;
+
+  $views = views_get_all_views();
+
+  // get the --name option
+  // TODO : take into account the case off a comma-separated list of names
+  $name = drush_get_option_list('name');
+  $with_name = !empty($name) ? TRUE : FALSE;
+
+  // get the --tags option
+  $tags = drush_get_option_list('tags');
+  $with_tags = !empty($tags) ? TRUE : FALSE;
+
+  // get the --status option
+  // store user input appart to reuse it after
+  $status_opt = drush_get_option_list('status');
+  // use the same logic than $view->disabled
+  if (in_array('disabled', $status_opt)) {
+    $status = TRUE;
+    $with_status = TRUE;
+  }
+  elseif (in_array('enabled', $status_opt)) {
+    $status = FALSE;
+    $with_status = TRUE;
+  }
+  else {
+    $status = NULL;
+    // wrong or empty --status option
+    $with_status = FALSE;
+  }
+
+  // get the --type option
+  $type = drush_get_option_list('type');
+  // use the same logic than $view->type
+  $with_type = FALSE;
+  if (in_array('normal', $type) || in_array('default', $type)|| in_array('overridden', $type)) {
+    $with_type = TRUE;
+  }
+
+  // set the table headers
+  $header = array(
+    dt('Machine name'),
+    dt('Description'),
+    dt('Type'),
+    dt('Status'),
+    dt('Tag'),
+  );
+
+  // setup a row for each view
+  foreach($views as $id => $view){
+    // if options were specified, check that first
+    // mismatch push the loop to the next view
+    if ($with_tags && !in_array($view->tag, $tags)) {
+      continue;
+    }
+    if ($with_status && !$view->disabled == $status) {
+      continue;
+    }
+    if ($with_type && strtolower($view->type) !== $type[0]) {
+      continue;
+    }
+    if ($with_name && !stristr($view->name, $name[0])) {
+      continue;
+    }
+
+    $row = array();
+    // each row entry should be in the same order as the header
+    $row[] = $view->name;
+    $row[] = $view->description;
+    $row[] = $view->type;
+    $row[] = $view->disabled ? dt('Disabled') : dt('Enabled');
+    $row[] = $view->tag;
+
+    // place the row in the appropiate array,
+    // so we can have disabled views at the bottom
+    if($view->disabled) {
+      $disabled_views[] = $row;
+      }
+    else{
+      $enabled_views[] = $row;
+    }
+    unset($row);
+
+    // gather some statistics
+    switch($view->type) {
+      case dt('Normal'):
+        $indb++;
+        break;
+
+      case dt('Overridden'):
+        $overridden++;
+        break;
+
+      case dt('Default'):
+        $incode++;
+        break;
+    }
+    $total++;
+  }
+
+  $disabled = count($disabled_views);
+
+  // sort alphabeticaly
+  asort($disabled_views);
+  asort($enabled_views);
+
+  // if options were used
+  $summary = "";
+  if ($with_name || $with_tags || $with_status || $with_type) {
+    $summary = "Views";
+
+    if ($with_name) {
+      $summary .= " named $name[0]";
+    }
+
+    if ($with_tags) {
+      $tags = implode(" or ", $tags);
+      $summary .= " tagged $tags";
+    }
+
+    if ($with_status) {
+      $status_opt = implode("", $status_opt);
+      $summary .= " which status is '$status_opt'";
+    }
+
+    if ($with_type) {
+      $type = ucfirst($type[0]);
+      $summary .= " of type '$type'";
+    }
+  }
+
+  if (!empty($summary)) {
+    drush_print($summary . "\n");
+  }
+
+  // print all rows as a table
+  if ($total > 0) {
+    $rows = array_merge($enabled_views, $disabled_views);
+    // put the headers as first row
+    array_unshift($rows, $header);
+
+    drush_print_table($rows, TRUE);
+  }
+
+  // print the statistics messages
+  drush_print(dt("A total of @total views were found in this Drupal installation:", array('@total' => $total)));
+  drush_print(dt("  @indb views reside only in the database", array('@indb' => $indb )));
+  drush_print(dt("  @over views are overridden", array('@over' => $overridden)));
+  drush_print(dt("  @incode views are in their default state", array('@incode' => $incode)));
+  drush_print(dt("  @dis views are disabled\n", array('@dis' => $disabled)));
+}
+
+function drush_views_analyze() {
+  views_include('analyze');
+  $messages_count = 0;
+  $total = 0;
+
+  foreach (views_get_all_views() as $view_name => $view) {
+    $total++;
+    if ($messages = views_analyze_view($view)) {
+      drush_print($view_name);
+      foreach ($messages as $message) {
+        $messages_count++;
+        drush_print($message['type'] .': '. $message['message'], 2);
+      }
+    }
+  }
+  drush_log(dt('A total of @total views were analyzed and @messages problems were found.', array('@total' => $total, '@messages' => $messages_count)), 'ok');
+}
+
+/**
+ * Enables views
+ */
+function drush_views_enable() {
+  $viewnames = _convert_csv_to_array(func_get_args());
+  // Return early if no view names were specified.
+  if (empty($viewnames)) {
+    return drush_set_error(dt('Please specify a space delimited list of view names to enable'));
+  }
+  _views_drush_changestatus($viewnames, FALSE);
+}
+
+/**
+ * Disables views
+ */
+function drush_views_disable() {
+  $viewnames = _convert_csv_to_array(func_get_args());
+  // Return early if no view names were specified.
+  if (empty($viewnames)) {
+    return drush_set_error(dt('Please specify a space delimited list of view names to disable'));
+  }
+  _views_drush_changestatus($viewnames, TRUE);
+}
+
+/**
+ * Helper function to enable / disable views
+ * @param $viewnames: array of viewnames to process
+ * @param $status: TRUE to disable or FALSE to enable the view
+ */
+function _views_drush_changestatus($viewnames = array(), $status = NULL) {
+  if ($status !== NULL && !empty($viewnames)) {
+    $changed = FALSE;
+    $processed = $status ? dt('disabled') : dt('enabled');
+    $views_status = variable_get('views_defaults', array());
+
+    foreach ($viewnames as $key => $viewname) {
+      if ($views_status[$viewname] !== $status) {
+        $views_status[$viewname] = $status;
+        $changed = TRUE;
+        drush_log(dt("The view '!name' has been !processed", array('!name' => $viewname, '!processed' => $processed)), 'success');
+      }
+      else {
+        drush_set_error(dt("The view '!name' is already !processed", array('!name' => $viewname, '!processed' => $processed)));
+      }
+    }
+    // If we made changes to views status, save them and clear caches
+    if ($changed) {
+      variable_set('views_defaults', $views_status);
+      views_invalidate_cache();
+      drush_log(dt("Views cache was cleared"), 'ok');
+      drush_log(dt("Menu cache is set to be rebuilt on the next request."), 'ok');
+    }
+  }
+}
+
+/**
+ * Adds a cache clear option for views.
+ */
+function views_drush_cache_clear(&$types) {
+  $types['views'] = 'views_invalidate_cache';
+}

+ 133 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_area.inc

@@ -0,0 +1,133 @@
+<?php
+
+/**
+ * @file
+ * Views area handlers.
+ */
+
+/**
+ * @defgroup views_area_handlers Views area handlers
+ * @{
+ * Handlers to tell Views what can display in header, footer
+ * and empty text in a view.
+ */
+
+/**
+ * Base class for area handlers.
+ *
+ * @ingroup views_area_handlers
+ */
+class views_handler_area extends views_handler {
+
+  /**
+   * Overrides views_handler::init().
+   *
+   * Make sure that no result area handlers are set to be shown when the result
+   * is empty.
+   */
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+    if ($this->handler_type == 'empty') {
+      $this->options['empty'] = TRUE;
+    }
+  }
+
+  /**
+   * Get this field's label.
+   */
+  function label() {
+    if (!isset($this->options['label'])) {
+      return $this->ui_name();
+    }
+    return $this->options['label'];
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $this->definition['field'] = !empty($this->definition['field']) ? $this->definition['field'] : '';
+    $label = !empty($this->definition['label']) ? $this->definition['label'] : $this->definition['field'];
+    $options['label'] = array('default' => $label, 'translatable' => TRUE);
+    $options['empty'] = array('default' => FALSE, 'bool' => TRUE);
+
+    return $options;
+  }
+
+  /**
+   * Provide extra data to the administration form
+   */
+  function admin_summary() {
+    return $this->label();
+  }
+
+  /**
+   * Default options form that provides the label widget that all fields
+   * should have.
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    $form['label'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Label'),
+      '#default_value' => isset($this->options['label']) ? $this->options['label'] : '',
+      '#description' => t('The label for this area that will be displayed only administratively.'),
+    );
+
+    if ($form_state['type'] != 'empty') {
+      $form['empty'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Display even if view has no result'),
+        '#default_value' => isset($this->options['empty']) ? $this->options['empty'] : 0,
+      );
+    }
+  }
+
+  /**
+   * Don't run a query
+   */
+  function query() { }
+
+  /**
+   * Render the area
+   */
+  function render($empty = FALSE) {
+    return '';
+  }
+
+  /**
+   * Area handlers shouldn't have groupby.
+   */
+  function use_group_by() {
+    return FALSE;
+  }
+}
+
+/**
+ * A special handler to take the place of missing or broken handlers.
+ *
+ * @ingroup views_area_handlers
+ */
+class views_handler_area_broken extends views_handler_area {
+  function ui_name($short = FALSE) {
+    return t('Broken/missing handler');
+  }
+
+  function ensure_my_table() { /* No table to ensure! */ }
+  function query($group_by = FALSE) { /* No query to run */ }
+  function render($empty = FALSE) { return ''; }
+  function options_form(&$form, &$form_state) {
+    $form['markup'] = array(
+      '#prefix' => '<div class="form-item description">',
+      '#value' => t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.'),
+    );
+  }
+
+  /**
+   * Determine if the handler is considered 'broken'
+   */
+  function broken() { return TRUE; }
+}
+
+/**
+ * @}
+ */

+ 96 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_area_result.inc

@@ -0,0 +1,96 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_area_result.
+ */
+
+/**
+ * Views area handler to display some configurable result summary.
+ *
+ * @ingroup views_area_handlers
+ */
+class views_handler_area_result extends views_handler_area {
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['content'] = array(
+      'default' => 'Displaying @start - @end of @total',
+      'translatable' => TRUE,
+    );
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    $variables = array(
+      'items' => array(
+        '@start -- the initial record number in the set',
+        '@end -- the last record number in the set',
+        '@total -- the total records in the set',
+        '@name -- the human-readable name of the view',
+        '@per_page -- the number of items per page',
+        '@current_page -- the current page number',
+        '@current_record_count -- the current page record count',
+        '@page_count -- the total page count',
+      ),
+    );
+    $list = theme('item_list', $variables);
+    $form['content'] = array(
+      '#title' => t('Display'),
+      '#type' => 'textarea',
+      '#rows' => 3,
+      '#default_value' => $this->options['content'],
+      '#description' => t('You may use HTML code in this field. The following tokens are supported:') . $list,
+    );
+  }
+
+
+  /**
+   * Find out the information to render.
+   */
+  function render($empty = FALSE) {
+    // Must have options and does not work on summaries.
+    if (!isset($this->options['content']) || $this->view->plugin_name == 'default_summary') {
+      return;
+    }
+    $output = '';
+    $format = $this->options['content'];
+    // Calculate the page totals.
+    $current_page = (int) $this->view->get_current_page() + 1;
+    $per_page = (int) $this->view->get_items_per_page();
+    $count = count($this->view->result);
+    // @TODO: Maybe use a possible is views empty functionality.
+    // Not every view has total_rows set, use view->result instead.
+    $total = isset($this->view->total_rows) ? $this->view->total_rows : count($this->view->result);
+    $name = check_plain($this->view->human_name);
+    if ($per_page === 0) {
+      $page_count = 1;
+      $start = 1;
+      $end = $total;
+    }
+    else {
+      $page_count = (int) ceil($total / $per_page);
+      $total_count = $current_page * $per_page;
+      if ($total_count > $total) {
+        $total_count = $total;
+      }
+      $start = ($current_page - 1) * $per_page + 1;
+      $end = $total_count;
+    }
+    $current_record_count = ($end - $start) + 1;
+    // Get the search information.
+    $items = array('start', 'end', 'total', 'name', 'per_page', 'current_page', 'current_record_count', 'page_count');
+    $replacements = array();
+    foreach ($items as $item) {
+      $replacements["@$item"] = ${$item};
+    }
+    // Send the output.
+    if (!empty($total)) {
+      $output .= filter_xss_admin(str_replace(array_keys($replacements), array_values($replacements), $format));
+    }
+    return $output;
+  }
+}

+ 110 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_area_text.inc

@@ -0,0 +1,110 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_area_text.
+ */
+
+/**
+ * Views area text handler.
+ *
+ * @ingroup views_area_handlers
+ */
+class views_handler_area_text extends views_handler_area {
+
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['content'] = array('default' => '', 'translatable' => TRUE, 'format_key' => 'format');
+    $options['format'] = array('default' => NULL);
+    $options['tokenize'] = array('default' => FALSE, 'bool' => TRUE);
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['content'] = array(
+      '#type' => 'text_format',
+      '#default_value' => $this->options['content'],
+      '#rows' => 6,
+      '#format' => isset($this->options['format']) ? $this->options['format'] : filter_default_format(),
+      '#wysiwyg' => FALSE,
+    );
+
+    // @TODO: Refactor token handling into a base class.
+    $form['tokenize'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Use replacement tokens from the first row'),
+      '#default_value' => $this->options['tokenize'],
+    );
+
+    // Get a list of the available fields and arguments for token replacement.
+    $options = array();
+    foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
+      $options[t('Fields')]["[$field]"] = $handler->ui_name();
+    }
+
+    $count = 0; // This lets us prepare the key as we want it printed.
+    foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
+      $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->ui_name()));
+      $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->ui_name()));
+    }
+
+    if (!empty($options)) {
+      $output = '<p>' . t('The following tokens are available. If you would like to have the characters \'[\' and \']\' please use the html entity codes \'%5B\' or  \'%5D\' or they will get replaced with empty space.' . '</p>');
+      foreach (array_keys($options) as $type) {
+        if (!empty($options[$type])) {
+          $items = array();
+          foreach ($options[$type] as $key => $value) {
+            $items[] = $key . ' == ' . check_plain($value);
+          }
+          $output .= theme('item_list',
+            array(
+              'items' => $items,
+              'type' => $type
+            ));
+        }
+      }
+
+      $form['token_help'] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Replacement patterns'),
+        '#collapsible' => TRUE,
+        '#collapsed' => TRUE,
+        '#value' => $output,
+        '#id' => 'edit-options-token-help',
+        '#dependency' => array(
+          'edit-options-tokenize' => array(1),
+        ),
+        '#prefix' => '<div>',
+        '#suffix' => '</div>',
+      );
+    }
+  }
+
+  function options_submit(&$form, &$form_state) {
+    $form_state['values']['options']['format'] = $form_state['values']['options']['content']['format'];
+    $form_state['values']['options']['content'] = $form_state['values']['options']['content']['value'];
+    parent::options_submit($form, $form_state);
+  }
+
+  function render($empty = FALSE) {
+    $format = isset($this->options['format']) ? $this->options['format'] : filter_default_format();
+    if (!$empty || !empty($this->options['empty'])) {
+      return $this->render_textarea($this->options['content'], $format);
+    }
+    return '';
+  }
+
+  /**
+   * Render a text area, using the proper format.
+   */
+  function render_textarea($value, $format) {
+    if ($value) {
+      if ($this->options['tokenize']) {
+        $value = $this->view->style_plugin->tokenize_value($value, 0);
+      }
+      return check_markup($value, $format, '', FALSE);
+    }
+  }
+}

+ 56 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_area_text_custom.inc

@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_area_text_custom.
+ */
+
+/**
+ * Views area text custom handler.
+ *
+ * @ingroup views_area_handlers
+ */
+class views_handler_area_text_custom extends views_handler_area_text {
+
+  function option_definition() {
+    $options = parent::option_definition();
+    unset($options['format']);
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    // Alter the form element, to be a regular text area.
+    $form['content']['#type'] = 'textarea';
+    unset($form['content']['#format']);
+    unset($form['content']['#wysiwyg']);
+
+    // @TODO: Use the token refactored base class.
+  }
+
+  // Empty, so we don't inherit options_submit from the parent.
+  function options_submit(&$form, &$form_state) {
+  }
+
+  function render($empty = FALSE) {
+    if (!$empty || !empty($this->options['empty'])) {
+      return $this->render_textarea_custom($this->options['content']);
+    }
+
+    return '';
+  }
+
+  /**
+   * Render a text area with filter_xss_admin.
+   */
+  function render_textarea_custom($value) {
+    if ($value) {
+      if ($this->options['tokenize']) {
+        $value = $this->view->style_plugin->tokenize_value($value, 0);
+      }
+      return $this->sanitize_value($value, 'xss_admin');
+    }
+  }
+
+}

+ 83 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_area_view.inc

@@ -0,0 +1,83 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_area_view.
+ */
+
+/**
+ * Views area handlers. Insert a view inside of an area.
+ *
+ * @ingroup views_area_handlers
+ */
+class views_handler_area_view extends views_handler_area {
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['view_to_insert'] = array('default' => '');
+    $options['inherit_arguments'] = array('default' => FALSE, 'bool' => TRUE);
+    return $options;
+  }
+
+  /**
+   * Default options form that provides the label widget that all fields
+   * should have.
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $view_display = $this->view->name . ':' . $this->view->current_display;
+
+    $options = array('' => t('-Select-'));
+    $options += views_get_views_as_options(FALSE, 'all', $view_display, FALSE, TRUE);
+    $form['view_to_insert'] = array(
+      '#type' => 'select',
+      '#title' => t('View to insert'),
+      '#default_value' => $this->options['view_to_insert'],
+      '#description' => t('The view to insert into this area.'),
+      '#options' => $options,
+    );
+
+    $form['inherit_arguments'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Inherit contextual filters'),
+      '#default_value' => $this->options['inherit_arguments'],
+      '#description' => t('If checked, this view will receive the same contextual filters as its parent.'),
+    );
+  }
+
+  /**
+   * Render the area
+   */
+  function render($empty = FALSE) {
+    if (!empty($this->options['view_to_insert'])) {
+      list($view_name, $display_id) = explode(':', $this->options['view_to_insert']);
+
+      $view = views_get_view($view_name);
+      if (empty($view) || !$view->access($display_id)) {
+        return;
+      }
+      $view->set_display($display_id);
+
+      // Avoid recursion
+      $view->parent_views += $this->view->parent_views;
+      $view->parent_views[] = "$view_name:$display_id";
+
+      // Check if the view is part of the parent views of this view
+      $search = "$view_name:$display_id";
+      if (in_array($search, $this->view->parent_views)) {
+        drupal_set_message(t("Recursion detected in view @view display @display.", array('@view' => $view_name, '@display' => $display_id)), 'error');
+      }
+      else {
+        if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) {
+          return $view->preview($display_id, $this->view->args);
+        }
+        else {
+          return $view->preview($display_id);
+        }
+      }
+    }
+    return '';
+  }
+}

+ 1240 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_argument.inc

@@ -0,0 +1,1240 @@
+<?php
+
+/**
+ * @file
+ * @todo.
+ */
+
+/**
+ * @defgroup views_argument_handlers Views argument handlers
+ * Handlers to tell Views how to contextually filter queries.
+ * @{
+ */
+
+/**
+ * Base class for arguments.
+ *
+ * The basic argument works for very simple arguments such as nid and uid
+ *
+ * Definition terms for this handler:
+ * - name field: The field to use for the name to use in the summary, which is
+ *               the displayed output. For example, for the node: nid argument,
+ *               the argument itself is the nid, but node.title is displayed.
+ * - name table: The table to use for the name, should it not be in the same
+ *               table as the argument.
+ * - empty field name: For arguments that can have no value, such as taxonomy
+ *                     which can have "no term", this is the string which
+ *                     will be displayed for this lack of value. Be sure to use
+ *                     t().
+ * - validate type: A little used string to allow an argument to restrict
+ *                  which validator is available to just one. Use the
+ *                  validator ID. This probably should not be used at all,
+ *                  and may disappear or change.
+ * - numeric: If set to TRUE this field is numeric and will use %d instead of
+ *            %s in queries.
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument extends views_handler {
+  var $validator = NULL;
+  var $argument = NULL;
+  var $value = NULL;
+
+  /**
+   * The table to use for the name, should it not be in the same table as the argument.
+   * @var string
+   */
+  var $name_table;
+
+  /**
+   * The field to use for the name to use in the summary, which is
+   * the displayed output. For example, for the node: nid argument,
+   * the argument itself is the nid, but node.title is displayed.
+   * @var string
+   */
+  var $name_field;
+
+  /**
+   * Constructor
+   */
+  function construct() {
+    parent::construct();
+
+    if (!empty($this->definition['name field'])) {
+      $this->name_field = $this->definition['name field'];
+    }
+    if (!empty($this->definition['name table'])) {
+      $this->name_table = $this->definition['name table'];
+    }
+  }
+
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+
+    // Compatibility: The new UI changed several settings.
+    if (!empty($options['wildcard']) && !isset($options['exception']['value'])) {
+      $this->options['exception']['value'] = $options['wildcard'];
+    }
+    if (!empty($options['wildcard_substitution']) && !isset($options['exception']['title'])) {
+      // Enable the checkbox if the title is filled in.
+      $this->options['exception']['title_enable'] = 1;
+      $this->options['exception']['title'] = $options['wildcard_substitution'];
+    }
+
+    if (!isset($options['summary']['format']) && !empty($options['style_plugin'])) {
+      $this->options['summary']['format'] = $options['style_plugin'];
+    }
+
+    // Setup default value.
+    $options['style_options'] = isset($options['style_options']) ? $options['style_options'] : array();
+
+    if (!isset($options['summary']['sort_order']) && !empty($options['default_action']) && $options['default_action'] == 'summary asc') {
+      $this->options['default_action'] = 'summary';
+      $this->options['summary']['sort_order'] = 'asc';
+      $this->options['summary']['number_of_records'] = 0;
+      $this->options['summary_options'] = $options['style_options'];
+    }
+    elseif (!isset($options['summary']['sort_order']) && !empty($options['default_action']) && $options['default_action'] == 'summary desc') {
+      $this->options['default_action'] = 'summary';
+      $this->options['summary']['sort_order'] = 'desc';
+      $this->options['summary']['number_of_records'] = 0;
+      $this->options['summary_options'] = $options['style_options'];
+    }
+    elseif (!isset($options['summary']['sort_order']) && !empty($options['default_action']) && $options['default_action'] == 'summary asc by count') {
+      $this->options['default_action'] = 'summary';
+      $this->options['summary']['sort_order'] = 'asc';
+      $this->options['summary']['number_of_records'] = 1;
+      $this->options['summary_options'] = $options['style_options'];
+    }
+    elseif (!isset($options['summary']['sort_order']) && !empty($options['default_action']) && $options['default_action'] == 'summary desc by count') {
+      $this->options['default_action'] = 'summary';
+      $this->options['summary']['sort_order'] = 'desc';
+      $this->options['summary']['number_of_records'] = 1;
+      $this->options['summary_options'] = $options['style_options'];
+    }
+
+    if (!empty($options['title']) && !isset($options['title_enable'])) {
+      $this->options['title_enable'] = 1;
+    }
+    if (!empty($options['breadcrumb']) && !isset($options['breadcrumb_enable'])) {
+      $this->options['breadcrumb_enable'] = 1;
+    }
+
+    if (!empty($options['validate_type']) && !isset($options['validate']['type'])) {
+      $this->options['validate']['type'] = $options['validate_type'];
+      $this->options['specify_validation'] = 1;
+    }
+    if (!empty($options['validate_fail']) && !isset($options['validate']['fail'])) {
+      $this->options['validate']['fail'] = $options['validate_fail'];
+      $this->options['specify_validation'] = 1;
+    }
+  }
+
+  /**
+   * Give an argument the opportunity to modify the breadcrumb, if it wants.
+   * This only gets called on displays where a breadcrumb is actually used.
+   *
+   * The breadcrumb will be in the form of an array, with the keys being
+   * the path and the value being the already sanitized title of the path.
+   */
+  function set_breadcrumb(&$breadcrumb) { }
+
+  /**
+   * Determine if the argument can generate a breadcrumb
+   *
+   * @return TRUE/FALSE
+   */
+  function uses_breadcrumb() {
+    $info = $this->default_actions($this->options['default_action']);
+    return !empty($info['breadcrumb']);
+  }
+
+  function is_exception($arg = NULL) {
+    if (!isset($arg)) {
+      $arg = isset($this->argument) ? $this->argument : NULL;
+    }
+    return !empty($this->options['exception']['value']) && $this->options['exception']['value'] === $arg;
+  }
+
+  function exception_title() {
+    // If title overriding is off for the exception, return the normal title.
+    if (empty($this->options['exception']['title_enable'])) {
+      return $this->get_title();
+    }
+    return $this->options['exception']['title'];
+  }
+
+  /**
+   * Determine if the argument needs a style plugin.
+   *
+   * @return TRUE/FALSE
+   */
+  function needs_style_plugin() {
+    $info = $this->default_actions($this->options['default_action']);
+    $validate_info = $this->default_actions($this->options['validate']['fail']);
+    return !empty($info['style plugin']) || !empty($validate_info['style plugin']);
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['default_action'] = array('default' => 'ignore');
+    $options['exception'] = array(
+      'contains' => array(
+        'value' => array('default' => 'all'),
+        'title_enable' => array('default' => FALSE, 'bool' => TRUE),
+        'title' => array('default' => 'All', 'translatable' => TRUE),
+      ),
+    );
+    $options['title_enable'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['title'] = array('default' => '', 'translatable' => TRUE);
+    $options['breadcrumb_enable'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['breadcrumb'] = array('default' => '', 'translatable' => TRUE);
+    $options['default_argument_type'] = array('default' => 'fixed', 'export' => 'export_plugin');
+    $options['default_argument_options'] = array('default' => array(), 'export' => FALSE);
+    $options['default_argument_skip_url'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['summary_options'] = array('default' => array(), 'export' => FALSE);
+    $options['summary'] = array(
+      'contains' => array(
+        'sort_order' => array('default' => 'asc'),
+        'number_of_records' => array('default' => 0),
+        'format' => array('default' => 'default_summary', 'export' => 'export_summary'),
+      ),
+    );
+    $options['specify_validation'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['validate'] = array(
+      'contains' => array(
+        'type' => array('default' => 'none', 'export' => 'export_validation'),
+        'fail' => array('default' => 'not found'),
+      ),
+    );
+    $options['validate_options'] = array('default' => array(), 'export' => FALSE);
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $argument_text = $this->view->display_handler->get_argument_text();
+
+    $form['#pre_render'][] = 'views_ui_pre_render_move_argument_options';
+
+    $form['description'] = array(
+      '#markup' => $argument_text['description'],
+      '#theme_wrappers' => array('container'),
+      '#attributes' => array('class' => array('description')),
+    );
+
+    $form['no_argument'] = array(
+      '#type' => 'fieldset',
+      '#title' => $argument_text['filter value not present'],
+    );
+    // Everything in the fieldset is floated, so the last element needs to
+    // clear those floats.
+    $form['no_argument']['clearfix'] = array(
+      '#weight' => 1000,
+      '#markup' => '<div class="clearfix"></div>',
+    );
+    $form['default_action'] = array(
+      '#type' => 'radios',
+      '#process' => array('views_ui_process_container_radios'),
+      '#default_value' => $this->options['default_action'],
+      '#fieldset' => 'no_argument',
+    );
+
+    $form['exception'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Exceptions'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+      '#fieldset' => 'no_argument',
+    );
+    $form['exception']['value'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Exception value'),
+      '#size' => 20,
+      '#default_value' => $this->options['exception']['value'],
+      '#description' => t('If this value is received, the filter will be ignored; i.e, "all values"'),
+    );
+    $form['exception']['title_enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Override title'),
+      '#default_value' => $this->options['exception']['title_enable'],
+    );
+    $form['exception']['title'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Override title'),
+      '#title_display' => 'invisible',
+      '#size' => 20,
+      '#default_value' => $this->options['exception']['title'],
+      '#description' => t('Override the view and other argument titles. Use "%1" for the first argument, "%2" for the second, etc.'),
+      '#dependency' => array(
+        'edit-options-exception-title-enable' => array('1'),
+      ),
+    );
+
+    $options = array();
+    $defaults = $this->default_actions();
+    $validate_options = array();
+    foreach ($defaults as $id => $info) {
+      $options[$id] = $info['title'];
+      if (empty($info['default only'])) {
+        $validate_options[$id] = $info['title'];
+      }
+      if (!empty($info['form method'])) {
+        $this->{$info['form method']}($form, $form_state);
+      }
+    }
+    $form['default_action']['#options'] = $options;
+
+    $form['argument_present'] = array(
+      '#type' => 'fieldset',
+      '#title' => $argument_text['filter value present'],
+    );
+    $form['title_enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Override title'),
+      '#default_value' => $this->options['title_enable'],
+      '#fieldset' => 'argument_present',
+    );
+    $form['title'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Provide title'),
+      '#title_display' => 'invisible',
+      '#default_value' => $this->options['title'],
+      '#description' => t('Override the view and other argument titles. Use "%1" for the first argument, "%2" for the second, etc.'),
+      '#dependency' => array(
+        'edit-options-title-enable' => array('1'),
+      ),
+      '#fieldset' => 'argument_present',
+    );
+
+    $form['breadcrumb_enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Override breadcrumb'),
+      '#default_value' => $this->options['breadcrumb_enable'],
+      '#fieldset' => 'argument_present',
+    );
+    $form['breadcrumb'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Provide breadcrumb'),
+      '#title_display' => 'invisible',
+      '#default_value' => $this->options['breadcrumb'],
+      '#description' => t('Enter a breadcrumb name you would like to use. See "Title" for percent substitutions.'),
+      '#dependency' => array(
+        'edit-options-breadcrumb-enable' => array('1'),
+      ),
+      '#fieldset' => 'argument_present',
+    );
+
+    $form['specify_validation'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Specify validation criteria'),
+      '#default_value' => $this->options['specify_validation'],
+      '#fieldset' => 'argument_present',
+    );
+
+    $form['validate'] = array(
+      '#type' => 'container',
+      '#fieldset' => 'argument_present',
+    );
+    // @todo The mockup wanted to use "Validate using" here, but it doesn't
+    // work well with many options (they'd need to be changed as well)
+    $form['validate']['type'] = array(
+      '#type' => 'select',
+      '#title' => t('Validator'),
+      '#default_value' => $this->options['validate']['type'],
+      '#dependency' => array(
+        'edit-options-specify-validation' => array('1'),
+      ),
+    );
+
+    $validate_types = array('none' => t('- Basic validation -'));
+    $plugins = views_fetch_plugin_data('argument validator');
+    foreach ($plugins as $id => $info) {
+      if (!empty($info['no ui'])) {
+        continue;
+      }
+
+      $valid = TRUE;
+      if (!empty($info['type'])) {
+        $valid = FALSE;
+        if (empty($this->definition['validate type'])) {
+          continue;
+        }
+        foreach ((array) $info['type'] as $type) {
+          if ($type == $this->definition['validate type']) {
+            $valid = TRUE;
+            break;
+          }
+        }
+      }
+
+      // If we decide this validator is ok, add it to the list.
+      if ($valid) {
+        $plugin = $this->get_plugin('argument validator', $id);
+        if ($plugin) {
+          if ($plugin->access() || $this->options['validate']['type'] == $id) {
+            $form['validate']['options'][$id] = array(
+              '#prefix' => '<div id="edit-options-validate-options-' . $id . '-wrapper">',
+              '#suffix' => '</div>',
+              '#type' => 'item',
+              // Even if the plugin has no options add the key to the form_state.
+              '#input' => TRUE, // trick it into checking input to make #process run
+              '#dependency' => array(
+                'edit-options-specify-validation' => array('1'),
+                'edit-options-validate-type' => array($id),
+              ),
+              '#dependency_count' => 2,
+              '#id' => 'edit-options-validate-options-' . $id,
+            );
+            $plugin->options_form($form['validate']['options'][$id], $form_state);
+            $validate_types[$id] = $info['title'];
+          }
+        }
+      }
+    }
+
+    asort($validate_types);
+    $form['validate']['type']['#options'] = $validate_types;
+
+    $form['validate']['fail'] = array(
+      '#type' => 'select',
+      '#title' => t('Action to take if filter value does not validate'),
+      '#default_value' => $this->options['validate']['fail'],
+      '#options' => $validate_options,
+      '#dependency' => array(
+        'edit-options-specify-validation' => array('1'),
+      ),
+      '#fieldset' => 'argument_present',
+    );
+  }
+
+  function options_validate(&$form, &$form_state) {
+    if (empty($form_state['values']['options'])) {
+      return;
+    }
+
+    // Let the plugins do validation.
+    $default_id = $form_state['values']['options']['default_argument_type'];
+    $plugin = $this->get_plugin('argument default', $default_id);
+    if ($plugin) {
+      $plugin->options_validate($form['argument_default'][$default_id], $form_state, $form_state['values']['options']['argument_default'][$default_id]);
+    }
+
+    // summary plugin
+    $summary_id = $form_state['values']['options']['summary']['format'];
+    $plugin = $this->get_plugin('style', $summary_id);
+    if ($plugin) {
+      $plugin->options_validate($form['summary']['options'][$summary_id], $form_state, $form_state['values']['options']['summary']['options'][$summary_id]);
+    }
+
+    $validate_id = $form_state['values']['options']['validate']['type'];
+    $plugin = $this->get_plugin('argument validator', $validate_id);
+    if ($plugin) {
+      $plugin->options_validate($form['validate']['options'][$default_id], $form_state, $form_state['values']['options']['validate']['options'][$validate_id]);
+    }
+
+  }
+
+  function options_submit(&$form, &$form_state) {
+    if (empty($form_state['values']['options'])) {
+      return;
+    }
+
+    // Let the plugins make submit modifications if necessary.
+    $default_id = $form_state['values']['options']['default_argument_type'];
+    $plugin = $this->get_plugin('argument default', $default_id);
+    if ($plugin) {
+      $options = &$form_state['values']['options']['argument_default'][$default_id];
+      $plugin->options_submit($form['argument_default'][$default_id], $form_state, $options);
+      // Copy the now submitted options to their final resting place so they get saved.
+      $form_state['values']['options']['default_argument_options'] = $options;
+    }
+
+    // summary plugin
+    $summary_id = $form_state['values']['options']['summary']['format'];
+    $plugin = $this->get_plugin('style', $summary_id);
+    if ($plugin) {
+      $options = &$form_state['values']['options']['summary']['options'][$summary_id];
+      $plugin->options_submit($form['summary']['options'][$summary_id], $form_state, $options);
+      // Copy the now submitted options to their final resting place so they get saved.
+      $form_state['values']['options']['summary_options'] = $options;
+    }
+
+    $validate_id = $form_state['values']['options']['validate']['type'];
+    $plugin = $this->get_plugin('argument validator', $validate_id);
+    if ($plugin) {
+      $options = &$form_state['values']['options']['validate']['options'][$validate_id];
+      $plugin->options_submit($form['validate']['options'][$validate_id], $form_state, $options);
+      // Copy the now submitted options to their final resting place so they get saved.
+      $form_state['values']['options']['validate_options'] = $options;
+    }
+
+    // Clear out the content of title if it's not enabled.
+    $options =& $form_state['values']['options'];
+    if (empty($options['title_enable'])) {
+      $options['title'] = '';
+    }
+  }
+
+  /**
+   * Provide a list of default behaviors for this argument if the argument
+   * is not present.
+   *
+   * Override this method to provide additional (or fewer) default behaviors.
+   */
+  function default_actions($which = NULL) {
+    $defaults = array(
+      'ignore' => array(
+        'title' => t('Display all results for the specified field'),
+        'method' => 'default_ignore',
+        'breadcrumb' => TRUE, // generate a breadcrumb to here
+      ),
+      'default' => array(
+        'title' => t('Provide default value'),
+        'method' => 'default_default',
+        'form method' => 'default_argument_form',
+        'has default argument' => TRUE,
+        'default only' => TRUE, // this can only be used for missing argument, not validation failure
+        'breadcrumb' => TRUE, // generate a breadcrumb to here
+      ),
+      'not found' => array(
+        'title' => t('Hide view'),
+        'method' => 'default_not_found',
+        'hard fail' => TRUE, // This is a hard fail condition
+      ),
+      'summary' => array(
+        'title' => t('Display a summary'),
+        'method' => 'default_summary',
+        'form method' => 'default_summary_form',
+        'style plugin' => TRUE,
+        'breadcrumb' => TRUE, // generate a breadcrumb to here
+      ),
+      'empty' => array(
+        'title' => t('Display contents of "No results found"'),
+        'method' => 'default_empty',
+        'breadcrumb' => TRUE, // generate a breadcrumb to here
+      ),
+      'access denied' => array(
+        'title' => t('Display "Access Denied"'),
+        'method' => 'default_access_denied',
+        'breadcrumb' => FALSE, // generate a breadcrumb to here
+      ),
+    );
+
+    if ($this->view->display_handler->has_path()) {
+      $defaults['not found']['title'] = t('Show "Page not found"');
+    }
+
+    if ($which) {
+      if (!empty($defaults[$which])) {
+        return $defaults[$which];
+      }
+    }
+    else {
+      return $defaults;
+    }
+  }
+
+  /**
+   * Provide a form for selecting the default argument when the
+   * default action is set to provide default argument.
+   */
+  function default_argument_form(&$form, &$form_state) {
+    $plugins = views_fetch_plugin_data('argument default');
+    $options = array();
+
+    $form['default_argument_skip_url'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Skip default argument for view URL'),
+      '#default_value' => $this->options['default_argument_skip_url'],
+      '#description' => t('Select whether to include this default argument when constructing the URL for this view. Skipping default arguments is useful e.g. in the case of feeds.')
+    );
+
+    $form['default_argument_type'] = array(
+      '#prefix' => '<div id="edit-options-default-argument-type-wrapper">',
+      '#suffix' => '</div>',
+      '#type' => 'select',
+      '#id' => 'edit-options-default-argument-type',
+      '#title' => t('Type'),
+      '#default_value' => $this->options['default_argument_type'],
+
+      '#dependency' => array('radio:options[default_action]' => array('default')),
+      // Views custom key, moves this element to the appropriate container
+      // under the radio button.
+      '#argument_option' => 'default',
+    );
+
+    foreach ($plugins as $id => $info) {
+      if (!empty($info['no ui'])) {
+        continue;
+      }
+      $plugin = $this->get_plugin('argument default', $id);
+      if ($plugin) {
+        if ($plugin->access() || $this->options['default_argument_type'] == $id) {
+          $form['argument_default']['#argument_option'] = 'default';
+          $form['argument_default'][$id] = array(
+            '#prefix' => '<div id="edit-options-argument-default-options-' . $id . '-wrapper">',
+            '#suffix' => '</div>',
+            '#id' => 'edit-options-argument-default-options-' . $id,
+            '#type' => 'item',
+            // Even if the plugin has no options add the key to the form_state.
+            '#input' => TRUE,
+            '#dependency' => array(
+              'radio:options[default_action]' => array('default'),
+              'edit-options-default-argument-type' => array($id)
+            ),
+            '#dependency_count' => 2,
+          );
+          $options[$id] = $info['title'];
+          $plugin->options_form($form['argument_default'][$id], $form_state);
+        }
+      }
+    }
+
+    asort($options);
+    $form['default_argument_type']['#options'] = $options;
+  }
+
+  /**
+   * Provide a form for selecting further summary options when the
+   * default action is set to display one.
+   */
+  function default_summary_form(&$form, &$form_state) {
+    $style_plugins = views_fetch_plugin_data('style');
+    $summary_plugins = array();
+    $format_options = array();
+    foreach ($style_plugins as $key => $plugin) {
+      if (isset($plugin['type']) && $plugin['type'] == 'summary') {
+        $summary_plugins[$key] = $plugin;
+        $format_options[$key] = $plugin['title'];
+      }
+    }
+
+    $form['summary'] = array(
+      // Views custom key, moves this element to the appropriate container
+      // under the radio button.
+      '#argument_option' => 'summary',
+    );
+    $form['summary']['sort_order'] = array(
+      '#type' => 'radios',
+      '#title' => t('Sort order'),
+      '#options' => array('asc' => t('Ascending'), 'desc' => t('Descending')),
+      '#default_value' => $this->options['summary']['sort_order'],
+      '#dependency' => array('radio:options[default_action]' => array('summary')),
+    );
+    $form['summary']['number_of_records'] = array(
+      '#type' => 'radios',
+      '#title' => t('Sort by'),
+      '#default_value' => $this->options['summary']['number_of_records'],
+      '#options' => array(
+        0 => $this->get_sort_name(),
+        1 => t('Number of records')
+      ),
+      '#dependency' => array('radio:options[default_action]' => array('summary')),
+    );
+
+    $form['summary']['format'] = array(
+      '#type' => 'radios',
+      '#title' => t('Format'),
+      '#options' => $format_options,
+      '#default_value' => $this->options['summary']['format'],
+      '#dependency' => array('radio:options[default_action]' => array('summary')),
+    );
+
+    foreach ($summary_plugins as $id => $info) {
+      if (empty($info['uses options'])) {
+        continue;
+      }
+      $plugin = $this->get_plugin('style', $id);
+      if ($plugin) {
+        $form['summary']['options'][$id] = array(
+          '#prefix' => '<div id="edit-options-summary-options-' . $id . '-wrapper">',
+          '#suffix' => '</div>',
+          '#id' => 'edit-options-summary-options-' . $id,
+          '#type' => 'item',
+          '#input' => TRUE, // trick it into checking input to make #process run
+          '#dependency' => array(
+            'radio:options[default_action]' => array('summary'),
+            'radio:options[summary][format]' => array($id),
+          ),
+          '#dependency_count' => 2,
+        );
+        $options[$id] = $info['title'];
+        $plugin->options_form($form['summary']['options'][$id], $form_state);
+      }
+    }
+  }
+
+  /**
+   * Handle the default action, which means our argument wasn't present.
+   *
+   * Override this method only with extreme care.
+   *
+   * @return
+   *   A boolean value; if TRUE, continue building this view. If FALSE,
+   *   building the view will be aborted here.
+   */
+  function default_action($info = NULL) {
+    if (!isset($info)) {
+      $info = $this->default_actions($this->options['default_action']);
+    }
+
+    if (!$info) {
+      return FALSE;
+    }
+
+    if (!empty($info['method args'])) {
+      return call_user_func_array(array(&$this, $info['method']), $info['method args']);
+    }
+    else {
+      return $this->{$info['method']}();
+    }
+  }
+
+  /**
+   * How to act if validation failes
+   */
+  function validate_fail() {
+    $info = $this->default_actions($this->options['validate']['fail']);
+    return $this->default_action($info);
+  }
+  /**
+   * Default action: ignore.
+   *
+   * If an argument was expected and was not given, in this case, simply
+   * ignore the argument entirely.
+   */
+  function default_ignore() {
+    return TRUE;
+  }
+
+  /**
+   * Default action: not found.
+   *
+   * If an argument was expected and was not given, in this case, report
+   * the view as 'not found' or hide it.
+   */
+  function default_not_found() {
+    // Set a failure condition and let the display manager handle it.
+    $this->view->build_info['fail'] = TRUE;
+    return FALSE;
+  }
+
+  /**
+   * Default action: access denied.
+   *
+   * If an argument was expected and was not given, in this case, report
+   * the view as 'access denied'.
+   */
+  function default_access_denied() {
+    $this->view->build_info['denied'] = TRUE;
+    return FALSE;
+  }
+
+  /**
+   * Default action: empty
+   *
+   * If an argument was expected and was not given, in this case, display
+   * the view's empty text
+   */
+  function default_empty() {
+    // We return with no query; this will force the empty text.
+    $this->view->built = TRUE;
+    $this->view->executed = TRUE;
+    $this->view->result = array();
+    return FALSE;
+  }
+
+  /**
+   * This just returns true. The view argument builder will know where
+   * to find the argument from.
+   */
+  function default_default() {
+    return TRUE;
+  }
+
+  /**
+   * Determine if the argument is set to provide a default argument.
+   */
+  function has_default_argument() {
+    $info = $this->default_actions($this->options['default_action']);
+    return !empty($info['has default argument']);
+  }
+
+  /**
+   * Get a default argument, if available.
+   */
+  function get_default_argument() {
+    $plugin = $this->get_plugin('argument default');
+    if ($plugin) {
+      return $plugin->get_argument();
+    }
+  }
+
+  /**
+   * Process the summary arguments for display.
+   *
+   * For example, the validation plugin may want to alter an argument for use in
+   * the URL.
+   */
+  function process_summary_arguments(&$args) {
+    if ($this->options['validate']['type'] != 'none') {
+      if (isset($this->validator) || $this->validator = $this->get_plugin('argument validator')) {
+        $this->validator->process_summary_arguments($args);
+      }
+    }
+  }
+
+  /**
+   * Default action: summary.
+   *
+   * If an argument was expected and was not given, in this case, display
+   * a summary query.
+   */
+  function default_summary() {
+    $this->view->build_info['summary'] = TRUE;
+    $this->view->build_info['summary_level'] = $this->options['id'];
+
+    // Change the display style to the summary style for this
+    // argument.
+    $this->view->plugin_name = $this->options['summary']['format'];
+    $this->view->style_options = $this->options['summary_options'];
+
+    // Clear out the normal primary field and whatever else may have
+    // been added and let the summary do the work.
+    $this->query->clear_fields();
+    $this->summary_query();
+
+    $by = $this->options['summary']['number_of_records'] ? 'num_records' : NULL;
+    $this->summary_sort($this->options['summary']['sort_order'], $by);
+
+    // Summaries have their own sorting and fields, so tell the View not
+    // to build these.
+    $this->view->build_sort = $this->view->build_fields = FALSE;
+    return TRUE;
+  }
+
+  /**
+   * Build the info for the summary query.
+   *
+   * This must:
+   * - add_groupby: group on this field in order to create summaries.
+   * - add_field: add a 'num_nodes' field for the count. Usually it will
+   *   be a count on $view->base_field
+   * - set_count_field: Reset the count field so we get the right paging.
+   *
+   * @return
+   *   The alias used to get the number of records (count) for this entry.
+   */
+  function summary_query() {
+    $this->ensure_my_table();
+    // Add the field.
+    $this->base_alias = $this->query->add_field($this->table_alias, $this->real_field);
+
+    $this->summary_name_field();
+    return $this->summary_basics();
+  }
+
+  /**
+   * Add the name field, which is the field displayed in summary queries.
+   * This is often used when the argument is numeric.
+   */
+  function summary_name_field() {
+    // Add the 'name' field. For example, if this is a uid argument, the
+    // name field would be 'name' (i.e, the username).
+
+    if (isset($this->name_table)) {
+      // if the alias is different then we're probably added, not ensured,
+      // so look up the join and add it instead.
+      if ($this->table_alias != $this->name_table) {
+        $j = views_get_table_join($this->name_table, $this->table);
+        if ($j) {
+          $join = clone $j;
+          $join->left_table = $this->table_alias;
+          $this->name_table_alias = $this->query->add_table($this->name_table, $this->relationship, $join);
+        }
+      }
+      else {
+        $this->name_table_alias = $this->query->ensure_table($this->name_table, $this->relationship);
+      }
+    }
+    else {
+      $this->name_table_alias = $this->table_alias;
+    }
+
+    if (isset($this->name_field)) {
+      $this->name_alias = $this->query->add_field($this->name_table_alias, $this->name_field);
+    }
+    else {
+      $this->name_alias = $this->base_alias;
+    }
+  }
+
+  /**
+   * Some basic summary behavior that doesn't need to be repeated as much as
+   * code that goes into summary_query()
+   */
+  function summary_basics($count_field = TRUE) {
+    // Add the number of nodes counter
+    $distinct = ($this->view->display_handler->get_option('distinct') && empty($this->query->no_distinct));
+
+    $count_alias = $this->query->add_field($this->query->base_table, $this->query->base_field, 'num_records',
+                                           array('count' => TRUE, 'distinct' => $distinct));
+    $this->query->add_groupby($this->name_alias);
+
+    if ($count_field) {
+      $this->query->set_count_field($this->table_alias, $this->real_field);
+    }
+
+    $this->count_alias = $count_alias;
+  }
+
+  /**
+   * Sorts the summary based upon the user's selection. The base variant of
+   * this is usually adequte.
+   *
+   * @param $order
+   *   The order selected in the UI.
+   */
+  function summary_sort($order, $by = NULL) {
+    $this->query->add_orderby(NULL, NULL, $order, (!empty($by) ? $by : $this->name_alias));
+  }
+
+  /**
+   * Provide the argument to use to link from the summary to the next level;
+   * this will be called once per row of a summary, and used as part of
+   * $view->get_url().
+   *
+   * @param $data
+   *   The query results for the row.
+   */
+  function summary_argument($data) {
+    return $data->{$this->base_alias};
+  }
+
+  /**
+   * Provides the name to use for the summary. By default this is just
+   * the name field.
+   *
+   * @param $data
+   *   The query results for the row.
+   */
+  function summary_name($data) {
+    $value = $data->{$this->name_alias};
+    if (empty($value) && !empty($this->definition['empty field name'])) {
+      $value = $this->definition['empty field name'];
+    }
+    return check_plain($value);
+  }
+
+  /**
+   * Set up the query for this argument.
+   *
+   * The argument sent may be found at $this->argument.
+   */
+  function query($group_by = FALSE) {
+    $this->ensure_my_table();
+    $this->query->add_where(0, "$this->table_alias.$this->real_field", $this->argument);
+  }
+
+  /**
+   * Get the title this argument will assign the view, given the argument.
+   *
+   * This usually needs to be overridden to provide a proper title.
+   */
+  function title() {
+    return check_plain($this->argument);
+  }
+
+  /**
+   * Called by the view object to get the title. This may be set by a
+   * validator so we don't necessarily call through to title().
+   */
+  function get_title() {
+    if (isset($this->validated_title)) {
+      return $this->validated_title;
+    }
+    else {
+      return $this->title();
+    }
+  }
+
+  /**
+   * Validate that this argument works. By default, all arguments are valid.
+   */
+  function validate_arg($arg) {
+    // By using % in URLs, arguments could be validated twice; this eases
+    // that pain.
+    if (isset($this->argument_validated)) {
+      return $this->argument_validated;
+    }
+
+    if ($this->is_exception($arg)) {
+      return $this->argument_validated = TRUE;
+    }
+
+    if ($this->options['validate']['type'] == 'none') {
+      return $this->argument_validated = $this->validate_argument_basic($arg);
+    }
+
+    $plugin = $this->get_plugin('argument validator');
+    if ($plugin) {
+      return $this->argument_validated = $plugin->validate_argument($arg);
+    }
+
+    // If the plugin isn't found, fall back to the basic validation path:
+    return $this->argument_validated = $this->validate_argument_basic($arg);
+  }
+
+  /**
+   * Called by the menu system to validate an argument.
+   *
+   * This checks to see if this is a 'soft fail', which means that if the
+   * argument fails to validate, but there is an action to take anyway,
+   * then validation cannot actually fail.
+   */
+  function validate_argument($arg) {
+    $validate_info = $this->default_actions($this->options['validate']['fail']);
+    if (empty($validate_info['hard fail'])) {
+      return TRUE;
+    }
+
+    $rc = $this->validate_arg($arg);
+
+    // If the validator has changed the validate fail condition to a
+    // soft fail, deal with that:
+    $validate_info = $this->default_actions($this->options['validate']['fail']);
+    if (empty($validate_info['hard fail'])) {
+      return TRUE;
+    }
+
+    return $rc;
+  }
+
+  /**
+   * Provide a basic argument validation.
+   *
+   * This can be overridden for more complex types; the basic
+   * validator only checks to see if the argument is not NULL
+   * or is numeric if the definition says it's numeric.
+   */
+  function validate_argument_basic($arg) {
+    if (!isset($arg) || $arg === '') {
+      return FALSE;
+    }
+
+    if (!empty($this->definition['numeric']) && !isset($this->options['break_phrase']) && !is_numeric($arg)) {
+      return FALSE;
+    }
+
+    return TRUE;
+  }
+
+  /**
+   * Set the input for this argument
+   *
+   * @return TRUE if it successfully validates; FALSE if it does not.
+   */
+  function set_argument($arg) {
+    $this->argument = $arg;
+    return $this->validate_arg($arg);
+  }
+
+  /**
+   * Get the value of this argument.
+   */
+  function get_value() {
+    // If we already processed this argument, we're done.
+    if (isset($this->argument)) {
+      return $this->argument;
+    }
+
+    // Otherwise, we have to pretend to process ourself to find the value.
+    $value = NULL;
+    // Find the position of this argument within the view.
+    $position = 0;
+    foreach ($this->view->argument as $id => $argument) {
+      if ($id == $this->options['id']) {
+        break;
+      }
+      $position++;
+    }
+
+    $arg = isset($this->view->args[$position]) ? $this->view->args[$position] : NULL;
+    $this->position = $position;
+
+    // Clone ourselves so that we don't break things when we're really
+    // processing the arguments.
+    $argument = clone $this;
+    if (!isset($arg) && $argument->has_default_argument()) {
+      $arg = $argument->get_default_argument();
+
+      // remember that this argument was computed, not passed on the URL.
+      $this->is_default = TRUE;
+    }
+    // Set the argument, which will also validate that the argument can be set.
+    if ($argument->set_argument($arg)) {
+      $value = $argument->argument;
+    }
+    unset($argument);
+    return $value;
+  }
+
+  /**
+   * Export handler for summary export.
+   *
+   * Arguments can have styles for the summary view. This special export
+   * handler makes sure this works properly.
+   */
+  function export_summary($indent, $prefix, $storage, $option, $definition, $parents) {
+    $output = '';
+    $name = $this->options['summary'][$option];
+    $options = $this->options['summary_options'];
+
+    $plugin = views_get_plugin('style', $name);
+    if ($plugin) {
+      $plugin->init($this->view, $this->view->display_handler->display, $options);
+      // Write which plugin to use.
+      $output .= $indent . $prefix . "['summary']['$option'] = '$name';\n";
+
+      // Pass off to the plugin to export itself.
+      $output .= $plugin->export_options($indent, $prefix . "['summary_options']");
+    }
+
+    return $output;
+  }
+
+  /**
+   * Export handler for validation export.
+   *
+   * Arguments use validation plugins. This special export handler makes sure
+   * this works properly.
+   */
+  function export_validation($indent, $prefix, $storage, $option, $definition, $parents) {
+    $output = '';
+    $name = $this->options['validate'][$option];
+    $options = $this->options['validate_options'];
+
+    $plugin = views_get_plugin('argument validator', $name);
+    if ($plugin) {
+      $plugin->init($this->view, $this->display, $options);
+      // Write which plugin to use.
+      $output .= $indent . $prefix . "['validate']['$option'] = '$name';\n";
+
+      // Pass off to the plugin to export itself.
+      $output .= $plugin->export_options($indent, $prefix . "['validate_options']");
+    }
+
+    return $output;
+  }
+
+  /**
+   * Generic plugin export handler.
+   *
+   * Since style and validation plugins have their own export handlers, this
+   * one is currently only used for default argument plugins.
+   */
+  function export_plugin($indent, $prefix, $storage, $option, $definition, $parents) {
+    $output = '';
+    if ($option == 'default_argument_type') {
+      $type = 'argument default';
+      $option_name = 'default_argument_options';
+    }
+
+    $plugin = $this->get_plugin($type);
+    $name = $this->options[$option];
+
+    if ($plugin) {
+      // Write which plugin to use.
+      $output .= $indent . $prefix . "['$option'] = '$name';\n";
+
+      // Pass off to the plugin to export itself.
+      $output .= $plugin->export_options($indent, $prefix . "['$option_name']");
+    }
+
+    return $output;
+  }
+
+  /**
+   * Get the display or row plugin, if it exists.
+   */
+  function get_plugin($type = 'argument default', $name = NULL) {
+    $options = array();
+    switch ($type) {
+      case 'argument default':
+        $plugin_name = $this->options['default_argument_type'];
+        $options_name = 'default_argument_options';
+        break;
+      case 'argument validator':
+        $plugin_name = $this->options['validate']['type'];
+        $options_name = 'validate_options';
+        break;
+      case 'style':
+        $plugin_name = $this->options['summary']['format'];
+        $options_name = 'summary_options';
+    }
+
+    if (!$name) {
+      $name = $plugin_name;
+    }
+
+    // we only fetch the options if we're fetching the plugin actually
+    // in use.
+    if ($name == $plugin_name) {
+      $options = $this->options[$options_name];
+    }
+
+    $plugin = views_get_plugin($type, $name);
+    if ($plugin) {
+      // Style plugins expects different parameters as argument related plugins.
+      if ($type == 'style') {
+        $plugin->init($this->view, $this->view->display_handler->display, $options);
+      }
+      else {
+        $plugin->init($this->view, $this, $options);
+      }
+      return $plugin;
+    }
+  }
+
+  /**
+   * Return a description of how the argument would normally be sorted.
+   *
+   * Subclasses should override this to specify what the default sort order of
+   * their argument is (e.g. alphabetical, numeric, date).
+   */
+  function get_sort_name() {
+    return t('Default sort', array(), array('context' => 'Sort order'));
+  }
+}
+
+/**
+ * A special handler to take the place of missing or broken handlers.
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument_broken extends views_handler_argument {
+  function ui_name($short = FALSE) {
+    return t('Broken/missing handler');
+  }
+
+  function ensure_my_table() { /* No table to ensure! */ }
+  function query($group_by = FALSE) { /* No query to run */ }
+  function options_form(&$form, &$form_state) {
+    $form['markup'] = array(
+      '#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
+    );
+  }
+
+  /**
+   * Determine if the handler is considered 'broken'
+   */
+  function broken() { return TRUE; }
+}
+
+/**
+ * @}
+ */

+ 101 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_argument_date.inc

@@ -0,0 +1,101 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_argument_date.
+ */
+
+/**
+ * Abstract argument handler for dates.
+ *
+ * Adds an option to set a default argument based on the current date.
+ *
+ * @param $arg_format
+ *   The format string to use on the current time when
+ *   creating a default date argument.
+ *
+ * Definitions terms:
+ * - many to one: If true, the "many to one" helper will be used.
+ * - invalid input: A string to give to the user for obviously invalid input.
+ *                  This is deprecated in favor of argument validators.
+ *
+ * @see views_many_to_one_helper()
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument_date extends views_handler_argument_formula {
+  var $option_name = 'default_argument_date';
+  var $arg_format = 'Y-m-d';
+
+  /**
+   * Add an option to set the default value to the current date.
+   */
+  function default_argument_form(&$form, &$form_state) {
+    parent::default_argument_form($form, $form_state);
+    $form['default_argument_type']['#options'] += array('date' => t('Current date'));
+    $form['default_argument_type']['#options'] += array('node_created' => t("Current node's creation time"));
+    $form['default_argument_type']['#options'] += array('node_changed' => t("Current node's update time"));  }
+
+  /**
+   * Set the empty argument value to the current date,
+   * formatted appropriately for this argument.
+   */
+  function get_default_argument($raw = FALSE) {
+    if (!$raw && $this->options['default_argument_type'] == 'date') {
+      return date($this->arg_format, REQUEST_TIME);
+    }
+    else if (!$raw && in_array($this->options['default_argument_type'], array('node_created', 'node_changed'))) {
+      foreach (range(1, 3) as $i) {
+        $node = menu_get_object('node', $i);
+        if (!empty($node)) {
+          continue;
+        }
+      }
+
+      if (arg(0) == 'node' && is_numeric(arg(1))) {
+        $node = node_load(arg(1));
+      }
+
+      if (empty($node)) {
+        return parent::get_default_argument();
+      }
+      elseif ($this->options['default_argument_type'] == 'node_created') {
+        return date($this->arg_format, $node->created);
+      }
+      elseif ($this->options['default_argument_type'] == 'node_changed') {
+        return date($this->arg_format, $node->changed);
+      }
+    }
+
+    return parent::get_default_argument($raw);
+  }
+
+  /**
+   * The date handler provides some default argument types, which aren't argument default plugins,
+   * so addapt the export mechanism.
+   */
+  function export_plugin($indent, $prefix, $storage, $option, $definition, $parents) {
+
+    // Only use a special behaviour for the special argument types, else just
+    // use the default behaviour.
+    if ($option == 'default_argument_type') {
+      $type = 'argument default';
+      $option_name = 'default_argument_options';
+
+      $plugin = $this->get_plugin($type);
+      $name = $this->options[$option];
+      if (in_array($name, array('date', 'node_created', 'node_changed'))) {
+
+        // Write which plugin to use.
+        $output = $indent . $prefix . "['$option'] = '$name';\n";
+        return $output;
+      }
+    }
+    return parent::export_plugin($indent, $prefix, $storage, $option, $definition, $parents);
+  }
+
+
+  function get_sort_name() {
+    return t('Date', array(), array('context' => 'Sort order'));
+  }
+}

+ 63 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_argument_formula.inc

@@ -0,0 +1,63 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_argument_formula.
+ */
+
+/**
+ * Abstract argument handler for simple formulae.
+ *
+ * Child classes of this object should implement summary_argument, at least.
+ *
+ * Definition terms:
+ * - formula: The formula to use for this handler.
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument_formula extends views_handler_argument {
+  var $formula = NULL;
+  /**
+   * Constructor
+   */
+  function construct() {
+    parent::construct();
+
+    if (!empty($this->definition['formula'])) {
+      $this->formula = $this->definition['formula'];
+    }
+  }
+
+  function get_formula() {
+    return str_replace('***table***', $this->table_alias, $this->formula);
+  }
+
+  /**
+   * Build the summary query based on a formula
+   */
+  function summary_query() {
+    $this->ensure_my_table();
+    // Now that our table is secure, get our formula.
+    $formula = $this->get_formula();
+
+    // Add the field.
+    $this->base_alias = $this->name_alias = $this->query->add_field(NULL, $formula, $this->field);
+    $this->query->set_count_field(NULL, $formula, $this->field);
+
+    return $this->summary_basics(FALSE);
+  }
+
+  /**
+   * Build the query based upon the formula
+   */
+  function query($group_by = FALSE) {
+    $this->ensure_my_table();
+    // Now that our table is secure, get our formula.
+    $placeholder = $this->placeholder();
+    $formula = $this->get_formula() .' = ' . $placeholder;
+    $placeholders = array(
+      $placeholder => $this->argument,
+    );
+    $this->query->add_where(0, $formula, $placeholders, 'formula');
+  }
+}

+ 29 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_argument_group_by_numeric.inc

@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_argument_group_by_numeric.
+ */
+
+/**
+ * Simple handler for arguments using group by.
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument_group_by_numeric extends views_handler_argument  {
+  function query($group_by = FALSE) {
+    $this->ensure_my_table();
+    $field = $this->get_field();
+    $placeholder = $this->placeholder();
+
+    $this->query->add_having_expression(0, "$field = $placeholder", array($placeholder => $this->argument));
+  }
+
+  function ui_name($short = FALSE) {
+    return $this->get_field(parent::ui_name($short));
+  }
+
+  function get_sort_name() {
+    return t('Numerical', array(), array('context' => 'Sort order'));
+  }
+}

+ 185 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_argument_many_to_one.inc

@@ -0,0 +1,185 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_argument_many_to_one.
+ */
+
+/**
+ * An argument handler for use in fields that have a many to one relationship
+ * with the table(s) to the left. This adds a bunch of options that are
+ * reasonably common with this type of relationship.
+ * Definition terms:
+ * - numeric: If true, the field will be considered numeric. Probably should
+ *   always be set TRUE as views_handler_argument_string has many to one
+ *   capabilities.
+ * - zero is null: If true, a 0 will be handled as empty, so for example
+ *   a default argument can be provided or a summary can be shown.
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument_many_to_one extends views_handler_argument {
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+    $this->helper = new views_many_to_one_helper($this);
+
+    // Ensure defaults for these, during summaries and stuff:
+    $this->operator = 'or';
+    $this->value = array();
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    if (!empty($this->definition['numeric'])) {
+      $options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE);
+    }
+
+    $options['add_table'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['require_value'] = array('default' => FALSE, 'bool' => TRUE);
+
+    if (isset($this->helper)) {
+      $this->helper->option_definition($options);
+    }
+    else {
+      $helper = new views_many_to_one_helper($this);
+      $helper->option_definition($options);
+    }
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    // allow + for or, , for and
+    if (!empty($this->definition['numeric'])) {
+      $form['break_phrase'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Allow multiple values'),
+        '#description' => t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'),
+        '#default_value' => !empty($this->options['break_phrase']),
+        '#fieldset' => 'more',
+      );
+    }
+
+    $form['add_table'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Allow multiple filter values to work together'),
+      '#description' => t('If selected, multiple instances of this filter can work together, as though multiple values were supplied to the same filter. This setting is not compatible with the "Reduce duplicates" setting.'),
+      '#default_value' => !empty($this->options['add_table']),
+      '#fieldset' => 'more',
+    );
+
+    $form['require_value'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Do not display items with no value in summary'),
+      '#default_value' => !empty($this->options['require_value']),
+      '#fieldset' => 'more',
+    );
+
+    $this->helper->options_form($form, $form_state);
+  }
+
+  /**
+   * Override ensure_my_table so we can control how this joins in.
+   * The operator actually has influence over joining.
+   */
+  function ensure_my_table() {
+    $this->helper->ensure_my_table();
+  }
+
+  function query($group_by = FALSE) {
+    $empty = FALSE;
+    if (isset($this->definition['zero is null']) && $this->definition['zero is null']) {
+      if (empty($this->argument)) {
+        $empty = TRUE;
+      }
+    }
+    else {
+      if (!isset($this->argument)) {
+        $empty = TRUE;
+      }
+    }
+    if ($empty) {
+      parent::ensure_my_table();
+      $this->query->add_where(0, "$this->table_alias.$this->real_field", NULL, 'IS NULL');
+      return;
+    }
+
+    if (!empty($this->options['break_phrase'])) {
+      views_break_phrase($this->argument, $this);
+    }
+    else {
+      $this->value = array($this->argument);
+      $this->operator = 'or';
+    }
+
+    $this->helper->add_filter();
+  }
+
+  function title() {
+    if (!$this->argument) {
+      return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized');
+    }
+
+    if (!empty($this->options['break_phrase'])) {
+      views_break_phrase($this->argument, $this);
+    }
+    else {
+      $this->value = array($this->argument);
+      $this->operator = 'or';
+    }
+
+    // @todo -- both of these should check definition for alternate keywords.
+
+    if (empty($this->value)) {
+      return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized');
+    }
+
+    if ($this->value === array(-1)) {
+      return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : t('Invalid input');
+    }
+
+    return implode($this->operator == 'or' ? ' + ' : ', ', $this->title_query());
+  }
+
+  function summary_query() {
+    $field = $this->table . '.' . $this->field;
+    $join = $this->get_join();
+
+    if (!empty($this->options['require_value'])) {
+      $join->type = 'INNER';
+    }
+
+    if (empty($this->options['add_table']) || empty($this->view->many_to_one_tables[$field])) {
+      $this->table_alias = $this->query->ensure_table($this->table, $this->relationship, $join);
+    }
+    else {
+      $this->table_alias = $this->helper->summary_join();
+    }
+
+    // Add the field.
+    $this->base_alias = $this->query->add_field($this->table_alias, $this->real_field);
+
+    $this->summary_name_field();
+
+    return $this->summary_basics();
+  }
+
+  function summary_argument($data) {
+    $value = $data->{$this->base_alias};
+    if (empty($value)) {
+      $value = 0;
+    }
+
+    return $value;
+  }
+
+  /**
+   * Override for specific title lookups.
+   */
+  function title_query() {
+    return $this->value;
+  }
+}

+ 67 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_argument_null.inc

@@ -0,0 +1,67 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_argument_null.
+ */
+
+/**
+ * Argument handler that ignores the argument.
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument_null extends views_handler_argument {
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['must_not_be'] = array('default' => FALSE, 'bool' => TRUE);
+    return $options;
+  }
+
+  /**
+   * Override options_form() so that only the relevant options
+   * are displayed to the user.
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    $form['must_not_be'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Fail basic validation if any argument is given'),
+      '#default_value' => !empty($this->options['must_not_be']),
+      '#description' => t('By checking this field, you can use this to make sure views with more arguments than necessary fail validation.'),
+      '#fieldset' => 'more',
+    );
+
+    unset($form['exception']);
+  }
+
+  /**
+   * Override default_actions() to remove actions that don't
+   * make sense for a null argument.
+   */
+  function default_actions($which = NULL) {
+    if ($which) {
+      if (in_array($which, array('ignore', 'not found', 'empty', 'default'))) {
+        return parent::default_actions($which);
+      }
+      return;
+    }
+    $actions = parent::default_actions();
+    unset($actions['summary asc']);
+    unset($actions['summary desc']);
+    return $actions;
+  }
+
+  function validate_argument_basic($arg) {
+    if (!empty($this->options['must_not_be'])) {
+      return !isset($arg);
+    }
+
+    return parent::validate_argument_basic($arg);
+  }
+
+  /**
+   * Override the behavior of query() to prevent the query
+   * from being changed in any way.
+   */
+  function query($group_by = FALSE) {}
+}

+ 116 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_argument_numeric.inc

@@ -0,0 +1,116 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_argument_numeric.
+ */
+
+/**
+ * Basic argument handler for arguments that are numeric. Incorporates
+ * break_phrase.
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument_numeric extends views_handler_argument {
+  /**
+   * The operator used for the query: or|and.
+   * @var string
+   */
+  var $operator;
+
+  /**
+   * The actual value which is used for querying.
+   * @var array
+   */
+  var $value;
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['not'] = array('default' => FALSE, 'bool' => TRUE);
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    // allow + for or, , for and
+    $form['break_phrase'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Allow multiple values'),
+      '#description' => t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'),
+      '#default_value' => !empty($this->options['break_phrase']),
+      '#fieldset' => 'more',
+    );
+
+    $form['not'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Exclude'),
+      '#description' => t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'),
+      '#default_value' => !empty($this->options['not']),
+      '#fieldset' => 'more',
+    );
+  }
+
+  function title() {
+    if (!$this->argument) {
+      return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized');
+    }
+
+    if (!empty($this->options['break_phrase'])) {
+      views_break_phrase($this->argument, $this);
+    }
+    else {
+      $this->value = array($this->argument);
+      $this->operator = 'or';
+    }
+
+    if (empty($this->value)) {
+      return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized');
+    }
+
+    if ($this->value === array(-1)) {
+      return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : t('Invalid input');
+    }
+
+    return implode($this->operator == 'or' ? ' + ' : ', ', $this->title_query());
+  }
+
+  /**
+   * Override for specific title lookups.
+   * @return array
+   *    Returns all titles, if it's just one title it's an array with one entry.
+   */
+  function title_query() {
+    return $this->value;
+  }
+
+  function query($group_by = FALSE) {
+    $this->ensure_my_table();
+
+    if (!empty($this->options['break_phrase'])) {
+      views_break_phrase($this->argument, $this);
+    }
+    else {
+      $this->value = array($this->argument);
+    }
+
+    $placeholder = $this->placeholder();
+    $null_check = empty($this->options['not']) ? '' : "OR $this->table_alias.$this->real_field IS NULL";
+
+    if (count($this->value) > 1) {
+      $operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
+      $this->query->add_where_expression(0, "$this->table_alias.$this->real_field $operator($placeholder) $null_check", array($placeholder => $this->value));
+    }
+    else {
+      $operator = empty($this->options['not']) ? '=' : '!=';
+      $this->query->add_where_expression(0, "$this->table_alias.$this->real_field $operator $placeholder $null_check", array($placeholder => $this->argument));
+    }
+  }
+
+  function get_sort_name() {
+    return t('Numerical', array(), array('context' => 'Sort order'));
+  }
+}

+ 274 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_argument_string.inc

@@ -0,0 +1,274 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_argument_string.
+ */
+
+/**
+ * Basic argument handler to implement string arguments that may have length
+ * limits.
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument_string extends views_handler_argument {
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+    if (!empty($this->definition['many to one'])) {
+      $this->helper = new views_many_to_one_helper($this);
+
+      // Ensure defaults for these, during summaries and stuff:
+      $this->operator = 'or';
+      $this->value = array();
+    }
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['glossary'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['limit'] = array('default' => 0);
+    $options['case'] = array('default' => 'none');
+    $options['path_case'] = array('default' => 'none');
+    $options['transform_dash'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE);
+
+    if (!empty($this->definition['many to one'])) {
+      $options['add_table'] = array('default' => FALSE, 'bool' => TRUE);
+      $options['require_value'] = array('default' => FALSE, 'bool' => TRUE);
+    }
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['glossary'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Glossary mode'),
+      '#description' => t('Glossary mode applies a limit to the number of characters used in the filter value, which allows the summary view to act as a glossary.'),
+      '#default_value' => $this->options['glossary'],
+      '#fieldset' => 'more',
+    );
+
+    $form['limit'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Character limit'),
+      '#description' => t('How many characters of the filter value to filter against. If set to 1, all fields starting with the first letter in the filter value would be matched.'),
+      '#default_value' => $this->options['limit'],
+      '#dependency' => array('edit-options-glossary' => array(TRUE)),
+      '#fieldset' => 'more',
+    );
+
+    $form['case'] = array(
+      '#type' => 'select',
+      '#title' => t('Case'),
+      '#description' => t('When printing the title and summary, how to transform the case of the filter value.'),
+      '#options' => array(
+        'none' => t('No transform'),
+        'upper' => t('Upper case'),
+        'lower' => t('Lower case'),
+        'ucfirst' => t('Capitalize first letter'),
+        'ucwords' => t('Capitalize each word'),
+      ),
+      '#default_value' => $this->options['case'],
+      '#fieldset' => 'more',
+    );
+
+    $form['path_case'] = array(
+      '#type' => 'select',
+      '#title' => t('Case in path'),
+      '#description' => t('When printing url paths, how to transform the case of the filter value. Do not use this unless with Postgres as it uses case sensitive comparisons.'),
+      '#options' => array(
+        'none' => t('No transform'),
+        'upper' => t('Upper case'),
+        'lower' => t('Lower case'),
+        'ucfirst' => t('Capitalize first letter'),
+        'ucwords' => t('Capitalize each word'),
+      ),
+      '#default_value' => $this->options['path_case'],
+      '#fieldset' => 'more',
+    );
+
+    $form['transform_dash'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Transform spaces to dashes in URL'),
+      '#default_value' => $this->options['transform_dash'],
+      '#fieldset' => 'more',
+    );
+
+    if (!empty($this->definition['many to one'])) {
+      $form['add_table'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Allow multiple filter values to work together'),
+        '#description' => t('If selected, multiple instances of this filter can work together, as though multiple values were supplied to the same filter. This setting is not compatible with the "Reduce duplicates" setting.'),
+        '#default_value' => !empty($this->options['add_table']),
+        '#fieldset' => 'more',
+      );
+
+      $form['require_value'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Do not display items with no value in summary'),
+        '#default_value' => !empty($this->options['require_value']),
+        '#fieldset' => 'more',
+      );
+    }
+
+    // allow + for or, , for and
+    $form['break_phrase'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Allow multiple values'),
+      '#description' => t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'),
+      '#default_value' => !empty($this->options['break_phrase']),
+      '#fieldset' => 'more',
+    );
+  }
+
+  /**
+   * Build the summary query based on a string
+   */
+  function summary_query() {
+    if (empty($this->definition['many to one'])) {
+      $this->ensure_my_table();
+    }
+    else {
+      $this->table_alias = $this->helper->summary_join();
+    }
+
+    if (empty($this->options['glossary'])) {
+      // Add the field.
+      $this->base_alias = $this->query->add_field($this->table_alias, $this->real_field);
+      $this->query->set_count_field($this->table_alias, $this->real_field);
+    }
+    else {
+      // Add the field.
+      $formula = $this->get_formula();
+      $this->base_alias = $this->query->add_field(NULL, $formula, $this->field . '_truncated');
+      $this->query->set_count_field(NULL, $formula, $this->field, $this->field . '_truncated');
+    }
+
+    $this->summary_name_field();
+    return $this->summary_basics(FALSE);
+  }
+
+  /**
+   * Get the formula for this argument.
+   *
+   * $this->ensure_my_table() MUST have been called prior to this.
+   */
+  function get_formula() {
+    return "SUBSTRING($this->table_alias.$this->real_field, 1, " . intval($this->options['limit']) . ")";
+  }
+
+  /**
+   * Build the query based upon the formula
+   */
+  function query($group_by = FALSE) {
+    $argument = $this->argument;
+    if (!empty($this->options['transform_dash'])) {
+      $argument = strtr($argument, '-', ' ');
+    }
+
+    if (!empty($this->options['break_phrase'])) {
+      views_break_phrase_string($argument, $this);
+    }
+    else {
+      $this->value = array($argument);
+      $this->operator = 'or';
+    }
+
+    if (!empty($this->definition['many to one'])) {
+      if (!empty($this->options['glossary'])) {
+        $this->helper->formula = TRUE;
+      }
+      $this->helper->ensure_my_table();
+      $this->helper->add_filter();
+      return;
+    }
+
+    $this->ensure_my_table();
+    $formula = FALSE;
+    if (empty($this->options['glossary'])) {
+      $field = "$this->table_alias.$this->real_field";
+    }
+    else {
+      $formula = TRUE;
+      $field = $this->get_formula();
+    }
+
+    if (count($this->value) > 1) {
+      $operator = 'IN';
+      $argument = $this->value;
+    }
+    else {
+      $operator = '=';
+    }
+
+    if ($formula) {
+      $placeholder = $this->placeholder();
+      if ($operator == 'IN') {
+        $field .= " IN($placeholder)";
+      }
+      else {
+        $field .= ' = ' . $placeholder;
+      }
+      $placeholders = array(
+        $placeholder => $argument,
+      );
+      $this->query->add_where_expression(0, $field, $placeholders);
+    }
+    else {
+      $this->query->add_where(0, $field, $argument, $operator);
+    }
+  }
+
+  function summary_argument($data) {
+    $value = $this->case_transform($data->{$this->base_alias}, $this->options['path_case']);
+    if (!empty($this->options['transform_dash'])) {
+      $value = strtr($value, ' ', '-');
+    }
+    return $value;
+  }
+
+  function get_sort_name() {
+    return t('Alphabetical', array(), array('context' => 'Sort order'));
+  }
+
+  function title() {
+    $this->argument = $this->case_transform($this->argument, $this->options['case']);
+    if (!empty($this->options['transform_dash'])) {
+      $this->argument = strtr($this->argument, '-', ' ');
+    }
+
+    if (!empty($this->options['break_phrase'])) {
+      views_break_phrase_string($this->argument, $this);
+    }
+    else {
+      $this->value = array($this->argument);
+      $this->operator = 'or';
+    }
+
+    if (empty($this->value)) {
+      return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized');
+    }
+
+    if ($this->value === array(-1)) {
+      return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : t('Invalid input');
+    }
+
+    return implode($this->operator == 'or' ? ' + ' : ', ', $this->title_query());
+  }
+
+  /**
+   * Override for specific title lookups.
+   */
+  function title_query() {
+    return drupal_map_assoc($this->value, 'check_plain');
+  }
+
+  function summary_name($data) {
+    return $this->case_transform(parent::summary_name($data), $this->options['case']);
+  }
+
+}

+ 1630 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field.inc

@@ -0,0 +1,1630 @@
+<?php
+
+/**
+ * @file
+ * @todo.
+ */
+
+/**
+ * @defgroup views_field_handlers Views field handlers
+ * @{
+ * Handlers to tell Views how to build and display fields.
+ *
+ */
+
+/**
+ * Indicator of the render_text() method for rendering a single item.
+ * (If no render_item() is present).
+ */
+define('VIEWS_HANDLER_RENDER_TEXT_PHASE_SINGLE_ITEM', 0);
+
+/**
+ * Indicator of the render_text() method for rendering the whole element.
+ * (if no render_item() method is available).
+ */
+define('VIEWS_HANDLER_RENDER_TEXT_PHASE_COMPLETELY', 1);
+
+/**
+ * Indicator of the render_text() method for rendering the empty text.
+ */
+define('VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY', 2);
+
+/**
+ * Base field handler that has no options and renders an unformatted field.
+ *
+ * Definition terms:
+ * - additional fields: An array of fields that should be added to the query
+ *                      for some purpose. The array is in the form of:
+ *                      array('identifier' => array('table' => tablename,
+ *                      'field' => fieldname); as many fields as are necessary
+ *                      may be in this array.
+ * - click sortable: If TRUE, this field may be click sorted.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field extends views_handler {
+  var $field_alias = 'unknown';
+  var $aliases = array();
+
+  /**
+   * The field value prior to any rewriting.
+   *
+   * @var mixed
+   */
+  public $original_value = NULL;
+
+  /**
+   * @var array
+   * Stores additional fields which get's added to the query.
+   * The generated aliases are stored in $aliases.
+   */
+  var $additional_fields = array();
+
+  /**
+   * Construct a new field handler.
+   */
+  function construct() {
+    parent::construct();
+
+    $this->additional_fields = array();
+    if (!empty($this->definition['additional fields'])) {
+      $this->additional_fields = $this->definition['additional fields'];
+    }
+
+    if (!isset($this->options['exclude'])) {
+      $this->options['exclude'] = '';
+    }
+  }
+
+  /**
+   * Determine if this field can allow advanced rendering.
+   *
+   * Fields can set this to FALSE if they do not wish to allow
+   * token based rewriting or link-making.
+   */
+  function allow_advanced_render() {
+    return TRUE;
+  }
+
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+  }
+
+  /**
+   * Called to add the field to a query.
+   */
+  function query() {
+    $this->ensure_my_table();
+    // Add the field.
+    $params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array();
+    $this->field_alias = $this->query->add_field($this->table_alias, $this->real_field, NULL, $params);
+
+    $this->add_additional_fields();
+  }
+
+  /**
+   * Add 'additional' fields to the query.
+   *
+   * @param $fields
+   * An array of fields. The key is an identifier used to later find the
+   * field alias used. The value is either a string in which case it's
+   * assumed to be a field on this handler's table; or it's an array in the
+   * form of
+   * @code array('table' => $tablename, 'field' => $fieldname) @endcode
+   */
+  function add_additional_fields($fields = NULL) {
+    if (!isset($fields)) {
+      // notice check
+      if (empty($this->additional_fields)) {
+        return;
+      }
+      $fields = $this->additional_fields;
+    }
+
+    $group_params = array();
+    if ($this->options['group_type'] != 'group') {
+      $group_params = array(
+        'function' => $this->options['group_type'],
+      );
+    }
+
+    if (!empty($fields) && is_array($fields)) {
+      foreach ($fields as $identifier => $info) {
+        if (is_array($info)) {
+          if (isset($info['table'])) {
+            $table_alias = $this->query->ensure_table($info['table'], $this->relationship);
+          }
+          else {
+            $table_alias = $this->table_alias;
+          }
+
+          if (empty($table_alias)) {
+            debug(t('Handler @handler tried to add additional_field @identifier but @table could not be added!', array('@handler' => $this->definition['handler'], '@identifier' => $identifier, '@table' => $info['table'])));
+            $this->aliases[$identifier] = 'broken';
+            continue;
+          }
+
+          $params = array();
+          if (!empty($info['params'])) {
+            $params = $info['params'];
+          }
+
+          $params += $group_params;
+          $this->aliases[$identifier] = $this->query->add_field($table_alias, $info['field'], NULL, $params);
+        }
+        else {
+          $this->aliases[$info] = $this->query->add_field($this->table_alias, $info, NULL, $group_params);
+        }
+      }
+    }
+  }
+
+  /**
+   * Called to determine what to tell the clicksorter.
+   */
+  function click_sort($order) {
+    if (isset($this->field_alias)) {
+      // Since fields should always have themselves already added, just
+      // add a sort on the field.
+      $params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array();
+      $this->query->add_orderby(NULL, NULL, $order, $this->field_alias, $params);
+    }
+  }
+
+  /**
+   * Determine if this field is click sortable.
+   */
+  function click_sortable() {
+    return !empty($this->definition['click sortable']);
+  }
+
+  /**
+   * Get this field's label.
+   */
+  function label() {
+    if (!isset($this->options['label'])) {
+      return '';
+    }
+    return $this->options['label'];
+  }
+
+  /**
+   * Return an HTML element based upon the field's element type.
+   */
+  function element_type($none_supported = FALSE, $default_empty = FALSE, $inline = FALSE) {
+    if ($none_supported) {
+      if ($this->options['element_type'] === '0') {
+        return '';
+      }
+    }
+    if ($this->options['element_type']) {
+      return check_plain($this->options['element_type']);
+    }
+
+    if ($default_empty) {
+      return '';
+    }
+
+    if ($inline) {
+      return 'span';
+    }
+
+    if (isset($this->definition['element type'])) {
+      return $this->definition['element type'];
+    }
+
+    return 'span';
+  }
+
+  /**
+   * Return an HTML element for the label based upon the field's element type.
+   */
+  function element_label_type($none_supported = FALSE, $default_empty = FALSE) {
+    if ($none_supported) {
+      if ($this->options['element_label_type'] === '0') {
+        return '';
+      }
+    }
+    if ($this->options['element_label_type']) {
+      return check_plain($this->options['element_label_type']);
+    }
+
+    if ($default_empty) {
+      return '';
+    }
+
+    return 'span';
+  }
+
+  /**
+   * Return an HTML element for the wrapper based upon the field's element type.
+   */
+  function element_wrapper_type($none_supported = FALSE, $default_empty = FALSE) {
+    if ($none_supported) {
+      if ($this->options['element_wrapper_type'] === '0') {
+        return 0;
+      }
+    }
+    if ($this->options['element_wrapper_type']) {
+      return check_plain($this->options['element_wrapper_type']);
+    }
+
+    if ($default_empty) {
+      return '';
+    }
+
+    return 'div';
+  }
+
+  /**
+   * Provide a list of elements valid for field HTML.
+   *
+   * This function can be overridden by fields that want more or fewer
+   * elements available, though this seems like it would be an incredibly
+   * rare occurence.
+   */
+  function get_elements() {
+    static $elements = NULL;
+    if (!isset($elements)) {
+      $elements = variable_get('views_field_rewrite_elements', array(
+        '' => t('- Use default -'),
+        '0' => t('- None -'),
+        'div' => 'DIV',
+        'span' => 'SPAN',
+        'h1' => 'H1',
+        'h2' => 'H2',
+        'h3' => 'H3',
+        'h4' => 'H4',
+        'h5' => 'H5',
+        'h6' => 'H6',
+        'p' => 'P',
+        'strong' => 'STRONG',
+        'em' => 'EM',
+      ));
+    }
+
+    return $elements;
+  }
+
+  /**
+   * Return the class of the field.
+   */
+  function element_classes($row_index = NULL) {
+    $classes = explode(' ', $this->options['element_class']);
+    foreach ($classes as &$class) {
+      $class = $this->tokenize_value($class, $row_index);
+      $class = views_clean_css_identifier($class);
+    }
+    return implode(' ', $classes);
+  }
+
+  /**
+   * Replace a value with tokens from the last field.
+   *
+   * This function actually figures out which field was last and uses its
+   * tokens so they will all be available.
+   */
+  function tokenize_value($value, $row_index = NULL) {
+    if (strpos($value, '[') !== FALSE || strpos($value, '!') !== FALSE || strpos($value, '%') !== FALSE) {
+      $fake_item = array(
+        'alter_text' => TRUE,
+        'text' => $value,
+      );
+
+      // Use isset() because empty() will trigger on 0 and 0 is
+      // the first row.
+      if (isset($row_index) && isset($this->view->style_plugin->render_tokens[$row_index])) {
+        $tokens = $this->view->style_plugin->render_tokens[$row_index];
+      }
+      else {
+        // Get tokens from the last field.
+        $last_field = end($this->view->field);
+        if (isset($last_field->last_tokens)) {
+          $tokens = $last_field->last_tokens;
+        }
+        else {
+          $tokens = $last_field->get_render_tokens($fake_item);
+        }
+      }
+
+      $value = strip_tags($this->render_altered($fake_item, $tokens));
+      if (!empty($this->options['alter']['trim_whitespace'])) {
+        $value = trim($value);
+      }
+    }
+
+    return $value;
+  }
+
+  /**
+   * Return the class of the field's label.
+   */
+  function element_label_classes($row_index = NULL) {
+    $classes = explode(' ', $this->options['element_label_class']);
+    foreach ($classes as &$class) {
+      $class = $this->tokenize_value($class, $row_index);
+      $class = views_clean_css_identifier($class);
+    }
+    return implode(' ', $classes);
+  }
+
+  /**
+   * Return the class of the field's wrapper.
+   */
+  function element_wrapper_classes($row_index = NULL) {
+    $classes = explode(' ', $this->options['element_wrapper_class']);
+    foreach ($classes as &$class) {
+      $class = $this->tokenize_value($class, $row_index);
+      $class = views_clean_css_identifier($class);
+    }
+    return implode(' ', $classes);
+  }
+
+  /**
+   * Get the value that's supposed to be rendered.
+   *
+   * This api exists so that other modules can easy set the values of the field
+   * without having the need to change the render method as well.
+   *
+   * @param $values
+   *   An object containing all retrieved values.
+   * @param $field
+   *   Optional name of the field where the value is stored.
+   */
+  function get_value($values, $field = NULL) {
+    $alias = isset($field) && isset($this->aliases[$field]) ? $this->aliases[$field] : $this->field_alias;
+    if (isset($values->{$alias})) {
+      return $values->{$alias};
+    }
+  }
+
+  /**
+   * Determines if this field will be available as an option to group the result
+   * by in the style settings.
+   *
+   * @return bool
+   *  TRUE if this field handler is groupable, otherwise FALSE.
+   */
+  function use_string_group_by() {
+    return TRUE;
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['label'] = array('default' => $this->definition['title'], 'translatable' => TRUE);
+    $options['exclude'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['alter'] = array(
+      'contains' => array(
+        'alter_text' => array('default' => FALSE, 'bool' => TRUE),
+        'text' => array('default' => '', 'translatable' => TRUE),
+        'make_link' => array('default' => FALSE, 'bool' => TRUE),
+        'path' => array('default' => ''),
+        'absolute' => array('default' => FALSE, 'bool' => TRUE),
+        'external' => array('default' => FALSE, 'bool' => TRUE),
+        'replace_spaces' => array('default' => FALSE, 'bool' => TRUE),
+        'path_case' => array('default' => 'none', 'translatable' => FALSE),
+        'trim_whitespace' => array('default' => FALSE, 'bool' => TRUE),
+        'alt' => array('default' => '', 'translatable' => TRUE),
+        'rel' => array('default' => ''),
+        'link_class' => array('default' => ''),
+        'prefix' => array('default' => '', 'translatable' => TRUE),
+        'suffix' => array('default' => '', 'translatable' => TRUE),
+        'target' => array('default' => ''),
+        'nl2br' => array('default' => FALSE, 'bool' => TRUE),
+        'max_length' => array('default' => ''),
+        'word_boundary' => array('default' => TRUE, 'bool' => TRUE),
+        'ellipsis' => array('default' => TRUE, 'bool' => TRUE),
+        'more_link' => array('default' => FALSE, 'bool' => TRUE),
+        'more_link_text' => array('default' => '', 'translatable' => TRUE),
+        'more_link_path' => array('default' => ''),
+        'strip_tags' => array('default' => FALSE, 'bool' => TRUE),
+        'trim' => array('default' => FALSE, 'bool' => TRUE),
+        'preserve_tags' => array('default' => ''),
+        'html' => array('default' => FALSE, 'bool' => TRUE),
+      ),
+    );
+    $options['element_type'] = array('default' => '');
+    $options['element_class'] = array('default' => '');
+
+    $options['element_label_type'] = array('default' => '');
+    $options['element_label_class'] = array('default' => '');
+    $options['element_label_colon'] = array('default' => TRUE, 'bool' => TRUE);
+
+    $options['element_wrapper_type'] = array('default' => '');
+    $options['element_wrapper_class'] = array('default' => '');
+
+    $options['element_default_classes'] = array('default' => TRUE, 'bool' => TRUE);
+
+    $options['empty'] = array('default' => '', 'translatable' => TRUE);
+    $options['hide_empty'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['empty_zero'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['hide_alter_empty'] = array('default' => TRUE, 'bool' => TRUE);
+
+    return $options;
+  }
+
+  /**
+   * Performs some cleanup tasks on the options array before saving it.
+   */
+  function options_submit(&$form, &$form_state) {
+    $options = &$form_state['values']['options'];
+    $types = array('element_type', 'element_label_type', 'element_wrapper_type');
+    $classes = array_combine(array('element_class', 'element_label_class', 'element_wrapper_class'), $types);
+
+    foreach ($types as $type) {
+      if (!$options[$type . '_enable']) {
+        $options[$type] = '';
+      }
+    }
+
+    foreach ($classes as $class => $type) {
+      if (!$options[$class . '_enable'] || !$options[$type . '_enable']) {
+        $options[$class] = '';
+      }
+    }
+
+    if (empty($options['custom_label'])) {
+      $options['label'] = '';
+      $options['element_label_colon'] = FALSE;
+    }
+  }
+
+  /**
+   * Default options form that provides the label widget that all fields
+   * should have.
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $label = $this->label();
+    $form['custom_label'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Create a label'),
+      '#description' => t('Enable to create a label for this field.'),
+      '#default_value' => $label !== '',
+      '#weight' => -103,
+    );
+    $form['label'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Label'),
+      '#default_value' => $label,
+      '#dependency' => array(
+        'edit-options-custom-label' => array(1),
+      ),
+      '#weight' => -102,
+    );
+    $form['element_label_colon'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Place a colon after the label'),
+      '#default_value' => $this->options['element_label_colon'],
+      '#dependency' => array(
+        'edit-options-custom-label' => array(1),
+      ),
+      '#weight' => -101,
+    );
+
+    $form['exclude'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Exclude from display'),
+      '#default_value' => $this->options['exclude'],
+      '#description' => t('Enable to load this field as hidden. Often used to group fields, or to use as token in another field.'),
+      '#weight' => -100,
+    );
+
+    $form['style_settings'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Style settings'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+      '#weight' => 99,
+    );
+
+    $form['element_type_enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Customize field HTML'),
+      '#default_value' => !empty($this->options['element_type']) || (string) $this->options['element_type'] == '0' || !empty($this->options['element_class']) || (string) $this->options['element_class'] == '0',
+      '#fieldset' => 'style_settings',
+    );
+    $form['element_type'] = array(
+      '#title' => t('HTML element'),
+      '#options' => $this->get_elements(),
+      '#type' => 'select',
+      '#default_value' => $this->options['element_type'],
+      '#description' => t('Choose the HTML element to wrap around this field, e.g. H1, H2, etc.'),
+      '#dependency' => array(
+        'edit-options-element-type-enable' => array(1),
+      ),
+      '#fieldset' => 'style_settings',
+    );
+
+    $form['element_class_enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Create a CSS class'),
+      '#dependency' => array(
+        'edit-options-element-type-enable' => array(1),
+      ),
+      '#default_value' => !empty($this->options['element_class']) || (string) $this->options['element_class'] == '0',
+      '#fieldset' => 'style_settings',
+    );
+    $form['element_class'] = array(
+      '#title' => t('CSS class'),
+      '#description' => t('You may use token substitutions from the rewriting section in this class.'),
+      '#type' => 'textfield',
+      '#default_value' => $this->options['element_class'],
+      '#dependency' => array(
+        'edit-options-element-class-enable' => array(1),
+        'edit-options-element-type-enable' => array(1),
+      ),
+      '#dependency_count' => 2,
+      '#fieldset' => 'style_settings',
+    );
+
+    $form['element_label_type_enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Customize label HTML'),
+      '#default_value' => !empty($this->options['element_label_type']) || (string) $this->options['element_label_type'] == '0' || !empty($this->options['element_label_class']) || (string) $this->options['element_label_class'] == '0',
+      '#fieldset' => 'style_settings',
+    );
+    $form['element_label_type'] = array(
+      '#title' => t('Label HTML element'),
+      '#options' => $this->get_elements(FALSE),
+      '#type' => 'select',
+      '#default_value' => $this->options['element_label_type'],
+      '#description' => t('Choose the HTML element to wrap around this label, e.g. H1, H2, etc.'),
+      '#dependency' => array(
+        'edit-options-element-label-type-enable' => array(1),
+      ),
+      '#fieldset' => 'style_settings',
+    );
+    $form['element_label_class_enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Create a CSS class'),
+      '#dependency' => array(
+        'edit-options-element-label-type-enable' => array(1)
+      ),
+      '#default_value' => !empty($this->options['element_label_class']) || (string) $this->options['element_label_class'] == '0',
+      '#fieldset' => 'style_settings',
+    );
+    $form['element_label_class'] = array(
+      '#title' => t('CSS class'),
+      '#description' => t('You may use token substitutions from the rewriting section in this class.'),
+      '#type' => 'textfield',
+      '#default_value' => $this->options['element_label_class'],
+      '#dependency' => array(
+        'edit-options-element-label-class-enable' => array(1),
+        'edit-options-element-label-type-enable' => array(1),
+      ),
+      '#dependency_count' => 2,
+      '#fieldset' => 'style_settings',
+    );
+
+    $form['element_wrapper_type_enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Customize field and label wrapper HTML'),
+      '#default_value' => !empty($this->options['element_wrapper_type']) || (string) $this->options['element_wrapper_type'] == '0' || !empty($this->options['element_wrapper_class']) || (string) $this->options['element_wrapper_class'] == '0',
+      '#fieldset' => 'style_settings',
+    );
+    $form['element_wrapper_type'] = array(
+      '#title' => t('Wrapper HTML element'),
+      '#options' => $this->get_elements(FALSE),
+      '#type' => 'select',
+      '#default_value' => $this->options['element_wrapper_type'],
+      '#description' => t('Choose the HTML element to wrap around this field and label, e.g. H1, H2, etc. This may not be used if the field and label are not rendered together, such as with a table.'),
+      '#dependency' => array(
+        'edit-options-element-wrapper-type-enable' => array(1),
+      ),
+      '#fieldset' => 'style_settings',
+    );
+
+    $form['element_wrapper_class_enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Create a CSS class'),
+      '#dependency' => array(
+        'edit-options-element-wrapper-type-enable' => array(1),
+      ),
+      '#default_value' => !empty($this->options['element_wrapper_class']) || (string) $this->options['element_wrapper_class'] == '0',
+      '#fieldset' => 'style_settings',
+    );
+    $form['element_wrapper_class'] = array(
+      '#title' => t('CSS class'),
+      '#description' => t('You may use token substitutions from the rewriting section in this class.'),
+      '#type' => 'textfield',
+      '#default_value' => $this->options['element_wrapper_class'],
+      '#dependency' => array(
+        'edit-options-element-wrapper-class-enable' => array(1),
+        'edit-options-element-wrapper-type-enable' => array(1),
+      ),
+      '#dependency_count' => 2,
+      '#fieldset' => 'style_settings',
+    );
+
+    $form['element_default_classes'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Add default classes'),
+      '#default_value' => $this->options['element_default_classes'],
+      '#description' => t('Use default Views classes to identify the field, field label and field content.'),
+      '#fieldset' => 'style_settings',
+    );
+
+    $form['alter'] = array(
+      '#title' => t('Rewrite results'),
+      '#type' => 'fieldset',
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+      '#weight' => 100,
+    );
+
+    if ($this->allow_advanced_render()) {
+      $form['alter']['#tree'] = TRUE;
+      $form['alter']['alter_text'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Rewrite the output of this field'),
+        '#description' => t('Enable to override the output of this field with custom text or replacement tokens.'),
+        '#default_value' => $this->options['alter']['alter_text'],
+      );
+
+      $form['alter']['text'] = array(
+        '#title' => t('Text'),
+        '#type' => 'textarea',
+        '#default_value' => $this->options['alter']['text'],
+        '#description' => t('The text to display for this field. You may include HTML. You may enter data from this view as per the "Replacement patterns" below.'),
+        '#dependency' => array(
+          'edit-options-alter-alter-text' => array(1),
+        ),
+      );
+
+      $form['alter']['make_link'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Output this field as a link'),
+        '#description' => t('If checked, this field will be made into a link. The destination must be given below.'),
+        '#default_value' => $this->options['alter']['make_link'],
+      );
+      $form['alter']['path'] = array(
+        '#title' => t('Link path'),
+        '#type' => 'textfield',
+        '#default_value' => $this->options['alter']['path'],
+        '#description' => t('The Drupal path or absolute URL for this link. You may enter data from this view as per the "Replacement patterns" below.'),
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+        ),
+        '#maxlength' => 255,
+      );
+      $form['alter']['absolute'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Use absolute path'),
+        '#default_value' => $this->options['alter']['absolute'],
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+        ),
+      );
+      $form['alter']['replace_spaces'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Replace spaces with dashes'),
+        '#default_value' => $this->options['alter']['replace_spaces'],
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1)
+        ),
+      );
+      $form['alter']['external'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('External server URL'),
+        '#default_value' => $this->options['alter']['external'],
+        '#description' => t("Links to an external server using a full URL: e.g. 'http://www.example.com' or 'www.example.com'."),
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+        ),
+      );
+      $form['alter']['path_case'] = array(
+        '#type' => 'select',
+        '#title' => t('Transform the case'),
+        '#description' => t('When printing url paths, how to transform the case of the filter value.'),
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+        ),
+       '#options' => array(
+          'none' => t('No transform'),
+          'upper' => t('Upper case'),
+          'lower' => t('Lower case'),
+          'ucfirst' => t('Capitalize first letter'),
+          'ucwords' => t('Capitalize each word'),
+        ),
+        '#default_value' => $this->options['alter']['path_case'],
+      );
+      $form['alter']['link_class'] = array(
+        '#title' => t('Link class'),
+        '#type' => 'textfield',
+        '#default_value' => $this->options['alter']['link_class'],
+        '#description' => t('The CSS class to apply to the link.'),
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+        ),
+      );
+      $form['alter']['alt'] = array(
+        '#title' => t('Title text'),
+        '#type' => 'textfield',
+        '#default_value' => $this->options['alter']['alt'],
+        '#description' => t('Text to place as "title" text which most browsers display as a tooltip when hovering over the link.'),
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+        ),
+      );
+      $form['alter']['rel'] = array(
+        '#title' => t('Rel Text'),
+        '#type' => 'textfield',
+        '#default_value' => $this->options['alter']['rel'],
+        '#description' => t('Include Rel attribute for use in lightbox2 or other javascript utility.'),
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+        ),
+      );
+      $form['alter']['prefix'] = array(
+        '#title' => t('Prefix text'),
+        '#type' => 'textfield',
+        '#default_value' => $this->options['alter']['prefix'],
+        '#description' => t('Any text to display before this link. You may include HTML.'),
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+        ),
+      );
+      $form['alter']['suffix'] = array(
+        '#title' => t('Suffix text'),
+        '#type' => 'textfield',
+        '#default_value' => $this->options['alter']['suffix'],
+        '#description' => t('Any text to display after this link. You may include HTML.'),
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+        ),
+      );
+      $form['alter']['target'] = array(
+        '#title' => t('Target'),
+        '#type' => 'textfield',
+        '#default_value' => $this->options['alter']['target'],
+        '#description' => t("Target of the link, such as _blank, _parent or an iframe's name. This field is rarely used."),
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+        ),
+      );
+
+
+      // Get a list of the available fields and arguments for token replacement.
+      $options = array();
+      foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
+        $options[t('Fields')]["[$field]"] = $handler->ui_name();
+        // We only use fields up to (and including) this one.
+        if ($field == $this->options['id']) {
+          break;
+        }
+      }
+      $count = 0; // This lets us prepare the key as we want it printed.
+      foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
+        $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->ui_name()));
+        $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->ui_name()));
+      }
+
+      $this->document_self_tokens($options[t('Fields')]);
+
+      // Default text.
+      $output = t('<p>You must add some additional fields to this display before using this field. These fields may be marked as <em>Exclude from display</em> if you prefer. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.</p>');
+      // We have some options, so make a list.
+      if (!empty($options)) {
+        $output = t('<p>The following tokens are available for this field. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.
+If you would like to have the characters \'[\' and \']\' please use the html entity codes \'%5B\' or  \'%5D\' or they will get replaced with empty space.</p>');
+        foreach (array_keys($options) as $type) {
+          if (!empty($options[$type])) {
+            $items = array();
+            foreach ($options[$type] as $key => $value) {
+              $items[] = $key . ' == ' . check_plain($value);
+            }
+            $output .= theme('item_list',
+              array(
+                'items' => $items,
+                'type' => $type
+              ));
+          }
+        }
+      }
+      // This construct uses 'hidden' and not markup because process doesn't
+      // run. It also has an extra div because the dependency wants to hide
+      // the parent in situations like this, so we need a second div to
+      // make this work.
+      $form['alter']['help'] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Replacement patterns'),
+        '#collapsible' => TRUE,
+        '#collapsed' => TRUE,
+        '#value' => $output,
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1),
+          'edit-options-alter-alter-text' => array(1),
+          'edit-options-alter-more-link' => array(1),
+        ),
+      );
+
+      $form['alter']['trim'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Trim this field to a maximum length'),
+        '#description' => t('Enable to trim the field to a maximum length of characters'),
+        '#default_value' => $this->options['alter']['trim'],
+      );
+
+      $form['alter']['max_length'] = array(
+        '#title' => t('Maximum length'),
+        '#type' => 'textfield',
+        '#default_value' => $this->options['alter']['max_length'],
+        '#description' => t('The maximum number of characters this field can be.'),
+        '#dependency' => array(
+          'edit-options-alter-trim' => array(1),
+        ),
+      );
+
+      $form['alter']['word_boundary'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Trim only on a word boundary'),
+        '#description' => t('If checked, this field be trimmed only on a word boundary. This is guaranteed to be the maximum characters stated or less. If there are no word boundaries this could trim a field to nothing.'),
+        '#default_value' => $this->options['alter']['word_boundary'],
+        '#dependency' => array(
+          'edit-options-alter-trim' => array(1),
+        ),
+      );
+
+      $form['alter']['ellipsis'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Add an ellipsis'),
+        '#description' => t('If checked, a "..." will be added if a field was trimmed.'),
+        '#default_value' => $this->options['alter']['ellipsis'],
+        '#dependency' => array(
+          'edit-options-alter-trim' => array(1),
+        ),
+      );
+
+      $form['alter']['more_link'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Add a read-more link if output is trimmed.'),
+        '#description' => t('If checked, a read-more link will be added at the end of the trimmed output'),
+        '#default_value' => $this->options['alter']['more_link'],
+        '#dependency' => array(
+          'edit-options-alter-trim' => array(1),
+        ),
+      );
+
+      $form['alter']['more_link_text'] = array(
+        '#type' => 'textfield',
+        '#title' => t('More link text'),
+        '#default_value' => $this->options['alter']['more_link_text'],
+        '#description' => t('The text which will be displayed on the more link. You may enter data from this view as per the "Replacement patterns" above.'),
+        '#dependency_count' => 2,
+        '#dependency' => array(
+          'edit-options-alter-trim' => array(1),
+          'edit-options-alter-more-link' => array(1),
+        ),
+      );
+      $form['alter']['more_link_path'] = array(
+        '#type' => 'textfield',
+        '#title' => t('More link path'),
+        '#default_value' => $this->options['alter']['more_link_path'],
+        '#description' => t('The path which is used for the more link. You may enter data from this view as per the "Replacement patterns" above.'),
+        '#dependency_count' => 2,
+        '#dependency' => array(
+          'edit-options-alter-trim' => array(1),
+          'edit-options-alter-more-link' => array(1),
+        ),
+      );
+
+      $form['alter']['html'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Field can contain HTML'),
+        '#description' => t('If checked, HTML corrector will be run to ensure tags are properly closed after trimming.'),
+        '#default_value' => $this->options['alter']['html'],
+        '#dependency' => array(
+          'edit-options-alter-trim' => array(1),
+        ),
+      );
+
+      $form['alter']['strip_tags'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Strip HTML tags'),
+        '#description' => t('If checked, all HTML tags will be stripped.'),
+        '#default_value' => $this->options['alter']['strip_tags'],
+      );
+
+      $form['alter']['preserve_tags'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Preserve certain tags'),
+        '#description' => t('List the tags that need to be preserved during the stripping process. example &quot;&lt;p&gt; &lt;br&gt;&quot; which will preserve all p and br elements'),
+        '#default_value' => $this->options['alter']['preserve_tags'],
+        '#dependency' => array(
+          'edit-options-alter-strip-tags' => array(1),
+        ),
+      );
+
+      $form['alter']['trim_whitespace'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Remove whitespace'),
+        '#description' => t('If checked, all whitespaces at the beginning and the end of the output will be removed.'),
+        '#default_value' => $this->options['alter']['trim_whitespace'],
+      );
+
+      $form['alter']['nl2br'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Convert newlines to HTML &lt;br&gt; tags'),
+        '#description' => t('If checked, all newlines chars (e.g. \n) are converted into HTML &lt;br&gt; tags.'),
+        '#default_value' => $this->options['alter']['nl2br'],
+      );
+    }
+
+    $form['empty_field_behavior'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('No results behavior'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+      '#weight' => 100,
+    );
+
+    $form['empty'] = array(
+      '#type' => 'textarea',
+      '#title' => t('No results text'),
+      '#default_value' => $this->options['empty'],
+      '#description' => t('Provide text to display if this field contains an empty result. You may include HTML. You may enter data from this view as per the "Replacement patterns" in the "Rewrite Results" section below.'),
+      '#fieldset' => 'empty_field_behavior',
+    );
+
+    $form['empty_zero'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Count the number 0 as empty'),
+      '#default_value' => $this->options['empty_zero'],
+      '#description' => t('Enable to display the "no results text" if the field contains the number 0.'),
+      '#fieldset' => 'empty_field_behavior',
+    );
+
+    $form['hide_empty'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Hide if empty'),
+      '#default_value' => $this->options['hide_empty'],
+      '#description' => t('Enable to hide this field if it is empty. Note that the field label or rewritten output may still be displayed. To hide labels, check the style or row style settings for empty fields. To hide rewritten content, check the "Hide rewriting if empty" checkbox.'),
+      '#fieldset' => 'empty_field_behavior',
+    );
+
+    $form['hide_alter_empty'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Hide rewriting if empty'),
+      '#default_value' => $this->options['hide_alter_empty'],
+      '#description' => t('Do not display rewritten content if this field is empty.'),
+      '#fieldset' => 'empty_field_behavior',
+    );
+  }
+
+  /**
+   * Provide extra data to the administration form
+   */
+  function admin_summary() {
+    return $this->label();
+  }
+
+  /**
+   * Run before any fields are rendered.
+   *
+   * This gives the handlers some time to set up before any handler has
+   * been rendered.
+   *
+   * @param $values
+   *   An array of all objects returned from the query.
+   */
+  function pre_render(&$values) { }
+
+  /**
+   * Render the field.
+   *
+   * @param $values
+   *   The values retrieved from the database.
+   */
+  function render($values) {
+    $value = $this->get_value($values);
+    return $this->sanitize_value($value);
+  }
+
+  /**
+   * Render a field using advanced settings.
+   *
+   * This renders a field normally, then decides if render-as-link and
+   * text-replacement rendering is necessary.
+   */
+  function advanced_render($values) {
+    if ($this->allow_advanced_render() && method_exists($this, 'render_item')) {
+      $raw_items = $this->get_items($values);
+      // If there are no items, set the original value to NULL.
+      if (empty($raw_items)) {
+        $this->original_value = NULL;
+      }
+    }
+    else {
+      $value = $this->render($values);
+      if (is_array($value)) {
+        $value = drupal_render($value);
+      }
+      $this->last_render = $value;
+      $this->original_value = $value;
+    }
+
+    if ($this->allow_advanced_render()) {
+      $tokens = NULL;
+      if (method_exists($this, 'render_item')) {
+        $items = array();
+        foreach ($raw_items as $count => $item) {
+          $value = $this->render_item($count, $item);
+          if (is_array($value)) {
+            $value = drupal_render($value);
+          }
+          $this->last_render = $value;
+          $this->original_value = $this->last_render;
+
+          $alter = $item + $this->options['alter'];
+          $alter['phase'] = VIEWS_HANDLER_RENDER_TEXT_PHASE_SINGLE_ITEM;
+          $items[] = $this->render_text($alter);
+        }
+
+        $value = $this->render_items($items);
+      }
+      else {
+        $alter = array('phase' => VIEWS_HANDLER_RENDER_TEXT_PHASE_COMPLETELY) + $this->options['alter'];
+        $value = $this->render_text($alter);
+      }
+
+      if (is_array($value)) {
+        $value = drupal_render($value);
+      }
+      // This happens here so that render_as_link can get the unaltered value of
+      // this field as a token rather than the altered value.
+      $this->last_render = $value;
+    }
+
+    if (empty($this->last_render)) {
+      if ($this->is_value_empty($this->last_render, $this->options['empty_zero'], FALSE)) {
+        $alter = $this->options['alter'];
+        $alter['alter_text'] = 1;
+        $alter['text'] = $this->options['empty'];
+        $alter['phase'] = VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY;
+        $this->last_render = $this->render_text($alter);
+      }
+    }
+
+    return $this->last_render;
+  }
+
+  /**
+   * Checks if a field value is empty.
+   *
+   * @param $value
+   *   The field value.
+   * @param bool $empty_zero
+   *   Whether or not this field is configured to consider 0 as empty.
+   * @param bool $no_skip_empty
+   *   Whether or not to use empty() to check the value.
+   *
+   * @return bool
+   * TRUE if the value is considered empty, FALSE otherwise.
+   */
+  function is_value_empty($value, $empty_zero, $no_skip_empty = TRUE) {
+    if (!isset($value)) {
+      $empty = TRUE;
+    }
+    else {
+      $empty = ($empty_zero || ($value !== 0 && $value !== '0'));
+    }
+
+    if ($no_skip_empty) {
+      $empty = empty($value) && $empty;
+    }
+    return $empty;
+  }
+
+  /**
+   * Perform an advanced text render for the item.
+   *
+   * This is separated out as some fields may render lists, and this allows
+   * each item to be handled individually.
+   */
+  function render_text($alter) {
+    $value = $this->last_render;
+
+    if (!empty($alter['alter_text']) && $alter['text'] !== '') {
+      $tokens = $this->get_render_tokens($alter);
+      $value = $this->render_altered($alter, $tokens);
+    }
+
+    if (!empty($this->options['alter']['trim_whitespace'])) {
+      $value = trim($value);
+    }
+
+    // Check if there should be no further rewrite for empty values.
+    $no_rewrite_for_empty = $this->options['hide_alter_empty'] && $this->is_value_empty($this->original_value, $this->options['empty_zero']);
+
+    // Check whether the value is empty and return nothing, so the field isn't rendered.
+    // First check whether the field should be hidden if the value(hide_alter_empty = TRUE) /the rewrite is empty (hide_alter_empty = FALSE).
+    // For numeric values you can specify whether "0"/0 should be empty.
+    if ((($this->options['hide_empty'] && empty($value))
+        || ($alter['phase'] != VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty))
+      && $this->is_value_empty($value, $this->options['empty_zero'], FALSE)) {
+      return '';
+    }
+    // Only in empty phase.
+    if ($alter['phase'] == VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty) {
+      // If we got here then $alter contains the value of "No results text"
+      // and so there is nothing left to do.
+      return $value;
+    }
+
+    if (!empty($alter['strip_tags'])) {
+      $value = strip_tags($value, $alter['preserve_tags']);
+    }
+
+    $suffix = '';
+    if (!empty($alter['trim']) && !empty($alter['max_length'])) {
+      $length = strlen($value);
+      $value = $this->render_trim_text($alter, $value);
+      if ($this->options['alter']['more_link'] && strlen($value) < $length) {
+        $tokens = $this->get_render_tokens($alter);
+        $more_link_text = $this->options['alter']['more_link_text'] ? $this->options['alter']['more_link_text'] : t('more');
+        $more_link_text = strtr(filter_xss_admin($more_link_text), $tokens);
+        $more_link_path = $this->options['alter']['more_link_path'];
+        $more_link_path = strip_tags(decode_entities(strtr($more_link_path, $tokens)));
+
+        // Take sure that paths which was runned through url() does work as well.
+        $base_path = base_path();
+        // Checks whether the path starts with the base_path.
+        if (strpos($more_link_path, $base_path) === 0) {
+          $more_link_path = drupal_substr($more_link_path, drupal_strlen($base_path));
+        }
+
+        $more_link = l($more_link_text, $more_link_path, array('attributes' => array('class' => array('views-more-link'))));
+
+        $suffix .= " " . $more_link;
+      }
+    }
+
+    if (!empty($alter['nl2br'])) {
+      $value = nl2br($value);
+    }
+    $this->last_render_text = $value;
+
+    if (!empty($alter['make_link']) && !empty($alter['path'])) {
+      if (!isset($tokens)) {
+       $tokens = $this->get_render_tokens($alter);
+      }
+      $value = $this->render_as_link($alter, $value, $tokens);
+    }
+
+    return $value . $suffix;
+  }
+
+  /**
+   * Render this field as altered text, from a fieldset set by the user.
+   */
+  function render_altered($alter, $tokens) {
+    // Filter this right away as our substitutions are already sanitized.
+    $value = filter_xss_admin($alter['text']);
+    $value = strtr($value, $tokens);
+
+    return $value;
+  }
+
+  /**
+   * Trim the field down to the specified length.
+   */
+  function render_trim_text($alter, $value) {
+    if (!empty($alter['strip_tags'])) {
+      // NOTE: It's possible that some external fields might override the
+      // element type so if someone from, say, CCK runs into a bug here,
+      // this may be why =)
+      $this->definition['element type'] = 'span';
+    }
+    return views_trim_text($alter, $value);
+  }
+
+  /**
+   * Render this field as a link, with the info from a fieldset set by
+   * the user.
+   */
+  function render_as_link($alter, $text, $tokens) {
+    $value = '';
+
+    if (!empty($alter['prefix'])) {
+      $value .= filter_xss_admin(strtr($alter['prefix'], $tokens));
+    }
+
+    $options = array(
+      'html' => TRUE,
+      'absolute' => !empty($alter['absolute']) ? TRUE : FALSE,
+    );
+
+    // $path will be run through check_url() by l() so we do not need to
+    // sanitize it ourselves.
+    $path = $alter['path'];
+
+    // strip_tags() removes <front>, so check whether its different to front.
+    if ($path != '<front>') {
+      // Use strip tags as there should never be HTML in the path.
+      // However, we need to preserve special characters like " that
+      // were removed by check_plain().
+      $path = strip_tags(decode_entities(strtr($path, $tokens)));
+
+      if (!empty($alter['path_case']) && $alter['path_case'] != 'none') {
+        $path = $this->case_transform($path, $this->options['alter']['path_case']);
+      }
+
+      if (!empty($alter['replace_spaces'])) {
+        $path = str_replace(' ', '-', $path);
+      }
+    }
+
+    // Parse the URL and move any query and fragment parameters out of the path.
+    $url = parse_url($path);
+
+    // Seriously malformed URLs may return FALSE or empty arrays.
+    if (empty($url)) {
+      return $text;
+    }
+
+    // If the path is empty do not build a link around the given text and return
+    // it as is.
+    // http://www.example.com URLs will not have a $url['path'], so check host as well.
+    if (empty($url['path']) && empty($url['host']) && empty($url['fragment'])) {
+      return $text;
+    }
+
+    // If no scheme is provided in the $path, assign the default 'http://'.
+    // This allows a url of 'www.example.com' to be converted to 'http://www.example.com'.
+    // Only do this on for external URLs.
+    if ($alter['external']){
+      if (!isset($url['scheme'])) {
+        // There is no scheme, add the default 'http://' to the $path.
+        $path = "http://$path";
+        // Reset the $url array to include the new scheme.
+        $url = parse_url($path);
+      }
+    }
+
+    if (isset($url['query'])) {
+      $path = strtr($path, array('?' . $url['query'] => ''));
+      $query = drupal_get_query_array($url['query']);
+      // Remove query parameters that were assigned a query string replacement
+      // token for which there is no value available.
+      foreach ($query as $param => $val) {
+        if ($val == '%' . $param) {
+          unset($query[$param]);
+        }
+      }
+      $options['query'] = $query;
+    }
+    if (isset($url['fragment'])) {
+      $path = strtr($path, array('#' . $url['fragment'] => ''));
+      // If the path is empty we want to have a fragment for the current site.
+      if ($path == '') {
+        $options['external'] = TRUE;
+      }
+      $options['fragment'] = $url['fragment'];
+    }
+
+    $alt = strtr($alter['alt'], $tokens);
+    // Set the title attribute of the link only if it improves accessibility
+    if ($alt && $alt != $text) {
+      $options['attributes']['title'] = decode_entities($alt);
+    }
+
+    $class = strtr($alter['link_class'], $tokens);
+    if ($class) {
+      $options['attributes']['class'] = array($class);
+    }
+
+    if (!empty($alter['rel']) && $rel = strtr($alter['rel'], $tokens)) {
+      $options['attributes']['rel'] = $rel;
+    }
+
+    $target = check_plain(trim(strtr($alter['target'],$tokens)));
+    if (!empty($target)) {
+      $options['attributes']['target'] = $target;
+    }
+
+    // Allow the addition of arbitrary attributes to links. Additional attributes
+    // currently can only be altered in preprocessors and not within the UI.
+    if (isset($alter['link_attributes']) && is_array($alter['link_attributes'])) {
+      foreach ($alter['link_attributes'] as $key => $attribute) {
+        if (!isset($options['attributes'][$key])) {
+          $options['attributes'][$key] = strtr($attribute, $tokens);
+        }
+      }
+    }
+
+    // If the query and fragment were programatically assigned overwrite any
+    // parsed values.
+    if (isset($alter['query'])) {
+      // Convert the query to a string, perform token replacement, and then
+      // convert back to an array form for l().
+      $options['query'] = drupal_http_build_query($alter['query']);
+      $options['query'] = strtr($options['query'], $tokens);
+      $options['query'] = drupal_get_query_array($options['query']);
+    }
+    if (isset($alter['alias'])) {
+      // Alias is a boolean field, so no token.
+      $options['alias'] = $alter['alias'];
+    }
+    if (isset($alter['fragment'])) {
+      $options['fragment'] = strtr($alter['fragment'], $tokens);
+    }
+    if (isset($alter['language'])) {
+      $options['language'] = $alter['language'];
+    }
+
+    // If the url came from entity_uri(), pass along the required options.
+    if (isset($alter['entity'])) {
+      $options['entity'] = $alter['entity'];
+    }
+    if (isset($alter['entity_type'])) {
+      $options['entity_type'] = $alter['entity_type'];
+    }
+
+    $value .= l($text, $path, $options);
+
+    if (!empty($alter['suffix'])) {
+      $value .= filter_xss_admin(strtr($alter['suffix'], $tokens));
+    }
+
+    return $value;
+  }
+
+  /**
+   * Get the 'render' tokens to use for advanced rendering.
+   *
+   * This runs through all of the fields and arguments that
+   * are available and gets their values. This will then be
+   * used in one giant str_replace().
+   */
+  function get_render_tokens($item) {
+    $tokens = array();
+    if (!empty($this->view->build_info['substitutions'])) {
+      $tokens = $this->view->build_info['substitutions'];
+    }
+    $count = 0;
+    foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
+      $token = '%' . ++$count;
+      if (!isset($tokens[$token])) {
+        $tokens[$token] = '';
+      }
+
+      // Use strip tags as there should never be HTML in the path.
+      // However, we need to preserve special characters like " that
+      // were removed by check_plain().
+      $tokens['!' . $count] = isset($this->view->args[$count - 1]) ? strip_tags(decode_entities($this->view->args[$count - 1])) : '';
+    }
+
+    // Get flattened set of tokens for any array depth in $_GET parameters.
+    $tokens += $this->get_token_values_recursive($_GET);
+
+    // Now add replacements for our fields.
+    foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
+      if (isset($handler->last_render)) {
+        $tokens["[$field]"] = $handler->last_render;
+      }
+      else {
+        $tokens["[$field]"] = '';
+      }
+      if (!empty($item)) {
+        $this->add_self_tokens($tokens, $item);
+      }
+
+      // We only use fields up to (and including) this one.
+      if ($field == $this->options['id']) {
+        break;
+      }
+    }
+
+    // Store the tokens for the row so we can reference them later if necessary.
+    $this->view->style_plugin->render_tokens[$this->view->row_index] = $tokens;
+    $this->last_tokens = $tokens;
+
+    return $tokens;
+  }
+
+  /**
+   * Recursive function to add replacements for nested query string parameters.
+   *
+   * E.g. if you pass in the following array:
+   *   array(
+   *     'foo' => array(
+   *       'a' => 'value',
+   *       'b' => 'value',
+   *     ),
+   *     'bar' => array(
+   *       'a' => 'value',
+   *       'b' => array(
+   *         'c' => value,
+   *       ),
+   *     ),
+   *   );
+   *
+   * Would yield the following array of tokens:
+   *   array(
+   *     '%foo_a' => 'value'
+   *     '%foo_b' => 'value'
+   *     '%bar_a' => 'value'
+   *     '%bar_b_c' => 'value'
+   *   );
+   *
+   * @param $array
+   *   An array of values.
+   *
+   * @param $parent_keys
+   *   An array of parent keys. This will represent the array depth.
+   *
+   * @return
+   *   An array of available tokens, with nested keys representative of the array structure.
+   */
+  function get_token_values_recursive(array $array, array $parent_keys = array()) {
+    $tokens = array();
+
+    foreach ($array as $param => $val) {
+      if (is_array($val)) {
+         // Copy parent_keys array, so we don't afect other elements of this iteration.
+         $child_parent_keys = $parent_keys;
+         $child_parent_keys[] = $param;
+         // Get the child tokens.
+         $child_tokens = $this->get_token_values_recursive($val, $child_parent_keys);
+         // Add them to the current tokens array.
+         $tokens += $child_tokens;
+      }
+      else {
+        // Create a token key based on array element structure.
+        $token_string = !empty($parent_keys) ? implode('_', $parent_keys) . '_' . $param : $param;
+        $tokens['%' . $token_string] = strip_tags(decode_entities($val));
+      }
+    }
+
+    return $tokens;
+  }
+
+  /**
+   * Add any special tokens this field might use for itself.
+   *
+   * This method is intended to be overridden by items that generate
+   * fields as a list. For example, the field that displays all terms
+   * on a node might have tokens for the tid and the term.
+   *
+   * By convention, tokens should follow the format of [token-subtoken]
+   * where token is the field ID and subtoken is the field. If the
+   * field ID is terms, then the tokens might be [terms-tid] and [terms-name].
+   */
+  function add_self_tokens(&$tokens, $item) { }
+
+  /**
+   * Document any special tokens this field might use for itself.
+   *
+   * @see add_self_tokens()
+   */
+  function document_self_tokens(&$tokens) { }
+
+  /**
+   * Call out to the theme() function, which probably just calls render() but
+   * allows sites to override output fairly easily.
+   */
+  function theme($values) {
+    return theme($this->theme_functions(),
+      array(
+        'view' => $this->view,
+        'field' => $this,
+        'row' => $values
+      ));
+  }
+
+  function theme_functions() {
+    $themes = array();
+    $hook = 'views_view_field';
+
+    $display = $this->view->display[$this->view->current_display];
+
+    if (!empty($display)) {
+      $themes[] = $hook . '__' . $this->view->name  . '__' . $display->id . '__' . $this->options['id'];
+      $themes[] = $hook . '__' . $this->view->name  . '__' . $display->id;
+      $themes[] = $hook . '__' . $display->id . '__' . $this->options['id'];
+      $themes[] = $hook . '__' . $display->id;
+      if ($display->id != $display->display_plugin) {
+        $themes[] = $hook . '__' . $this->view->name  . '__' . $display->display_plugin . '__' . $this->options['id'];
+        $themes[] = $hook . '__' . $this->view->name  . '__' . $display->display_plugin;
+        $themes[] = $hook . '__' . $display->display_plugin . '__' . $this->options['id'];
+        $themes[] = $hook . '__' . $display->display_plugin;
+      }
+    }
+    $themes[] = $hook . '__' . $this->view->name . '__' . $this->options['id'];
+    $themes[] = $hook . '__' . $this->view->name;
+    $themes[] = $hook . '__' . $this->options['id'];
+    $themes[] = $hook;
+
+    return $themes;
+  }
+
+  function ui_name($short = FALSE) {
+    return $this->get_field(parent::ui_name($short));
+  }
+}
+
+/**
+ * A special handler to take the place of missing or broken handlers.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_broken extends views_handler_field {
+  function ui_name($short = FALSE) {
+    return t('Broken/missing handler');
+  }
+
+  function ensure_my_table() { /* No table to ensure! */ }
+  function query($group_by = FALSE) { /* No query to run */ }
+  function options_form(&$form, &$form_state) {
+    $form['markup'] = array(
+      '#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
+    );
+  }
+
+  /**
+   * Determine if the handler is considered 'broken'
+   */
+  function broken() { return TRUE; }
+}
+
+/**
+ * Render a numeric value as a size.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_file_size extends views_handler_field {
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['file_size_display'] = array('default' => 'formatted');
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    $form['file_size_display'] = array(
+      '#title' => t('File size display'),
+      '#type' => 'select',
+      '#options' => array(
+        'formatted' => t('Formatted (in KB or MB)'),
+        'bytes' => t('Raw bytes'),
+      ),
+    );
+  }
+
+  function render($values) {
+    $value = $this->get_value($values);
+    if ($value) {
+      switch ($this->options['file_size_display']) {
+        case 'bytes':
+          return $value;
+        case 'formatted':
+        default:
+          return format_size($value);
+      }
+    }
+    else {
+      return '';
+    }
+  }
+}
+
+/**
+ * A handler to run a field through simple XSS filtering.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_xss extends views_handler_field {
+  function render($values) {
+    $value = $this->get_value($values);
+    return $this->sanitize_value($value, 'xss');
+  }
+}
+
+/**
+ * @}
+ */

+ 110 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_boolean.inc

@@ -0,0 +1,110 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_boolean.
+ */
+
+/**
+ * A handler to provide proper displays for booleans.
+ *
+ * Allows for display of true/false, yes/no, on/off, enabled/disabled.
+ *
+ * Definition terms:
+ *   - output formats: An array where the first entry is displayed on boolean true
+ *      and the second is displayed on boolean false. An example for sticky is:
+ *      @code
+ *      'output formats' => array(
+ *        'sticky' => array(t('Sticky'), ''),
+ *      ),
+ *      @endcode
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_boolean extends views_handler_field {
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['type'] = array('default' => 'yes-no');
+    $options['type_custom_true'] = array('default' => '', 'translatable' => TRUE);
+    $options['type_custom_false'] = array('default' => '', 'translatable' => TRUE);
+    $options['not'] = array('definition bool' => 'reverse');
+
+    return $options;
+  }
+
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+
+    $default_formats = array(
+      'yes-no' => array(t('Yes'), t('No')),
+      'true-false' => array(t('True'), t('False')),
+      'on-off' => array(t('On'), t('Off')),
+      'enabled-disabled' => array(t('Enabled'), t('Disabled')),
+      'boolean' => array(1, 0),
+      'unicode-yes-no' => array('✔', '✖'),
+    );
+    $output_formats = isset($this->definition['output formats']) ? $this->definition['output formats'] : array();
+    $custom_format = array('custom' => array(t('Custom')));
+    $this->formats = array_merge($default_formats, $output_formats, $custom_format);
+  }
+
+  function options_form(&$form, &$form_state) {
+    foreach ($this->formats as $key => $item) {
+      $options[$key] = implode('/', $item);
+    }
+
+    $form['type'] = array(
+      '#type' => 'select',
+      '#title' => t('Output format'),
+      '#options' => $options,
+      '#default_value' => $this->options['type'],
+    );
+
+    $form['type_custom_true'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Custom output for TRUE'),
+      '#default_value' => $this->options['type_custom_true'],
+      '#states' => array(
+        'visible' => array(
+          'select[name="options[type]"]' => array('value' => 'custom'),
+        ),
+      ),
+    );
+
+    $form['type_custom_false'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Custom output for FALSE'),
+      '#default_value' => $this->options['type_custom_false'],
+      '#states' => array(
+        'visible' => array(
+          'select[name="options[type]"]' => array('value' => 'custom'),
+        ),
+      ),
+    );
+
+    $form['not'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Reverse'),
+      '#description' => t('If checked, true will be displayed as false.'),
+      '#default_value' => $this->options['not'],
+    );
+    parent::options_form($form, $form_state);
+  }
+
+  function render($values) {
+    $value = $this->get_value($values);
+    if (!empty($this->options['not'])) {
+      $value = !$value;
+    }
+
+    if ($this->options['type'] == 'custom') {
+      return $value ? filter_xss_admin($this->options['type_custom_true']) : filter_xss_admin($this->options['type_custom_false']);
+    }
+    else if (isset($this->formats[$this->options['type']])) {
+      return $value ? $this->formats[$this->options['type']][0] : $this->formats[$this->options['type']][1];
+    }
+    else {
+      return $value ? $this->formats['yes-no'][0] : $this->formats['yes-no'][1];
+    }
+  }
+}

+ 102 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_contextual_links.inc

@@ -0,0 +1,102 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_contextual_links.
+ */
+
+/**
+ * Provides a handler that adds contextual links.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_contextual_links extends views_handler_field {
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['fields'] = array('default' => array());
+    $options['destination'] = array('default' => TRUE, 'bool' => TRUE);
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    $all_fields = $this->view->display_handler->get_field_labels();
+    // Offer to include only those fields that follow this one.
+    $field_options = array_slice($all_fields, 0, array_search($this->options['id'], array_keys($all_fields)));
+    $form['fields'] = array(
+      '#type' => 'checkboxes',
+      '#title' => t('Fields'),
+      '#description' => t('Fields to be included as contextual links.'),
+      '#options' => $field_options,
+      '#default_value' => $this->options['fields'],
+    );
+    $form['destination'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Include destination'),
+      '#description' => t('Include a "destination" parameter in the link to return the user to the original view upon completing the contextual action.'),
+      '#default_value' => $this->options['destination'],
+    );
+  }
+
+  function pre_render(&$values) {
+    // Add a row plugin css class for the contextual link.
+    $class = 'contextual-links-region';
+    if (!empty($this->view->style_plugin->options['row_class'])) {
+      $this->view->style_plugin->options['row_class'] .= " $class";
+    }
+    else {
+      $this->view->style_plugin->options['row_class'] = $class;
+    }
+  }
+
+  /**
+   * Render the contextual fields.
+   */
+  function render($values) {
+    $links = array();
+    foreach ($this->options['fields'] as $field) {
+      if (empty($this->view->style_plugin->rendered_fields[$this->view->row_index][$field])) {
+        continue;
+      }
+      $title = $this->view->field[$field]->last_render_text;
+      $path = '';
+      if (!empty($this->view->field[$field]->options['alter']['path'])) {
+        $path = $this->view->field[$field]->options['alter']['path'];
+      }
+      if (!empty($title) && !empty($path)) {
+        // Make sure that tokens are replaced for this paths as well.
+        $tokens = $this->get_render_tokens(array());
+        $path = strip_tags(decode_entities(strtr($path, $tokens)));
+
+        $links[$field] = array(
+          'href' => $path,
+          'title' => $title,
+        );
+        if (!empty($this->options['destination'])) {
+          $links[$field]['query'] = drupal_get_destination();
+        }
+      }
+    }
+
+    if (!empty($links)) {
+      $build = array(
+        '#prefix' => '<div class="contextual-links-wrapper">',
+        '#suffix' => '</div>',
+        '#theme' => 'links__contextual',
+        '#links' => $links,
+        '#attributes' => array('class' => array('contextual-links')),
+        '#attached' => array(
+          'library' => array(array('contextual', 'contextual-links')),
+        ),
+        '#access' => user_access('access contextual links'),
+      );
+      return drupal_render($build);
+    }
+    else {
+      return '';
+    }
+  }
+
+  function query() { }
+}

+ 50 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_counter.inc

@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_counter.
+ */
+
+/**
+ * Field handler to show a counter of the current row.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_counter extends views_handler_field {
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['counter_start'] = array('default' => 1);
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    $form['counter_start'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Starting value'),
+      '#default_value' => $this->options['counter_start'],
+      '#description' => t('Specify the number the counter should start at.'),
+      '#size' => 2,
+    );
+
+    parent::options_form($form, $form_state);
+  }
+
+  function query() {
+    // do nothing -- to override the parent query.
+  }
+
+  function render($values) {
+    // Note:  1 is subtracted from the counter start value below because the
+    // counter value is incremented by 1 at the end of this function.
+    $count = is_numeric($this->options['counter_start']) ? $this->options['counter_start'] - 1 : 0;
+    $pager = $this->view->query->pager;
+    // Get the base count of the pager.
+    if ($pager->use_pager()) {
+      $count += ($pager->get_items_per_page() * $pager->get_current_page() + $pager->get_offset());
+    }
+    // Add the counter for the current site.
+    $count += $this->view->row_index + 1;
+
+    return $count;
+  }
+}

+ 55 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_custom.inc

@@ -0,0 +1,55 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_custom.
+ */
+
+/**
+ * A handler to provide a field that is completely custom by the administrator.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_custom extends views_handler_field {
+  function query() {
+    // do nothing -- to override the parent query.
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    // Override the alter text option to always alter the text.
+    $options['alter']['contains']['alter_text'] = array('default' => TRUE, 'bool' => TRUE);
+    $options['hide_alter_empty'] = array('default' => FALSE, 'bool' => TRUE);
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    // Remove the checkbox
+    unset($form['alter']['alter_text']);
+    unset($form['alter']['text']['#dependency']);
+    unset($form['alter']['text']['#process']);
+    unset($form['alter']['help']['#dependency']);
+    unset($form['alter']['help']['#process']);
+    $form['#pre_render'][] = 'views_handler_field_custom_pre_render_move_text';
+  }
+
+  function render($values) {
+    // Return the text, so the code never thinks the value is empty.
+    return $this->options['alter']['text'];
+  }
+}
+
+/**
+ * Prerender function to move the textarea to the top.
+ */
+function views_handler_field_custom_pre_render_move_text($form) {
+  $form['text'] = $form['alter']['text'];
+  $form['help'] = $form['alter']['help'];
+  unset($form['alter']['text']);
+  unset($form['alter']['help']);
+
+  return $form;
+}

+ 101 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_date.inc

@@ -0,0 +1,101 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_date.
+ */
+
+/**
+ * A handler to provide proper displays for dates.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_date extends views_handler_field {
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['date_format'] = array('default' => 'small');
+    $options['custom_date_format'] = array('default' => '');
+    $options['timezone'] = array('default' => '');
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+
+    $date_formats = array();
+    $date_types = system_get_date_types();
+    foreach ($date_types as $key => $value) {
+      $date_formats[$value['type']] = t('@date_format format', array('@date_format' => $value['title'])) . ': ' . format_date(REQUEST_TIME, $value['type']);
+    }
+
+    $form['date_format'] = array(
+      '#type' => 'select',
+      '#title' => t('Date format'),
+      '#options' => $date_formats + array(
+        'custom' => t('Custom'),
+        'raw time ago' => t('Time ago'),
+        'time ago' => t('Time ago (with "ago" appended)'),
+        'raw time hence' => t('Time hence'),
+        'time hence' => t('Time hence (with "hence" appended)'),
+        'raw time span' => t('Time span (future dates have "-" prepended)'),
+        'inverse time span' => t('Time span (past dates have "-" prepended)'),
+        'time span' => t('Time span (with "ago/hence" appended)'),
+      ),
+      '#default_value' => isset($this->options['date_format']) ? $this->options['date_format'] : 'small',
+    );
+    $form['custom_date_format'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Custom date format'),
+      '#description' => t('If "Custom", see the <a href="@url" target="_blank">PHP manual</a> for date formats. Otherwise, enter the number of different time units to display, which defaults to 2.', array('@url' => 'http://php.net/manual/function.date.php')),
+      '#default_value' => isset($this->options['custom_date_format']) ? $this->options['custom_date_format'] : '',
+      '#dependency' => array('edit-options-date-format' => array('custom', 'raw time ago', 'time ago', 'raw time hence', 'time hence', 'raw time span', 'time span', 'raw time span', 'inverse time span', 'time span')),
+    );
+    $form['timezone'] = array(
+      '#type' => 'select',
+      '#title' => t('Timezone'),
+      '#description' => t('Timezone to be used for date output.'),
+      '#options' => array('' => t('- Default site/user timezone -')) + system_time_zones(FALSE),
+      '#default_value' => $this->options['timezone'],
+      '#dependency' => array('edit-options-date-format' => array_merge(array('custom'), array_keys($date_formats))),
+    );
+
+    parent::options_form($form, $form_state);
+  }
+
+  function render($values) {
+    $value = $this->get_value($values);
+    $format = $this->options['date_format'];
+    if (in_array($format, array('custom', 'raw time ago', 'time ago', 'raw time hence', 'time hence', 'raw time span', 'time span', 'raw time span', 'inverse time span', 'time span'))) {
+      $custom_format = $this->options['custom_date_format'];
+    }
+
+    if ($value) {
+      $timezone = !empty($this->options['timezone']) ? $this->options['timezone'] : NULL;
+      $time_diff = REQUEST_TIME - $value; // will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence)
+      switch ($format) {
+        case 'raw time ago':
+          return format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2);
+        case 'time ago':
+          return t('%time ago', array('%time' => format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2)));
+        case 'raw time hence':
+          return format_interval(-$time_diff, is_numeric($custom_format) ? $custom_format : 2);
+        case 'time hence':
+          return t('%time hence', array('%time' => format_interval(-$time_diff, is_numeric($custom_format) ? $custom_format : 2)));
+        case 'raw time span':
+          return ($time_diff < 0 ? '-' : '') . format_interval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2);
+        case 'inverse time span':
+          return ($time_diff > 0 ? '-' : '') . format_interval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2);
+        case 'time span':
+          return t(($time_diff < 0 ? '%time hence' : '%time ago'), array('%time' => format_interval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2)));
+        case 'custom':
+          if ($custom_format == 'r') {
+            return format_date($value, $format, $custom_format, $timezone, 'en');
+          }
+          return format_date($value, $format, $custom_format, $timezone);
+        default:
+          return format_date($value, $format, '', $timezone);
+      }
+    }
+  }
+}

+ 104 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_entity.inc

@@ -0,0 +1,104 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_entity.
+ */
+
+/**
+ * A handler to display data from entity objects.
+ *
+ * Fields based upon this handler work with all query-backends if the tables
+ * used by the query backend have an 'entity type' specified. In order to
+ * make fields based upon this handler automatically available to all compatible
+ * query backends, the views field can be defined in the table
+ * @code views_entity_{ENTITY_TYPE} @endcode.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_entity extends views_handler_field {
+
+  /**
+   * Stores the entity type which is loaded by this field.
+   */
+  public $entity_type;
+
+  /**
+   * Stores all entites which are in the result.
+   */
+  public $entities;
+
+  /**
+   * The base field of the entity type assosiated with this field.
+   */
+  public $base_field;
+
+  /**
+   * Initialize the entity type.
+   */
+  public function init(&$view, &$options) {
+    parent::init($view, $options);
+
+    // Initialize the entity-type used.
+    $table_data = views_fetch_data($this->table);
+    $this->entity_type = $table_data['table']['entity type'];
+  }
+
+  /**
+   * Overriden to add the field for the entity id.
+   */
+  function query() {
+    $this->table_alias = $base_table = $this->view->base_table;
+    $this->base_field = $this->view->base_field;
+
+    if (!empty($this->relationship)) {
+      foreach ($this->view->relationship as $relationship) {
+        if ($relationship->alias == $this->relationship) {
+          $base_table = $relationship->definition['base'];
+          $this->table_alias = $relationship->alias;
+
+          $table_data = views_fetch_data($base_table);
+          $this->base_field = empty($relationship->definition['base field']) ? $table_data['table']['base']['field'] : $relationship->definition['base field'];
+        }
+      }
+    }
+
+    // Add the field if the query back-end implements an add_field() method,
+    // just like the default back-end.
+    if (method_exists($this->query, 'add_field')) {
+      $this->field_alias = $this->query->add_field($this->table_alias, $this->base_field, '');
+    }
+
+    $this->add_additional_fields();
+  }
+
+  /**
+   * Load the entities for all rows that are about to be displayed.
+   */
+  function pre_render(&$values) {
+    if (!empty($values)) {
+      list($this->entity_type, $this->entities) = $this->query->get_result_entities($values, !empty($this->relationship) ? $this->relationship : NULL, $this->field_alias);
+    }
+  }
+
+  /**
+   * Overridden to return the entity object, or a certain property of the entity.
+   */
+  function get_value($values, $field = NULL) {
+    if (isset($this->entities[$this->view->row_index])) {
+      $entity = $this->entities[$this->view->row_index];
+      // Support to get a certain part of the entity.
+      if (isset($field) && isset($entity->{$field})) {
+        return $entity->{$field};
+      }
+      // Support to get a part of the values as the normal get_value.
+      elseif (isset($field) && isset($values->{$this->aliases[$field]})) {
+        return $values->{$this->aliases[$field]};
+      }
+      else {
+        return $entity;
+      }
+    }
+    return FALSE;
+  }
+}

+ 73 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_machine_name.inc

@@ -0,0 +1,73 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_machine_name.
+ */
+
+/**
+ * Field handler whichs allows to show machine name content as human name.
+ * @ingroup views_field_handlers
+ *
+ * Definition items:
+ * - options callback: The function to call in order to generate the value options. If omitted, the options 'Yes' and 'No' will be used.
+ * - options arguments: An array of arguments to pass to the options callback.
+ */
+class views_handler_field_machine_name extends views_handler_field {
+  /**
+   * @var array Stores the available options.
+   */
+  var $value_options;
+
+  function get_value_options() {
+    if (isset($this->value_options)) {
+      return;
+    }
+
+    if (isset($this->definition['options callback']) && is_callable($this->definition['options callback'])) {
+      if (isset($this->definition['options arguments']) && is_array($this->definition['options arguments'])) {
+        $this->value_options = call_user_func_array($this->definition['options callback'], $this->definition['options arguments']);
+      }
+      else {
+        $this->value_options = call_user_func($this->definition['options callback']);
+      }
+    }
+    else {
+      $this->value_options = array();
+    }
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['machine_name'] = array('default' => FALSE, 'bool' => TRUE);
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['machine_name'] = array(
+      '#title' => t('Output machine name'),
+      '#description' => t('Display field as machine name.'),
+      '#type' => 'checkbox',
+      '#default_value' => !empty($this->options['machine_name']),
+    );
+  }
+
+  function pre_render(&$values) {
+    $this->get_value_options();
+  }
+
+  function render($values) {
+    $value = $values->{$this->field_alias};
+    if (!empty($this->options['machine_name']) || !isset($this->value_options[$value])) {
+      $result = check_plain($value);
+    }
+    else {
+      $result = $this->value_options[$value];
+    }
+
+    return $result;
+  }
+}

+ 59 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_markup.inc

@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_markup.
+ */
+
+/**
+ * A handler to run a field through check_markup, using a companion
+ * format field.
+ *
+ * - format: (REQUIRED) Either a string format id to use for this field or an
+ *           array('field' => {$field}) where $field is the field in this table
+ *           used to control the format such as the 'format' field in the node,
+ *           which goes with the 'body' field.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_markup extends views_handler_field {
+  /**
+   * Constructor; calls to base object constructor.
+   */
+  function construct() {
+    parent::construct();
+
+    $this->format = $this->definition['format'];
+
+    $this->additional_fields = array();
+    if (is_array($this->format)) {
+      $this->additional_fields['format'] = $this->format;
+    }
+  }
+
+  function render($values) {
+    $value = $this->get_value($values);
+    if (is_array($this->format)) {
+      $format = $this->get_value($values, 'format');
+    }
+    else {
+      $format = $this->format;
+    }
+    if ($value) {
+      $value = str_replace('<!--break-->', '', $value);
+      return check_markup($value, $format, '');
+    }
+  }
+
+  function element_type($none_supported = FALSE, $default_empty = FALSE, $inline = FALSE) {
+    if ($inline) {
+      return 'span';
+    }
+
+    if (isset($this->definition['element type'])) {
+      return $this->definition['element type'];
+    }
+
+    return 'div';
+  }
+}

+ 84 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_math.inc

@@ -0,0 +1,84 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_math.
+ */
+
+/**
+ * Render a mathematical expression as a numeric value
+ *
+ * Definition terms:
+ * - float: If true this field contains a decimal value. If unset this field
+ *   will be assumed to be integer.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_math extends views_handler_field_numeric {
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['expression'] = array('default' => '');
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    $form['expression'] = array(
+      '#type' => 'textarea',
+      '#title' => t('Expression'),
+      '#description' => t('Enter mathematical expressions such as 2 + 2 or sqrt(5). You may assign variables and create mathematical functions and evaluate them. Use the ; to separate these. For example: f(x) = x + 2; f(2).'),
+      '#default_value' => $this->options['expression'],
+    );
+
+    // Create a place for the help
+    $form['expression_help'] = array();
+    parent::options_form($form, $form_state);
+
+    // Then move the existing help:
+    $form['expression_help'] = $form['alter']['help'];
+    unset($form['expression_help']['#dependency']);
+    unset($form['alter']['help']);
+  }
+
+  function render($values) {
+    ctools_include('math-expr');
+    $tokens = array_map('floatval', $this->get_render_tokens(array()));
+    $value = strtr($this->options['expression'], $tokens);
+    $expressions = explode(';', $value);
+    $math = new ctools_math_expr;
+    foreach ($expressions as $expression) {
+      if ($expression !== '') {
+        $value = $math->evaluate($expression);
+      }
+    }
+
+    // The rest is directly from views_handler_field_numeric but because it
+    // does not allow the value to be passed in, it is copied.
+    if (!empty($this->options['set_precision'])) {
+      $value = number_format($value, $this->options['precision'], $this->options['decimal'], $this->options['separator']);
+    }
+    else {
+      $remainder = abs($value) - intval(abs($value));
+      $value = $value > 0 ? floor($value) : ceil($value);
+      $value = number_format($value, 0, '', $this->options['separator']);
+      if ($remainder) {
+        // The substr may not be locale safe.
+        $value .= $this->options['decimal'] . substr($remainder, 2);
+      }
+    }
+
+    // Check to see if hiding should happen before adding prefix and suffix.
+    if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) {
+      return '';
+    }
+
+    // Should we format as a plural.
+    if (!empty($this->options['format_plural']) && ($value != 0 || !$this->options['empty_zero'])) {
+      $value = format_plural($value, $this->options['format_plural_singular'], $this->options['format_plural_plural']);
+    }
+
+    return $this->sanitize_value($this->options['prefix'] . $value . $this->options['suffix']);
+  }
+
+  function query() { }
+}

+ 137 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_numeric.inc

@@ -0,0 +1,137 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_numeric.
+ */
+
+/**
+ * Render a field as a numeric value
+ *
+ * Definition terms:
+ * - float: If true this field contains a decimal value. If unset this field
+ *          will be assumed to be integer.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_numeric extends views_handler_field {
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['set_precision'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['precision'] = array('default' => 0);
+    $options['decimal'] = array('default' => '.', 'translatable' => TRUE);
+    $options['separator'] = array('default' => ',', 'translatable' => TRUE);
+    $options['format_plural'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['format_plural_singular'] = array('default' => '1');
+    $options['format_plural_plural'] = array('default' => '@count');
+    $options['prefix'] = array('default' => '', 'translatable' => TRUE);
+    $options['suffix'] = array('default' => '', 'translatable' => TRUE);
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    if (!empty($this->definition['float'])) {
+      $form['set_precision'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Round'),
+        '#description' => t('If checked, the number will be rounded.'),
+        '#default_value' => $this->options['set_precision'],
+      );
+      $form['precision'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Precision'),
+        '#default_value' => $this->options['precision'],
+        '#description' => t('Specify how many digits to print after the decimal point.'),
+        '#dependency' => array('edit-options-set-precision' => array(TRUE)),
+        '#size' => 2,
+      );
+      $form['decimal'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Decimal point'),
+        '#default_value' => $this->options['decimal'],
+        '#description' => t('What single character to use as a decimal point.'),
+        '#size' => 2,
+      );
+    }
+    $form['separator'] = array(
+      '#type' => 'select',
+      '#title' => t('Thousands marker'),
+      '#options' => array(
+        '' => t('- None -'),
+        ',' => t('Comma'),
+        ' ' => t('Space'),
+        '.' => t('Decimal'),
+        '\'' => t('Apostrophe'),
+      ),
+      '#default_value' => $this->options['separator'],
+      '#description' => t('What single character to use as the thousands separator.'),
+      '#size' => 2,
+    );
+    $form['format_plural'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Format plural'),
+      '#description' => t('If checked, special handling will be used for plurality.'),
+      '#default_value' => $this->options['format_plural'],
+    );
+    $form['format_plural_singular'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Singular form'),
+      '#default_value' => $this->options['format_plural_singular'],
+      '#description' => t('Text to use for the singular form.'),
+      '#dependency' => array('edit-options-format-plural' => array(TRUE)),
+    );
+    $form['format_plural_plural'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Plural form'),
+      '#default_value' => $this->options['format_plural_plural'],
+      '#description' => t('Text to use for the plural form, @count will be replaced with the value.'),
+      '#dependency' => array('edit-options-format-plural' => array(TRUE)),
+    );
+    $form['prefix'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Prefix'),
+      '#default_value' => $this->options['prefix'],
+      '#description' => t('Text to put before the number, such as currency symbol.'),
+    );
+    $form['suffix'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Suffix'),
+      '#default_value' => $this->options['suffix'],
+      '#description' => t('Text to put after the number, such as currency symbol.'),
+    );
+
+    parent::options_form($form, $form_state);
+  }
+
+  function render($values) {
+    $value = $this->get_value($values);
+    if (!empty($this->options['set_precision'])) {
+      $value = number_format($value, $this->options['precision'], $this->options['decimal'], $this->options['separator']);
+    }
+    else {
+      $remainder = abs($value) - intval(abs($value));
+      $value = $value > 0 ? floor($value) : ceil($value);
+      $value = number_format($value, 0, '', $this->options['separator']);
+      if ($remainder) {
+        // The substr may not be locale safe.
+        $value .= $this->options['decimal'] . substr($remainder, 2);
+      }
+    }
+
+    // Check to see if hiding should happen before adding prefix and suffix.
+    if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) {
+      return '';
+    }
+
+    // Should we format as a plural.
+    if (!empty($this->options['format_plural'])) {
+      $value = format_plural($value, $this->options['format_plural_singular'], $this->options['format_plural_plural']);
+    }
+
+    return $this->sanitize_value($this->options['prefix'], 'xss')
+      . $this->sanitize_value($value)
+      . $this->sanitize_value($this->options['suffix'], 'xss');
+  }
+}

+ 158 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_prerender_list.inc

@@ -0,0 +1,158 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_prerender_list.
+ */
+
+/**
+ * Field handler to provide a list of items.
+ *
+ * The items are expected to be loaded by a child object during pre_render,
+ * and 'my field' is expected to be the pointer to the items in the list.
+ *
+ * Items to render should be in a list in $this->items
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_prerender_list extends views_handler_field {
+  /**
+   * Stores all items which are used to render the items.
+   * It should be keyed first by the id of the base table, for example nid.
+   * The second key is the id of the thing which is displayed multiple times
+   * per row, for example the tid.
+   *
+   * @var array
+   */
+  var $items = array();
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['type'] = array('default' => 'separator');
+    $options['separator'] = array('default' => ', ');
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    $form['type'] = array(
+      '#type' => 'radios',
+      '#title' => t('Display type'),
+      '#options' => array(
+        'ul' => t('Unordered list'),
+        'ol' => t('Ordered list'),
+        'separator' => t('Simple separator'),
+      ),
+      '#default_value' => $this->options['type'],
+    );
+
+    $form['separator'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Separator'),
+      '#default_value' => $this->options['separator'],
+      '#dependency' => array('radio:options[type]' => array('separator')),
+    );
+    parent::options_form($form, $form_state);
+  }
+
+  /**
+   * Render the field.
+   *
+   * This function is deprecated, but left in for older systems that have not
+   * yet or won't update their prerender list fields. If a render_item method
+   * exists, this will not get used by advanced_render.
+   */
+  function render($values) {
+    $field = $this->get_value($values);
+    if (!empty($this->items[$field])) {
+      if ($this->options['type'] == 'separator') {
+        return implode($this->sanitize_value($this->options['separator']), $this->items[$field]);
+      }
+      else {
+        return theme('item_list',
+          array(
+            'items' => $this->items[$field],
+            'title' => NULL,
+            'type' => $this->options['type']
+          ));
+      }
+    }
+  }
+
+  /**
+   * Render all items in this field together.
+   *
+   * When using advanced render, each possible item in the list is rendered
+   * individually. Then the items are all pasted together.
+   */
+  function render_items($items) {
+    if (!empty($items)) {
+      if ($this->options['type'] == 'separator') {
+        return implode($this->sanitize_value($this->options['separator'], 'xss_admin'), $items);
+      }
+      else {
+        return theme('item_list',
+          array(
+            'items' => $items,
+            'title' => NULL,
+            'type' => $this->options['type']
+          ));
+      }
+    }
+  }
+
+  /**
+   * Return an array of items for the field.
+   *
+   * Items should be stored in the result array, if possible, as an array
+   * with 'value' as the actual displayable value of the item, plus
+   * any items that might be found in the 'alter' options array for
+   * creating links, such as 'path', 'fragment', 'query' etc, such a thing
+   * is to be made. Additionally, items that might be turned into tokens
+   * should also be in this array.
+   */
+  function get_items($values) {
+    // Only the parent get_value returns a single field.
+    $field = parent::get_value($values);
+    if (!empty($this->items[$field])) {
+      return $this->items[$field];
+    }
+
+    return array();
+  }
+
+  /**
+   * Get the value that's supposed to be rendered.
+   *
+   * @param $values
+   *   An object containing all retrieved values.
+   * @param $field
+   *   Optional name of the field where the value is stored.
+   * @param $raw
+   *   Use the raw data and not the data defined in pre_render
+   */
+  function get_value($values, $field = NULL, $raw = FALSE) {
+    if ($raw) {
+      return parent::get_value($values, $field);
+    }
+    $item = $this->get_items($values);
+    $item = (array) $item;
+    if (isset($field) && isset($item[$field])) {
+      return $item[$field];
+    }
+    return $item;
+  }
+
+  /**
+   * Determine if advanced rendering is allowed.
+   *
+   * By default, advanced rendering will NOT be allowed if the class
+   * inheriting from this does not implement a 'render_items' method.
+   */
+  function allow_advanced_render() {
+    // Note that the advanced render bits also use the presence of
+    // this method to determine if it needs to render items as a list.
+    return method_exists($this, 'render_item');
+  }
+}

+ 65 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_serialized.inc

@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_serialized.
+ */
+
+/**
+ * Field handler to show data of serialized fields.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_serialized extends views_handler_field {
+
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['format'] = array('default' => 'unserialized');
+    $options['key'] = array('default' => '');
+    return $options;
+  }
+
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['format'] = array(
+      '#type' => 'select',
+      '#title' => t('Display format'),
+      '#description' => t('How should the serialized data be displayed. You can choose a custom array/object key or a print_r on the full output.'),
+      '#options' => array(
+        'unserialized' => t('Full data (unserialized)'),
+        'serialized' => t('Full data (serialized)'),
+        'key' => t('A certain key'),
+      ),
+      '#default_value' => $this->options['format'],
+    );
+    $form['key'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Which key should be displayed'),
+      '#default_value' => $this->options['key'],
+      '#dependency' => array('edit-options-format' => array('key')),
+    );
+  }
+
+  function options_validate(&$form, &$form_state) {
+    // Require a key if the format is key.
+    if ($form_state['values']['options']['format'] == 'key' && $form_state['values']['options']['key'] == '') {
+      form_error($form['key'], t('You have to enter a key if you want to display a key of the data.'));
+    }
+  }
+
+  function render($values) {
+    $value = $values->{$this->field_alias};
+
+    if ($this->options['format'] == 'unserialized') {
+      return check_plain(print_r(unserialize($value), TRUE));
+    }
+    elseif ($this->options['format'] == 'key' && !empty($this->options['key'])) {
+      $value = (array) unserialize($value);
+      return check_plain($value[$this->options['key']]);
+    }
+
+    return $value;
+  }
+}

+ 37 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_time_interval.inc

@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_time_interval.
+ */
+
+/**
+ * A handler to provide proper displays for time intervals.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_time_interval extends views_handler_field {
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['granularity'] = array('default' => 2);
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['granularity'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Granularity'),
+      '#description' => t('How many different units to display in the string.'),
+      '#default_value' => $this->options['granularity'],
+    );
+  }
+
+  function render($values) {
+    $value = $values->{$this->field_alias};
+    return format_interval($value, isset($this->options['granularity']) ? $this->options['granularity'] : 2);
+  }
+}

+ 46 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_field_url.inc

@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_url.
+ */
+
+/**
+ * Field handler to provide simple renderer that turns a URL into a clickable link.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_url extends views_handler_field {
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['display_as_link'] = array('default' => TRUE, 'bool' => TRUE);
+
+    return $options;
+  }
+
+  /**
+   * Provide link to the page being visited.
+   */
+  function options_form(&$form, &$form_state) {
+    $form['display_as_link'] = array(
+      '#title' => t('Display as link'),
+      '#type' => 'checkbox',
+      '#default_value' => !empty($this->options['display_as_link']),
+    );
+    parent::options_form($form, $form_state);
+  }
+
+  function render($values) {
+    $value = $this->get_value($values);
+    if (!empty($this->options['display_as_link'])) {
+      $this->options['alter']['make_link'] = TRUE;
+      $this->options['alter']['path'] = $value;
+      $text = !empty($this->options['text']) ? $this->sanitize_value($this->options['text']) : $this->sanitize_value($value, 'url');
+      return $text;
+    }
+    else {
+      return $this->sanitize_value($value, 'url');
+    }
+  }
+}

+ 1410 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter.inc

@@ -0,0 +1,1410 @@
+<?php
+
+/**
+ * @file
+ * @todo.
+ */
+
+/**
+ * @defgroup views_filter_handlers Views filter handlers
+ * @{
+ * Handlers to tell Views how to filter queries.
+ *
+ * Definition items:
+ * - allow empty: If true, the 'IS NULL' and 'IS NOT NULL' operators become
+ *   available as standard operators.
+ *
+ * Object flags:
+ *  You can set some specific behavior by setting up the following flags on
+ *  your custom class.
+ *
+ * - always_multiple:
+ *    Disable the possibility to force a single value.
+ * - no_operator:
+ *    Disable the possibility to use operators.
+ * - always_required:
+ *    Disable the possibility to allow a exposed input to be optional.
+ */
+
+/**
+ * Base class for filters.
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter extends views_handler {
+  /**
+   * Contains the actual value of the field,either configured in the views ui
+   * or entered in the exposed filters.
+   */
+  var $value = NULL;
+
+  /**
+   * Contains the operator which is used on the query.
+   */
+  var $operator = '=';
+
+  /**
+   * Contains the information of the selected item in a gruped filter.
+   */
+  var $group_info = NULL;
+
+  /**
+   * @var bool
+   * Disable the possibility to force a single value.
+   */
+  var $always_multiple = FALSE;
+
+  /**
+   * @var bool
+   * Disable the possibility to use operators.
+   */
+  var $no_operator = FALSE;
+
+  /**
+   * @var bool
+   * Disable the possibility to allow a exposed input to be optional.
+   */
+  var $always_required = FALSE;
+
+  /**
+   * Provide some extra help to get the operator/value easier to use.
+   *
+   * This likely has to be overridden by filters which are more complex
+   * than simple operator/value.
+   */
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+
+    $this->operator = $this->options['operator'];
+    $this->value = $this->options['value'];
+    $this->group_info = $this->options['group_info']['default_group'];
+
+    // Compatibility: The new UI changed several settings.
+    if (!empty($options['exposed']) && !empty($options['expose']['optional']) && !isset($options['expose']['required'])) {
+      $this->options['expose']['required'] = !$options['expose']['optional'];
+    }
+    if (!empty($options['exposed']) && !empty($options['expose']['single']) && !isset($options['expose']['multiple'])) {
+      $this->options['expose']['multiple'] = !$options['expose']['single'];
+    }
+    if (!empty($options['exposed']) && !empty($options['expose']['operator']) && !isset($options['expose']['operator_id'])) {
+      $this->options['expose']['operator_id'] = $options['expose']['operator_id'] = $options['expose']['operator'];
+    }
+
+    if ($this->multiple_exposed_input()) {
+      $this->group_info = array_filter($options['group_info']['default_group_multiple']);
+      $this->options['expose']['multiple'] = TRUE;
+    }
+
+    // If there are relationships in the view, allow empty should be true
+    // so that we can do IS NULL checks on items. Not all filters respect
+    // allow empty, but string and numeric do and that covers enough.
+    if ($this->view->display_handler->get_option('relationships')) {
+      $this->definition['allow empty'] = TRUE;
+    }
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['operator'] = array('default' => '=');
+    $options['value'] = array('default' => '');
+    $options['group'] = array('default' => '1');
+    $options['exposed'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['expose'] = array(
+      'contains' => array(
+        'operator_id' => array('default' => FALSE),
+        'label' => array('default' => '', 'translatable' => TRUE),
+        'description' => array('default' => '', 'translatable' => TRUE),
+        'use_operator' => array('default' => FALSE, 'bool' => TRUE),
+        'operator' => array('default' => ''),
+        'identifier' => array('default' => ''),
+        'required' => array('default' => FALSE, 'bool' => TRUE),
+        'remember' => array('default' => FALSE, 'bool' => TRUE),
+        'multiple' => array('default' => FALSE, 'bool' => TRUE),
+        'remember_roles' => array('default' => array(
+          DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID,
+        )),
+      ),
+    );
+
+    // A group is a combination of a filter, an operator and a value
+    // operating like a single filter.
+    // Users can choose from a select box which group they want to apply.
+    // Views will filter the view according to the defined values.
+    // Because it acts as a standard filter, we have to define
+    // an identifier and other settings like the widget and the label.
+    // This settings are saved in another array to allow users to switch
+    // between a normal filter and a group of filters with a single click.
+    $options['is_grouped'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['group_info'] = array(
+      'contains' => array(
+        'label' => array('default' => '', 'translatable' => TRUE),
+        'description' => array('default' => '', 'translatable' => TRUE),
+        'identifier' => array('default' => ''),
+        'optional' => array('default' => TRUE, 'bool' => TRUE),
+        'widget' => array('default' => 'select'),
+        'multiple' => array('default' => FALSE, 'bool' => TRUE),
+        'remember' => array('default' => 0),
+        'default_group' => array('default' => 'All'),
+        'default_group_multiple' => array('default' => array()),
+        'group_items' => array('default' => array()),
+      ),
+    );
+
+    return $options;
+  }
+
+  /**
+   * Display the filter on the administrative summary
+   */
+  function admin_summary() {
+    return check_plain((string) $this->operator) . ' ' . check_plain((string) $this->value);
+  }
+
+  /**
+   * Determine if a filter can be exposed.
+   */
+  function can_expose() { return TRUE; }
+
+  /**
+   * Determine if a filter can be converted into a group.
+   * Only exposed filters with operators available can be converted into groups.
+   */
+  function can_build_group() {
+    return $this->is_exposed() && (count($this->operator_options()) > 0);
+  }
+
+  /**
+   * Returns TRUE if the exposed filter works like a grouped filter.
+   */
+  function is_a_group() {
+    return $this->is_exposed() && !empty($this->options['is_grouped']);
+  }
+
+  /**
+   * Provide the basic form which calls through to subforms.
+   * If overridden, it is best to call through to the parent,
+   * or to at least make sure all of the functions in this form
+   * are called.
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    if ($this->can_expose()) {
+      $this->show_expose_button($form, $form_state);
+    }
+    if ($this->can_build_group()) {
+      $this->show_build_group_button($form, $form_state);
+    }
+    $form['clear_markup_start'] = array(
+      '#markup' => '<div class="clearfix">',
+    );
+    if ($this->is_a_group()) {
+      if ($this->can_build_group()) {
+        $form['clear_markup_start'] = array(
+          '#markup' => '<div class="clearfix">',
+        );
+        // Render the build group form.
+        $this->show_build_group_form($form, $form_state);
+        $form['clear_markup_end'] = array(
+          '#markup' => '</div>',
+        );
+      }
+    }
+    else {
+      // Add the subform from operator_form().
+      $this->show_operator_form($form, $form_state);
+      // Add the subform from value_form().
+      $this->show_value_form($form, $form_state);
+      $form['clear_markup_end'] = array(
+        '#markup' => '</div>',
+      );
+      if ($this->can_expose()) {
+        // Add the subform from expose_form().
+        $this->show_expose_form($form, $form_state);
+      }
+    }
+  }
+
+  /**
+   * Simple validate handler
+   */
+  function options_validate(&$form, &$form_state) {
+    $this->operator_validate($form, $form_state);
+    $this->value_validate($form, $form_state);
+    if (!empty($this->options['exposed']) && !$this->is_a_group()) {
+      $this->expose_validate($form, $form_state);
+    }
+    if ($this->is_a_group()) {
+      $this->build_group_validate($form, $form_state);
+    }
+  }
+
+  /**
+   * Simple submit handler
+   */
+  function options_submit(&$form, &$form_state) {
+    unset($form_state['values']['expose_button']); // don't store this.
+    unset($form_state['values']['group_button']); // don't store this.
+    if (!$this->is_a_group()) {
+      $this->operator_submit($form, $form_state);
+      $this->value_submit($form, $form_state);
+    }
+    if (!empty($this->options['exposed'])) {
+      $this->expose_submit($form, $form_state);
+    }
+    if ($this->is_a_group()) {
+      $this->build_group_submit($form, $form_state);
+    }
+  }
+
+  /**
+   * Shortcut to display the operator form.
+   */
+  function show_operator_form(&$form, &$form_state) {
+    $this->operator_form($form, $form_state);
+    $form['operator']['#prefix'] = '<div class="views-group-box views-left-30">';
+    $form['operator']['#suffix'] = '</div>';
+  }
+
+  /**
+   * Options form subform for setting the operator.
+   *
+   * This may be overridden by child classes, and it must
+   * define $form['operator'];
+   *
+   * @see options_form()
+   */
+  function operator_form(&$form, &$form_state) {
+    $options = $this->operator_options();
+    if (!empty($options)) {
+      $form['operator'] = array(
+        '#type' => count($options) < 10 ? 'radios' : 'select',
+        '#title' => t('Operator'),
+        '#default_value' => $this->operator,
+        '#options' => $options,
+      );
+    }
+  }
+
+  /**
+   * Provide a list of options for the default operator form.
+   * Should be overridden by classes that don't override operator_form
+   */
+  function operator_options() { return array(); }
+
+  /**
+   * Validate the operator form.
+   */
+  function operator_validate($form, &$form_state) { }
+
+  /**
+   * Perform any necessary changes to the form values prior to storage.
+   * There is no need for this function to actually store the data.
+   */
+  function operator_submit($form, &$form_state) { }
+
+  /**
+   * Shortcut to display the value form.
+   */
+  function show_value_form(&$form, &$form_state) {
+    $this->value_form($form, $form_state);
+    if (empty($this->no_operator)) {
+      $form['value']['#prefix'] = '<div class="views-group-box views-right-70">' . (isset($form['value']['#prefix']) ? $form['value']['#prefix'] : '');
+      $form['value']['#suffix'] = (isset($form['value']['#suffix']) ? $form['value']['#suffix'] : '') . '</div>';
+    }
+  }
+
+  /**
+   * Options form subform for setting options.
+   *
+   * This should be overridden by all child classes and it must
+   * define $form['value']
+   *
+   * @see options_form()
+   */
+  function value_form(&$form, &$form_state) { $form['value'] = array(); }
+
+  /**
+   * Validate the options form.
+   */
+  function value_validate($form, &$form_state) { }
+
+  /**
+   * Perform any necessary changes to the form values prior to storage.
+   * There is no need for this function to actually store the data.
+   */
+  function value_submit($form, &$form_state) { }
+
+  /**
+   * Shortcut to display the exposed options form.
+   */
+  function show_build_group_form(&$form, &$form_state) {
+    if (empty($this->options['is_grouped'])) {
+      return;
+    }
+
+    $this->build_group_form($form, $form_state);
+
+    // When we click the expose button, we add new gadgets to the form but they
+    // have no data in $_POST so their defaults get wiped out. This prevents
+    // these defaults from getting wiped out. This setting will only be TRUE
+    // during a 2nd pass rerender.
+    if (!empty($form_state['force_build_group_options'])) {
+      foreach (element_children($form['group_info']) as $id) {
+        if (isset($form['group_info'][$id]['#default_value']) && !isset($form['group_info'][$id]['#value'])) {
+          $form['group_info'][$id]['#value'] = $form['group_info'][$id]['#default_value'];
+        }
+      }
+    }
+  }
+
+  /**
+   * Shortcut to display the build_group/hide button.
+   */
+  function show_build_group_button(&$form, &$form_state) {
+
+    $form['group_button'] = array(
+      '#prefix' => '<div class="views-grouped clearfix">',
+      '#suffix' => '</div>',
+      // Should always come after the description and the relationship.
+      '#weight' => -190,
+    );
+
+    $grouped_description = t('Grouped filters allow a choice between predefined operator|value pairs.');
+    $form['group_button']['radios'] = array(
+      '#theme_wrappers' => array('container'),
+      '#attributes' => array('class' => array('js-only')),
+    );
+    $form['group_button']['radios']['radios'] = array(
+      '#title' => t('Filter type to expose'),
+      '#description' => $grouped_description,
+      '#type' => 'radios',
+      '#options' => array(
+        t('Single filter'),
+        t('Grouped filters'),
+      ),
+    );
+
+    if (empty($this->options['is_grouped'])) {
+      $form['group_button']['markup'] = array(
+        '#markup' => '<div class="description grouped-description">' . $grouped_description . '</div>',
+      );
+      $form['group_button']['button'] = array(
+        '#limit_validation_errors' => array(),
+        '#type' => 'submit',
+        '#value' => t('Grouped filters'),
+        '#submit' => array('views_ui_config_item_form_build_group'),
+      );
+      $form['group_button']['radios']['radios']['#default_value'] = 0;
+    }
+    else {
+      $form['group_button']['button'] = array(
+        '#limit_validation_errors' => array(),
+        '#type' => 'submit',
+        '#value' => t('Single filter'),
+        '#submit' => array('views_ui_config_item_form_build_group'),
+      );
+      $form['group_button']['radios']['radios']['#default_value'] = 1;
+    }
+  }
+  /**
+   * Shortcut to display the expose/hide button.
+   */
+  function show_expose_button(&$form, &$form_state) {
+    $form['expose_button'] = array(
+      '#prefix' => '<div class="views-expose clearfix">',
+      '#suffix' => '</div>',
+      // Should always come after the description and the relationship.
+      '#weight' => -200,
+    );
+
+    // Add a checkbox for JS users, which will have behavior attached to it
+    // so it can replace the button.
+    $form['expose_button']['checkbox'] = array(
+      '#theme_wrappers' => array('container'),
+      '#attributes' => array('class' => array('js-only')),
+    );
+    $form['expose_button']['checkbox']['checkbox'] = array(
+      '#title' => t('Expose this filter to visitors, to allow them to change it'),
+      '#type' => 'checkbox',
+    );
+
+    // Then add the button itself.
+    if (empty($this->options['exposed'])) {
+      $form['expose_button']['markup'] = array(
+        '#markup' => '<div class="description exposed-description">' . t('This filter is not exposed. Expose it to allow the users to change it.') . '</div>',
+      );
+      $form['expose_button']['button'] = array(
+        '#limit_validation_errors' => array(),
+        '#type' => 'submit',
+        '#value' => t('Expose filter'),
+        '#submit' => array('views_ui_config_item_form_expose'),
+      );
+      $form['expose_button']['checkbox']['checkbox']['#default_value'] = 0;
+    }
+    else {
+      $form['expose_button']['markup'] = array(
+        '#markup' => '<div class="description exposed-description">' . t('This filter is exposed. If you hide it, users will not be able to change it.') . '</div>',
+      );
+      $form['expose_button']['button'] = array(
+        '#limit_validation_errors' => array(),
+        '#type' => 'submit',
+        '#value' => t('Hide filter'),
+        '#submit' => array('views_ui_config_item_form_expose'),
+      );
+      $form['expose_button']['checkbox']['checkbox']['#default_value'] = 1;
+    }
+  }
+
+  /**
+   * Options form subform for exposed filter options.
+   *
+   * @see options_form()
+   */
+  function expose_form(&$form, &$form_state) {
+    $form['#theme'] = 'views_ui_expose_filter_form';
+    // #flatten will move everything from $form['expose'][$key] to $form[$key]
+    // prior to rendering. That's why the pre_render for it needs to run first,
+    // so that when the next pre_render (the one for fieldsets) runs, it gets
+    // the flattened data.
+    array_unshift($form['#pre_render'], 'views_ui_pre_render_flatten_data');
+    $form['expose']['#flatten'] = TRUE;
+
+    if (empty($this->always_required)) {
+      $form['expose']['required'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Required'),
+        '#default_value' => $this->options['expose']['required'],
+      );
+    }
+    else {
+      $form['expose']['required'] = array(
+        '#type' => 'value',
+        '#value' => TRUE,
+      );
+    }
+    $form['expose']['label'] = array(
+      '#type' => 'textfield',
+      '#default_value' => $this->options['expose']['label'],
+      '#title' => t('Label'),
+      '#size' => 40,
+    );
+
+    $form['expose']['description'] = array(
+      '#type' => 'textfield',
+      '#default_value' => $this->options['expose']['description'],
+      '#title' => t('Description'),
+      '#size' => 60,
+    );
+
+    if (!empty($form['operator']['#type'])) {
+       // Increase the width of the left (operator) column.
+      $form['operator']['#prefix'] = '<div class="views-group-box views-left-40">';
+      $form['operator']['#suffix'] = '</div>';
+      $form['value']['#prefix'] = '<div class="views-group-box views-right-60">';
+      $form['value']['#suffix'] = '</div>';
+
+      $form['expose']['use_operator'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Expose operator'),
+        '#description' => t('Allow the user to choose the operator.'),
+        '#default_value' => !empty($this->options['expose']['use_operator']),
+      );
+      $form['expose']['operator_id'] = array(
+        '#type' => 'textfield',
+        '#default_value' => $this->options['expose']['operator_id'],
+        '#title' => t('Operator identifier'),
+        '#size' => 40,
+        '#description' => t('This will appear in the URL after the ? to identify this operator.'),
+        '#dependency' => array(
+          'edit-options-expose-use-operator' => array(1)
+        ),
+        '#fieldset' => 'more',
+      );
+    }
+    else {
+      $form['expose']['operator_id'] = array(
+        '#type' => 'value',
+        '#value' => '',
+      );
+    }
+
+    if (empty($this->always_multiple)) {
+      $form['expose']['multiple'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Allow multiple selections'),
+        '#description' => t('Enable to allow users to select multiple items.'),
+        '#default_value' => $this->options['expose']['multiple'],
+      );
+    }
+    $form['expose']['remember'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Remember the last selection'),
+      '#description' => t('Enable to remember the last selection made by the user.'),
+      '#default_value' => $this->options['expose']['remember'],
+    );
+
+    $role_options = array_map('check_plain', user_roles());
+    $form['expose']['remember_roles'] = array(
+      '#type' => 'checkboxes',
+      '#title' => t('User roles'),
+      '#description' => t('Remember exposed selection only for the selected user role(s). If you select no roles, the exposed data will never be stored.'),
+      '#default_value' => $this->options['expose']['remember_roles'],
+      '#options' => $role_options,
+      '#dependency' =>  array(
+        'edit-options-expose-remember' => array(1),
+      ),
+    );
+
+    $form['expose']['identifier'] = array(
+      '#type' => 'textfield',
+      '#default_value' => $this->options['expose']['identifier'],
+      '#title' => t('Filter identifier'),
+      '#size' => 40,
+      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
+      '#fieldset' => 'more',
+    );
+  }
+
+  /**
+   * Validate the options form.
+   */
+  function expose_validate($form, &$form_state) {
+    if (empty($form_state['values']['options']['expose']['identifier'])) {
+      form_error($form['expose']['identifier'], t('The identifier is required if the filter is exposed.'));
+    }
+
+    if (!empty($form_state['values']['options']['expose']['identifier']) && $form_state['values']['options']['expose']['identifier'] == 'value') {
+      form_error($form['expose']['identifier'], t('This identifier is not allowed.'));
+    }
+
+    if (!$this->view->display_handler->is_identifier_unique($form_state['id'], $form_state['values']['options']['expose']['identifier'])) {
+      form_error($form['expose']['identifier'], t('This identifier is used by another handler.'));
+    }
+  }
+
+   /**
+   * Validate the build group options form.
+   */
+  function build_group_validate($form, &$form_state) {
+    if (!empty($form_state['values']['options']['group_info'])) {
+      if (empty($form_state['values']['options']['group_info']['identifier'])) {
+        form_error($form['group_info']['identifier'], t('The identifier is required if the filter is exposed.'));
+      }
+
+      if (!empty($form_state['values']['options']['group_info']['identifier']) && $form_state['values']['options']['group_info']['identifier'] == 'value') {
+        form_error($form['group_info']['identifier'], t('This identifier is not allowed.'));
+      }
+
+      if (!$this->view->display_handler->is_identifier_unique($form_state['id'], $form_state['values']['options']['group_info']['identifier'])) {
+        form_error($form['group_info']['identifier'], t('This identifier is used by another handler.'));
+      }
+    }
+
+    if (!empty($form_state['values']['options']['group_info']['group_items'])) {
+      foreach ($form_state['values']['options']['group_info']['group_items'] as $id => $group) {
+        if (empty($group['remove'])) {
+
+          // Check if the title is defined but value wasn't defined.
+          if (!empty($group['title'])) {
+            if ((!is_array($group['value']) && trim($group['value']) == "") ||
+                (is_array($group['value']) && count(array_filter($group['value'], '_views_array_filter_zero')) == 0)) {
+              form_error($form['group_info']['group_items'][$id]['value'],
+                         t('The value is required if title for this item is defined.'));
+            }
+          }
+
+          // Check if the value is defined but title wasn't defined.
+          if ((!is_array($group['value']) && trim($group['value']) != "") ||
+              (is_array($group['value']) && count(array_filter($group['value'], '_views_array_filter_zero')) > 0)) {
+            if (empty($group['title'])) {
+              form_error($form['group_info']['group_items'][$id]['title'],
+                         t('The title is required if value for this item is defined.'));
+            }
+          }
+        }
+      }
+    }
+  }
+
+  /**
+   * Save new group items, re-enumerates and remove groups marked to delete.
+   */
+  function build_group_submit($form, &$form_state) {
+    $groups = array();
+    uasort($form_state['values']['options']['group_info']['group_items'], 'drupal_sort_weight');
+    // Filter out removed items.
+
+    // Start from 1 to avoid problems with #default_value in the widget.
+    $new_id = 1;
+    $new_default = 'All';
+    foreach ($form_state['values']['options']['group_info']['group_items'] as $id => $group) {
+      if (empty($group['remove'])) {
+        // Don't store this.
+        unset($group['remove']);
+        unset($group['weight']);
+        $groups[$new_id] = $group;
+
+        if ($form_state['values']['options']['group_info']['default_group'] === $id) {
+          $new_default = $new_id;
+        }
+      }
+      $new_id++;
+    }
+    if ($new_default != 'All') {
+      $form_state['values']['options']['group_info']['default_group'] = $new_default;
+    }
+    $filter_default_multiple = array_filter($form_state['values']['options']['group_info']['default_group_multiple']);
+    $form_state['values']['options']['group_info']['default_group_multiple'] = $filter_default_multiple;
+
+    $form_state['values']['options']['group_info']['group_items'] = $groups;
+  }
+
+  /**
+   * Provide default options for exposed filters.
+   */
+  function expose_options() {
+    $this->options['expose'] = array(
+      'use_operator' => FALSE,
+      'operator' => $this->options['id'] . '_op',
+      'identifier' => $this->options['id'],
+      'label' => $this->definition['title'],
+      'description' => NULL,
+      'remember' => FALSE,
+      'multiple' => FALSE,
+      'required' => FALSE,
+    );
+  }
+
+   /**
+   * Provide default options for exposed filters.
+   */
+  function build_group_options() {
+    $this->options['group_info'] = array(
+      'label' => $this->definition['title'],
+      'description' => NULL,
+      'identifier' => $this->options['id'],
+      'optional' => TRUE,
+      'widget' => 'select',
+      'multiple' => FALSE,
+      'remember' => FALSE,
+      'default_group' => 'All',
+      'default_group_multiple' => array(),
+      'group_items' => array(),
+    );
+  }
+
+  /**
+   * Build a form containing a group of operator | values to apply as a
+   * single filter.
+   */
+  function group_form(&$form, &$form_state) {
+    if (!empty($this->options['group_info']['optional']) && !$this->multiple_exposed_input()) {
+
+      $old_any = $this->options['group_info']['widget'] == 'select' ? '<Any>' : '&lt;Any&gt;';
+      $any_label = variable_get('views_exposed_filter_any_label', 'new_any') == 'old_any' ? $old_any : t('- Any -');
+      $groups = array('All' => $any_label);
+    }
+    foreach ($this->options['group_info']['group_items'] as $id => $group) {
+      if (!empty($group['title'])) {
+        $groups[$id] = $id != 'All' ? t($group['title']) : $group['title'];
+      }
+    }
+
+    if (count($groups)) {
+      $value = $this->options['group_info']['identifier'];
+
+      $form[$value] = array(
+        '#type' => $this->options['group_info']['widget'],
+        '#default_value' => $this->group_info,
+        '#options' => $groups,
+      );
+      if (!empty($this->options['group_info']['multiple'])) {
+        if (count($groups) < 5) {
+          $form[$value]['#type'] = 'checkboxes';
+        }
+        else {
+          $form[$value]['#type'] = 'select';
+          $form[$value]['#size'] = 5;
+          $form[$value]['#multiple'] = TRUE;
+        }
+        unset($form[$value]['#default_value']);
+        if (empty($form_state['input'])) {
+          $form_state['input'][$value] = $this->group_info;
+        }
+      }
+
+      $this->options['expose']['label'] = '';
+    }
+  }
+
+
+  /**
+   * Render our chunk of the exposed filter form when selecting
+   *
+   * You can override this if it doesn't do what you expect.
+   */
+  function exposed_form(&$form, &$form_state) {
+    if (empty($this->options['exposed'])) {
+      return;
+    }
+
+    // Build the exposed form, when its based on an operator.
+    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id'])) {
+      $operator = $this->options['expose']['operator_id'];
+      $this->operator_form($form, $form_state);
+      $form[$operator] = $form['operator'];
+
+      if (isset($form[$operator]['#title'])) {
+        unset($form[$operator]['#title']);
+      }
+
+      $this->exposed_translate($form[$operator], 'operator');
+
+      unset($form['operator']);
+    }
+
+    // Build the form and set the value based on the identifier.
+    if (!empty($this->options['expose']['identifier'])) {
+      $value = $this->options['expose']['identifier'];
+      $this->value_form($form, $form_state);
+      $form[$value] = $form['value'];
+
+      if (isset($form[$value]['#title']) && !empty($form[$value]['#type']) && $form[$value]['#type'] != 'checkbox') {
+        unset($form[$value]['#title']);
+      }
+
+      $this->exposed_translate($form[$value], 'value');
+
+      if (!empty($form['#type']) && ($form['#type'] == 'checkboxes' || ($form['#type'] == 'select' && !empty($form['#multiple'])))) {
+        unset($form[$value]['#default_value']);
+      }
+
+      if (!empty($form['#type']) && $form['#type'] == 'select' && empty($form['#multiple'])) {
+        $form[$value]['#default_value'] = 'All';
+      }
+
+      if ($value != 'value') {
+        unset($form['value']);
+      }
+    }
+  }
+
+  /**
+   * Build the form to let users create the group of exposed filters.
+   * This form is displayed when users click on button 'Build group'
+   */
+  function build_group_form(&$form, &$form_state) {
+    if (empty($this->options['exposed']) || empty($this->options['is_grouped'])) {
+      return;
+    }
+    $form['#theme'] = 'views_ui_build_group_filter_form';
+
+    // #flatten will move everything from $form['group_info'][$key] to $form[$key]
+    // prior to rendering. That's why the pre_render for it needs to run first,
+    // so that when the next pre_render (the one for fieldsets) runs, it gets
+    // the flattened data.
+    array_unshift($form['#pre_render'], 'views_ui_pre_render_flatten_data');
+    $form['group_info']['#flatten'] = TRUE;
+
+    if (!empty($this->options['group_info']['identifier'])) {
+      $identifier = $this->options['group_info']['identifier'];
+    }
+    else {
+      $identifier = 'group_' . $this->options['expose']['identifier'];
+    }
+    $form['group_info']['identifier'] = array(
+      '#type' => 'textfield',
+      '#default_value' => $identifier,
+      '#title' => t('Filter identifier'),
+      '#size' => 40,
+      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
+      '#fieldset' => 'more',
+    );
+    $form['group_info']['label'] = array(
+      '#type' => 'textfield',
+      '#default_value' => $this->options['group_info']['label'],
+      '#title' => t('Label'),
+      '#size' => 40,
+    );
+
+    $form['group_info']['optional'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Optional'),
+      '#description' => t('This exposed filter is optional and will have added options to allow it not to be set.'),
+      '#default_value' => $this->options['group_info']['optional'],
+    );
+    $form['group_info']['multiple'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Allow multiple selections'),
+      '#description' => t('Enable to allow users to select multiple items.'),
+      '#default_value' => $this->options['group_info']['multiple'],
+    );
+    $form['group_info']['widget'] = array(
+      '#type' => 'radios',
+      '#default_value' => $this->options['group_info']['widget'],
+      '#title' => t('Widget type'),
+      '#options' => array(
+        'radios' => t('Radios'),
+        'select' => t('Select'),
+      ),
+      '#description' => t('Select which kind of widget will be used to render the group of filters'),
+    );
+    $form['group_info']['remember'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Remember'),
+      '#description' => t('Remember the last setting the user gave this filter.'),
+      '#default_value' => $this->options['group_info']['remember'],
+    );
+
+    if (!empty($this->options['group_info']['identifier'])) {
+      $identifier = $this->options['group_info']['identifier'];
+    }
+    else {
+      $identifier = 'group_' . $this->options['expose']['identifier'];
+    }
+    $form['group_info']['identifier'] = array(
+      '#type' => 'textfield',
+      '#default_value' => $identifier,
+      '#title' => t('Filter identifier'),
+      '#size' => 40,
+      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
+      '#fieldset' => 'more',
+    );
+    $form['group_info']['label'] = array(
+      '#type' => 'textfield',
+      '#default_value' => $this->options['group_info']['label'],
+      '#title' => t('Label'),
+      '#size' => 40,
+    );
+    $form['group_info']['description'] = array(
+      '#type' => 'textfield',
+      '#default_value' => $this->options['group_info']['description'],
+      '#title' => t('Description'),
+      '#size' => 60,
+    );
+    $form['group_info']['optional'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Optional'),
+      '#description' => t('This exposed filter is optional and will have added options to allow it not to be set.'),
+      '#default_value' => $this->options['group_info']['optional'],
+    );
+    $form['group_info']['widget'] = array(
+      '#type' => 'radios',
+      '#default_value' => $this->options['group_info']['widget'],
+      '#title' => t('Widget type'),
+      '#options' => array(
+        'radios' => t('Radios'),
+        'select' => t('Select'),
+      ),
+      '#description' => t('Select which kind of widget will be used to render the group of filters'),
+    );
+    $form['group_info']['remember'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Remember'),
+      '#description' => t('Remember the last setting the user gave this filter.'),
+      '#default_value' => $this->options['group_info']['remember'],
+    );
+
+    $groups = array('All' => '- Any -'); // The string '- Any -' will not be rendered see @theme_views_ui_build_group_filter_form
+
+    // Provide 3 options to start when we are in a new group.
+    if (count($this->options['group_info']['group_items']) == 0) {
+      $this->options['group_info']['group_items'] = array_fill(1, 3, array());
+    }
+
+    // After the general settings, comes a table with all the existent groups.
+    $default_weight = 0;
+    foreach ($this->options['group_info']['group_items'] as $item_id => $item) {
+      if (!empty($form_state['values']['options']['group_info']['group_items'][$item_id]['remove'])) {
+        continue;
+      }
+      // Each rows contains three widgets:
+      // a) The title, where users define how they identify a pair of operator | value
+      // b) The operator
+      // c) The value (or values) to use in the filter with the selected operator
+
+      // In each row, we have to display the operator form and the value from
+      // $row acts as a fake form to render each widget in a row.
+      $row = array();
+      $groups[$item_id] = '';
+      $this->operator_form($row, $form_state);
+      // Force the operator form to be a select box. Some handlers uses
+      // radios and they occupy a lot of space in a table row.
+      $row['operator']['#type'] = 'select';
+      $row['operator']['#title'] = '';
+      $this->value_form($row, $form_state);
+
+      // Fix the dependencies to update value forms when operators
+      // changes. This is needed because forms are inside a new form and
+      // their ids changes. Dependencies are used when operator changes
+      // from to 'Between', 'Not Between', etc, and two or more widgets
+      // are displayed.
+      $without_children = TRUE;
+      foreach (element_children($row['value']) as $children) {
+        if (isset($row['value'][$children]['#dependency']['edit-options-operator'])) {
+          $row['value'][$children]['#dependency']["edit-options-group-info-group-items-$item_id-operator"] = $row['value'][$children]['#dependency']['edit-options-operator'];
+          unset($row['value'][$children]['#dependency']['edit-options-operator']);
+          $row['value'][$children]['#title'] = '';
+
+          if (!empty($this->options['group_info']['group_items'][$item_id]['value'][$children])) {
+            $row['value'][$children]['#default_value'] = $this->options['group_info']['group_items'][$item_id]['value'][$children];
+          }
+        }
+        $without_children = FALSE;
+      }
+
+      if ($without_children) {
+        if (!empty($this->options['group_info']['group_items'][$item_id]['value'])) {
+          $row['value']['#default_value'] = $this->options['group_info']['group_items'][$item_id]['value'];
+        }
+      }
+
+      if (!empty($this->options['group_info']['group_items'][$item_id]['operator'])) {
+        $row['operator']['#default_value'] = $this->options['group_info']['group_items'][$item_id]['operator'];
+      }
+
+      $default_title = '';
+      if (!empty($this->options['group_info']['group_items'][$item_id]['title'])) {
+        $default_title = $this->options['group_info']['group_items'][$item_id]['title'];
+      }
+
+      // Per item group, we have a title that identifies it.
+      $form['group_info']['group_items'][$item_id] = array(
+        'title' => array(
+          '#type' => 'textfield',
+          '#size' => 20,
+          '#default_value' => $default_title,
+        ),
+        'operator' => $row['operator'],
+        'value' => $row['value'],
+        'remove' => array(
+          '#type' => 'checkbox',
+          '#id' => 'views-removed-' . $item_id,
+          '#attributes' => array('class' => array('views-remove-checkbox')),
+          '#default_value' => 0,
+        ),
+        'weight' => array(
+          '#type' => 'weight',
+          '#delta' => 10,
+          '#default_value' => $default_weight++,
+          '#attributes' => array('class' => array('weight')),
+        ),
+      );
+    }
+    // From all groups, let chose which is the default.
+    $form['group_info']['default_group'] = array(
+      '#type' => 'radios',
+      '#options' => $groups,
+      '#default_value' => $this->options['group_info']['default_group'],
+      '#required' => TRUE,
+      '#attributes' => array(
+        'class' => array('default-radios'),
+      )
+    );
+    // From all groups, let chose which is the default.
+    $form['group_info']['default_group_multiple'] = array(
+      '#type' => 'checkboxes',
+      '#options' => $groups,
+      '#default_value' => $this->options['group_info']['default_group_multiple'],
+      '#attributes' => array(
+        'class' => array('default-checkboxes'),
+      )
+    );
+
+    $form['group_info']['add_group'] = array(
+      '#prefix' => '<div class="views-build-group clear-block">',
+      '#suffix' => '</div>',
+      '#type' => 'submit',
+      '#value' => t('Add another item'),
+      '#submit' => array('views_ui_config_item_form_add_group'),
+    );
+
+    $js = array();
+    $js['tableDrag']['views-filter-groups']['weight'][0] = array(
+      'target' => 'weight',
+      'source' => NULL,
+      'relationship' => 'sibling',
+      'action' => 'order',
+      'hidden' => TRUE,
+      'limit' => 0,
+    );
+    if (!empty($form_state['js settings']) && is_array($js)) {
+      $form_state['js settings'] = array_merge($form_state['js settings'], $js);
+    }
+    else {
+      $form_state['js settings'] = $js;
+    }
+  }
+
+
+  /**
+   * Make some translations to a form item to make it more suitable to
+   * exposing.
+   */
+  function exposed_translate(&$form, $type) {
+    if (!isset($form['#type'])) {
+      return;
+    }
+
+    if ($form['#type'] == 'radios') {
+      $form['#type'] = 'select';
+    }
+    // Checkboxes don't work so well in exposed forms due to GET conversions.
+    if ($form['#type'] == 'checkboxes') {
+      if (empty($form['#no_convert']) || empty($this->options['expose']['multiple'])) {
+        $form['#type'] = 'select';
+      }
+      if (!empty($this->options['expose']['multiple'])) {
+        $form['#multiple'] = TRUE;
+      }
+    }
+    if (empty($this->options['expose']['multiple']) && isset($form['#multiple'])) {
+      unset($form['#multiple']);
+      $form['#size'] = NULL;
+    }
+
+    // Cleanup in case the translated element's (radios or checkboxes) display value contains html.
+    if ($form['#type'] == 'select') {
+      $this->prepare_filter_select_options($form['#options']);
+    }
+
+    if ($type == 'value' && empty($this->always_required) && empty($this->options['expose']['required']) && $form['#type'] == 'select' && empty($form['#multiple'])) {
+      $any_label = variable_get('views_exposed_filter_any_label', 'new_any') == 'old_any' ? t('<Any>') : t('- Any -');
+      $form['#options'] = array('All' => $any_label) + $form['#options'];
+      $form['#default_value'] = 'All';
+    }
+
+    if (!empty($this->options['expose']['required'])) {
+      $form['#required'] = TRUE;
+    }
+  }
+
+
+
+  /**
+   * Sanitizes the HTML select element's options.
+   *
+   * The function is recursive to support optgroups.
+   */
+  function prepare_filter_select_options(&$options) {
+    foreach ($options as $value => $label) {
+      // Recurse for optgroups.
+      if (is_array($label)) {
+        $this->prepare_filter_select_options($options[$value]);
+      }
+      // FAPI has some special value to allow hierarchy.
+      // @see _form_options_flatten
+      elseif (is_object($label)) {
+        $this->prepare_filter_select_options($options[$value]->option);
+      }
+      else {
+        $options[$value] = strip_tags(decode_entities($label));
+      }
+    }
+  }
+
+  /**
+   * Tell the renderer about our exposed form. This only needs to be
+   * overridden for particularly complex forms. And maybe not even then.
+   *
+   * @return array|null
+   *   For standard exposed filters. An array with the following keys:
+   *   - operator: The $form key of the operator. Set to NULL if no operator.
+   *   - value: The $form key of the value. Set to NULL if no value.
+   *   - label: The label to use for this piece.
+   *   For grouped exposed filters. An array with the following keys:
+   *   - value: The $form key of the value. Set to NULL if no value.
+   *   - label: The label to use for this piece.
+   */
+  function exposed_info() {
+    if (empty($this->options['exposed'])) {
+      return;
+    }
+
+    if ($this->is_a_group()) {
+      return array(
+        'value' => $this->options['group_info']['identifier'],
+        'label' => $this->options['group_info']['label'],
+        'description' => $this->options['group_info']['description'],
+      );
+    }
+
+    return array(
+      'operator' => $this->options['expose']['operator_id'],
+      'value' => $this->options['expose']['identifier'],
+      'label' => $this->options['expose']['label'],
+      'description' => $this->options['expose']['description'],
+    );
+  }
+
+  /*
+   * Transform the input from a grouped filter into a standard filter.
+   *
+   * When a filter is a group, find the set of operator and values
+   * that the choosed item represents, and inform views that a normal
+   * filter was submitted by telling the operator and the value selected.
+   *
+   * The param $selected_group_id is only passed when the filter uses the
+   * checkboxes widget, and this function will be called for each item
+   * choosed in the checkboxes.
+   */
+  function convert_exposed_input(&$input, $selected_group_id = NULL) {
+    if ($this->is_a_group()) {
+      // If it is already defined the selected group, use it. Only valid
+      // when the filter uses checkboxes for widget.
+      if (!empty($selected_group_id)) {
+        $selected_group = $selected_group_id;
+      }
+      else {
+        $selected_group = $input[$this->options['group_info']['identifier']];
+      }
+      if ($selected_group == 'All' && !empty($this->options['group_info']['optional'])) {
+        return NULL;
+      }
+      if ($selected_group != 'All' && empty($this->options['group_info']['group_items'][$selected_group])) {
+        return FALSE;
+      }
+      if (isset($selected_group) && isset($this->options['group_info']['group_items'][$selected_group])) {
+        $input[$this->options['expose']['operator']] = $this->options['group_info']['group_items'][$selected_group]['operator'];
+
+        // Value can be optional, For example for 'empty' and 'not empty' filters.
+        if (!empty($this->options['group_info']['group_items'][$selected_group]['value'])) {
+          $input[$this->options['expose']['identifier']] = $this->options['group_info']['group_items'][$selected_group]['value'];
+        }
+        $this->options['expose']['use_operator'] = TRUE;
+
+        $this->group_info = $input[$this->options['group_info']['identifier']];
+        return TRUE;
+      }
+      else {
+        return FALSE;
+      }
+    }
+  }
+
+  /**
+   * Returns the options available for a grouped filter that users checkboxes
+   * as widget, and therefore has to be applied several times, one per
+   * item selected.
+   */
+  function group_multiple_exposed_input(&$input) {
+    if (!empty($input[$this->options['group_info']['identifier']])) {
+      return array_filter($input[$this->options['group_info']['identifier']]);
+    }
+    return array();
+  }
+
+  /**
+   * Returns TRUE if users can select multiple groups items of a
+   * grouped exposed filter.
+   */
+  function multiple_exposed_input() {
+    return $this->is_a_group() && !empty($this->options['group_info']['multiple']);
+  }
+
+  /**
+   * If set to remember exposed input in the session, store it there.
+   * This function is similar to store_exposed_input but modified to
+   * work properly when the filter is a group.
+   */
+  function store_group_input($input, $status) {
+    if (!$this->is_a_group() || empty($this->options['group_info']['identifier'])) {
+      return TRUE;
+    }
+
+    if (empty($this->options['group_info']['remember'])) {
+      return;
+    }
+
+    // Figure out which display id is responsible for the filters, so we
+    // know where to look for session stored values.
+    $display_id = ($this->view->display_handler->is_defaulted('filters')) ? 'default' : $this->view->current_display;
+
+    // false means that we got a setting that means to recuse ourselves,
+    // so we should erase whatever happened to be there.
+    if ($status === FALSE && isset($_SESSION['views'][$this->view->name][$display_id])) {
+      $session = &$_SESSION['views'][$this->view->name][$display_id];
+
+      if (isset($session[$this->options['group_info']['identifier']])) {
+        unset($session[$this->options['group_info']['identifier']]);
+      }
+    }
+
+    if ($status !== FALSE) {
+      if (!isset($_SESSION['views'][$this->view->name][$display_id])) {
+        $_SESSION['views'][$this->view->name][$display_id] = array();
+      }
+
+      $session = &$_SESSION['views'][$this->view->name][$display_id];
+
+      $session[$this->options['group_info']['identifier']] = $input[$this->options['group_info']['identifier']];
+    }
+  }
+
+  /**
+   * Check to see if input from the exposed filters should change
+   * the behavior of this filter.
+   */
+  function accept_exposed_input($input) {
+    if (empty($this->options['exposed'])) {
+      return TRUE;
+    }
+
+
+    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id']) && isset($input[$this->options['expose']['operator_id']])) {
+      $this->operator = $input[$this->options['expose']['operator_id']];
+    }
+
+    if (!empty($this->options['expose']['identifier'])) {
+      $value = $input[$this->options['expose']['identifier']];
+
+      // Various ways to check for the absence of non-required input.
+      if (empty($this->options['expose']['required'])) {
+        if (($this->operator == 'empty' || $this->operator == 'not empty') && $value === '') {
+          $value = ' ';
+        }
+
+        if ($this->operator != 'empty' && $this->operator != 'not empty') {
+          if ($value == 'All' || $value === array()) {
+            return FALSE;
+          }
+        }
+
+        if (!empty($this->always_multiple) && $value === '') {
+          return FALSE;
+        }
+      }
+
+
+      if (isset($value)) {
+        $this->value = $value;
+        if (empty($this->always_multiple) && empty($this->options['expose']['multiple'])) {
+          $this->value = array($value);
+        }
+      }
+      else {
+        return FALSE;
+      }
+    }
+
+    return TRUE;
+  }
+
+  function store_exposed_input($input, $status) {
+    if (empty($this->options['exposed']) || empty($this->options['expose']['identifier'])) {
+      return TRUE;
+    }
+
+    if (empty($this->options['expose']['remember'])) {
+      return;
+    }
+
+    // Check if we store exposed value for current user.
+    global $user;
+    $allowed_rids = empty($this->options['expose']['remember_roles']) ? array() : array_filter($this->options['expose']['remember_roles']);
+    $intersect_rids = array_intersect_key($allowed_rids, $user->roles);
+    if (empty($intersect_rids)) {
+      return;
+    }
+
+    // Figure out which display id is responsible for the filters, so we
+    // know where to look for session stored values.
+    $display_id = ($this->view->display_handler->is_defaulted('filters')) ? 'default' : $this->view->current_display;
+
+    // shortcut test.
+    $operator = !empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id']);
+
+    // false means that we got a setting that means to recuse ourselves,
+    // so we should erase whatever happened to be there.
+    if (!$status && isset($_SESSION['views'][$this->view->name][$display_id])) {
+      $session = &$_SESSION['views'][$this->view->name][$display_id];
+      if ($operator && isset($session[$this->options['expose']['operator_id']])) {
+        unset($session[$this->options['expose']['operator_id']]);
+      }
+
+      if (isset($session[$this->options['expose']['identifier']])) {
+        unset($session[$this->options['expose']['identifier']]);
+      }
+    }
+
+    if ($status) {
+      if (!isset($_SESSION['views'][$this->view->name][$display_id])) {
+        $_SESSION['views'][$this->view->name][$display_id] = array();
+      }
+
+      $session = &$_SESSION['views'][$this->view->name][$display_id];
+
+      if ($operator && isset($input[$this->options['expose']['operator_id']])) {
+        $session[$this->options['expose']['operator_id']] = $input[$this->options['expose']['operator_id']];
+      }
+
+      $session[$this->options['expose']['identifier']] = $input[$this->options['expose']['identifier']];
+    }
+  }
+
+  /**
+   * Add this filter to the query.
+   *
+   * Due to the nature of fapi, the value and the operator have an unintended
+   * level of indirection. You will find them in $this->operator
+   * and $this->value respectively.
+   */
+  function query() {
+    $this->ensure_my_table();
+    $this->query->add_where($this->options['group'], "$this->table_alias.$this->real_field", $this->value, $this->operator);
+  }
+
+  /**
+   * Can this filter be used in OR groups?
+   *
+   * Some filters have complicated where clauses that cannot be easily used
+   * with OR groups. Some filters must also use HAVING which also makes
+   * them not groupable. These filters will end up in a special group
+   * if OR grouping is in use.
+   *
+   * @return bool
+   */
+   function can_group() {
+     return TRUE;
+   }
+}
+
+
+/**
+ * A special handler to take the place of missing or broken handlers.
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_broken extends views_handler_filter {
+  function ui_name($short = FALSE) {
+    return t('Broken/missing handler');
+  }
+
+  function ensure_my_table() { /* No table to ensure! */ }
+  function query($group_by = FALSE) { /* No query to run */ }
+  function options_form(&$form, &$form_state) {
+    $form['markup'] = array(
+      '#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
+    );
+  }
+
+  /**
+   * Determine if the handler is considered 'broken'
+   */
+  function broken() { return TRUE; }
+}
+
+/**
+ * Filter by no empty values, though allow to use "0".
+ * @param $var
+ * @return bool
+ */
+function _views_array_filter_zero($var) {
+  return trim($var) != "";
+}
+
+
+/**
+ * @}
+ */

+ 179 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_boolean_operator.inc

@@ -0,0 +1,179 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_boolean_operator.
+ */
+
+/**
+ * Simple filter to handle matching of boolean values
+ *
+ * Definition items:
+ * - label: (REQUIRED) The label for the checkbox.
+ * - type: For basic 'true false' types, an item can specify the following:
+ *    - true-false: True/false (this is the default)
+ *    - yes-no: Yes/No
+ *    - on-off: On/Off
+ *    - enabled-disabled: Enabled/Disabled
+ * - accept null: Treat a NULL value as false.
+ * - use equal: If you use this flag the query will use = 1 instead of <> 0.
+ *   This might be helpful for performance reasons.
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_boolean_operator extends views_handler_filter {
+  // exposed filter options
+  var $always_multiple = TRUE;
+  // Don't display empty space where the operator would be.
+  var $no_operator = TRUE;
+  // Whether to accept NULL as a false value or not
+  var $accept_null = FALSE;
+
+  function construct() {
+    $this->value_value = t('True');
+    if (isset($this->definition['label'])) {
+      $this->value_value = $this->definition['label'];
+    }
+    if (isset($this->definition['accept null'])) {
+      $this->accept_null = (bool) $this->definition['accept null'];
+    }
+    else if (isset($this->definition['accept_null'])) {
+      $this->accept_null = (bool) $this->definition['accept_null'];
+    }
+    $this->value_options = NULL;
+    parent::construct();
+  }
+
+  /**
+   * Return the possible options for this filter.
+   *
+   * Child classes should override this function to set the possible values
+   * for the filter.  Since this is a boolean filter, the array should have
+   * two possible keys: 1 for "True" and 0 for "False", although the labels
+   * can be whatever makes sense for the filter.  These values are used for
+   * configuring the filter, when the filter is exposed, and in the admin
+   * summary of the filter.  Normally, this should be static data, but if it's
+   * dynamic for some reason, child classes should use a guard to reduce
+   * database hits as much as possible.
+   */
+  function get_value_options() {
+    if (isset($this->definition['type'])) {
+      if ($this->definition['type'] == 'yes-no') {
+        $this->value_options = array(1 => t('Yes'), 0 => t('No'));
+      }
+      if ($this->definition['type'] == 'on-off') {
+        $this->value_options = array(1 => t('On'), 0 => t('Off'));
+      }
+      if ($this->definition['type'] == 'enabled-disabled') {
+        $this->value_options = array(1 => t('Enabled'), 0 => t('Disabled'));
+      }
+    }
+
+    // Provide a fallback if the above didn't set anything.
+    if (!isset($this->value_options)) {
+      $this->value_options = array(1 => t('True'), 0 => t('False'));
+    }
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['value']['default'] = FALSE;
+
+    return $options;
+  }
+
+  function operator_form(&$form, &$form_state) {
+    $form['operator'] = array();
+  }
+
+  function value_form(&$form, &$form_state) {
+    if (empty($this->value_options)) {
+      // Initialize the array of possible values for this filter.
+      $this->get_value_options();
+    }
+    if (!empty($form_state['exposed'])) {
+      // Exposed filter: use a select box to save space.
+      $filter_form_type = 'select';
+    }
+    else {
+      // Configuring a filter: use radios for clarity.
+      $filter_form_type = 'radios';
+    }
+    $form['value'] = array(
+      '#type' => $filter_form_type,
+      '#title' => $this->value_value,
+      '#options' => $this->value_options,
+      '#default_value' => $this->value,
+    );
+    if (!empty($this->options['exposed'])) {
+      $identifier = $this->options['expose']['identifier'];
+      if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
+        $form_state['input'][$identifier] = $this->value;
+      }
+      // If we're configuring an exposed filter, add an <Any> option.
+      if (empty($form_state['exposed']) || empty($this->options['expose']['required'])) {
+        $any_label = variable_get('views_exposed_filter_any_label', 'new_any') == 'old_any' ? '<Any>' : t('- Any -');
+        if ($form['value']['#type'] != 'select') {
+          $any_label = check_plain($any_label);
+        }
+        $form['value']['#options'] = array('All' => $any_label) + $form['value']['#options'];
+      }
+    }
+  }
+
+  function value_validate($form, &$form_state) {
+    if ($form_state['values']['options']['value'] == 'All' && !empty($form_state['values']['options']['expose']['required'])) {
+      form_set_error('value', t('You must select a value unless this is an non-required exposed filter.'));
+    }
+  }
+
+  function admin_summary() {
+    if ($this->is_a_group()) {
+      return t('grouped');
+    }
+    if (!empty($this->options['exposed'])) {
+      return t('exposed');
+    }
+    if (empty($this->value_options)) {
+      $this->get_value_options();
+    }
+    // Now that we have the valid options for this filter, just return the
+    // human-readable label based on the current value.  The value_options
+    // array is keyed with either 0 or 1, so if the current value is not
+    // empty, use the label for 1, and if it's empty, use the label for 0.
+    return $this->value_options[!empty($this->value)];
+  }
+
+  function expose_options() {
+    parent::expose_options();
+    $this->options['expose']['operator_id'] = '';
+    $this->options['expose']['label'] = $this->value_value;
+    $this->options['expose']['required'] = TRUE;
+  }
+
+  function query() {
+    $this->ensure_my_table();
+    $field = "$this->table_alias.$this->real_field";
+
+    if (empty($this->value)) {
+      if ($this->accept_null) {
+        $or = db_or()
+          ->condition($field, 0, '=')
+          ->condition($field, NULL, 'IS NULL');
+        $this->query->add_where($this->options['group'], $or);
+      }
+      else {
+        $this->query->add_where($this->options['group'], $field, 0, '=');
+      }
+    }
+    else {
+      if (!empty($this->definition['use equal'])) {
+        $this->query->add_where($this->options['group'], $field, 1, '=');
+      }
+      else {
+        $this->query->add_where($this->options['group'], $field, 0, '<>');
+      }
+    }
+  }
+}

+ 35 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_boolean_operator_string.inc

@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_boolean_operator_string.
+ */
+
+/**
+ * Simple filter to handle matching of boolean values.
+ *
+ * This handler checks to see if a string field is empty (equal to '') or not.
+ * It is otherwise identical to the parent operator.
+ *
+ * Definition items:
+ * - label: (REQUIRED) The label for the checkbox.
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_boolean_operator_string extends views_handler_filter_boolean_operator {
+  function query() {
+    $this->ensure_my_table();
+    $where = "$this->table_alias.$this->real_field ";
+
+    if (empty($this->value)) {
+      $where .= "= ''";
+      if ($this->accept_null) {
+        $where = '(' . $where . " OR $this->table_alias.$this->real_field IS NULL)";
+      }
+    }
+    else {
+      $where .= "<> ''";
+    }
+    $this->query->add_where($this->options['group'], $where);
+  }
+}

+ 170 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_combine.inc

@@ -0,0 +1,170 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_combine.
+ */
+
+/**
+ * Filter handler which allows to search on multiple fields.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_filter_combine extends views_handler_filter_string {
+  /**
+   * @var views_plugin_query_default
+   */
+  public $query;
+
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['fields'] = array('default' => array());
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    $this->view->init_style();
+
+    // Allow to choose all fields as possible.
+    if ($this->view->style_plugin->uses_fields()) {
+      $options = array();
+      foreach ($this->view->display_handler->get_handlers('field') as $name => $field) {
+        $options[$name] = $field->ui_name(TRUE);
+      }
+      if ($options) {
+        $form['fields'] = array(
+          '#type' => 'select',
+          '#title' => t('Choose fields to combine for filtering'),
+          '#description' => t("This filter doesn't work for very special field handlers."),
+          '#multiple' => TRUE,
+          '#options' => $options,
+          '#default_value' => $this->options['fields'],
+        );
+      }
+      else {
+        form_set_error('', t('You have to add some fields to be able to use this filter.'));
+      }
+    }
+  }
+
+  function query() {
+    $this->view->_build('field');
+    $fields = array();
+    // Only add the fields if they have a proper field and table alias.
+    foreach ($this->options['fields'] as $id) {
+      $field = $this->view->field[$id];
+      // Always add the table of the selected fields to be sure a table alias
+      // exists.
+      $field->ensure_my_table();
+      if (!empty($field->field_alias) && !empty($field->field_alias)) {
+        $fields[] = "$field->table_alias.$field->real_field";
+      }
+    }
+    if ($fields) {
+      $count = count($fields);
+      $separated_fields = array();
+      foreach ($fields as $key => $field) {
+        $separated_fields[] = $field;
+        if ($key < $count - 1) {
+          $separated_fields[] = "' '";
+        }
+      }
+      $expression = implode(', ', $separated_fields);
+      $expression = "CONCAT_WS(' ', $expression)";
+
+      $info = $this->operators();
+      if (!empty($info[$this->operator]['method'])) {
+        $this->{$info[$this->operator]['method']}($expression);
+      }
+    }
+  }
+
+  // By default things like op_equal uses add_where, that doesn't support
+  // complex expressions, so override all operators.
+  function op_equal($field) {
+    $placeholder = $this->placeholder();
+    $operator = $this->operator();
+    $this->query->add_where_expression($this->options['group'], "$field $operator $placeholder", array($placeholder => $this->value));
+  }
+
+  function op_contains($field) {
+    $placeholder = $this->placeholder();
+    $this->query->add_where_expression($this->options['group'], "$field LIKE $placeholder", array($placeholder => '%' . db_like($this->value) . '%'));
+  }
+
+  function op_word($field) {
+    $where = $this->operator == 'word' ? db_or() : db_and();
+
+    // Don't filter on empty strings.
+    if (empty($this->value)) {
+      return;
+    }
+
+    preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->value, $matches, PREG_SET_ORDER);
+    foreach ($matches as $match) {
+      $phrase = FALSE;
+      // Strip off phrase quotes.
+      if ($match[2]{0} == '"') {
+        $match[2] = substr($match[2], 1, -1);
+        $phrase = TRUE;
+      }
+      $words = trim($match[2], ',?!();:-');
+      $words = $phrase ? array($words) : preg_split('/ /', $words, -1, PREG_SPLIT_NO_EMPTY);
+      $placeholder = $this->placeholder();
+      foreach ($words as $word) {
+        $where->where($field . " LIKE $placeholder", array($placeholder => '%' . db_like(trim($word, " ,!?")) . '%'));
+      }
+    }
+
+    if (!$where) {
+      return;
+    }
+
+    // Previously this was a call_user_func_array() but that's unnecessary
+    // as views will unpack an array that is a single arg.
+    $this->query->add_where($this->options['group'], $where);
+  }
+
+  function op_starts($field) {
+    $placeholder = $this->placeholder();
+    $this->query->add_where_expression($this->options['group'], "$field LIKE $placeholder", array($placeholder => db_like($this->value) . '%'));
+  }
+
+  function op_not_starts($field) {
+    $placeholder = $this->placeholder();
+    $this->query->add_where_expression($this->options['group'], "$field NOT LIKE $placeholder", array($placeholder => db_like($this->value) . '%'));
+  }
+
+  function op_ends($field) {
+    $placeholder = $this->placeholder();
+    $this->query->add_where_expression($this->options['group'], "$field LIKE $placeholder", array($placeholder => '%' . db_like($this->value)));
+  }
+
+  function op_not_ends($field) {
+    $placeholder = $this->placeholder();
+    $this->query->add_where_expression($this->options['group'], "$field NOT LIKE $placeholder", array($placeholder => '%' . db_like($this->value)));
+  }
+
+  function op_not($field) {
+    $placeholder = $this->placeholder();
+    $this->query->add_where_expression($this->options['group'], "$field NOT LIKE $placeholder", array($placeholder => '%' . db_like($this->value) . '%'));
+  }
+
+  function op_regex($field) {
+    $placeholder = $this->placeholder();
+    $this->query->add_where_expression($this->options['group'], "$field RLIKE $placeholder", array($placeholder => $this->value));
+  }
+
+  function op_empty($field) {
+    if ($this->operator == 'empty') {
+      $operator = "IS NULL";
+    }
+    else {
+      $operator = "IS NOT NULL";
+    }
+
+    $this->query->add_where_expression($this->options['group'], "$field $operator");
+  }
+}

+ 183 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_date.inc

@@ -0,0 +1,183 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_date.
+ */
+
+/**
+ * Filter to handle dates stored as a timestamp.
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_date extends views_handler_filter_numeric {
+  function option_definition() {
+    $options = parent::option_definition();
+
+    // value is already set up properly, we're just adding our new field to it.
+    $options['value']['contains']['type']['default'] = 'date';
+
+    return $options;
+  }
+
+  /**
+   * Add a type selector to the value form
+   */
+  function value_form(&$form, &$form_state) {
+    if (empty($form_state['exposed'])) {
+      $form['value']['type'] = array(
+        '#type' => 'radios',
+        '#title' => t('Value type'),
+        '#options' => array(
+          'date' => t('A date in any machine readable format. CCYY-MM-DD HH:MM:SS is preferred.'),
+          'offset' => t('An offset from the current time such as "!example1" or "!example2"', array('!example1' => '+1 day', '!example2' => '-2 hours -30 minutes')),
+        ),
+        '#default_value' => !empty($this->value['type']) ? $this->value['type'] : 'date',
+      );
+    }
+    parent::value_form($form, $form_state);
+  }
+
+  function options_validate(&$form, &$form_state) {
+    parent::options_validate($form, $form_state);
+
+    if (!empty($this->options['exposed']) && empty($form_state['values']['options']['expose']['required'])) {
+      // Who cares what the value is if it's exposed and non-required.
+      return;
+    }
+
+    $this->validate_valid_time($form['value'], $form_state['values']['options']['operator'], $form_state['values']['options']['value']);
+  }
+
+  function exposed_validate(&$form, &$form_state) {
+    if (empty($this->options['exposed'])) {
+      return;
+    }
+
+    if (empty($this->options['expose']['required'])) {
+      // Who cares what the value is if it's exposed and non-required.
+      return;
+    }
+
+    $value = &$form_state['values'][$this->options['expose']['identifier']];
+    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id'])) {
+      $operator = $form_state['values'][$this->options['expose']['operator_id']];
+    }
+    else {
+      $operator = $this->operator;
+    }
+
+    $this->validate_valid_time($this->options['expose']['identifier'], $operator, $value);
+
+  }
+
+  /**
+   * Validate that the time values convert to something usable.
+   */
+  function validate_valid_time(&$form, $operator, $value) {
+    $operators = $this->operators();
+
+    if ($operators[$operator]['values'] == 1) {
+      $convert = strtotime($value['value']);
+      if (!empty($form['value']) && ($convert == -1 || $convert === FALSE)) {
+        form_error($form['value'], t('Invalid date format.'));
+      }
+    }
+    elseif ($operators[$operator]['values'] == 2) {
+      $min = strtotime($value['min']);
+      if ($min == -1 || $min === FALSE) {
+        form_error($form['min'], t('Invalid date format.'));
+      }
+      $max = strtotime($value['max']);
+      if ($max == -1 || $max === FALSE) {
+        form_error($form['max'], t('Invalid date format.'));
+      }
+    }
+  }
+
+  /**
+   * Validate the build group options form.
+   */
+  function build_group_validate($form, &$form_state) {
+    // Special case to validate grouped date filters, this is because the
+    // $group['value'] array contains the type of filter (date or offset)
+    // and therefore the number of items the comparission has to be done
+    // against 'one' instead of 'zero'.
+    foreach ($form_state['values']['options']['group_info']['group_items'] as $id => $group) {
+      if (empty($group['remove'])) {
+        // Check if the title is defined but value wasn't defined.
+        if (!empty($group['title'])) {
+          if ((!is_array($group['value']) && empty($group['value'])) || (is_array($group['value']) && count(array_filter($group['value'])) == 1)) {
+            form_error($form['group_info']['group_items'][$id]['value'], t('The value is required if title for this item is defined.'));
+          }
+        }
+
+        // Check if the value is defined but title wasn't defined.
+        if ((!is_array($group['value']) && !empty($group['value'])) || (is_array($group['value']) && count(array_filter($group['value'])) > 1)) {
+          if (empty($group['title'])) {
+            form_error($form['group_info']['group_items'][$id]['title'], t('The title is required if value for this item is defined.'));
+          }
+        }
+      }
+    }
+  }
+
+
+  function accept_exposed_input($input) {
+    if (empty($this->options['exposed'])) {
+      return TRUE;
+    }
+
+    // Store this because it will get overwritten.
+    $type = $this->value['type'];
+    $rc = parent::accept_exposed_input($input);
+
+    // Don't filter if value(s) are empty.
+    $operators = $this->operators();
+    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id'])) {
+      $operator = $input[$this->options['expose']['operator_id']];
+    }
+    else {
+      $operator = $this->operator;
+    }
+
+    if ($operators[$operator]['values'] == 1) {
+      if ($this->value['value'] == '') {
+        return FALSE;
+      }
+    }
+    else {
+      if ($this->value['min'] == '' || $this->value['max'] == '') {
+        return FALSE;
+      }
+    }
+
+    // restore what got overwritten by the parent.
+    $this->value['type'] = $type;
+    return $rc;
+  }
+
+  function op_between($field) {
+    $a = intval(strtotime($this->value['min'], 0));
+    $b = intval(strtotime($this->value['max'], 0));
+
+    if ($this->value['type'] == 'offset') {
+      $a = '***CURRENT_TIME***' . sprintf('%+d', $a); // keep sign
+      $b = '***CURRENT_TIME***' . sprintf('%+d', $b); // keep sign
+    }
+    // This is safe because we are manually scrubbing the values.
+    // It is necessary to do it this way because $a and $b are formulas when using an offset.
+    $operator = strtoupper($this->operator);
+    $this->query->add_where_expression($this->options['group'], "$field $operator $a AND $b");
+  }
+
+  function op_simple($field) {
+    $value = intval(strtotime($this->value['value'], 0));
+    if (!empty($this->value['type']) && $this->value['type'] == 'offset') {
+      $value = '***CURRENT_TIME***' . sprintf('%+d', $value); // keep sign
+    }
+    // This is safe because we are manually scrubbing the value.
+    // It is necessary to do it this way because $value is a formula when using an offset.
+    $this->query->add_where_expression($this->options['group'], "$field $this->operator $value");
+  }
+}

+ 122 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_entity_bundle.inc

@@ -0,0 +1,122 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_entity_bundle
+ */
+
+/**
+ * Filter class which allows to filter by certain bundles of an entity.
+ *
+ * This class provides workarounds for taxonomy and comment.
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_entity_bundle extends views_handler_filter_in_operator {
+  /**
+   * Stores the entity type on which the filter filters.
+   *
+   * @var string
+   */
+  public $entity_type;
+
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+
+    $this->get_entity_type();
+  }
+
+  /**
+   * Set and returns the entity_type.
+   *
+   * @return string
+   *   The entity type on the filter.
+   */
+  function get_entity_type() {
+    if (!isset($this->entity_type)) {
+      $data = views_fetch_data($this->table);
+      if (isset($data['table']['entity type'])) {
+        $this->entity_type = $data['table']['entity type'];
+      }
+
+      // If the current filter is under a relationship you can't be sure that the
+      // entity type of the view is the entity type of the current filter
+      // For example a filter from a node author on a node view does have users as entity type.
+      if (!empty($this->options['relationship']) && $this->options['relationship'] != 'none') {
+        $relationships = $this->view->display_handler->get_option('relationships');
+        if (!empty($relationships[$this->options['relationship']])) {
+          $options = $relationships[$this->options['relationship']];
+          $data = views_fetch_data($options['table']);
+          $this->entity_type = $data['table']['entity type'];
+        }
+      }
+    }
+
+    return $this->entity_type;
+  }
+
+
+  function get_value_options() {
+    if (!isset($this->value_options)) {
+      $info = entity_get_info($this->entity_type);
+      $types = $info['bundles'];
+      $this->value_title = t('@entity types', array('@entity' => $info['label']));
+
+      $options = array();
+      foreach ($types as $type => $info) {
+        $options[$type] = t($info['label']);
+      }
+      asort($options);
+      $this->value_options = $options;
+    }
+  }
+
+  /**
+   * All entity types beside comment and taxonomy terms have a proper implement
+   * bundle, though these two need an additional join to node/vocab table
+   * to work as required.
+   */
+  function query() {
+    $this->ensure_my_table();
+
+    // Adjust the join for the comment case.
+    if ($this->entity_type == 'comment') {
+      $join = new views_join();
+      $def = array(
+        'table' => 'node',
+        'field' => 'nid',
+        'left_table' => $this->table_alias,
+        'left_field' => 'nid',
+      );
+      $join->definition = $def;
+      $join->construct();
+      $join->adjusted = TRUE;
+      $this->table_alias = $this->query->add_table('node', $this->relationship, $join);
+      $this->real_field = 'type';
+
+      // Replace the value to match the node type column.
+      foreach ($this->value as &$value) {
+        $value = str_replace('comment_node_', '', $value);
+      }
+    }
+    elseif ($this->entity_type == 'taxonomy_term') {
+      $join = new views_join();
+      $def = array(
+        'table' => 'taxonomy_vocabulary',
+        'field' => 'vid',
+        'left_table' => $this->table_alias,
+        'left_field' => 'vid',
+      );
+      $join->definition = $def;
+      $join->construct();
+      $join->adjusted = TRUE;
+      $this->table_alias = $this->query->add_table('taxonomy_vocabulary', $this->relationship, $join);
+      $this->real_field = 'machine_name';
+    }
+    else {
+      $entity_info = entity_get_info($this->entity_type);
+      $this->real_field = $entity_info['bundle keys']['bundle'];
+    }
+    parent::query();
+  }
+}

+ 45 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_equality.inc

@@ -0,0 +1,45 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_equality.
+ */
+
+/**
+ * Simple filter to handle equal to / not equal to filters
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_equality extends views_handler_filter {
+  // exposed filter options
+  var $always_multiple = TRUE;
+
+  /**
+   * Provide simple equality operator
+   */
+  function operator_options() {
+    return array(
+      '=' => t('Is equal to'),
+      '!=' => t('Is not equal to'),
+    );
+  }
+
+  /**
+   * Provide a simple textfield for equality
+   */
+  function value_form(&$form, &$form_state) {
+    $form['value'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Value'),
+      '#size' => 30,
+      '#default_value' => $this->value,
+    );
+
+    if (!empty($form_state['exposed'])) {
+      $identifier = $this->options['expose']['identifier'];
+      if (!isset($form_state['input'][$identifier])) {
+        $form_state['input'][$identifier] = $this->value;
+      }
+    }
+  }
+}

+ 56 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_group_by_numeric.inc

@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_group_by_numeric.
+ */
+
+/**
+ * Simple filter to handle greater than/less than filters
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_group_by_numeric extends views_handler_filter_numeric {
+  function query() {
+    $this->ensure_my_table();
+    $field = $this->get_field();
+
+    $info = $this->operators();
+    if (!empty($info[$this->operator]['method'])) {
+      $this->{$info[$this->operator]['method']}($field);
+    }
+  }
+  function op_between($field) {
+    $placeholder_min = $this->placeholder();
+    $placeholder_max = $this->placeholder();
+    if ($this->operator == 'between') {
+      $this->query->add_having_expression($this->options['group'], "$field >= $placeholder_min", array($placeholder_min => $this->value['min']));
+      $this->query->add_having_expression($this->options['group'], "$field <= $placeholder_max", array($placeholder_max => $this->value['max']));
+    }
+    else {
+      $this->query->add_having_expression($this->options['group'], "$field <= $placeholder_min OR $field >= $placeholder_max", array($placeholder_min => $this->value['min'], $placeholder_max => $this->value['max']));
+    }
+  }
+
+  function op_simple($field) {
+    $placeholder = $this->placeholder();
+    $this->query->add_having_expression($this->options['group'], "$field $this->operator $placeholder", array($placeholder => $this->value['value']));
+  }
+
+  function op_empty($field) {
+    if ($this->operator == 'empty') {
+      $operator = "IS NULL";
+    }
+    else {
+      $operator = "IS NOT NULL";
+    }
+
+    $this->query->add_having_expression($this->options['group'], "$field $operator");
+  }
+
+  function ui_name($short = FALSE) {
+    return $this->get_field(parent::ui_name($short));
+  }
+
+  function can_group() { return FALSE; }
+}

+ 426 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_in_operator.inc

@@ -0,0 +1,426 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_in_operator.
+ */
+
+/**
+ * Simple filter to handle matching of multiple options selectable via checkboxes
+ *
+ * Definition items:
+ * - options callback: The function to call in order to generate the value options. If omitted, the options 'Yes' and 'No' will be used.
+ * - options arguments: An array of arguments to pass to the options callback.
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_in_operator extends views_handler_filter {
+  var $value_form_type = 'checkboxes';
+
+  /**
+   * @var array
+   * Stores all operations which are available on the form.
+   */
+  var $value_options = NULL;
+
+  function construct() {
+    parent::construct();
+    $this->value_title = t('Options');
+    $this->value_options = NULL;
+  }
+
+  /**
+   * Child classes should be used to override this function and set the
+   * 'value options', unless 'options callback' is defined as a valid function
+   * or static public method to generate these values.
+   *
+   * This can use a guard to be used to reduce database hits as much as
+   * possible.
+   *
+   * @return
+   *   Return the stored values in $this->value_options if someone expects it.
+   */
+  function get_value_options() {
+    if (isset($this->value_options)) {
+      return;
+    }
+
+    if (isset($this->definition['options callback']) && is_callable($this->definition['options callback'])) {
+      if (isset($this->definition['options arguments']) && is_array($this->definition['options arguments'])) {
+        $this->value_options = call_user_func_array($this->definition['options callback'], $this->definition['options arguments']);
+      }
+      else {
+        $this->value_options = call_user_func($this->definition['options callback']);
+      }
+    }
+    else {
+      $this->value_options = array(t('Yes'), t('No'));
+    }
+
+    return $this->value_options;
+  }
+
+  function expose_options() {
+    parent::expose_options();
+    $this->options['expose']['reduce'] = FALSE;
+  }
+
+  function expose_form(&$form, &$form_state) {
+    parent::expose_form($form, $form_state);
+    $form['expose']['reduce'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Limit list to selected items'),
+      '#description' => t('If checked, the only items presented to the user will be the ones selected here.'),
+      '#default_value' => !empty($this->options['expose']['reduce']), // safety
+    );
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['operator']['default'] = 'in';
+    $options['value']['default'] = array();
+    $options['expose']['contains']['reduce'] = array('default' => FALSE, 'bool' => TRUE);
+
+    return $options;
+  }
+
+  /**
+   * This kind of construct makes it relatively easy for a child class
+   * to add or remove functionality by overriding this function and
+   * adding/removing items from this array.
+   */
+  function operators() {
+    $operators = array(
+      'in' => array(
+        'title' => t('Is one of'),
+        'short' => t('in'),
+        'short_single' => t('='),
+        'method' => 'op_simple',
+        'values' => 1,
+      ),
+      'not in' => array(
+        'title' => t('Is not one of'),
+        'short' => t('not in'),
+        'short_single' => t('<>'),
+        'method' => 'op_simple',
+        'values' => 1,
+      ),
+    );
+    // if the definition allows for the empty operator, add it.
+    if (!empty($this->definition['allow empty'])) {
+      $operators += array(
+        'empty' => array(
+          'title' => t('Is empty (NULL)'),
+          'method' => 'op_empty',
+          'short' => t('empty'),
+          'values' => 0,
+        ),
+        'not empty' => array(
+          'title' => t('Is not empty (NOT NULL)'),
+          'method' => 'op_empty',
+          'short' => t('not empty'),
+          'values' => 0,
+        ),
+      );
+    }
+
+    return $operators;
+  }
+
+  /**
+   * Build strings from the operators() for 'select' options
+   */
+  function operator_options($which = 'title') {
+    $options = array();
+    foreach ($this->operators() as $id => $info) {
+      $options[$id] = $info[$which];
+    }
+
+    return $options;
+  }
+
+  function operator_values($values = 1) {
+    $options = array();
+    foreach ($this->operators() as $id => $info) {
+      if (isset($info['values']) && $info['values'] == $values) {
+        $options[] = $id;
+      }
+    }
+
+    return $options;
+  }
+
+  function value_form(&$form, &$form_state) {
+    $form['value'] = array();
+    $options = array();
+
+    if (empty($form_state['exposed'])) {
+      // Add a select all option to the value form.
+      $options = array('all' => t('Select all'));
+    }
+
+    $this->get_value_options();
+    $options += $this->value_options;
+    $default_value = (array) $this->value;
+
+    $which = 'all';
+    if (!empty($form['operator'])) {
+      $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator';
+    }
+    if (!empty($form_state['exposed'])) {
+      $identifier = $this->options['expose']['identifier'];
+
+      if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) {
+        // exposed and locked.
+        $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none';
+      }
+      else {
+        $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']);
+      }
+
+      if (!empty($this->options['expose']['reduce'])) {
+        $options = $this->reduce_value_options();
+
+        if (!empty($this->options['expose']['multiple']) && empty($this->options['expose']['required'])) {
+          $default_value = array();
+        }
+      }
+
+      if (empty($this->options['expose']['multiple'])) {
+        if (empty($this->options['expose']['required']) && (empty($default_value) || !empty($this->options['expose']['reduce']))) {
+          $default_value = 'All';
+        }
+        elseif (empty($default_value)) {
+          $keys = array_keys($options);
+          $default_value = array_shift($keys);
+        }
+        else {
+          $copy = $default_value;
+          $default_value = array_shift($copy);
+        }
+      }
+    }
+
+    if ($which == 'all' || $which == 'value') {
+      $form['value'] = array(
+        '#type' => $this->value_form_type,
+        '#title' => $this->value_title,
+        '#options' => $options,
+        '#default_value' => $default_value,
+        // These are only valid for 'select' type, but do no harm to checkboxes.
+        '#multiple' => TRUE,
+        '#size' => count($options) > 8 ? 8 : count($options),
+      );
+      if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
+        $form_state['input'][$identifier] = $default_value;
+      }
+
+      if ($which == 'all') {
+        if (empty($form_state['exposed']) && (in_array($this->value_form_type, array('checkbox', 'checkboxes', 'radios', 'select')))) {
+          $form['value']['#prefix'] = '<div id="edit-options-value-wrapper">';
+          $form['value']['#suffix'] = '</div>';
+        }
+        $form['value']['#dependency'] = array($source => $this->operator_values(1));
+      }
+    }
+  }
+
+  /**
+   * When using exposed filters, we may be required to reduce the set.
+   */
+  function reduce_value_options($input = NULL) {
+    if (!isset($input)) {
+      $input = $this->value_options;
+    }
+
+    // Because options may be an array of strings, or an array of mixed arrays
+    // and strings (optgroups) or an array of objects, we have to
+    // step through and handle each one individually.
+    $options = array();
+    foreach ($input as $id => $option) {
+      if (is_array($option)) {
+        $options[$id] = $this->reduce_value_options($option);
+        continue;
+      }
+      elseif (is_object($option)) {
+        $keys = array_keys($option->option);
+        $key = array_shift($keys);
+        if (isset($this->options['value'][$key])) {
+          $options[$id] = $option;
+        }
+      }
+      elseif (isset($this->options['value'][$id])) {
+        $options[$id] = $option;
+      }
+    }
+    return $options;
+  }
+
+  function accept_exposed_input($input) {
+    // A very special override because the All state for this type of
+    // filter could have a default:
+    if (empty($this->options['exposed'])) {
+      return TRUE;
+    }
+
+    // If this is non-multiple and non-required, then this filter will
+    // participate, but using the default settings, *if* 'limit is true.
+    if (empty($this->options['expose']['multiple']) && empty($this->options['expose']['required']) && !empty($this->options['expose']['limit'])) {
+      $identifier = $this->options['expose']['identifier'];
+      if ($input[$identifier] == 'All') {
+        return TRUE;
+      }
+    }
+
+    return parent::accept_exposed_input($input);
+  }
+
+  function value_submit($form, &$form_state) {
+    // Drupal's FAPI system automatically puts '0' in for any checkbox that
+    // was not set, and the key to the checkbox if it is set.
+    // Unfortunately, this means that if the key to that checkbox is 0,
+    // we are unable to tell if that checkbox was set or not.
+
+    // Luckily, the '#value' on the checkboxes form actually contains
+    // *only* a list of checkboxes that were set, and we can use that
+    // instead.
+
+    $form_state['values']['options']['value'] = $form['value']['#value'];
+  }
+
+  function admin_summary() {
+    if ($this->is_a_group()) {
+      return t('grouped');
+    }
+    if (!empty($this->options['exposed'])) {
+      return t('exposed');
+    }
+    $info = $this->operators();
+
+    $this->get_value_options();
+
+    if (!is_array($this->value)) {
+      return;
+    }
+
+    $operator = check_plain($info[$this->operator]['short']);
+    $values = '';
+    if (in_array($this->operator, $this->operator_values(1))) {
+      // Remove every element which is not known.
+      foreach ($this->value as $value) {
+        if (!isset($this->value_options[$value])) {
+          unset($this->value[$value]);
+        }
+      }
+      // Choose different kind of ouput for 0, a single and multiple values.
+      if (count($this->value) == 0) {
+        $values = t('Unknown');
+      }
+      else if (count($this->value) == 1) {
+        // If any, use the 'single' short name of the operator instead.
+        if (isset($info[$this->operator]['short_single'])) {
+          $operator = check_plain($info[$this->operator]['short_single']);
+        }
+
+        $keys = $this->value;
+        $value = array_shift($keys);
+        if (isset($this->value_options[$value])) {
+          $values = check_plain($this->value_options[$value]);
+        }
+        else {
+          $values = '';
+        }
+      }
+      else {
+        foreach ($this->value as $value) {
+          if ($values !== '') {
+            $values .= ', ';
+          }
+          if (drupal_strlen($values) > 8) {
+            $values .= '...';
+            break;
+          }
+          if (isset($this->value_options[$value])) {
+            $values .= check_plain($this->value_options[$value]);
+          }
+        }
+      }
+    }
+
+    return $operator . (($values !== '') ? ' ' . $values : '');
+  }
+
+  function query() {
+    $info = $this->operators();
+    if (!empty($info[$this->operator]['method'])) {
+      $this->{$info[$this->operator]['method']}();
+    }
+  }
+
+  function op_simple() {
+    if (empty($this->value)) {
+      return;
+    }
+    $this->ensure_my_table();
+
+    // We use array_values() because the checkboxes keep keys and that can cause
+    // array addition problems.
+    $this->query->add_where($this->options['group'], "$this->table_alias.$this->real_field", array_values($this->value), $this->operator);
+  }
+
+  function op_empty() {
+    $this->ensure_my_table();
+    if ($this->operator == 'empty') {
+      $operator = "IS NULL";
+    }
+    else {
+      $operator = "IS NOT NULL";
+    }
+
+    $this->query->add_where($this->options['group'], "$this->table_alias.$this->real_field", NULL, $operator);
+  }
+
+  function validate() {
+    $this->get_value_options();
+    $errors = array();
+
+    // If the operator is an operator which doesn't require a value, there is
+    // no need for additional validation.
+    if (in_array($this->operator, $this->operator_values(0))) {
+      return array();
+    }
+
+    if (!in_array($this->operator, $this->operator_values(1))) {
+      $errors[] = t('The operator is invalid on filter: @filter.', array('@filter' => $this->ui_name(TRUE)));
+    }
+    if (is_array($this->value)) {
+      if (!isset($this->value_options)) {
+        // Don't validate if there are none value options provided, for example for special handlers.
+        return $errors;
+      }
+      if ($this->options['exposed'] && !$this->options['expose']['required'] && empty($this->value)) {
+        // Don't validate if the field is exposed and no default value is provided.
+        return $errors;
+      }
+
+      // Some filter_in_operator usage uses optgroups forms, so flatten it.
+      $flat_options = form_options_flatten($this->value_options, TRUE);
+
+      // Remove every element which is not known.
+      foreach ($this->value as $value) {
+        if (!isset($flat_options[$value])) {
+          unset($this->value[$value]);
+        }
+      }
+      // Choose different kind of ouput for 0, a single and multiple values.
+      if (count($this->value) == 0) {
+        $errors[] = t('No valid values found on filter: @filter.', array('@filter' => $this->ui_name(TRUE)));
+      }
+    }
+    elseif (!empty($this->value) && ($this->operator == 'in' || $this->operator == 'not in')) {
+      $errors[] = t('The value @value is not an array for @operator on filter: @filter', array('@value' => views_var_export($this->value), '@operator' => $this->operator, '@filter' => $this->ui_name(TRUE)));
+    }
+    return $errors;
+  }
+}

+ 125 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_many_to_one.inc

@@ -0,0 +1,125 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_many_to_one.
+ */
+
+/**
+ * Complex filter to handle filtering for many to one relationships,
+ * such as terms (many terms per node) or roles (many roles per user).
+ *
+ * The construct method needs to be overridden to provide a list of options;
+ * alternately, the value_form and admin_summary methods need to be overriden
+ * to provide something that isn't just a select list.
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_many_to_one extends views_handler_filter_in_operator {
+  /**
+   * @var views_many_to_one_helper
+   *
+   * Stores the Helper object which handles the many_to_one complexity.
+   */
+  var $helper = NULL;
+
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+    $this->helper = new views_many_to_one_helper($this);
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['operator']['default'] = 'or';
+    $options['value']['default'] = array();
+
+    if (isset($this->helper)) {
+      $this->helper->option_definition($options);
+    }
+    else {
+      $helper = new views_many_to_one_helper($this);
+      $helper->option_definition($options);
+    }
+
+    return $options;
+  }
+
+  function operators() {
+    $operators = array(
+      'or' => array(
+        'title' => t('Is one of'),
+        'short' => t('or'),
+        'short_single' => t('='),
+        'method' => 'op_helper',
+        'values' => 1,
+        'ensure_my_table' => 'helper',
+      ),
+      'and' => array(
+        'title' => t('Is all of'),
+        'short' => t('and'),
+        'short_single' => t('='),
+        'method' => 'op_helper',
+        'values' => 1,
+        'ensure_my_table' => 'helper',
+      ),
+      'not' => array(
+        'title' => t('Is none of'),
+        'short' => t('not'),
+        'short_single' => t('<>'),
+        'method' => 'op_helper',
+        'values' => 1,
+        'ensure_my_table' => 'helper',
+      ),
+    );
+    // if the definition allows for the empty operator, add it.
+    if (!empty($this->definition['allow empty'])) {
+      $operators += array(
+        'empty' => array(
+          'title' => t('Is empty (NULL)'),
+          'method' => 'op_empty',
+          'short' => t('empty'),
+          'values' => 0,
+        ),
+        'not empty' => array(
+          'title' => t('Is not empty (NOT NULL)'),
+          'method' => 'op_empty',
+          'short' => t('not empty'),
+          'values' => 0,
+        ),
+      );
+    }
+
+    return $operators;
+  }
+
+  var $value_form_type = 'select';
+  function value_form(&$form, &$form_state) {
+    parent::value_form($form, $form_state);
+
+    if (empty($form_state['exposed'])) {
+      $this->helper->options_form($form, $form_state);
+    }
+  }
+
+  /**
+   * Override ensure_my_table so we can control how this joins in.
+   * The operator actually has influence over joining.
+   */
+  function ensure_my_table() {
+    // Defer to helper if the operator specifies it.
+    $info = $this->operators();
+    if (isset($info[$this->operator]['ensure_my_table']) && $info[$this->operator]['ensure_my_table'] == 'helper') {
+      return $this->helper->ensure_my_table();
+    }
+
+    return parent::ensure_my_table();
+  }
+
+  function op_helper() {
+    if (empty($this->value)) {
+      return;
+    }
+    $this->helper->add_filter();
+  }
+}

+ 325 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_numeric.inc

@@ -0,0 +1,325 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_numeric.
+ */
+
+/**
+ * Simple filter to handle greater than/less than filters
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_numeric extends views_handler_filter {
+  var $always_multiple = TRUE;
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['value'] = array(
+      'contains' => array(
+        'min' => array('default' => ''),
+        'max' => array('default' => ''),
+        'value' => array('default' => ''),
+      ),
+    );
+
+    return $options;
+  }
+
+  function operators() {
+    $operators = array(
+      '<' => array(
+        'title' => t('Is less than'),
+        'method' => 'op_simple',
+        'short' => t('<'),
+        'values' => 1,
+      ),
+      '<=' => array(
+        'title' => t('Is less than or equal to'),
+        'method' => 'op_simple',
+        'short' => t('<='),
+        'values' => 1,
+      ),
+      '=' => array(
+        'title' => t('Is equal to'),
+        'method' => 'op_simple',
+        'short' => t('='),
+        'values' => 1,
+      ),
+      '!=' => array(
+        'title' => t('Is not equal to'),
+        'method' => 'op_simple',
+        'short' => t('!='),
+        'values' => 1,
+      ),
+      '>=' => array(
+        'title' => t('Is greater than or equal to'),
+        'method' => 'op_simple',
+        'short' => t('>='),
+        'values' => 1,
+      ),
+      '>' => array(
+        'title' => t('Is greater than'),
+        'method' => 'op_simple',
+        'short' => t('>'),
+        'values' => 1,
+      ),
+      'between' => array(
+        'title' => t('Is between'),
+        'method' => 'op_between',
+        'short' => t('between'),
+        'values' => 2,
+      ),
+      'not between' => array(
+        'title' => t('Is not between'),
+        'method' => 'op_between',
+        'short' => t('not between'),
+        'values' => 2,
+      ),
+    );
+
+    // if the definition allows for the empty operator, add it.
+    if (!empty($this->definition['allow empty'])) {
+      $operators += array(
+        'empty' => array(
+          'title' => t('Is empty (NULL)'),
+          'method' => 'op_empty',
+          'short' => t('empty'),
+          'values' => 0,
+        ),
+        'not empty' => array(
+          'title' => t('Is not empty (NOT NULL)'),
+          'method' => 'op_empty',
+          'short' => t('not empty'),
+          'values' => 0,
+        ),
+      );
+    }
+
+    // Add regexp support for MySQL.
+    if (Database::getConnection()->databaseType() == 'mysql') {
+      $operators += array(
+        'regular_expression' => array(
+          'title' => t('Regular expression'),
+          'short' => t('regex'),
+          'method' => 'op_regex',
+          'values' => 1,
+        ),
+      );
+    }
+
+    return $operators;
+  }
+
+  /**
+   * Provide a list of all the numeric operators
+   */
+  function operator_options($which = 'title') {
+    $options = array();
+    foreach ($this->operators() as $id => $info) {
+      $options[$id] = $info[$which];
+    }
+
+    return $options;
+  }
+
+  function operator_values($values = 1) {
+    $options = array();
+    foreach ($this->operators() as $id => $info) {
+      if ($info['values'] == $values) {
+        $options[] = $id;
+      }
+    }
+
+    return $options;
+  }
+  /**
+   * Provide a simple textfield for equality
+   */
+  function value_form(&$form, &$form_state) {
+    $form['value']['#tree'] = TRUE;
+
+    // We have to make some choices when creating this as an exposed
+    // filter form. For example, if the operator is locked and thus
+    // not rendered, we can't render dependencies; instead we only
+    // render the form items we need.
+    $which = 'all';
+    if (!empty($form['operator'])) {
+      $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator';
+    }
+
+    if (!empty($form_state['exposed'])) {
+      $identifier = $this->options['expose']['identifier'];
+
+      if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) {
+        // exposed and locked.
+        $which = in_array($this->operator, $this->operator_values(2)) ? 'minmax' : 'value';
+      }
+      else {
+        $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']);
+      }
+    }
+
+    if ($which == 'all') {
+      $form['value']['value'] = array(
+        '#type' => 'textfield',
+        '#title' => empty($form_state['exposed']) ? t('Value') : '',
+        '#size' => 30,
+        '#default_value' => $this->value['value'],
+        '#dependency' => array($source => $this->operator_values(1)),
+      );
+      if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['value'])) {
+        $form_state['input'][$identifier]['value'] = $this->value['value'];
+      }
+    }
+    elseif ($which == 'value') {
+      // When exposed we drop the value-value and just do value if
+      // the operator is locked.
+      $form['value'] = array(
+        '#type' => 'textfield',
+        '#title' => empty($form_state['exposed']) ? t('Value') : '',
+        '#size' => 30,
+        '#default_value' => $this->value['value'],
+      );
+      if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
+        $form_state['input'][$identifier] = $this->value['value'];
+      }
+    }
+
+    if ($which == 'all' || $which == 'minmax') {
+      $form['value']['min'] = array(
+        '#type' => 'textfield',
+        '#title' => empty($form_state['exposed']) ? t('Min') : '',
+        '#size' => 30,
+        '#default_value' => $this->value['min'],
+      );
+      $form['value']['max'] = array(
+        '#type' => 'textfield',
+        '#title' => empty($form_state['exposed']) ? t('And max') : t('And'),
+        '#size' => 30,
+        '#default_value' => $this->value['max'],
+      );
+      if ($which == 'all') {
+        $dependency = array(
+          '#dependency' => array($source => $this->operator_values(2)),
+        );
+        $form['value']['min'] += $dependency;
+        $form['value']['max'] += $dependency;
+      }
+      if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['min'])) {
+        $form_state['input'][$identifier]['min'] = $this->value['min'];
+      }
+      if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier]['max'])) {
+        $form_state['input'][$identifier]['max'] = $this->value['max'];
+      }
+
+      if (!isset($form['value'])) {
+        // Ensure there is something in the 'value'.
+        $form['value'] = array(
+          '#type' => 'value',
+          '#value' => NULL
+        );
+      }
+    }
+  }
+
+  function query() {
+    $this->ensure_my_table();
+    $field = "$this->table_alias.$this->real_field";
+
+    $info = $this->operators();
+    if (!empty($info[$this->operator]['method'])) {
+      $this->{$info[$this->operator]['method']}($field);
+    }
+  }
+
+  function op_between($field) {
+    if ($this->operator == 'between') {
+      $this->query->add_where($this->options['group'], $field, array($this->value['min'], $this->value['max']), 'BETWEEN');
+    }
+    else {
+      $this->query->add_where($this->options['group'], db_or()->condition($field, $this->value['min'], '<=')->condition($field, $this->value['max'], '>='));
+    }
+  }
+
+  function op_simple($field) {
+    $this->query->add_where($this->options['group'], $field, $this->value['value'], $this->operator);
+  }
+
+  function op_empty($field) {
+    if ($this->operator == 'empty') {
+      $operator = "IS NULL";
+    }
+    else {
+      $operator = "IS NOT NULL";
+    }
+
+    $this->query->add_where($this->options['group'], $field, NULL, $operator);
+  }
+
+  function op_regex($field) {
+    $this->query->add_where($this->options['group'], $field, $this->value['value'], 'RLIKE');
+  }
+
+  function admin_summary() {
+    if ($this->is_a_group()) {
+      return t('grouped');
+    }
+    if (!empty($this->options['exposed'])) {
+      return t('exposed');
+    }
+
+    $options = $this->operator_options('short');
+    $output = check_plain($options[$this->operator]);
+    if (in_array($this->operator, $this->operator_values(2))) {
+      $output .= ' ' . t('@min and @max', array('@min' => $this->value['min'], '@max' => $this->value['max']));
+    }
+    elseif (in_array($this->operator, $this->operator_values(1))) {
+      $output .= ' ' . check_plain($this->value['value']);
+    }
+    return $output;
+  }
+
+  /**
+   * Do some minor translation of the exposed input
+   */
+  function accept_exposed_input($input) {
+    if (empty($this->options['exposed'])) {
+      return TRUE;
+    }
+
+    // rewrite the input value so that it's in the correct format so that
+    // the parent gets the right data.
+    if (!empty($this->options['expose']['identifier'])) {
+      $value = &$input[$this->options['expose']['identifier']];
+      if (!is_array($value)) {
+        $value = array(
+          'value' => $value,
+        );
+      }
+    }
+
+    $rc = parent::accept_exposed_input($input);
+
+    if (empty($this->options['expose']['required'])) {
+      // We have to do some of our own checking for non-required filters.
+      $info = $this->operators();
+      if (!empty($info[$this->operator]['values'])) {
+        switch ($info[$this->operator]['values']) {
+          case 1:
+            if ($value['value'] === '') {
+              return FALSE;
+            }
+            break;
+          case 2:
+            if ($value['min'] === '' && $value['max'] === '') {
+              return FALSE;
+            }
+            break;
+        }
+      }
+    }
+
+    return $rc;
+  }
+}

+ 338 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_filter_string.inc

@@ -0,0 +1,338 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_filter_string.
+ */
+
+/**
+ * Basic textfield filter to handle string filtering commands
+ * including equality, like, not like, etc.
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_string extends views_handler_filter {
+  // exposed filter options
+  var $always_multiple = TRUE;
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['expose']['contains']['required'] = array('default' => FALSE, 'bool' => TRUE);
+
+    return $options;
+  }
+
+  /**
+   * This kind of construct makes it relatively easy for a child class
+   * to add or remove functionality by overriding this function and
+   * adding/removing items from this array.
+   */
+  function operators() {
+    $operators = array(
+      '=' => array(
+        'title' => t('Is equal to'),
+        'short' => t('='),
+        'method' => 'op_equal',
+        'values' => 1,
+      ),
+      '!=' => array(
+        'title' => t('Is not equal to'),
+        'short' => t('!='),
+        'method' => 'op_equal',
+        'values' => 1,
+      ),
+      'contains' => array(
+        'title' => t('Contains'),
+        'short' => t('contains'),
+        'method' => 'op_contains',
+        'values' => 1,
+      ),
+      'word' => array(
+        'title' => t('Contains any word'),
+        'short' => t('has word'),
+        'method' => 'op_word',
+        'values' => 1,
+      ),
+      'allwords' => array(
+        'title' => t('Contains all words'),
+        'short' => t('has all'),
+        'method' => 'op_word',
+        'values' => 1,
+      ),
+      'starts' => array(
+        'title' => t('Starts with'),
+        'short' => t('begins'),
+        'method' => 'op_starts',
+        'values' => 1,
+      ),
+      'not_starts' => array(
+        'title' => t('Does not start with'),
+        'short' => t('not_begins'),
+        'method' => 'op_not_starts',
+        'values' => 1,
+      ),
+      'ends' => array(
+        'title' => t('Ends with'),
+        'short' => t('ends'),
+        'method' => 'op_ends',
+        'values' => 1,
+      ),
+      'not_ends' => array(
+        'title' => t('Does not end with'),
+        'short' => t('not_ends'),
+        'method' => 'op_not_ends',
+        'values' => 1,
+      ),
+      'not' => array(
+        'title' => t('Does not contain'),
+        'short' => t('!has'),
+        'method' => 'op_not',
+        'values' => 1,
+      ),
+      'shorterthan' => array(
+        'title' => t('Length is shorter than'),
+        'short' => t('shorter than'),
+        'method' => 'op_shorter',
+        'values' => 1,
+      ),
+      'longerthan' => array(
+        'title' => t('Length is longer than'),
+        'short' => t('longer than'),
+        'method' => 'op_longer',
+        'values' => 1,
+      ),
+    );
+    // if the definition allows for the empty operator, add it.
+    if (!empty($this->definition['allow empty'])) {
+      $operators += array(
+        'empty' => array(
+          'title' => t('Is empty (NULL)'),
+          'method' => 'op_empty',
+          'short' => t('empty'),
+          'values' => 0,
+        ),
+        'not empty' => array(
+          'title' => t('Is not empty (NOT NULL)'),
+          'method' => 'op_empty',
+          'short' => t('not empty'),
+          'values' => 0,
+        ),
+      );
+    }
+    // Add regexp support for MySQL.
+    if (Database::getConnection()->databaseType() == 'mysql') {
+      $operators += array(
+        'regular_expression' => array(
+          'title' => t('Regular expression'),
+          'short' => t('regex'),
+          'method' => 'op_regex',
+          'values' => 1,
+        ),
+      );
+    }
+
+    return $operators;
+  }
+
+  /**
+   * Build strings from the operators() for 'select' options
+   */
+  function operator_options($which = 'title') {
+    $options = array();
+    foreach ($this->operators() as $id => $info) {
+      $options[$id] = $info[$which];
+    }
+
+    return $options;
+  }
+
+  function admin_summary() {
+    if ($this->is_a_group()) {
+      return t('grouped');
+    }
+    if (!empty($this->options['exposed'])) {
+      return t('exposed');
+    }
+
+    $options = $this->operator_options('short');
+    $output = '';
+    if(!empty($options[$this->operator])) {
+      $output = check_plain($options[$this->operator]);
+    }
+    if (in_array($this->operator, $this->operator_values(1))) {
+      $output .= ' ' . check_plain($this->value);
+    }
+    return $output;
+  }
+
+  function operator_values($values = 1) {
+    $options = array();
+    foreach ($this->operators() as $id => $info) {
+      if (isset($info['values']) && $info['values'] == $values) {
+        $options[] = $id;
+      }
+    }
+
+    return $options;
+  }
+
+  /**
+   * Provide a simple textfield for equality
+   */
+  function value_form(&$form, &$form_state) {
+    // We have to make some choices when creating this as an exposed
+    // filter form. For example, if the operator is locked and thus
+    // not rendered, we can't render dependencies; instead we only
+    // render the form items we need.
+    $which = 'all';
+    if (!empty($form['operator'])) {
+      $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator';
+    }
+    if (!empty($form_state['exposed'])) {
+      $identifier = $this->options['expose']['identifier'];
+
+      if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) {
+        // exposed and locked.
+        $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none';
+      }
+      else {
+        $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']);
+      }
+    }
+
+    if ($which == 'all' || $which == 'value') {
+      $form['value'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Value'),
+        '#size' => 30,
+        '#default_value' => $this->value,
+      );
+      if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
+        $form_state['input'][$identifier] = $this->value;
+      }
+
+      if ($which == 'all') {
+        $form['value'] += array(
+          '#dependency' => array($source => $this->operator_values(1)),
+        );
+      }
+    }
+
+    if (!isset($form['value'])) {
+      // Ensure there is something in the 'value'.
+      $form['value'] = array(
+        '#type' => 'value',
+        '#value' => NULL
+      );
+    }
+  }
+
+  function operator() {
+    return $this->operator == '=' ? 'LIKE' : 'NOT LIKE';
+  }
+
+  /**
+   * Add this filter to the query.
+   *
+   * Due to the nature of fapi, the value and the operator have an unintended
+   * level of indirection. You will find them in $this->operator
+   * and $this->value respectively.
+   */
+  function query() {
+    $this->ensure_my_table();
+    $field = "$this->table_alias.$this->real_field";
+
+    $info = $this->operators();
+    if (!empty($info[$this->operator]['method'])) {
+      $this->{$info[$this->operator]['method']}($field);
+    }
+  }
+
+  function op_equal($field) {
+    $this->query->add_where($this->options['group'], $field, $this->value, $this->operator());
+  }
+
+  function op_contains($field) {
+    $this->query->add_where($this->options['group'], $field, '%' . db_like($this->value) . '%', 'LIKE');
+  }
+
+  function op_word($field) {
+    $where = $this->operator == 'word' ? db_or() : db_and();
+
+    // Don't filter on empty strings.
+    if (empty($this->value)) {
+      return;
+    }
+
+    preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->value, $matches, PREG_SET_ORDER);
+    foreach ($matches as $match) {
+      $phrase = false;
+      // Strip off phrase quotes
+      if ($match[2]{0} == '"') {
+        $match[2] = substr($match[2], 1, -1);
+        $phrase = true;
+      }
+      $words = trim($match[2], ',?!();:-');
+      $words = $phrase ? array($words) : preg_split('/ /', $words, -1, PREG_SPLIT_NO_EMPTY);
+      foreach ($words as $word) {
+        $placeholder = $this->placeholder();
+        $where->condition($field, '%' . db_like(trim($word, " ,!?")) . '%', 'LIKE');
+      }
+    }
+
+    if (!$where) {
+      return;
+    }
+
+    // previously this was a call_user_func_array but that's unnecessary
+    // as views will unpack an array that is a single arg.
+    $this->query->add_where($this->options['group'], $where);
+  }
+
+  function op_starts($field) {
+    $this->query->add_where($this->options['group'], $field, db_like($this->value) . '%', 'LIKE');
+  }
+
+  function op_not_starts($field) {
+    $this->query->add_where($this->options['group'], $field, db_like($this->value) . '%', 'NOT LIKE');
+  }
+
+  function op_ends($field) {
+    $this->query->add_where($this->options['group'], $field, '%' . db_like($this->value), 'LIKE');
+  }
+
+  function op_not_ends($field) {
+    $this->query->add_where($this->options['group'], $field, '%' . db_like($this->value), 'NOT LIKE');
+  }
+
+  function op_not($field) {
+    $this->query->add_where($this->options['group'], $field, '%' . db_like($this->value) . '%', 'NOT LIKE');
+  }
+
+  function op_shorter($field) {
+    $placeholder = $this->placeholder();
+    $this->query->add_where_expression($this->options['group'], "LENGTH($field) < $placeholder", array($placeholder => $this->value));
+  }
+
+  function op_longer($field) {
+    $placeholder = $this->placeholder();
+    $this->query->add_where_expression($this->options['group'], "LENGTH($field) > $placeholder", array($placeholder => $this->value));
+  }
+
+  function op_regex($field) {
+    $this->query->add_where($this->options['group'], $field, $this->value, 'RLIKE');
+  }
+
+  function op_empty($field) {
+    if ($this->operator == 'empty') {
+      $operator = "IS NULL";
+    }
+    else {
+      $operator = "IS NOT NULL";
+    }
+
+    $this->query->add_where($this->options['group'], $field, NULL, $operator);
+  }
+
+}

+ 186 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_relationship.inc

@@ -0,0 +1,186 @@
+<?php
+
+/**
+ * @file
+ * Views' relationship handlers.
+ */
+
+/**
+ * @defgroup views_relationship_handlers Views relationship handlers
+ * @{
+ * Handlers to tell Views how to create alternate relationships.
+ */
+
+/**
+ * Simple relationship handler that allows a new version of the primary table
+ * to be linked in.
+ *
+ * The base relationship handler can only handle a single join. Some relationships
+ * are more complex and might require chains of joins; for those, you must
+ * utilize a custom relationship handler.
+ *
+ * Definition items:
+ * - base: The new base table this relationship will be adding. This does not
+ *   have to be a declared base table, but if there are no tables that
+ *   utilize this base table, it won't be very effective.
+ * - base field: The field to use in the relationship; if left out this will be
+ *   assumed to be the primary field.
+ * - relationship table: The actual table this relationship operates against.
+ *   This is analogous to using a 'table' override.
+ * - relationship field: The actual field this relationship operates against.
+ *   This is analogous to using a 'real field' override.
+ * - label: The default label to provide for this relationship, which is
+ *   shown in parentheses next to any field/sort/filter/argument that uses
+ *   the relationship.
+ *
+ * @ingroup views_relationship_handlers
+ */
+class views_handler_relationship extends views_handler {
+  /**
+   * Init handler to let relationships live on tables other than
+   * the table they operate on.
+   */
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+    if (isset($this->definition['relationship table'])) {
+      $this->table = $this->definition['relationship table'];
+    }
+    if (isset($this->definition['relationship field'])) {
+      // Set both real_field and field so custom handler
+      // can rely on the old field value.
+      $this->real_field = $this->field = $this->definition['relationship field'];
+    }
+  }
+
+  /**
+   * Get this field's label.
+   */
+  function label() {
+    if (!isset($this->options['label'])) {
+      return $this->ui_name();
+    }
+    return $this->options['label'];
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+
+    // Relationships definitions should define a default label, but if they aren't get another default value.
+    if (!empty($this->definition['label'])) {
+      $label = $this->definition['label'];
+    }
+    else {
+      $label = !empty($this->definition['field']) ? $this->definition['field'] : $this->definition['base field'];
+    }
+
+    $options['label'] = array('default' => $label, 'translatable' => TRUE);
+    $options['required'] = array('default' => FALSE, 'bool' => TRUE);
+
+    return $options;
+  }
+
+  /**
+   * Default options form that provides the label widget that all fields
+   * should have.
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    $form['label'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Identifier'),
+      '#default_value' => isset($this->options['label']) ? $this->options['label'] : '',
+      '#description' => t('Edit the administrative label displayed when referencing this relationship from filters, etc.'),
+      '#required' => TRUE,
+    );
+
+    $form['required'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Require this relationship'),
+      '#description' => t('Enable to hide items that do not contain this relationship'),
+      '#default_value' => !empty($this->options['required']),
+    );
+  }
+
+  /**
+   * Called to implement a relationship in a query.
+   */
+  function query() {
+    // Figure out what base table this relationship brings to the party.
+    $table_data = views_fetch_data($this->definition['base']);
+    $base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field'];
+
+    $this->ensure_my_table();
+
+    $def = $this->definition;
+    $def['table'] = $this->definition['base'];
+    $def['field'] = $base_field;
+    $def['left_table'] = $this->table_alias;
+    $def['left_field'] = $this->real_field;
+    if (!empty($this->options['required'])) {
+      $def['type'] = 'INNER';
+    }
+
+    if (!empty($this->definition['extra'])) {
+      $def['extra'] = $this->definition['extra'];
+    }
+
+    if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
+      $join = new $def['join_handler'];
+    }
+    else {
+      $join = new views_join();
+    }
+
+    $join->definition = $def;
+    $join->options = $this->options;
+    $join->construct();
+    $join->adjusted = TRUE;
+
+    // use a short alias for this:
+    $alias = $def['table'] . '_' . $this->table;
+
+    $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
+
+    // Add access tags if the base table provide it.
+    if (empty($this->query->options['disable_sql_rewrite']) && isset($table_data['table']['base']['access query tag'])) {
+      $access_tag = $table_data['table']['base']['access query tag'];
+      $this->query->add_tag($access_tag);
+    }
+  }
+
+  /**
+   * You can't groupby a relationship.
+   */
+  function use_group_by() {
+    return FALSE;
+  }
+}
+
+/**
+ * A special handler to take the place of missing or broken handlers.
+ *
+ * @ingroup views_relationship_handlers
+ */
+class views_handler_relationship_broken extends views_handler_relationship {
+  function ui_name($short = FALSE) {
+    return t('Broken/missing handler');
+  }
+
+  function ensure_my_table() { /* No table to ensure! */ }
+  function query() { /* No query to run */ }
+  function options_form(&$form, &$form_state) {
+    $form['markup'] = array(
+      '#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
+    );
+  }
+
+  /**
+   * Determine if the handler is considered 'broken'
+   */
+  function broken() { return TRUE; }
+}
+
+/**
+ * @}
+ */

+ 382 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_relationship_groupwise_max.inc

@@ -0,0 +1,382 @@
+<?php
+
+/**
+ * @file
+ * Relationship for groupwise maximum handler.
+ */
+
+/**
+ * Relationship handler that allows a groupwise maximum of the linked in table.
+ * For a definition, see:
+ * http://dev.mysql.com/doc/refman/5.0/en/example-maximum-column-group-row.html
+ * In lay terms, instead of joining to get all matching records in the linked
+ * table, we get only one record, a 'representative record' picked according
+ * to a given criteria.
+ *
+ * Example:
+ * Suppose we have a term view that gives us the terms: Horse, Cat, Aardvark.
+ * We wish to show for each term the most recent node of that term.
+ * What we want is some kind of relationship from term to node.
+ * But a regular relationship will give us all the nodes for each term,
+ * giving the view multiple rows per term. What we want is just one
+ * representative node per term, the node that is the 'best' in some way:
+ * eg, the most recent, the most commented on, the first in alphabetical order.
+ *
+ * This handler gives us that kind of relationship from term to node.
+ * The method of choosing the 'best' implemented with a sort
+ * that the user selects in the relationship settings.
+ *
+ * So if we want our term view to show the most commented node for each term,
+ * add the relationship and in its options, pick the 'Comment count' sort.
+ *
+ * Relationship definition
+ *  - 'outer field': The outer field to substitute into the correlated subquery.
+ *       This must be the full field name, not the alias.
+ *       Eg: 'term_data.tid'.
+ *  - 'argument table',
+ *    'argument field': These options define a views argument that the subquery
+ *     must add to itself to filter by the main view.
+ *     Example: the main view shows terms, this handler is being used to get to
+ *     the nodes base table. Your argument must be 'term_node', 'tid', as this
+ *     is the argument that should be added to a node view to filter on terms.
+ *
+ * A note on performance:
+ * This relationship uses a correlated subquery, which is expensive.
+ * Subsequent versions of this handler could also implement the alternative way
+ * of doing this, with a join -- though this looks like it could be pretty messy
+ * to implement. This is also an expensive method, so providing both methods and
+ * allowing the user to choose which one works fastest for their data might be
+ * the best way.
+ * If your use of this relationship handler is likely to result in large
+ * data sets, you might want to consider storing statistics in a separate table,
+ * in the same way as node_comment_statistics.
+ *
+ * @ingroup views_relationship_handlers
+ */
+class views_handler_relationship_groupwise_max extends views_handler_relationship {
+
+  /**
+   * Defines default values for options.
+   */
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['subquery_sort'] = array('default' => NULL);
+    // Descending more useful.
+    $options['subquery_order'] = array('default' => 'DESC');
+    $options['subquery_regenerate'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['subquery_view'] = array('default' => FALSE);
+    $options['subquery_namespace'] = array('default' => FALSE);
+
+    return $options;
+  }
+
+  /**
+   * Extends the relationship's basic options, allowing the user to pick
+   * a sort and an order for it.
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    // Get the sorts that apply to our base.
+    $sorts = views_fetch_fields($this->definition['base'], 'sort');
+    foreach ($sorts as $sort_id => $sort) {
+      $sort_options[$sort_id] = "$sort[group]: $sort[title]";
+    }
+    $base_table_data = views_fetch_data($this->definition['base']);
+
+    $form['subquery_sort'] = array(
+      '#type' => 'select',
+      '#title' => t('Representative sort criteria'),
+      // Provide the base field as sane default sort option.
+      '#default_value' => !empty($this->options['subquery_sort']) ? $this->options['subquery_sort'] : $this->definition['base'] . '.' . $base_table_data['table']['base']['field'],
+      '#options' => $sort_options,
+      '#description' => theme('advanced_help_topic', array('module' => 'views', 'topic' => 'relationship-representative')) .
+        t("The sort criteria is applied to the data brought in by the relationship to determine how a representative item is obtained for each row. For example, to show the most recent node for each user, pick 'Content: Updated date'."),
+    );
+
+    $form['subquery_order'] = array(
+      '#type' => 'radios',
+      '#title' => t('Representative sort order'),
+      '#description' => t("The ordering to use for the sort criteria selected above."),
+      '#options' => array('ASC' => t('Ascending'), 'DESC' => t('Descending')),
+      '#default_value' => $this->options['subquery_order'],
+    );
+
+    $form['subquery_namespace'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Subquery namespace'),
+      '#description' => t('Advanced. Enter a namespace for the subquery used by this relationship.'),
+      '#default_value' => $this->options['subquery_namespace'],
+    );
+
+
+    // WIP: This stuff doens't work yet: namespacing issues.
+    // A list of suitable views to pick one as the subview.
+    $views = array('' => '<none>');
+    $all_views = views_get_all_views();
+    foreach ($all_views as $view) {
+      // Only get views that are suitable:
+      // - base must the base that our relationship joins towards
+      // - must have fields.
+      if ($view->base_table == $this->definition['base'] && !empty($view->display['default']->display_options['fields'])) {
+        // TODO: check the field is the correct sort?
+        // or let users hang themselves at this stage and check later?
+        if ($view->type == 'Default') {
+          $views[t('Default Views')][$view->name] = $view->name;
+        }
+        else {
+          $views[t('Existing Views')][$view->name] = $view->name;
+        }
+      }
+    }
+
+    $form['subquery_view'] = array(
+      '#type' => 'select',
+      '#title' => t('Representative view'),
+      '#default_value' => $this->options['subquery_view'],
+      '#options' => $views,
+      '#description' => t('Advanced. Use another view to generate the relationship subquery. This allows you to use filtering and more than one sort. If you pick a view here, the sort options above are ignored. Your view must have the ID of its base as its only field, and should have some kind of sorting.'),
+    );
+
+    $form['subquery_regenerate'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Generate subquery each time view is run.'),
+      '#default_value' => $this->options['subquery_regenerate'],
+      '#description' => t('Will re-generate the subquery for this relationship every time the view is run, instead of only when these options are saved. Use for testing if you are making changes elsewhere. WARNING: seriously impairs performance.'),
+    );
+  }
+
+  /**
+   * Helper function to create a pseudo view.
+   *
+   * We use this to obtain our subquery SQL.
+   */
+  function get_temporary_view() {
+    views_include('view');
+    $view = new view();
+    $view->vid = 'new'; // @todo: what's this?
+    $view->base_table = $this->definition['base'];
+    $view->add_display('default');
+    return $view;
+  }
+
+  /**
+   * When the form is submitted, take sure to clear the subquery string cache.
+   */
+  function options_form_submit(&$form, &$form_state) {
+    $cid = 'views_relationship_groupwise_max:' . $this->view->name . ':' . $this->view->current_display . ':' . $this->options['id'];
+    cache_clear_all($cid, 'cache_views_data');
+  }
+
+  /**
+   * Generate a subquery given the user options, as set in the options.
+   * These are passed in rather than picked up from the object because we
+   * generate the subquery when the options are saved, rather than when the view
+   * is run. This saves considerable time.
+   *
+   * @param $options
+   *   An array of options:
+   *    - subquery_sort: the id of a views sort.
+   *    - subquery_order: either ASC or DESC.
+   * @return
+   *    The subquery SQL string, ready for use in the main query.
+   */
+  function left_query($options) {
+    // Either load another view, or create one on the fly.
+    if ($options['subquery_view']) {
+      $temp_view = views_get_view($options['subquery_view']);
+      // Remove all fields from default display
+      unset($temp_view->display['default']->display_options['fields']);
+    }
+    else {
+      // Create a new view object on the fly, which we use to generate a query
+      // object and then get the SQL we need for the subquery.
+      $temp_view = $this->get_temporary_view();
+
+      // Add the sort from the options to the default display.
+      // This is broken, in that the sort order field also gets added as a
+      // select field. See http://drupal.org/node/844910.
+      // We work around this further down.
+      $sort = $options['subquery_sort'];
+      list($sort_table, $sort_field) = explode('.', $sort);
+      $sort_options = array('order' => $options['subquery_order']);
+      $temp_view->add_item('default', 'sort', $sort_table, $sort_field, $sort_options);
+    }
+
+    // Get the namespace string.
+    $temp_view->namespace = (!empty($options['subquery_namespace'])) ? '_'. $options['subquery_namespace'] : '_INNER';
+    $this->subquery_namespace = (!empty($options['subquery_namespace'])) ? '_'. $options['subquery_namespace'] : 'INNER';
+
+    // The value we add here does nothing, but doing this adds the right tables
+    // and puts in a WHERE clause with a placeholder we can grab later.
+    $temp_view->args[] = '**CORRELATED**';
+
+    // Add the base table ID field.
+    $views_data = views_fetch_data($this->definition['base']);
+    $base_field = $views_data['table']['base']['field'];
+    $temp_view->add_item('default', 'field', $this->definition['base'], $this->definition['field']);
+
+    // Add the correct argument for our relationship's base
+    // ie the 'how to get back to base' argument.
+    // The relationship definition tells us which one to use.
+    $temp_view->add_item(
+      'default',
+      'argument',
+      $this->definition['argument table'], // eg 'term_node',
+      $this->definition['argument field'] //  eg 'tid'
+    );
+
+    // Build the view. The creates the query object and produces the query
+    // string but does not run any queries.
+    $temp_view->build();
+
+    // Now take the SelectQuery object the View has built and massage it
+    // somewhat so we can get the SQL query from it.
+    $subquery = $temp_view->build_info['query'];
+
+    // Workaround until http://drupal.org/node/844910 is fixed:
+    // Remove all fields from the SELECT except the base id.
+    $fields =& $subquery->getFields();
+    foreach (array_keys($fields) as $field_name) {
+      // The base id for this subquery is stored in our definition.
+      if ($field_name != $this->definition['field']) {
+        unset($fields[$field_name]);
+      }
+    }
+
+    // Make every alias in the subquery safe within the outer query by
+    // appending a namespace to it, '_inner' by default.
+    $tables =& $subquery->getTables();
+    foreach (array_keys($tables) as $table_name) {
+      $tables[$table_name]['alias'] .= $this->subquery_namespace;
+      // Namespace the join on every table.
+      if (isset($tables[$table_name]['condition'])) {
+        $tables[$table_name]['condition'] = $this->condition_namespace($tables[$table_name]['condition']);
+      }
+    }
+    // Namespace fields.
+    foreach (array_keys($fields) as $field_name) {
+      $fields[$field_name]['table'] .= $this->subquery_namespace;
+      $fields[$field_name]['alias'] .= $this->subquery_namespace;
+    }
+    // Namespace conditions.
+    $where =& $subquery->conditions();
+    $this->alter_subquery_condition($subquery, $where);
+    // Not sure why, but our sort order clause doesn't have a table.
+    // TODO: the call to add_item() above to add the sort handler is probably
+    // wrong -- needs attention from someone who understands it.
+    // In the meantime, this works, but with a leap of faith...
+    $orders =& $subquery->getOrderBy();
+    foreach ($orders as $order_key => $order) {
+      // But if we're using a whole view, we don't know what we have!
+      if ($options['subquery_view']) {
+        list($sort_table, $sort_field) = explode('.', $order_key);
+      }
+      $orders[$sort_table . $this->subquery_namespace . '.' . $sort_field] = $order;
+      unset($orders[$order_key]);
+    }
+
+    // The query we get doesn't include the LIMIT, so add it here.
+    $subquery->range(0, 1);
+
+    // Extract the SQL the temporary view built.
+    $subquery_sql = $subquery->__toString();
+
+    // Replace the placeholder with the outer, correlated field.
+    // Eg, change the placeholder ':users_uid' into the outer field 'users.uid'.
+    // We have to work directly with the SQL, because putting a name of a field
+    // into a SelectQuery that it does not recognize (because it's outer) just
+    // makes it treat it as a string.
+    $outer_placeholder = ':' . str_replace('.', '_', $this->definition['outer field']);
+    $subquery_sql = str_replace($outer_placeholder, $this->definition['outer field'], $subquery_sql);
+
+    return $subquery_sql;
+  }
+
+  /**
+   * Recursive helper to add a namespace to conditions.
+   *
+   * Similar to _views_query_tag_alter_condition().
+   *
+   * (Though why is the condition we get in a simple query 3 levels deep???)
+   */
+  function alter_subquery_condition(QueryAlterableInterface $query, &$conditions) {
+    foreach ($conditions as $condition_id => &$condition) {
+      // Skip the #conjunction element.
+      if (is_numeric($condition_id)) {
+        if (is_string($condition['field'])) {
+          $condition['field'] = $this->condition_namespace($condition['field']);
+        }
+        elseif (is_object($condition['field'])) {
+          $sub_conditions =& $condition['field']->conditions();
+          $this->alter_subquery_condition($query, $sub_conditions);
+        }
+      }
+    }
+  }
+
+  /**
+   * Helper function to namespace query pieces.
+   *
+   * Turns 'foo.bar' into 'foo_NAMESPACE.bar'.
+   */
+  function condition_namespace($string) {
+    return str_replace('.', $this->subquery_namespace . '.', $string);
+  }
+
+  /**
+   * Called to implement a relationship in a query.
+   * This is mostly a copy of our parent's query() except for this bit with
+   * the join class.
+   */
+  function query() {
+    // Figure out what base table this relationship brings to the party.
+    $table_data = views_fetch_data($this->definition['base']);
+    $base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field'];
+
+    $this->ensure_my_table();
+
+    $def = $this->definition;
+    $def['table'] = $this->definition['base'];
+    $def['field'] = $base_field;
+    $def['left_table'] = $this->table_alias;
+    $def['left_field'] = $this->field;
+    if (!empty($this->options['required'])) {
+      $def['type'] = 'INNER';
+    }
+
+    if ($this->options['subquery_regenerate']) {
+      // For testing only, regenerate the subquery each time.
+      $def['left_query'] = $this->left_query($this->options);
+    }
+    else {
+      // Get the stored subquery SQL string.
+      $cid = 'views_relationship_groupwise_max:' . $this->view->name . ':' . $this->view->current_display . ':' . $this->options['id'];
+      $cache = cache_get($cid, 'cache_views_data');
+      if (isset($cache->data)) {
+        $def['left_query'] = $cache->data;
+      }
+      else {
+        $def['left_query'] = $this->left_query($this->options);
+        cache_set($cid, $def['left_query'], 'cache_views_data');
+      }
+    }
+
+    if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
+      $join = new $def['join_handler'];
+    }
+    else {
+      $join = new views_join_subquery();
+    }
+
+    $join->definition = $def;
+    $join->construct();
+    $join->adjusted = TRUE;
+
+    // use a short alias for this:
+    $alias = $def['table'] . '_' . $this->table;
+
+    $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
+  }
+}

+ 240 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_sort.inc

@@ -0,0 +1,240 @@
+<?php
+
+/**
+ * @file
+ * @todo.
+ */
+
+/**
+ * @defgroup views_sort_handlers Views sort handlers
+ * @{
+ * Handlers to tell Views how to sort queries.
+ */
+
+/**
+ * Base sort handler that has no options and performs a simple sort.
+ *
+ * @ingroup views_sort_handlers
+ */
+class views_handler_sort extends views_handler {
+
+  /**
+   * Determine if a sort can be exposed.
+   */
+  function can_expose() { return TRUE; }
+
+  /**
+   * Called to add the sort to a query.
+   */
+  function query() {
+    $this->ensure_my_table();
+    // Add the field.
+    $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order']);
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['order'] = array('default' => 'ASC');
+    $options['exposed'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['expose'] = array(
+      'contains' => array(
+        'label' => array('default' => '', 'translatable' => TRUE),
+      ),
+    );
+    return $options;
+  }
+
+  /**
+   * Display whether or not the sort order is ascending or descending
+   */
+  function admin_summary() {
+    if (!empty($this->options['exposed'])) {
+      return t('Exposed');
+    }
+    switch ($this->options['order']) {
+      case 'ASC':
+      case 'asc':
+      default:
+        return t('asc');
+        break;
+      case 'DESC';
+      case 'desc';
+        return t('desc');
+        break;
+    }
+  }
+
+  /**
+   * Basic options for all sort criteria
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    if ($this->can_expose()) {
+      $this->show_expose_button($form, $form_state);
+    }
+    $form['op_val_start'] = array('#value' => '<div class="clearfix">');
+    $this->show_sort_form($form, $form_state);
+    $form['op_val_end'] = array('#value' => '</div>');
+    if ($this->can_expose()) {
+      $this->show_expose_form($form, $form_state);
+    }
+  }
+
+  /**
+   * Shortcut to display the expose/hide button.
+   */
+  function show_expose_button(&$form, &$form_state) {
+    $form['expose_button'] = array(
+      '#prefix' => '<div class="views-expose clearfix">',
+      '#suffix' => '</div>',
+      // Should always come first
+      '#weight' => -1000,
+    );
+
+    // Add a checkbox for JS users, which will have behavior attached to it
+    // so it can replace the button.
+    $form['expose_button']['checkbox'] = array(
+      '#theme_wrappers' => array('container'),
+      '#attributes' => array('class' => array('js-only')),
+    );
+    $form['expose_button']['checkbox']['checkbox'] = array(
+      '#title' => t('Expose this sort to visitors, to allow them to change it'),
+      '#type' => 'checkbox',
+    );
+
+    // Then add the button itself.
+    if (empty($this->options['exposed'])) {
+      $form['expose_button']['markup'] = array(
+        '#markup' => '<div class="description exposed-description" style="float: left; margin-right:10px">' . t('This sort is not exposed. Expose it to allow the users to change it.') . '</div>',
+      );
+      $form['expose_button']['button'] = array(
+        '#limit_validation_errors' => array(),
+        '#type' => 'submit',
+        '#value' => t('Expose sort'),
+        '#submit' => array('views_ui_config_item_form_expose'),
+      );
+      $form['expose_button']['checkbox']['checkbox']['#default_value'] = 0;
+    }
+    else {
+      $form['expose_button']['markup'] = array(
+        '#markup' => '<div class="description exposed-description">' . t('This sort is exposed. If you hide it, users will not be able to change it.') . '</div>',
+      );
+      $form['expose_button']['button'] = array(
+        '#limit_validation_errors' => array(),
+        '#type' => 'submit',
+        '#value' => t('Hide sort'),
+        '#submit' => array('views_ui_config_item_form_expose'),
+      );
+      $form['expose_button']['checkbox']['checkbox']['#default_value'] = 1;
+    }
+  }
+
+  /**
+   * Simple validate handler
+   */
+  function options_validate(&$form, &$form_state) {
+    $this->sort_validate($form, $form_state);
+    if (!empty($this->options['exposed'])) {
+      $this->expose_validate($form, $form_state);
+    }
+
+  }
+
+  /**
+   * Simple submit handler
+   */
+  function options_submit(&$form, &$form_state) {
+    unset($form_state['values']['expose_button']); // don't store this.
+    $this->sort_submit($form, $form_state);
+    if (!empty($this->options['exposed'])) {
+      $this->expose_submit($form, $form_state);
+    }
+  }
+
+  /**
+   * Shortcut to display the value form.
+   */
+  function show_sort_form(&$form, &$form_state) {
+    $options = $this->sort_options();
+    if (!empty($options)) {
+      $form['order'] = array(
+        '#type' => 'radios',
+        '#options' => $options,
+        '#default_value' => $this->options['order'],
+      );
+    }
+  }
+
+  function sort_validate(&$form, &$form_state) { }
+
+  function sort_submit(&$form, &$form_state) { }
+
+  /**
+   * Provide a list of options for the default sort form.
+   * Should be overridden by classes that don't override sort_form
+   */
+  function sort_options() {
+    return array(
+      'ASC' => t('Sort ascending'),
+      'DESC' => t('Sort descending'),
+    );
+  }
+
+  function expose_form(&$form, &$form_state) {
+    // #flatten will move everything from $form['expose'][$key] to $form[$key]
+    // prior to rendering. That's why the pre_render for it needs to run first,
+    // so that when the next pre_render (the one for fieldsets) runs, it gets
+    // the flattened data.
+    array_unshift($form['#pre_render'], 'views_ui_pre_render_flatten_data');
+    $form['expose']['#flatten'] = TRUE;
+
+    $form['expose']['label'] = array(
+      '#type' => 'textfield',
+      '#default_value' => $this->options['expose']['label'],
+      '#title' => t('Label'),
+      '#required' => TRUE,
+      '#size' => 40,
+      '#weight' => -1,
+   );
+  }
+
+  /**
+   * Provide default options for exposed sorts.
+   */
+  function expose_options() {
+    $this->options['expose'] = array(
+      'order' => $this->options['order'],
+      'label' => $this->definition['title'],
+    );
+  }
+}
+
+/**
+ * A special handler to take the place of missing or broken handlers.
+ *
+ * @ingroup views_sort_handlers
+ */
+class views_handler_sort_broken extends views_handler_sort {
+  function ui_name($short = FALSE) {
+    return t('Broken/missing handler');
+  }
+
+  function ensure_my_table() { /* No table to ensure! */ }
+  function query($group_by = FALSE) { /* No query to run */ }
+  function options_form(&$form, &$form_state) {
+    $form['markup'] = array(
+      '#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
+    );
+  }
+
+  /**
+   * Determine if the handler is considered 'broken'
+   */
+  function broken() { return TRUE; }
+}
+
+
+/**
+ * @}
+ */

+ 74 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_sort_date.inc

@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_sort_date.
+ */
+
+/**
+ * Basic sort handler for dates.
+ *
+ * This handler enables granularity, which is the ability to make dates
+ * equivalent based upon nearness.
+ *
+ * @ingroup views_sort_handlers
+ */
+class views_handler_sort_date extends views_handler_sort {
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['granularity'] = array('default' => 'second');
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['granularity'] = array(
+      '#type' => 'radios',
+      '#title' => t('Granularity'),
+      '#options' => array(
+        'second' => t('Second'),
+        'minute' => t('Minute'),
+        'hour'   => t('Hour'),
+        'day'    => t('Day'),
+        'month'  => t('Month'),
+        'year'   => t('Year'),
+      ),
+      '#description' => t('The granularity is the smallest unit to use when determining whether two dates are the same; for example, if the granularity is "Year" then all dates in 1999, regardless of when they fall in 1999, will be considered the same date.'),
+      '#default_value' => $this->options['granularity'],
+    );
+  }
+
+  /**
+   * Called to add the sort to a query.
+   */
+  function query() {
+    $this->ensure_my_table();
+    switch ($this->options['granularity']) {
+      case 'second':
+      default:
+        $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order']);
+        return;
+      case 'minute':
+        $formula = views_date_sql_format('YmdHi', "$this->table_alias.$this->real_field");
+        break;
+      case 'hour':
+        $formula = views_date_sql_format('YmdH', "$this->table_alias.$this->real_field");
+        break;
+      case 'day':
+        $formula = views_date_sql_format('Ymd', "$this->table_alias.$this->real_field");
+        break;
+      case 'month':
+        $formula = views_date_sql_format('Ym', "$this->table_alias.$this->real_field");
+        break;
+      case 'year':
+        $formula = views_date_sql_format('Y', "$this->table_alias.$this->real_field");
+        break;
+    }
+
+    // Add the field.
+    $this->query->add_orderby(NULL, $formula, $this->options['order'], $this->table_alias . '_' . $this->field . '_' . $this->options['granularity']);
+  }
+}

+ 38 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_sort_group_by_numeric.inc

@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_sort_group_by_numeric.
+ */
+
+/**
+ * Handler for GROUP BY on simple numeric fields.
+ *
+ * @ingroup views_sort_handlers
+ */
+class views_handler_sort_group_by_numeric extends views_handler_sort {
+  function init(&$view, &$options) {
+    parent::init($view, $options);
+
+    // Initialize the original handler.
+    $this->handler = views_get_handler($options['table'], $options['field'], 'sort');
+    $this->handler->init($view, $options);
+  }
+
+  /**
+   * Called to add the field to a query.
+   */
+  function query() {
+    $this->ensure_my_table();
+
+    $params = array(
+      'function' => $this->options['group_type'],
+    );
+
+    $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order'], NULL, $params);
+  }
+
+  function ui_name($short = FALSE) {
+    return $this->get_field(parent::ui_name($short));
+  }
+}

+ 54 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_sort_menu_hierarchy.inc

@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_sort_menu_hierarchy.
+ */
+
+/**
+ * Sort in menu hierarchy order.
+ *
+ * Given a field name of 'p' this produces an ORDER BY on p1, p2, ..., p9;
+ * and optionally injects multiple joins to {menu_links} to sort by weight
+ * and title as well.
+ *
+ * This is only really useful for the {menu_links} table.
+ *
+ * @ingroup views_sort_handlers
+ */
+class views_handler_sort_menu_hierarchy extends views_handler_sort {
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['sort_within_level'] = array('default' => FALSE);
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    $form['sort_within_level'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Sort within each hierarchy level'),
+      '#description' => t('Enable this to sort the items within each level of the hierarchy by weight and title.  Warning: this may produce a slow query.'),
+      '#default_value' => $this->options['sort_within_level'],
+    );
+  }
+
+  function query() {
+    $this->ensure_my_table();
+    $max_depth = isset($this->definition['max depth']) ? $this->definition['max depth'] : MENU_MAX_DEPTH;
+    for ($i = 1; $i <= $max_depth; ++$i) {
+      if ($this->options['sort_within_level']) {
+        $join = new views_join();
+        $join->construct('menu_links', $this->table_alias, $this->field . $i, 'mlid');
+        $menu_links = $this->query->add_table('menu_links', NULL, $join);
+        $this->query->add_orderby($menu_links, 'weight', $this->options['order']);
+        $this->query->add_orderby($menu_links, 'link_title', $this->options['order']);
+      }
+
+      // We need this even when also sorting by weight and title, to make sure
+      // that children of two parents with the same weight and title are
+      // correctly separated.
+      $this->query->add_orderby($this->table_alias, $this->field . $i, $this->options['order']);
+    }
+  }
+}

+ 22 - 0
sites/all/modules/contrib/views/views/handlers/views_handler_sort_random.inc

@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_sort_random.
+ */
+
+/**
+ * Handle a random sort.
+ *
+ * @ingroup views_sort_handlers
+ */
+class views_handler_sort_random extends views_handler_sort {
+  function query() {
+    $this->query->add_orderby('rand');
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    $form['order']['#access'] = FALSE;
+  }
+}

File diff suppressed because it is too large
+ 0 - 0
sites/all/modules/contrib/views/views/help/about.html


+ 43 - 0
sites/all/modules/contrib/views/views/help/advanced-settings.html

@@ -0,0 +1,43 @@
+In the category <strong>Other</strong> you have different options to set Advanced configurations in your View.
+
+<strong>Machine Name:</strong>
+You can change the default machine name of the view.
+
+<strong>Comment: No comment</strong>
+You can Use the comment option to write comments for your Views, the comments are only shown in the Views UI. Comment your Display for other Maintainer
+
+<strong>Use AJAX: No</strong>
+If set, this view will use an AJAX mechanism for paging, table sorting and exposed filters. This prevents the entire page from refreshing. It is not recommended that you use this if this view is the main content of the page as it will prevent deep linking to specific pages, but it is very useful for side content. Block displays require this setting to be ON if exposed filters are being used.
+
+<strong>Hide attachments in summary: No</strong>
+
+<strong>Use aggregation: No</strong>
+All fields that are selected for grouping will be collapsed to one record per distinct value. Other fields which are selected for aggregation will have the function run on them. For example, you can group nodes on title and count the number of nids in order to get a list of duplicate titles.
+For more Information how aggregation work see the "Use Aggregation" Help Page
+
+<strong>Query settings: Settings</strong>
+
+Here can you set advanced Settings for the SQL Settings
+<ul>
+  <li><strong>Disable SQL rewriting</strong></li>
+
+  <li><strong>Distinct: No</strong></li>
+  This will make the view display only distinct items. If there are multiple identical items, each will be displayed only once. You can use this to try and remove duplicates from a view, though it does not always work. Note that this can slow queries down, so use it with caution.
+
+  <li><strong>Use Slave Server</strong></li>
+
+  <li><strong>Query Comment</strong></li>
+</ul>
+<strong>Field Language: Current user's language</strong>
+
+<strong>Caching: None</strong>
+You can choose a "Time-based" Caching if you want. With it you get the option to choose the length of time raw query results should be cached and "The length of time rendered HTML output should be cached."
+
+<strong>Link display: Page</strong>
+
+<strong>CSS class: None</strong>
+You can define some own CSS Classes for your View
+
+<strong>Theme: Information</strong>
+Clicking on the "Theme: Information" link provides you with a listing of all posiible theming files. The highlighted files are the ones Views is currently using. All other filenames are suggested templates.
+For more Information see the <a href="/help/views/analyze-theme" title="Theme Information" >"Theme information"</a> Page

+ 30 - 0
sites/all/modules/contrib/views/views/help/advanced-style-settings.html

@@ -0,0 +1,30 @@
+In Views 3 you can set Advanced Style Settings, they help you to insert markup of your own from the Views UI, so that you can fairly easily override the default markup without having to restyle via templates.
+
+
+<ul>
+<li> Customize field HTML</li>
+With Customize field HTML you can generate html tags around the field.
+
+<li>Customize label HTML</li>
+Here you can generate html tags around the label of a field.
+
+<li>Customize field and label wrapper HTML</li>
+Here you can generate html tags around the wrapper of the label and field
+</ul>
+
+<a href="path:images/views3-semanticviews.png"><img src="path:images/views3-semanticviews.png" /></a>
+
+Usage example
+
+In a view with a field:
+<ol>
+<li>Configure the field. (Click on the field.)</li>
+
+<li>In the modal that opens, scroll down to <strong>Style Settings</strong>.</li>
+
+<li>Choose one or more of the three <i>Customize</i> options. This will reveal a dropdown menu where you can choose from one or more HTML tags to use on that field and allow you to add a CSS class specific to that field should you desire.</li>
+
+<li>Decide if you want to keep the Views default classes. Unchecking this box means your markup is *it*.</li>
+</ol>
+
+In Views 2 you needed for Style Settings the <a href="http://drupal.org/project/semanticviews">Semantic Views</a> Modul, now the Semantic Views module has been mostly incorporated into Views 3.x. Semantic Views is still around for people who need it, though. For some details on how the original module is different from the Views implementation, please see <a href="http://drupal.org/node/1013876">this issue</a>.

+ 1 - 0
sites/all/modules/contrib/views/views/help/aggregation.html

@@ -0,0 +1 @@
+See: <a href="topic:views/group-by">Group by</a>

+ 31 - 0
sites/all/modules/contrib/views/views/help/alter-exposed-filter.html

@@ -0,0 +1,31 @@
+Modifying default values of a views exposed form is tricky, because FAPI was not designed to work with GET forms. One consequence is that it often can't tell if textfields (there are others) were submitted or not.
+
+As a consequence, it *always* thinks the value was submitted, even if it was not. To fix that, Views modifies $form_state['input'][$identifier] with the default value if $form_state['input'][$identifier] was not set. In order to modify the default value in an alter, you need to do this:
+
+<pre>
+&lt;?php
+if (empty($form_state['view']->exposed_input[$identifier])) .
+		{ $form_state['input'][$identifier] = $default_value; }
+?&gt;
+</pre>
+
+where $identifier is the particular filter for which you want to change the default value, and $default_value is the new default value you want to set.
+
+If you use a hook_form_FORM_ID_alter or hook_form_alter, you can modify exposed filters on the fly based on information that is external to Views. For example, I modified the exposed filter of a form to set a taxonomy term ID based on the user's GeoIP.
+
+To do this, I used the following function, where geoip_redirect_get_tid() loads the relevant term id based on the user's current ip_address():
+
+<pre>
+&lt;?php
+function MODULENAME_form_views_exposed_form_alter(&$form, $form_state) {
+  if(strpos($form['#id'], 'volunteer-directory') !== FALSE) {
+    $city_tid = geoip_redirect_get_tid();
+    if(is_numeric($city_tid) && $city_tid != 7660) {
+      if (empty($form_state['view']->exposed_input['tid']))  {
+        $form_state['input']['tid'] = $city_tid;
+      }
+    }
+  }
+}
+?&gt;
+</pre>

+ 24 - 0
sites/all/modules/contrib/views/views/help/analyze-theme.html

@@ -0,0 +1,24 @@
+<p>Clicking on the "Theme: Information" link provides you with a listing of all posiible theming files. The highlighted files are the ones Views is currently using. All other filenames are suggested templates.</p>
+<p>You may use any of the following possible theme files to modify individual parts of your view. In total, there are four parts to theming a view.</p>
+<ul>
+  <li> The <strong>display</strong> theme is usually views-view.tpl.php and it largely controls the decorations around a view; where the header, footer, pager, more link, feed icon, etc, will be placed. </li>
+
+  <li> The <strong>style</strong> will control how all of the results of the display are put together. It may be as simple as just displaying all of the rows, or it may be a complex table generator or something in between. </li>
+
+  <li> The <strong>row</strong> style controls each individual row; not all styles utilize the row style (notably the table), but most others do.
+
+  <li> Finally, <strong>field</strong> themes allow you to override the look and even the data of each individual field, if the style uses fields. The actual template the system will use should be hilighted in <strong>bold</strong>.</li>
+</ul>
+
+<div class="help-box" style="text-align:center">
+<a href="path:images/style-breakdown-large.png"><img src="path:images/style-breakdown.png" /></a>
+<em>A breakdown of View output</em>
+</div>
+
+<p>The link to the left of each type will give you information about the default template used for that type. You may cut and paste this and place it in your theme with the appropriate template, or you may copy the base file from the views/theme directory (or, if provided by a module, from the module's directory). <strong>It is important that you clear the theme registry cache every time you add a new template, or the new template will not be picked up.</strong></p>
+
+<p><strong>Important note:</strong> You place your custom template files in your theme directory, <strong>not views/theme</strong>. This is always true of theming with Drupal.
+
+<p>In addition to this tool, the very useful <a href="http://drupal.org/project/devel">devel</a> module contains a tool called the "Theme developer" which does a good job of visually showing you which areas of your site use which themes. Be careful with it, though, as the theme developer causes the Views edit page to break.</p>
+
+<p>Also, this feature will only work properly with Drupal 6.3 and later; prior to Drupal 6.3 <a href="http://drupal.org/node/241570">this patch</a> will be required.</p>

File diff suppressed because it is too large
+ 0 - 0
sites/all/modules/contrib/views/views/help/api-default-views.html


+ 179 - 0
sites/all/modules/contrib/views/views/help/api-example.html

@@ -0,0 +1,179 @@
+
+For the new table defined by the Node example module to be understood by the views module you need to create a node_example.views.inc file that describes the table and its relationships to the rest of the database.  In order for views to know that this file is to be loaded you need to implement hook_views_api.  This is done by adding the following function into your node_example.module file
+
+<pre>
+&lt;?php
+/**
+ * Implements hook_views_api().
+ *
+ * This tells drupal that there is Views integration file named
+ * module-name.views.inc
+ */
+function node_example_views_api() {
+  // Note that you can include 'path' in this array so that your views.inc
+  // file can be stored in a different location.
+  return array(
+    'api' => 2.0
+  );
+}
+?&gt;
+</pre>
+
+Below is the contents of a simple node_example.views.inc file that allows you to create views that include the new color and quantity information.
+
+<pre>
+&lt;?php
+
+/**
+ * This file is used to tell the views module about the new node_example table.
+ *
+ * Database definition:
+ * @code
+ *   CREATE TABLE node_example (
+ *     vid int(10) unsigned NOT NULL default '0',
+ *     nid int(10) unsigned NOT NULL default '0',
+ *     color varchar(255) NOT NULL default '',
+ *     quantity int(10) unsigned NOT NULL default '0',
+ *     PRIMARY KEY (vid, nid),
+ *     KEY `node_example_nid` (nid)
+ *   )
+ * @endcode
+ */
+
+function node_example_views_data()  {
+  // Basic table information.
+
+  // ----------------------------------------------------------------
+  // node_example table
+  //  New group within Views called 'Example'
+  //  The group will appear in the UI in the dropdown tha allows you
+  //  to narrow down which fields and filters are available.
+
+  $data = array();
+  $data['node_example']['table']['group']  = t('Example');
+
+  // Let Views know that our example table joins to the 'node'
+  // base table. This means it will be available when listing
+  // nodes and automatically make its fields appear.
+  //
+  // We also show up for node revisions.
+  $data['node_example']['table']['join'] = array(
+    'node_revisions' => array(
+      'left_field' => 'vid',
+      'field' => 'vid',
+    ),
+    'node' => array(
+      'left_field' => 'vid',
+      'field' => 'vid',
+    ),
+  );
+
+  // quantity
+  $data['node_example']['quantity'] = array(
+    'title' => t('Quantity'),
+    'help' => t('Quantity of items.'),
+    'field' => array(
+      'handler' => 'views_handler_field_numeric',
+      'click sortable' => TRUE,
+     ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+
+  // Color
+  $data['node_example']['color'] = array(
+    'title' => t('Color'),
+    'help' => t('Color of item.'),
+
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE,
+     ),
+     'filter' => array(
+      'handler' => 'views_handler_filter_string',
+     ),
+     'argument' => array(
+       'handler' => 'views_handler_argument_string',
+     ),
+     'sort' => array(
+      'handler' => 'views_handler_sort',
+     ),
+  );
+
+  return $data;
+}
+
+?&gt;
+</pre>
+
+Some notes on usage:
+
+Within Views, click on the Add tab.  You have a number of type options here.  Normally you would select either 'Node' (if you only want to display information on current nodes) or 'Node revision' (if you want to display information on all revisions of the nodes)
+
+With this configuration you always pull out of the database, data for every single node, whether or not it has color and quantity information.  To display information on just those nodes that have color and quantity information you can use a filter so that only nodes which don't have a NULL color or a NULL quantity are displayed.
+
+<h3>Type/relationship extension</h3>
+
+When your tables have first class data, you will often need to have own View types and View relationships defined.  With the current node_example table this isn't required although I try to justify it below on an efficiency basis. See [[http://groups.drupal.org/node/17236#comment-58980|this discussion]] as to why it isn't justified.
+
+Pulling data out of the database for every node when you only want data for the new Example node type is inefficient.  To reduce the initial data extraction to just that relating to the new Example nodes requires that you make the node_example table the base table.  This can be done by adding the following code into the node_example.views.inc file just before the 'return $data;'
+
+<pre>
+&lt;?php
+
+//  **** Begin optional extra for type and relationships ****
+
+  //  Use node_example as a new base table
+  //     by creating a new views type called 'Node example'
+  //  This allows it to be selected as the 'view type'
+  //          when you initially add a new view.
+  $data['node_example']['table']['base'] = array(
+    'field' => 'vid',
+    'title' => t('Node example'),
+    'help' => t("Node example type with color and quantity information."),
+    'weight' => -9,
+  );
+
+  // When using the new 'Node example' type you need to use relationships
+  //   to access fields in other tables.
+
+  // Relationship to the 'Node revision' table
+  $data['node_example']['vid'] = array(
+    'title' => t('Node revision'),
+    'help' => t('The particular node revision the color and quantity is attached to'),
+    'relationship' => array(
+      'label' => t('Node revision'),
+      'base' => 'node_revisions',
+      'base field' => 'vid',
+      // This allows us to not show this relationship if the base is already
+      // node_revisions so users won't create circular relationships.
+      'skip base' => array('node', 'node_revisions'),
+    ),
+  );
+
+  // Relationship to the 'Node' table
+  $data['node_example']['nid'] = array(
+    'title' => t('Node'),
+    'help' => t('The particular node the color and quantity is attached to'),
+    'relationship' => array(
+      'label' => t('Node'),
+      'base' => 'node',
+      'base field' => 'nid',
+      // This allows us to not show this relationship if the base is already
+      // node so users won't create circular relationships.
+      'skip base' => array('node', 'node_revisions'),
+    ),
+  );
+
+//  **** End optional extra for type and relationships ****
+
+?&gt;
+</pre>
+
+The above code adds a new 'Node example' to the view types that can be selected within the Add tab window of views.  Selecting this sets the node_example table to be the base table.
+
+If you select 'Node example' as view type, when you initially go into the edit window of views you will find  the only fields available are the color and quantity fields.  To get fields from other tables you need to add a relationship.  Relationships may be found at the top in the same column as the fields.

+ 88 - 0
sites/all/modules/contrib/views/views/help/api-forms.html

@@ -0,0 +1,88 @@
+Views allows handlers to output form elements, wrapping them automatically in a form, and handling validation / submission.
+The form is multistep by default, allowing other modules to add additional steps, such as confirmation screens.
+
+<h2>Implementation</h2>
+A views handler outputs a special placeholder in render(), while the real form with matching structure gets added in views_form().
+When the View is being preprocessed for the theme file, all placeholders get replaced with the rendered form elements.
+
+The views handler can also implement views_form_validate() and views_form_submit().
+<pre>
+  function render($values) {
+    return '&lt;!--form-item-' . $this-&gt;options['id'] . '--' . $this-&gt;view-&gt;row_index . '--&gt;';
+  }
+
+  function form_element_name() {
+    // Make sure this value is unique for all the view fields
+    return $this-&gt;options['id'];
+  }
+
+  function form_element_row_id($row_id) {
+    // You could use values from $this-&gt;view-&gt;result[$row_id]
+    // to provide complex row ids.
+    return $row_id;
+  }
+
+  function views_form(&$form, &$form_state) {
+    // The view is empty, abort.
+    if (empty($this-&gt;view-&gt;result)) {
+      return;
+    }
+
+    $field_name = $this-&gt;form_element_name();
+    $form[$field_name] = array(
+      '#tree' => TRUE,
+    );
+    // At this point, the query has already been run, so we can access the results
+    foreach ($this-&gt;view-&gt;result as $row_id => $row) {
+      $form_element_row_id = $this-&gt;form_element_row_id($row_id);
+      $form[$field_name][$form_element_row_id] = array(
+        '#type' => 'textfield',
+        '#title' => t('Your name'),
+        '#default_value' => '',
+      );
+    }
+  }
+
+  // Optional validate function.
+  function views_form_validate($form, &$form_state) {
+    $field_name = $this->form_element_name();
+    foreach ($form_state['values'][$field_name] as $row_id => $value) {
+      if ($value == 'Drupal') {
+        form_set_error($field_name . '][' . $row_id, "You can't be named Drupal. That's my name.");
+      }
+    }
+  }
+
+  // Optional submit function.
+  function views_form_submit($form, &$form_state) {
+    // Do something here
+  }
+</pre>
+
+The form is multistep by default, with one step: 'views_form_views_form'.
+A "form_example" module could add a confirmation step by setting:
+<pre>
+ $form_state['step'] = 'form_example_confirmation';
+</pre>
+in form_example_views_form_submit().
+Then, views_form would call form_example_confirmation($form, $form_state, $view, $output) to get that step.
+
+<b>Important:</b> You can fetch the Views object in form_alter and validate / submit hooks from the form state:
+<pre>
+  $view = $form_state['build_info']['args'][0];
+</pre>
+
+<h2>Relevant Views functions</h2>
+<ul>
+<li>template_preprocess_views_view()</li>
+<li>views_form()</li>
+<li>views_form_views_form()</li>
+<li>views_form_views_form_validate()</li>
+<li>views_form_views_form_submit()</li>
+<li>theme_views_form_views_form()</li>
+</ul>
+
+<h2>Hooks</h2>
+<ul>
+<li>hook_views_form_substitutions()</li>
+</ul>

+ 45 - 0
sites/all/modules/contrib/views/views/help/api-handler-area.html

@@ -0,0 +1,45 @@
+In Views areas (header, footer, empty-text) are pluggable, this means you can write your own php logic to place whatever you want.
+
+<h3>Requirements</h3>
+You should have read <a href="topic:views/api">API</a> and <a href="topic:views/api-tables">Tables API</a> to get a basic knowledge
+how to extend views.
+
+<h3>Create your own area handler</h3>
+
+The first step is to tell views: Hey i want to add a new area handler.
+Therefore you have to implement hook_views_data and add a new one. For example:
+
+<pre>
+function yourmodule_views_data() {
+  $data['views']['collapsible_area'] = array(
+    'title' =&gt; t('Collabsible Text area'),
+    'help' =&gt; t('Provide collabsible markup text for the area.'),
+    'area' =&gt; array(
+      'handler' =&gt; 'yourmodule_handler_collapsible_area_text',
+    ),
+  );
+}
+</pre>
+
+The second step is to write this handler. Therefore create a file called yourmodule_handler_collapsible_area_text.inc and
+add it to the .info file of your module.
+
+Then add content to your area file like this:
+<pre>
+class yourmodule_handler_collapsible_area_text extends views_handler_area_text {
+  function render($empty = FALSE) {
+    // Here you just return a string of your content you want.
+    if ($render = parent::render($empty)) {
+      $element = array(
+        '#type' =&gt; 'fieldset',
+        '#title' =&gt; t('Title'),
+        '#value' =&gt; $render,
+      );
+      $output = theme('fieldset', $element);
+      return $output;
+    }
+  }
+}
+</pre>
+
+As on every handler you can add options so you can configure the behavior. If the area isn't shown yet in the views interface, please clear the cache :)

File diff suppressed because it is too large
+ 238 - 0
sites/all/modules/contrib/views/views/help/api-tables.html


+ 224 - 0
sites/all/modules/contrib/views/views/help/api-upgrading.html

@@ -0,0 +1,224 @@
+In order to take advantage of the changes in Drupal 7, Views has gone through several API changes.
+Here's what you should know.
+
+<h3>Handler registry</h3>
+
+Views now uses Drupal's dynamic-loading code registry.
+You can safely remove your implementations of hook_views_handlers(), since they are no longer used.
+
+Please remember to specify the handlers in your module's .info file. For example:
+<pre>
+name = Example module
+description = "Gives an example of a module."
+core = 7.x
+files[] = example.module
+files[] = example.install
+
+; Views handlers
+files[] = includes/views/handlers/example_handler_argument_string.inc
+</pre>
+
+<h3>Removed handlers</h3>
+
+Note that views_handler_filter_float has been removed.
+This functionality is now handled by views_handler_filter_numeric.
+There's no need for having a special handler any more, thanks to the new DB layer in Drupal 7.
+
+views_handler_sort_formula has been removed.
+Everyone who used it can extend from views_handler_sort, too.
+
+<h3>Ctools dependency</h3>
+Views requires ctools now, so it can use the dependency system of ctools.
+The only thing you have to do is to remove views_process_dependency.
+
+<h3>Changed add_where api</h3>
+If your field is a plain sql field:
+<pre>
+$this->query->add_where($this->options['group'], "$this->table_alias.$this->real_field " . $this->operator . " '%s'", $this->value);
+</pre>
+has to be converted to
+<pre>
+$this->query->add_where($this->options['group'], "$this->table_alias.$this->real_field", $this->value, $this->operator);
+</pre>
+If your field is a complex where condition:
+<pre>
+$this->query->add_where($this->options['group'], "$upper($field) NOT LIKE $upper('%%%s')", $this->value);
+</pre>
+has to be converted to
+<pre>
+$placeholder = $this->placeholder();
+$this->query->add_where_expression($this->options['group'], "$field LIKE $placeholder", array($placeholder => '%' . db_like($this->value)));
+</pre>
+placeholder() generates a automatic unique placeholder for you.
+
+add_where with operator 'formula' can be converted to add_where_expression.
+add_having with operator 'formula' can be converted to add_having_expression.
+
+<h3>Changed place for display specific settings</h3>
+In the new ui the new place for display settings is at the top of the second column.
+Therefore use something like this code in your display plugin:
+<pre>
+$categories['block'] = array(
+  'title' => t('Block settings'),
+  'column' => 'second',
+  'build' => array(
+    '#weight' => -10,
+  ),
+);
+</pre>
+
+<h3>Changed filter settings and associated class variables</h3>
+'optional' and 'single' are now 'required' and 'multiple', the logic is now opposite.
+Also, the 'no_single' and 'no_optional' class variables (known as "object flags" in the API docs)
+are now 'always_multiple' and 'always_required'.
+
+<h3>Changed argument settings</h3>
+See the init() function in views_handler_argument for an overview of everything
+that changed.
+
+1. The default actions 'summary asc', 'summary desc', 'summary asc by count', 'summary asc by count'
+have been replaced by a single 'summary' action (which takes the sort order and type as options).
+2. Wildcards are now called exceptions.
+<pre>
+$this->options['exception']['value'] = $options['wildcard'];
+$this->options['exception']['title'] = $options['wildcard_substitution'];
+</pre>
+3. Summary plugin options are now stored in 'summary_options' instead of 'style_options'
+<pre>
+$this->options['summary_options'] = $options['style_options'];
+</pre>
+4. The selected summary plugin is no longer stored in 'style_plugin'.
+<pre>
+$this->options['summary']['format'] = $options['style_plugin'];
+</pre>
+5. The validator options have been moved.
+<pre>
+$options['validate']['type'] = $options['validate_type'];
+$options['validate']['fail'] = $options['validate_fail'];
+</pre>
+6. The validator settings have been moved from $form['argument_validate'] to ['validate_options']
+This means that dependent code in validate plugins needs to change.
+Example change for views_plugin_argument_validate_user:
+<pre>
+    $form['roles'] = array(
+       '#dependency' => array(
+-        'edit-options-argument-validate-user-restrict-roles' => array(1),
++        'edit-options-validate-options-user-restrict-roles' => array(1),
+       ),
+</pre>
+
+<h3>The introduction of get_value() and sanitize_value()</h3>
+The views_handler class got two new functions:
+<pre>
+/**
+ * Get the value that's supposed to be rendered.
+ *
+ * @param $values
+ *   An object containing all retrieved values.
+ * @param $field
+ *   Optional name of the field where the value is stored.
+ */
+function get_value($values, $field = NULL) {
+  $alias = isset($field) ? $this->aliases[$field] : $this->field_alias;
+  if (isset($values->{$alias})) {
+    return $values->{$alias};
+  }
+}
+
+/**
+ * Sanitize the value for output.
+ *
+ * @param $value
+ *   The value being rendered.
+ * @param $type
+ *   The type of sanitization needed. If not provided, check_plain() is used.
+ */
+function sanitize_value($value, $type = NULL) {
+  switch ($type) {
+    case 'xss':
+      $value = filter_xss($value);
+      break;
+    case 'url':
+      $value = check_url($value);
+      break;
+    default:
+      $value = check_plain($value);
+      break;
+  }
+  return $value;
+}
+</pre>
+These functions are meant to be used in the render() functions of field handlers,
+for fetching data (usually by alias) from the $values object, and for sanitizing values.
+
+The abstraction of fetching data from rendering data is important because
+different query backends have different ways of storing data in $values, and the field alias
+is a SQL specific thing. So instead of overriding the whole render() function and copying
+all of the logic there (as well as having to constantly keep up with upstream Views changes),
+the backend can just override get_values(), which is significantly less code.
+
+Of course, different ways of fetching and displaying data might require different
+ways of sanitizing it, hence the usage of the sanitize_value() function.
+
+Examples of converting render() field handler implementations:
+<pre>
+// This
+$value = $values->{$this->field_alias};
+// Becomes this
+$value = $this->get_value($values);
+
+// And this
+$format = $values->{$this->aliases['format']};
+// Becomes this
+$format = $this->get_values($values, 'format');
+
+// Instead of this:
+return check_plain($value);
+// We write:
+return $this->sanitize_value($value);
+
+// Since sanitize_value() supports different sanitization functions, this:
+return filter_xss($value);
+// Can become:
+return $this->sanitize_value($value, 'xss');
+</pre>
+
+
+<h3>Changed views_get_page_view</h3>
+In contrast to 6.x views_get_page_view now does stores the current view, not the current page display.
+
+<h3>Removed views-view-row-node</h3>
+Due to changes in comment.module there is no extra views-view-row-node template needed to display the comments. If you do some custom stuff there you should now be able to do everything in your node.tpl.php.
+
+<h3>Entity type Key on Base tables</h3>
+During the development of the drupal7 version of views the entity type associated with a table got added to $data['name']['table']['base']['entity type']. It should be moved to $data['name']['table']['entity type'].
+
+<h3>Changed views_plugin_style::render_grouping()</h3>
+The parameters as well as the structure of the methods return have changed.
+The method now accepts a third optional parameter called "$group_rendered".
+This parameter defines whether to use the rendered or the raw field value for grouping.
+Intention for adding the parameter was that the grouping could have been acted
+unexpected if the rendered field contained unique values e.g. by using drupal_html_id().
+<dl>
+<dt>New return structure</dt>
+<dd>
+{grouping value} is the value affected by the new parameter.
+<pre>
+  array (
+    {grouping value} => array(
+      'group' => {rendered_value of the grouping field},
+      'rows' => array({group rows}),
+    ),
+  );
+</pre>
+</dd>
+<dt>Old return structure</dt>
+<dd>
+<strong>If the new parameter isn't explicitly set or its value is NULL the structure of the return will be the same as in D6!</strong>
+<pre>
+  array (
+    {rendered_value of the grouping field} => array({group rows}),
+  );
+</pre>
+</dd>
+</dl>

File diff suppressed because it is too large
+ 4 - 0
sites/all/modules/contrib/views/views/help/api.html


File diff suppressed because it is too large
+ 0 - 0
sites/all/modules/contrib/views/views/help/argument.html


File diff suppressed because it is too large
+ 11 - 0
sites/all/modules/contrib/views/views/help/basic-settings.html


+ 5 - 0
sites/all/modules/contrib/views/views/help/demo-video.html

@@ -0,0 +1,5 @@
+<p>Here are some links to demonstration videos. It will get you started working with Views.</p>
+
+<p><a href="http://drupal.org/node/248766">Views 2 (Drupal 6) Demonstration Video - Drupal Handbook</a></p>
+
+<p><a href="http://nodeone.se/blogg/taming-the-beast-learn-views-with-nodeone">NodeOne's initial screencasts on the Views 3 UI.</a>

+ 1 - 0
sites/all/modules/contrib/views/views/help/display-attachment.html

@@ -0,0 +1 @@
+Attachment displays are 'attached' to another display in the same view. When the display is visited, the attached display will also be rendered and may be placed before, after or both before and after the original display. Attachment displays are often useful for displaying an argument summary view along with a page display that accepts arguments. This can be used to provide a kind of glossary.

+ 11 - 0
sites/all/modules/contrib/views/views/help/display-block.html

@@ -0,0 +1,11 @@
+Block displays will show up on your blocks administration page. Once a block display is created and saved, it can be enabled and positioned in your theme by visiting <strong>administer &gt;&gt; site building &gt;&gt; blocks</strong> and selecting it from the list.
+
+Blocks <strong>do not</strong> accept arguments from any source; the only way to get arguments to a block is to provide defaults to it, possibly via the PHP Code default setting.
+
+<ul>
+<li>Edit the argument in question; you may want to override this argument if you have multiple displays using it.</li>
+<li>Change the "Action to take if argument is not present" to "Provide default argument". This will bring up a new box called "Provide default argument options".</li>
+<li>The most common default argument type used for blocks is Node from URL, where it attempts to determine if the URL refers to a node, for example if visiting 'node/1' or 'node/1/edit'. User ID from URL is also very common.</li>
+<li>If you change the default argument type to 'PHP Code' (note: You must have permission to use PHP code on your site) you can enter PHP to define the argument needed. Simply return the argument.</li>
+<li>If you are using a <strong>more link</strong> with a block, you must have a page display for that more link to attach to. The more link will not print if there is no place (no display) for it to link to.</li>
+</ul>

+ 3 - 0
sites/all/modules/contrib/views/views/help/display-default.html

@@ -0,0 +1,3 @@
+The default display is primarily a display to store settings, and isn't actually used anywhere within the Views system. It is possible for external programs to use the default display, but if they do they will (hopefully) tell you which display they will be working with. The default display is also a convenient display to use to embed into your site using PHP snippets; this is useful, for example, in node content, but this is something that should generally only be done by administrators.
+
+In general, you probably want to add either a <a href="topic:views/display-page">page display</a> or a <a href="topic:views/display-block">block display</a>.

+ 1 - 0
sites/all/modules/contrib/views/views/help/display-feed.html

@@ -0,0 +1 @@
+A feed display allows you to attach an RSS feed to a view.

+ 7 - 0
sites/all/modules/contrib/views/views/help/display-page.html

@@ -0,0 +1,7 @@
+Page displays have a <a href="topic:views/path">path</a> and an optional <a href="topic:views/menu">menu</a> component. Page displays will be the primary content for the page, meaning they will be displayed in the main content area when you visit the URL that corresponds to the path.
+
+Page displays take their arguments from the URL. You can embed arguments into the URL using %; in previous versions of Views, this was '$arg'. For example, 'node/%/foo' will accept URLs such as 'node/1/foo'.
+
+Please remember that using a % placeholder makes the argument required. If you wish to have an optional argument, simply omit the % from the path. I.e. using "page/%" as the path requires an argument and visiting 'http://www.example.com/page' will not trigger the view.
+
+If you intend to embed a view manually into another view, it is recommended that the page display not be used for embedding. Select a different display type to embed.

File diff suppressed because it is too large
+ 4 - 0
sites/all/modules/contrib/views/views/help/display.html


+ 13 - 0
sites/all/modules/contrib/views/views/help/drush.html

@@ -0,0 +1,13 @@
+There are some Drush commands available for Views, initially added in <a href="http://drupal.org/node/1079178">Drush command to revert views</a>:
+
+<ul>
+<li>views-dev (vd) -  Setup the views settings to a more developer oriented value</li>
+<li>views-revert (vr) - Revert overridden views to their default state. Make backups first!</li>
+</ul>
+
+Examples:
+drush views-revert
+[prompts the user with a list of overridden views to choose from, or to revert all]
+
+drush views-revert archive myview2
+[reverts the two specified views]

+ 24 - 0
sites/all/modules/contrib/views/views/help/embed.html

@@ -0,0 +1,24 @@
+You can easily embed the results of a view into other parts of your site;
+either with code as a module, or in nodes or blocks as snippets. The
+easiest way is to use the function <strong>views_embed_view()</strong>:
+
+<code>/**
+ * Embed a view using a PHP snippet.
+ *
+ * This function is meant to be called from PHP snippets, should one wish to
+ * embed a view in a node or something. It's meant to provide the simplest
+ * solution and doesn't really offer a lot of options, but breaking the function
+ * apart is pretty easy, and this provides a worthwhile guide to doing so.
+ *
+ * @param $name
+ *   The name of the view to embed.
+ * @param $display_id
+ *   The display id to embed. If unsure, use 'default', as it will always be
+ *   valid. But things like 'page' or 'block' should work here.
+ * @param ...
+ *   Any additional parameters will be passed as arguments.
+ */
+function views_embed_view($name, $display_id = 'default') {
+</code>
+
+To figure out the id of a display, hover your mouse over the tab to select that display. Everything after the '#views-tab-' is the id of that display. This ID is guaranteed never to change unless you delete the display and create a new one.

+ 3 - 0
sites/all/modules/contrib/views/views/help/empty-text.html

@@ -0,0 +1,3 @@
+The Emtpy Text content will be displayed when you choose the option <em>Display empty text</em> under the <strong>Arguments</strong> labelled <em>Action to take if argument is not present</em>.
+
+By default you can choose one or more text areas.

File diff suppressed because it is too large
+ 47 - 0
sites/all/modules/contrib/views/views/help/example-author-block.html


+ 46 - 0
sites/all/modules/contrib/views/views/help/example-filter-by-current-user.html

@@ -0,0 +1,46 @@
+<p>In this example you will create a page that displays a list of the content authored by the current logged-in user. This will demonstrate using Views <em>filters</em> and <em>relationships</em> to dynamically filter the view's contents at display time.</p>
+
+<p>For this example, we are assuming you have a content type "Blog Post".</p>
+
+<h3>Creating the View</h3>
+<p>The first step is creating a view for our content list page. Because the page will show the titles of content, this view is considered a "Content" type. Go to <a target="_blank" href="base_url:admin/structure/views/add">add new view</a>, enter the following properties, and click <strong>Next</strong>:</p>
+
+<dl>
+  <dt>View name</dt>
+  <dd>content_by_current_user</dd>
+  <dt>Description</dt>
+  <dd>List of content authored by the current user.</dd>
+</dl>
+
+<p>Choose <strong>Show</strong> <em>Content</em> <strong>of type</strong> <em>Blog Post</em>. You can choose any way you wish to sort the content.</p>
+
+<h3>Creating the page</h3>
+<p>Tick the box next to <strong>Create a page</strong>. Enter a page title and a path. For our purposes here, the default settings for the rest of this page are sufficient.</p>
+
+<p>Click on <strong>Continue &amp; edit</strong>.</p>
+
+<h3>Creating the relationship</h3>
+<p>In order to have access to the author of the content, it is important to create a relationship between the current content type, and users.</p>
+
+<p>Under <strong>Advanced</strong> in the right culumn, select <strong>add</strong> next to <strong>Relationships</strong>.</p>
+<p>Select <em>Content: Author</em> and click on <strong>Add and configure relationships</strong>. Leave the settings as they are and click on <strong>Apply (all displays)</strong>.</p>
+
+<p>You now have access to the user data related to the content you are viewing.</p>
+
+<h3>Filtering the view</h3>
+<p>Now you need to filter the view to display only content authored by the current user. This data is now available for the content because you have created the relationship in the step above.</p>
+
+<p>Next to <strong>Filter criteria</strong> click on <strong>add</strong> to add a new filter to your view.</p>
+
+<p>Filter the list of fields by selecting <em>User</em> next to <strong>Filter</strong> at the top. You now have more fields than before due to the relationship you created.</p>
+
+<p>Select <em>User: Current</em> from the list and click on <strong>Add and configure filter criteria</strong>.</p>
+
+<p>Since this field is only visible due to the relationship you created, <em>author</em> will already be selected under <strong>Relationship</strong>. This shows that the relationship you created is being used for the filter field.</p>
+<p>Select <em>Yes</em> under <strong>Is the logged in user</strong>, and click on <strong>Apply (all displays)</strong>.</p>
+
+<p>If you have authored content of the type <em>Blog Post</em>, you should now see a list of those posts under the preview section at the bottom.</p>
+
+<h3>Saving &amp; testing the view</h3>
+<p>Click on <strong>Save</strong> to save the view.</p>
+<p>You can test the view by going to the path you entered in the first part of this example.</p>

File diff suppressed because it is too large
+ 55 - 0
sites/all/modules/contrib/views/views/help/example-recent-stories.html


+ 54 - 0
sites/all/modules/contrib/views/views/help/example-slideshow-thumb-pager.html

@@ -0,0 +1,54 @@
+<p>In this example you will create a views block that displays images in a slideshow using thumbnails of the images as a pager underneath the slideshow. This will demonstrate using <em>Views Slideshow </em>and <em>Image Styles</em> to display images.</p>
+
+<p>For this example, we are going to display a single image from each content item of the type &quot;Photos&quot;, which we assume you have already set up with an image field. We are also assuming that <em>Views Slideshow</em> and at least one plugin is installed and activated.</p>
+
+<h3>Creating the image styles</h3>
+
+<p>The first step is creating the right image styles to display the images from the node. We will create one for the slideshow image, and one for the pagers. Go to  <a target="_blank" href="base_url:admin/structure/views/add">Image Styles</a> and create the following two styles:</p>
+
+<dl>
+  <dt>Style name</dt>
+  <dd>slideshow_image</dd>
+  <dt>Effects</dt>
+  <dd>Scale and crop: 600px wide, 400px high</dd>
+</dl>
+<dl>
+  <dt>Style name</dt>
+  <dd>slideshow_thumbnail</dd>
+  <dt>Effects</dt>
+  <dd>Scale and crop: 30px wide, 20px high</dd>
+</dl>
+
+<h3>Creating the View and block</h3>
+
+<p>The next step is creating a view for the slideshow. Because the block will show the images in content, this view is considered a "Content" view. Go to <a target="_blank" href="base_url:admin/structure/views/add">add new view</a>, enter the following properties, and click <strong>Next</strong>:</p>
+<dl>
+  <dt>View name</dt>
+  <dd>Photo Slideshow</dd>
+  <dt>Description</dt>
+  <dd>Slideshow of images from Photos.</dd>
+</dl>
+
+<p>Choose <strong>Show</strong> <em>Content</em> <strong>of type</strong> <em>Photos</em>. You can choose any way you wish to sort the content.</p>
+<p>Untick the box next to <strong>Create a page</strong> and tick the box next to <strong>Create a block</strong>. Enter a block title and choose Slideshow from the <strong>Display format</strong> select box. Select <em>fields</em> from the other select box. Leave the remaining settings as they are.</p>
+<p>Click on <strong>Continue &amp; edit</strong>.</p>
+
+<h3>Editing the view settings</h3>
+
+<p>Turn off the pager by clicking on <strong>Display a specified number of items</strong> in the middle column and selecting <strong>Display all items</strong> in the next screen, and applying the settings.</p>
+<p>Enter a Block name by clicking on <strong>None</strong> at the top of the middle column.</p>
+<p>Next, remove the <em>Content: Title</em> field from the fields list in the left column by blicking on <strong>rearrage</strong> under the arrow.</p>
+<p>Next we have to add the thumbnail image field. Click on <strong>Add</strong> under the fields section and select your image field from the list. In the next screen, turn off the label, select <em>Exclude from display</em> and select <em>slideshow_thumbnail</em> from the Image Style select box. Under MORE, enter <em>Thumbnail</em> under Administrative Title.</p>
+<p>Click on <strong>Apply (all displays)</strong>.</p>
+<p>Now we have to add the image field to display in the slideshow. Clcik on <strong>Add</strong> under the fields section and select your image field from the list. In the next screen, turn off the label and select <em>slideshow_image</em> from the Image Style select box. Under MORE, enter <em>Display Image</em> under Administrative Title.</p>
+<p>Click on <strong>Apply (all displays)</strong>.</p>
+
+<h3>Editing the slideshow settings</h3>
+
+<p>Click on <strong>Settings</strong> next to Format: Slideshow in the first column. In the screen that opens we can choose the options for our slideshow.</p>
+<p>For the purpose of this example, we will only add the thumbnails as a pager, and leave the remaining slideshow settings as they are. Select the tick box next to <em>Pager</em> under Bottom Widgets. Select <em>Fields</em> from the Pager Type select box. Select the tick box next to <em>Thumbnail</em>.</p>
+<p>Click on <strong>Apply (all displays)</strong>.</p>
+
+<h3>Saving &amp; testing the view</h3>
+<p>Click on <strong>Save</strong> to save the view.</p>
+<p>You can test the view by adding the block you have created to your theme.</p>

File diff suppressed because it is too large
+ 1 - 0
sites/all/modules/contrib/views/views/help/example-user-feed.html


File diff suppressed because it is too large
+ 6 - 0
sites/all/modules/contrib/views/views/help/example-users-by-role.html


Some files were not shown because too many files changed in this diff