summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/ctools
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/ctools')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/API.txt47
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/CHANGELOG.txt82
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/LICENSE.txt339
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/UPGRADE.txt63
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.css18
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.info12
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.js29
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.module279
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/button.css32
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/collapsible-div.css26
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/context.css10
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/ctools.css25
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/dropbutton.css67
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/dropdown.css73
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/export-ui-list.css45
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/modal.css126
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/ruleset.css11
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/stylizer.css129
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/wizard.css8
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.api.php207
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.info14
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.install197
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.module842
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info12
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.install82
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.module85
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/access/ruleset.inc109
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc29
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php53
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css134
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info12
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.install19
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.module756
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/ajax-loader.gifbin0 -> 10819 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/loading-large.gifbin0 -> 2545 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/loading.gifbin0 -> 1849 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/popups-border.pngbin0 -> 380 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/js/ctools-ajax-sample.js42
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info12
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.install67
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.module98
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php129
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/README.txt14
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info15
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.module94
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc451
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html17
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html19
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html17
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html21
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Module-setup-and-hooks.html20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html18
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/ctools_plugin_example.help.ini42
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/access/arg_length.inc65
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/access/example_role.inc76
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc52
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/icon_example.pngbin0 -> 566 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc116
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc103
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc129
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc83
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc134
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/panels.pages.inc214
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc50
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/drush/ctools.drush.inc1015
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/about.html29
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/ajax.html0
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/collapsible-div.html1
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-access.html12
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-arguments.html14
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-content.html153
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-context.html13
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-relationships.html13
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context.html0
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/css.html1
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/ctools.help.ini97
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dependent.html1
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dropbutton.html1
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dropdown.html1
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/export-ui.html85
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/export.html291
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/form.html1
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/modal.html215
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/object-cache.html132
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-api.html55
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-creating.html192
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-implementing.html61
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins.html5
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/wizard.html311
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/arrow-active.pngbin0 -> 313 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/collapsible-collapsed.pngbin0 -> 108 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/collapsible-expanded.pngbin0 -> 106 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/expanded-options.pngbin0 -> 228 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-close-window.pngbin0 -> 877 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-configure.pngbin0 -> 765 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-delete.pngbin0 -> 877 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/no-icon.pngbin0 -> 574 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/status-active.gifbin0 -> 2196 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/throbber.gifbin0 -> 3208 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/ajax.inc129
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cache.inc169
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cache.plugin-type.inc11
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cleanstring.inc204
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/collapsible.theme.inc79
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.inc818
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.menu.inc75
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.plugin-type.inc17
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.theme.inc21
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-access-admin.inc486
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-admin.inc819
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-task-handler.inc534
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context.inc1583
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context.menu.inc40
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context.plugin-type.inc24
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context.theme.inc344
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/css.inc572
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/dependent.inc181
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/dropbutton.theme.inc142
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/dropdown.theme.inc87
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/export-ui.inc475
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/export-ui.menu.inc24
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/export-ui.plugin-type.inc20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/export.inc1250
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/fields.inc342
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/jump-menu.inc150
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/language.inc44
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/math-expr.inc388
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/menu.inc98
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/modal.inc247
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/object-cache.cron.inc16
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/object-cache.inc205
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/page-wizard.inc194
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/page-wizard.menu.inc32
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/plugins-admin.inc208
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/plugins.inc915
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/registry.inc77
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/stylizer.inc1654
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/stylizer.theme.inc28
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/utility.inc44
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/views.inc26
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/wizard.inc512
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/wizard.theme.inc25
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/js/ajax-responder.js126
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/js/auto-submit.js88
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/js/collapsible-div.js240
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/js/dependent.js231
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/js/dropbutton.js95
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/js/dropdown.js87
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/js/jump-menu.js42
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/js/modal.js535
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/js/stylizer.js220
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/css/page-manager.css372
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/about.html11
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/api-task-handler.html43
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/api-task-type.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/api-task.html38
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/custom-pages-access.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/custom-pages-arguments.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/custom-pages-menu.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/custom-pages.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/getting-started-create.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/getting-started-custom-nodes.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/getting-started-custom-vocabulary.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/getting-started-members.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/getting-started-page-list.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/getting-started.html15
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/page-task-type.html4
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/page_manager.help.ini59
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/help/variants.html2
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/images/arrow-active.pngbin0 -> 313 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/images/locked-other.pngbin0 -> 262 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/images/locked.pngbin0 -> 273 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/js/page-list.js44
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.admin.inc1866
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.info12
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.install202
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.module1280
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/cache/page_manager_context.inc70
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/task_handlers/http_response.inc285
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/blog.inc121
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/blog_user.inc152
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/contact_site.inc129
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/contact_user.inc155
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/node_edit.inc185
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/node_view.inc169
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/page.admin.inc1521
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/page.inc787
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/poll.inc121
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/search.inc249
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/term_view.inc331
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/user_edit.inc174
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/plugins/tasks/user_view.inc161
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/theme/page-manager-edit-page.tpl.php53
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/theme/page_manager.theme.inc118
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/compare_users.inc70
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/context_exists.inc51
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/entity_bundle.inc137
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/entity_field_value.inc225
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/front.inc46
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/node.inc0
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/node_access.inc89
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/node_language.inc114
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/node_status.inc33
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/node_type.inc117
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/path_visibility.inc88
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/perm.inc73
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/php.inc64
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/role.inc79
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/site_language.inc87
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/string_equal.inc94
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/string_length.inc78
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/term.inc129
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/term_has_parent.inc172
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/term_parent.inc86
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/term_vocabulary.inc87
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/access/theme.inc70
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/entity_id.inc70
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/nid.inc50
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/node_add.inc32
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/node_edit.inc51
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/rid.inc50
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/string.inc64
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/term.inc163
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/terms.inc77
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/uid.inc53
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/user_edit.inc48
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/user_name.inc47
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/arguments/vid.inc46
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/cache/export_ui.inc39
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/cache/simple.inc51
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/block.inc492
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_contrib_block.pngbin0 -> 574 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_contrib_block_empty.pngbin0 -> 450 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_contrib_menu.pngbin0 -> 552 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_contrib_page.pngbin0 -> 460 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_activeforumtopics.pngbin0 -> 603 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_authorinformation.pngbin0 -> 606 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_block.pngbin0 -> 568 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_block_empty.pngbin0 -> 450 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_block_menu.pngbin0 -> 552 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_booknavigation.pngbin0 -> 626 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_languageswitcher.pngbin0 -> 601 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_navigation.pngbin0 -> 818 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_newforumtopics.pngbin0 -> 604 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_page.pngbin0 -> 460 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_popularcontent.pngbin0 -> 604 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_primarylinks.pngbin0 -> 892 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_recentblogposts.pngbin0 -> 681 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_recentcomments.pngbin0 -> 662 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_recentpoll.pngbin0 -> 608 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_searchform.pngbin0 -> 717 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_syndicate.pngbin0 -> 803 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_userlogin.pngbin0 -> 601 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_whosnew.pngbin0 -> 732 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/block/icon_core_whosonline.pngbin0 -> 744 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/contact/contact.inc60
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/contact/icon_contact.pngbin0 -> 606 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/contact/user_contact.inc66
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/custom/custom.inc429
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/custom/icon_block_custom.pngbin0 -> 522 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc266
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field_extra.inc121
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/form/entity_form_field.inc115
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/form/form.inc62
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/form/icon_form.pngbin0 -> 460 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node/icon_node.pngbin0 -> 460 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node/node.inc252
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/icon_node.pngbin0 -> 460 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_attachments.inc44
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_author.inc71
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_body.inc40
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_book_children.inc43
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_book_nav.inc43
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_comment_form.inc96
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_comments.inc98
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_content.inc204
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_created.inc74
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_links.inc105
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_terms.inc205
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_title.inc73
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_type_desc.inc47
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_context/node_updated.inc75
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/icon_node_form.pngbin0 -> 460 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/node_form_attachments.inc51
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/node_form_author.inc52
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/node_form_book.inc50
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/node_form_buttons.inc43
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/node_form_comment.inc50
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/node_form_log.inc47
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/node_form_menu.inc50
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/node_form_path.inc51
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/node_form_publishing.inc54
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/node_form/node_form_title.inc41
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_actions.inc32
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_breadcrumb.inc32
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_feed_icons.inc32
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_help.inc33
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_logo.inc37
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_messages.inc33
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_primary_links.inc40
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_secondary_links.inc40
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_site_name.inc32
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_slogan.inc32
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_tabs.inc89
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/page/page_title.inc118
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/search/icon_search.pngbin0 -> 717 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/search/search_form.inc156
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/search/search_result.inc204
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/term_context/icon_term.pngbin0 -> 460 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/term_context/term_description.inc50
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/term_context/term_list.inc146
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/token/icon_token.pngbin0 -> 460 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/token/token.inc115
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/user_context/icon_user.pngbin0 -> 606 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/user_context/profile_fields.inc129
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/user_context/profile_fields_pane.tpl.php16
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/user_context/user_picture.inc54
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/user_context/user_profile.inc87
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/user_context/user_signature.inc43
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/vocabulary_context/icon_vocabulary.pngbin0 -> 460 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/content_types/vocabulary_context/vocabulary_terms.inc100
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/entity.inc273
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/node.inc181
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/node_add_form.inc124
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/node_edit_form.inc192
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/string.inc64
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/term.inc166
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/terms.inc98
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/token.inc61
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/user.inc174
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/user_edit_form.inc179
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/contexts/vocabulary.inc72
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/export_ui/ctools_export_ui.class.php1531
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/export_ui/ctools_export_ui.inc24
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/relationships/book_parent.inc66
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/relationships/entity_from_field.inc215
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/relationships/entity_from_schema.inc136
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/relationships/node_edit_form_from_node.inc31
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/relationships/term_from_node.inc60
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/relationships/term_parent.inc68
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/relationships/terms_from_node.inc83
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/plugins/relationships/user_from_node.inc38
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/stylizer/plugins/export_ui/stylizer.inc45
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/stylizer/plugins/export_ui/stylizer_ui.class.php272
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/stylizer/stylizer.info13
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/stylizer/stylizer.install70
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/stylizer/stylizer.module135
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/css.test69
-rwxr-xr-xkolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools.drush.sh119
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools.plugins.test100
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_export_test/ctools_export.test215
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.default_ctools_export_tests.inc31
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.info15
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.install86
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.module10
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_plugin_test.info16
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/ctools_plugin_test.module72
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/object_cache.test46
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/plugins/cached/ctoolsCachedPluginArray.class.php7
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/plugins/cached/ctoolsCachedPluginArray2.class.php7
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/plugins/cached/plugin_array.inc20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/plugins/cached/plugin_array2.inc20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/plugins/cached/plugin_array_dne.inc15
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/plugins/not_cached/ctoolsNotCachedPluginArray.class.php7
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/plugins/not_cached/ctoolsNotCachedPluginArray2.class.php7
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/plugins/not_cached/plugin_array.inc20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/plugins/not_cached/plugin_array2.inc20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/tests/plugins/not_cached/plugin_array_dne.inc15
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/icon_views_block_legacy.pngbin0 -> 599 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/icon_views_page.pngbin0 -> 716 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/icon_views_page_legacy.pngbin0 -> 587 bytes
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views.inc568
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views_attachments.inc75
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views_empty.inc53
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views_exposed.inc51
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views_feed.inc51
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views_footer.inc51
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views_header.inc51
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views_pager.inc52
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views_panes.inc621
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views_row.inc237
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/content_types/views_view.inc52
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/contexts/view.inc174
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/relationships/node_from_view.inc64
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/relationships/term_from_view.inc64
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/relationships/user_from_view.inc64
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/relationships/view_from_argument.inc101
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/views/views_content.views.inc64
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_display_ctools_context.inc272
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_display_panel_pane.inc416
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_style_ctools_context.inc53
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/views_content.admin.inc0
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/views_content.info17
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/views_content/views_content.module283
396 files changed, 49303 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/API.txt b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/API.txt
new file mode 100644
index 0000000..2df7e22
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/API.txt
@@ -0,0 +1,47 @@
+Current API Version: 2.0.5
+
+Please note that the API version is an internal number and does not match release numbers. It is entirely possible that releases will not increase the API version number, and increasing this number too often would burden contrib module maintainers who need to keep up with API changes.
+
+This file contains a log of changes to the API.
+API Version 2.0.7
+ All ctools object cache database functions can now accept session_id as an optional
+ argument to facilitate using non-session id keys.
+
+API Version 2.0.6
+ Introduce a hook to alter the implementors of a certain api via hook_[ctools_api_hook]_alter.
+
+API Version 2.0.5
+ Introduce ctools_fields_get_fields_by_type().
+ Add language.inc
+ Introduce hook_ctools_content_subtype_alter($subtype, $plugin);
+
+API Version 2.0.4
+ Introduce ctools_form_include_file()
+
+API Version 2.0.3
+ Introduce ctools_field_invoke_field() and ctools_field_invoke_field_default().
+
+API Version 2.0.2
+ Introduce ctools_export_crud_load_multiple() and 'load multiple callback' to
+ export schema.
+
+API Version 2.0.1
+ Introduce ctools_export_crud_enable(), ctools_export_crud_disable() and
+ ctools_export_crud_set_status() and requisite changes.
+ Introduce 'object factory' to export schema, allowing modules to control
+ how the exportable objects are instantiated.
+ Introduce 'hook_ctools_math_expression_functions_alter'.
+
+API Version 2.0
+ Remove the deprecated callback-based behavior of the 'defaults' property on
+ plugin types; array addition is now the only option. If you need more
+ complex logic, do it with the 'process' callback.
+ Introduce a global plugin type registration hook and remove the per-plugin
+ type magic callbacks.
+ Introduce $owner . '_' . $api . '_hook_name' allowing modules to use their own
+ API hook in place of 'hook_ctools_plugin_api'.
+ Introduce ctools_plugin_api_get_hook() to get the hook name above.
+ Introduce 'cache defaults' and 'default cache bin' keys to export.inc
+
+Versions prior to 2.0 have been removed from this document. See the D6 version
+for that information.
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/CHANGELOG.txt b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/CHANGELOG.txt
new file mode 100644
index 0000000..c5bd5e6
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/CHANGELOG.txt
@@ -0,0 +1,82 @@
+Current API VERSION: 2.0. See API.txt for more information.
+
+ctools 7.x-1.x-dev
+==================
+#1008120: "New custom content" shows empty form if custom content panes module is not enabled.
+#999302 by troky: Fix jump menu. Apparently this wasn't actually committed the last time it was committed.
+#1065976 by tekante and David_Rothstein: Reset plugin static cache during module enable to prevent stale data from harming export ui.
+#1016510 by EclipseGC: Make the taxonomy system page functional.
+
+ctools 7.x-1.x-alpha2 (05-Jan-2011)
+===================================
+
+#911396 by alex_b: Prevent notices in export UI.
+#919768 by mikey_p: Allow url options to be sent to ctools_ajax_command_url().
+#358953 by cedarm: Allow term context to return lowercase, spaces to dashes versions of terms.
+#931434 by EclipseGc: Argument plugin for node revision ID.
+#910656: CTools AJAX sample wizard demo "domesticated" checkbox value not stored.
+#922442 by EugenMayer, neclimdul and voxpelli: Make sure ctools_include can handle '' or NULL directory.
+#919956 by traviss359: Correct example in wizard advanced help.
+#942968: Fix taxonomy term access rule with tag term vocabs.
+#840344: node add argument had crufty code causing notices.
+#944462 by longhairedgit: Invalid character in regex causes rare notice.
+#938778 by dereine: Fix profile content type for D7 updates.
+Add detach event to modal close so that wysiwyg can detach the editor.
+Variant titles showing up as blank if more than one variant on a page.
+#940016: token support was not yet updated for D7.
+#940446: Skip validation on back and cancel buttons in all wizards.
+#954492: Redirect not always working in wizard.inc
+#955348: Lack of redirect on "Update" button in Page Manager causing data loss sometimes.
+#941778: Update and save button should not appear in the "Add variant" path.
+#955070 by EclipseGc: Update ctools internal page tokens to work properly on content all content.
+#956890 by EclipseGc: Update views_content to not use views dependency since that is gone.
+#954728 by EclipseGc: Update node template page function name to not collide with new hook_node_view().
+#946534 by EclipseGc: Add support for field content on all entitities.
+#952586 by EclipseGc: Fix node_author content type.
+#959206: If a context is not set when rendering content, attempt to guess the context (fixes Views panes where "From context" was added but pane was never edited.)
+#961654 by benshell: drupal_alter() only supports 4 arguments.
+#911362 by alex_b: Facilitate plugin cache resets for tests.
+#945360 by naxoc: node_tag_new() not updated to D7.
+#953804 by EclipseGc: Fix node comment rendering.
+#953542 by EclipseGc: Fix node rendering.
+#953776 by EclipseGc: Fix node link rendering.
+#954772 by EclipseGc: Fix node build mode selection in node content type.
+#954762 by EclipseGc: Fix comment forbidden theme call.
+#954894 by EclipseGc: Fix breadcrumb content type.
+#955180 by EclipseGc: Fix page primary navigation type.
+#957190 by EclipseGc: Fix page secondary navigation type.
+#957194 by EclipseGc: Remove mission content type, since D7 no longer has a site mission.
+#957348 by EclipseGc: Fix search form URL path.
+#952586 by andypost: Use format_username for displaying unlinked usernames.
+#963800 by benshell: Fix query to fetch custom block title.
+#983496 by Amitaibu: Fix term argument to use proper load function.
+#989484 by Amitaibu: Fix notice in views plugin.
+#982496: Fix token context.
+#995026: Fix export UI during enable/disable which would throw notices and not properly set/unset menu items.
+#998870 by Amitaibu: Fix notice when content has no icon by using function already designed for that.
+#983576 by Amitaibu: Node view fallback task showed white screen.
+#1004644 by pillarsdotnet: Update a missed theme() call to D7.
+#1006162 by aspilicious: .info file cleanup.
+#998312 by dereine: Support the expanded/hidden options that Views did for dependent.js
+#955030: Remove no longer supported footer message content type.
+Fix broken query in term context config.
+#992022 by pcambra: Fix node autocomplete.
+#946302 by BerdArt and arywyr: Fix PHP 5.3 reference error.
+#980528 by das-peter: Notice fix with entity settings.
+#999302 by troky: ctools_jump_menu() needed updating to new form parameters.
+#964174: stylizer plugin theme delegation was in the wrong place, causing errors.
+#991658 by burlap: Fully load the "user" context for the logged in user because not all fields are in $user.
+#1014866 by das-peter: Smarter title panes, notice fix on access plugin descriptions.
+#1015662 by troky: plugin .info files were not using correct filepaths.
+#941780 by EclipseGc: Restore the "No blocks" functionality.
+#951048 by EclipseGc: Tighter entity integration so that new entities are automatic contexts and relationships.
+#941800 by me and aspilicious: Use Drupal 7 #machine_name automation on page manager pages and all export_ui defaults.
+Disabled exportables and pages not properly greyed out.
+#969208 by me and benshell: Get user_view and user profile working.
+#941796: Recategorize blocks
+
+ctools 7.x-1.x-alpha1
+=====================
+
+Changelog reset for 7.x
+Basic conversion done during sprint.
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/LICENSE.txt b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/LICENSE.txt
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/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.
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/UPGRADE.txt b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/UPGRADE.txt
new file mode 100644
index 0000000..844ecce
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/UPGRADE.txt
@@ -0,0 +1,63 @@
+Upgrading from ctools-6.x-1.x to ctools-7.x-2.x:
+
+ - Remove ctools_ajax_associate_url_to_element as it shouldn't be necessary
+ with the new AJAX api's in Drupal core.
+
+ - All calls to the ctools_ajax_command_prepend() should be replace with
+ the core function ajax_command_prepend();
+ This is also the case for append, insert, after, before, replace, html,
+ and remove commands.
+ Each of these commands have been incorporated into the
+ Drupal.ajax.prototype.commands.insert
+ function with a corresponding parameter specifying which method to use.
+
+ - All calls to ctools_ajax_render() should be replaced with calls to core
+ ajax_render(). Note that ctools_ajax_render() printed the json object and
+ exited, ajax_render() gives you this responsibility.
+
+ ctools_ajax_render()
+
+ becomes
+
+ print ajax_render();
+ exit;
+
+ - All calls to ctools_static*() should be replaced with corresponding calls
+ to drupal_static*().
+
+ - All calls to ctools_css_add_css should be replaced with calls to
+ drupal_add_css(). Note that the arguments to drupal_add_css() have changed.
+
+ - All wizard form builder functions must now return a form array().
+
+ - ctools_build_form is very close to being removed. In anticipation of this,
+ all $form_state['wrapper callback']s must now be
+ $form_state['wrapper_callback']. In addition to this $form_state['args']
+ must now be $form_state['build_info']['args'].
+
+ NOTE: Previously checking to see if the return from ctools_build_form()
+ is empty would be enough to see if the form was submitted. This is no
+ longer true. Please check for $form_state['executed']. If using a wizard
+ check for $form_state['complete'].
+
+ - Plugin types now must be explicitly registered via a registration hook,
+ hook_ctools_plugin_type(); info once provided in magically-named functions
+ (e.g., ctools_ctools_plugin_content_types() was the old function to
+ provide plugin type info for ctools' content_type plugins) now must be
+ provided in that global hook. See http://drupal.org/node/910538 for more
+ details.
+
+ - Plugins that use 'theme arguments' now use 'theme variables' instead.
+
+ - Context, argument and relationship plugins now use 'add form' and/or
+ 'edit form' rather than 'settings form'. These plugins now support
+ form wizards just like content plugins. These forms now all take
+ $form, &$form_state as arguments, and the configuration for the plugin
+ can be found in $form_state['conf'].
+
+ For all these forms, the submit handler MUST put appropriate data in
+ $form_state['conf']. Data will no longer be stored automatically.
+
+ For all of these forms, the separate settings #trees in the form are now
+ gone, so form ids may be adjusted. Also, these are now all real forms
+ using CTools form wizard instead of fake subforms as previously. \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.css
new file mode 100644
index 0000000..45a172d
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.css
@@ -0,0 +1,18 @@
+.export-container {
+ width: 48%;
+ float: left;
+ padding: 5px 1% 0;
+}
+.export-container table {
+ width: 100%;
+}
+.export-container table input,
+.export-container table th,
+.export-container table td {
+ padding: 0 0 .2em .5em;
+ margin: 0;
+ vertical-align: middle;
+}
+.export-container .select-all {
+ width: 1.5em;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.info b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.info
new file mode 100644
index 0000000..790561c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.info
@@ -0,0 +1,12 @@
+name = Bulk Export
+description = Performs bulk exporting of data objects known about by Chaos tools.
+core = 7.x
+dependencies[] = ctools
+package = Chaos tool suite
+
+; Information added by drupal.org packaging script on 2012-08-08
+version = "7.x-1.1"
+core = "7.x"
+project = "ctools"
+datestamp = "1344463011"
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.js b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.js
new file mode 100644
index 0000000..a4fb3f2
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.js
@@ -0,0 +1,29 @@
+
+/**
+ * @file
+ * CTools Bulk Export javascript functions.
+ */
+
+(function ($) {
+
+Drupal.behaviors.CToolsBulkExport = {
+ attach: function (context) {
+
+ $('#bulk-export-export-form .vertical-tabs-pane', context).drupalSetSummary(function (context) {
+
+ // Check if any individual checkbox is checked.
+ if ($('.bulk-selection input:checked', context).length > 0) {
+ return Drupal.t('Exportables selected');
+ }
+
+ return '';
+ });
+
+ // Special bind click on the select-all checkbox.
+ $('.select-all').bind('click', function(context) {
+ $(this, '.vertical-tabs-pane').drupalSetSummary(context);
+ });
+ }
+};
+
+})(jQuery);
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.module b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.module
new file mode 100644
index 0000000..afb15b9
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/bulk_export/bulk_export.module
@@ -0,0 +1,279 @@
+<?php
+
+/**
+ * @file
+ * Perform bulk exports.
+ */
+
+/**
+ * Implements hook_permission().
+ */
+function bulk_export_permission() {
+ return array(
+ 'use bulk exporter' => array(
+ 'title' => t('Access Bulk Exporter'),
+ 'description' => t('Export various system objects into code.'),
+ ),
+ );
+}
+
+/**
+ * Implements hook_menu().
+ */
+function bulk_export_menu() {
+ $items['admin/structure/bulk-export'] = array(
+ 'title' => 'Bulk Exporter',
+ 'description' => 'Bulk-export multiple CTools-handled data objects to code.',
+ 'access arguments' => array('use bulk exporter'),
+ 'page callback' => 'bulk_export_export',
+ );
+ $items['admin/structure/bulk-export/results'] = array(
+ 'access arguments' => array('use bulk exporter'),
+ 'page callback' => 'bulk_export_export',
+ 'type' => MENU_CALLBACK,
+ );
+ return $items;
+}
+
+/**
+ * FAPI gateway to the bulk exporter.
+ *
+ * @param $cli
+ * Whether this function is called from command line.
+ * @param $options
+ * A collection of options, only passed in by drush_ctools_export().
+ */
+function bulk_export_export($cli = FALSE, $options = array()) {
+ ctools_include('export');
+ $form = array();
+ $schemas = ctools_export_get_schemas(TRUE);
+ $exportables = $export_tables = array();
+
+ foreach ($schemas as $table => $schema) {
+ if (!empty($schema['export']['list callback']) && function_exists($schema['export']['list callback'])) {
+ $exportables[$table] = $schema['export']['list callback']();
+ }
+ else {
+ $exportables[$table] = ctools_export_default_list($table, $schema);
+ }
+ natcasesort($exportables[$table]);
+ $export_tables[$table] = $schema['module'];
+ }
+ if ($exportables) {
+ $form_state = array(
+ 're_render' => FALSE,
+ 'no_redirect' => TRUE,
+ 'exportables' => $exportables,
+ 'export_tables' => $export_tables,
+ 'name' => '',
+ 'code' => '',
+ 'module' => '',
+ );
+
+ // If called from drush_ctools_export, get the module name and
+ // select all exportables and call the submit function directly.
+ if ($cli) {
+ $module_name = $options['name'];
+ $form_state['values']['name'] = $module_name;
+ if (isset($options['selections'])) {
+ $exportables = $options['selections'];
+ }
+ $form_state['values']['tables'] = array();
+ foreach ($exportables as $table => $names) {
+ if (!empty($names)) {
+ $form_state['values']['tables'][] = $table;
+ $form_state['values'][$table] = array();
+ foreach ($names as $name => $title) {
+ $form_state['values'][$table][$name] = $name;
+ }
+ }
+ }
+ $output = bulk_export_export_form_submit($form, $form_state);
+ }
+ else {
+ $output = drupal_build_form('bulk_export_export_form', $form_state);
+ $module_name = $form_state['module'];
+ }
+
+ if (!empty($form_state['submitted']) || $cli) {
+ drupal_set_title(t('Bulk export results'));
+ $output = '';
+ $module_code = '';
+ $api_code = array();
+ $dependencies = $file_data = array();
+ foreach ($form_state['code'] as $module => $api_info) {
+ if ($module == 'general') {
+ $module_code .= $api_info;
+ }
+ else {
+ foreach ($api_info as $api => $info) {
+ $api_hook = ctools_plugin_api_get_hook($module, $api);
+ if (empty($api_code[$api_hook])) {
+ $api_code[$api_hook] = '';
+ }
+ $api_code[$api_hook] .= " if (\$module == '$module' && \$api == '$api') {\n";
+ $api_code[$api_hook] .= " return array('version' => $info[version]);\n";
+ $api_code[$api_hook] .= " }\n";
+ $dependencies[$module] = TRUE;
+
+ $file = $module_name . '.' . $api . '.inc';
+ $code = "<?php\n\n";
+ $code .= "/**\n";
+ $code .= " * @file\n";
+ $code .= " * Bulk export of $api objects generated by Bulk export module.\n";
+ $code .= " */\n\n";
+ $code .= $info['code'];
+ if ($cli) {
+ $file_data[$file] = $code;
+ }
+ else {
+ $export_form = drupal_get_form('ctools_export_form', $code, t('Place this in @file', array('@file' => $file)));
+ $output .= drupal_render($export_form);
+ }
+ }
+ }
+ }
+
+ // Add hook_ctools_plugin_api at the top of the module code, if there is any.
+ if ($api_code) {
+ foreach ($api_code as $api_hook => $text) {
+ $api = "\n/**\n";
+ $api .= " * Implements hook_$api_hook().\n";
+ $api .= " */\n";
+ $api .= "function {$module_name}_$api_hook(\$module, \$api) {\n";
+ $api .= $text;
+ $api .= "}\n";
+ $module_code = $api . $module_code;
+ }
+ }
+
+ if ($module_code) {
+ $module = "<?php\n\n";
+ $module .= "/**\n";
+ $module .= " * @file\n";
+ $module .= " * Bulk export of objects generated by Bulk export module.\n";
+ $module .= " */\n";
+ $module .= $module_code;
+ if ($cli) {
+ $file_data[$module_name . '.module'] = $module;
+ }
+ else {
+ $export_form = drupal_get_form('ctools_export_form', $module, t('Place this in @file', array('@file' => $form_state['module'] . '.module')));
+ $output = drupal_render($export_form) . $output;
+ }
+ }
+
+ $info = strtr("name = @module export module\n", array('@module' => $form_state['module']));
+ $info .= strtr("description = Export objects from CTools\n", array('@module' => $form_state['values']['name']));
+ foreach ($dependencies as $module => $junk) {
+ $info .= "dependencies[] = $module\n";
+ }
+ $info .= "package = Chaos tool suite\n";
+ $info .= "core = 7.x\n";
+ if ($cli) {
+ $file_data[$module_name . '.info'] = $info;
+ }
+ else {
+ $export_form = drupal_get_form('ctools_export_form', $info, t('Place this in @file', array('@file' => $form_state['module'] . '.info')));
+ $output = drupal_render($export_form) . $output;
+ }
+ }
+
+ if ($cli) {
+ return $file_data;
+ }
+ else {
+ return $output;
+ }
+ }
+ else {
+ return t('There are no objects to be exported at this time.');
+ }
+}
+
+/**
+ * FAPI definition for the bulk exporter form.
+ *
+ */
+function bulk_export_export_form($form, &$form_state) {
+
+ $files = system_rebuild_module_data();
+
+ $form['additional_settings'] = array(
+ '#type' => 'vertical_tabs',
+ );
+
+ $options = $tables = array();
+ foreach ($form_state['exportables'] as $table => $list) {
+ if (empty($list)) {
+ continue;
+ }
+
+ foreach ($list as $id => $title) {
+ $options[$table][$id] = array($title);
+ $options[$table][$id]['#attributes'] = array('class' => array('bulk-selection'));
+ }
+
+ $module = $form_state['export_tables'][$table];
+ $header = array($table);
+ $module_name = $files[$module]->info['name'];
+ $tables[] = $table;
+
+ if (!isset($form[$module_name])) {
+ $form[$files[$module]->info['name']] = array(
+ '#type' => 'fieldset',
+ '#group' => 'additional_settings',
+ '#title' => $module_name,
+ );
+ }
+
+ $form[$module_name]['tables'][$table] = array(
+ '#prefix' => '<div class="export-container">',
+ '#suffix' => '</div>',
+ '#type' => 'tableselect',
+ '#header' => $header,
+ '#options' => $options[$table],
+ );
+ }
+
+ $form['tables'] = array(
+ '#type' => 'value',
+ '#value' => $tables,
+ );
+
+ $form['name'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Module name'),
+ '#description' => t('Enter the module name to export code to.'),
+ );
+
+ $form['submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Export'),
+ );
+
+ $form['#action'] = url('admin/structure/bulk-export/results');
+ $form['#attached']['css'][] = drupal_get_path('module', 'bulk_export') . '/bulk_export.css';
+ $form['#attached']['js'][] = drupal_get_path('module', 'bulk_export') . '/bulk_export.js';
+ return $form;
+}
+
+/**
+ * Process the bulk export submit form and make the results available.
+ */
+function bulk_export_export_form_submit($form, &$form_state) {
+ $code = array();
+ $name = empty($form_state['values']['name']) ? 'foo' : $form_state['values']['name'];
+ $tables = $form_state['values']['tables'];
+
+ foreach ($tables as $table) {
+ $names = array_keys(array_filter($form_state['values'][$table]));
+ if ($names) {
+ natcasesort($names);
+ ctools_export_to_hook_code($code, $table, $names, $name);
+ }
+ }
+
+ $form_state['code'] = $code;
+ $form_state['module'] = $name;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/button.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/button.css
new file mode 100644
index 0000000..91a6044
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/button.css
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+.ctools-button-processed {
+ border-style: solid;
+ border-width: 1px;
+ display: inline-block;
+ line-height: 1;
+}
+
+.ctools-button-processed:hover {
+ cursor: pointer;
+}
+
+.ctools-button-processed .ctools-content {
+ padding-bottom: 2px;
+ padding-top: 2px;
+}
+
+.ctools-no-js .ctools-content ul,
+.ctools-button-processed .ctools-content ul {
+ list-style-image: none;
+ list-style-type: none;
+}
+
+.ctools-button-processed li {
+ line-height: 1.3333;
+}
+
+.ctools-button li a {
+ padding-left: 12px;
+ padding-right: 12px;
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/collapsible-div.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/collapsible-div.css
new file mode 100644
index 0000000..ff64813
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/collapsible-div.css
@@ -0,0 +1,26 @@
+
+.ctools-collapsible-container .ctools-toggle {
+ float: left;
+ width: 21px;
+ height: 21px;
+ cursor: pointer;
+ background-position: 7px 7px;
+ background-repeat: no-repeat;
+ background-image: url(../images/collapsible-expanded.png);
+}
+
+.ctools-collapsible-container .ctools-collapsible-handle {
+ display: none;
+}
+
+html.js .ctools-collapsible-container .ctools-collapsible-handle {
+ display: block;
+}
+
+.ctools-collapsible-container .ctools-collapsible-handle {
+ cursor: pointer;
+}
+
+.ctools-collapsible-container .ctools-toggle-collapsed {
+ background-image: url(../images/collapsible-collapsed.png);
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/context.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/context.css
new file mode 100644
index 0000000..5093104
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/context.css
@@ -0,0 +1,10 @@
+.ctools-context-holder .ctools-context-title {
+ float: left;
+ width: 49%;
+ font-style: italic;
+}
+
+.ctools-context-holder .ctools-context-content {
+ float: right;
+ width: 49%;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/ctools.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/ctools.css
new file mode 100644
index 0000000..7372988
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/ctools.css
@@ -0,0 +1,25 @@
+.ctools-locked {
+ color: red;
+ border: 1px solid red;
+ padding: 1em;
+}
+
+.ctools-owns-lock {
+ background: #FFFFDD none repeat scroll 0 0;
+ border: 1px solid #F0C020;
+ padding: 1em;
+}
+
+a.ctools-ajaxing,
+input.ctools-ajaxing,
+button.ctools-ajaxing,
+select.ctools-ajaxing {
+ padding-right: 18px !important;
+ background: url(../images/status-active.gif) right center no-repeat;
+}
+
+div.ctools-ajaxing {
+ float: left;
+ width: 18px;
+ background: url(../images/status-active.gif) center center no-repeat;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/dropbutton.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/dropbutton.css
new file mode 100644
index 0000000..7825111
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/dropbutton.css
@@ -0,0 +1,67 @@
+/* $Id$ */
+
+.ctools-dropbutton-processed {
+ padding-right: 18px;
+ position: relative;
+ background-color: inherit;
+}
+
+.ctools-dropbutton-processed.open {
+ z-index: 200;
+}
+
+.ctools-dropbutton-processed .ctools-content li,
+.ctools-dropbutton-processed .ctools-content a {
+ display: block;
+}
+
+.ctools-dropbutton-processed .ctools-link {
+ bottom: 0;
+ display: block;
+ height: auto;
+ position: absolute;
+ right: 0;
+ text-indent: -9999px; /* LTR */
+ top: 0;
+ width: 17px;
+}
+
+.ctools-dropbutton-processed .ctools-link a {
+ overflow: hidden;
+}
+
+.ctools-dropbutton-processed .ctools-content ul {
+ margin: 0;
+ overflow: hidden;
+}
+
+.ctools-dropbutton-processed.open li + li {
+ padding-top: 4px;
+}
+
+/**
+ * This creates the dropbutton arrow and inherits the link color
+ */
+.ctools-twisty {
+ border-bottom-color: transparent;
+ border-left-color: transparent;
+ border-right-color: transparent;
+ border-style: solid;
+ border-width: 4px 4px 0;
+ line-height: 0;
+ right: 6px;
+ position: absolute;
+ top: 0.75em;
+}
+
+.ctools-dropbutton-processed.open .ctools-twisty {
+ border-bottom: 4px solid;
+ border-left-color: transparent;
+ border-right-color: transparent;
+ border-top-color: transparent;
+ top: 0.5em;
+}
+
+.ctools-no-js .ctools-twisty {
+ display: none;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/dropdown.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/dropdown.css
new file mode 100644
index 0000000..bb50f3f
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/dropdown.css
@@ -0,0 +1,73 @@
+html.js div.ctools-dropdown div.ctools-dropdown-container {
+ z-index: 1001;
+ display: none;
+ text-align: left;
+ position: absolute;
+}
+
+html.js div.ctools-dropdown div.ctools-dropdown-container ul li a {
+ display: block;
+}
+
+html.js div.ctools-dropdown div.ctools-dropdown-container ul {
+ list-style-type: none;
+ margin: 0;
+ padding: 0;
+}
+
+html.js div.ctools-dropdown div.ctools-dropdown-container ul li {
+ display: block;
+ /* prevent excess right margin in IE */
+ margin-right: 0;
+ margin-left: 0;
+ padding-right: 0;
+ padding-left: 0;
+ background-image: none; /* prevent list backgrounds from mucking things up */
+}
+
+.ctools-dropdown-no-js .ctools-dropdown-link,
+.ctools-dropdown-no-js span.text {
+ display: none;
+}
+
+/* Everything from here down is purely visual style and can be overridden. */
+
+html.js div.ctools-dropdown a.ctools-dropdown-text-link {
+ background: url(../images/collapsible-expanded.png) 3px 5px no-repeat;
+ padding-left: 12px;
+}
+
+html.js div.ctools-dropdown div.ctools-dropdown-container {
+ width: 175px;
+ background: #fff;
+ border: 1px solid black;
+ margin: 4px 1px 0 0;
+ padding: 0;
+ color: #494949;
+}
+
+html.js div.ctools-dropdown div.ctools-dropdown-container ul li li a {
+ padding-left: 25px;
+ width: 150px;
+ color: #027AC6;
+}
+
+html.js div.ctools-dropdown div.ctools-dropdown-container ul li a {
+ text-decoration: none;
+ padding-left: 5px;
+ width: 170px;
+ color: #027AC6;
+}
+
+html.js div.ctools-dropdown div.ctools-dropdown-container ul li span {
+ display: block;
+}
+
+html.js div.ctools-dropdown div.ctools-dropdown-container ul li span.text {
+ font-style: italic;
+ padding-left: 5px;
+}
+
+html.js .ctools-dropdown-hover {
+ background-color: #ECECEC;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/export-ui-list.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/export-ui-list.css
new file mode 100644
index 0000000..170d128
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/export-ui-list.css
@@ -0,0 +1,45 @@
+body form#ctools-export-ui-list-form {
+ margin: 0 0 20px 0;
+}
+
+#ctools-export-ui-list-form .form-item {
+ padding-right: 1em; /* LTR */
+ float: left; /* LTR */
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+#ctools-export-ui-list-items {
+ width: 100%;
+}
+
+#edit-order-wrapper {
+ clear: left; /* LTR */
+}
+
+#ctools-export-ui-list-form .form-submit {
+ margin-top: 1.65em;
+ float: left; /* LTR */
+}
+
+tr.ctools-export-ui-disabled td {
+ color: #999;
+}
+
+th.ctools-export-ui-operations,
+td.ctools-export-ui-operations {
+ text-align: right; /* LTR */
+ vertical-align: top;
+}
+
+/* Force the background color to inherit so that the dropbuttons do not need
+ a specific background color. */
+td.ctools-export-ui-operations {
+ background-color: inherit;
+}
+
+td.ctools-export-ui-operations .ctools-dropbutton {
+ text-align: left; /* LTR */
+ position: absolute;
+ right: 10px;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/modal.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/modal.css
new file mode 100644
index 0000000..d9f44e2
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/modal.css
@@ -0,0 +1,126 @@
+div.ctools-modal-content {
+ background: #fff;
+ color: #000;
+ padding: 0;
+ margin: 2px;
+ border: 1px solid #000;
+ width: 600px;
+ text-align: left;
+}
+
+div.ctools-modal-content .modal-title {
+ font-size: 120%;
+ font-weight: bold;
+ color: white;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+div.ctools-modal-content .modal-header {
+ background-color: #2385c2;
+ padding: 0 .25em 0 1em;
+}
+
+div.ctools-modal-content .modal-header a {
+ color: white;
+}
+
+div.ctools-modal-content .modal-content {
+ padding: 1em 1em 0 1em;
+ overflow: auto;
+ position: relative; /* Keeps IE7 from flowing outside the modal. */
+}
+
+div.ctools-modal-content .modal-form {
+}
+
+div.ctools-modal-content a.close {
+ color: white;
+ float: right;
+}
+
+div.ctools-modal-content a.close:hover {
+ text-decoration: none;
+}
+
+div.ctools-modal-content a.close img {
+ position: relative;
+ top: 1px;
+}
+
+div.ctools-modal-content .modal-content .modal-throbber-wrapper {
+ text-align: center;
+}
+
+div.ctools-modal-content .modal-content .modal-throbber-wrapper img {
+ margin-top: 160px;
+}
+
+/** modal forms CSS **/
+div.ctools-modal-content .form-item label {
+ width: 15em;
+ float: left;
+}
+
+div.ctools-modal-content .form-item label.option {
+ width: auto;
+ float: none;
+}
+
+div.ctools-modal-content .form-item .description {
+ clear: left;
+}
+
+div.ctools-modal-content .form-item .description .tips {
+ margin-left: 2em;
+}
+
+div.ctools-modal-content .no-float .form-item * {
+ float: none;
+}
+
+div.ctools-modal-content .modal-form .no-float label {
+ width: auto;
+}
+
+div.ctools-modal-content fieldset,
+div.ctools-modal-content .form-radios,
+div.ctools-modal-content .form-checkboxes {
+ clear: left;
+}
+
+div.ctools-modal-content .resizable-textarea {
+ width: auto;
+ margin-left: 15em;
+ margin-right: 5em;
+}
+
+div.ctools-modal-content .container-inline .form-item {
+ margin-right: 2em;
+}
+
+#views-exposed-pane-wrapper .form-item {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+div.ctools-modal-content label.hidden-options {
+ background: transparent url(../images/arrow-active.png) no-repeat right;
+ height: 12px;
+ padding-right: 12px;
+}
+
+div.ctools-modal-content label.expanded-options {
+ background: transparent url(../images/expanded-options.png) no-repeat right;
+ height: 12px;
+ padding-right: 16px;
+}
+
+div.ctools-modal-content .option-text-aligner label.expanded-options,
+div.ctools-modal-content .option-text-aligner label.hidden-options {
+ background: none;
+}
+
+div.ctools-modal-content .dependent-options {
+ padding-left: 30px;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/ruleset.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/ruleset.css
new file mode 100644
index 0000000..891455f
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/ruleset.css
@@ -0,0 +1,11 @@
+.ctools-right-container {
+ float: right;
+ padding: 0 0 0 .5em;
+ margin: 0;
+ width: 48.5%;
+}
+
+.ctools-left-container {
+ padding-right: .5em;
+ width: 48.5%;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/stylizer.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/stylizer.css
new file mode 100644
index 0000000..a16ec78
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/stylizer.css
@@ -0,0 +1,129 @@
+
+/* Farbtastic placement */
+.color-form {
+ max-width: 50em;
+ position: relative;
+ min-height: 195px;
+}
+#placeholder {
+/*
+ position: absolute;
+ top: 0;
+ right: 0;
+*/
+ margin: 0 auto;
+ width: 195px;
+}
+
+/* Palette */
+.color-form .form-item {
+ height: 2em;
+ line-height: 2em;
+ padding-left: 1em; /* LTR */
+ margin: 0.5em 0;
+}
+
+.color-form .form-item input {
+ margin-top: .2em;
+}
+
+.color-form label {
+ float: left; /* LTR */
+ clear: left; /* LTR */
+ width: 14em;
+}
+.color-form .form-text, .color-form .form-select {
+ float: left; /* LTR */
+}
+.color-form .form-text {
+ text-align: center;
+ margin-right: 5px; /* LTR */
+ cursor: pointer;
+}
+
+#palette .hook {
+ float: left; /* LTR */
+ margin-top: 3px;
+ width: 16px;
+ height: 16px;
+}
+#palette .up {
+ background-position: 100% -27px; /* LTR */
+}
+#palette .both {
+ background-position: 100% -54px; /* LTR */
+}
+
+
+#palette .form-item {
+ width: 24em;
+}
+#palette .item-selected {
+ background: #eee;
+}
+
+/* Preview */
+#preview {
+ width: 45%;
+ float: right;
+ margin: 0;
+}
+
+#ctools_stylizer_color_scheme_form {
+ float: left;
+ width: 45%;
+ margin: 0;
+}
+
+/* general style for the layout-icon */
+.ctools-style-icon .caption {
+ width: 100px;
+ margin-bottom: 1em;
+ line-height: 1em;
+ text-align: center;
+ cursor: default;
+}
+
+.ctools-style-icons .form-item {
+ width: 100px;
+ float: left;
+ margin: 0 3px !important;
+}
+
+.ctools-style-icons .form-item .ctools-style-icon {
+ float: none;
+ height: 150px;
+ width: 100px;
+}
+
+.ctools-style-icons .form-item label.option {
+ width: 100px;
+ display: block;
+ text-align: center;
+}
+
+.ctools-style-icons .form-item label.option input {
+ margin: 0 auto;
+}
+
+.ctools-style-icons .ctools-style-category {
+ height: 190px;
+}
+
+.ctools-style-icons .ctools-style-category label {
+ font-weight: bold;
+ width: 100%;
+ float: left;
+}
+
+/**
+ * Stylizer font editor widget
+ */
+.ctools-stylizer-spacing-form .form-item {
+ float: left;
+ margin: .25em;
+}
+
+#edit-font-font {
+ width: 9em;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/wizard.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/wizard.css
new file mode 100644
index 0000000..d42a2db
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/css/wizard.css
@@ -0,0 +1,8 @@
+
+.wizard-trail {
+ font-size: 120%;
+}
+
+.wizard-trail-current {
+ font-weight: bold;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.api.php b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.api.php
new file mode 100644
index 0000000..1aef57c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.api.php
@@ -0,0 +1,207 @@
+<?php
+
+/**
+ * @file
+ * Hooks provided by the Chaos Tool Suite.
+ *
+ * This file is divided into static hooks (hooks with string literal names) and
+ * dynamic hooks (hooks with pattern-derived string names).
+ */
+
+/**
+ * @addtogroup hooks
+ * @{
+ */
+
+/**
+ * Inform CTools about plugin types.
+ *
+ * @return array
+ * An array of plugin types, keyed by the type name.
+ * See the advanced help topic 'plugins-creating' for details of the array
+ * properties.
+ */
+function hook_ctools_plugin_type() {
+ $plugins['my_type'] = array(
+ 'load themes' => TRUE,
+ );
+
+ return $plugins;
+}
+
+/**
+ * This hook is used to inform the CTools plugin system about the location of a
+ * directory that should be searched for files containing plugins of a
+ * particular type. CTools invokes this same hook for all plugins, using the
+ * two passed parameters to indicate the specific type of plugin for which it
+ * is searching.
+ *
+ * The $plugin_type parameter is self-explanatory - it is the string name of the
+ * plugin type (e.g., Panels' 'layouts' or 'styles'). The $owner parameter is
+ * necessary because CTools internally namespaces plugins by the module that
+ * owns them. This is an extension of Drupal best practices on avoiding global
+ * namespace pollution by prepending your module name to all its functions.
+ * Consequently, it is possible for two different modules to create a plugin
+ * type with exactly the same name and have them operate in harmony. In fact,
+ * this system renders it impossible for modules to encroach on other modules'
+ * plugin namespaces.
+ *
+ * Given this namespacing, it is important that implementations of this hook
+ * check BOTH the $owner and $plugin_type parameters before returning a path.
+ * If your module does not implement plugins for the requested module/plugin
+ * combination, it is safe to return nothing at all (or NULL). As a convenience,
+ * it is also safe to return a path that does not exist for plugins your module
+ * does not implement - see form 2 for a use case.
+ *
+ * Note that modules implementing a plugin also must implement this hook to
+ * instruct CTools as to the location of the plugins. See form 3 for a use case.
+ *
+ * The conventional structure to return is "plugins/$plugin_type" - that is, a
+ * 'plugins' subdirectory in your main module directory, with individual
+ * directories contained therein named for the plugin type they contain.
+ *
+ * @param string $owner
+ * The system name of the module owning the plugin type for which a base
+ * directory location is being requested.
+ * @param string $plugin_type
+ * The name of the plugin type for which a base directory is being requested.
+ * @return string
+ * The path where CTools' plugin system should search for plugin files,
+ * relative to your module's root. Omit leading and trailing slashes.
+ */
+function hook_ctools_plugin_directory($owner, $plugin_type) {
+ // Form 1 - for a module implementing only the 'content_types' plugin owned
+ // by CTools, this would cause the plugin system to search the
+ // <moduleroot>/plugins/content_types directory for .inc plugin files.
+ if ($owner == 'ctools' && $plugin_type == 'content_types') {
+ return 'plugins/content_types';
+ }
+
+ // Form 2 - if your module implements only Panels plugins, and has 'layouts'
+ // and 'styles' plugins but no 'cache' or 'display_renderers', it is OK to be
+ // lazy and return a directory for a plugin you don't actually implement (so
+ // long as that directory doesn't exist). This lets you avoid ugly in_array()
+ // logic in your conditional, and also makes it easy to add plugins of those
+ // types later without having to change this hook implementation.
+ if ($owner == 'panels') {
+ return "plugins/$plugin_type";
+ }
+
+ // Form 3 - CTools makes no assumptions about where your plugins are located,
+ // so you still have to implement this hook even for plugins created by your
+ // own module.
+ if ($owner == 'mymodule') {
+ // Yes, this is exactly like Form 2 - just a different reasoning for it.
+ return "plugins/$plugin_type";
+ }
+ // Finally, if nothing matches, it's safe to return nothing at all (or NULL).
+}
+
+/**
+ * Alter a plugin before it has been processed.
+ *
+ * This hook is useful for altering flags or other information that will be
+ * used or possibly overriden by the process hook if defined.
+ *
+ * @param $plugin
+ * An associative array defining a plugin.
+ * @param $info
+ * An associative array of plugin type info.
+ */
+function hook_ctools_plugin_pre_alter(&$plugin, &$info) {
+ // Override a function defined by the plugin.
+ if ($info['type'] == 'my_type') {
+ $plugin['my_flag'] = 'new_value';
+ }
+}
+
+/**
+ * Alter a plugin after it has been processed.
+ *
+ * This hook is useful for overriding the final values for a plugin after it
+ * has been processed.
+ *
+ * @param $plugin
+ * An associative array defining a plugin.
+ * @param $info
+ * An associative array of plugin type info.
+ */
+function hook_ctools_plugin_post_alter(&$plugin, &$info) {
+ // Override a function defined by the plugin.
+ if ($info['type'] == 'my_type') {
+ $plugin['my_function'] = 'new_function';
+ }
+}
+
+/**
+ * Alter the list of modules/themes which implement a certain api.
+ *
+ * The hook named here is just an example, as the real existing hooks are named
+ * for example 'hook_views_api_alter'.
+ *
+ * @param array $list
+ * An array of informations about the implementors of a certain api.
+ * The key of this array are the module names/theme names.
+ */
+function hook_ctools_api_hook_alter(&$list) {
+ // Alter the path of the node implementation.
+ $list['node']['path'] = drupal_get_path('module', 'node');
+}
+
+/**
+ * Alter the available functions to be used in ctools math expression api.
+ *
+ * One usecase would be to create your own function in your module and
+ * allow to use it in the math expression api.
+ *
+ * @param $functions
+ * An array which has the functions as value.
+ */
+function hook_ctools_math_expression_functions_alter(&$functions) {
+ // Allow to convert from degrees to radiant.
+ $functions[] = 'deg2rad';
+}
+
+/**
+ * Alter everything.
+ *
+ * @param $info
+ * An associative array containing the following keys:
+ * - content: The rendered content.
+ * - title: The content's title.
+ * - no_blocks: A boolean to decide if blocks should be displayed.
+ * @param $page
+ * If TRUE then this renderer owns the page and can use theme('page')
+ * for no blocks; if false, output is returned regardless of any no
+ * blocks settings.
+ * @param $context
+ * An associative array containing the following keys:
+ * - args: The raw arguments behind the contexts.
+ * - contexts: The context objects in use.
+ * - task: The task object in use.
+ * - subtask: The subtask object in use.
+ * - handler: The handler object in use.
+ */
+function hook_ctools_render_alter(&$info, &$page, &$context) {
+ if ($context['handler']->name == 'my_handler') {
+ ctools_add_css('my_module.theme', 'my_module');
+ }
+}
+
+/**
+ * Alter a content plugin subtype.
+ *
+ * While content types can be altered via hook_ctools_plugin_pre_alter() or
+ * hook_ctools_plugin_post_alter(), the subtypes that content types rely on
+ * are special and require their own hook.
+ *
+ * This hook can be used to add things like 'render last' or change icons
+ * or categories or to rename content on specific sites.
+ */
+function hook_ctools_content_subtype_alter($subtype, $plugin) {
+ $subtype['render last'] = TRUE;
+}
+
+/**
+ * @} End of "addtogroup hooks".
+ */
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.info b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.info
new file mode 100644
index 0000000..2ccf719
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.info
@@ -0,0 +1,14 @@
+name = Chaos tools
+description = A library of helpful tools by Merlin of Chaos.
+core = 7.x
+package = Chaos tool suite
+files[] = includes/context.inc
+files[] = includes/math-expr.inc
+files[] = includes/stylizer.inc
+
+; Information added by drupal.org packaging script on 2012-08-08
+version = "7.x-1.1"
+core = "7.x"
+project = "ctools"
+datestamp = "1344463011"
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.install b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.install
new file mode 100644
index 0000000..4a6f55c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.install
@@ -0,0 +1,197 @@
+<?php
+
+/**
+ * @file
+ * Contains install and update functions for ctools.
+ */
+
+/**
+ * Use requirements to ensure that the CTools CSS cache directory can be
+ * created and that the PHP version requirement is met.
+ */
+function ctools_requirements($phase) {
+ $requirements = array();
+ if ($phase == 'runtime') {
+ $requirements['ctools_css_cache'] = array(
+ 'title' => t('CTools CSS Cache'),
+ 'severity' => REQUIREMENT_OK,
+ 'value' => t('Exists'),
+ );
+
+ $path = 'public://ctools/css';
+ if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY)) {
+ $requirements['ctools_css_cache']['description'] = t('The CTools CSS cache directory, %path could not be created due to a misconfigured files directory. Please ensure that the files directory is correctly configured and that the webserver has permission to create directories.', array('%path' => file_uri_target($path)));
+ $requirements['ctools_css_cache']['severity'] = REQUIREMENT_ERROR;
+ $requirements['ctools_css_cache']['value'] = t('Unable to create');
+ }
+
+ if (!function_exists('error_get_last')) {
+ $requirements['ctools_php_52']['title'] = t('CTools PHP requirements');
+ $requirements['ctools_php_52']['description'] = t('CTools requires certain features only available in PHP 5.2.0 or higher.');
+ $requirements['ctools_php_52']['severity'] = REQUIREMENT_WARNING;
+ $requirements['ctools_php_52']['value'] = t('PHP !version', array('!version' => phpversion()));
+ }
+ }
+
+ return $requirements;
+}
+
+/**
+ * Implements hook_schemea
+ */
+function ctools_schema() {
+ return ctools_schema_2();
+}
+
+/**
+ * Version 2 of the CTools schema.
+ */
+function ctools_schema_2() {
+ $schema = ctools_schema_1();
+
+ // update the 'name' field to be 128 bytes long:
+ $schema['ctools_object_cache']['fields']['name']['length'] = 128;
+
+ // DO NOT MODIFY THIS TABLE -- this definition is used to create the table.
+ // Changes to this table must be made in schema_3 or higher.
+ $schema['ctools_css_cache'] = array(
+ 'description' => 'A special cache used to store CSS that must be non-volatile.',
+ 'fields' => array(
+ 'cid' => array(
+ 'type' => 'varchar',
+ 'length' => '128',
+ 'description' => 'The CSS ID this cache object belongs to.',
+ 'not null' => TRUE,
+ ),
+ 'filename' => array(
+ 'type' => 'varchar',
+ 'length' => '255',
+ 'description' => 'The filename this CSS is stored in.',
+ ),
+ 'css' => array(
+ 'type' => 'text',
+ 'size' => 'big',
+ 'description' => 'CSS being stored.',
+ 'serialize' => TRUE,
+ ),
+ 'filter' => array(
+ 'type' => 'int',
+ 'size' => 'tiny',
+ 'description' => 'Whether or not this CSS needs to be filtered.',
+ ),
+ ),
+ 'primary key' => array('cid'),
+ );
+
+ return $schema;
+}
+
+/**
+ * CTools' initial schema; separated for the purposes of updates.
+ *
+ * DO NOT MAKE CHANGES HERE. This schema version is locked.
+ */
+function ctools_schema_1() {
+ $schema['ctools_object_cache'] = array(
+ 'description' => t('A special cache used to store objects that are being edited; it serves to save state in an ordinarily stateless environment.'),
+ 'fields' => array(
+ 'sid' => array(
+ 'type' => 'varchar',
+ 'length' => '64',
+ 'not null' => TRUE,
+ 'description' => 'The session ID this cache object belongs to.',
+ ),
+ 'name' => array(
+ 'type' => 'varchar',
+ 'length' => '32',
+ 'not null' => TRUE,
+ 'description' => 'The name of the object this cache is attached to.',
+ ),
+ 'obj' => array(
+ 'type' => 'varchar',
+ 'length' => '32',
+ 'not null' => TRUE,
+ 'description' => 'The type of the object this cache is attached to; this essentially represents the owner so that several sub-systems can use this cache.',
+ ),
+ 'updated' => array(
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ 'description' => 'The time this cache was created or updated.',
+ ),
+ 'data' => array(
+ 'type' => 'text',
+ 'size' => 'big',
+ 'description' => 'Serialized data being stored.',
+ 'serialize' => TRUE,
+ ),
+ ),
+ 'primary key' => array('sid', 'obj', 'name'),
+ 'indexes' => array('updated' => array('updated')),
+ );
+ return $schema;
+}
+
+/**
+ * Enlarge the ctools_object_cache.name column to prevent truncation and weird
+ * errors.
+ */
+function ctools_update_6001() {
+ // Perform updates like this to reduce code duplication.
+ $schema = ctools_schema_2();
+
+ db_change_field('ctools_object_cache', 'name', 'name', $schema['ctools_object_cache']['fields']['name']);
+}
+
+/**
+ * Add the new css cache table.
+ */
+function ctools_update_6002() {
+ // Schema 2 is locked and should not be changed.
+ $schema = ctools_schema_2();
+
+ db_create_table('ctools_css_cache', $schema['ctools_css_cache']);
+}
+
+/**
+ * Take over for the panels_views module if it was on.
+ */
+function ctools_update_6003() {
+ $result = db_query('SELECT status FROM {system} WHERE name = :name', array(':name' => 'panels_views'))->fetchField();
+ if ($result) {
+ db_delete('system')->condition('name', 'panels_views')->execute();
+ module_enable(array('views_content'), TRUE);
+ }
+}
+
+/**
+ * Add primary key to the ctools_object_cache table.
+ */
+function ctools_update_6004() {
+ db_add_primary_key('ctools_object_cache', array('sid', 'obj', 'name'));
+ db_drop_index('ctools_object_cache', 'sid_obj_name');
+}
+
+/**
+ * Removed update.
+ */
+function ctools_update_6005() {
+ return array();
+}
+
+/**
+ * ctools_custom_content table was originally here, but is now moved to
+ * its own module.
+ */
+function ctools_update_6007() {
+ $ret = array();
+ if (db_table_exists('ctools_custom_content')) {
+ // Enable the module to make everything as seamless as possible.
+ module_enable(array('ctools_custom_content'), TRUE);
+ }
+
+ return $ret;
+}
+
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.module b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.module
new file mode 100644
index 0000000..7dfc989
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools.module
@@ -0,0 +1,842 @@
+<?php
+
+/**
+ * @file
+ * CTools primary module file.
+ *
+ * Most of the CTools tools are in their own .inc files. This contains
+ * nothing more than a few convenience functions and some hooks that
+ * must be implemented in the module file.
+ */
+
+define('CTOOLS_API_VERSION', '2.0.7');
+
+/**
+ * Test the CTools API version.
+ *
+ * This function can always be used to safely test if CTools has the minimum
+ * API version that your module can use. It can also try to protect you from
+ * running if the CTools API version is too new, but if you do that you need
+ * to be very quick about watching CTools API releases and release new versions
+ * of your software as soon as the new release is made, or people might end up
+ * updating CTools and having your module shut down without any recourse.
+ *
+ * It is recommended that every hook of your module that might use CTools or
+ * might lead to a use of CTools be guarded like this:
+ *
+ * @code
+ * if (!module_invoke('ctools', 'api_version', '1.0')) {
+ * return;
+ * }
+ * @endcode
+ *
+ * Note that some hooks such as _menu() or _theme() must return an array().
+ *
+ * You can use it in your hook_requirements to report this error condition
+ * like this:
+ *
+ * @code
+ * define('MODULENAME_MINIMUM_CTOOLS_API_VERSION', '1.0');
+ * define('MODULENAME_MAXIMUM_CTOOLS_API_VERSION', '1.1');
+ *
+ * function MODULENAME_requirements($phase) {
+ * $requirements = array();
+ * if (!module_invoke('ctools', 'api_version', MODULENAME_MINIMUM_CTOOLS_API_VERSION, MODULENAME_MAXIMUM_CTOOLS_API_VERSION)) {
+ * $requirements['MODULENAME_ctools'] = array(
+ * 'title' => $t('MODULENAME required Chaos Tool Suite (CTools) API Version'),
+ * 'value' => t('Between @a and @b', array('@a' => MODULENAME_MINIMUM_CTOOLS_API_VERSION, '@b' => MODULENAME_MAXIMUM_CTOOLS_API_VERSION)),
+ * 'severity' => REQUIREMENT_ERROR,
+ * );
+ * }
+ * return $requirements;
+ * }
+ * @endcode
+ *
+ * Please note that the version is a string, not an floating point number.
+ * This will matter once CTools reaches version 1.10.
+ *
+ * A CTools API changes history will be kept in API.txt. Not every new
+ * version of CTools will necessarily update the API version.
+ * @param $minimum
+ * The minimum version of CTools necessary for your software to run with it.
+ * @param $maximum
+ * The maximum version of CTools allowed for your software to run with it.
+ */
+function ctools_api_version($minimum, $maximum = NULL) {
+ if (version_compare(CTOOLS_API_VERSION, $minimum, '<')) {
+ return FALSE;
+ }
+
+ if (isset($maximum) && version_compare(CTOOLS_API_VERSION, $maximum, '>')) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+// General utility functions
+
+/**
+ * Include .inc files as necessary.
+ *
+ * This fuction is helpful for including .inc files for your module. The
+ * general case is including ctools funcitonality like this:
+ *
+ * @code
+ * ctools_include('plugins');
+ * @endcode
+ *
+ * Similar funcitonality can be used for other modules by providing the $module
+ * and $dir arguments like this:
+ *
+ * @code
+ * // include mymodule/includes/import.inc
+ * ctools_include('import', 'mymodule');
+ * // include mymodule/plugins/foobar.inc
+ * ctools_include('foobar', 'mymodule', 'plugins');
+ * @endcode
+ *
+ * @param $file
+ * The base file name to be included.
+ * @param $module
+ * Optional module containing the include.
+ * @param $dir
+ * Optional subdirectory containing the include file.
+ */
+function ctools_include($file, $module = 'ctools', $dir = 'includes') {
+ static $used = array();
+
+ $dir = '/' . ($dir ? $dir . '/' : '');
+
+ if (!isset($used[$module][$dir][$file])) {
+ require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "$dir$file.inc";
+ $used[$module][$dir][$file] = TRUE;
+ }
+}
+
+/**
+ * Include .inc files in a form context.
+ *
+ * This is a variant of ctools_include that will save information in the
+ * the form_state so that cached forms will properly include things.
+ */
+function ctools_form_include(&$form_state, $file, $module = 'ctools', $dir = 'includes') {
+ if (!isset($form_state['build_info']['args'])) {
+ $form_state['build_info']['args'] = array();
+ }
+
+ $dir = '/' . ($dir ? $dir . '/' : '');
+ form_load_include($form_state, 'inc', $module, $dir . $file);
+}
+
+/**
+ * Add an arbitrary path to the $form_state so it can work with form cache.
+ *
+ * module_load_include uses an unfortunately annoying syntax to work, making it
+ * difficult to translate the more simple $path + $file syntax.
+ */
+function ctools_form_include_file(&$form_state, $filename) {
+ if (!isset($form_state['build_info']['args'])) {
+ $form_state['build_info']['args'] = array();
+ }
+
+ // Now add this to the build info files so that AJAX requests will know to load it.
+ $form_state['build_info']['files']["$filename"] = $filename;
+ require_once DRUPAL_ROOT . '/' . $filename;
+}
+
+/**
+ * Provide the proper path to an image as necessary.
+ *
+ * This helper function is used by ctools but can also be used in other
+ * modules in the same way as explained in the comments of ctools_include.
+ *
+ * @param $image
+ * The base file name (with extension) of the image to be included.
+ * @param $module
+ * Optional module containing the include.
+ * @param $dir
+ * Optional subdirectory containing the include file.
+ */
+function ctools_image_path($image, $module = 'ctools', $dir = 'images') {
+ return drupal_get_path('module', $module) . "/$dir/" . $image;
+}
+
+/**
+ * Include css files as necessary.
+ *
+ * This helper function is used by ctools but can also be used in other
+ * modules in the same way as explained in the comments of ctools_include.
+ *
+ * @param $file
+ * The base file name to be included.
+ * @param $module
+ * Optional module containing the include.
+ * @param $dir
+ * Optional subdirectory containing the include file.
+ */
+function ctools_add_css($file, $module = 'ctools', $dir = 'css') {
+ drupal_add_css(drupal_get_path('module', $module) . "/$dir/$file.css");
+}
+
+/**
+ * Format a css file name for use with $form['#attached']['css'].
+ *
+ * This helper function is used by ctools but can also be used in other
+ * modules in the same way as explained in the comments of ctools_include.
+ *
+ * @code
+ * $form['#attached']['css'] = array(ctools_attach_css('collapsible-div'));
+ * $form['#attached']['css'][ctools_attach_css('collapsible-div')] = array('preprocess' => FALSE);
+ * @endcode
+ *
+ * @param $file
+ * The base file name to be included.
+ * @param $module
+ * Optional module containing the include.
+ * @param $dir
+ * Optional subdirectory containing the include file.
+ */
+function ctools_attach_css($file, $module = 'ctools', $dir = 'css') {
+ return drupal_get_path('module', $module) . "/$dir/$file.css";
+}
+
+/**
+ * Include js files as necessary.
+ *
+ * This helper function is used by ctools but can also be used in other
+ * modules in the same way as explained in the comments of ctools_include.
+ *
+ * @param $file
+ * The base file name to be included.
+ * @param $module
+ * Optional module containing the include.
+ * @param $dir
+ * Optional subdirectory containing the include file.
+ */
+function ctools_add_js($file, $module = 'ctools', $dir = 'js') {
+ drupal_add_js(drupal_get_path('module', $module) . "/$dir/$file.js");
+}
+
+/**
+ * Format a javascript file name for use with $form['#attached']['js'].
+ *
+ * This helper function is used by ctools but can also be used in other
+ * modules in the same way as explained in the comments of ctools_include.
+ *
+ * @code
+ * $form['#attached']['js'] = array(ctools_attach_js('auto-submit'));
+ * @endcode
+ *
+ * @param $file
+ * The base file name to be included.
+ * @param $module
+ * Optional module containing the include.
+ * @param $dir
+ * Optional subdirectory containing the include file.
+ */
+function ctools_attach_js($file, $module = 'ctools', $dir = 'js') {
+ return drupal_get_path('module', $module) . "/$dir/$file.js";
+}
+
+/**
+ * Get a list of roles in the system.
+ *
+ * @return
+ * An array of role names keyed by role ID.
+ *
+ * @deprecated
+ * user_roles() should be used instead.
+ */
+function ctools_get_roles() {
+ return user_roles();
+}
+
+/*
+ * Break x,y,z and x+y+z into an array. Numeric only.
+ *
+ * @param $str
+ * The string to parse.
+ *
+ * @return $object
+ * An object containing
+ * - operator: Either 'and' or 'or'
+ * - value: An array of numeric values.
+ */
+function ctools_break_phrase($str) {
+ $object = new stdClass();
+
+ if (preg_match('/^([0-9]+[+ ])+[0-9]+$/', $str)) {
+ // The '+' character in a query string may be parsed as ' '.
+ $object->operator = 'or';
+ $object->value = preg_split('/[+ ]/', $str);
+ }
+ else if (preg_match('/^([0-9]+,)*[0-9]+$/', $str)) {
+ $object->operator = 'and';
+ $object->value = explode(',', $str);
+ }
+
+ // Keep an 'error' value if invalid strings were given.
+ if (!empty($str) && (empty($object->value) || !is_array($object->value))) {
+ $object->value = array(-1);
+ $object->invalid_input = TRUE;
+ return $object;
+ }
+
+ if (empty($object->value)) {
+ $object->value = array();
+ }
+
+ // Doubly ensure that all values are numeric only.
+ foreach ($object->value as $id => $value) {
+ $object->value[$id] = intval($value);
+ }
+
+ return $object;
+}
+
+/**
+ * Set a token/value pair to be replaced later in the request, specifically in
+ * ctools_preprocess_page().
+ *
+ * @param $token
+ * The token to be replaced later, during page rendering. This should
+ * ideally be a string inside of an HTML comment, so that if there is
+ * no replacement, the token will not render on the page.
+ * @param $type
+ * The type of the token. Can be either 'variable', which will pull data
+ * directly from the page variables
+ * @param $argument
+ * If $type == 'variable' then argument should be the key to fetch from
+ * the $variables. If $type == 'callback' then it should either be the
+ * callback, or an array that will be sent to call_user_func_array().
+ *
+ * @return
+ * A array of token/variable names to be replaced.
+ */
+function ctools_set_page_token($token = NULL, $type = NULL, $argument = NULL) {
+ static $tokens = array();
+
+ if (isset($token)) {
+ $tokens[$token] = array($type, $argument);
+ }
+ return $tokens;
+}
+
+/**
+ * Easily set a token from the page variables.
+ *
+ * This function can be used like this:
+ * $token = ctools_set_variable_token('tabs');
+ *
+ * $token will then be a simple replacement for the 'tabs' about of the
+ * variables available in the page template.
+ */
+function ctools_set_variable_token($token) {
+ $string = '<!-- ctools-page-' . $token . ' -->';
+ ctools_set_page_token($string, 'variable', $token);
+ return $string;
+}
+
+/**
+ * Easily set a token from the page variables.
+ *
+ * This function can be used like this:
+ * $token = ctools_set_variable_token('id', 'mymodule_myfunction');
+ */
+function ctools_set_callback_token($token, $callback) {
+ // If the callback uses arguments they are considered in the token.
+ if (is_array($callback)) {
+ $token .= '-' . md5(serialize($callback));
+ }
+ $string = '<!-- ctools-page-' . $token . ' -->';
+ ctools_set_page_token($string, 'callback', $callback);
+ return $string;
+}
+
+/**
+ * Tell CTools that sidebar blocks should not be rendered.
+ *
+ * It is often desirable to not display sidebars when rendering a page,
+ * particularly when using Panels. This informs CTools to alter out any
+ * sidebar regions during block render.
+ */
+function ctools_set_no_blocks($blocks = FALSE) {
+ $status = &drupal_static(__FUNCTION__, TRUE);
+ $status = $blocks;
+}
+
+// -----------------------------------------------------------------------
+// Drupal core hooks
+
+/**
+ * Implement hook_init to keep our global CSS at the ready.
+ */
+function ctools_init() {
+ ctools_add_css('ctools');
+ // If we are sure that CTools' AJAX is in use, change the error handling.
+ if (!empty($_REQUEST['ctools_ajax'])) {
+ ini_set('display_errors', 0);
+ register_shutdown_function('ctools_shutdown_handler');
+ }
+
+ // Clear plugin cache on the module page submit.
+ if ($_GET['q'] == 'admin/modules/list/confirm' && !empty($_POST)) {
+ cache_clear_all('ctools_plugin_files:', 'cache', TRUE);
+ }
+}
+
+/**
+ * Shutdown handler used during ajax operations to help catch fatal errors.
+ */
+function ctools_shutdown_handler() {
+ if (function_exists('error_get_last') AND ($error = error_get_last())) {
+ switch ($error['type']) {
+ case E_ERROR:
+ case E_CORE_ERROR:
+ case E_COMPILE_ERROR:
+ case E_USER_ERROR:
+ // Do this manually because including files here is dangerous.
+ $commands = array(
+ array(
+ 'command' => 'alert',
+ 'title' => t('Error'),
+ 'text' => t('Unable to complete operation. Fatal error in @file on line @line: @message', array(
+ '@file' => $error['file'],
+ '@line' => $error['line'],
+ '@message' => $error['message'],
+ )),
+ ),
+ );
+
+ // Change the status code so that the client will read the AJAX returned.
+ header('HTTP/1.1 200 OK');
+ drupal_json($commands);
+ }
+ }
+}
+
+/**
+ * Implements hook_theme().
+ */
+function ctools_theme() {
+ ctools_include('utility');
+ $items = array();
+ ctools_passthrough('ctools', 'theme', $items);
+ return $items;
+}
+
+/**
+ * Implements hook_menu().
+ */
+function ctools_menu() {
+ ctools_include('utility');
+ $items = array();
+ ctools_passthrough('ctools', 'menu', $items);
+ return $items;
+}
+
+/**
+ * Implementation of hook_cron. Clean up old caches.
+ */
+function ctools_cron() {
+ ctools_include('utility');
+ $items = array();
+ ctools_passthrough('ctools', 'cron', $items);
+}
+
+/**
+ * Ensure the CTools CSS cache is flushed whenever hook_flush_caches is invoked.
+ */
+function ctools_flush_caches() {
+ // Do not actually flush caches if running on cron. Drupal uses this hook
+ // in an inconsistent fashion and it does not necessarily mean to *flush*
+ // caches when running from cron. Instead it's just getting a list of cache
+ // tables and may not do any flushing.
+ if (!empty($GLOBALS['locks']['cron'])) {
+ return;
+ }
+
+ ctools_include('css');
+ ctools_css_flush_caches();
+}
+
+/**
+ * Implements hook_element_info_alter().
+ *
+ */
+function ctools_element_info_alter(&$type) {
+ ctools_include('dependent');
+ ctools_dependent_element_info_alter($type);
+}
+
+/**
+ * Implementation of hook_file_download()
+ *
+ * When using the private file system, we have to let Drupal know it's ok to
+ * download CSS and image files from our temporary directory.
+ */
+function ctools_file_download($filepath) {
+ if (strpos($filepath, 'ctools') === 0) {
+ $mime = file_get_mimetype($filepath);
+ // For safety's sake, we allow only text and images.
+ if (strpos($mime, 'text') === 0 || strpos($mime, 'image') === 0) {
+ return array('Content-type:' . $mime);
+ }
+ }
+}
+
+/**
+ * Implements hook_registry_files_alter().
+ *
+ * Alter the registry of files to automagically include all classes in
+ * class-based plugins.
+ */
+function ctools_registry_files_alter(&$files, $indexed_modules) {
+ ctools_include('registry');
+ return _ctools_registry_files_alter($files, $indexed_modules);
+}
+
+// -----------------------------------------------------------------------
+// CTools hook implementations.
+
+/**
+ * Implementation of hook_ctools_plugin_directory() to let the system know
+ * where all our own plugins are.
+ */
+function ctools_ctools_plugin_directory($owner, $plugin_type) {
+ if ($owner == 'ctools') {
+ return 'plugins/' . $plugin_type;
+ }
+}
+
+/**
+ * Implements hook_ctools_plugin_type().
+ */
+function ctools_ctools_plugin_type() {
+ ctools_include('utility');
+ $items = array();
+ // Add all the plugins that have their own declaration space elsewhere.
+ ctools_passthrough('ctools', 'plugin-type', $items);
+
+ return $items;
+}
+
+// -----------------------------------------------------------------------
+// Drupal theme preprocess hooks that must be in the .module file.
+
+/**
+ * A theme preprocess function to automatically allow panels-based node
+ * templates based upon input when the panel was configured.
+ */
+function ctools_preprocess_node(&$vars) {
+ // The 'ctools_template_identifier' attribute of the node is added when the pane is
+ // rendered.
+ if (!empty($vars['node']->ctools_template_identifier)) {
+ $vars['ctools_template_identifier'] = check_plain($vars['node']->ctools_template_identifier);
+ $vars['theme_hook_suggestions'][] = 'node__panel__' . check_plain($vars['node']->ctools_template_identifier);
+ }
+}
+
+function ctools_page_alter(&$page) {
+ $page['#post_render'][] = 'ctools_page_token_processing';
+}
+
+/**
+ * A theme post_render callback to allow content type plugins to use page
+ * template variables which are not yet available when the content type is
+ * rendered.
+ */
+function ctools_page_token_processing($children, $elements) {
+ $tokens = ctools_set_page_token();
+ if (!empty($tokens)) {
+ foreach ($tokens as $token => $key) {
+ list($type, $argument) = $key;
+ switch ($type) {
+ case 'variable':
+ $tokens[$token] = isset($variables[$argument]) ? $variables[$argument] : '';
+ break;
+ case 'callback':
+ if (is_string($argument) && function_exists($argument)) {
+ $tokens[$token] = $argument($variables);
+ }
+ if (is_array($argument) && function_exists($argument[0])) {
+ $function = array_shift($argument);
+ $argument = array_merge(array(&$variables), $argument);
+ $tokens[$token] = call_user_func_array($function, $argument);
+ }
+ break;
+ }
+ }
+ $children = strtr($children, $tokens);
+ }
+ return $children;
+}
+
+// -----------------------------------------------------------------------
+// Menu callbacks that must be in the .module file.
+
+/**
+ * Determine if the current user has access via a plugin.
+ *
+ * This function is meant to be embedded in the Drupal menu system, and
+ * therefore is in the .module file since sub files can't be loaded, and
+ * takes arguments a little bit more haphazardly than ctools_access().
+ *
+ * @param $access
+ * An access control array which contains the following information:
+ * - 'logic': and or or. Whether all tests must pass or one must pass.
+ * - 'plugins': An array of access plugins. Each contains:
+ * - - 'name': The name of the plugin
+ * - - 'settings': The settings from the plugin UI.
+ * - - 'context': Which context to use.
+ * @param ...
+ * zero or more context arguments generated from argument plugins. These
+ * contexts must have an 'id' attached to them so that they can be
+ * properly associated. The argument plugin system should set this, but
+ * if the context is coming from elsewhere it will need to be set manually.
+ *
+ * @return
+ * TRUE if access is granted, false if otherwise.
+ */
+function ctools_access_menu($access) {
+ // Short circuit everything if there are no access tests.
+ if (empty($access['plugins'])) {
+ return TRUE;
+ }
+
+ $contexts = array();
+ foreach (func_get_args() as $arg) {
+ if (is_object($arg) && get_class($arg) == 'ctools_context') {
+ $contexts[$arg->id] = $arg;
+ }
+ }
+
+ ctools_include('context');
+ return ctools_access($access, $contexts);
+}
+
+/**
+ * Determine if the current user has access via checks to multiple different
+ * permissions.
+ *
+ * This function is a thin wrapper around user_access that allows multiple
+ * permissions to be easily designated for use on, for example, a menu callback.
+ *
+ * @param ...
+ * An indexed array of zero or more permission strings to be checked by
+ * user_access().
+ *
+ * @return
+ * Iff all checks pass will this function return TRUE. If an invalid argument
+ * is passed (e.g., not a string), this function errs on the safe said and
+ * returns FALSE.
+ */
+function ctools_access_multiperm() {
+ foreach (func_get_args() as $arg) {
+ if (!is_string($arg) || !user_access($arg)) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+/**
+ * Check to see if the incoming menu item is js capable or not.
+ *
+ * This can be used as %ctools_js as part of a path in hook menu. CTools
+ * ajax functions will automatically change the phrase 'nojs' to 'ajax'
+ * when it attaches ajax to a link. This can be used to autodetect if
+ * that happened.
+ */
+function ctools_js_load($js) {
+ if ($js == 'ajax') {
+ return TRUE;
+ }
+ return 0;
+}
+
+/**
+ * Menu _load hook.
+ *
+ * This function will be called to load an object as a replacement for
+ * %ctools_export_ui in menu paths.
+ */
+function ctools_export_ui_load($item_name, $plugin_name) {
+ $return = &drupal_static(__FUNCTION__, FALSE);
+
+ if (!$return) {
+ ctools_include('export-ui');
+ $plugin = ctools_get_export_ui($plugin_name);
+ $handler = ctools_export_ui_get_handler($plugin);
+
+ if ($handler) {
+ return $handler->load_item($item_name);
+ }
+ }
+
+ return $return;
+}
+
+// -----------------------------------------------------------------------
+// Caching callbacks on behalf of export-ui.
+
+/**
+ * Menu access callback for various tasks of export-ui.
+ */
+function ctools_export_ui_task_access($plugin_name, $op, $item = NULL) {
+ ctools_include('export-ui');
+ $plugin = ctools_get_export_ui($plugin_name);
+ $handler = ctools_export_ui_get_handler($plugin);
+
+ if ($handler) {
+ return $handler->access($op, $item);
+ }
+
+ // Deny access if the handler cannot be found.
+ return FALSE;
+}
+
+/**
+ * Cache callback on behalf of ctools_export_ui.
+ */
+function ctools_export_ui_context_cache_get($plugin_name, $key) {
+ dsm('should not be called!');
+ return;
+}
+
+/**
+ * Cache callback on behalf of ctools_export_ui.
+ */
+function ctools_export_ui_context_cache_set($plugin_name, $key, $item) {
+ dsm('should not be called!');
+ return;
+}
+
+/**
+ * Callback for access control ajax form on behalf of export ui.
+ *
+ * Returns the cached access config and contexts used.
+ * Note that this is assuming that access will be in $item->access -- if it
+ * is not, an export UI plugin will have to make its own callbacks.
+ */
+function ctools_export_ui_ctools_access_get($argument) {
+ ctools_include('export-ui');
+ list($plugin_name, $key) = explode(':', $argument, 2);
+
+ $plugin = ctools_get_export_ui($plugin_name);
+ $handler = ctools_export_ui_get_handler($plugin);
+
+ if ($handler) {
+ ctools_include('context');
+ $item = $handler->edit_cache_get($key);
+ if (!$item) {
+ $item = ctools_export_crud_load($handler->plugin['schema'], $key);
+ }
+
+ $contexts = ctools_context_load_contexts($item);
+ return array($item->access, $contexts);
+ }
+}
+
+/**
+ * Callback for access control ajax form on behalf of export ui
+ *
+ * Returns the cached access config and contexts used.
+ * Note that this is assuming that access will be in $item->access -- if it
+ * is not, an export UI plugin will have to make its own callbacks.
+ */
+function ctools_export_ui_ctools_access_set($argument, $access) {
+ ctools_include('export-ui');
+ list($plugin_name, $key) = explode(':', $argument, 2);
+
+ $plugin = ctools_get_export_ui($plugin_name);
+ $handler = ctools_export_ui_get_handler($plugin);
+
+ if ($handler) {
+ ctools_include('context');
+ $item = $handler->edit_cache_get($key);
+ if (!$item) {
+ $item = ctools_export_crud_load($handler->plugin['schema'], $key);
+ }
+ $item->access = $access;
+ return $handler->edit_cache_set_key($item, $key);
+ }
+}
+
+/**
+ * Implements hook_menu_local_tasks_alter().
+ */
+function ctools_menu_local_tasks_alter(&$data, $router_item, $root_path) {
+ ctools_include('menu');
+ _ctools_menu_add_dynamic_items($data, $router_item, $root_path);
+}
+
+/**
+ * Implement hook_block_list_alter() to potentially remove blocks.
+ *
+ * This exists in order to replicate Drupal 6's "no blocks" functionality.
+ */
+function ctools_block_list_alter(&$blocks) {
+ $check = drupal_static('ctools_set_no_blocks', TRUE);
+ if (!$check) {
+ foreach ($blocks as $block_id => $block) {
+ // @todo -- possibly we can set configuration for this so that users can
+ // specify which blocks will not get rendered.
+ if (strpos($block->region, 'sidebar') !== FALSE) {
+ unset($blocks[$block_id]);
+ }
+ }
+ }
+}
+
+/**
+ * Implement hook_modules_enabled to clear static caches for detecting new plugins
+ */
+function ctools_modules_enabled($modules) {
+ ctools_include('plugins');
+ ctools_get_plugins_reset();
+}
+
+/**
+ * Menu theme callback.
+ *
+ * This simply ensures that Panels ajax calls are rendered in the same
+ * theme as the original page to prevent .css file confusion.
+ *
+ * To use this, set this as the theme callback on AJAX related menu
+ * items. Since the ajax page state won't be sent during ajax requests,
+ * it should be safe to use even if ajax isn't invoked.
+ */
+function ctools_ajax_theme_callback() {
+ if (!empty($_POST['ajax_page_state']['theme'])) {
+ return $_POST['ajax_page_state']['theme'];
+ }
+}
+
+function ctools_ctools_entity_context_alter(&$plugin, &$entity, $plugin_id) {
+ ctools_include('context');
+ switch ($plugin_id) {
+ case 'entity_id:taxonomy_term':
+ $plugin['no ui'] = TRUE;
+ break;
+ case 'entity:user':
+ $plugin = ctools_get_context('user');
+ unset($plugin['no ui']);
+ unset($plugin['no required context ui']);
+ break;
+ }
+
+ // Apply restrictions on taxonomy term reverse relationships whose
+ // restrictions are in the settings on the field.
+ if (!empty($plugin['parent']) &&
+ $plugin['parent'] == 'entity_from_field' &&
+ !empty($plugin['reverse']) &&
+ $plugin['to entity'] == 'taxonomy_term') {
+ $field = field_info_field($plugin['field name']);
+ if (isset($field['settings']['allowed_values'][0]['vocabulary'])) {
+ $plugin['required context']->restrictions = array('vocabulary' => array($field['settings']['allowed_values'][0]['vocabulary']));
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info
new file mode 100644
index 0000000..4562d7a
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info
@@ -0,0 +1,12 @@
+name = Custom rulesets
+description = Create custom, exportable, reusable access rulesets for applications like Panels.
+core = 7.x
+package = Chaos tool suite
+dependencies[] = ctools
+
+; Information added by drupal.org packaging script on 2012-08-08
+version = "7.x-1.1"
+core = "7.x"
+project = "ctools"
+datestamp = "1344463011"
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.install b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.install
new file mode 100644
index 0000000..b1613d8
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.install
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * Schema for customizable access rulesets.
+ */
+function ctools_access_ruleset_schema() {
+ return ctools_access_ruleset_schema_1();
+}
+
+function ctools_access_ruleset_schema_1() {
+ $schema = array();
+
+ $schema['ctools_access_ruleset'] = array(
+ 'description' => 'Contains exportable customized access rulesets.',
+ 'export' => array(
+ 'identifier' => 'ruleset',
+ 'bulk export' => TRUE,
+ 'primary key' => 'rsid',
+ 'api' => array(
+ 'owner' => 'ctools',
+ 'api' => 'ctools_rulesets',
+ 'minimum_version' => 1,
+ 'current_version' => 1,
+ ),
+ ),
+ 'fields' => array(
+ 'rsid' => array(
+ 'type' => 'serial',
+ 'description' => 'A database primary key to ensure uniqueness',
+ 'not null' => TRUE,
+ 'no export' => TRUE,
+ ),
+ 'name' => array(
+ 'type' => 'varchar',
+ 'length' => '255',
+ 'description' => 'Unique ID for this ruleset. Used to identify it programmatically.',
+ ),
+ 'admin_title' => array(
+ 'type' => 'varchar',
+ 'length' => '255',
+ 'description' => 'Administrative title for this ruleset.',
+ ),
+ 'admin_description' => array(
+ 'type' => 'text',
+ 'size' => 'big',
+ 'description' => 'Administrative description for this ruleset.',
+ 'object default' => '',
+ ),
+ 'requiredcontexts' => array(
+ 'type' => 'text',
+ 'size' => 'big',
+ 'description' => 'Any required contexts for this ruleset.',
+ 'serialize' => TRUE,
+ 'object default' => array(),
+ ),
+ 'contexts' => array(
+ 'type' => 'text',
+ 'size' => 'big',
+ 'description' => 'Any embedded contexts for this ruleset.',
+ 'serialize' => TRUE,
+ 'object default' => array(),
+ ),
+ 'relationships' => array(
+ 'type' => 'text',
+ 'size' => 'big',
+ 'description' => 'Any relationships for this ruleset.',
+ 'serialize' => TRUE,
+ 'object default' => array(),
+ ),
+ 'access' => array(
+ 'type' => 'text',
+ 'size' => 'big',
+ 'description' => 'The actual group of access plugins for this ruleset.',
+ 'serialize' => TRUE,
+ 'object default' => array(),
+ ),
+ ),
+ 'primary key' => array('rsid'),
+ );
+
+ return $schema;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.module b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.module
new file mode 100644
index 0000000..fb39f37
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.module
@@ -0,0 +1,85 @@
+<?php
+
+/**
+ * @file
+ * ctools_access_ruleset module
+ *
+ * This module allows styles to be created and managed on behalf of modules
+ * that implement styles.
+ *
+ * The ctools_access_ruleset tool allows recolorable styles to be created via a miniature
+ * scripting language. Panels utilizes this to allow administrators to add
+ * styles directly to any panel display.
+ */
+
+/**
+ * Implementation of hook_permission()
+ */
+function ctools_access_ruleset_permission() {
+ return array(
+ 'administer ctools access ruleset' => array(
+ 'title' => t('Administer access rulesets'),
+ 'description' => t('Add, delete and edit custom access rulesets.'),
+ ),
+ );
+}
+
+/**
+ * Implementation of hook_ctools_plugin_directory() to let the system know
+ * we implement task and task_handler plugins.
+ */
+function ctools_access_ruleset_ctools_plugin_directory($module, $plugin) {
+ // Most of this module is implemented as an export ui plugin, and the
+ // rest is in ctools/includes/ctools_access_ruleset.inc
+ if ($module == 'ctools' && ($plugin == 'export_ui' || $plugin == 'access')) {
+ return 'plugins/' . $plugin;
+ }
+}
+
+/**
+ * Implementation of hook_panels_dashboard_blocks().
+ *
+ * Adds page information to the Panels dashboard.
+ */
+function ctools_access_ruleset_panels_dashboard_blocks(&$vars) {
+ $vars['links']['ctools_access_ruleset'] = array(
+ 'title' => l(t('Custom ruleset'), 'admin/structure/ctools-rulesets/add'),
+ 'description' => t('Custom rulesets are combinations of access plugins you can use for access control, selection criteria and pane visibility.'),
+ );
+
+ // Load all mini panels and their displays.
+ ctools_include('export');
+ $items = ctools_export_crud_load_all('ctools_access_ruleset');
+ $count = 0;
+ $rows = array();
+
+ foreach ($items as $item) {
+ $rows[] = array(
+ check_plain($item->admin_title),
+ array(
+ 'data' => l(t('Edit'), "admin/structure/ctools-rulesets/list/$item->name/edit"),
+ 'class' => 'links',
+ ),
+ );
+
+ // Only show 10.
+ if (++$count >= 10) {
+ break;
+ }
+ }
+
+ if ($rows) {
+ $content = theme('table', array('rows' => $rows, 'attributes' => array('class' => 'panels-manage')));
+ }
+ else {
+ $content = '<p>' . t('There are no custom rulesets.') . '</p>';
+ }
+
+ $vars['blocks']['ctools_access_ruleset'] = array(
+ 'title' => t('Manage custom rulesets'),
+ 'link' => l(t('Go to list'), 'admin/structure/ctools-rulesets'),
+ 'content' => $content,
+ 'class' => 'dashboard-ruleset',
+ 'section' => 'right',
+ );
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/access/ruleset.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/access/ruleset.inc
new file mode 100644
index 0000000..f8abea6
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/access/ruleset.inc
@@ -0,0 +1,109 @@
+<?php
+
+/**
+ * @file
+ * Plugin to provide access control based on user rulesetission strings.
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+ 'title' => '',
+ 'description' => '',
+ 'callback' => 'ctools_ruleset_ctools_access_check',
+ 'settings form' => 'ctools_ruleset_ctools_access_settings',
+ 'summary' => 'ctools_ruleset_ctools_access_summary',
+
+ // This access plugin actually just contains child plugins that are
+ // exportable, UI configured rulesets.
+ 'get child' => 'ctools_ruleset_ctools_access_get_child',
+ 'get children' => 'ctools_ruleset_ctools_access_get_children',
+);
+
+/**
+ * Merge the main access plugin with a loaded ruleset to form a child plugin.
+ */
+function ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item) {
+ $plugin['name'] = $parent . ':' . $item->name;
+ $plugin['title'] = check_plain($item->admin_title);
+ $plugin['description'] = check_plain($item->admin_description);
+
+ // TODO: Generalize this in CTools.
+ if (!empty($item->requiredcontexts)) {
+ $plugin['required context'] = array();
+ foreach ($item->requiredcontexts as $context) {
+ $info = ctools_get_context($context['name']);
+ // TODO: allow an optional setting
+ $plugin['required context'][] = new ctools_context_required($context['identifier'], $info['context name']);
+ }
+ }
+
+ // Store the loaded ruleset in the plugin.
+ $plugin['ruleset'] = $item;
+ return $plugin;
+}
+
+/**
+ * Get a single child access plugin.
+ */
+function ctools_ruleset_ctools_access_get_child($plugin, $parent, $child) {
+ ctools_include('export');
+ $item = ctools_export_crud_load('ctools_access_ruleset', $child);
+ if ($item) {
+ return ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item);
+ }
+}
+
+/**
+ * Get all child access plugins.
+ */
+function ctools_ruleset_ctools_access_get_children($plugin, $parent) {
+ $plugins = array();
+ ctools_include('export');
+ $items = ctools_export_crud_load_all('ctools_access_ruleset');
+ foreach ($items as $name => $item) {
+ $child = ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item);
+ $plugins[$child['name']] = $child;
+ }
+
+ return $plugins;
+}
+
+/**
+ * Settings form for the 'by ruleset' access plugin
+ */
+function ctools_ruleset_ctools_access_settings(&$form, &$form_state, $conf) {
+ if (!empty($form_state['plugin']['ruleset']->admin_description)) {
+ $form['markup'] = array(
+ '#markup' => '<div class="description">' . check_plain($form_state['plugin']['ruleset']->admin_description) . '</div>',
+ );
+ }
+
+ return $form;
+}
+
+/**
+ * Check for access.
+ */
+function ctools_ruleset_ctools_access_check($conf, $context, $plugin) {
+ // Load up any contexts we might be using.
+ $contexts = ctools_context_match_required_contexts($plugin['ruleset']->requiredcontexts, $context);
+ $contexts = ctools_context_load_contexts($plugin['ruleset'], FALSE, $contexts);
+
+ return ctools_access($plugin['ruleset']->access, $contexts);
+}
+
+/**
+ * Provide a summary description based upon the checked roles.
+ */
+function ctools_ruleset_ctools_access_summary($conf, $context, $plugin) {
+ if (!empty($plugin['ruleset']->admin_description)) {
+ return check_plain($plugin['ruleset']->admin_description);
+ }
+ else {
+ return check_plain($plugin['ruleset']->admin_title);
+ }
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc
new file mode 100644
index 0000000..d2a1c60
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc
@@ -0,0 +1,29 @@
+<?php
+
+$plugin = array(
+ 'schema' => 'ctools_access_ruleset',
+ 'access' => 'administer ctools access ruleset',
+
+ 'menu' => array(
+ 'menu item' => 'ctools-rulesets',
+ 'menu title' => 'Custom access rulesets',
+ 'menu description' => 'Add, edit or delete custom access rulesets for use with Panels and other systems that utilize CTools content plugins.',
+ ),
+
+ 'title singular' => t('ruleset'),
+ 'title singular proper' => t('Ruleset'),
+ 'title plural' => t('rulesets'),
+ 'title plural proper' => t('Rulesets'),
+
+ 'handler' => 'ctools_access_ruleset_ui',
+
+ 'use wizard' => TRUE,
+ 'form info' => array(
+ 'order' => array(
+ 'basic' => t('Basic information'),
+ 'context' => t('Contexts'),
+ 'rules' => t('Rules'),
+ ),
+ ),
+);
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php
new file mode 100644
index 0000000..b181464
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php
@@ -0,0 +1,53 @@
+<?php
+
+class ctools_access_ruleset_ui extends ctools_export_ui {
+
+ function edit_form_context(&$form, &$form_state) {
+ ctools_include('context-admin');
+ ctools_context_admin_includes();
+ ctools_add_css('ruleset');
+
+ $form['right'] = array(
+ '#prefix' => '<div class="ctools-right-container">',
+ '#suffix' => '</div>',
+ );
+
+ $form['left'] = array(
+ '#prefix' => '<div class="ctools-left-container clearfix">',
+ '#suffix' => '</div>',
+ );
+
+ // Set this up and we can use CTools' Export UI's built in wizard caching,
+ // which already has callbacks for the context cache under this name.
+ $module = 'export_ui::' . $this->plugin['name'];
+ $name = $this->edit_cache_get_key($form_state['item'], $form_state['form type']);
+
+ ctools_context_add_context_form($module, $form, $form_state, $form['right']['contexts_table'], $form_state['item'], $name);
+ ctools_context_add_required_context_form($module, $form, $form_state, $form['left']['required_contexts_table'], $form_state['item'], $name);
+ ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $form_state['item'], $name);
+ }
+
+ function edit_form_rules(&$form, &$form_state) {
+ // The 'access' UI passes everything via $form_state, unlike the 'context' UI.
+ // The main difference is that one is about 3 years newer than the other.
+ ctools_include('context');
+ ctools_include('context-access-admin');
+
+ $form_state['access'] = $form_state['item']->access;
+ $form_state['contexts'] = ctools_context_load_contexts($form_state['item']);
+
+ $form_state['module'] = 'ctools_export_ui';
+ $form_state['callback argument'] = $form_state['object']->plugin['name'] . ':' . $form_state['object']->edit_cache_get_key($form_state['item'], $form_state['form type']);
+ $form_state['no buttons'] = TRUE;
+
+ $form = ctools_access_admin_form($form, $form_state);
+ }
+
+ function edit_form_rules_submit(&$form, &$form_state) {
+ $form_state['item']->access['logic'] = $form_state['values']['logic'];
+ }
+
+ function edit_form_submit(&$form, &$form_state) {
+ parent::edit_form_submit($form, $form_state);
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css
new file mode 100644
index 0000000..8df17de
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css
@@ -0,0 +1,134 @@
+div.ctools-sample-modal-content {
+ background:none;
+ border:0;
+ color:#000000;
+ margin:0;
+ padding:0;
+ text-align:left;
+}
+div.ctools-sample-modal-content .modal-scroll{
+ overflow:hidden;
+ overflow-y:auto;
+}
+div.ctools-sample-modal-content #popups-overlay {
+ background-color:transparent;
+}
+div.ctools-sample-modal-content #popups-loading {
+ width:248px;
+ position:absolute;
+ display:none;
+ opacity:1;
+ -moz-border-radius: 8px;
+ -webkit-border-radius: 8px;
+ z-index:99;
+}
+div.ctools-sample-modal-content #popups-loading span.popups-loading-message {
+ background:#FFF url(../images/loading-large.gif) no-repeat 8px center;
+ display:block;
+ color:#444444;
+ font-family:Arial;
+ font-size:22px;
+ font-weight:bold;
+ height:36px;
+ line-height:36px;
+ padding:0 40px;
+}
+div.ctools-sample-modal-content #popups-loading table,
+div.ctools-sample-modal-content .popups-box table {
+ margin:0px;
+}
+div.ctools-sample-modal-content #popups-loading tbody,
+div.ctools-sample-modal-content .popups-box tbody {
+ border:none;
+}
+div.ctools-sample-modal-content .popups-box tr {
+ background-color:transparent;
+}
+div.ctools-sample-modal-content td.popups-border {
+ background: url(../images/popups-border.png);
+ background-color:transparent;
+ border: none;
+}
+div.ctools-sample-modal-content td.popups-tl,
+div.ctools-sample-modal-content td.popups-tr,
+div.ctools-sample-modal-content td.popups-bl,
+div.ctools-sample-modal-content td.popups-br {
+ background-repeat: no-repeat;
+ height:10px;
+ padding:0px;
+}
+div.ctools-sample-modal-content td.popups-tl { background-position: 0px 0px; }
+div.ctools-sample-modal-content td.popups-t,
+div.ctools-sample-modal-content td.popups-b {
+ background-position: 0px -40px;
+ background-repeat: repeat-x;
+}
+div.ctools-sample-modal-content td.popups-tr { background-position: 0px -10px; width: 10px; }
+div.ctools-sample-modal-content td.popups-cl,
+div.ctools-sample-modal-content td.popups-cr {
+ background-position: -10px 0;
+ background-repeat: repeat-y;
+ width:10px;
+}
+div.ctools-sample-modal-content td.popups-cl,
+div.ctools-sample-modal-content td.popups-cr,
+div.ctools-sample-modal-content td.popups-c { padding:0; border: none; }
+div.ctools-sample-modal-content td.popups-c { background:#fff; }
+div.ctools-sample-modal-content td.popups-bl { background-position: 0px -20px; }
+div.ctools-sample-modal-content td.popups-br { background-position: 0px -30px; width: 10px; }
+
+div.ctools-sample-modal-content .popups-box,
+div.ctools-sample-modal-content #popups-loading {
+ border: 0px solid #454545;
+ opacity:1;
+ overflow:hidden;
+ padding:0;
+ background-color:transparent;
+}
+div.ctools-sample-modal-content .popups-container {
+ overflow:hidden;
+ height:100%;
+ background-color:#fff;
+}
+div.ctools-sample-modal-content div.popups-title {
+ -moz-border-radius-topleft: 0px;
+ -webkit-border-radius-topleft: 0px;
+ margin-bottom:0px;
+ background-color:#ff7200;
+ border:1px solid #ce5c00;
+ padding:4px 10px 5px;
+ color:white;
+ font-size:1em;
+ font-weight:bold;
+}
+div.ctools-sample-modal-content .popups-body {
+ background-color:#fff;
+ padding:8px;
+}
+div.ctools-sample-modal-content .popups-box .popups-buttons,
+div.ctools-sample-modal-content .popups-box .popups-footer {
+ background-color:#fff;
+}
+div.ctools-sample-modal-content .popups-title a.close {
+ color: #fff;
+ text-decoration:none;
+}
+div.ctools-sample-modal-content .popups-close {
+ font-size:120%;
+ float:right;
+ text-align:right;
+}
+div.ctools-sample-modal-content .modal-loading-wrapper {
+ width:220px;
+ height:19px;
+ margin:0 auto;
+ margin-top:2%;
+}
+
+div.ctools-sample-modal-content tbody{
+ border:none;
+}
+
+div.ctools-sample-modal-content .modal-content .modal-throbber-wrapper img {
+ margin-top: 100px;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info
new file mode 100644
index 0000000..056083d
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info
@@ -0,0 +1,12 @@
+name = Chaos Tools (CTools) AJAX Example
+description = Shows how to use the power of Chaos AJAX.
+package = Chaos tool suite
+dependencies[] = ctools
+core = 7.x
+
+; Information added by drupal.org packaging script on 2012-08-08
+version = "7.x-1.1"
+core = "7.x"
+project = "ctools"
+datestamp = "1344463011"
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.install b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.install
new file mode 100644
index 0000000..04325db
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.install
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * @file
+ */
+
+/**
+ * Implementation of hook_install()
+ */
+function ctools_ajax_sample_install() {
+
+}
+
+/**
+ * Implementation of hook_uninstall()
+ */
+function ctools_ajax_sample_uninstall() {
+
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.module b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.module
new file mode 100644
index 0000000..2a30c2a
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.module
@@ -0,0 +1,756 @@
+<?php
+
+/**
+ * @file
+ * Sample AJAX functionality so people can see some of the CTools AJAX
+ * features in use.
+ */
+
+// ---------------------------------------------------------------------------
+// Drupal hooks.
+
+/**
+ * Implementation of hook_menu()
+ */
+function ctools_ajax_sample_menu() {
+ $items['ctools_ajax_sample'] = array(
+ 'title' => 'Chaos Tools AJAX Demo',
+ 'page callback' => 'ctools_ajax_sample_page',
+ 'access callback' => TRUE,
+ 'type' => MENU_NORMAL_ITEM,
+ );
+ $items['ctools_ajax_sample/simple_form'] = array(
+ 'title' => 'Simple Form',
+ 'page callback' => 'ctools_ajax_simple_form',
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+ $items['ctools_ajax_sample/%ctools_js/hello'] = array(
+ 'title' => 'Hello World',
+ 'page callback' => 'ctools_ajax_sample_hello',
+ 'page arguments' => array(1),
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+ $items['ctools_ajax_sample/%ctools_js/tablenix/%'] = array(
+ 'title' => 'Hello World',
+ 'page callback' => 'ctools_ajax_sample_tablenix',
+ 'page arguments' => array(1, 3),
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+ $items['ctools_ajax_sample/%ctools_js/login'] = array(
+ 'title' => 'Login',
+ 'page callback' => 'ctools_ajax_sample_login',
+ 'page arguments' => array(1),
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+ $items['ctools_ajax_sample/%ctools_js/animal'] = array(
+ 'title' => 'Animal',
+ 'page callback' => 'ctools_ajax_sample_animal',
+ 'page arguments' => array(1),
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+ $items['ctools_ajax_sample/%ctools_js/login/%'] = array(
+ 'title' => 'Post-Login Action',
+ 'page callback' => 'ctools_ajax_sample_login_success',
+ 'page arguments' => array(1, 3),
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+ $items['ctools_ajax_sample/jumped'] = array(
+ 'title' => 'Successful Jumping',
+ 'page callback' => 'ctools_ajax_sample_jump_menu_page',
+ 'access callback' => TRUE,
+ 'type' => MENU_NORMAL_ITEM,
+ );
+
+ return $items;
+}
+
+function ctools_ajax_simple_form() {
+ ctools_include('content');
+ ctools_include('context');
+ $node = node_load(1);
+ $context = ctools_context_create('node', $node);
+ $context = array('context_node_1' => $context);
+ return ctools_content_render('node_comment_form', 'node_comment_form', ctools_ajax_simple_form_pane(), array(), array(), $context);
+}
+
+function ctools_ajax_simple_form_pane() {
+ $configuration = array(
+ 'anon_links' => 0,
+ 'context' => 'context_node_1',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ );
+ return $configuration;
+}
+
+/**
+ * Implementation of hook_theme()
+ *
+ * Render some basic output for this module.
+ */
+function ctools_ajax_sample_theme() {
+ return array(
+ // Sample theme functions.
+ 'ctools_ajax_sample_container' => array(
+ 'arguments' => array('content' => NULL),
+ ),
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Page callbacks
+
+/**
+ * Page callback to display links and render a container for AJAX stuff.
+ */
+function ctools_ajax_sample_page() {
+ global $user;
+
+ // Include the CTools tools that we need.
+ ctools_include('ajax');
+ ctools_include('modal');
+
+ // Add CTools' javascript to the page.
+ ctools_modal_add_js();
+
+ // Create our own javascript that will be used to theme a modal.
+ $sample_style = array(
+ 'ctools-sample-style' => array(
+ 'modalSize' => array(
+ 'type' => 'fixed',
+ 'width' => 500,
+ 'height' => 300,
+ 'addWidth' => 20,
+ 'addHeight' => 15,
+ ),
+ 'modalOptions' => array(
+ 'opacity' => .5,
+ 'background-color' => '#000',
+ ),
+ 'animation' => 'fadeIn',
+ 'modalTheme' => 'CToolsSampleModal',
+ 'throbber' => theme('image', array('path' => ctools_image_path('ajax-loader.gif', 'ctools_ajax_sample'), 'alt' => t('Loading...'), 'title' => t('Loading'))),
+ ),
+ );
+
+ drupal_add_js($sample_style, 'setting');
+
+ // Since we have our js, css and images in well-known named directories,
+ // CTools makes it easy for us to just use them without worrying about
+ // using drupal_get_path() and all that ugliness.
+ ctools_add_js('ctools-ajax-sample', 'ctools_ajax_sample');
+ ctools_add_css('ctools-ajax-sample', 'ctools_ajax_sample');
+
+ // Create a list of clickable links.
+ $links = array();
+
+ // Only show login links to the anonymous user.
+ if ($user->uid == 0) {
+ $links[] = ctools_modal_text_button(t('Modal Login (default style)'), 'ctools_ajax_sample/nojs/login', t('Login via modal'));
+
+ // The extra class points to the info in ctools-sample-style which we added
+ // to the settings, prefixed with 'ctools-modal'.
+ $links[] = ctools_modal_text_button(t('Modal Login (custom style)'), 'ctools_ajax_sample/nojs/login', t('Login via modal'), 'ctools-modal-ctools-sample-style');
+ }
+
+ // Four ways to do our animal picking wizard.
+ $button_form = ctools_ajax_sample_ajax_button_form();
+ $links[] = l(t('Wizard (no modal)'), 'ctools_ajax_sample/nojs/animal');
+ $links[] = ctools_modal_text_button(t('Wizard (default modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal'));
+ $links[] = ctools_modal_text_button(t('Wizard (custom modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal'), 'ctools-modal-ctools-sample-style');
+ $links[] = drupal_render($button_form);
+
+ $links[] = ctools_ajax_text_button(t('Hello world!'), "ctools_ajax_sample/nojs/hello", t('Replace text with "hello world"'));
+
+ $output = theme('item_list', array('items' => $links, 'title' => t('Actions')));
+
+ // This container will have data AJAXed into it.
+ $output .= theme('ctools_ajax_sample_container', array('content' => '<h1>' . t('Sample Content') . '</h1>'));
+
+ // Create a table that we can have data removed from via AJAX.
+ $header = array(t('Row'), t('Content'), t('Actions'));
+ $rows = array();
+ for($i = 1; $i < 11; $i++) {
+ $rows[] = array(
+ 'class' => array('ajax-sample-row-'. $i),
+ 'data' => array(
+ $i,
+ md5($i),
+ ctools_ajax_text_button("remove", "ctools_ajax_sample/nojs/tablenix/$i", t('Delete this row')),
+ ),
+ );
+ }
+
+ $output .= theme('table', array('header' => $header, 'rows' => $rows, array('class' => array('ajax-sample-table'))));
+
+ // Show examples of ctools javascript widgets
+ $output .= '<h2>'. t('CTools Javascript Widgets') .'</h2>';
+
+ // Create a drop down menu
+ $links = array();
+ $links[] = array('title' => t('Link 1'), 'href' => $_GET['q']);
+ $links[] = array('title' => t('Link 2'), 'href' => $_GET['q']);
+ $links[] = array('title' => t('Link 3'), 'href' => $_GET['q']);
+
+ $output .= '<h3>' . t('Drop Down Menu') . '</h3>';
+ $output .= theme('ctools_dropdown', array('title' => t('Click to Drop Down'), 'links' => $links));
+
+ // Create a collapsible div
+ $handle = t('Click to Collapse');
+ $content = 'Nulla ligula ante, aliquam at adipiscing egestas, varius vel arcu. Etiam laoreet elementum mi vel consequat. Etiam scelerisque lorem vel neque consequat quis bibendum libero congue. Nulla facilisi. Mauris a elit a leo feugiat porta. Phasellus placerat cursus est vitae elementum.';
+ $output .= '<h3>'. t('Collapsible Div') .'</h3>';
+ $output .= theme('ctools_collapsible', array('handle' => $handle, 'content' => $content, 'collapsed' => FALSE));
+
+ // Create a jump menu
+ ctools_include('jump-menu');
+ $form = drupal_get_form('ctools_ajax_sample_jump_menu_form');
+ $output .= '<h3>'. t('Jump Menu') .'</h3>';
+ $output .= drupal_render($form);
+
+ return array('markup' => array('#markup' => $output));
+}
+
+/**
+ * Returns a "take it all over" hello world style request.
+ */
+function ctools_ajax_sample_hello($js = NULL) {
+ $output = '<h1>' . t('Hello World') . '</h1>';
+ if ($js) {
+ ctools_include('ajax');
+ $commands = array();
+ $commands[] = ajax_command_html('#ctools-sample', $output);
+ print ajax_render($commands); // this function exits.
+ exit;
+ }
+ else {
+ return $output;
+ }
+}
+
+/**
+ * Nix a row from a table and restripe.
+ */
+function ctools_ajax_sample_tablenix($js, $row) {
+ if (!$js) {
+ // We don't support degrading this from js because we're not
+ // using the server to remember the state of the table.
+ return MENU_ACCESS_DENIED;
+ }
+ ctools_include('ajax');
+
+ $commands = array();
+ $commands[] = ajax_command_remove("tr.ajax-sample-row-$row");
+ $commands[] = ajax_command_restripe("table.ajax-sample-table");
+ print ajax_render($commands);
+ exit;
+}
+
+/**
+ * A modal login callback.
+ */
+function ctools_ajax_sample_login($js = NULL) {
+ // Fall back if $js is not set.
+ if (!$js) {
+ return drupal_get_form('user_login');
+ }
+
+ ctools_include('modal');
+ ctools_include('ajax');
+ $form_state = array(
+ 'title' => t('Login'),
+ 'ajax' => TRUE,
+ );
+ $output = ctools_modal_form_wrapper('user_login', $form_state);
+ if (!empty($form_state['executed'])) {
+ // We'll just overwrite the form output if it was successful.
+ $output = array();
+ $inplace = ctools_ajax_text_button(t('remain here'), 'ctools_ajax_sample/nojs/login/inplace', t('Go to your account'));
+ $account = ctools_ajax_text_button(t('your account'), 'ctools_ajax_sample/nojs/login/user', t('Go to your account'));
+ $output[] = ctools_modal_command_display(t('Login Success'), '<div class="modal-message">Login successful. You can now choose whether to '. $inplace .', or go to '. $account.'.</div>');
+ }
+ print ajax_render($output);
+ exit;
+}
+
+/**
+ * Post-login processor: should we go to the user account or stay in place?
+ */
+function ctools_ajax_sample_login_success($js, $action) {
+ if (!$js) {
+ // we should never be here out of ajax context
+ return MENU_NOT_FOUND;
+ }
+
+ ctools_include('ajax');
+ ctools_add_js('ajax-responder');
+ $commands = array();
+ if ($action == 'inplace') {
+ // stay here
+ $commands[] = ctools_ajax_command_reload();
+ }
+ else {
+ // bounce bounce
+ $commands[] = ctools_ajax_command_redirect('user');
+ }
+ print ajax_render($commands);
+ exit;
+}
+
+/**
+ * A modal login callback.
+ */
+function ctools_ajax_sample_animal($js = NULL, $step = NULL) {
+ if ($js) {
+ ctools_include('modal');
+ ctools_include('ajax');
+ }
+
+ $form_info = array(
+ 'id' => 'animals',
+ 'path' => "ctools_ajax_sample/" . ($js ? 'ajax' : 'nojs') . "/animal/%step",
+ 'show trail' => TRUE,
+ 'show back' => TRUE,
+ 'show cancel' => TRUE,
+ 'show return' => FALSE,
+ 'next callback' => 'ctools_ajax_sample_wizard_next',
+ 'finish callback' => 'ctools_ajax_sample_wizard_finish',
+ 'cancel callback' => 'ctools_ajax_sample_wizard_cancel',
+ // this controls order, as well as form labels
+ 'order' => array(
+ 'start' => t('Choose animal'),
+ ),
+ // here we map a step to a form id.
+ 'forms' => array(
+ // e.g. this for the step at wombat/create
+ 'start' => array(
+ 'form id' => 'ctools_ajax_sample_start'
+ ),
+ ),
+ );
+
+ // We're not using any real storage here, so we're going to set our
+ // object_id to 1. When using wizard forms, id management turns
+ // out to be one of the hardest parts. Editing an object with an id
+ // is easy, but new objects don't usually have ids until somewhere
+ // in creation.
+ //
+ // We skip all this here by just using an id of 1.
+
+ $object_id = 1;
+
+ if (empty($step)) {
+ // We reset the form when $step is NULL because that means they have
+ // for whatever reason started over.
+ ctools_ajax_sample_cache_clear($object_id);
+ $step = 'start';
+ }
+
+ // This automatically gets defaults if there wasn't anything saved.
+ $object = ctools_ajax_sample_cache_get($object_id);
+
+ $animals = ctools_ajax_sample_animals();
+
+ // Make sure we can't somehow accidentally go to an invalid animal.
+ if (empty($animals[$object->type])) {
+ $object->type = 'unknown';
+ }
+
+ // Now that we have our object, dynamically add the animal's form.
+ if ($object->type == 'unknown') {
+ // If they haven't selected a type, add a form that doesn't exist yet.
+ $form_info['order']['unknown'] = t('Configure animal');
+ $form_info['forms']['unknown'] = array('form id' => 'nothing');
+ }
+ else {
+ // Add the selected animal to the order so that it shows up properly in the trail.
+ $form_info['order'][$object->type] = $animals[$object->type]['config title'];
+ }
+
+ // Make sure all animals forms are represented so that the next stuff can
+ // work correctly:
+ foreach ($animals as $id => $animal) {
+ $form_info['forms'][$id] = array('form id' => $animals[$id]['form']);
+ }
+
+ $form_state = array(
+ 'ajax' => $js,
+ // Put our object and ID into the form state cache so we can easily find
+ // it.
+ 'object_id' => $object_id,
+ 'object' => &$object,
+ );
+
+ // Send this all off to our form. This is like drupal_get_form only wizardy.
+ ctools_include('wizard');
+ $form = ctools_wizard_multistep_form($form_info, $step, $form_state);
+ $output = drupal_render($form);
+
+ if ($output === FALSE || !empty($form_state['complete'])) {
+ // This creates a string based upon the animal and its setting using
+ // function indirection.
+ $animal = $animals[$object->type]['output']($object);
+ }
+
+ // If $output is FALSE, there was no actual form.
+ if ($js) {
+ // If javascript is active, we have to use a render array.
+ $commands = array();
+ if ($output === FALSE || !empty($form_state['complete'])) {
+ // Dismiss the modal.
+ $commands[] = ajax_command_html('#ctools-sample', $animal);
+ $commands[] = ctools_modal_command_dismiss();
+ }
+ else if (!empty($form_state['cancel'])) {
+ // If cancelling, return to the activity.
+ $commands[] = ctools_modal_command_dismiss();
+ }
+ else {
+ $commands = ctools_modal_form_render($form_state, $output);
+ }
+ print ajax_render($commands);
+ exit;
+ }
+ else {
+ if ($output === FALSE || !empty($form_state['complete'])) {
+ return $animal;
+ }
+ else if (!empty($form_state['cancel'])) {
+ drupal_goto('ctools_ajax_sample');
+ }
+ else {
+ return $output;
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Themes
+
+/**
+ * Theme function for main rendered output.
+ */
+function theme_ctools_ajax_sample_container($vars) {
+ $output = '<div id="ctools-sample">';
+ $output .= $vars['content'];
+ $output .= '</div>';
+
+ return $output;
+}
+
+// ---------------------------------------------------------------------------
+// Stuff needed for our little wizard.
+
+/**
+ * Get a list of our animals and associated forms.
+ *
+ * What we're doing is making it easy to add more animals in just one place,
+ * which is often how it will work in the real world. If using CTools, what
+ * you would probably really have, here, is a set of plugins for each animal.
+ */
+function ctools_ajax_sample_animals() {
+ return array(
+ 'sheep' => array(
+ 'title' => t('Sheep'),
+ 'config title' => t('Configure sheep'),
+ 'form' => 'ctools_ajax_sample_configure_sheep',
+ 'output' => 'ctools_ajax_sample_show_sheep',
+ ),
+ 'lizard' => array(
+ 'title' => t('Lizard'),
+ 'config title' => t('Configure lizard'),
+ 'form' => 'ctools_ajax_sample_configure_lizard',
+ 'output' => 'ctools_ajax_sample_show_lizard',
+ ),
+ 'raptor' => array(
+ 'title' => t('Raptor'),
+ 'config title' => t('Configure raptor'),
+ 'form' => 'ctools_ajax_sample_configure_raptor',
+ 'output' => 'ctools_ajax_sample_show_raptor',
+ ),
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Wizard caching helpers.
+
+/**
+ * Store our little cache so that we can retain data from form to form.
+ */
+function ctools_ajax_sample_cache_set($id, $object) {
+ ctools_include('object-cache');
+ ctools_object_cache_set('ctools_ajax_sample', $id, $object);
+}
+
+/**
+ * Get the current object from the cache, or default.
+ */
+function ctools_ajax_sample_cache_get($id) {
+ ctools_include('object-cache');
+ $object = ctools_object_cache_get('ctools_ajax_sample', $id);
+ if (!$object) {
+ // Create a default object.
+ $object = new stdClass;
+ $object->type = 'unknown';
+ $object->name = '';
+ }
+
+ return $object;
+}
+
+/**
+ * Clear the wizard cache.
+ */
+function ctools_ajax_sample_cache_clear($id) {
+ ctools_include('object-cache');
+ ctools_object_cache_clear('ctools_ajax_sample', $id);
+}
+
+// ---------------------------------------------------------------------------
+// Wizard in-between helpers; what to do between or after forms.
+
+/**
+ * Handle the 'next' click on the add/edit pane form wizard.
+ *
+ * All we need to do is store the updated pane in the cache.
+ */
+function ctools_ajax_sample_wizard_next(&$form_state) {
+ ctools_ajax_sample_cache_set($form_state['object_id'], $form_state['object']);
+}
+
+/**
+ * Handle the 'finish' click on teh add/edit pane form wizard.
+ *
+ * All we need to do is set a flag so the return can handle adding
+ * the pane.
+ */
+function ctools_ajax_sample_wizard_finish(&$form_state) {
+ $form_state['complete'] = TRUE;
+}
+
+/**
+ * Handle the 'cancel' click on the add/edit pane form wizard.
+ */
+function ctools_ajax_sample_wizard_cancel(&$form_state) {
+ $form_state['cancel'] = TRUE;
+}
+
+// ---------------------------------------------------------------------------
+// Wizard forms for our simple info collection wizard.
+
+/**
+ * Wizard start form. Choose an animal.
+ */
+function ctools_ajax_sample_start($form, &$form_state) {
+ $form_state['title'] = t('Choose animal');
+
+ $animals = ctools_ajax_sample_animals();
+ foreach ($animals as $id => $animal) {
+ $options[$id] = $animal['title'];
+ }
+
+ $form['type'] = array(
+ '#title' => t('Choose your animal'),
+ '#type' => 'radios',
+ '#options' => $options,
+ '#default_value' => $form_state['object']->type,
+ '#required' => TRUE,
+ );
+
+ return $form;
+}
+
+/**
+ * They have selected a sheep. Set it.
+ */
+function ctools_ajax_sample_start_submit(&$form, &$form_state) {
+ $form_state['object']->type = $form_state['values']['type'];
+ // Override where to go next based on the animal selected.
+ $form_state['clicked_button']['#next'] = $form_state['values']['type'];
+}
+
+/**
+ * Wizard form to configure your sheep.
+ */
+function ctools_ajax_sample_configure_sheep($form, &$form_state) {
+ $form_state['title'] = t('Configure sheep');
+
+ $form['name'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Name your sheep'),
+ '#default_value' => $form_state['object']->name,
+ '#required' => TRUE,
+ );
+
+ $form['sheep'] = array(
+ '#title' => t('What kind of sheep'),
+ '#type' => 'radios',
+ '#options' => array(
+ t('Wensleydale') => t('Wensleydale'),
+ t('Merino') => t('Merino'),
+ t('Corriedale') => t('Coriedale'),
+ ),
+ '#default_value' => !empty($form_state['object']->sheep) ? $form_state['object']->sheep : '',
+ '#required' => TRUE,
+ );
+ return $form;
+}
+
+/**
+ * Submit the sheep and store the values from the form.
+ */
+function ctools_ajax_sample_configure_sheep_submit(&$form, &$form_state) {
+ $form_state['object']->name = $form_state['values']['name'];
+ $form_state['object']->sheep = $form_state['values']['sheep'];
+}
+
+/**
+ * Provide some output for our sheep.
+ */
+function ctools_ajax_sample_show_sheep($object) {
+ return t('You have a @type sheep named "@name".', array(
+ '@type' => $object->sheep,
+ '@name' => $object->name,
+ ));
+}
+
+/**
+ * Wizard form to configure your lizard.
+ */
+function ctools_ajax_sample_configure_lizard($form, &$form_state) {
+ $form_state['title'] = t('Configure lizard');
+
+ $form['name'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Name your lizard'),
+ '#default_value' => $form_state['object']->name,
+ '#required' => TRUE,
+ );
+
+ $form['lizard'] = array(
+ '#title' => t('Venomous'),
+ '#type' => 'checkbox',
+ '#default_value' => !empty($form_state['object']->lizard),
+ );
+ return $form;
+}
+
+/**
+ * Submit the lizard and store the values from the form.
+ */
+function ctools_ajax_sample_configure_lizard_submit(&$form, &$form_state) {
+ $form_state['object']->name = $form_state['values']['name'];
+ $form_state['object']->lizard = $form_state['values']['lizard'];
+}
+
+/**
+ * Provide some output for our raptor.
+ */
+function ctools_ajax_sample_show_lizard($object) {
+ return t('You have a @type lizard named "@name".', array(
+ '@type' => empty($object->lizard) ? t('non-venomous') : t('venomous'),
+ '@name' => $object->name,
+ ));
+}
+
+/**
+ * Wizard form to configure your raptor.
+ */
+function ctools_ajax_sample_configure_raptor($form, &$form_state) {
+ $form_state['title'] = t('Configure raptor');
+
+ $form['name'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Name your raptor'),
+ '#default_value' => $form_state['object']->name,
+ '#required' => TRUE,
+ );
+
+ $form['raptor'] = array(
+ '#title' => t('What kind of raptor'),
+ '#type' => 'radios',
+ '#options' => array(
+ t('Eagle') => t('Eagle'),
+ t('Hawk') => t('Hawk'),
+ t('Owl') => t('Owl'),
+ t('Buzzard') => t('Buzzard'),
+ ),
+ '#default_value' => !empty($form_state['object']->raptor) ? $form_state['object']->raptor : '',
+ '#required' => TRUE,
+ );
+
+ $form['domesticated'] = array(
+ '#title' => t('Domesticated'),
+ '#type' => 'checkbox',
+ '#default_value' => !empty($form_state['object']->domesticated),
+ );
+ return $form;
+}
+
+/**
+ * Submit the raptor and store the values from the form.
+ */
+function ctools_ajax_sample_configure_raptor_submit(&$form, &$form_state) {
+ $form_state['object']->name = $form_state['values']['name'];
+ $form_state['object']->raptor = $form_state['values']['raptor'];
+ $form_state['object']->domesticated = $form_state['values']['domesticated'];
+}
+
+/**
+ * Provide some output for our raptor.
+ */
+function ctools_ajax_sample_show_raptor($object) {
+ return t('You have a @type @raptor named "@name".', array(
+ '@type' => empty($object->domesticated) ? t('wild') : t('domesticated'),
+ '@raptor' => $object->raptor,
+ '@name' => $object->name,
+ ));
+}
+
+/**
+ * Helper function to provide a sample jump menu form
+ */
+function ctools_ajax_sample_jump_menu_form() {
+ $url = url('ctools_ajax_sample/jumped');
+ $form_state = array();
+ $form = ctools_jump_menu(array(), $form_state, array($url => t('Jump!')), array());
+ return $form;
+}
+
+/**
+ * Provide a message to the user that the jump menu worked
+ */
+function ctools_ajax_sample_jump_menu_page() {
+ $return_link = l(t('Return to the examples page.'), 'ctools_ajax_sample');
+ $output = t('You successfully jumped! !return_link', array('!return_link' => $return_link));
+ return $output;
+}
+
+/**
+ * Provide a form for an example ajax modal button
+ */
+function ctools_ajax_sample_ajax_button_form() {
+ $form = array();
+
+ $form['url'] = array(
+ '#type' => 'hidden',
+ // The name of the class is the #id of $form['ajax_button'] with "-url"
+ // suffix.
+ '#attributes' => array('class' => array('ctools-ajax-sample-button-url')),
+ '#value' => url('ctools_ajax_sample/nojs/animal'),
+ );
+
+ $form['ajax_button'] = array(
+ '#type' => 'button',
+ '#value' => 'Wizard (button modal)',
+ '#attributes' => array('class' => array('ctools-use-modal')),
+ '#id' => 'ctools-ajax-sample-button',
+ );
+
+ return $form;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/ajax-loader.gif b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/ajax-loader.gif
new file mode 100644
index 0000000..d84f653
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/ajax-loader.gif
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/loading-large.gif b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/loading-large.gif
new file mode 100644
index 0000000..1c72ebb
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/loading-large.gif
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/loading.gif b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/loading.gif
new file mode 100644
index 0000000..dc21df1
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/loading.gif
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/popups-border.png b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/popups-border.png
new file mode 100644
index 0000000..ba939f8
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/images/popups-border.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/js/ctools-ajax-sample.js b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/js/ctools-ajax-sample.js
new file mode 100644
index 0000000..0cbfc87
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_ajax_sample/js/ctools-ajax-sample.js
@@ -0,0 +1,42 @@
+/**
+* Provide the HTML to create the modal dialog.
+*/
+Drupal.theme.prototype.CToolsSampleModal = function () {
+ var html = '';
+
+ html += '<div id="ctools-modal" class="popups-box">';
+ html += ' <div class="ctools-modal-content ctools-sample-modal-content">';
+ html += ' <table cellpadding="0" cellspacing="0" id="ctools-face-table">';
+ html += ' <tr>';
+ html += ' <td class="popups-tl popups-border"></td>';
+ html += ' <td class="popups-t popups-border"></td>';
+ html += ' <td class="popups-tr popups-border"></td>';
+ html += ' </tr>';
+ html += ' <tr>';
+ html += ' <td class="popups-cl popups-border"></td>';
+ html += ' <td class="popups-c" valign="top">';
+ html += ' <div class="popups-container">';
+ html += ' <div class="modal-header popups-title">';
+ html += ' <span id="modal-title" class="modal-title"></span>';
+ html += ' <span class="popups-close"><a class="close" href="#">' + Drupal.CTools.Modal.currentSettings.closeText + '</a></span>';
+ html += ' <div class="clear-block"></div>';
+ html += ' </div>';
+ html += ' <div class="modal-scroll"><div id="modal-content" class="modal-content popups-body"></div></div>';
+ html += ' <div class="popups-buttons"></div>'; //Maybe someday add the option for some specific buttons.
+ html += ' <div class="popups-footer"></div>'; //Maybe someday add some footer.
+ html += ' </div>';
+ html += ' </td>';
+ html += ' <td class="popups-cr popups-border"></td>';
+ html += ' </tr>';
+ html += ' <tr>';
+ html += ' <td class="popups-bl popups-border"></td>';
+ html += ' <td class="popups-b popups-border"></td>';
+ html += ' <td class="popups-br popups-border"></td>';
+ html += ' </tr>';
+ html += ' </table>';
+ html += ' </div>';
+ html += '</div>';
+
+ return html;
+
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info
new file mode 100644
index 0000000..75a2a93
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info
@@ -0,0 +1,12 @@
+name = Custom content panes
+description = Create custom, exportable, reusable content panes for applications like Panels.
+core = 7.x
+package = Chaos tool suite
+dependencies[] = ctools
+
+; Information added by drupal.org packaging script on 2012-08-08
+version = "7.x-1.1"
+core = "7.x"
+project = "ctools"
+datestamp = "1344463011"
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.install b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.install
new file mode 100644
index 0000000..8348434
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.install
@@ -0,0 +1,67 @@
+<?php
+
+/**
+ * Schema for CTools custom content.
+ */
+function ctools_custom_content_schema() {
+ return ctools_custom_content_schema_1();
+}
+
+function ctools_custom_content_schema_1() {
+ $schema = array();
+
+ $schema['ctools_custom_content'] = array(
+ 'description' => 'Contains exportable customized content for this site.',
+ 'export' => array(
+ 'identifier' => 'content',
+ 'bulk export' => TRUE,
+ 'primary key' => 'cid',
+ 'api' => array(
+ 'owner' => 'ctools',
+ 'api' => 'ctools_content',
+ 'minimum_version' => 1,
+ 'current_version' => 1,
+ ),
+ 'create callback' => 'ctools_content_type_new',
+ ),
+ 'fields' => array(
+ 'cid' => array(
+ 'type' => 'serial',
+ 'description' => 'A database primary key to ensure uniqueness',
+ 'not null' => TRUE,
+ 'no export' => TRUE,
+ ),
+ 'name' => array(
+ 'type' => 'varchar',
+ 'length' => '255',
+ 'description' => 'Unique ID for this content. Used to identify it programmatically.',
+ ),
+ 'admin_title' => array(
+ 'type' => 'varchar',
+ 'length' => '255',
+ 'description' => 'Administrative title for this content.',
+ ),
+ 'admin_description' => array(
+ 'type' => 'text',
+ 'size' => 'big',
+ 'description' => 'Administrative description for this content.',
+ 'object default' => '',
+ ),
+ 'category' => array(
+ 'type' => 'varchar',
+ 'length' => '255',
+ 'description' => 'Administrative category for this content.',
+ ),
+ 'settings' => array(
+ 'type' => 'text',
+ 'size' => 'big',
+ 'description' => 'Serialized settings for the actual content to be used',
+ 'serialize' => TRUE,
+ 'object default' => array(),
+ ),
+ ),
+ 'primary key' => array('cid'),
+ );
+
+ return $schema;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.module b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.module
new file mode 100644
index 0000000..a2e8ee2
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.module
@@ -0,0 +1,98 @@
+<?php
+
+/**
+ * @file
+ * ctools_custom_content module
+ *
+ * This module allows styles to be created and managed on behalf of modules
+ * that implement styles.
+ *
+ * The ctools_custom_content tool allows recolorable styles to be created via a miniature
+ * scripting language. Panels utilizes this to allow administrators to add
+ * styles directly to any panel display.
+ */
+
+/**
+ * Implementation of hook_permission()
+ */
+function ctools_custom_content_permission() {
+ return array(
+ 'administer custom content' => array(
+ 'title' => t('Administer custom content'),
+ 'description' => t('Add, edit and delete CTools custom stored custom content'),
+ ),
+ );
+}
+
+/**
+ * Implementation of hook_ctools_plugin_directory() to let the system know
+ * we implement task and task_handler plugins.
+ */
+function ctools_custom_content_ctools_plugin_directory($module, $plugin) {
+ // Most of this module is implemented as an export ui plugin, and the
+ // rest is in ctools/includes/ctools_custom_content.inc
+ if ($module == 'ctools' && $plugin == 'export_ui') {
+ return 'plugins/' . $plugin;
+ }
+}
+
+/**
+ * Create callback for creating a new CTools custom content type.
+ *
+ * This ensures we get proper defaults from the plugin for its settings.
+ */
+function ctools_content_type_new($set_defaults) {
+ $item = ctools_export_new_object('ctools_custom_content', $set_defaults);
+ ctools_include('content');
+ $plugin = ctools_get_content_type('custom');
+ $item->settings = ctools_content_get_defaults($plugin, array());
+ return $item;
+}
+
+/**
+ * Implementation of hook_panels_dashboard_blocks().
+ *
+ * Adds page information to the Panels dashboard.
+ */
+function ctools_custom_content_panels_dashboard_blocks(&$vars) {
+ $vars['links']['ctools_custom_content'] = array(
+ 'title' => l(t('Custom content'), 'admin/structure/ctools-content/add'),
+ 'description' => t('Custom content panes are basic HTML you enter that can be reused in all of your panels.'),
+ );
+
+ // Load all mini panels and their displays.
+ ctools_include('export');
+ $items = ctools_export_crud_load_all('ctools_custom_content');
+ $count = 0;
+ $rows = array();
+
+ foreach ($items as $item) {
+ $rows[] = array(
+ check_plain($item->admin_title),
+ array(
+ 'data' => l(t('Edit'), "admin/structure/ctools-content/list/$item->name/edit"),
+ 'class' => 'links',
+ ),
+ );
+
+ // Only show 10.
+ if (++$count >= 10) {
+ break;
+ }
+ }
+
+ if ($rows) {
+ $content = theme('table', array('rows' => $rows, 'attributes' => array('class' => 'panels-manage')));
+ }
+ else {
+ $content = '<p>' . t('There are no custom content panes.') . '</p>';
+ }
+
+ $vars['blocks']['ctools_custom_content'] = array(
+ 'title' => t('Manage custom content'),
+ 'link' => l(t('Go to list'), 'admin/structure/ctools-content'),
+ 'content' => $content,
+ 'class' => 'dashboard-content',
+ 'section' => 'right',
+ );
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc
new file mode 100644
index 0000000..467dc58
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc
@@ -0,0 +1,20 @@
+<?php
+
+$plugin = array(
+ 'schema' => 'ctools_custom_content',
+ 'access' => 'administer custom content',
+
+ 'menu' => array(
+ 'menu item' => 'ctools-content',
+ 'menu title' => 'Custom content panes',
+ 'menu description' => 'Add, edit or delete custom content panes.',
+ ),
+
+ 'title singular' => t('content pane'),
+ 'title singular proper' => t('Content pane'),
+ 'title plural' => t('content panes'),
+ 'title plural proper' => t('Content panes'),
+
+ 'handler' => 'ctools_custom_content_ui',
+);
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php
new file mode 100644
index 0000000..56fe4b2
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php
@@ -0,0 +1,129 @@
+<?php
+
+class ctools_custom_content_ui extends ctools_export_ui {
+
+ function edit_form(&$form, &$form_state) {
+ // Correct for an error that came in because filter format changed.
+ if (is_array($form_state['item']->settings['body'])) {
+ $form_state['item']->settings['format'] = $form_state['item']->settings['body']['format'];
+ $form_state['item']->settings['body'] = $form_state['item']->settings['body']['value'];
+ }
+ parent::edit_form($form, $form_state);
+
+ $form['category'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Category'),
+ '#description' => t('What category this content should appear in. If left blank the category will be "Miscellaneous".'),
+ '#default_value' => $form_state['item']->category,
+ );
+
+ $form['title'] = array(
+ '#type' => 'textfield',
+ '#default_value' => $form_state['item']->settings['title'],
+ '#title' => t('Title'),
+ );
+
+ $form['body'] = array(
+ '#type' => 'text_format',
+ '#title' => t('Body'),
+ '#default_value' => $form_state['item']->settings['body'],
+ '#format' => $form_state['item']->settings['format'],
+ );
+
+ $form['substitute'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Use context keywords'),
+ '#description' => t('If checked, context keywords will be substituted in this content.'),
+ '#default_value' => !empty($form_state['item']->settings['substitute']),
+ );
+ }
+
+ function edit_form_submit(&$form, &$form_state) {
+ parent::edit_form_submit($form, $form_state);
+
+ // Since items in our settings are not in the schema, we have to do these manually:
+ $form_state['item']->settings['title'] = $form_state['values']['title'];
+ $form_state['item']->settings['body'] = $form_state['values']['body']['value'];
+ $form_state['item']->settings['format'] = $form_state['values']['body']['format'];
+ $form_state['item']->settings['substitute'] = $form_state['values']['substitute'];
+ }
+
+ function list_form(&$form, &$form_state) {
+ parent::list_form($form, $form_state);
+
+ $options = array('all' => t('- All -'));
+ foreach ($this->items as $item) {
+ $options[$item->category] = $item->category;
+ }
+
+ $form['top row']['category'] = array(
+ '#type' => 'select',
+ '#title' => t('Category'),
+ '#options' => $options,
+ '#default_value' => 'all',
+ '#weight' => -10,
+ );
+ }
+
+ function list_filter($form_state, $item) {
+ if ($form_state['values']['category'] != 'all' && $form_state['values']['category'] != $item->category) {
+ return TRUE;
+ }
+
+ return parent::list_filter($form_state, $item);
+ }
+
+ function list_sort_options() {
+ return array(
+ 'disabled' => t('Enabled, title'),
+ 'title' => t('Title'),
+ 'name' => t('Name'),
+ 'category' => t('Category'),
+ 'storage' => t('Storage'),
+ );
+ }
+
+ function list_build_row($item, &$form_state, $operations) {
+ // Set up sorting
+ switch ($form_state['values']['order']) {
+ case 'disabled':
+ $this->sorts[$item->name] = empty($item->disabled) . $item->admin_title;
+ break;
+ case 'title':
+ $this->sorts[$item->name] = $item->admin_title;
+ break;
+ case 'name':
+ $this->sorts[$item->name] = $item->name;
+ break;
+ case 'category':
+ $this->sorts[$item->name] = $item->category;
+ break;
+ case 'storage':
+ $this->sorts[$item->name] = $item->type . $item->admin_title;
+ break;
+ }
+
+ $ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
+
+ $this->rows[$item->name] = array(
+ 'data' => array(
+ array('data' => check_plain($item->name), 'class' => array('ctools-export-ui-name')),
+ array('data' => check_plain($item->admin_title), 'class' => array('ctools-export-ui-title')),
+ array('data' => check_plain($item->category), 'class' => array('ctools-export-ui-category')),
+ array('data' => $ops, 'class' => array('ctools-export-ui-operations')),
+ ),
+ 'title' => check_plain($item->admin_description),
+ 'class' => array(!empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled'),
+ );
+ }
+
+ function list_table_header() {
+ return array(
+ array('data' => t('Name'), 'class' => array('ctools-export-ui-name')),
+ array('data' => t('Title'), 'class' => array('ctools-export-ui-title')),
+ array('data' => t('Category'), 'class' => array('ctools-export-ui-category')),
+ array('data' => t('Operations'), 'class' => array('ctools-export-ui-operations')),
+ );
+ }
+
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/README.txt b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/README.txt
new file mode 100644
index 0000000..42edcdc
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/README.txt
@@ -0,0 +1,14 @@
+
+The CTools Plugin Example is an example for developers of how to CTools
+access, argument, content type, context, and relationship plugins.
+
+There are a number of ways to profit from this:
+
+1. The code itself intends to be as simple and self-explanatory as possible.
+ Nothing fancy is attempted: It's just trying to use the plugin API to show
+ how it can be used.
+
+2. There is a sample panel. You can access it at /ctools_plugin_example/xxxx
+ to see how it works.
+
+3. There is Advanced Help at admin/advanced_help/ctools_plugin_example. \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info
new file mode 100644
index 0000000..3b11096
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info
@@ -0,0 +1,15 @@
+name = Chaos Tools (CTools) Plugin Example
+description = Shows how an external module can provide ctools plugins (for Panels, etc.).
+package = Chaos tool suite
+dependencies[] = ctools
+dependencies[] = panels
+dependencies[] = page_manager
+dependencies[] = advanced_help
+core = 7.x
+
+; Information added by drupal.org packaging script on 2012-08-08
+version = "7.x-1.1"
+core = "7.x"
+project = "ctools"
+datestamp = "1344463011"
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.module b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.module
new file mode 100644
index 0000000..442969d
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.module
@@ -0,0 +1,94 @@
+<?php
+
+/*
+ * @file
+ *
+ * Working sample module to demonstrate CTools 3 plugins
+ *
+ * This sample module is only intended to demonstrate how external modules can
+ * provide ctools plugins. There is no useful functionality, and it's only
+ * intended for developers or for educational use.
+ *
+ * As far as possible, everything is kept very simple, not exercising all of
+ * the capabilities of CTools or Panels.
+ *
+ * Although the ctools documentation suggests that strict naming conventions
+ * be followed, this code attempts to follow only the conventions which are
+ * required (the hooks), in order to demonstrate the difference. You can
+ * certainly use the conventions, but it's important to know the difference
+ * between a convention and a requirement.
+ *
+ * The advanced_help module is required, because both CTools and this module
+ * provide help that way.
+ *
+ * There is a demonstration panel provided at /ctools_plugin_example/123
+ */
+
+/**
+ * Implements hook_menu
+ */
+function ctools_plugin_example_menu() {
+ $items = array();
+
+ $items["admin/settings/ctools_plugin_example"] = array(
+ 'title' => 'CTools plugin example',
+ 'description' => t("Demonstration code, advanced help, and a demo panel to show how to build ctools plugins."),
+ 'page callback' => 'ctools_plugin_example_explanation_page',
+ 'access arguments' => array('administer site configuration'),
+ 'type' => MENU_NORMAL_ITEM,
+ );
+
+ return $items;
+}
+
+/**
+ * Implements hook_ctools_plugin_directory().
+ *
+ * It simply tells panels where to find the .inc files that define various
+ * args, contexts, content_types. In this case the subdirectories of
+ * ctools_plugin_example/panels are used.
+ */
+function ctools_plugin_example_ctools_plugin_directory($module, $plugin) {
+ if ($module == 'ctools' && !empty($plugin)) {
+ return "plugins/$plugin";
+ }
+}
+
+/**
+ * Implement hook_ctools_plugin_api().
+ *
+ * If you do this, CTools will pick up default panels pages in
+ * <modulename>.pages_default.inc
+ */
+function ctools_plugin_example_ctools_plugin_api($module, $api) {
+ // @todo -- this example should explain how to put it in a different file.
+ if ($module == 'panels_mini' && $api == 'panels_default') {
+ return array('version' => 1);
+ }
+ if ($module == 'page_manager' && $api == 'pages_default') {
+ return array('version' => 1);
+ }
+}
+
+/**
+ * Just provide an explanation page for the admin section
+ * @return unknown_type
+ */
+function ctools_plugin_example_explanation_page() {
+ $content = '<p>' . t("The CTools Plugin Example is simply a developer's demo of how to create plugins for CTools. It provides no useful functionality for an ordinary user.") . '</p>';
+
+ $content .= '<p>' . t(
+ 'There is a demo panel demonstrating much of the functionality provided at
+ <a href="@demo_url">CTools demo panel</a>, and you can find documentation on the examples at
+ !ctools_plugin_example_help.
+ CTools itself provides documentation at !ctools_help. Mostly, though, the code itself is intended to be the teacher.
+ You can find it in %path.',
+ array(
+ '@demo_url' => url('ctools_plugin_example/xxxxx'),
+ '!ctools_plugin_example_help' => theme('advanced_help_topic', 'ctools_plugin_example', 'Chaos-Tools--CTools--Plugin-Examples', 'title'),
+ '!ctools_help' => theme('advanced_help_topic', 'ctools', 'plugins', 'title'),
+ '%path' => drupal_get_path('module', 'ctools_plugin_example'),
+ )) . '</p>';
+
+ return $content;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc
new file mode 100644
index 0000000..10a7619
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc
@@ -0,0 +1,451 @@
+<?php
+
+/**
+ * @file
+ * This module provides default panels to demonstrate the behavior of the plugins.
+ */
+
+/**
+ * Default panels pages for CTools Plugin Example
+ *
+ * To pick up this file, your module needs to implement
+ * hook_ctools_plugin_api() - See ctools_plugin_example_ctools_plugin_api() in
+ * ctools_plugin_example.module.
+ *
+ *
+ * Note the naming of the file: <modulename>.pages_default.inc
+ * With this naming, no additional code needs to be provided. CTools will just find the file.
+ * The name of the hook is <modulename>_default_page_manager_pages()
+ *
+ * This example provides two pages, but the returned array could
+ * have several pages.
+ *
+ * @return
+ * Array of pages, normally exported from Panels.
+ */
+
+function ctools_plugin_example_default_page_manager_pages() {
+
+ // begin exported panel.
+
+ $page = new stdClass;
+ $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
+ $page->api_version = 1;
+ $page->name = 'ctools_plugin_example';
+ $page->task = 'page';
+ $page->admin_title = 'CTools plugin example';
+ $page->admin_description = 'This panel provides no functionality to a working Drupal system. It\'s intended to display the various sample plugins provided by the CTools Plugin Example module. ';
+ $page->path = 'ctools_plugin_example/%sc';
+ $page->access = array(
+ 'logic' => 'and',
+ );
+ $page->menu = array(
+ 'type' => 'normal',
+ 'title' => 'CTools plugin example',
+ 'name' => 'navigation',
+ 'weight' => '0',
+ 'parent' => array(
+ 'type' => 'none',
+ 'title' => '',
+ 'name' => 'navigation',
+ 'weight' => '0',
+ ),
+ );
+ $page->arguments = array(
+ 'sc' => array(
+ 'id' => 2,
+ 'identifier' => 'simplecontext-arg',
+ 'name' => 'simplecontext_arg',
+ 'settings' => array(),
+ ),
+ );
+ $page->conf = array();
+ $page->default_handlers = array();
+ $handler = new stdClass;
+ $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
+ $handler->api_version = 1;
+ $handler->name = 'page_ctools_panel_context';
+ $handler->task = 'page';
+ $handler->subtask = 'ctools_plugin_example';
+ $handler->handler = 'panel_context';
+ $handler->weight = 0;
+ $handler->conf = array(
+ 'title' => 'Panel',
+ 'no_blocks' => FALSE,
+ 'css_id' => '',
+ 'css' => '',
+ 'contexts' => array(
+ '0' => array(
+ 'name' => 'simplecontext',
+ 'id' => 1,
+ 'identifier' => 'Configured simplecontext (not from argument)',
+ 'keyword' => 'configured_simplecontext',
+ 'context_settings' => array(
+ 'sample_simplecontext_setting' => 'default simplecontext setting',
+ ),
+ ),
+ ),
+ 'relationships' => array(
+ '0' => array(
+ 'context' => 'argument_simplecontext_arg_2',
+ 'name' => 'relcontext_from_simplecontext',
+ 'id' => 1,
+ 'identifier' => 'Relcontext from simplecontext (from relationship)',
+ 'keyword' => 'relcontext',
+ ),
+ ),
+ 'access' => array(
+ 'logic' => 'and',
+ ),
+ );
+ $display = new panels_display;
+ $display->layout = 'threecol_33_34_33_stacked';
+ $display->layout_settings = array();
+ $display->panel_settings = array(
+ 'style' => 'rounded_corners',
+ 'style_settings' => array(
+ 'default' => array(
+ 'corner_location' => 'pane',
+ ),
+ ),
+ );
+ $display->cache = array();
+ $display->title = 'CTools plugin example panel';
+ $display->hide_title = FALSE;
+ $display->title_pane = 1;
+ $display->content = array();
+ $display->panels = array();
+ $pane = new stdClass;
+ $pane->pid = 'new-1';
+ $pane->panel = 'left';
+ $pane->type = 'no_context_content_type';
+ $pane->subtype = 'no_context_content_type';
+ $pane->shown = TRUE;
+ $pane->access = array();
+ $pane->configuration = array(
+ 'item1' => 'contents of config item 1',
+ 'item2' => 'contents of config item 2',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ );
+ $pane->cache = array();
+ $pane->style = array();
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 0;
+ $display->content['new-1'] = $pane;
+ $display->panels['left'][0] = 'new-1';
+ $pane = new stdClass;
+ $pane->pid = 'new-2';
+ $pane->panel = 'left';
+ $pane->type = 'custom';
+ $pane->subtype = 'custom';
+ $pane->shown = TRUE;
+ $pane->access = array(
+ 'plugins' => array(
+ '0' => array(
+ 'name' => 'arg_length',
+ 'settings' => array(
+ 'greater_than' => '1',
+ 'arg_length' => '4',
+ ),
+ 'context' => 'argument_simplecontext_arg_2',
+ ),
+ ),
+ );
+ $pane->configuration = array(
+ 'title' => 'Long Arg Visibility Block',
+ 'body' => 'This block will be here when the argument is longer than configured arg length. It uses the \'arg_length\' access plugin to test against the length of the argument used for Simplecontext.',
+ 'format' => '1',
+ 'substitute' => 1,
+ );
+ $pane->cache = array();
+ $pane->style = array();
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 1;
+ $display->content['new-2'] = $pane;
+ $display->panels['left'][1] = 'new-2';
+ $pane = new stdClass;
+ $pane->pid = 'new-3';
+ $pane->panel = 'left';
+ $pane->type = 'custom';
+ $pane->subtype = 'custom';
+ $pane->shown = TRUE;
+ $pane->access = array(
+ 'plugins' => array(
+ '0' => array(
+ 'name' => 'arg_length',
+ 'settings' => array(
+ 'greater_than' => '0',
+ 'arg_length' => '4',
+ ),
+ 'context' => 'argument_simplecontext_arg_2',
+ ),
+ ),
+ );
+ $pane->configuration = array(
+ 'title' => 'Short Arg Visibility',
+ 'body' => 'This block appears when the simplecontext argument is <i>less than</i> the configured length.',
+ 'format' => '1',
+ 'substitute' => 1,
+ );
+ $pane->cache = array();
+ $pane->style = array();
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 2;
+ $display->content['new-3'] = $pane;
+ $display->panels['left'][2] = 'new-3';
+ $pane = new stdClass;
+ $pane->pid = 'new-4';
+ $pane->panel = 'middle';
+ $pane->type = 'simplecontext_content_type';
+ $pane->subtype = 'simplecontext_content_type';
+ $pane->shown = TRUE;
+ $pane->access = array();
+ $pane->configuration = array(
+ 'buttons' => NULL,
+ '#validate' => NULL,
+ '#submit' => NULL,
+ '#action' => NULL,
+ 'context' => 'argument_simplecontext_arg_2',
+ 'aligner_start' => NULL,
+ 'override_title' => 1,
+ 'override_title_text' => 'Simplecontext (with an arg)',
+ 'aligner_stop' => NULL,
+ 'override_title_markup' => NULL,
+ 'config_item_1' => 'Config item 1 contents',
+ '#build_id' => NULL,
+ '#type' => NULL,
+ '#programmed' => NULL,
+ 'form_build_id' => 'form-19c4ae6cb54fad8f096da46e95694e5a',
+ '#token' => NULL,
+ 'form_token' => '17141d3531eaa7b609da78afa6f3b560',
+ 'form_id' => 'simplecontext_content_type_edit_form',
+ '#id' => NULL,
+ '#description' => NULL,
+ '#attributes' => NULL,
+ '#required' => NULL,
+ '#tree' => NULL,
+ '#parents' => NULL,
+ '#method' => NULL,
+ '#post' => NULL,
+ '#processed' => NULL,
+ '#defaults_loaded' => NULL,
+ );
+ $pane->cache = array();
+ $pane->style = array();
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 0;
+ $display->content['new-4'] = $pane;
+ $display->panels['middle'][0] = 'new-4';
+ $pane = new stdClass;
+ $pane->pid = 'new-5';
+ $pane->panel = 'middle';
+ $pane->type = 'simplecontext_content_type';
+ $pane->subtype = 'simplecontext_content_type';
+ $pane->shown = TRUE;
+ $pane->access = array();
+ $pane->configuration = array(
+ 'buttons' => NULL,
+ '#validate' => NULL,
+ '#submit' => NULL,
+ '#action' => NULL,
+ 'context' => 'context_simplecontext_1',
+ 'aligner_start' => NULL,
+ 'override_title' => 1,
+ 'override_title_text' => 'Configured simplecontext content type (not from arg)',
+ 'aligner_stop' => NULL,
+ 'override_title_markup' => NULL,
+ 'config_item_1' => '(configuration for simplecontext)',
+ '#build_id' => NULL,
+ '#type' => NULL,
+ '#programmed' => NULL,
+ 'form_build_id' => 'form-d016200490abd015dc5b8a7e366d76ea',
+ '#token' => NULL,
+ 'form_token' => '17141d3531eaa7b609da78afa6f3b560',
+ 'form_id' => 'simplecontext_content_type_edit_form',
+ '#id' => NULL,
+ '#description' => NULL,
+ '#attributes' => NULL,
+ '#required' => NULL,
+ '#tree' => NULL,
+ '#parents' => NULL,
+ '#method' => NULL,
+ '#post' => NULL,
+ '#processed' => NULL,
+ '#defaults_loaded' => NULL,
+ );
+ $pane->cache = array();
+ $pane->style = array();
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 1;
+ $display->content['new-5'] = $pane;
+ $display->panels['middle'][1] = 'new-5';
+ $pane = new stdClass;
+ $pane->pid = 'new-6';
+ $pane->panel = 'middle';
+ $pane->type = 'custom';
+ $pane->subtype = 'custom';
+ $pane->shown = TRUE;
+ $pane->access = array();
+ $pane->configuration = array(
+ 'admin_title' => 'Simplecontext keyword usage',
+ 'title' => 'Simplecontext keyword usage',
+ 'body' => 'Demonstrating context keyword usage:
+ item1 is %sc:item1
+ item2 is %sc:item2
+ description is %sc:description',
+ 'format' => '1',
+ 'substitute' => 1,
+ );
+ $pane->cache = array();
+ $pane->style = array();
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 2;
+ $display->content['new-6'] = $pane;
+ $display->panels['middle'][2] = 'new-6';
+ $pane = new stdClass;
+ $pane->pid = 'new-7';
+ $pane->panel = 'right';
+ $pane->type = 'relcontext_content_type';
+ $pane->subtype = 'relcontext_content_type';
+ $pane->shown = TRUE;
+ $pane->access = array();
+ $pane->configuration = array(
+ 'buttons' => NULL,
+ '#validate' => NULL,
+ '#submit' => NULL,
+ '#action' => NULL,
+ 'context' => 'relationship_relcontext_from_simplecontext_1',
+ 'aligner_start' => NULL,
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ 'aligner_stop' => NULL,
+ 'override_title_markup' => NULL,
+ 'config_item_1' => 'some stuff in this one',
+ '#build_id' => NULL,
+ '#type' => NULL,
+ '#programmed' => NULL,
+ 'form_build_id' => 'form-8485f84511bd06e51b4a48e998448054',
+ '#token' => NULL,
+ 'form_token' => '1c3356396374d51d7d2531a10fd25310',
+ 'form_id' => 'relcontext_edit_form',
+ '#id' => NULL,
+ '#description' => NULL,
+ '#attributes' => NULL,
+ '#required' => NULL,
+ '#tree' => NULL,
+ '#parents' => NULL,
+ '#method' => NULL,
+ '#post' => NULL,
+ '#processed' => NULL,
+ '#defaults_loaded' => NULL,
+ );
+ $pane->cache = array();
+ $pane->style = array();
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 0;
+ $display->content['new-7'] = $pane;
+ $display->panels['right'][0] = 'new-7';
+ $pane = new stdClass;
+ $pane->pid = 'new-8';
+ $pane->panel = 'top';
+ $pane->type = 'custom';
+ $pane->subtype = 'custom';
+ $pane->shown = TRUE;
+ $pane->access = array();
+ $pane->configuration = array(
+ 'title' => 'Demonstrating ctools plugins',
+ 'body' => 'The CTools Plugin Example module (and this panel page) are just here to demonstrate how to build CTools plugins.
+
+ ',
+ 'format' => '2',
+ 'substitute' => 1,
+ );
+ $pane->cache = array();
+ $pane->style = array();
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 0;
+ $display->content['new-8'] = $pane;
+ $display->panels['top'][0] = 'new-8';
+ $handler->conf['display'] = $display;
+ $page->default_handlers[$handler->name] = $handler;
+
+ // end of exported panel.
+ $pages['ctools_plugin_example_demo_page'] = $page;
+
+ // begin exported panel
+
+ $page = new stdClass;
+ $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
+ $page->api_version = 1;
+ $page->name = 'ctools_plugin_example_base';
+ $page->task = 'page';
+ $page->admin_title = 'CTools Plugin Example base page';
+ $page->admin_description = 'This panel is for when people hit /ctools_plugin_example without an argument. We can use it to tell people to move on.';
+ $page->path = 'ctools_plugin_example';
+ $page->access = array();
+ $page->menu = array();
+ $page->arguments = array();
+ $page->conf = array();
+ $page->default_handlers = array();
+ $handler = new stdClass;
+ $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
+ $handler->api_version = 1;
+ $handler->name = 'page_ctools_plugin_example_base_panel_context';
+ $handler->task = 'page';
+ $handler->subtask = 'ctools_plugin_example_base';
+ $handler->handler = 'panel_context';
+ $handler->weight = 0;
+ $handler->conf = array(
+ 'title' => 'Panel',
+ 'no_blocks' => FALSE,
+ 'css_id' => '',
+ 'css' => '',
+ 'contexts' => array(),
+ 'relationships' => array(),
+ );
+ $display = new panels_display;
+ $display->layout = 'onecol';
+ $display->layout_settings = array();
+ $display->panel_settings = array();
+ $display->cache = array();
+ $display->title = '';
+ $display->hide_title = FALSE;
+ $display->content = array();
+ $display->panels = array();
+ $pane = new stdClass;
+ $pane->pid = 'new-1';
+ $pane->panel = 'middle';
+ $pane->type = 'custom';
+ $pane->subtype = 'custom';
+ $pane->shown = TRUE;
+ $pane->access = array();
+ $pane->configuration = array(
+ 'title' => 'Use this page with an argument',
+ 'body' => 'This demo page works if you use an argument, like <a href="ctools_plugin_example/xxxxx">ctools_plugin_example/xxxxx</a>.',
+ 'format' => '1',
+ 'substitute' => NULL,
+ );
+ $pane->cache = array();
+ $pane->style = array();
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 0;
+ $display->content['new-1'] = $pane;
+ $display->panels['middle'][0] = 'new-1';
+ $handler->conf['display'] = $display;
+ $page->default_handlers[$handler->name] = $handler;
+ // end exported panel.
+
+ $pages['base_page'] = $page;
+
+ return $pages;
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html
new file mode 100644
index 0000000..781260e
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html
@@ -0,0 +1,17 @@
+<div id="node-16" class="node">
+
+
+
+
+ <div class="content clear-block">
+ <p>We can use access plugins to determine access to a page or visibility of the panes in a page. Basically, we just determine access based on configuration settings and the various contexts that are available to us.</p>
+<p>The arbitrary example in plugins/access/arg_length.inc determines access based on the length of the simplecontext argument. You can configure whether access should be granted if the simplecontext argument is greater or less than some number.</p>
+ </div>
+
+ <div class="clear-block">
+ <div class="meta">
+ </div>
+
+ </div>
+
+</div>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html
new file mode 100644
index 0000000..4dd569d
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html
@@ -0,0 +1,20 @@
+<div id="node-12" class="node">
+
+
+
+
+ <div class="content clear-block">
+ <p>Contexts are fundamental to CTools, and they almost always start with an argument to a panels page, so we'll start there too.</p>
+<p>We first need to process an argument.</p>
+<p>We're going to work with a "Simplecontext" context type and argument, and then with a content type that displays it. So we'll start by with the Simplecontext argument plugin in plugins/arguments/simplecontext_arg.inc.</p>
+<p>Note that the name of the file (simplecontext_arg.inc) is built from the machine name of our plugin (simplecontext_arg). And note also that the primary function that we use to provide our argument (ctools_plugin_example_simplecontext_arg_ctools_arguments()) is also built from the machine name. This magic is most of the naming magic that you have to know.</p>
+<p>You can browse plugins/arguments/simplecontext_arg.inc and see the little that it does.</p>
+ </div>
+
+ <div class="clear-block">
+ <div class="meta">
+ </div>
+
+ </div>
+
+</div>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html
new file mode 100644
index 0000000..7576c80
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html
@@ -0,0 +1,19 @@
+<div id="node-10" class="node">
+
+
+
+
+ <div class="content clear-block">
+ <p>This demonstration module is intended for developers to look at and play with. CTools plugins are not terribly difficult to do, but it can be hard to sort through the various arguments and required functions. The idea here is that you should have a starting point for most anything you want to do. Just work through the example, and then start experimenting with changing it.</p>
+<p>There are two parts to this demo: </p>
+<p>First, there is a sample panel provided that uses all the various plugins. It's at <a href="/ctools_plugin_example/12345">ctools_example/12345</a>. You can edit the panel and configure all the panes on it.</p>
+<p>Second, the code is there for you to experiment with and change as you see fit. Sometimes starting with simple code and working with it can take you places that it's hard to go when you're looking at more complex examples.</p>
+ </div>
+
+ <div class="clear-block">
+ <div class="meta">
+ </div>
+
+ </div>
+
+</div>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html
new file mode 100644
index 0000000..918a13c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html
@@ -0,0 +1,17 @@
+<div id="node-14" class="node">
+
+
+
+
+ <div class="content clear-block">
+ <p>Now we get to the heart of the matter: Building a content type plugin. A content type plugin uses the contexts available to it to display something. plugins/content_types/simplecontext_content_type.inc does this work for us.</p>
+<p>Note that our content type also has an edit form which can be used to configure its behavior. This settings form is accessed through the panels interface, and it's up to you what the settings mean to the code and the generation of content in the display rendering.</p>
+ </div>
+
+ <div class="clear-block">
+ <div class="meta">
+ </div>
+
+ </div>
+
+</div>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html
new file mode 100644
index 0000000..e8efbb3
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html
@@ -0,0 +1,21 @@
+<div id="node-13" class="node">
+
+
+
+
+ <div class="content clear-block">
+ <p>Now that we have a plugin for a simplecontext argument, we can create a plugin for a simplecontext context. </p>
+<p>Normally, a context would take an argument which is a key like a node ID (nid) and retrieve a more complex object from a database or whatever. In our example, we'll artificially transform the argument into an arbitrary "context" data object. </p>
+<p>plugins/contexts/simplecontext.inc implements our context.</p>
+<p>Note that there are actually two ways to create a context. The normal one, which we've been referring to, is to create a context from an argument. However, it is also possible to configure a context in a panel using the panels interface. This is quite inflexible, but might be useful for configuring single page. However, it means that we have a settings form for exactly that purpose. Our context would have to know how to create itself from a settings form as well as from an argument. Simplecontext can do that.</p>
+<p>A context plugin can also provide keywords that expose parts of its context using keywords like masterkeyword:dataitem. The node plugin for ctools has node:nid and node:title, for example. The simplecontext plugin here provides the simplest of keywords.</p>
+
+ </div>
+
+ <div class="clear-block">
+ <div class="meta">
+ </div>
+
+ </div>
+
+</div>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Module-setup-and-hooks.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Module-setup-and-hooks.html
new file mode 100644
index 0000000..f816917
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Module-setup-and-hooks.html
@@ -0,0 +1,20 @@
+<div id="node-11" class="node">
+
+
+
+
+ <div class="content clear-block">
+ <p>Your module must provide a few things so that your plugins can be found.</p>
+<p>First, you need to implement hook_ctools_plugin_directory(). Here we're telling CTools that our plugins will be found in the module's directory in the plugins/&lt;plugintype&gt; directory. Context plugins will be in ctools_plugin_example/plugins/contexts, Content-type plugins will be in ctools_plugin_example/plugins/content_types.</p>
+<p><div class="codeblock"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">ctools_plugin_example_ctools_plugin_directory</span><span style="color: #007700">(</span><span style="color: #0000BB">$module</span><span style="color: #007700">, </span><span style="color: #0000BB">$plugin</span><span style="color: #007700">) {<br />&nbsp; if (</span><span style="color: #0000BB">$module </span><span style="color: #007700">== </span><span style="color: #DD0000">'ctools' </span><span style="color: #007700">&amp;&amp; !empty(</span><span style="color: #0000BB">$plugin</span><span style="color: #007700">)) {<br />&nbsp;&nbsp;&nbsp; return </span><span style="color: #DD0000">"plugins/$plugin"</span><span style="color: #007700">;<br />&nbsp; }<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div></p>
+<p>Second, if you module wants to provide default panels pages, you can implement hook_ctools_plugin_api(). CTools will then pick up your panels pages in the file named &lt;modulename&gt;.pages_default.inc.</p>
+<p><div class="codeblock"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">ctools_plugin_example_ctools_plugin_api</span><span style="color: #007700">(</span><span style="color: #0000BB">$module</span><span style="color: #007700">, </span><span style="color: #0000BB">$api</span><span style="color: #007700">) {<br />&nbsp; if (</span><span style="color: #0000BB">$module </span><span style="color: #007700">== </span><span style="color: #DD0000">'panels_mini' </span><span style="color: #007700">&amp;&amp; </span><span style="color: #0000BB">$api </span><span style="color: #007700">== </span><span style="color: #DD0000">'panels_default'</span><span style="color: #007700">) {<br />&nbsp;&nbsp;&nbsp; return array(</span><span style="color: #DD0000">'version' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />&nbsp; }<br />&nbsp; if (</span><span style="color: #0000BB">$module </span><span style="color: #007700">== </span><span style="color: #DD0000">'page_manager' </span><span style="color: #007700">&amp;&amp; </span><span style="color: #0000BB">$api </span><span style="color: #007700">== </span><span style="color: #DD0000">'pages_default'</span><span style="color: #007700">) {<br />&nbsp;&nbsp;&nbsp; return array(</span><span style="color: #DD0000">'version' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />&nbsp; }<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div></p>
+ </div>
+
+ <div class="clear-block">
+ <div class="meta">
+ </div>
+
+ </div>
+
+</div>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html
new file mode 100644
index 0000000..7691245
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html
@@ -0,0 +1,18 @@
+<div id="node-15" class="node">
+
+
+
+
+ <div class="content clear-block">
+ <p>Often a single data type can lead us to other data types. For example, a node has a user (the author) and the user has data associated with it.</p>
+<p>A relationship plugin allows this kind of data to be accessed. </p>
+<p>An example relationship plugin is provided in plugins/relationships/relcontext_from_simplecontext.inc. It looks at a simplecontext (which we got from an argument) and builds an (artificial) "relcontext" from that.</p>
+ </div>
+
+ <div class="clear-block">
+ <div class="meta">
+ </div>
+
+ </div>
+
+</div>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/ctools_plugin_example.help.ini b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/ctools_plugin_example.help.ini
new file mode 100644
index 0000000..6fb3d4c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/help/ctools_plugin_example.help.ini
@@ -0,0 +1,42 @@
+[Chaos-Tools--CTools--Plugin-Examples]
+title = CTools Plugin Examples
+file = Chaos-Tools--CTools--Plugin-Examples
+weight = 0
+parent =
+
+[Module-setup-and-hooks]
+title = Module setup and hooks
+file = Module-setup-and-hooks
+weight = -15
+parent = Chaos-Tools--CTools--Plugin-Examples
+
+[Argument-Plugins--Starting-at-the-beginning]
+title = Argument Plugins: Starting at the beginning
+file = Argument-Plugins--Starting-at-the-beginning
+weight = -14
+parent = Chaos-Tools--CTools--Plugin-Examples
+
+[Context-plugins--Creating-a--context--from-an-argument]
+title = Context plugins: Creating a context from an argument
+file = Context-plugins--Creating-a--context--from-an-argument
+weight = -13
+parent = Chaos-Tools--CTools--Plugin-Examples
+
+[Content-Type-Plugins--Displaying-content-using-a-context]
+title = Content Type Plugins: Displaying content using a context
+file = Content-Type-Plugins--Displaying-content-using-a-context
+weight = -12
+parent = Chaos-Tools--CTools--Plugin-Examples
+
+[Access-Plugins--Determining-access-and-visibility]
+title = Access Plugins: Determining access and visibility
+file = Access-Plugins--Determining-access-and-visibility
+weight = -11
+parent = Chaos-Tools--CTools--Plugin-Examples
+
+[Relationships--Letting-one-context-take-us-to-another]
+title = Relationships: Letting one context take us to another
+file = Relationships--Letting-one-context-take-us-to-another
+weight = -10
+parent = Chaos-Tools--CTools--Plugin-Examples
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/access/arg_length.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/access/arg_length.inc
new file mode 100644
index 0000000..2a09eea
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/access/arg_length.inc
@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * @file
+ * Plugin to provide access control/visibility based on length of
+ * simplecontext argument (in URL).
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+ 'title' => t("Arg length"),
+ 'description' => t('Control access by length of simplecontext argument.'),
+ 'callback' => 'ctools_plugin_example_arg_length_ctools_access_check',
+ 'settings form' => 'ctools_plugin_example_arg_length_ctools_access_settings',
+ 'summary' => 'ctools_plugin_example_arg_length_ctools_access_summary',
+ 'required context' => new ctools_context_required(t('Simplecontext'), 'simplecontext'),
+);
+
+/**
+ * Settings form for the 'by role' access plugin.
+ */
+function ctools_plugin_example_arg_length_ctools_access_settings(&$form, &$form_state, $conf) {
+ $form['settings']['greater_than'] = array(
+ '#type' => 'radios',
+ '#title' => t('Grant access if simplecontext argument length is'),
+ '#options' => array(1 => t('Greater than'), 0 => t('Less than or equal to')),
+ '#default_value' => $conf['greater_than'],
+ );
+ $form['settings']['arg_length'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Length of simplecontext argument'),
+ '#size' => 3,
+ '#default_value' => $conf['arg_length'],
+ '#description' => t('Access/visibility will be granted based on arg length.'),
+ );
+}
+
+/**
+ * Check for access.
+ */
+function ctools_plugin_example_arg_length_ctools_access_check($conf, $context) {
+ // As far as I know there should always be a context at this point, but this
+ // is safe.
+ if (empty($context) || empty($context->data)) {
+ return FALSE;
+ }
+ $compare = ($context->arg_length > $conf['arg_length']);
+ if (($compare && $conf['greater_than']) || (!$compare && !$conf['greater_than'])) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ * Provide a summary description based upon the checked roles.
+ */
+function ctools_plugin_example_arg_length_ctools_access_summary($conf, $context) {
+ return t('Simpletext argument must be !comp @length characters',
+ array('!comp' => $conf['greater_than'] ? 'greater than' : 'less than or equal to',
+ '@length' => $conf['arg_length']));
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/access/example_role.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/access/example_role.inc
new file mode 100644
index 0000000..bbe364c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/access/example_role.inc
@@ -0,0 +1,76 @@
+<?php
+
+/**
+ * @file
+ * Plugin to provide access control based upon role membership.
+ * This is directly from the ctools module, but serves as a good
+ * example of an access plugin
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+ 'title' => t("CTools example: role"),
+ 'description' => t('Control access by role.'),
+ 'callback' => 'ctools_plugin_example_example_role_ctools_access_check',
+ 'default' => array('rids' => array()),
+ 'settings form' => 'ctools_plugin_example_example_role_ctools_access_settings',
+ 'summary' => 'ctools_plugin_example_example_role_ctools_access_summary',
+ 'required context' => new ctools_context_required(t('User'), 'user'),
+);
+
+/**
+ * Settings form for the 'by role' access plugin.
+ */
+function ctools_plugin_example_example_role_ctools_access_settings(&$form, &$form_state, $conf) {
+ $form['settings']['rids'] = array(
+ '#type' => 'checkboxes',
+ '#title' => t('Role'),
+ '#default_value' => $conf['rids'],
+ '#options' => ctools_get_roles(),
+ '#description' => t('Only the checked roles will be granted access.'),
+ );
+}
+
+/**
+ * Compress the roles allowed to the minimum.
+ */
+function ctools_plugin_example_example_role_ctools_access_settings_submit(&$form, &$form_state) {
+ $form_state['values']['settings']['rids'] = array_keys(array_filter($form_state['values']['settings']['rids']));
+}
+
+/**
+ * Check for access.
+ */
+function ctools_plugin_example_example_role_ctools_access_check($conf, $context) {
+ // As far as I know there should always be a context at this point, but this
+ // is safe.
+ if (empty($context) || empty($context->data) || !isset($context->data->roles)) {
+ return FALSE;
+ }
+
+ $roles = array_keys($context->data->roles);
+ $roles[] = $context->data->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID;
+ return (bool) array_intersect($conf['rids'], $roles);
+}
+
+/**
+ * Provide a summary description based upon the checked roles.
+ */
+function ctools_plugin_example_example_role_ctools_access_summary($conf, $context) {
+ if (!isset($conf['rids'])) {
+ $conf['rids'] = array();
+ }
+ $roles = ctools_get_roles();
+ $names = array();
+ foreach (array_filter($conf['rids']) as $rid) {
+ $names[] = check_plain($roles[$rid]);
+ }
+ if (empty($names)) {
+ return t('@identifier can have any role', array('@identifier' => $context->identifier));
+ }
+ return format_plural(count($names), '@identifier must have role "@roles"', '@identifier can be one of "@roles"', array('@roles' => implode(', ', $names), '@identifier' => $context->identifier));
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc
new file mode 100644
index 0000000..51c7c60
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * @file
+ *
+ * Sample plugin to provide an argument handler for a simplecontext.
+ *
+ * Given any argument to the page, simplecontext will get it
+ * and turn it into a piece of data (a "context") just by adding some text to it.
+ * Normally, the argument would be a key into some database (like the node
+ * database, for example, and the result of using the argument would be to load
+ * a specific "context" or data item that we can use elsewhere.
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+ 'title' => t("Simplecontext arg"),
+ // keyword to use for %substitution
+ 'keyword' => 'simplecontext',
+ 'description' => t('Creates a "simplecontext" from the arg.'),
+ 'context' => 'simplecontext_arg_context',
+ // 'settings form' => 'simplecontext_arg_settings_form',
+
+ // placeholder_form is used in panels preview, for example, so we can
+ // preview without getting the arg from a URL
+ 'placeholder form' => array(
+ '#type' => 'textfield',
+ '#description' => t('Enter the simplecontext arg'),
+ ),
+);
+
+/**
+ * Get the simplecontext context using the arg. In this case we're just going
+ * to manufacture the context from the data in the arg, but normally it would
+ * be an API call, db lookup, etc.
+ */
+function simplecontext_arg_context($arg = NULL, $conf = NULL, $empty = FALSE) {
+ // If $empty == TRUE it wants a generic, unfilled context.
+ if ($empty) {
+ return ctools_context_create_empty('simplecontext');
+ }
+ // Do whatever error checking is required, returning FALSE if it fails the test
+ // Normally you'd check
+ // for a missing object, one you couldn't create, etc.
+ if (empty($arg)) {
+ return FALSE;
+ }
+ return ctools_context_create('simplecontext', $arg);
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/icon_example.png b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/icon_example.png
new file mode 100644
index 0000000..58c6bee
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/icon_example.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc
new file mode 100644
index 0000000..8b73408
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc
@@ -0,0 +1,116 @@
+<?php
+
+/**
+ * @file
+ * "No context" sample content type. It operates with no context at all. It would
+ * be basically the same as a 'custom content' block, but it's not even that
+ * sophisticated.
+ *
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+ 'title' => t('CTools example no context content type'),
+ 'description' => t('No context content type - requires and uses no context.'),
+
+ // 'single' => TRUE means has no subtypes.
+ 'single' => TRUE,
+ // Constructor.
+ 'content_types' => array('no_context_content_type'),
+ // Name of a function which will render the block.
+ 'render callback' => 'no_context_content_type_render',
+ // The default context.
+ 'defaults' => array(),
+
+ // This explicitly declares the config form. Without this line, the func would be
+ // ctools_plugin_example_no_context_content_type_edit_form.
+ 'edit form' => 'no_context_content_type_edit_form',
+
+ // Icon goes in the directory with the content type.
+ 'icon' => 'icon_example.png',
+ 'category' => array(t('CTools Examples'), -9),
+
+ // this example does not provide 'admin info', which would populate the
+ // panels builder page preview.
+);
+
+/**
+ * Run-time rendering of the body of the block.
+ *
+ * @param $subtype
+ * @param $conf
+ * Configuration as done at admin time.
+ * @param $args
+ * @param $context
+ * Context - in this case we don't have any.
+ *
+ * @return
+ * An object with at least title and content members.
+ */
+function no_context_content_type_render($subtype, $conf, $args, $context) {
+ $block = new stdClass();
+
+ $ctools_help = theme('advanced_help_topic', 'ctools', 'plugins', 'title');
+ $ctools_plugin_example_help = theme('advanced_help_topic', 'ctools_plugin_example', 'Chaos-Tools--CTools--Plugin-Examples', 'title');
+
+ // The title actually used in rendering
+ $block->title = check_plain("No-context content type");
+ $block->content = t("
+ <div>Welcome to the CTools Plugin Example demonstration content type.
+
+ This block is a content type which requires no context at all. It's like a custom block,
+ but not even that sophisticated.
+
+ For more information on the example plugins, please see the advanced help for
+
+ {$ctools_help} and {$ctools_plugin_example_help}
+ </div>
+ ");
+ if (!empty($conf)) {
+ $block->content .= '<div>The only information that can be displayed in this block comes from the code and its settings form: </div>';
+ $block->content .= '<div style="border: 1px solid red;">' . var_export($conf, TRUE) . '</div>';
+ }
+
+ return $block;
+
+}
+
+/**
+ * 'Edit form' callback for the content type.
+ * This example just returns a form; validation and submission are standard drupal
+ * Note that if we had not provided an entry for this in hook_content_types,
+ * this could have had the default name
+ * ctools_plugin_example_no_context_content_type_edit_form.
+ *
+ */
+function no_context_content_type_edit_form($form, &$form_state) {
+ $conf = $form_state['conf'];
+ $form['item1'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Item1'),
+ '#size' => 50,
+ '#description' => t('The setting for item 1.'),
+ '#default_value' => !empty($conf['item1']) ? $conf['item1'] : '',
+ '#prefix' => '<div class="clear-block no-float">',
+ '#suffix' => '</div>',
+ );
+ $form['item2'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Item2'),
+ '#size' => 50,
+ '#description' => t('The setting for item 2'),
+ '#default_value' => !empty($conf['item2']) ? $conf['item2'] : '',
+ '#prefix' => '<div class="clear-block no-float">',
+ '#suffix' => '</div>',
+ );
+ return $form;
+}
+
+function no_context_content_type_edit_form_submit($form, &$form_state) {
+ foreach (array('item1', 'item2') as $key) {
+ $form_state['conf'][$key] = $form_state['values'][$key];
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc
new file mode 100644
index 0000000..bf54dce
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc
@@ -0,0 +1,103 @@
+<?php
+
+
+/**
+ * @file
+ * Content type that displays the relcontext context type.
+ *
+ * This example is for use with the relcontext relationship to show
+ * how we can get a relationship-context into a data type.
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+ // Used in add content dialogs.
+ 'title' => t('CTools example relcontext content type'),
+ 'admin info' => 'ctools_plugin_example_relcontext_content_type_admin_info',
+ 'content_types' => 'relcontext_content_type',
+ 'single' => TRUE,
+ 'render callback' => 'relcontext_content_type_render',
+ // Icon goes in the directory with the content type. Here, in plugins/content_types.
+ 'icon' => 'icon_example.png',
+ 'description' => t('Relcontext content type - works with relcontext context.'),
+ 'required context' => new ctools_context_required(t('Relcontext'), 'relcontext'),
+ 'category' => array(t('CTools Examples'), -9),
+ 'edit form' => 'relcontext_edit_form',
+
+ // this example does not provide 'admin info', which would populate the
+ // panels builder page preview.
+
+);
+
+/**
+ * Run-time rendering of the body of the block.
+ *
+ * @param $subtype
+ * @param $conf
+ * Configuration as done at admin time
+ * @param $args
+ * @param $context
+ * Context - in this case we don't have any
+ *
+ * @return
+ * An object with at least title and content members
+ */
+function relcontext_content_type_render($subtype, $conf, $args, $context) {
+ $data = $context->data;
+ $block = new stdClass();
+
+ // Don't forget to check this data if it's untrusted.
+ // The title actually used in rendering.
+ $block->title = "Relcontext content type";
+ $block->content = t("
+ This is a block of data created by the Relcontent content type.
+ Data in the block may be assembled from static text (like this) or from the
+ content type settings form (\$conf) for the content type, or from the context
+ that is passed in. <br />
+ In our case, the configuration form (\$conf) has just one field, 'config_item_1;
+ and it's configured with:
+ ");
+ if (!empty($conf)) {
+ $block->content .= '<div style="border: 1px solid red;">' . var_export($conf['config_item_1'], TRUE) . '</div>';
+ }
+ if (!empty($context)) {
+ $block->content .= '<br />The args ($args) were <div style="border: 1px solid yellow;" >' .
+ var_export($args, TRUE) . '</div>';
+ }
+ $block->content .= '<br />And the relcontext context ($context->data->description)
+ (which was created from a
+ simplecontext context) was <div style="border: 1px solid green;" >' .
+ print_r($context->data->description, TRUE) . '</div>';
+ return $block;
+}
+
+/**
+ * 'Edit' callback for the content type.
+ * This example just returns a form.
+ *
+ */
+function relcontext_edit_form($form, &$form_state) {
+ $conf = $form_state['conf'];
+
+ $form['config_item_1'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Config Item 1 (relcontext)'),
+ '#size' => 50,
+ '#description' => t('Setting for relcontext.'),
+ '#default_value' => !empty($conf['config_item_1']) ? $conf['config_item_1'] : '',
+ '#prefix' => '<div class="clear-block no-float">',
+ '#suffix' => '</div>',
+ );
+ return $form;
+}
+
+function relcontext_edit_form_submit($form, &$form_state) {
+ foreach (element_children($form) as $key) {
+ if (!empty($form_state['values'][$key])) {
+ $form_state['conf'][$key] = $form_state['values'][$key];
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc
new file mode 100644
index 0000000..a308683
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc
@@ -0,0 +1,129 @@
+<?php
+
+
+/**
+ * @file
+ * Sample ctools content type that takes advantage of context.
+ *
+ * This example uses the context it gets (simplecontext) to demo how a
+ * ctools content type can access and use context. Note that the simplecontext
+ * can be either configured manually into a panel or it can be retrieved via
+ * an argument.
+ *
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+ 'title' => t('Simplecontext content type'),
+ 'content_types' => 'simplecontext_content_type',
+ // 'single' means not to be subtyped.
+ 'single' => TRUE,
+ // Name of a function which will render the block.
+ 'render callback' => 'simplecontext_content_type_render',
+
+ // Icon goes in the directory with the content type.
+ 'icon' => 'icon_example.png',
+ 'description' => t('Simplecontext content type - works with a simplecontext context.'),
+ 'required context' => new ctools_context_required(t('Simplecontext'), 'simplecontext'),
+ 'edit form' => 'simplecontext_content_type_edit_form',
+ 'admin title' => 'ctools_plugin_example_simplecontext_content_type_admin_title',
+
+ // presents a block which is used in the preview of the data.
+ // Pn Panels this is the preview pane shown on the panels building page.
+ 'admin info' => 'ctools_plugin_example_simplecontext_content_type_admin_info',
+ 'category' => array(t('CTools Examples'), -9),
+);
+
+function ctools_plugin_example_simplecontext_content_type_admin_title($subtype, $conf, $context = NULL) {
+ $output = t('Simplecontext');
+ if ($conf['override_title'] && !empty($conf['override_title_text'])) {
+ $output = filter_xss_admin($conf['override_title_text']);
+ }
+ return $output;
+}
+
+/**
+ * Callback to provide administrative info (the preview in panels when building
+ * a panel).
+ *
+ * In this case we'll render the content with a dummy argument and
+ * a dummy context.
+ */
+function ctools_plugin_example_simplecontext_content_type_admin_info($subtype, $conf, $context = NULL) {
+ $context = new stdClass();
+ $context->data = new stdClass();
+ $context->data->description = t("no real context");
+ $block = simplecontext_content_type_render($subtype, $conf, array("Example"), $context);
+ return $block;
+}
+
+/**
+ * Run-time rendering of the body of the block (content type)
+ *
+ * @param $subtype
+ * @param $conf
+ * Configuration as done at admin time
+ * @param $args
+ * @param $context
+ * Context - in this case we don't have any
+ *
+ * @return
+ * An object with at least title and content members
+ */
+function simplecontext_content_type_render($subtype, $conf, $args, $context) {
+ $data = $context->data;
+ $block = new stdClass();
+
+ // Don't forget to check this data if it's untrusted.
+ // The title actually used in rendering.
+ $block->title = "Simplecontext content type";
+ $block->content = t("
+ This is a block of data created by the Simplecontext content type.
+ Data in the block may be assembled from static text (like this) or from the
+ content type settings form (\$conf) for the content type, or from the context
+ that is passed in. <br />
+ In our case, the configuration form (\$conf) has just one field, 'config_item_1;
+ and it's configured with:
+ ");
+ if (!empty($conf)) {
+ $block->content .= '<div style="border: 1px solid red;">' . print_r(filter_xss_admin($conf['config_item_1']), TRUE) . '</div>';
+ }
+ if (!empty($context)) {
+ $block->content .= '<br />The args ($args) were <div style="border: 1px solid yellow;" >' .
+ var_export($args, TRUE) . '</div>';
+ }
+ $block->content .= '<br />And the simplecontext context ($context->data->description) was <div style="border: 1px solid green;" >' .
+ print_r($context->data->description, TRUE) . '</div>';
+ return $block;
+}
+
+/**
+ * 'Edit' callback for the content type.
+ * This example just returns a form.
+ *
+ */
+function simplecontext_content_type_edit_form($form, &$form_state) {
+ $conf = $form_state['conf'];
+ $form['config_item_1'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Config Item 1 for simplecontext content type'),
+ '#size' => 50,
+ '#description' => t('The stuff for item 1.'),
+ '#default_value' => !empty($conf['config_item_1']) ? $conf['config_item_1'] : '',
+ '#prefix' => '<div class="clear-block no-float">',
+ '#suffix' => '</div>',
+ );
+
+ return $form;
+}
+
+function simplecontext_content_type_edit_form_submit($form, &$form_state) {
+ foreach (element_children($form) as $key) {
+ if (!empty($form_state['values'][$key])) {
+ $form_state['conf'][$key] = $form_state['values'][$key];
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc
new file mode 100644
index 0000000..0c7ef11
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc
@@ -0,0 +1,83 @@
+<?php
+
+/**
+ * @file
+ * Sample ctools context type plugin that
+ * is used in this demo to create a relcontext from an existing simplecontext.
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+ 'title' => t("Relcontext"),
+ 'description' => t('A relcontext object.'),
+ // Function to create the relcontext.
+ 'context' => 'ctools_plugin_example_context_create_relcontext',
+ // Function that does the settings.
+ 'settings form' => 'relcontext_settings_form',
+ 'keyword' => 'relcontext',
+ 'context name' => 'relcontext',
+);
+
+/**
+ * Create a context, either from manual configuration (form) or from an argument on the URL.
+ *
+ * @param $empty
+ * If true, just return an empty context.
+ * @param $data
+ * If from settings form, an array as from a form. If from argument, a string.
+ * @param $conf
+ * TRUE if the $data is coming from admin configuration, FALSE if it's from a URL arg.
+ *
+ * @return
+ * a Context object.
+ */
+function ctools_plugin_example_context_create_relcontext($empty, $data = NULL, $conf = FALSE) {
+ $context = new ctools_context('relcontext');
+ $context->plugin = 'relcontext';
+ if ($empty) {
+ return $context;
+ }
+ if ($conf) {
+ if (!empty($data)) {
+ $context->data = new stdClass();
+ // For this simple item we'll just create our data by stripping non-alpha and
+ // adding 'sample_relcontext_setting' to it.
+ $context->data->description = 'relcontext_from__' . preg_replace('/[^a-z]/i', '', $data['sample_relcontext_setting']);
+ $context->data->description .= '_from_configuration_sample_simplecontext_setting';
+ $context->title = t("Relcontext context from simplecontext");
+ return $context;
+ }
+ }
+ else {
+ // $data is coming from an arg - it's just a string.
+ // This is used for keyword.
+ $context->title = "relcontext_" . $data->data->description;
+ $context->argument = $data->argument;
+ // Make up a bogus context.
+ $context->data = new stdClass();
+ // For this simple item we'll just create our data by stripping non-alpha and
+ // prepend 'relcontext_' and adding '_created_from_from_simplecontext' to it.
+ $context->data->description = 'relcontext_' . preg_replace('/[^a-z]/i', '', $data->data->description);
+ $context->data->description .= '_created_from_simplecontext';
+ return $context;
+ }
+}
+
+function relcontext_settings_form($conf, $external = FALSE) {
+ $form = array();
+
+ $form['sample_relcontext_setting'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Relcontext setting'),
+ '#size' => 50,
+ '#description' => t('Just an example setting.'),
+ '#default_value' => !empty($conf['sample_relcontext_setting']) ? $conf['sample_relcontext_setting'] : '',
+ '#prefix' => '<div class="clear-block no-float">',
+ '#suffix' => '</div>',
+ );
+ return $form;
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc
new file mode 100644
index 0000000..e19a842
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc
@@ -0,0 +1,134 @@
+<?php
+
+
+/**
+ * @file
+ * Sample ctools context type plugin that shows how to create a context from an arg.
+ *
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+ 'title' => t("Simplecontext"),
+ 'description' => t('A single "simplecontext" context, or data element.'),
+ 'context' => 'ctools_plugin_example_context_create_simplecontext', // func to create context
+ 'context name' => 'simplecontext',
+ 'settings form' => 'simplecontext_settings_form',
+ 'keyword' => 'simplecontext',
+
+ // Provides a list of items which are exposed as keywords.
+ 'convert list' => 'simplecontext_convert_list',
+ // Convert keywords into data.
+ 'convert' => 'simplecontext_convert',
+
+ 'placeholder form' => array(
+ '#type' => 'textfield',
+ '#description' => t('Enter some data to represent this "simplecontext".'),
+ ),
+);
+
+/**
+ * Create a context, either from manual configuration or from an argument on the URL.
+ *
+ * @param $empty
+ * If true, just return an empty context.
+ * @param $data
+ * If from settings form, an array as from a form. If from argument, a string.
+ * @param $conf
+ * TRUE if the $data is coming from admin configuration, FALSE if it's from a URL arg.
+ *
+ * @return
+ * a Context object/
+ */
+function ctools_plugin_example_context_create_simplecontext($empty, $data = NULL, $conf = FALSE) {
+ $context = new ctools_context('simplecontext');
+ $context->plugin = 'simplecontext';
+
+ if ($empty) {
+ return $context;
+ }
+
+ if ($conf) {
+ if (!empty($data)) {
+ $context->data = new stdClass();
+ // For this simple item we'll just create our data by stripping non-alpha and
+ // adding '_from_configuration_item_1' to it.
+ $context->data->item1 = t("Item1");
+ $context->data->item2 = t("Item2");
+ $context->data->description = preg_replace('/[^a-z]/i', '', $data['sample_simplecontext_setting']);
+ $context->data->description .= '_from_configuration_sample_simplecontext_setting';
+ $context->title = t("Simplecontext context from config");
+ return $context;
+ }
+ }
+ else {
+ // $data is coming from an arg - it's just a string.
+ // This is used for keyword.
+ $context->title = $data;
+ $context->argument = $data;
+ // Make up a bogus context
+ $context->data = new stdClass();
+ $context->data->item1 = t("Item1");
+ $context->data->item2 = t("Item2");
+
+ // For this simple item we'll just create our data by stripping non-alpha and
+ // adding '_from_simplecontext_argument' to it.
+ $context->data->description = preg_replace('/[^a-z]/i', '', $data);
+ $context->data->description .= '_from_simplecontext_argument';
+ $context->arg_length = strlen($context->argument);
+ return $context;
+ }
+}
+
+function simplecontext_settings_form($conf, $external = FALSE) {
+ if (empty($conf)) {
+ $conf = array(
+ 'sample_simplecontext_setting' => 'default simplecontext setting',
+ );
+ }
+ $form = array();
+ $form['sample_simplecontext_setting'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Setting for simplecontext'),
+ '#size' => 50,
+ '#description' => t('An example setting that could be used to configure a context'),
+ '#default_value' => $conf['sample_simplecontext_setting'],
+ '#prefix' => '<div class="clear-block no-float">',
+ '#suffix' => '</div>',
+ );
+ return $form;
+}
+
+
+
+/**
+ * Provide a list of sub-keywords.
+ *
+ * This is used to provide keywords from the context for use in a content type,
+ * pane, etc.
+ */
+function simplecontext_convert_list() {
+ return array(
+ 'item1' => t('Item1'),
+ 'item2' => t('Item2'),
+ 'description' => t('Description'),
+ );
+}
+
+/**
+ * Convert a context into a string to be used as a keyword by content types, etc.
+ */
+function simplecontext_convert($context, $type) {
+ switch ($type) {
+ case 'item1':
+ return $context->data->item1;
+ case 'item2':
+ return $context->data->item2;
+ case 'description':
+ return $context->data->description;
+ }
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/panels.pages.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/panels.pages.inc
new file mode 100644
index 0000000..d3022af
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/panels.pages.inc
@@ -0,0 +1,214 @@
+<?php
+
+/**
+ * @file
+ * Holds the panels pages export.
+ */
+
+/**
+ * Implements hook_default_panel_pages()
+ */
+function ctools_plugin_example_default_panel_pages() {
+ $page = new stdClass();
+ $page->pid = 'new';
+ $page->did = 'new';
+ $page->name = 'ctools_plugin_example_demo_panel';
+ $page->title = 'Panels Plugin Example Demo Panel';
+ $page->access = array();
+ $page->path = 'demo_panel';
+ $page->load_flags = 1;
+ $page->css_id = '';
+ $page->arguments = array(
+ 0 =>
+ array(
+ 'name' => 'simplecontext_arg',
+ 'id' => 1,
+ 'default' => '404',
+ 'title' => '',
+ 'identifier' => 'Simplecontext arg',
+ 'keyword' => 'simplecontext',
+ ),
+ );
+ $page->relationships = array(
+ 0 =>
+ array(
+ 'context' => 'argument_simplecontext_arg_1',
+ 'name' => 'relcontext_from_simplecontext',
+ 'id' => 1,
+ 'identifier' => 'Relcontext from Simplecontext',
+ 'keyword' => 'relcontext',
+ ),
+ );
+ $page->no_blocks = '0';
+ $page->switcher_options = array();
+ $page->menu = '0';
+ $page->contexts = array();
+ $display = new ctools_display();
+ $display->did = 'new';
+ $display->layout = 'threecol_33_34_33_stacked';
+ $display->layout_settings = array();
+ $display->panel_settings = array();
+ $display->content = array();
+ $display->panels = array();
+ $pane = new stdClass();
+ $pane->pid = 'new-1';
+ $pane->panel = 'left';
+ $pane->type = 'custom';
+ $pane->shown = '1';
+ $pane->subtype = 'custom';
+ $pane->access = array();
+ $pane->configuration = array(
+ 'style' => 'default',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ 'css_id' => '',
+ 'css_class' => '',
+ 'title' => '"No Context Item"',
+ 'body' => 'The "no context item" content type is here to demonstrate that you can create a content_type that does not require a context. This is probably the same as just creating a custom php block on the fly, and might serve the same purpose.',
+ 'format' => '1',
+ );
+ $pane->cache = array();
+ $display->content['new-1'] = $pane;
+ $display->panels['left'][0] = 'new-1';
+ $pane = new stdClass();
+ $pane->pid = 'new-2';
+ $pane->panel = 'left';
+ $pane->type = 'no_context_item';
+ $pane->shown = '1';
+ $pane->subtype = 'description';
+ $pane->access = array();
+ $pane->configuration = array(
+ 'style' => 'default',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ 'css_id' => '',
+ 'css_class' => '',
+ 'item1' => 'one',
+ 'item2' => 'two',
+ 'item3' => 'three',
+ );
+ $pane->cache = array();
+ $display->content['new-2'] = $pane;
+ $display->panels['left'][1] = 'new-2';
+ $pane = new stdClass();
+ $pane->pid = 'new-3';
+ $pane->panel = 'middle';
+ $pane->type = 'custom';
+ $pane->shown = '1';
+ $pane->subtype = 'custom';
+ $pane->access = array();
+ $pane->configuration = array(
+ 'style' => 'default',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ 'css_id' => '',
+ 'css_class' => '',
+ 'title' => 'Simplecontext',
+ 'body' => 'The "Simplecontext" content and content type demonstrate a very basic context and how to display it.
+
+ Simplecontext includes configuration, so it can get info from the config. It can also get its information to run from a simplecontext context, generated either from an arg to the panels page or via explicitly adding a context to the page.',
+ 'format' => '1',
+ );
+ $pane->cache = array();
+ $display->content['new-3'] = $pane;
+ $display->panels['middle'][0] = 'new-3';
+ $pane = new stdClass();
+ $pane->pid = 'new-4';
+ $pane->panel = 'middle';
+ $pane->type = 'simplecontext_item';
+ $pane->shown = '1';
+ $pane->subtype = 'description';
+ $pane->access = array(
+ 0 => '2',
+ 1 => '4',
+ );
+ $pane->configuration = array(
+ 'context' => 'argument_simplecontext_arg_1',
+ 'style' => 'default',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ 'css_id' => '',
+ 'css_class' => '',
+ 'config_item_1' => 'simplecontext called from arg',
+ );
+ $pane->cache = array();
+ $display->content['new-4'] = $pane;
+ $display->panels['middle'][1] = 'new-4';
+ $pane = new stdClass();
+ $pane->pid = 'new-5';
+ $pane->panel = 'right';
+ $pane->type = 'custom';
+ $pane->shown = '1';
+ $pane->subtype = 'custom';
+ $pane->access = array();
+ $pane->configuration = array(
+ 'style' => 'default',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ 'css_id' => '',
+ 'css_class' => '',
+ 'title' => 'Relcontext',
+ 'body' => 'The relcontext content_type gets its data from a relcontext, which is an example of a relationship. This panel should be run with an argument like "/xxx", which allows the simplecontext to get its context, and then the relcontext is configured in this panel to get (create) its data from the simplecontext.',
+ 'format' => '1',
+ );
+ $pane->cache = array();
+ $display->content['new-5'] = $pane;
+ $display->panels['right'][0] = 'new-5';
+ $pane = new stdClass();
+ $pane->pid = 'new-6';
+ $pane->panel = 'right';
+ $pane->type = 'relcontext_item';
+ $pane->shown = '1';
+ $pane->subtype = 'description';
+ $pane->access = array();
+ $pane->configuration = array(
+ 'context' => 'relationship_relcontext_from_simplecontext_1',
+ 'style' => 'default',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ 'css_id' => '',
+ 'css_class' => '',
+ 'config_item_1' => 'default1',
+ );
+ $pane->cache = array();
+ $display->content['new-6'] = $pane;
+ $display->panels['right'][1] = 'new-6';
+ $pane = new stdClass();
+ $pane->pid = 'new-7';
+ $pane->panel = 'top';
+ $pane->type = 'custom_php';
+ $pane->shown = '1';
+ $pane->subtype = 'custom_php';
+ $pane->access = array();
+ $pane->configuration = array(
+ 'style' => 'default',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ 'css_id' => '',
+ 'css_class' => '',
+ 'title' => '',
+ 'body' => '$arg = arg(1);
+ $arg0 = arg(0);
+ if (!$arg) {
+ $block->content = <<<END
+ <em>This page is intended to run with an arg and you don\'t have one.</em>
+ <br />
+ Without an arg, the page doesn\'t have any context.
+ <br />Please try something like "/$arg0/xxx"
+END;
+
+ $block->title = "This is intended to run with an argument";
+ } else {
+ $block->content = "The arg for this page is \'$arg\'";
+ }',
+ );
+ $pane->cache = array();
+ $display->content['new-7'] = $pane;
+ $display->panels['top'][0] = 'new-7';
+ $page->display = $display;
+ $page->displays = array();
+ $pages['ctools_plugin_example'] = $page;
+
+
+ return $pages;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc
new file mode 100644
index 0000000..6224621
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc
@@ -0,0 +1,50 @@
+<?php
+
+
+/**
+ * @file
+ *
+ * Sample relationship plugin.
+ *
+ * We take a simplecontext, look in it for what we need to make a relcontext, and make it.
+ * In the real world, this might be getting a taxonomy id from a node, for example.
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+ 'title' => t("Relcontext from simplecontext"),
+ 'keyword' => 'relcontext',
+ 'description' => t('Adds a relcontext from existing simplecontext.'),
+ 'required context' => new ctools_context_required(t('Simplecontext'), 'simplecontext'),
+ 'context' => 'ctools_relcontext_from_simplecontext_context',
+ 'settings form' => 'ctools_relcontext_from_simplecontext_settings_form',
+);
+
+/**
+ * Return a new context based on an existing context.
+ */
+function ctools_relcontext_from_simplecontext_context($context = NULL, $conf) {
+ // If unset it wants a generic, unfilled context, which is just NULL.
+ if (empty($context->data)) {
+ return ctools_context_create_empty('relcontext', NULL);
+ }
+
+ // You should do error-checking here.
+
+ // Create the new context from some element of the parent context.
+ // In this case, we'll pass in the whole context so it can be used to
+ // create the relcontext.
+ return ctools_context_create('relcontext', $context);
+}
+
+/**
+ * Settings form for the relationship.
+ */
+function ctools_relcontext_from_simplecontext_settings_form($conf) {
+ // We won't configure it in this case.
+ return array();
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/drush/ctools.drush.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/drush/ctools.drush.inc
new file mode 100644
index 0000000..bf1df1f
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/drush/ctools.drush.inc
@@ -0,0 +1,1015 @@
+<?php
+
+/**
+ * @file
+ * CTools Drush commands.
+ */
+
+/**
+ * Implements hook_drush_command().
+ */
+function ctools_drush_command() {
+ $items = array();
+
+ $module_text = 'Filter the list of exportables by module. This will come from the \'export_module\' key on the exportable.';
+ $all_text = 'Perform this operation all CTools exportables available on the system (all tables).';
+
+ $items['ctools-export'] = array(
+ 'aliases' => array('ctex'),
+ 'callback' => 'ctools_drush_export',
+ 'description' => 'Export multiple CTools exportable objects directly to code.',
+ 'arguments' => array(
+ 'module' => 'Name of your module.',
+ ),
+ 'options' => array(
+ 'subdir' => 'The name of the sub directory to create the module in. Defaults to ctools_export which will be placed into sites/all/modules.',
+ 'remove' => 'Remove existing files before writing, except the .module file.',
+ 'filter' => 'Filter the list of exportables by status. Available options are enabled, disabled, overridden, database, code and all. Defaults to enabled.',
+ 'tables' => 'Comma separated list of exportable table names to filter by.',
+ ),
+ 'examples' => array(
+ 'drush ctex export_module' => 'Export CTools exportables to a module called "export_module".',
+ 'drush ctex export_module --subdir=exports' => 'Same as above, but into the sites/all/modules/exports directory.',
+ 'drush ctex export_module --subdir=exports --remove' => 'Same as above, but automatically removing all files, except for the .module file.',
+ 'drush ctex --filter="views_view"' => 'Filter export selection to the views_view table only.',
+ ),
+ );
+
+ $items['ctools-export-info'] = array(
+ 'aliases' => array('ctei'),
+ 'callback' => 'ctools_drush_export_info',
+ 'description' => 'Show available CTools exportable objects.',
+ 'arguments' => array(),
+ 'options' => array(
+ 'format' => 'Display exportables info in a different format such as print_r, json, export. The default is to show in a tabular format.',
+ 'tables-only' => 'Only show list of exportable types/table names and not available objects.',
+ 'filter' => 'Filter the list of exportables by status. Available options are enabled, disabled, overridden, database, and code.',
+ 'module' => $module_text,
+ ),
+ 'examples' => array(
+ 'drush ctools-export-info' => 'View export info on all exportables.',
+ 'drush ctools-export-info views_view variable' => 'View export info for views_view and variable exportable types only.',
+ 'drush ctei --filter=enabled' => 'Show all enabled exportables.',
+ 'drush ctei views_view --filter=disabled' => 'Show all enabled exportables.',
+ 'drush ctei views_view --module=node' => 'Show all exportables provided by/on behalf of the node module.',
+ ),
+ );
+
+ $items['ctools-export-view'] = array(
+ 'aliases' => array('ctev'),
+ 'callback' => 'ctools_drush_export_op_command',
+ 'description' => 'View CTools exportable object code output.',
+ 'arguments' => array(
+ 'table name' => 'Base table of the exportable you want to view.',
+ 'machine names' => 'Space separated list of exportables you want to view.',
+ ),
+ 'options' => array(
+ 'indent' => 'The string to use for indentation when dispalying the exportable export code. Defaults to \'\'.',
+ 'no-colour' => 'Remove any colour formatting from export string output. Ideal if you are sending the output of this command to a file.',
+ 'module' => $module_text,
+ 'all' => $all_text,
+ ),
+ 'examples' => array(
+ 'drush ctools-export-view views_view' => 'View all views exportable objects.',
+ 'drush ctools-export-view views_view archive' => 'View default views archive view.',
+ ),
+ );
+
+ $items['ctools-export-revert'] = array(
+ 'aliases' => array('cter'),
+ 'callback' => 'ctools_drush_export_op_command',
+ 'description' => 'Revert CTools exportables from changes overridden in the database.',
+ 'arguments' => array(
+ 'table name' => 'Base table of the exportable you want to revert.',
+ 'machine names' => 'Space separated list of exportables you want to revert.',
+ ),
+ 'options' => array(
+ 'module' => $module_text,
+ 'all' => $all_text,
+ ),
+ 'examples' => array(
+ 'drush ctools-export-revert views_view' => 'Revert all overridden views exportable objects.',
+ 'drush ctools-export-revert views_view archive' => 'Revert overridden default views archive view.',
+ 'drush ctools-export-revert --all' => 'Revert all exportables on the system.',
+ ),
+ );
+
+ $items['ctools-export-enable'] = array(
+ 'aliases' => array('ctee'),
+ 'callback' => 'ctools_drush_export_op_command',
+ 'description' => 'Enable CTools exportables.',
+ 'arguments' => array(
+ 'table name' => 'Base table of the exportable you want to enable.',
+ 'machine names' => 'Space separated list of exportables you want to enable.',
+ ),
+ 'options' => array(
+ 'module' => $module_text,
+ 'all' => $all_text,
+ ),
+ 'examples' => array(
+ 'drush ctools-export-enable views_view' => 'Enable all overridden views exportable objects.',
+ 'drush ctools-export-enable views_view archive' => 'Enable overridden default views archive view.',
+ ),
+ );
+
+ $items['ctools-export-disable'] = array(
+ 'aliases' => array('cted'),
+ 'callback' => 'ctools_drush_export_op_command',
+ 'description' => 'Disable CTools exportables.',
+ 'arguments' => array(
+ 'table name' => 'Base table of the exportable you want to disable.',
+ 'machine names' => 'Space separated list of exportables you want to disable.',
+ ),
+ 'options' => array(
+ 'module' => $module_text,
+ 'all' => $all_text,
+ ),
+ 'examples' => array(
+ 'drush ctools-export-disable views_view' => 'Disable all overridden views exportable objects.',
+ 'drush ctools-export-disable views_view archive' => 'Disable overridden default views archive view.',
+ ),
+ );
+
+ return $items;
+}
+
+/**
+ * Implementation of hook_drush_help().
+ */
+function ctools_drush_help($section) {
+ switch ($section) {
+ case 'meta:ctools:title':
+ return dt('CTools commands');
+ case 'meta:entity:summary':
+ return dt('CTools drush commands.');
+ }
+}
+
+/**
+ * Drush callback: export
+ */
+function ctools_drush_export($module = 'foo') {
+ $error = FALSE;
+ if (preg_match('@[^a-z_]+@', $module)) {
+ $error = dt('The name of the module must contain only lowercase letters and underscores') . '.';
+ drush_log($error, 'error');
+ return;
+ }
+
+ // Filter by tables.
+ $tables = _ctools_drush_explode_options('tables');
+
+ // Check status.
+ $filter = drush_get_option('filter', FALSE);
+ if (empty($filter)) {
+ drush_set_option('filter', 'enabled');
+ }
+
+ // Selection.
+ $options = array('all' => dt('Export everything'), 'select' => dt('Make selection'));
+ $selection = drush_choice($options, dt('Select to proceed'));
+
+ if (!$selection) {
+ return;
+ }
+
+ // Present the selection screens.
+ if ($selection == 'select') {
+ $selections = _ctools_drush_selection_screen($tables);
+ }
+ else {
+ $info = _ctools_drush_export_info($tables, TRUE);
+ $selections = $info['exportables'];
+ }
+
+ // Subdirectory.
+ $dest_exists = FALSE;
+ $subdir = drush_get_option('subdir', 'ctools_export');
+ $dest = 'sites/all/modules/' . $subdir . '/' . $module;
+
+ // Overwriting files can be set with 'remove' argument.
+ $remove = drush_get_option('remove', FALSE);
+
+ // Check if folder exists.
+ if (file_exists($dest)) {
+ $dest_exists = TRUE;
+ if ($remove) {
+ if (drush_confirm(dt('All files except for the .info and .module files in !module will be removed. You can choose later if you want to overwrite these files as well. Are you sure you want to proceed ?', array('!module' => $module)))) {
+ $remove = TRUE;
+ drush_log(dt('Files will be removed'), 'success');
+ }
+ else {
+ drush_log(dt('Export aborted.'), 'success');
+ return;
+ }
+ }
+ }
+
+ // Remove files (except for the .module file) if the destination folder exists.
+ if ($remove && $dest_exists) {
+ _ctools_drush_file_delete($dest);
+ }
+
+ // Create new dir if needed.
+ if (!$dest_exists) {
+ if (!file_exists('sites/all/modules/' . $subdir)) {
+ drush_mkdir('sites/all/modules/' . $subdir);
+ }
+ }
+
+ // Create destination directory.
+ drush_mkdir($dest);
+
+ // Load bulk export module.
+ module_load_include('module', 'bulk_export');
+
+ // Create options and call Bulk export function.
+ // We create an array, because maybe in the future we can pass in more
+ // options to the export function (pre-selected modules and/or exportables).
+ $options = array(
+ 'name' => $module,
+ 'selections' => $selections,
+ );
+ $files = bulk_export_export(TRUE, $options);
+
+ $alter = array(
+ 'module' => $module,
+ 'files' => $files,
+ );
+ // Let other drush commands alter the files.
+ drush_command_invoke_all_ref('drush_ctex_files_alter', $alter);
+ $files = $alter['files'];
+
+ // Start writing.
+ if (is_array($files)) {
+ foreach ($files as $base_file => $data) {
+ $filename = $dest . '/' . $base_file;
+ // Extra check for .module file.
+ if ($base_file == ($module . '.module' || $module . '.info') && file_exists($filename)) {
+ if (!drush_confirm(dt('Do you want to overwrite !module_file', array('!module_file' => $base_file)))) {
+ drush_log(dt('Writing of !filename skipped. This is the code that was supposed to be written:', array('!filename' => $filename)), 'success');
+ drush_print('---------');
+ drush_print(shellColours::getColouredOutput("\n$data", 'light_green'));
+ drush_print('---------');
+ continue;
+ }
+ }
+ if (file_put_contents($filename, $data)) {
+ drush_log(dt('Succesfully written !filename', array('!filename' => $filename)), 'success');
+ }
+ else {
+ drush_log(dt('Error writing !filename', array('!filename' => $filename)), 'error');
+ }
+ }
+ }
+ else {
+ drush_log(dt('No files were found to be written.'), 'error');
+ }
+}
+
+/**
+ * Helper function to select the exportables. By default, all exportables
+ * will be selected, so it will be easier to deselect them.
+ *
+ * @param $tables
+ */
+function _ctools_drush_selection_screen(array $tables = array()) {
+ $selections = $build = array();
+ $files = system_rebuild_module_data();
+
+ $selection_number = 0;
+
+ $info = _ctools_drush_export_info($tables, TRUE);
+ $exportables = $info['exportables'];
+ $schemas = $info['schemas'];
+
+ $export_tables = array();
+
+ foreach (array_keys($exportables) as $table) {
+ natcasesort($exportables[$table]);
+ $export_tables[$table] = $files[$schemas[$table]['module']]->info['name'] . ' (' . $table . ')';
+ }
+
+ foreach ($export_tables as $table => $table_title) {
+ if (!empty($exportables[$table])) {
+ $table_count = count($exportables[$table]);
+ $selection_number += $table_count;
+ foreach ($exportables[$table] as $key => $title) {
+ $build[$table]['title'] = $table_title;
+ $build[$table]['items'][$key] = $title;
+ $build[$table]['count'] = $table_count;
+ $selections[$table][$key] = $key;
+ }
+ }
+ }
+
+ drush_print(dt('Number of exportables selected: !number', array('!number' => $selection_number)));
+ drush_print(dt('By default all exportables are selected. Select a table to deselect exportables. Select "cancel" to start writing the files.'));
+
+ // Let's go into a loop.
+ $return = FALSE;
+ while (!$return) {
+
+ // Present the tables choice.
+ $table_rows = array();
+ foreach ($build as $table => $info) {
+ $table_rows[$table] = $info['title'] . ' (' . $info['count'] . ')';
+ }
+ $table_choice = drush_choice($table_rows, dt('Select a table. Select cancel to start writing files.'));
+
+ // Bail out.
+ if (!$table_choice) {
+ drush_log(dt('Selection mode done, starting to write the files.'), 'notice');
+ $return = TRUE;
+ return $selections;
+ }
+
+ // Present the exportables choice, using the drush_choice_multiple.
+ $max = count($build[$table_choice]['items']);
+ $exportable_rows = array();
+ foreach ($build[$table_choice]['items'] as $key => $title) {
+ $exportable_rows[$key] = $title;
+ }
+ drush_print(dt('Exportables from !table', array('!table' => $build[$table_choice]['title'])));
+ $multi_select = drush_choice_multiple($exportable_rows, $selections[$table_choice], dt('Select exportables.'), '!value', '!value (selected)', 0, $max);
+
+ // Update selections.
+ if (is_array($multi_select)) {
+ $build[$table_choice]['count'] = count($multi_select);
+ $selections[$table_choice] = array();
+ foreach ($multi_select as $key) {
+ $selections[$table_choice][$key] = $key;
+ }
+ }
+ }
+}
+
+/**
+ * Delete files in a directory, keeping the .module and .info files.
+ *
+ * @param $path
+ * Path to directory in which to remove files.
+ */
+function _ctools_drush_file_delete($path) {
+ if (is_dir($path)) {
+ $files = new DirectoryIterator($path);
+ foreach ($files as $fileInfo) {
+ if (!$fileInfo->isDot() && !in_array($fileInfo->getExtension(), array('module', 'info'))) {
+ unlink($fileInfo->getPathname());
+ }
+ }
+ }
+}
+
+/**
+ * Drush callback: Export info.
+ *
+ * @params $table_names
+ * Each argument will be taken as a CTools exportable table name.
+ */
+function ctools_drush_export_info() {
+ // Collect array of table names from args.
+ $table_names = func_get_args();
+
+ // Get format option to allow for alternative output.
+ $format = drush_get_option('format', FALSE);
+ $tables_only = drush_get_option('tables-only', FALSE);
+ $filter = drush_get_option('filter', FALSE);
+ $export_module = drush_get_option('module', FALSE);
+
+ $load = (bool) $filter || $export_module;
+
+ // Get info on these tables, or all tables if none specified.
+ $info = _ctools_drush_export_info($table_names, $load);
+ $exportables = $info['exportables'];
+
+ if (empty($exportables)) {
+ drush_log(dt('There are no exportables available.'), 'warning');
+ return;
+ }
+
+ // Filter by export module.
+ if (is_string($export_module)) {
+ $exportables = _ctools_drush_export_module_filter($exportables, $export_module);
+ }
+
+ if (empty($exportables)) {
+ drush_log(dt('There are no exportables matching this criteria.'), 'notice');
+ return;
+ }
+
+ $exportable_counts = _ctools_drush_count_exportables($exportables);
+
+ // Only use array keys if --tables-only option is set.
+ if ($tables_only) {
+ $exportables = array_keys($exportables);
+ }
+
+ // Use format from --format option if it's present, and send to drush_format.
+ if ($format) {
+ // Create array with all exportable info and counts in one.
+ $output = array(
+ 'exportables' => $exportables,
+ 'count' => $exportable_counts,
+ );
+ drush_print(drush_format($output, NULL, $format));
+ }
+ // Build a tabular output as default.
+ else {
+ $header = $tables_only ? array() : array(dt('Base table'), dt('Exportables'));
+ $rows = array();
+ foreach ($exportables as $table => $info) {
+ if (is_array($info)) {
+ $row = array(
+ $table,
+ // Machine name is better for this?
+ shellColours::getColouredOutput(implode("\n", array_keys($info)), 'light_green') . "\n",
+ );
+ $rows[] = $row;
+ }
+ else {
+ $rows[] = array($info);
+ }
+ }
+ if (!empty($rows)) {
+ drush_print("\n");
+ array_unshift($rows, $header);
+ drush_print_table($rows, TRUE, array(20));
+ drush_print(dt('Total exportables found: !total', array('!total' => $exportable_counts['total'])));
+ foreach ($exportable_counts['exportables'] as $table_name => $count) {
+ drush_print(dt('!table_name (!count)', array('!table_name' => $table_name, '!count' => $count)), 2);
+ }
+ drush_print("\n");
+ }
+ }
+}
+/**
+ * Drush callback: Acts as the hub for all op commands to keep
+ * all arg handling etc in one place.
+ */
+function ctools_drush_export_op_command() {
+ // Get all info for the current drush command.
+ $command = drush_get_command();
+ $op = '';
+
+ switch ($command['command']) {
+ case 'ctools-export-view':
+ $op = 'view';
+ break;
+ case 'ctools-export-revert':
+ // Revert is same as deleting. As any objects in the db are deleted.
+ $op = 'delete';
+ break;
+ case 'ctools-export-enable':
+ $op = 'enable';
+ break;
+ case 'ctools-export-disable':
+ $op = 'disable';
+ break;
+ }
+
+ if (!$op) {
+ return;
+ }
+
+ if (drush_get_option('all', FALSE)) {
+ $info = _ctools_drush_export_info('', TRUE);
+ $exportable_info = $info['exportables'];
+
+ $all = drush_confirm(dt('Are you sure you would like to !op all exportables on the system?',
+ array('!op' => _ctools_drush_export_op_alias($op))));
+
+ if ($all && $exportable_info) {
+ foreach ($exportable_info as $table => $exportables) {
+ if (!empty($exportables)) {
+ ctools_drush_export_op($op, $table, $exportables);
+ }
+ }
+ }
+ }
+ else {
+ $args = func_get_args();
+ // Table name should always be first arg...
+ $table_name = array_shift($args);
+ // Any additional args are assumed to be exportable names.
+ $object_names = $args;
+
+ // Return any exportables based on table name, object names, options.
+ $exportables = _ctools_drush_export_op_command_logic($op, $table_name, $object_names);
+
+ if ($exportables) {
+ ctools_drush_export_op($op, $table_name, $exportables);
+ }
+ }
+}
+
+/**
+ * Iterate through exportable object names, load them, and pass each
+ * object to the correct op function.
+ *
+ * @param $op
+ * @param $table_name
+ * @param $exportables
+ *
+ */
+function ctools_drush_export_op($op = '', $table_name = '', $exportables = NULL) {
+ $objects = ctools_export_crud_load_multiple($table_name, array_keys($exportables));
+
+ $function = '_ctools_drush_export_' . $op;
+ if (function_exists($function)) {
+ foreach ($objects as $object) {
+ $function($table_name, $object);
+ }
+ }
+ else {
+ drush_log(dt('CTools CRUD function !function doesn\'t exist.',
+ array('!function' => $function)), 'error');
+ }
+}
+
+/**
+ * Helper function to abstract logic for selecting exportable types/objects
+ * from individual commands as they will all share this same error
+ * handling/arguments for returning list of exportables.
+ *
+ * @param $table_name
+ * @param $object_names
+ *
+ * @return
+ * Array of exportable objects (filtered if necessary, by name etc..) or FALSE if not.
+ */
+function _ctools_drush_export_op_command_logic($op = '', $table_name = NULL, array $object_names = array()) {
+ if (!$table_name) {
+ drush_log(dt('Exportable table name empty. Use the --all command if you want to perform this operation on all tables.'), 'error');
+ return FALSE;
+ }
+
+ // Get export info based on table name.
+ $info = _ctools_drush_export_info(array($table_name), TRUE);
+
+ if (!isset($info['exportables'][$table_name])) {
+ drush_log(dt('Exportable table name not found.'), 'error');
+ return FALSE;
+ }
+
+ $exportables = &$info['exportables'];
+
+ if (empty($object_names)) {
+ $all = drush_confirm(dt('No object names entered. Would you like to try and !op all exportables of type !type',
+ array('!op' => _ctools_drush_export_op_alias($op), '!type' => $table_name)));
+ if (!$all) {
+ drush_log(dt('Command cancelled'), 'success');
+ return FALSE;
+ }
+ }
+ else {
+ // Iterate through object names and check they exist in exportables array.
+ // Log error and unset them if they don't.
+ foreach ($object_names as $object_name) {
+ if (!isset($exportables[$table_name][$object_name])) {
+ drush_log(dt('Invalid exportable: !exportable', array('!exportable' => $object_name)), 'error');
+ unset($object_names[$table_name][$object_name]);
+ }
+ }
+ // Iterate through exportables to get just a list of selected ones.
+ foreach (array_keys($exportables[$table_name]) as $exportable) {
+ if (!in_array($exportable, $object_names)) {
+ unset($exportables[$table_name][$exportable]);
+ }
+ }
+ }
+
+ $export_module = drush_get_option('module', FALSE);
+
+ if (is_string($export_module)) {
+ $exportables = _ctools_drush_export_module_filter($exportables, $export_module);
+ }
+
+ return $exportables[$table_name];
+}
+
+/**
+ * Return array of CTools exportable info based on available tables returned from
+ * ctools_export_get_schemas().
+ *
+ * @param $table_names
+ * Array of table names to return.
+ * @param $load
+ * (bool) should ctools exportable objects be loaded for each type.
+ * The default behaviour will load just a list of exportable names.
+ *
+ * @return
+ * Nested arrays of available exportables, keyed by table name.
+ */
+function _ctools_drush_export_info(array $table_names = array(), $load = FALSE) {
+ ctools_include('export');
+ // Get available schemas that declare exports.
+ $schemas = ctools_export_get_schemas(TRUE);
+ $exportables = array();
+
+ if (!empty($schemas)) {
+ // Remove types we don't want, if any.
+ if (!empty($table_names)) {
+ foreach (array_keys($schemas) as $table_name) {
+ if (!in_array($table_name, $table_names)) {
+ unset($schemas[$table_name]);
+ }
+ }
+ }
+ // Load array of available exportables for each schema.
+ foreach ($schemas as $table_name => $schema) {
+ // Load all objects.
+ if ($load) {
+ $exportables[$table_name] = ctools_export_crud_load_all($table_name);
+ }
+ // Get a list of exportable names.
+ else {
+ if (!empty($schema['export']['list callback']) && function_exists($schema['export']['list callback'])) {
+ $exportables[$table_name] = $schema['export']['list callback']();
+ }
+ else {
+ $exportables[$table_name] = ctools_export_default_list($table_name, $schema);
+ }
+ }
+ }
+ }
+
+ if ($load) {
+ $filter = drush_get_option('filter', FALSE);
+ $exportables = _ctools_drush_filter_exportables($exportables, $filter);
+ }
+
+ return array('exportables' => $exportables, 'schemas' => $schemas);
+}
+
+/*
+ * View a single object.
+ *
+ * @param $table_name
+ * @param $object
+ */
+function _ctools_drush_export_view($table_name, $object) {
+ $indent = drush_get_option('indent', '');
+ $no_colour = drush_get_option('no-colour', FALSE);
+ $export = ctools_export_crud_export($table_name, $object, $indent);
+ if ($no_colour) {
+ drush_print("\n$export");
+ }
+ else {
+ drush_print(shellColours::getColouredOutput("\n$export", 'light_green'));
+ }
+}
+
+/*
+ * Revert a single object.
+ *
+ * @param $table_name
+ * @param $object
+ */
+function _ctools_drush_export_delete($table_name, $object) {
+ $name = _ctools_drush_get_export_name($table_name, $object);
+
+ if (_ctools_drush_object_is_overridden($object)) {
+ // Remove from db.
+ ctools_export_crud_delete($table_name, $object);
+ drush_log("Reverted object: $name", 'success');
+ }
+ else {
+ drush_log("Nothing to revert for: $name", 'notice');
+ }
+}
+
+/*
+ * Enable a single object.
+ *
+ * @param $table_name
+ * @param $object
+ */
+function _ctools_drush_export_enable($table_name, $object) {
+ $name = _ctools_drush_get_export_name($table_name, $object);
+
+ if (_ctools_drush_object_is_disabled($object)) {
+
+ // Enable object.
+ ctools_export_crud_enable($table_name, $object);
+ drush_log("Enabled object: $name", 'success');
+ }
+ else {
+ drush_log("$name is already Enabled", 'notice');
+ }
+}
+
+/*
+ * Disable a single object.
+ *
+ * @param $table_name
+ * @param $object
+ */
+function _ctools_drush_export_disable($table_name, $object) {
+ $name = _ctools_drush_get_export_name($table_name, $object);
+
+ if (!_ctools_drush_object_is_disabled($object)) {
+ // Disable object.
+ ctools_export_crud_disable($table_name, $object);
+ drush_log("Disabled object: $name", 'success');
+ }
+ else {
+ drush_log("$name is already disabled", 'notice');
+ }
+}
+
+/**
+ * Filter a nested array of exportables by export module.
+ *
+ * @param $exportables array
+ * Passed by reference. A nested array of exportables, keyed by table name.
+ * @param $export_module string
+ * The name of the export module providing the exportable.
+ */
+function _ctools_drush_export_module_filter($exportables, $export_module) {
+ $module_list = module_list();
+
+ if (!isset($module_list[$export_module])) {
+ drush_log(dt('Invalid export module: !export_module', array('!export_module' => $export_module)), 'error');
+ }
+
+ foreach ($exportables as $table => $objects) {
+ foreach ($objects as $key => $object) {
+ if (empty($object->export_module) || ($object->export_module !== $export_module)) {
+ unset($exportables[$table][$key]);
+ }
+ }
+ }
+
+ return array_filter($exportables);
+}
+
+/**
+ * Gets the key for an exportable type.
+ *
+ * @param $table_name
+ * The exportable table name.
+ * @param $object
+ * The exportable object.
+ *
+ * @return string
+ * The key defined in the export schema data.
+ */
+function _ctools_drush_get_export_name($table_name, $object) {
+ $info = _ctools_drush_export_info(array($table_name));
+ $key = $info['schemas'][$table_name]['export']['key'];
+ return $object->{$key};
+}
+
+/**
+ * Determine if an object is disabled.
+ *
+ * @param $object
+ * Loaded CTools exportable object.
+ *
+ * @return TRUE or FALSE
+ */
+function _ctools_drush_object_is_disabled($object) {
+ return (isset($object->disabled) && ($object->disabled == TRUE)) ? TRUE : FALSE;
+}
+
+/**
+ * Determine if an object is enabled.
+ *
+ * @see _ctools_drush_object_is_disabled.
+ */
+function _ctools_drush_object_is_enabled($object) {
+ return (empty($object->disabled)) ? TRUE : FALSE;
+}
+
+/**
+ * Determine if an object is overridden.
+ */
+function _ctools_drush_object_is_overridden($object) {
+ $status = EXPORT_IN_CODE + EXPORT_IN_DATABASE;
+ return ($object->export_type == $status) ? TRUE : FALSE;
+}
+
+/**
+ * Determine if an object is not overridden.
+ */
+function _ctools_drush_object_is_not_overridden($object) {
+ $status = EXPORT_IN_CODE + EXPORT_IN_DATABASE;
+ return ($object->export_type == $status) ? FALSE : TRUE;
+}
+
+/**
+ * Determine if an object is only in the db.
+ */
+function _ctools_drush_object_is_db_only($object) {
+ return ($object->export_type == EXPORT_IN_DATABASE) ? TRUE : FALSE;
+}
+
+/**
+ * Determine if an object is not in the db.
+ */
+function _ctools_drush_object_is_not_db_only($object) {
+ return ($object->export_type == EXPORT_IN_DATABASE) ? FALSE : TRUE;
+}
+
+/**
+ * Determine if an object is a code only default.
+ */
+function _ctools_drush_object_is_code_only($object) {
+ return ($object->export_type == EXPORT_IN_CODE) ? TRUE : FALSE;
+}
+
+/**
+ * Determine if an object is not a code only default.
+ */
+function _ctools_drush_object_is_not_code_only($object) {
+ return ($object->export_type == EXPORT_IN_CODE) ? FALSE : TRUE;
+}
+
+/**
+ * Return an array of count information based on exportables array.
+ *
+ * @param $exportables
+ * Array of exportables to count.
+ *
+ * @return
+ * Array of count data containing the following:
+ * 'total' - A total count of all exportables.
+ * 'exportables' - An array of exportable counts per table.
+ */
+function _ctools_drush_count_exportables($exportables) {
+ $count = array('exportables' => array());
+
+ foreach ($exportables as $table => $objects) {
+ // Add the object count for each table.
+ $count['exportables'][$table] = count($objects);
+ }
+
+ // Once all tables have been counted, total these up.
+ $count['total'] = array_sum($count['exportables']);
+
+ return $count;
+}
+
+/**
+ * Filters a collection of exportables based on filters.
+ *
+ * @param $exportables
+ * @param $filter
+ */
+function _ctools_drush_filter_exportables($exportables, $filter) {
+ $eval = FALSE;
+
+ if (is_string($filter)) {
+ switch ($filter) {
+ // Show enabled exportables only.
+ case 'enabled':
+ $eval = '_ctools_drush_object_is_disabled';
+ break;
+ // Show disabled exportables only.
+ case 'disabled':
+ $eval = '_ctools_drush_object_is_enabled';
+ break;
+ // Show overridden exportables only.
+ case 'overridden':
+ $eval = '_ctools_drush_object_is_not_overridden';
+ break;
+ // Show database only exportables.
+ case 'database':
+ $eval = '_ctools_drush_object_is_not_db_only';
+ break;
+ // Show code only exportables.
+ case 'code':
+ $eval = '_ctools_drush_object_is_not_code_only';
+ break;
+ // Do nothing.
+ case 'all':
+ break;
+ default:
+ drush_log(dt('Invalid filter option. Available options are: enabled, disabled, overridden, database, and code.'), 'error');
+ return;
+ }
+
+ if ($eval) {
+ foreach ($exportables as $table => $objects) {
+ foreach ($objects as $key => $object) {
+ if ($eval($object)) {
+ unset($exportables[$table][$key]);
+ }
+ }
+ }
+ }
+ }
+
+ return array_filter($exportables);
+}
+
+/**
+ * Return an alias for an op, that will be used to show as output.
+ * For now, this is mainly necessary for delete => revert alias.
+ *
+ * @param $op
+ * The op name. Such as 'enable', 'disable', or 'delete'.
+ *
+ * @return
+ * The matched alias value or the original $op passed in if not found.
+ */
+function _ctools_drush_export_op_alias($op) {
+ $aliases = array(
+ 'delete' => 'revert',
+ );
+
+ if (isset($aliases[$op])) {
+ return $aliases[$op];
+ }
+
+ return $op;
+}
+
+/**
+ * Convert the drush options from a csv list into an array.
+ *
+ * @param $drush_option
+ * The drush option name to invoke.
+ *
+ * @return
+ * Exploded array of options.
+ */
+function _ctools_drush_explode_options($drush_option) {
+ $options = drush_get_option($drush_option, array());
+ if (!empty($options)) {
+ $options = explode(',', $options);
+ return array_map('trim', $options);
+ }
+
+ return $options;
+}
+
+/**
+ * Class to deal with wrapping output strings with
+ * colour formatting for the shell.
+ */
+class shellColours {
+
+ private static $foreground_colours = array(
+ 'black' => '0;30',
+ 'dark_gray' => '1;30',
+ 'blue' => '0;34',
+ 'light_blue' => '1;34',
+ 'green' => '0;32',
+ 'light_green' => '1;32',
+ 'cyan' => '0;36',
+ 'light_cyan' => '1;36',
+ 'red' => '0;31',
+ 'light_red' => '1;31',
+ 'purple' => '0;35',
+ 'light_purple' => '1;35',
+ 'brown' => '0;33',
+ 'yellow' => '1;33',
+ 'light_gray' => '0;37',
+ 'white' => '1;37',
+ );
+
+ private static $background_colours = array(
+ 'black' => '40',
+ 'red' => '41',
+ 'green' => '42',
+ 'yellow' => '43',
+ 'blue' => '44',
+ 'magenta' => '45',
+ 'cyan' => '46',
+ 'light_gray' => '47',
+ );
+
+ private function __construct() {}
+
+ // Returns coloured string
+ public static function getColouredOutput($string, $foreground_colour = NULL, $background_colour = NULL) {
+ $coloured_string = "";
+
+ // Check if given foreground colour found
+ if ($foreground_colour) {
+ $coloured_string .= "\033[" . self::$foreground_colours[$foreground_colour] . "m";
+ }
+ // Check if given background colour found
+ if ($background_colour) {
+ $coloured_string .= "\033[" . self::$background_colours[$background_colour] . "m";
+ }
+
+ // Add string and end colouring
+ $coloured_string .= $string . "\033[0m";
+
+ return $coloured_string;
+ }
+
+ // Returns all foreground colour names
+ public static function getForegroundColours() {
+ return array_keys(self::$foreground_colours);
+ }
+
+ // Returns all background colour names
+ public static function getBackgroundColours() {
+ return array_keys(self::$background_colours);
+ }
+
+} // shellColours
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/about.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/about.html
new file mode 100644
index 0000000..30b64c2
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/about.html
@@ -0,0 +1,29 @@
+<p>The Chaos Tool Suite is a series of tools for developers to make code that I've found to be very useful to Views and Panels more readily available. Certain methods of doing things, particularly with AJAX, exportable objects and a plugin system, are proving to be ideas that are useful outside of just Views and Panels. This module does not offer much directly to the end user, but instead, creates a library for other modules to use. If you are an end user and some module asked you to install the CTools suite, then this is far as you really need to go. If you're a developer and are interested in these tools, read on!</p>
+
+<h2>Tools provided by CTools</h2>
+
+<dl>
+<dt><a href="&topic:ctools/plugins&">Plugins</a></dt>
+<dd>The plugins tool allows a module to allow <b>other</b> modules (and themes!) to provide plugins which provide some kind of functionality or some kind of task. For example, in Panels there are several types of plugins: Content types (which are like blocks), layouts (which are page layouts) and styles (which can be used to style a panel). Each plugin is represented by a .inc file, and the functionality they offer can differ wildly.</dd>
+
+<dt><a href="&topic:ctools/context&">Context</a></dt>
+<dd>Context is the idea that the objects that are used in page generation have more value than simply creating a single piece of output. Instead, contexts can be used to create multiple pieces of content that can all be put onto the page. Additionally, contexts can be used to derive other contexts via relationships, such as determining the node author and displaying data about the new context.</dd>
+
+<dt><a href="&topic:ctools/ajax&">AJAX Tools</a></dt>
+<dd>AJAX (also known as AHAH) is a method of allowing the browser and the server to communicate without requiring a page refresh. It can be used to create complicated interactive forms, but it is somewhat difficult to integrate into Drupal's Form API. These tools make it easier to accomplish this goal. In addition, CTools provides a few other javascript helpers, such as a modal dialog, a collapsible div, a simple dropdown and dependent checkboxes.</dd>
+
+<dt><a href="&topic:ctools/css&">CSS scrubbing and caching</a></dt>
+<dd>Drupal comes with a fantastic array of tools to ensure HTML is safe to output but does not contain any similar tools for CSS. CTools provides a small tool to sanitize CSS, so user-input CSS code can still be safely used. It also provides a method for caching CSS for better performance.</dd>
+
+<dt><a href="&topic:ctools/export&">Exportable objects</a></dt>
+<dd>Views and Panels both use objects that can either be in code or in the database, and the objects can be exported into a piece of PHP code, so they can be moved from site to site or out of the database entirely. This library abstracts that functionality, so other modules can use this same concept for their data.</dd>
+
+<dt><a href="&topic:ctools/form&">Form tools</a></dt>
+<dd>Drupal 6's FAPI really improved over Drupal 5, and made a lot of things possible. Still, it missed a few items that were needed to make form wizards and truly dynamic AJAX forms possible. CTools includes a replacement for drupal_get_form() that has a few more options and allows the caller to examine the $form_state once the form has completed.</dd>
+
+<dt><a href="&topic:ctools/wizard&">Form wizards</a></dt>
+<dd>Finally! An easy way to have form wizards, which is any 'form' that is actually a string of forms that build up to a final conclusion. The form wizard supports a single entry point, the ability to choose whether or not the user can go forward/back/up on the form and easy callbacks to handle the difficult job of dealing with data in between forms.</dd>
+
+<dt><a href="&topic:ctools/object-cache&">Temporary object cache</a></dt>
+<dd>For normal forms, all of the data needed for an object is stored in the form so that the browser handles a lot of the work. For multi-step and ajax forms, however, this is impractical, and letting the browser store data can be insecure. The object cache provides a non-volatile location to store temporary data while the form is being worked on. This is much safer than the standard Drupal caching mechanism, which is volatile, meaning it can be cleared at any time and any system using it must be capable of recreating the data that was there. This system also allows for object locking, since any object which has an item in the cache from another person can be assumed to be 'locked for editing'.</dd>
+</dl>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/ajax.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/ajax.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/ajax.html
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/collapsible-div.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/collapsible-div.html
new file mode 100644
index 0000000..b9b6d9c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/collapsible-div.html
@@ -0,0 +1 @@
+<p>To be written.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-access.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-access.html
new file mode 100644
index 0000000..95a8d7f
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-access.html
@@ -0,0 +1,12 @@
+<p>Access plugins allow context based access control to pages.</p>
+<pre> 'title' => Title of the plugin
+ 'description' => Description of the plugin
+ 'callback' => callback to see if there is access is available. params: $conf, $contexts, $account
+ 'required context' => zero or more required contexts for this access plugin
+ 'default' => an array of defaults or a callback giving defaults
+ 'settings form' => settings form. params: &$form, &$form_state, $conf
+ settings form validate
+ settings form submit
+</pre>
+
+<p><strong>Warning:</strong> your settings array will be stored <strong>in the meny system</strong> to reduce loads, so be <strong>trim</strong>.</p> \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-arguments.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-arguments.html
new file mode 100644
index 0000000..5c479ae
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-arguments.html
@@ -0,0 +1,14 @@
+<p>Arguments create a context from external input, which is assumed to be a string as though it came from a URL element.</p>
+
+<pre>'title' => title
+ 'description' => Description
+ 'keyword' => Default keyword for the context
+ 'context' => Callback to create the context. Params: $arg = NULL, $conf = NULL, $empty = FALSE
+ 'default' => either an array of default settings or a string which is a callback or null to not use.
+ 'settings form' => params: $form, $form_state, $conf -- gets the whole form. Should put anything it wants to keep automatically in $form['settings']
+ 'settings form validate' => params: $form, $form_state
+ 'settings form submit' => params: $form, $form_state
+ 'criteria form' => params: $form, &$form_state, $conf, $argument, $id -- gets the whole argument. It should only put form widgets in $form[$id]. $conf may not be properly initialized so always guard against this due to arguments being changed and handlers not being updated to match.
+ + submit + validate
+ 'criteria select' => returns true if the selected criteria matches the context. params: $context, $conf
+</pre>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-content.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-content.html
new file mode 100644
index 0000000..8af5df4
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-content.html
@@ -0,0 +1,153 @@
+<p>The CTools pluggable content system provides various pieces of content as discrete bits of data that can be added to other applications, such as Panels or Dashboard via the UI. Whatever the content is added to stores the configuration for that individual piece of content, and provides this to the content.</p>
+
+<p>Each content type plugin will be contained in a .inc file, with subsidiary files, if necessary, in or near the same directory. Each content type consists of some information and one or more subtypes, which all use the same renderer. Subtypes are considered to be instances of the type. For example, the 'views' content type would have each view in the system as a subtype. Many content types will have exactly one subtype.</p>
+
+<p>Because the content and forms can be provided via ajax, the plugin also provides a list of CSS and JavaScript information that should be available on whatever page the content or forms may be AJAXed onto.</p>
+
+<p>For the purposes of selecting content from the UI, each content subtype will have the following information:</p>
+
+<ul>
+ <li>A title</li>
+ <li>A short description</li>
+ <li>A category [Do we want to add hierarchy categories? Do we want category to be more than just a string?]</li>
+ <li>An icon [do we want multiple icons? This becomes a hefty requirement]</li>
+</ul>
+
+<p>Each piece of content provides one or more configuration forms, if necessary, and the system that includes the content will handle the data storage. These forms can be provided in sequence as wizards or as extra forms that can be accessed through advanced administration.</p>
+
+<p>The plugin for a content type should contain:</p>
+
+<dl>
+ <dt>title</dt>
+ <dd>For use on the content permissions screen.</dd>
+ <dt>content types</dt>
+ <dd>Either an array of content type definitions, or a callback that will return content type definitions. This callback will get the plugin definition as an argument.</dd>
+
+ <dt>content type</dt>
+ <dd>[Optional] Provide a single content type definition. This is only necessary if content types might be intensive.</dd>
+
+ <dt>render callback</dt>
+ <dd>The callback to render the content. Parameters:
+ <dl>
+ <dt>$subtype</dt>
+ <dd>The name of the subtype being rendered. NOT the loaded subtype data.</dd>
+
+ <dt>$conf</dt>
+ <dd>The stored configuration for the content.</dd>
+
+ <dt>$args</dt>
+ <dd>Any arguments passed.</dd>
+
+ <dt>$context</dt>
+ <dd>An array of contexts requested by the required contexts and assigned by the configuration step.</dd>
+
+ <dt>$incoming_content</dt>
+ <dd>Any 'incoming content' if this is a wrapper.</dd>
+ </dl>
+ </dd>
+
+ <dt>admin title</dt>
+ <dd>A callback to provide the administrative title. If it is not a function, then it will be counted as a string to use as the admin title.</dd>
+
+ <dt>admin info</dt>
+ <dd>A callback to provide administrative information about the content, to be displayed when manipulating the content. It should contain a summary of configuration.</dd>
+
+ <dt>edit form</dt>
+ <dd>Either a single form ID or an array of forms *keyed* by form ID with the value to be used as the title of the form. %title me be used as a placeholder for the administrative title if necessary.
+ Example:
+<pre>array(
+ 'ctools_example_content_form_second' =&gt; t('Configure first form'),
+ 'ctools_example_content_form_first' =&gt; t('Configure second form'),
+),
+</pre>
+The first form will always have required configuration added to it. These forms are normal FAPI forms, but you do not need to provide buttons, these will be added by the form wizard.
+ </dd>
+
+ <dt>add form</dt>
+ <dd>[Optional] If different from the edit forms, provide them here in the same manner. Also may be set to FALSE to not have an add form.</dd>
+
+ <dt>css</dt>
+ <dd>A file or array of CSS files that are necessary for the content.</dd>
+
+ <dt>js</dt>
+ <dd>A file or array of javascript files that are necessary for the content to be displayed.</dd>
+
+ <dt>admin css</dt>
+ <dd>A file or array of CSS files that are necessary for the forms.</dd>
+
+ <dt>admin js</dt>
+ <dd>A file or array of JavaScript files that are necessary for the forms.</dd>
+
+ <dt>extra forms</dt>
+ <dd>An array of form information to handle extra administrative forms.</dd>
+
+ <dt>no title override</dt>
+ <dd>Set to TRUE if the title cannot be overridden.</dd>
+
+ <dt>single</dt>
+ <dd>Set to TRUE if this content provides exactly one subtype.</dd>
+
+ <dt>render last</dt>
+ <dd>Set to true if for some reason this content needs to render after other content. This is primarily used for forms to ensure that render order is correct.</dd>
+</dl>
+
+<p>TODO: many of the above callbacks can be assumed based upon patterns: modulename + '_' + name + '_' + function. i.e, render, admin_title, admin_info, etc.</p>
+
+<p>TODO: Some kind of simple access control to easily filter out content.</p>
+
+<p>The subtype definition should contain:</p>
+
+<dl>
+ <dt>title</dt>
+ <dd>The title of the subtype.</dd>
+
+ <dt>icon</dt>
+ <dd>The icon to display for the subtype.</dd>
+
+ <dt>path</dt>
+ <dd>The path for the icon if it is not in the same directory as the plugin.</dd>
+
+ <dt>description</dt>
+ <dd>The short description of the subtype, to be used when selecting it in the UI.</dd>
+
+ <dt>category</dt>
+ <dd>Either a text string for the category, or an array of the text string followed by the category weight.</dd>
+
+ <dt>required context [Optional]</dt>
+
+ <dd>Either a ctools_context_required or ctools_context_optional or array of contexts for this content. If omitted, no contexts are used.</dd>
+</dl>
+
+<h2>Rendered content</h2>
+
+<p>Rendered content is a little more than just HTML.</p>
+
+<dl>
+ <dt>title</dt>
+ <dd>The safe to render title of the content.</dd>
+
+ <dt>content</dt>
+ <dd>The safe to render HTML content.</dd>
+
+ <dt>links</dt>
+ <dd>An array of links associated with the content suitable for theme('links').</dd>
+
+ <dt>more</dt>
+ <dd>An optional 'more' link (destination only)</dd>
+
+ <dt>admin_links</dt>
+ <dd>Administrative links associated with the content, suitable for theme('links').</dd>
+
+ <dt>feeds</dt>
+ <dd>An array of feed icons or links associated with the content. Each member of the array is rendered HTML.</dd>
+
+ <dt>type</dt>
+ <dd>The content type.</dd>
+
+ <dt>subtype</dt>
+ <dd>The content subtype. These two may be used together as module-delta for block style rendering.</dd>
+</dl>
+
+<h2>Todo: example</h2>
+
+<p>Todo after implementations are updated to new version.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-context.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-context.html
new file mode 100644
index 0000000..2314bd5
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-context.html
@@ -0,0 +1,13 @@
+<p>Context plugin data:</p>
+
+<pre>
+ 'title' => Visible title
+ 'description' => Description of context
+ 'context' => Callback to create a context. Params: $empty, $data = NULL, $conf = FALSE
+ 'settings form' => Callback to show a context setting form. Params: ($conf, $external = FALSE)
+ 'settings form validate' => params: ($form, &$form_values, &$form_state)
+ 'settings form submit' => params: 'ctools_context_node_settings_form_submit',
+ 'keyword' => The default keyword to use.
+ 'context name' => The unique identifier for this context for use by required context checks.
+ 'no ui' => if TRUE this context cannot be selected.
+</pre> \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-relationships.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-relationships.html
new file mode 100644
index 0000000..cc9969e
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context-relationships.html
@@ -0,0 +1,13 @@
+<p>Relationship plugin data:</p>
+
+<pre>
+ 'title' => The title to display.
+ 'description' => Description to display.
+ 'keyword' => Default keyword for the context created by this relationship.
+ 'required context' => One or more ctools_context_required/optional objects
+ describing the context input.
+ new panels_required_context(t('Node'), 'node'),
+ 'context' => The callback to create the context. Params: ($context = NULL, $conf)
+ 'settings form' => Settings form. Params: $conf
+ 'settings form validate' => Validate.
+</pre>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/context.html
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/css.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/css.html
new file mode 100644
index 0000000..b9b6d9c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/css.html
@@ -0,0 +1 @@
+<p>To be written.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/ctools.help.ini b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/ctools.help.ini
new file mode 100644
index 0000000..fcb121b
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/ctools.help.ini
@@ -0,0 +1,97 @@
+[advanced help settings]
+line break = TRUE
+
+[about]
+title = About Chaos Tool Suite
+weight = -100
+
+[context]
+title = Context tool
+weight = -40
+
+[context-access]
+title = Context based access control plugins
+parent = context
+
+[context-context]
+title = Context plugins
+parent = context
+
+[context-arguments]
+title = Argument plugins
+parent = context
+
+[context-relationships]
+title = Relationship plugins
+parent = context
+
+[context-content]
+title = Content plugins
+parent = context
+
+[css]
+title = CSS scrubbing and caching tool
+
+[menu]
+title = Miscellaneous menu helper tool
+
+[plugins]
+title = Plugins and APIs tool
+weight = -50
+
+[plugins-api]
+title = Implementing APIs
+parent = plugins
+
+[plugins-creating]
+title = Creating plugins
+parent = plugins
+
+[plugins-implementing]
+title = Implementing plugins
+parent = plugins
+
+[export]
+title = Exportable objects tool
+
+[export-ui]
+title = Exportable objects UI creator
+
+[form]
+title = Form tools
+
+[wizard]
+title = Form wizard tool
+
+[ajax]
+title = AJAX and Javascript helper tools
+weight = -30
+
+[modal]
+title = Javascript modal tool
+parent = ajax
+
+[collapsible-div]
+title = Javascript collapsible DIV
+parent = ajax
+
+[dropdown]
+title = Javascript dropdown
+parent = ajax
+
+[dropbutton]
+title = Javascript dropbutton
+parent = ajax
+
+[dependent]
+title = Dependent checkboxes and radio buttons
+parent = ajax
+
+[object-cache]
+title = Temporary object caching
+
+; A bunch of this stuff we'll put in panels.
+
+[plugins-content]
+title = Creating content type plugins
+parent = panels%api
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dependent.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dependent.html
new file mode 100644
index 0000000..b9b6d9c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dependent.html
@@ -0,0 +1 @@
+<p>To be written.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dropbutton.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dropbutton.html
new file mode 100644
index 0000000..b9b6d9c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dropbutton.html
@@ -0,0 +1 @@
+<p>To be written.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dropdown.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dropdown.html
new file mode 100644
index 0000000..b9b6d9c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/dropdown.html
@@ -0,0 +1 @@
+<p>To be written.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/export-ui.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/export-ui.html
new file mode 100644
index 0000000..e6b1086
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/export-ui.html
@@ -0,0 +1,85 @@
+<p>Most user interfaces for exportables are very similar, so CTools includes a tool to provide the framework for the most common UI. This tool is a plugin of the 'export_ui' type. In order to create a UI for your exportable object with this tool, you first need to ensure that your module supports the plugin:</p>
+
+<pre>
+function HOOK_ctools_plugin_directory($module, $plugin) {
+ if ($module == 'ctools' && $plugin == 'export_ui') {
+ return 'plugins/' . $plugin;
+ }
+}
+</pre>
+
+<p>Then, you need to create a plugin .inc file describing your UI. Most of the UI runs with sane but simple defaults, so for the very simplest UI you don't need to do very much. This is a very simple example plugin for the 'example' export type:</p>
+
+<pre>
+$plugin = array(
+ // The name of the table as found in the schema in hook_install. This
+ // must be an exportable type with the 'export' section defined.
+ 'schema' => 'example',
+
+ // The access permission to use. If not provided it will default to
+ // 'administer site configuration'
+ 'access' => 'administer example',
+
+ // You can actually define large chunks of the menu system here. Nothing
+ // is required here. If you leave out the values, the prefix will default
+ // to admin/structure and the item will default to the plugin name.
+ 'menu' => array(
+ 'menu prefix' => 'admin/structure',
+ 'menu item' => 'example',
+ // Title of the top level menu. Note this should not be translated,
+ // as the menu system will translate it.
+ 'menu title' => 'Example',
+ // Description of the top level menu, which is usually needed for
+ // menu items in an administration list. Will be translated
+ // by the menu system.
+ 'menu description' => 'Administer site example objects.',
+ ),
+
+ // These are required to provide proper strings for referring to the
+ // actual type of exportable. "proper" means it will appear at the
+ // beginning of a sentence.
+ 'title singular' => t('example'),
+ 'title singular proper' => t('Example'),
+ 'title plural' => t('examples'),
+ 'title plural proper' => t('Examples'),
+
+ // This will provide you with a form for editing the properties on your
+ // exportable, with validate and submit handler.
+ //
+ // The item being edited will be in $form_state['item'].
+ //
+ // The submit handler is only responsible for moving data from
+ // $form_state['values'] to $form_state['item'].
+ //
+ // All callbacks will accept &$form and &$form_state as arguments.
+ 'form' => array(
+ 'settings' => 'example_ctools_export_ui_form',
+ 'validate' => 'example_ctools_export_ui_form_validate',
+ 'submit' => 'example_ctools_export_ui_form_submit',
+ ),
+
+);
+</pre>
+
+<p>For a more complete list of what you can set in your plugin, please see ctools_export_ui_defaults() in includes/export-ui.inc to see what the defaults are.</p>
+
+<h2>More advanced UIs</h2>
+
+<p>The bulk of this UI is built on an class called ctools_export_ui, which is itself stored in ctools/plugins/export_ui as the default plugin. Many UIs will have more complex needs than the defaults provide. Using OO and overriding methods can allow an implementation to use the basics and still provide more where it is needed. To utilize this, first add a 'handler' directive to your plugin .inc file:</p>
+
+<pre>
+ 'handler' => array(
+ 'class' => 'ctools_export_ui_example',
+ 'parent' => 'ctools_export_ui',
+ ),
+</pre>
+
+Then create your class in ctools_export_ui_example.class.php in your plugins directory:
+
+<pre>
+class ctools_export_ui_example extends ctools_export_ui {
+
+}
+</pre>
+
+<p>You can override any method found in the class (see the source file for details). In particular, there are several list methods that are good candidates for overriding if you need to provide richer data for listing, sorting or filtering. If you need multi-step add/edit forms, you can override edit_page(), add_page(), clone_page(), and import_page() to put your wizard in place of the basic editing system. For an example of how to use multi-step wizards, see the import_page() method.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/export.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/export.html
new file mode 100644
index 0000000..3a774e8
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/export.html
@@ -0,0 +1,291 @@
+<p>Exportable objects are objects that can live either in the database or in code, or in both. If they live in both, then the object in code is considered to be "overridden", meaning that the version in code is ignored in favor of the version in the database.</p>
+
+<p>The main benefit to this is that you can move objects that are intended to be structure or feature-related into code, thus removing them entirely from the database. This is a very important part of the deployment path, since in an ideal world, the database is primarily user generated content, whereas site structure and site features should be in code. However, many many features in Drupal rely on objects being in the database and provide UIs to create them.</p>
+
+<p>Using this system, you can give your objects dual life. They can be created in the UI, exported into code and put in revision control. Views and Panels both use this system heavily. Plus, any object that properly implements this system can be utilized by the Features module to be used as part of a bundle of objects that can be turned into feature modules.</p>
+
+<p>Typically, exportable objects have two identifiers. One identifier is a simple serial used for database identification. It is a primary key in the database and can be used locally. It also has a name which is an easy way to uniquely identify it. This makes it much less likely that importing and exporting these objects across systems will have collisions. They still can, of course, but with good name selection, these problems can be worked around.</p>
+
+<h2>Making your objects exportable</h2>
+
+<p>To make your objects exportable, you do have to do a medium amount of work.</p>
+
+<ol>
+ <li>Create a chunk of code in your object's schema definition in the .install file to introduce the object to CTools' export system.</li>
+ <li>Create a load function for your object that utilizes ctools_export_load_object().</li>
+ <li>Create a save function for your object that utilizes drupal_write_record() or any method you desire.</li>
+ <li>Create an import and export mechanism from the UI.</li>
+</ol>
+
+<h2>The export section of the schema file</h2>
+
+<p>Exportable objects are created by adding definition to the schema in an 'export' section. For example:</p>
+
+<pre>
+function mymodule_schema() {
+ $schema['mymodule_myobj'] = array(
+ 'description' => t('Table storing myobj definitions.'),
+ 'export' => array(
+ 'key' => 'name',
+ 'key name' => 'Name',
+ 'primary key' => 'oid',
+ 'identifier' => 'myobj', // Exports will be as $myobj
+ 'default hook' => 'default_mymodule_myobj', // Function hook name.
+ 'api' => array(
+ 'owner' => 'mymodule',
+ 'api' => 'default_mymodule_myobjs', // Base name for api include files.
+ 'minimum_version' => 1,
+ 'current_version' => 1,
+ ),
+ // If the key is stored in a table that is joined in, specify it:
+ 'key in table' => 'my_join_table',
+
+ ),
+
+ // If your object's data is split up across multiple tables, you can
+ // specify additional tables to join. This is very useful when working
+ // with modules like exportables.module that has a special table for
+ // translating keys to local database IDs.
+ //
+ // The joined table must have its own schema definition.
+ //
+ // If using joins, you should implement a 'delete callback' (see below)
+ // to ensure that deletes happen properly. export.inc does not do this
+ // automatically!
+ 'join' => array(
+ 'exportables' => array(
+ // The following parameters will be used in this way:
+ // SELECT ... FROM {mymodule_myobj} t__0 INNER JOIN {my_join_table} t__1 ON t__0.id = t__1.id AND extras
+ 'table' => 'my_join_table',
+ 'left_key' => 'format',
+ 'right_key' => 'id',
+ // Optionally you can define a callback to add custom conditions or
+ // alter the query as necessary. The callback function takes 3 args:
+ //
+ // myjoincallback(&$query, $schema, $join_schema);
+ //
+ // where $query is the database query object, $schema is the schema for
+ // the export base table and $join_schema is the schema for the current
+ // join table.
+ 'callback' => 'myjoincallback',
+
+ // You must specify which fields will be loaded. These fields must
+ // exist in the schema definition of the joined table.
+ 'load' => array(
+ 'machine',
+ ),
+
+ // And finally you can define other tables to perform INNER JOINS
+ //'other_joins' => array(
+ // 'table' => ...
+ //),
+ ),
+ )
+ 'fields' => array(
+ 'name' => array(
+ 'type' => 'varchar',
+ 'length' => '255',
+ 'description' => 'Unique ID for this object. Used to identify it programmatically.',
+ ),
+ 'oid' => array(
+ 'type' => 'serial',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
+ 'no export' => TRUE, // Do not export database-only keys.
+ ),
+ // ......
+ 'primary key' => array('oid'),
+ 'unique keys' => array(
+ 'name' => array('name'),
+ ),
+ );
+ return $schema;
+}
+</pre>
+
+<dl>
+<dt>key</dt>
+<dd>This is the primary key of the exportable object and should be a string as names are more portable across systems. It is possible to use numbers here, but be aware that export collisions are very likely. Defaults to 'name'.</dd>
+
+<dt>key name</dt>
+<dd>Human readable title of the export key. Defaults to 'Name'. Because the schema is cached, do not translate this. It must instead be translated when used.</dd>
+
+<dt>primary key</dt>
+<dd>A single field within the table that is to be used as the main identifier to discern whether or not the object has been written. As the schema definition's primary key value will be used by default, it is not usually necessary to define this.</dd>
+
+<dt>object</dt>
+<dd>The class the object should be created as, if 'object factory' is not set. If this is not set either, defaults as stdClass.</dd>
+
+<dt>object factory</dt>
+<dd>Function used to create the object. The function receives the schema and the loaded data as a parameters: your_factory_function($schema, $data). If this is set, 'object' has no effect since you can use your function to create whatever class you wish.</dd>
+
+<dt>admin_title</dt>
+<dd>A convenience field that may contain the field which represents the human readable administrative title for use in export UI. If a field "admin_title" exists, it will automatically be used.</dd>
+
+<dt>admin_description</dt>
+<dd>A convenience field that may contain the field which represents the human readable administrative title for use in export UI. If a field "admin_title" exists, it will automatically be used.</dd>
+
+<dt>can disable</dt>
+<dd>Control whether or not the exportable objects can be disabled. All this does is cause the 'disabled' field on the object to always be set appropriately, and a variable is kept to record the state. Changes made to this state must be handled by the owner of the object. Defaults to TRUE.</dd>
+
+<dt>status</dt>
+<dd>Exportable objects can be enabled or disabled, and this status is stored in a variable. This defines what variable that is. Defaults to: 'default_' . $table.</dd>
+
+<dt>default hook</dt>
+<dd>What hook to invoke to find exportable objects that are currently defined. These will all be gathered into a giant array. Defaults to 'default_' . $table.</dd>
+
+<dt>cache defaults</dt>
+<dd>If true, default objects will be cached so that the processing of the hook does not need to be called often. Defaults to FALSE. Recommended if you will potentially have a lot of objects in code. Not recommended if code will be the exception.</dd>
+
+<dt>default cache bin</dt>
+<dd>If default object caching is enabled, what cache bin to use. This defaults to the basic "cache". It is highly recommended that you use a different cache bin if possible.</dd>
+
+<dt>identifier</dt>
+<dd>When exporting the object, the identifier is the variable that the exported object will be placed in. Defaults to $table.</dd>
+
+<dt>bulk export</dt>
+<dd>Declares whether or not the exportable will be available for bulk exporting.</dd>
+
+<dt>export type string</dt>
+<dd>The export type string (Local, Overridden, Database) is normally stored as $item-&gt;type. Since type is a very common keyword, it's possible to specify what key to actually use. </dd>
+
+<dt>list callback</dt>
+<dd>Bulk export callback to provide a list of exportable objects to be chosen for bulk exporting. Defaults to $module . '_' . $table . '_list' if the function exists. If it is not, a default listing function will be provided that will make a best effort to list the titles. See ctools_export_default_list().</dd>
+
+<dt>to hook code callback</dt>
+<dd>Function used to generate an export for the bulk export process. This is only necessary if the export is more complicated than simply listing the fields. Defaults to $module . '_' . $table . '_to_hook_code'.</dt>
+
+
+<dt>create callback</dt>
+<dd>CRUD callback to use to create a new exportable item in memory. If not provided, the default function will be used. The single argument is a boolean used to determine if defaults should be set on the object. This object will not be written to the database by this callback.</dd>
+
+<dt>load callback</dt>
+<dd>CRUD callback to use to load a single item. If not provided, the default load function will be used. The callback will accept a single argument which should be an identifier of the export key.</dd>
+
+<dt>load multiple callback</dt>
+<dd>CRUD callback to use to load multiple items. If not provided, the default multiple load function will be used. The callback will accept an array which should be the identifiers of the export key.</dd>
+
+<dt>load all callback</dt>
+<dd>CRUD callback to use to load all items, usually for administrative purposes. If not provided, the default load function will be used. The callback will accept a single argument to determine if the load cache should be reset or not.</dd>
+
+<dt>save callback</dt>
+<dd>CRUD callback to use to save a single item. If not provided, the default save function will be used. The callback will accept a single argument which should be the complete exportable object to save.</dd>
+
+<dt>delete callback</dt>
+<dd>CRUD callback to use to delete a single item. If not provided, the default delete function will be used. The callback will accept a single argument which can be *either* the object or just the export key to delete. The callback MUST be able to accept either.</dd>
+
+<dt>export callback</dt>
+<dd>CRUD callback to use for exporting. If not provided, the default export function will be used. The callback will accept two arguments, the first is the item to export, the second is the indent to place on the export, if any.</dd>
+
+<dt>import callback</dt>
+<dd>CRUD callback to use for importing. If not provided, the default export function will be used. This function will accept the code as a single argument and, if the code evaluates, return an object represented by that code. In the case of failure, this will return a string with human readable errors.</dd>
+
+<dt>status callback</dt>
+<dd>CRUD callback to use for updating the status of an object. If the status is TRUE the object will be disabled. If the status is FALSE the object will be enabled.</dd>
+
+<dt>api</dt>
+<dd>The 'api' key can optionally contain some information for the plugin API definition. This means that the imports can be tied to an API name which is used to have automatic inclusion of files, and can be used to prevent dangerous objects from older versions from being loaded, causing a loss of functionality rather than site crashes or security loopholes.
+
+<p>If not present, no additional files will be loaded and the default hook will always be a simple hook that must be either part of the .module file or loaded during normal operations.</p>
+
+<p>api supports these subkeys:</p>
+
+<dl>
+<dt>owner</dt>
+<dd>The module that owns the API. Typically this is the name of the module that owns the schema. This will be one of the two keys used by hook_ctools_plugin_api() to determine version compatibility. Note that the name of this hook can be tailored via the use of hook_ctools_plugin_api_hook_name(). See ctools_plugin_api_get_hook() for details.</dd>
+<dt>api</dt>
+<dd>This is the name of the API, and will be the second parameter to the above mentioned hook. It will also be used as part of the name of the file that the hook containing default objects will be in, which comes in the form of MODULENAME.API.inc.</dd>
+<dt>minimum_version</dt>
+<dd>The minimum version supported. Any module reporting an API less than this will not have its default objects used. This should be updated only when API changes can cause older objects to crash or otherwise break badly.</dd>
+<dt>current_version</dt>
+<dd>The current version of the API. Any module reporting a required API higher than this will not have its default objects used.</dd>
+</dl>
+</dd>
+
+</dl>
+<p>In addition, each field can contain the following:</p>
+<dl>
+<dt>no export</dt>
+<dd>Set to TRUE to prevent that field from being exported.</dd>
+
+<dt>export callback</dt>
+<dd>A function to override the export behavior. It will receive ($myobject, $field, $value, $indent) as arguments. By default, fields are exported through ctools_var_export().</dd>
+</dl>
+
+<h2>Reserved keys on exportable objects</h2>
+
+<p>Exportable objects have several reserved keys that are used by the CTools export API. Each key can be found at <code>$myobj-&gt;{$key}</code> on an object loaded through <code>ctools_export_load_object()</code>. Implementing modules should not use these keys as they will be overwritten by the CTools export API.</p>
+<dl>
+<dt>api_version</dt>
+<dd>The API version that this object implements.</dd>
+
+<dt>disabled</dt>
+<dd>A boolean for whether the object is disabled.</dd>
+
+<dt>export_module</dt>
+<dd>For objects that live in code, the module which provides the default object.</dd>
+
+<dt>export_type</dt>
+<dd>A bitmask representation of an object current storage. You can use this bitmask in combination with the <code>EXPORT_IN_CODE</code> and <code>EXPORT_IN_DATABASE</code> constants to test for an object's storage in your code.
+</dd>
+
+<dt>in_code_only</dt>
+<dd>A boolean for whether the object lives only in code.</dd>
+
+<dt>table</dt>
+<dd>The schema API table that this object belongs to.</dd>
+
+<dt>type</dt>
+<dd>A string representing the storage type of this object. Can be one of the following:
+<ul>
+<li><em>Normal</em> is an object that lives only in the database.</li>
+<li><em>Overridden</em> is an object that lives in the database and is overriding the exported configuration of a corresponding object in code.</li>
+<li><em>Default</em> is an object that lives only in code.</li>
+</ul>
+<i>Note: This key can be changed by setting 'export type string' to something else, to try and prevent "type" from conflicting.</i>
+</dd>
+</dl>
+
+<h2>The load callback</h2>
+<p>Calling ctools_export_crud_load($table, $name) will invoke your load callback, calling ctools_export_crud_load_multiple($table, $names) will invoke your load multiple callback, and calling ctools_export_crud_load_all($table, $reset) will invoke your load all callback. The default handlers should be sufficient for most uses.</p>
+
+<p>Typically, there will be three load functions. A 'single' load, to load just one object, a 'multiple' load to load multiple objects, and an 'all' load, to load all of the objects for use in administrating the objects or utilizing the objects when you need all of them. Using ctools_export_load_object() you can easily do both, as well as quite a bit in between. This example duplicates the default functionality for loading one myobj.</p>
+
+<pre>
+/**
+ * Implements 'load callback' for myobj exportables.
+ */
+function mymodule_myobj_load($name) {
+ ctools_include('export');
+ $result = ctools_export_load_object('mymodule_myobjs', 'names', array($name));
+ if (isset($result[$name])) {
+ return $result[$name];
+ }
+}
+
+/**
+ * Implements 'load multiple callback' for myobj exportables.
+ */
+function mymodule_myobj_load_multiple(array $names) {
+ ctools_include('export')
+ $results = ctools_export_load_object('mymodule_myobjs', 'names', $names);
+ return array_filter($results);
+}
+</pre>
+
+<h2>The save callback</h2>
+Calling ctools_export_crud_save($table, $object) will invoke your save callback. The default handlers should be sufficient for most uses. For the default save mechanism to work, you <b>must</b> define a 'primary key' in the 'export' section of your schema. The following example duplicates the default functionality for the myobj.
+
+<pre>
+/**
+* Save a single myobj.
+*/
+function mymodule_myobj_save(&$myobj) {
+ $update = (isset($myobj->oid) && is_numeric($myobj->oid)) ? array('oid') : array();
+ return drupal_write_record('myobj', $myobj, $update);
+}
+</pre>
+
+<h2>Default hooks for your exports</h2>
+<p>All exportables come with a 'default' hook, which can be used to put your exportable into code. The easiest way to actually use this hook is to set up your exportable for bulk exporting, enable the bulk export module and export an object.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/form.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/form.html
new file mode 100644
index 0000000..b9b6d9c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/form.html
@@ -0,0 +1 @@
+<p>To be written.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/modal.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/modal.html
new file mode 100644
index 0000000..ea823a0
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/modal.html
@@ -0,0 +1,215 @@
+<p>CTools provides a simple modal that can be used as a popup to place forms. It differs from the normal modal frameworks in that it does not do its work via an iframe. This is both an advantage and a disadvantage. The iframe simply renders normal pages in a sub-browser and they can do their thing. That makes it much easier to put arbitrary pages and forms in a modal. However, the iframe is not very good at actually communicating changes to the main page, so you cannot open the modal, have it do some work, and then modify the page. </p>
+
+<h2>Invoking the modal</h2>
+
+<p>The basic form of the modal can be set up just by including the javascript and adding the proper class to a link or form that will open the modal. To include the proper javascript, simply include the library and call the add_js function:</p>
+
+<code>ctools_include('modal');
+ctools_modal_add_js();
+</code>
+
+<p>You can have links and buttons bound to use the modal by adding the class ctools-use-modal. For convenience, there is a helper function to try and do this, though it's not great at doing all links so using this is optional:</p>
+
+<code>/**
+ * Render an image as a button link. This will automatically apply an AJAX class
+ * to the link and add the appropriate javascript to make this happen.
+ *
+ * @param $image
+ * The path to an image to use that will be sent to theme('image') for rendering.
+ * @param $dest
+ * The destination of the link.
+ * @param $alt
+ * The alt text of the link.
+ * @param $class
+ * Any class to apply to the link. @todo this should be a options array.
+ */
+function ctools_modal_image_button($image, $dest, $alt, $class = '') {
+ return ctools_ajax_text_button(theme('image', array('path' => $image), $dest, $alt, $class, 'ctools-use-modal');
+}
+
+/**
+ * Render text as a link. This will automatically apply an AJAX class
+ * to the link and add the appropriate javascript to make this happen.
+ *
+ * Note: 'html' => true so be sure any text is vetted! Chances are these kinds of buttons will
+ * not use user input so this is a very minor concern.
+ *
+ * @param $text
+ * The text to display as the link.
+ * @param $dest
+ * The destination of the link.
+ * @param $alt
+ * The alt text of the link.
+ * @param $class
+ * Any class to apply to the link. @todo this should be a options array.
+ */
+function ctools_modal_text_button($text, $dest, $alt, $class = '') {
+ return ctools_ajax_text_button($text, $dest, $alt, $class, 'ctools-use-modal');
+}
+</code>
+
+<p>Like with all CTools' AJAX functionality, the href of the link will be the destination, with any appearance of /nojs/ converted to /ajax/.</p>
+
+<p>For submit buttons, however, the URL may be found a different, slightly more complex way. If you do not wish to simply submit the form to the modal, you can create a URL using hidden form fields. The ID of the item is taken and -url is appended to it to derive a class name. Then, all form elements that contain that class name are founded and their values put together to form a URL.</p>
+
+<p>For example, let's say you have an 'add' button, and it has a select form item that tells your system what widget it is adding. If the id of the add button is edit-add, you would place a hidden input with the base of your URL in the form and give it a class of 'edit-add-url'. You would then add 'edit-add-url' as a class to the select widget allowing you to convert this value to the form without posting. If no URL is found, the action of the form will be used and the entire form posted to it.</p>
+
+<h2>Customizing the modal</h2>
+
+<p>If you do not wish to use the default modal, the modal can be customized by creating an array of data to define a customized modal. To do this, you add an array of info to the javascript settings to define the customizations for the modal and add an additional class to your modal link or button to tell it which modal to use.</p>
+
+<p>First, you need to create a settings array. You can do this most easily with a bit of PHP:</p>
+
+<pre>drupal_add_js(array(
+ 'my-modal-style' => array(
+ 'modalSize' => array(
+ 'type' => 'fixed',
+ 'width' => 250,
+ 'height' => 250,
+ ),
+ ),
+ ), 'setting');
+</pre>
+
+<p>The key to the array above (in this case, my-modal-style) is the identifier to your modal theme. You can have multiple modal themes on a page, so be sure to use an ID that will not collide with some other module's use. Using your module or theme as a prefix is a good idea.</p>
+
+<p>Then, when adding the ctools-use-modal class to your link or button, also add the following class: ctools-modal-ID (in the example case, that would be ctools-modal-my-modal-style).</p>
+
+<p>modalSize can be 'fixed' or 'scale'. If fixed it will be a raw pixel value; if 'scale' it will be a percentage of the screen.</p>
+
+<p>You can set:</p>
+ <ul>
+ <li> <strong>modalSize</strong>: an array of data to control the sizing of the modal. It can contain:
+ <ul>
+ <li> <strong>type</strong>: Either <em>fixed</em> or <em>scale</em>. If fixed, the modal will always be a fixed size. If <em>scale</em> the modal will scale to a percentage of the browser window. <em>Default: scale</em>.
+<li> <strong>width</strong>: If </em>fixed</em> the width in pixels. If <em>scale</em> the percentage of the screen expressed as a number less than zero. (For 80 percent, use .8, for example). <em>Default: .8</em></li>
+<li> <strong>height</strong>: If <em>fixed</em> the height in pixels. If <em>scale</em> the percentage of the screen expressed as a number less than zero. (For 80 percent, use .8, for example). <em>Default: .8</em></li>
+<li> <strong>addWidth</strong>: Any additional width to add to the modal in pixels. Only useful if the type is scale. <em>Default: 0</em></li>
+<li> <strong>addHeight</strong>: Any additional height to add to the modal in pixels. Only useful if the type is scale. <em>Default: 0</em></li>
+<li> <strong>contentRight</strong>: The number of pixels to remove from the content inside the modal to make room for scroll bar and decorations. <em>Default: 25</em></li>
+<li> <strong>contentBottom</strong>: The number of pixels to remove from the content inside the modal to make room for scroll bar and decorations. <em>Default: 45</em></li>
+</ul>
+</li>
+<li> <strong>modalTheme</strong>: The Drupal javascript themable function which controls how the modal will be rendered. This function must be in the <em>Drupal.theme.prototype</em> namespace. If you set this value, you must include a corresponding function in a javascript file and use drupal_add_js() to add that file. <em>Default: CToolsModalDialog</em>
+<pre>
+ Drupal.theme.prototype.CToolsModalDialog = function () {
+ var html = ''
+ html += ' &lt;div id="ctools-modal"&gt;'
+ html += ' &lt;div class="ctools-modal-content"&gt;' // panels-modal-content
+ html += ' &lt;div class="modal-header"&gt;';
+ html += ' &lt;a class="close" href="#"&gt;';
+ html += Drupal.CTools.Modal.currentSettings.closeText + Drupal.CTools.Modal.currentSettings.closeImage;
+ html += ' &lt;/a&gt;';
+ html += ' &lt;span id="modal-title" class="modal-title"&gt;&nbsp;&lt;/span&gt;';
+ html += ' &lt;/div&gt;';
+ html += ' &lt;div id="modal-content" class="modal-content"&gt;';
+ html += ' &lt;/div&gt;';
+ html += ' &lt;/div&gt;';
+ html += ' &lt;/div&gt;';
+
+ return html;
+ }
+</pre></li>
+<li> <strong>throbberTheme</strong>: The Drupal javascript themable function which controls how the modal throbber will be rendered. This function must be in the <em>Drupal.theme.prototype</em> namespace. If you set this value, you must include a corresponding function in a javascript file and use drupal_add_js() to add that file. <em>Default: CToolsModalThrobber</em>
+<pre>
+ Drupal.theme.prototype.CToolsModalThrobber = function () {
+ var html = '';
+ html += ' &lt;div id="modal-throbber"&gt;';
+ html += ' &lt;div class="modal-throbber-wrapper"&gt;';
+ html += Drupal.CTools.Modal.currentSettings.throbber;
+ html += ' &lt;/div&gt;';
+ html += ' &lt;/div&gt;';
+
+ return html;
+ };
+</pre>
+</li>
+<li> <strong>modalOptions</strong>: The options object that's sent to Drupal.CTools.Modal.modalContent. Can contain any CSS settings that will be applied to the modal backdrop, in particular settings such as <strong>opacity</strong> and <strong>background</strong>. <em>Default: array('opacity' => .55, 'background' => '#fff');</em></li>
+<li> <strong>animation</strong>: Controls how the modal is animated when it is first drawn. Either <strong>show</strong>, <strong>fadeIn</strong> or <strong>slideDown</strong>. <em>Default: show</em></li>
+<li> <strong>animationSpeed</strong>: The speed of the animation, expressed either as a word jQuery understands (slow, medium or fast) or a number of milliseconds for the animation to run. <em>Defaults: fast</em></li>
+<li><strong>closeText</strong>: The text to display for the close button. Be sure to wrap this in t() for translatability. <em>Default: t('Close window')</em></li>
+<li><strong>closeImage</strong>: The image to use for the close button of the modal. <em>Default: theme('image', array('path' => ctools_image_path('icon-close-window.png'), 'alt' => t('Close window'), 'title' => t('Close window')))</em></li>
+<li><strong>loadingText</strong>: The text to display for the modal title during loading, along with the throbber. Be sure to wrap this in t() for translatability. <em>Default: t('Close window')</em></li>
+<li><strong>throbber</strong>: The HTML to display for the throbber image. You can use this instead of CToolsModalThrobber theme if you just want to change the image but not the throbber HTML. <em>Default: theme('image', array('path' => ctools_image_path('throbber.gif'), 'alt' => t('Loading...'), 'title' => t('Loading')))</em></li>
+</ul>
+
+<h2>Rendering within the modal</h2>
+<p>To render your data inside the modal, you need to provide a page callback in your module that responds more or less like a normal page.</p>
+
+<p>In order to handle degradability, it's nice to allow your page to work both inside and outside of the modal so that users whose javascript is turned off can still use your page. There are two ways to accomplish this. First, you can embed 'nojs' as a portion of the URL and then watch to see if that turns into 'ajax' when the link is clicked. Second, if you do not wish to modify the URLs, you can check $_POST['js'] or $_POST['ctools_js'] to see if that flag was set. The URL method is the most flexible because it is easy to send the two links along completely different paths if necessary, and it is also much easier to manually test your module's output by manually visiting the nojs URL. It's actually quite difficult to do this if you have to set $_POST['js'] to test.</p>
+
+<p>In your hook_menu, you can use the a CTools' AJAX convenience loader to help:</p>
+
+<pre>
+ $items['ctools_ajax_sample/%ctools_js/login'] = array(
+ 'title' => 'Login',
+ 'page callback' => 'ctools_ajax_sample_login',
+ 'page arguments' => array(1),
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+</pre>
+
+<p>The first argument to the page callback will be the result of ctools_js_load() which will return TRUE if 'ajax' was the string, and FALSE if anything else (i.e, nojs) is the string. Which means you can then declare your function like this:</p>
+
+<pre>
+function ctools_ajax_sample_login($js) {
+ if ($js) {
+ // react with the modal
+ }
+ else {
+ // react without the modal
+ }
+}
+</pre>
+
+<p>If your modal does not include a form, rendering the output you wish to give the user is just a matter of calling the modal renderer with your data:</p>
+
+<pre>
+function ctools_ajax_hello_world($js) {
+ $title = t('Greetings');
+ $output = '&lt;p&gt;' . t('Hello world') . ''&lt;/p&gt;';
+ if ($js) {
+ ctools_modal_render($title, $output);
+ }
+ else {
+ drupal_set_title($title);
+ return $output;
+ }
+}
+</pre>
+
+<p>If you need to do more than just render your modal, you can use a CTools $commands array. See the function ctools_modal_render() for more information on what you need to do here.</p>
+
+<p>If you are displaying a form -- and the vast majority of modals display forms -- then you need to do just slightly more. Fortunately there is the ctools_modal_form_wrapper() function:</p>
+
+<pre>
+ ctools_include('modal');
+ ctools_include('ajax');
+ $form_state = array(
+ 'title' => t('Title of my form'),
+ 'ajax' => $js,
+ );
+ $output = ctools_modal_form_wrapper('my_form', $form_state);
+ // There are some possible states after calling the form wrapper:
+ // 1) We are not using $js and the form has been executed.
+ // 2) We are using $js and the form was successfully submitted and
+ // we need to dismiss the modal.
+ // Most other states are handled automatically unless you set flags in
+ // $form_state to avoid handling them, so we only deal with those two
+ // states.
+ if ($form_state['executed'] && $js) {
+ $commands = array();
+ $commands[] = ctools_modal_command_dismiss(t('Login Success'));
+ // In typical usage you will do something else here, such as update a
+ // div with HTML or redirect the page based upon the results of the modal
+ // form.
+ print ajax_render($commands);
+ exit;
+ }
+
+ // Otherwise, just return the output.
+ return $output;
+</pre>
+
+<p>You can also use CTools' form wizard inside the modal. You do not need to do much special beyond setting $form_state['modal'] = TRUE in the wizard form; it already knows how to handle the rest.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/object-cache.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/object-cache.html
new file mode 100644
index 0000000..801a836
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/object-cache.html
@@ -0,0 +1,132 @@
+<p>The CTools Object Cache is a specialized cache for storing data that is non-volatile. This differs from the standard Drupal cache mechanism, which is volatile, meaning that the data can be cleared at any time and it is expected that any cached data can easily be reconstructed. In contrast, data stored in this cache is not expected to be reconstructable. It is primarily used for storing user input which is retrieved in stages, allowing for more complex user interface interactions.</p>
+
+<p>The object cache consists of 3 normal functions for cache maintenance, and 2 additional functions to facilitate locking.</p>
+
+<p>To use any of these functions, you must first use ctools_include:</p>
+
+<pre>
+ctools_include('object-cache');
+</pre>
+
+<pre>
+/**
+ * Get an object from the non-volatile ctools cache.
+ *
+ * This function caches in memory as well, so that multiple calls to this
+ * will not result in multiple database reads.
+ *
+ * @param $obj
+ * A 128 character or less string to define what kind of object is being
+ * stored; primarily this is used to prevent collisions.
+ * @param $name
+ * The name of the object being stored.
+ * @param $skip_cache
+ * Skip the memory cache, meaning this must be read from the db again.
+ *
+ * @return
+ * The data that was cached.
+ */
+function ctools_object_cache_get($obj, $name, $skip_cache = FALSE) {
+</pre>
+
+<pre>
+/**
+ * Store an object in the non-volatile ctools cache.
+ *
+ * @param $obj
+ * A 128 character or less string to define what kind of object is being
+ * stored; primarily this is used to prevent collisions.
+ * @param $name
+ * The name of the object being stored.
+ * @param $cache
+ * The object to be cached. This will be serialized prior to writing.
+ */
+function ctools_object_cache_set($obj, $name, $cache) {
+</pre>
+
+<pre>
+/**
+ * Remove an object from the non-volatile ctools cache
+ *
+ * @param $obj
+ * A 128 character or less string to define what kind of object is being
+ * stored; primarily this is used to prevent collisions.
+ * @param $name
+ * The name of the object being removed.
+ */
+function ctools_object_cache_clear($obj, $name) {
+</pre>
+
+<p>To facilitate locking, which is the ability to prohibit updates by other users while one user has an object cached, this system provides two functions:</p>
+
+<pre>
+/**
+ * Determine if another user has a given object cached.
+ *
+ * This is very useful for 'locking' objects so that only one user can
+ * modify them.
+ *
+ * @param $obj
+ * A 128 character or less string to define what kind of object is being
+ * stored; primarily this is used to prevent collisions.
+ * @param $name
+ * The name of the object being removed.
+ *
+ * @return
+ * An object containing the UID and updated date if found; NULL if not.
+ */
+function ctools_object_cache_test($obj, $name) {
+</pre>
+
+<p>The object returned by ctools_object_cache_test can be directly used to determine whether a user should be allowed to cache their own version of an object.</p>
+
+<p>To allow the concept of breaking a lock, that is, clearing another users changes:</p>
+
+<pre>
+/**
+ * Remove an object from the non-volatile ctools cache for all session IDs.
+ *
+ * This is useful for clearing a lock.
+ *
+ * @param $obj
+ * A 128 character or less string to define what kind of object is being
+ * stored; primarily this is used to prevent collisions.
+ * @param $name
+ * The name of the object being removed.
+ */
+function ctools_object_cache_clear_all($obj, $name) {
+</pre>
+
+<p>Typical best practice is to use wrapper functions such as these:</p>
+
+<pre>
+/**
+ * Get the cached changes to a given task handler.
+ */
+function delegator_page_get_page_cache($name) {
+ ctools_include('object-cache');
+ $cache = ctools_object_cache_get('delegator_page', $name);
+ if (!$cache) {
+ $cache = delegator_page_load($name);
+ $cache->locked = ctools_object_cache_test('delegator_page', $name);
+ }
+
+ return $cache;
+}
+
+/**
+ * Store changes to a task handler in the object cache.
+ */
+function delegator_page_set_page_cache($name, $page) {
+ ctools_include('object-cache');
+ $cache = ctools_object_cache_set('delegator_page', $name, $page);
+}
+
+/**
+ * Remove an item from the object cache.
+ */
+function delegator_page_clear_page_cache($name) {
+ ctools_include('object-cache');
+ ctools_object_cache_clear('delegator_page', $name);
+}
+</pre>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-api.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-api.html
new file mode 100644
index 0000000..548f17b
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-api.html
@@ -0,0 +1,55 @@
+<p>APIs are a form of plugins that are tightly associated with a module. Instead of a module providing any number of plugins, each module provides only one file for an API and this file can contain hooks that the module should invoke.</p>
+
+<p>Modules support this API by implementing hook_ctools_plugin_api($module, $api). If they support the API, they return a packet of data:</p>
+
+<pre>
+function mymodule_ctools_plugin_api($module, $api) {
+ if ($module == 'some module' && $api = 'some api') {
+ return array(
+ 'version' => The minimum API version this system supports. If this API version is incompatible then the .inc file will not be loaded.
+ 'path' => Where to find the file. Optional; if not specified it will be the module's directory.
+ 'file' => an alternative version of the filename. If not specified it will be $module.$api.inc
+ );
+ }
+}
+</pre>
+
+<p>This implementation must be in the .module file.</p>
+
+<p>Modules utilizing this can invole ctools_plugin_api_include() in order to ensure all modules that support the API will have their files loaded as necessary. It's usually easiest to create a small helper function like this:</p>
+
+<pre>
+define('MYMODULE_MINIMUM_VERSION', 1);
+define('MYMODULE_VERSION', 1);
+
+function mymodule_include_api() {
+ ctools_include('plugins');
+ return ctools_plugin_api_include('mymodule', 'myapi', MYMODULE_MINIMUM_VERSION, MYMODULE_VERSION);
+}
+</pre>
+
+<p>Using a define will ensure your use of version numbers is consistent and easy to update when you make API changes. You can then use the usual module_invoke type commands:</p>
+
+<pre>
+mymodule_include_api();
+module_invoke('myhook', $data);
+</pre>
+
+<p>If you need to pass references, this construct is standard:</p>
+
+<pre>
+foreach (mymodule_include_api() as $module => $info) {
+ $function = $module . '_hookname';
+ // Just because they implement the API and include a file does not guarantee they implemented
+ // a hook function!
+ if (!function_exists($function)) {
+ continue;
+ }
+
+ // Typically array_merge() is used below if data is returned.
+ $result = $function($data1, $data2, $data3);
+}
+</pre>
+
+<p>TODO: There needs to be a way to check API version without including anything, as a module may simply
+provide normal plugins and versioning could still matter.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-creating.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-creating.html
new file mode 100644
index 0000000..186bb74
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-creating.html
@@ -0,0 +1,192 @@
+There are two primary pieces to using plugins. The first is getting the data, and the second is using the data.
+
+<h2>Defining a plugin</h2>
+To define that you offer a plugin that modules can implement, you first must implement hook_ctools_plugin_type() to tell the plugin system about your plugin.
+
+<pre>
+/**
+ * Implements hook_ctools_plugin_type() to inform CTools about the layout plugin.
+ */
+function panels_ctools_plugin_type() {
+ $plugins['layouts'] = array(
+ 'load themes' => TRUE,
+ );
+
+ return $plugins;
+}
+</pre>
+
+The following information can be specified for each plugin type:
+<dl>
+<dt>cache</dt>
+<dd><em>Defaults to:</em> <strong>FALSE</strong></dd>
+<dd>If set to TRUE, the results of ctools_get_plugins will be cached in the 'cache' table (by default), thus preventing .inc files from being loaded. ctools_get_plugins looking for a specific plugin will always load the appropriate .inc file.</dd>
+<dt>cache table</dt>
+<dd><em>Defaults to:</em> <strong>'cache'</strong></dd>
+<dd>If 'cache' is TRUE, then this value specifies the cache table where the cached plugin information will be stored.</dd>
+<dt>defaults</dt>
+<dd><em>Defaults to:</em> <strong>array()</strong></dd>
+<dd>An array of defaults that should be added to each plugin; this can be used to ensure that every plugin has the basic data necessary. These defaults will not ovewrite data supplied by the plugin. This could also be a function name, in which case the callback will be used to provide defaults. NOTE, however, that the callback-based approach is deprecated as it is redundant with the 'process' callback, and as such will be removed in later versions. Consequently, you should only use the array form for maximum cross-version compatibility.</dd>
+<dt>load themes</dt>
+<dd><em>Defaults to:</em> <strong>FALSE</strong></dd>
+<dd>If set to TRUE, then plugins of this type can be supplied by themes as well as modules. If this is the case, all themes that are currently enabled will provide a plugin: NOTE: Due to a slight UI bug in Drupal, it is possible for the default theme to be active but not enabled. If this is the case, that theme will NOT provide plugins, so if you are using this feature, be sure to document that issue. Also, themes set via $custom_theme do not necessarily need to be enabled, but the system has no way of knowing what those themes are, so the enabled flag is the only true method of identifying which themes can provide layouts.</dd>
+<dt>hook</dt>
+<dd><em>Defaults to:</em> (dynamic value)</dd>
+<dd>The name of the hook used to collect data for this plugin. Normally this is <strong>$module . '_' . $type</strong> -- but this can be changed here. If you change this, you MUST be sure to document this for your plugin implementors as it will change the format of the specially named hook.
+<dt>process</dt>
+<dd><em>Defaults to:</em> <strong>''</strong></dd>
+<dd>An optional function callback to use for processing a plugin. This can be used to provide automated settings that must be calculated per-plugin instance (i.e., it is not enough to simply append an array via 'defaults'). The parameters on this callback are: <strong>callback(&$plugin, $info)</strong> where $plugin is a reference to the plugin as processed and $info is the fully processed result of hook_ctools_plugin_api_info().
+<dt>extension</dt>
+<dd><em>Defaults to:</em> <strong>'inc'</strong></dd>
+<dd>Can be used to change the extension on files containing plugins of this type. By default the extension will be "inc", though it will default to "info" if "info files" is set to true. Do not include the dot in the extension if changing it, that will be added automatically.</dd>
+<dt>info file</dt>
+<dd><em>Defaults to:</em> <strong>FALSE</strong></dd>
+<dd>If set to TRUE, then the plugin will look for a .info file instead of a .inc. Internally, this will look exactly the same, though obviously a .info file cannot contain functions. This can be good for styles that may not need to contain code.</dd>
+<dt>use hooks</dt>
+<dd><em>Defaults to:</em> <strong>TRUE</strong>*</dd>
+<dd>Use to enable support for plugin definition hooks instead of plugin definition files. NOTE: using a central plugin definition hook is less optimal for the plugins system, and as such this will default to FALSE in later versions.</dd>
+<dt>child plugins</dt>
+<dd><em>Defaults to:</em> <strong>FALSE</strong></dd>
+<dd>If set to TRUE, the plugin type can automatically have 'child plugins' meaning each plugin can actually provide multiple plugins. This is mostly used for plugins that store some of their information in the database, such as views, blocks or exportable custom versions of plugins.</dd>
+<dd>To implement, each plugin can have a 'get child' and 'get children' callback. Both of these should be implemented for performance reasons, since it is best to avoid getting all children if necessary, but if 'get child' is not implemented, it will fall back to 'get children' if it has to.</dd>
+<dd>Child plugins should be named parent:child, with the : being the separator, so that it knows which parent plugin to ask for teh child. The 'get children' method should at least return the parent plugin as part of the list, unless it wants the parent plugin itself to not be a choosable option, which is not unheard of. </dd>
+<dd>'get children' arguments are ($plugin, $parent) and 'get child' arguments are ($plugin, $parent, $child).
+</dl>
+
+In addition, there is a 'module' and 'type' settings; these are for internal use of the plugin system and you should not change these.
+<h2>Getting the data</h2>
+To create a plugin, a module only has to execute ctools_get_plugins with the right data:
+
+<pre>
+ ctools_include('plugins');
+ ctools_get_plugins($module, $type, [$id])
+</pre>
+
+In the above example, $module should be your module's name and $type is the type of the plugin. It is typically best practice to provide some kind of wrapper function to make this easier. For example, Panels provides the following functions to implement the 'content_types' plugin:
+
+<pre>
+/**
+ * Fetch metadata on a specific content_type plugin.
+ *
+ * @param $content type
+ * Name of a panel content type.
+ *
+ * @return
+ * An array with information about the requested panel content type.
+ */
+function panels_get_content_type($content_type) {
+ ctools_include('context');
+ ctools_include('plugins');
+ return ctools_get_plugins('panels', 'content_types', $content_type);
+}
+
+/**
+ * Fetch metadata for all content_type plugins.
+ *
+ * @return
+ * An array of arrays with information about all available panel content types.
+ */
+function panels_get_content_types() {
+ ctools_include('context');
+ ctools_include('plugins');
+ return ctools_get_plugins('panels', 'content_types');
+}
+</pre>
+
+<h2>Using the data</h2>
+
+Each plugin returns a packet of data, which is added to with a few defaults. Each plugin is guaranteed to always have the following data:
+<dl>
+<dt>name</dt>
+<dd>The name of the plugin. This is also the key in the array, of the full list of plugins, and is placed here since that is not always available.</dd>
+<dt>module</dt>
+<dd>The module that supplied the plugin.</dd>
+<dt>file</dt>
+<dd>The actual file containing the plugin.</dd>
+<dt>path</dt>
+<dd>The path to the file containing the plugin. This is useful for using secondary files, such as templates, css files, images, etc, that may come with a plugin.</dd>
+</dl>
+
+<p>Any of the above items can be overridden by the plugin itself, though the most likely one to be modified is the 'path'.</p>
+
+<p>The most likely data (beyond simple printable data) for a plugin to provide is a callback. The plugin system provides a pair of functions to make it easy and consistent for these callbacks to be used. The first is ctools_plugin_get_function, which requires the full $plugin object.</p>
+
+<pre>
+/**
+ * Get a function from a plugin, if it exists. If the plugin is not already
+ * loaded, try ctools_plugin_load_function() instead.
+ *
+ * @param $plugin
+ * The loaded plugin type.
+ * @param $callback_name
+ * The identifier of the function. For example, 'settings form'.
+ *
+ * @return
+ * The actual name of the function to call, or NULL if the function
+ * does not exist.
+ */
+function ctools_plugin_get_function($plugin, $callback_name)
+</pre>
+
+<p>The second does not require the full $plugin object, and will load it:</p>
+
+<pre>
+/**
+ * Load a plugin and get a function name from it, returning success only
+ * if the function exists.
+ *
+ * @param $module
+ * The module that owns the plugin type.
+ * @param $type
+ * The type of plugin.
+ * @param $id
+ * The id of the specific plugin to load.
+ * @param $callback_name
+ * The identifier of the function. For example, 'settings form'.
+ *
+ * @return
+ * The actual name of the function to call, or NULL if the function
+ * does not exist.
+ */
+function ctools_plugin_load_function($module, $type, $id, $callback_name) {
+</pre>
+
+<p>Both of these functions will ensure any needed files are included. In fact, it allows each callback to specify alternative include files. The plugin implementation could include code like this:</p>
+
+<pre>
+ 'callback_name' => 'actual_name_of_function_here',
+</pre>
+
+<p>Or like this:</p>
+<pre>
+ 'callback_name' => array(
+ 'file' => 'filename',
+ 'path' => 'filepath', // optional, will use plugin path if absent
+ 'function' => 'actual_name_of_function_here',
+ ),
+</pre>
+
+<p>An example, for 'plugin_example' type</p>
+
+<pre>
+$plugin = array(
+ 'name' => 'my_plugin',
+ 'module' => 'my_module',
+ 'example_callback' => array(
+ 'file' => 'my_plugin.extrafile.inc',
+ 'function' => 'my_module_my_plugin_example_callback',
+ ),
+);
+</pre>
+
+<p>To utilize this callback on this plugin:</p>
+
+<pre>
+if ($function = ctools_plugin_get_function($plugin, 'example_callback')) {
+ $function($arg1, $arg2, $etc);
+}
+</pre>
+
+<h2>Document your plugins!</h2>
+
+<p>Since the data provided by your plugin tends to be specific to your plugin type, you really need to document what the data returned in the hook in the .inc file will be or nobody will figure it out. Use advanced help and document it there. If every system that utilizes plugins does this, then plugin implementors will quickly learn to expect the documentation to be in the advanced help.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-implementing.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-implementing.html
new file mode 100644
index 0000000..070f08d
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins-implementing.html
@@ -0,0 +1,61 @@
+<p>To implement plugins, you need to implement a single hook in your module to tell the system where your plugins live, and then you need to implement one or more .inc files that contain the plugin data.</p>
+
+<h2>Telling it where your plugins live</h2>
+<p>To implement any plugins at all, you must implement a single function for all plugins: <strong>hook_ctools_plugin_directory</strong>. Every time a module loads plugins, this hook will be called to see which modules implement those plugins and in what directory those plugins will live.</p>
+
+<pre>
+function hook_ctools_plugin_directory($module, $plugin) {
+ if ($module == 'panels' && $plugin == 'content_types') {
+ return 'plugins/content_types';
+ }
+}
+</pre>
+
+<p>The directory returned should be relative to your module. Another common usage is to simply return that you implement all plugins owned by a given module (or modules):</p>
+
+<pre>
+function hook_ctools_plugin_directory($module, $plugin) {
+ if ($module == 'panels') {
+ return 'plugins/' . $plugin;
+ }
+}
+</pre>
+
+<p>Typically, it is recommended that all plugins be placed into the 'plugins' directory for clarity and maintainability. Inside the directory, any number of subdirectories can be used. For plugins that require extra files, such as templates, css, javascript or image files, this is highly recommended:</p>
+<pre>
+mymodule.module
+mymodule.info
+plugins/
+ content_types/
+ my_content_type.inc
+ layouts/
+ my_layout.inc
+ my_laout.css
+ my_layout.tpl.php
+ my_layout_image.png
+</pre>
+
+<h2>How a theme can implement plugins</h2>
+<p>Themes can implement plugins if the plugin owner specified that it's possible in its hook_ctools_api_TYPE() call. If so, it is generally exactly the same as modules, except for one important difference: themes don't get hook_ctools_plugin_directory(). Instead, themes add a line to their info file:</p>
+
+<pre>
+plugins[module][type] = directory
+</pre>
+
+<h2>How to structure the .inc file</h2>
+
+<p>The top of the .inc file should contain an array that defines the plugin. This array is simply defined in the global namespace of the file and does not need a function. Note that previous versions of this plugin system required a specially named function. While this function will still work, its use is now discouraged, as it is annoying to name properly.</p>
+
+<p>This array should look something like this:</p>
+
+<pre>
+$plugin = array(
+ 'key' => 'value',
+);
+</pre>
+
+<p>Several values will be filled in for you automatically, but you can override them if necessary. They include 'name', 'path', 'file' and 'module'. Additionally, the plugin can owner can provide other defaults as well.</p>
+
+<p>There are no required keys by the plugin system itself. The only requirements in the $plugin array will be defined by the plugin type.</p>
+
+<p>After this array, if your plugin needs functions, they can be declared. Different plugin types have different needs here, so exactly what else will be needed will change from type to type.</p>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins.html
new file mode 100644
index 0000000..b948411
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/plugins.html
@@ -0,0 +1,5 @@
+<p>The plugins tool allows a module to allow <b>other</b> modules (and themes!) to provide plugins which provide some kind of functionality or some kind of task. For example, in Panels there are several types of plugins: Content types (which are like blocks), layouts (which are page layouts) and styles (which can be used to style a panel). Each plugin is represented by a .inc file, and the functionality they offer can differ wildly.</p>
+
+<p>A module which uses plugins can implement a hook describing the plugin (which is not necessary, as defaults will be filled in) and then calls a ctools function which loads either all the known plugins (used for listing/choosing) or loads a specific plugin (used when its known which plugin is needed). From the perspective of the plugin system, a plugin is a packet of data, usually some printable info and a list of callbacks. It is up to the module implementing plugins to determine what that info means and what the callbacks do.</p>
+
+<p>A module which implements plugins must first implement the <strong>hook_ctools_plugin_directory</strong> function, which simply tells the system which plugins are supported and what directory to look in. Each plugin will then be in a .inc file in the directory supplied. The .inc file will contain a specially named hook which returns the data necessary to implement the plugin.</p> \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/wizard.html b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/wizard.html
new file mode 100644
index 0000000..33fc456
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/help/wizard.html
@@ -0,0 +1,311 @@
+<p>Form wizards, or multi-step forms, are a process by which the user goes through or can use an arbitrary number of different forms to create a single object or perform a single task. Traditionally the multi-step form is difficult in Drupal because there is no easy place to put data in between forms. No longer! The form wizard tool allows a single entry point to easily set up a wizard of multiple forms, provide callbacks to handle data storage and updates between forms and when forms are completed. This tool pairs well with the <a href="&topic:ctools/object-cache&">object cache</a> tool for storage.</p>
+
+<h2>The form info array</h2>
+<p>The wizard starts with an array of data that describes all of the forms available to the wizard and sets options for how the wizard will present and control the flow. Here is an example of the $form_info array as used in the delegator module:</p>
+
+<pre>
+ $form_info = array(
+ 'id' => 'delegator_page',
+ 'path' => "admin/structure/pages/edit/$page_name/%step",
+ 'show trail' => TRUE,
+ 'show back' => TRUE,
+ 'show return' => FALSE,
+ 'next callback' => 'delegator_page_add_subtask_next',
+ 'finish callback' => 'delegator_page_add_subtask_finish',
+ 'return callback' => 'delegator_page_add_subtask_finish',
+ 'cancel callback' => 'delegator_page_add_subtask_cancel',
+ 'order' => array(
+ 'basic' => t('Basic settings'),
+ 'argument' => t('Argument settings'),
+ 'access' => t('Access control'),
+ 'menu' => t('Menu settings'),
+ 'multiple' => t('Task handlers'),
+ ),
+ 'forms' => array(
+ 'basic' => array(
+ 'form id' => 'delegator_page_form_basic'
+ ),
+ 'access' => array(
+ 'form id' => 'delegator_page_form_access'
+ ),
+ 'menu' => array(
+ 'form id' => 'delegator_page_form_menu'
+ ),
+ 'argument' => array(
+ 'form id' => 'delegator_page_form_argument'
+ ),
+ 'multiple' => array(
+ 'form id' => 'delegator_page_argument_form_multiple'
+ ),
+ ),
+ );
+</pre>
+
+<p>The above array starts with an <strong>id</strong> which is used to identify the wizard in various places and a <strong>path</strong> which is needed to redirect to the next step between forms. It then creates some <strong>settings</strong> which control which pieces are displayed. In this case, it displays a form trail and a 'back' button, but not the 'return' button. Then there are the <strong>wizard callbacks</strong> which allow the wizard to act appropriately when forms are submitted. Finally it contains a <strong>list of forms</strong> and their <strong>order</strong> so that it knows which forms to use and what order to use them by default. Note that the keys in the order and list of forms match; that key is called the <strong>step</strong> and is used to identify each individual step of the wizard.</p>
+
+<p>Here is a full list of every item that can be in the form info array:</p>
+
+<dl>
+<dt>id</dt>
+<dd>An id for wizard. This is used like a hook to automatically name <strong>callbacks</strong>, as well as a form step's form building function. It is also used in trail theming.</dd>
+
+<dt>path</dt>
+<dd>The path to use when redirecting between forms. <strong>%step</strong> will be replaced with the key for the form.</dd>
+
+<dt>return path</dt>
+<dd>When a form is complete, this is the path to go to. This is required if the 'return' button is shown and not using AJAX. It is also used for the 'Finish' button. If it is not present and needed, the cancel path will also be checked.</dd>
+
+<dt>cancel path</dt>
+<dd>When a form is canceled, this is the path to go to. This is required if the 'cancel' is shown and not using AJAX.</dd>
+
+<dt>show trail</dt>
+<dd>If set to TRUE, the form trail will be shown like a breadcrumb at the top of each form. Defaults to FALSE.</dd>
+
+<dt>show back</dt>
+<dd>If set to TRUE, show a back button on each form. Defaults to FALSE.</dd>
+
+<dt>show return</dt>
+<dd>If set to TRUE, show a return button. Defaults to FALSE.</dd>
+
+<dt>show cancel</dt>
+<dd>If set to TRUE, show a cancel button. Defaults to FALSE.</dd>
+
+<dt>back text</dt>
+<dd>Set the text of the 'back' button. Defaults to t('Back').</dd>
+
+<dt>next text</dt>
+<dd>Set the text of the 'next' button. Defaults to t('Continue').</dd>
+
+<dt>return text</dt>
+<dd>Set the text of the 'return' button. Defaults to t('Update and return').</dd>
+
+<dt>finish text</dt>
+<dd>Set the text of the 'finish' button. Defaults to t('Finish').</dd>
+
+<dt>cancel text</dt>
+<dd>Set the text of the 'cancel' button. Defaults to t('Cancel').</dd>
+
+<dt>ajax</dt>
+<dd>Turn on AJAX capabilities, using CTools' ajax.inc. Defaults to FALSE.</dd>
+
+<dt>modal</dt>
+<dd>Put the wizard in the modal tool. The modal must already be open and called from an ajax button for this to work, which is easily accomplished using functions provided by the modal tool.</dd>
+
+<dt>ajax render</dt>
+<dd>A callback to display the rendered form via ajax. This is not required if using the modal tool, but is required otherwise since ajax by itself does not know how to render the results. Params: &$form_state, $output.</dd>
+
+<dt>finish callback</dt>
+<dd>The function to call when a form is complete and the finish button has been clicked. This function should finalize all data. Params: &$form_state.
+Defaults to $form_info['id']._finish if function exists.
+</dd>
+
+<dt>cancel callback</dt>
+<dd>The function to call when a form is canceled by the user. This function should clean up any data that is cached. Params: &$form_state.
+Defaults to $form_info['id']._cancel if function exists.</dd>
+
+<dt>return callback</dt>
+<dd>The function to call when a form is complete and the return button has been clicked. This is often the same as the finish callback. Params: &$form_state.
+Defaults to $form_info['id']._return if function exists.</dd>
+
+<dt>next callback</dt>
+<dd>The function to call when the next button has been clicked. This function should take the submitted data and cache it for later use by the finish callback. Params: &$form_state.
+Defaults to $form_info['id']._next if function exists.</dd>
+
+<dt>order</dt>
+<dd>An optional array of forms, keyed by the step, which represents the default order the forms will be displayed in. If not set, the forms array will control the order. Note that submit callbacks can override the order so that branching logic can be used.</dd>
+
+<dt>forms</dt>
+<dd>An array of form info arrays, keyed by step, describing every form available to the wizard. If order array isn't set, the wizard will use this to set the default order. Each array contains:
+ <dl>
+ <dt>form id</dt>
+ <dd>
+ The id of the form, as used in the Drupal form system. This is also the name of the function that represents the form builder.
+ Defaults to $form_info['id']._.$step._form.
+ </dd>
+
+ <dt>include</dt>
+ <dd>The name of a file to include which contains the code for this form. This makes it easy to include the form wizard in another file or set of files. This must be the full path of the file, so be sure to use drupal_get_path() when setting this. This can also be an array of files if multiple files need to be included.</dd>
+
+ <dt>title</dt>
+ <dd>The title of the form, to be optionally set via drupal_get_title. This is required when using the modal if $form_state['title'] is not set.</dd>
+ </dl>
+</dd>
+</dl>
+
+<h2>Invoking the form wizard</h2>
+<p>Your module should create a page callback via hook_menu, and this callback should contain an argument for the step. The path that leads to this page callback should be the same as the 'path' set in the $form_info array.</p>
+
+<p>The page callback should set up the $form_info, and figure out what the default step should be if no step is provided (note that the wizard does not do this for you; you MUST specify a step). Then invoke the form wizard:</p>
+
+<pre>
+ $form_state = array();
+ ctools_include('wizard');
+ $output = ctools_wizard_multistep_form($form_info, $step, $form_state);
+</pre>
+
+<p>If using AJAX or the modal, This part is actually done! If not, you have one more small step:</p>
+
+<pre>
+ return $output;
+</pre>
+
+<h2>Forms and their callbacks</h2>
+<p>Each form within the wizard is a complete, independent form using Drupal's Form API system. It has a form builder callback as well as submit and validate callbacks and can be form altered. The primary difference between these forms and a normal Drupal form is that the submit handler should not save any data. Instead, it should make any changes to a cached object (usually placed on the $form_state) and only the _finish or _return handler should actually save any real data.</p>
+
+<p>How you handle this is completely up to you. The recommended best practice is to use the CTools Object cache, and a good way to do this is to write a couple of wrapper functions around the cache that look like these example functions:</p>
+
+<pre>
+/**
+ * Get the cached changes to a given task handler.
+ */
+function delegator_page_get_page_cache($name) {
+ ctools_include('object-cache');
+ $cache = ctools_object_cache_get('delegator_page', $name);
+ if (!$cache) {
+ $cache = delegator_page_load($name);
+ $cache->locked = ctools_object_cache_test('delegator_page', $name);
+ }
+
+ return $cache;
+}
+
+/**
+ * Store changes to a task handler in the object cache.
+ */
+function delegator_page_set_page_cache($name, $page) {
+ ctools_include('object-cache');
+ $cache = ctools_object_cache_set('delegator_page', $name, $page);
+}
+
+/**
+ * Remove an item from the object cache.
+ */
+function delegator_page_clear_page_cache($name) {
+ ctools_include('object-cache');
+ ctools_object_cache_clear('delegator_page', $name);
+}
+</pre>
+
+<p>Using these wrappers, when performing a get_cache operation, it defaults to loading the real object. It then checks to see if another user has this object cached using the ctools_object_cache_test() function, which automatically sets a lock (which can be used to prevent writes later on).</p>
+
+<p>With this set up, the _next, _finish and _cancel callbacks are quite simple:</p>
+
+<pre>
+/**
+ * Callback generated when the add page process is finished.
+ */
+function delegator_page_add_subtask_finish(&$form_state) {
+ $page = &$form_state['page'];
+
+ // Create a real object from the cache
+ delegator_page_save($page);
+
+ // Clear the cache
+ delegator_page_clear_page_cache($form_state['cache name']);
+}
+
+/**
+ * Callback generated when the 'next' button is clicked.
+ *
+ * All we do here is store the cache.
+ */
+function delegator_page_add_subtask_next(&$form_state) {
+ // Update the cache with changes.
+ delegator_page_set_page_cache($form_state['cache name'], $form_state['page']);
+}
+
+/**
+ * Callback generated when the 'cancel' button is clicked.
+ *
+ * All we do here is clear the cache.
+ */
+function delegator_page_add_subtask_cancel(&$form_state) {
+ // Update the cache with changes.
+ delegator_page_clear_page_cache($form_state['cache name']);
+}
+</pre>
+
+<p>All that's needed to tie this together is to understand how the changes made it into the cache in the first place. This happened in the various form _submit handlers, which made changes to $form_state['page'] based upon the values set in the form:</p>
+
+<pre>
+/**
+ * Store the values from the basic settings form.
+ */
+function delegator_page_form_basic_submit($form, &$form_state) {
+ if (!isset($form_state['page']->pid) && empty($form_state['page']->import)) {
+ $form_state['page']->name = $form_state['values']['name'];
+ }
+
+ $form_state['page']->admin_title = $form_state['values']['admin_title'];
+ $form_state['page']->path = $form_state['values']['path'];
+
+ return $form;
+}
+</pre>
+
+<p>No database operations were made during this _submit, and that's a very important distinction about this system.</p>
+
+<h3>Proper handling of back button</h3>
+<p>When using <strong>'show back' => TRUE</strong> the cached data should be assigned to the <em>#default_value</em> form property. Otherwise when the user goes back to the previous step the forms default values instead of his (cached) input is used.</p>
+
+<pre>
+/**
+ * Form builder function for wizard.
+ */
+function wizardid_step2_form($form, &$form_state) {
+ $form_state['my data'] = my_module_get_cache($form_state['cache name']);
+ $form['example'] = array(
+ '#type' => 'radios',
+ '#title' => t('Title'),
+ '#default_value' => $form_state['my data']->example ? $form_state['my data']->example : default,
+ '#options' => array(
+ 'default' => t('Default'),
+ 'setting1' => t('Setting1'),
+ ),
+ );
+
+ return $form;
+}
+
+/**
+ * Submit handler to prepare needed values for storing in cache.
+ */
+function wizardid_step2_form_submit($form, &$form_state) {
+ $form_state['my data']->example = $form_state['values']['example'];
+}
+</pre>
+
+<p>The data is stored in the <em>my data</em> object on submitting. If the user goes back to this step the cached <em>my data</em> is used as the default form value. The function <em>my_module_get_cache()</em> is like the cache functions explained above.</p>
+
+<h2>Required fields, cancel and back buttons</h2>
+<p>If you have required fields in your forms, the back and cancel buttons will not work as expected since validation of the form will fail. You can add the following code to the top of your form validation to avoid this problem:</p>
+<pre>
+/**
+ * Validation handler for step2 form
+ */
+function wizardid_step2_form_validate(&$form, &$form_state) {
+ // if the clicked button is anything but the normal flow
+ if ($form_state['clicked_button']['#next'] != $form_state['next']) {
+ drupal_get_messages('error');
+ form_set_error(NULL, '', TRUE);
+ return;
+ }
+ // you form validation goes here
+ // ...
+}
+</pre>
+
+<h2>Wizard for anonymous users</h2>
+<p>If you are creating a wizard which is be used by anonymous users, you might run into some issues with drupal's caching for anonymous users. You can circumvent this by using hook_init and telling drupal to not cache your wizard pages:</p>
+<pre>
+/**
+ * Implementation of hook init
+ */
+function mymodule_init() {
+ // if the path leads to the wizard
+ if (drupal_match_path($_GET['q'], 'path/to/your/wizard/*')) {
+ // set cache to false
+ $GLOBALS['conf']['cache'] = FALSE;
+ }
+}
+</pre>
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/arrow-active.png b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/arrow-active.png
new file mode 100644
index 0000000..3bbd3c2
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/arrow-active.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/collapsible-collapsed.png b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/collapsible-collapsed.png
new file mode 100644
index 0000000..95a214a
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/collapsible-collapsed.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/collapsible-expanded.png b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/collapsible-expanded.png
new file mode 100644
index 0000000..46f39ec
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/collapsible-expanded.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/expanded-options.png b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/expanded-options.png
new file mode 100644
index 0000000..b7b755c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/expanded-options.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-close-window.png b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-close-window.png
new file mode 100644
index 0000000..5f0cf69
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-close-window.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-configure.png b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-configure.png
new file mode 100644
index 0000000..e23d67c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-configure.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-delete.png b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-delete.png
new file mode 100644
index 0000000..5f0cf69
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/icon-delete.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/no-icon.png b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/no-icon.png
new file mode 100644
index 0000000..fa78ec1
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/no-icon.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/status-active.gif b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/status-active.gif
new file mode 100644
index 0000000..207e95c
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/status-active.gif
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/throbber.gif b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/throbber.gif
new file mode 100644
index 0000000..8a084b8
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/images/throbber.gif
Binary files differ
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/ajax.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/ajax.inc
new file mode 100644
index 0000000..bb17bea
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/ajax.inc
@@ -0,0 +1,129 @@
+<?php
+
+// Set this so we can tell that the file has been included at some point.
+define('CTOOLS_AJAX_INCLUDED', 1);
+
+/**
+ * @file
+ * Extend core AJAX with some of our own stuff.
+ */
+
+/**
+ * Render an image as a button link. This will automatically apply an AJAX class
+ * to the link and add the appropriate javascript to make this happen.
+ *
+ * @param $image
+ * The path to an image to use that will be sent to theme('image') for rendering.
+ * @param $dest
+ * The destination of the link.
+ * @param $alt
+ * The alt text of the link.
+ * @param $class
+ * Any class to apply to the link. @todo this should be a options array.
+ */
+function ctools_ajax_image_button($image, $dest, $alt, $class = '') {
+ return ctools_ajax_text_button(theme('image', array('path' => $image)), $dest, $alt, $class);
+}
+
+/**
+ * Render text as a link. This will automatically apply an AJAX class
+ * to the link and add the appropriate javascript to make this happen.
+ *
+ * Note: 'html' => true so be sure any text is vetted! Chances are these kinds of buttons will
+ * not use user input so this is a very minor concern.
+ *
+ * @param $text
+ * The text that will be displayed as the link.
+ * @param $dest
+ * The destination of the link.
+ * @param $alt
+ * The alt text of the link.
+ * @param $class
+ * Any class to apply to the link. @todo this should be a options array.
+ * @param $type
+ * A type to use, in case a different behavior should be attached. Defaults
+ * to ctools-use-ajax.
+ */
+function ctools_ajax_text_button($text, $dest, $alt, $class = '', $type = 'use-ajax') {
+ drupal_add_library('system', 'drupal.ajax');
+ return l($text, $dest, array('html' => TRUE, 'attributes' => array('class' => array($type, $class), 'title' => $alt)));
+}
+
+/**
+ * Set a single property to a value, on all matched elements.
+ *
+ * @param $selector
+ * The CSS selector. This can be any selector jquery uses in $().
+ * @param $name
+ * The name or key: of the data attached to this selector.
+ * @param $value
+ * The value of the data.
+ */
+function ctools_ajax_command_attr($selector, $name, $value) {
+ ctools_add_js('ajax-responder');
+ return array(
+ 'command' => 'attr',
+ 'selector' => $selector,
+ 'name' => $name,
+ 'value' => $value,
+ );
+ }
+
+/**
+ * Force a client-side redirect.
+ *
+ * @param $url
+ * The url to be redirected to. This can be an absolute URL or a
+ * Drupal path.
+ * @param $delay
+ * A delay before applying the redirection, in milliseconds.
+ * @param $options
+ * An array of options to pass to the url() function.
+ */
+function ctools_ajax_command_redirect($url, $delay = 0, $options = array()) {
+ ctools_add_js('ajax-responder');
+ return array(
+ 'command' => 'redirect',
+ 'url' => url($url, $options),
+ 'delay' => $delay,
+ );
+}
+
+/**
+ * Force a reload of the current page.
+ */
+function ctools_ajax_command_reload() {
+ ctools_add_js('ajax-responder');
+ return array(
+ 'command' => 'reload',
+ );
+}
+
+/**
+ * Submit a form.
+ *
+ * This is useful for submitting a parent form after a child form has finished
+ * processing in a modal overlay.
+ *
+ * @param $selector
+ * The CSS selector to identify the form for submission. This can be any
+ * selector jquery uses in $().
+ */
+function ctools_ajax_command_submit($selector) {
+ ctools_add_js('ajax-responder');
+ return array(
+ 'command' => 'submit',
+ 'selector' => $selector,
+ );
+}
+
+/**
+ * Send an error response back via AJAX and immediately exit.
+ */
+function ctools_ajax_render_error($error = '') {
+ $commands = array();
+ $commands[] = ajax_command_alert($error);
+ print ajax_render($commands);
+ exit;
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cache.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cache.inc
new file mode 100644
index 0000000..3918683
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cache.inc
@@ -0,0 +1,169 @@
+<?php
+
+/**
+ * @file
+ *
+ * Plugins to handle cache-indirection.
+ *
+ * Simple plugin management to allow clients to more tightly control where
+ * object caches are stored.
+ *
+ * CTools provides an object cache mechanism, and it also provides a number
+ * of subsystems that are designed to plug into larger systems. When doing
+ * caching on multi-step forms (in particular during AJAX operations) these
+ * subsystems often need to operate their own cache. In reality, its best
+ * for everyone if they are able to piggyback off of the larger cache.
+ *
+ * This system allows this by registering plugins to control where caches
+ * are actually stored. For the most part, the subsystems could care less
+ * where the data is fetched from and stored to. All it needs to know is
+ * that it can 'get', 'set' and 'clear' caches. Additionally, some caches
+ * might need extra operations such as 'lock' and 'finalize', and other
+ * operations may be needed based upon the specific uses for the cache
+ * plugins.
+ *
+ * To utilize cache plugins, there are two pieces of data. First, there is
+ * the mechanism, which is simply the name of the plugin to use. CTools
+ * provides a 'simple' mechanism which goes straight through to the object
+ * cache. The second piece of data is the 'key' which is a unique identifier
+ * that can be used to find the data needed. Keys can be generated any number
+ * of ways, and the plugin must be agnostic about the key itself.
+ *
+ * That said, the 'mechanism' can be specified as pluginame::data and that
+ * data can be used to derive additional data. For example, it is often
+ * desirable to NOT store any cached data until original data (i.e, user
+ * input) has been received. The data can be used to derive this original
+ * data so that when a 'get' is called, if the cache is missed it can create
+ * the data needed. This can help prevent unwanted cache entries from
+ * building up just by visiting edit UIs without actually modifying anything.
+ *
+ * Modules wishing to implement cache indirection mechanisms need to implement
+ * a plugin of type 'cache' for the module 'ctools' and provide the .inc file.
+ * It should provide callbacks for 'cache set', 'cache get', and 'cache clear'.
+ * It can provide callbacks for 'break' and 'finalize' if these are relevant
+ * to the caching mechanism (i.e, for use with locking caches such as the page
+ * manager cache). Other operations may be utilized but at this time are not part
+ * of CTools.
+ */
+
+/**
+ * Fetch data from an indirect cache.
+ *
+ * @param string $mechanism
+ * A string containing the plugin name, and an optional data element to
+ * send to the plugin separated by two colons.
+ *
+ * @param string $key
+ * The key used to identify the cache.
+ *
+ * @return mixed
+ * The cached data. This can be any format as the plugin does not necessarily
+ * have knowledge of what is being cached.
+ */
+function ctools_cache_get($mechanism, $key) {
+ return ctools_cache_operation($mechanism, $key, 'get');
+}
+
+/**
+ * Store data in an indirect cache.
+ *
+ * @param string $mechanism
+ * A string containing the plugin name, and an optional data element to
+ * send to the plugin separated by two colons.
+ *
+ * @param string $key
+ * The key used to identify the cache.
+ *
+ * @param mixed $object
+ * The data to cache. This can be any format as the plugin does not
+ * necessarily have knowledge of what is being cached.
+ */
+function ctools_cache_set($mechanism, $key, $object) {
+ return ctools_cache_operation($mechanism, $key, 'set', $object);
+}
+
+/**
+ * Clear data from an indirect cache.
+ *
+ * @param string $mechanism
+ * A string containing the plugin name, and an optional data element to
+ * send to the plugin separated by two colons.
+ *
+ * @param string $key
+ * The key used to identify the cache.
+ */
+function ctools_cache_clear($mechanism, $key) {
+ return ctools_cache_operation($mechanism, $key, 'clear');
+
+}
+
+/**
+ * Perform a secondary operation on an indirect cache.
+ *
+ * Additional operations, beyond get, set and clear may be items
+ * such as 'break' and 'finalize', which are needed to support cache
+ * locking. Other operations may be added by users of the indirect
+ * caching functions as needed.
+ *
+ * @param string $mechanism
+ * A string containing the plugin name, and an optional data element to
+ * send to the plugin separated by two colons.
+ *
+ * @param string $key
+ * The key used to identify the cache.
+ *
+ * @param string $op
+ * The operation to call, such as 'break' or 'finalize'.
+ *
+ * @param mixed $object
+ * The cache data being operated on, in case it is necessary. This is
+ * optional so no references should be used.
+ *
+ * @return mixed
+ * The operation may or may not return a value.
+ */
+function ctools_cache_operation($mechanism, $key, $op, $object = NULL) {
+ list($plugin, $data) = ctools_cache_find_plugin($mechanism);
+ if (empty($plugin)) {
+ return;
+ }
+
+ $function = ctools_plugin_get_function($plugin, "cache $op");
+ if (empty($function)) {
+ return;
+ }
+
+ return $function($data, $key, $object, $op);
+}
+
+/**
+ * Take a mechanism and return a plugin and data.
+ *
+ * @param string $mechanism
+ * A string containing the plugin name, and an optional data element to
+ * send to the plugin separated by two colons.
+ *
+ * @return array
+ * An array, the first element will be the plugin and the second element
+ * will be the data. If the plugin could not be found, the $plugin will
+ * be NULL.
+ */
+function ctools_cache_find_plugin($mechanism) {
+ if (strpos($mechanism, '::') !== FALSE) {
+ // use explode(2) to ensure that the data can contain double
+ // colons, just in case.
+ list($name, $data) = explode('::', $mechanism, 2);
+ }
+ else {
+ $name = $mechanism;
+ $data = '';
+ }
+
+ if (empty($name)) {
+ return array(NULL, $data);
+ }
+
+ ctools_include('plugins');
+ $plugin = ctools_get_plugins('ctools', 'cache', $name);
+ return array($plugin, $data);
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cache.plugin-type.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cache.plugin-type.inc
new file mode 100644
index 0000000..1ab4cdd
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cache.plugin-type.inc
@@ -0,0 +1,11 @@
+<?php
+
+/**
+ * @file
+ * Contains plugin type registration information for the cache tool.
+ */
+
+function ctools_cache_plugin_type(&$items) {
+ // There are no options to declare on this plugin at this time.
+ $items['cache'] = array();
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cleanstring.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cleanstring.inc
new file mode 100644
index 0000000..56b3e36
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/cleanstring.inc
@@ -0,0 +1,204 @@
+<?php
+// $Id $
+
+/**
+ * @file
+ * Helper class to clean strings to make them URL safe and translatable.
+ *
+ * This was copied directly from pathauto and put here to be made available
+ * to all, because more things than just pathauto want URL safe strings.
+ *
+ * To use, simply:
+ * @code
+ * ctools_include('cleanstring');
+ * $output = ctools_cleanstring($string);
+ *
+ * You can add a variety of settings as an array in the second argument,
+ * including words to ignore, how to deal with punctuation, length
+ * limits, and more. See the function itself for options.
+ */
+
+/**
+ * Matches Unicode character classes.
+ *
+ * See: http://www.unicode.org/Public/UNIDATA/UCD.html#General_Category_Values
+ *
+ * The index only contains the following character classes:
+ * Lu Letter, Uppercase
+ * Ll Letter, Lowercase
+ * Lt Letter, Titlecase
+ * Lo Letter, Other
+ * Nd Number, Decimal Digit
+ * No Number, Other
+ *
+ * Copied from search.module's PREG_CLASS_SEARCH_EXCLUDE.
+ */
+define('CTOOLS_PREG_CLASS_ALNUM',
+'\x{0}-\x{2f}\x{3a}-\x{40}\x{5b}-\x{60}\x{7b}-\x{bf}\x{d7}\x{f7}\x{2b0}-' .
+'\x{385}\x{387}\x{3f6}\x{482}-\x{489}\x{559}-\x{55f}\x{589}-\x{5c7}\x{5f3}-' .
+'\x{61f}\x{640}\x{64b}-\x{65e}\x{66a}-\x{66d}\x{670}\x{6d4}\x{6d6}-\x{6ed}' .
+'\x{6fd}\x{6fe}\x{700}-\x{70f}\x{711}\x{730}-\x{74a}\x{7a6}-\x{7b0}\x{901}-' .
+'\x{903}\x{93c}\x{93e}-\x{94d}\x{951}-\x{954}\x{962}-\x{965}\x{970}\x{981}-' .
+'\x{983}\x{9bc}\x{9be}-\x{9cd}\x{9d7}\x{9e2}\x{9e3}\x{9f2}-\x{a03}\x{a3c}-' .
+'\x{a4d}\x{a70}\x{a71}\x{a81}-\x{a83}\x{abc}\x{abe}-\x{acd}\x{ae2}\x{ae3}' .
+'\x{af1}-\x{b03}\x{b3c}\x{b3e}-\x{b57}\x{b70}\x{b82}\x{bbe}-\x{bd7}\x{bf0}-' .
+'\x{c03}\x{c3e}-\x{c56}\x{c82}\x{c83}\x{cbc}\x{cbe}-\x{cd6}\x{d02}\x{d03}' .
+'\x{d3e}-\x{d57}\x{d82}\x{d83}\x{dca}-\x{df4}\x{e31}\x{e34}-\x{e3f}\x{e46}-' .
+'\x{e4f}\x{e5a}\x{e5b}\x{eb1}\x{eb4}-\x{ebc}\x{ec6}-\x{ecd}\x{f01}-\x{f1f}' .
+'\x{f2a}-\x{f3f}\x{f71}-\x{f87}\x{f90}-\x{fd1}\x{102c}-\x{1039}\x{104a}-' .
+'\x{104f}\x{1056}-\x{1059}\x{10fb}\x{10fc}\x{135f}-\x{137c}\x{1390}-\x{1399}' .
+'\x{166d}\x{166e}\x{1680}\x{169b}\x{169c}\x{16eb}-\x{16f0}\x{1712}-\x{1714}' .
+'\x{1732}-\x{1736}\x{1752}\x{1753}\x{1772}\x{1773}\x{17b4}-\x{17db}\x{17dd}' .
+'\x{17f0}-\x{180e}\x{1843}\x{18a9}\x{1920}-\x{1945}\x{19b0}-\x{19c0}\x{19c8}' .
+'\x{19c9}\x{19de}-\x{19ff}\x{1a17}-\x{1a1f}\x{1d2c}-\x{1d61}\x{1d78}\x{1d9b}-' .
+'\x{1dc3}\x{1fbd}\x{1fbf}-\x{1fc1}\x{1fcd}-\x{1fcf}\x{1fdd}-\x{1fdf}\x{1fed}-' .
+'\x{1fef}\x{1ffd}-\x{2070}\x{2074}-\x{207e}\x{2080}-\x{2101}\x{2103}-\x{2106}' .
+'\x{2108}\x{2109}\x{2114}\x{2116}-\x{2118}\x{211e}-\x{2123}\x{2125}\x{2127}' .
+'\x{2129}\x{212e}\x{2132}\x{213a}\x{213b}\x{2140}-\x{2144}\x{214a}-\x{2b13}' .
+'\x{2ce5}-\x{2cff}\x{2d6f}\x{2e00}-\x{3005}\x{3007}-\x{303b}\x{303d}-\x{303f}' .
+'\x{3099}-\x{309e}\x{30a0}\x{30fb}-\x{30fe}\x{3190}-\x{319f}\x{31c0}-\x{31cf}' .
+'\x{3200}-\x{33ff}\x{4dc0}-\x{4dff}\x{a015}\x{a490}-\x{a716}\x{a802}\x{a806}' .
+'\x{a80b}\x{a823}-\x{a82b}\x{e000}-\x{f8ff}\x{fb1e}\x{fb29}\x{fd3e}\x{fd3f}' .
+'\x{fdfc}-\x{fe6b}\x{feff}-\x{ff0f}\x{ff1a}-\x{ff20}\x{ff3b}-\x{ff40}\x{ff5b}-' .
+'\x{ff65}\x{ff70}\x{ff9e}\x{ff9f}\x{ffe0}-\x{fffd}');
+
+/**
+ * Clean up a string value provided by a module.
+ *
+ * Resulting string contains only alphanumerics and separators.
+ *
+ * @param $string
+ * A string to clean.
+ * @param $settings
+ * An optional array of settings to use.
+ * - 'clean slash': If set, slashes will be cleaned. Defaults to TRUE,
+ * so you have to explicitly set this to FALSE to not clean the
+ * slashes.
+ * - 'ignore words': Set to an array of words that will be removed
+ * rather than made safe. Defaults to an empty array.
+ * - 'separator': Change spaces and untranslatable characters to
+ * this character. Defaults to '-' .
+ * - 'replacements': An array of direct replacements to be made that will
+ * be implemented via strtr(). Defaults to an empty array.
+ * - 'transliterate': If set, use the transliteration replacements. If set
+ * to an array, use these replacements instead of the defaults in CTools.
+ * Defaults to FALSE.
+ * - 'reduce ascii': If set to TRUE further reduce to ASCII96 only. Defaults
+ * to TRUE.
+ * - 'max length': If set to a number, reduce the resulting string to this
+ * maximum length. Defaults to no maximum length.
+ * - 'lower case': If set to TRUE, convert the result to lower case.
+ * Defaults to false.
+ * These settings will be passed through drupal_alter.
+ *
+ * @return
+ * The cleaned string.
+ */
+function ctools_cleanstring($string, $settings = array()) {
+ $settings += array(
+ 'clean slash' => TRUE,
+ 'ignore words' => array(),
+ 'separator' => '-',
+ 'replacements' => array(),
+ 'transliterate' => FALSE,
+ 'reduce ascii' => TRUE,
+ 'max length' => FALSE,
+ 'lower case' => FALSE,
+ );
+
+ // Allow modules to make other changes to the settings.
+ if (isset($settings['clean id'])) {
+ drupal_alter('ctools_cleanstring_' . $settings['clean id'], $settings);
+ }
+
+ drupal_alter('ctools_cleanstring', $settings);
+
+ $output = $string;
+
+ // Do any replacements the user selected up front.
+ if (!empty($settings['replacements'])) {
+ $output = strtr($output, $settings['replacements']);
+ }
+
+ // Remove slashes if instructed to do so.
+ if ($settings['clean slash']) {
+ $output = str_replace('/', '', $output);
+ }
+
+ if (!empty($settings['transliterate']) && module_exists('transliteration')) {
+ $output = transliteration_get($output);
+ }
+
+ // Reduce to the subset of ASCII96 letters and numbers
+ if ($settings['reduce ascii']) {
+ $pattern = '/[^a-zA-Z0-9\/]+/';
+ $output = preg_replace($pattern, $settings['separator'], $output);
+ }
+
+ // Get rid of words that are on the ignore list
+ if (!empty($settings['ignore words'])) {
+ $ignore_re = '\b' . preg_replace('/,/', '\b|\b', $settings['ignore words']) . '\b';
+
+ if (function_exists('mb_eregi_replace')) {
+ $output = mb_eregi_replace($ignore_re, '', $output);
+ }
+ else {
+ $output = preg_replace("/$ignore_re/i", '', $output);
+ }
+ }
+
+ // Always replace whitespace with the separator.
+ $output = preg_replace('/\s+/', $settings['separator'], $output);
+
+ // In preparation for pattern matching,
+ // escape the separator if and only if it is not alphanumeric.
+ if (isset($settings['separator'])) {
+ if (preg_match('/^[^' . CTOOLS_PREG_CLASS_ALNUM . ']+$/uD', $settings['separator'])) {
+ $seppattern = $settings['separator'];
+ }
+ else {
+ $seppattern = '\\' . $settings['separator'];
+ }
+ // Trim any leading or trailing separators (note the need to
+ $output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output);
+
+ // Replace multiple separators with a single one
+ $output = preg_replace("/$seppattern+/", $settings['separator'], $output);
+ }
+
+ // Enforce the maximum component length
+ if (!empty($settings['max length'])) {
+ $output = ctools_cleanstring_truncate($output, $settings['max length'], $settings['separator']);
+ }
+
+ if (!empty($settings['lower case'])) {
+ $output = drupal_strtolower($output);
+ }
+ return $output;
+}
+
+/**
+ * A friendly version of truncate_utf8.
+ *
+ * @param $string
+ * The string to be truncated.
+ * @param $length
+ * An integer for the maximum desired length.
+ * @param $separator
+ * A string which contains the word boundary such as - or _.
+ *
+ * @return
+ * The string truncated below the maxlength.
+ */
+function ctools_cleanstring_truncate($string, $length, $separator) {
+ if (drupal_strlen($string) > $length) {
+ $string = drupal_substr($string, 0, $length + 1); // leave one more character
+ if ($last_break = strrpos($string, $separator)) { // space exists AND is not on position 0
+ $string = substr($string, 0, $last_break);
+ }
+ else {
+ $string = drupal_substr($string, 0, $length);
+ }
+ }
+ return $string;
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/collapsible.theme.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/collapsible.theme.inc
new file mode 100644
index 0000000..f7bbbb3
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/collapsible.theme.inc
@@ -0,0 +1,79 @@
+<?php
+
+/**
+ * @file
+ * Theme function for the collapsible div tool.
+ *
+ * Call theme('ctools_collapsible', $handle, $content, $collapsed) to draw the
+ * div. The theme function is not necessary; you can add the classes, js and css
+ * yourself if you really want to.
+ */
+
+/**
+ * Delegated implementation of hook_theme()
+ */
+function ctools_collapsible_theme(&$items) {
+ $items['ctools_collapsible'] = array(
+ 'variables' => array('handle' => NULL, 'content' => NULL, 'collapsed' => FALSE),
+ 'file' => 'includes/collapsible.theme.inc',
+ );
+ $items['ctools_collapsible_remembered'] = array(
+ 'variables' => array('id' => NULL, 'handle' => NULL, 'content' => NULL, 'collapsed' => FALSE),
+ 'file' => 'includes/collapsible.theme.inc',
+ );
+}
+
+/**
+ * Render a collapsible div.
+ *
+ * @param $handle
+ * Text to put in the handle/title area of the div.
+ * @param $content
+ * Text to put in the content area of the div, this is what will get
+ * collapsed
+ * @param $collapsed = FALSE
+ * If true, this div will start out collapsed.
+ */
+function theme_ctools_collapsible($vars) {
+ ctools_add_js('collapsible-div');
+ ctools_add_css('collapsible-div');
+
+ $class = $vars['collapsed'] ? ' ctools-collapsed' : '';
+ $output = '<div class="ctools-collapsible-container' . $class . '">';
+ $output .= '<div class="ctools-collapsible-handle">' . $vars['handle'] . '</div>';
+ $output .= '<div class="ctools-collapsible-content">' . $vars['content'] . '</div>';
+ $output .= '</div>';
+
+ return $output;
+}
+
+/**
+ * Render a collapsible div whose state will be remembered.
+ *
+ * @param $id
+ * The CSS id of the container. This is required.
+ * @param $handle
+ * Text to put in the handle/title area of the div.
+ * @param $content
+ * Text to put in the content area of the div, this is what will get
+ * collapsed
+ * @param $collapsed = FALSE
+ * If true, this div will start out collapsed.
+ */
+function theme_ctools_collapsible_remembered($vars) {
+ $id = $vars['id'];
+ $handle = $vars['handle'];
+ $content = $vars['content'];
+ $collapsed = $vars['collapsed'];
+ ctools_add_js('collapsible-div');
+ ctools_add_css('collapsible-div');
+
+ $class = $collapsed ? ' ctools-collapsed' : '';
+ $output = '<div id="' . $id . '" class="ctools-collapsible-remember ctools-collapsible-container' . $class . '">';
+ $output .= '<div class="ctools-collapsible-handle">' . $handle . '</div>';
+ $output .= '<div class="ctools-collapsible-content">' . $content . '</div>';
+ $output .= '</div>';
+
+ return $output;
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.inc
new file mode 100644
index 0000000..890ec23
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.inc
@@ -0,0 +1,818 @@
+<?php
+
+/**
+ * @file
+ * Contains the tools to handle pluggable content that can be used by other
+ * applications such as Panels or Dashboard.
+ *
+ * See the context-content.html file in advanced help for documentation
+ * of this tool.
+ */
+
+/**
+ * Provide defaults for a content type.
+ *
+ * Currently we check for automatically named callbacks to make life a little
+ * easier on the developer.
+ */
+function ctools_content_process(&$plugin, $info) {
+ $function_base = $plugin['module'] . '_' . $plugin['name'] . '_content_type_';
+
+ if (empty($plugin['render callback']) && function_exists($function_base . 'render')) {
+ $plugin['render callback'] = $function_base . 'render';
+ }
+
+ if (empty($plugin['admin title'])) {
+ if (function_exists($function_base . 'admin_title')) {
+ $plugin['admin title'] = $function_base . 'admin_title';
+ }
+ else {
+ $plugin['admin title'] = $plugin['title'];
+ }
+ }
+
+ if (empty($plugin['admin info']) && function_exists($function_base . 'admin_info')) {
+ $plugin['admin info'] = $function_base . 'admin_info';
+ }
+
+ if (!isset($plugin['edit form']) && function_exists($function_base . 'edit_form')) {
+ $plugin['edit form'] = $function_base . 'edit_form';
+ }
+
+ if (!isset($plugin['add form']) && function_exists($function_base . 'add_form')) {
+ $plugin['add form'] = $function_base . 'add_form';
+ }
+
+ if (!isset($plugin['add form']) && function_exists($function_base . 'edit_form')) {
+ $plugin['add form'] = $function_base . 'edit_form';
+ }
+
+ if (!isset($plugin['description'])) {
+ $plugin['description'] = '';
+ }
+
+ if (!isset($plugin['icon'])) {
+ $plugin['icon'] = ctools_content_admin_icon($plugin);
+ }
+
+ // Another ease of use check:
+ if (!isset($plugin['content types'])) {
+ // If a subtype plugin exists, try to use it. Otherwise assume single.
+ if (function_exists($function_base . 'content_types')) {
+ $plugin['content types'] = $function_base . 'content_types';
+ }
+ else {
+ $type = array(
+ 'title' => $plugin['title'],
+ 'description' => $plugin['description'],
+ 'icon' => ctools_content_admin_icon($plugin),
+ 'category' => $plugin['category'],
+ );
+
+ if (isset($plugin['required context'])) {
+ $type['required context'] = $plugin['required context'];
+ }
+ if (isset($plugin['top level'])) {
+ $type['top level'] = $plugin['top level'];
+ }
+ $plugin['content types'] = array($plugin['name'] => $type);
+ if (!isset($plugin['single'])) {
+ $plugin['single'] = TRUE;
+ }
+ }
+ }
+}
+
+/**
+ * Fetch metadata on a specific content_type plugin.
+ *
+ * @param $content type
+ * Name of a panel content type.
+ *
+ * @return
+ * An array with information about the requested panel content type.
+ */
+function ctools_get_content_type($content_type) {
+ ctools_include('context');
+ ctools_include('plugins');
+ return ctools_get_plugins('ctools', 'content_types', $content_type);
+}
+
+/**
+ * Fetch metadata for all content_type plugins.
+ *
+ * @return
+ * An array of arrays with information about all available panel content types.
+ */
+function ctools_get_content_types() {
+ ctools_include('context');
+ ctools_include('plugins');
+ return ctools_get_plugins('ctools', 'content_types');
+}
+
+/**
+ * Get all of the individual subtypes provided by a given content type. This
+ * would be all of the blocks for the block type, or all of the views for
+ * the view type.
+ *
+ * @param $type
+ * The content type to load.
+ *
+ * @return
+ * An array of all subtypes available.
+ */
+function ctools_content_get_subtypes($type) {
+ static $cache = array();
+
+ $subtypes = array();
+
+ if (is_array($type)) {
+ $plugin = $type;
+ }
+ else {
+ $plugin = ctools_get_content_type($type);
+ }
+
+ if (empty($plugin) || empty($plugin['name'])) {
+ return;
+ }
+
+ if (isset($cache[$plugin['name']])) {
+ return $cache[$plugin['name']];
+ }
+
+ if (isset($plugin['content types'])) {
+ $function = $plugin['content types'];
+ if (is_array($function)) {
+ $subtypes = $function;
+ }
+ else if (function_exists($function)) {
+ // Cast to array to prevent errors from non-array returns.
+ $subtypes = (array) $function($plugin);
+ }
+ }
+
+ // Walk through the subtypes and ensure minimal settings are
+ // retained.
+ foreach ($subtypes as $id => $subtype) {
+ // Use exact name since this is a modify by reference.
+ ctools_content_prepare_subtype($subtypes[$id], $plugin);
+ }
+
+ $cache[$plugin['name']] = $subtypes;
+
+ return $subtypes;
+}
+
+/**
+ * Given a content type and a subtype id, return the information about that
+ * content subtype.
+ *
+ * @param $type
+ * The content type being fetched.
+ * @param $subtype_id
+ * The id of the subtype being fetched.
+ *
+ * @return
+ * An array of information describing the content subtype.
+ */
+function ctools_content_get_subtype($type, $subtype_id) {
+ $subtype = array();
+ if (is_array($type)) {
+ $plugin = $type;
+ }
+ else {
+ $plugin = ctools_get_content_type($type);
+ }
+
+ $function = ctools_plugin_get_function($plugin, 'content type');
+ if ($function) {
+ $subtype = $function($subtype_id, $plugin);
+ }
+ else {
+ $subtypes = ctools_content_get_subtypes($type);
+ if (isset($subtypes[$subtype_id])) {
+ $subtype = $subtypes[$subtype_id];
+ }
+ // If there's only 1 and we somehow have the wrong subtype ID, do not
+ // care. Return the proper subtype anyway.
+ if (empty($subtype) && !empty($plugin['single'])) {
+ $subtype = current($subtypes);
+ }
+ }
+
+ if ($subtype) {
+ ctools_content_prepare_subtype($subtype, $plugin);
+ }
+ return $subtype;
+}
+
+/**
+ * Ensure minimal required settings on a content subtype exist.
+ */
+function ctools_content_prepare_subtype(&$subtype, $plugin) {
+ foreach (array('path', 'js', 'css') as $key) {
+ if (!isset($subtype[$key]) && isset($plugin[$key])) {
+ $subtype[$key] = $plugin[$key];
+ }
+ }
+
+ drupal_alter('ctools_content_subtype', $subtype, $plugin);
+}
+
+/**
+ * Get the content from a given content type.
+ *
+ * @param $type
+ * The content type. May be the name or an already loaded content type plugin.
+ * @param $subtype
+ * The name of the subtype being rendered.
+ * @param $conf
+ * The configuration for the content type.
+ * @param $keywords
+ * An array of replacement keywords that come from outside contexts.
+ * @param $args
+ * The arguments provided to the owner of the content type. Some content may
+ * wish to configure itself based on the arguments the panel or dashboard
+ * received.
+ * @param $context
+ * An array of context objects available for use.
+ * @param $incoming_content
+ * Any incoming content, if this display is a wrapper.
+ *
+ * @return
+ * The content as rendered by the plugin. This content should be an array
+ * with the following possible keys:
+ * - title: The safe to render title of the content.
+ * - content: The safe to render HTML content.
+ * - links: An array of links associated with the content suitable for
+ * theme('links').
+ * - more: An optional 'more' link (destination only)
+ * - admin_links: Administrative links associated with the content, suitable
+ * for theme('links').
+ * - feeds: An array of feed icons or links associated with the content.
+ * Each member of the array is rendered HTML.
+ * - type: The content type.
+ * - subtype: The content subtype. These two may be used together as
+ * module-delta for block style rendering.
+ */
+function ctools_content_render($type, $subtype, $conf, $keywords = array(), $args = array(), $context = array(), $incoming_content = '') {
+ if (is_array($type)) {
+ $plugin = $type;
+ }
+ else {
+ $plugin = ctools_get_content_type($type);
+ }
+
+ $subtype_info = ctools_content_get_subtype($plugin, $subtype);
+
+ $function = ctools_plugin_get_function($subtype_info, 'render callback');
+ if (!$function) {
+ $function = ctools_plugin_get_function($plugin, 'render callback');
+ }
+
+ if ($function) {
+ $pane_context = ctools_content_select_context($plugin, $subtype, $conf, $context);
+ if ($pane_context === FALSE) {
+ return;
+ }
+
+ $content = $function($subtype, $conf, $args, $pane_context, $incoming_content);
+
+ if (empty($content)) {
+ return;
+ }
+
+ // Set up some defaults and other massaging on the content before we hand
+ // it back to the caller.
+ if (!isset($content->type)) {
+ $content->type = $plugin['name'];
+ }
+
+ if (!isset($content->subtype)) {
+ $content->subtype = $subtype;
+ }
+
+ // Override the title if configured to
+ if (!empty($conf['override_title'])) {
+ // Give previous title as an available substitution here.
+ $keywords['%title'] = empty($content->title) ? '' : $content->title;
+ $content->original_title = $keywords['%title'];
+ $content->title = $conf['override_title_text'];
+ }
+
+ if (!empty($content->title)) {
+ // Perform substitutions
+ if (!empty($keywords) || !empty($context)) {
+ $content->title = ctools_context_keyword_substitute($content->title, $keywords, $context);
+ }
+
+ // Sterilize the title
+ $content->title = filter_xss_admin($content->title);
+
+ // If a link is specified, populate.
+ if (!empty($content->title_link)) {
+ if (!is_array($content->title_link)) {
+ $url = array('href' => $content->title_link);
+ }
+ else {
+ $url = $content->title_link;
+ }
+ // set defaults so we don't bring up notices
+ $url += array('href' => '', 'attributes' => array(), 'query' => array(), 'fragment' => '', 'absolute' => NULL, 'html' => TRUE);
+ $content->title = l($content->title, $url['href'], $url);
+ }
+ }
+
+ return $content;
+ }
+}
+
+/**
+ * Determine if a content type can be edited or not.
+ *
+ * Some content types simply have their content and no options. This function
+ * lets a UI determine if it should display an edit link or not.
+ */
+function ctools_content_editable($type, $subtype, $conf) {
+ if (empty($type['edit form']) && empty($subtype['edit form'])) {
+ return FALSE;
+ }
+
+ if ($function = ctools_plugin_get_function($subtype, 'check editable')) {
+ return $function($type, $subtype, $conf);
+ }
+
+ return TRUE;
+}
+
+/**
+ * Get the administrative title from a given content type.
+ *
+ * @param $type
+ * The content type. May be the name or an already loaded content type object.
+ * @param $subtype
+ * The subtype being rendered.
+ * @param $conf
+ * The configuration for the content type.
+ * @param $context
+ * An array of context objects available for use. These may be placeholders.
+ */
+function ctools_content_admin_title($type, $subtype, $conf, $context = NULL) {
+ if (is_array($type)) {
+ $plugin = $type;
+ }
+ else if (is_string($type)) {
+ $plugin = ctools_get_content_type($type);
+ }
+ else {
+ return;
+ }
+
+ if ($function = ctools_plugin_get_function($plugin, 'admin title')) {
+ $pane_context = ctools_content_select_context($plugin, $subtype, $conf, $context);
+ if ($pane_context === FALSE) {
+ if ($plugin['name'] == $subtype) {
+ return t('@type will not display due to missing context', array('@type' => $plugin['name']));
+ }
+ return t('@type:@subtype will not display due to missing context', array('@type' => $plugin['name'], '@subtype' => $subtype));
+ }
+
+ return $function($subtype, $conf, $pane_context);
+ }
+ else if (isset($plugin['admin title'])) {
+ return $plugin['admin title'];
+ }
+ else if (isset($plugin['title'])) {
+ return $plugin['title'];
+ }
+}
+
+/**
+ * Get the proper icon path to use, falling back to default icons if no icon exists.
+ *
+ * $subtype
+ * The loaded subtype info.
+ */
+function ctools_content_admin_icon($subtype) {
+ $icon = '';
+
+ if (isset($subtype['icon'])) {
+ $icon = $subtype['icon'];
+ if (!file_exists($icon)) {
+ $icon = $subtype['path'] . '/' . $icon;
+ }
+ }
+
+ if (empty($icon) || !file_exists($icon)) {
+ $icon = ctools_image_path('no-icon.png');
+ }
+
+ return $icon;
+}
+
+/**
+ * Set up the default $conf for a new instance of a content type.
+ */
+function ctools_content_get_defaults($plugin, $subtype) {
+ if (isset($plugin['defaults'])) {
+ $defaults = $plugin['defaults'];
+ }
+ else if (isset($subtype['defaults'])) {
+ $defaults = $subtype['defaults'];
+ }
+ if (isset($defaults)) {
+ if (is_string($defaults) && function_exists($defaults)) {
+ if ($return = $defaults($pane)) {
+ return $return;
+ }
+ }
+ else if (is_array($defaults)) {
+ return $defaults;
+ }
+ }
+
+ return array();
+}
+
+/**
+ * Get the administrative title from a given content type.
+ *
+ * @param $type
+ * The content type. May be the name or an already loaded content type object.
+ * @param $subtype
+ * The subtype being rendered.
+ * @param $conf
+ * The configuration for the content type.
+ * @param $context
+ * An array of context objects available for use. These may be placeholders.
+ */
+function ctools_content_admin_info($type, $subtype, $conf, $context = NULL) {
+ if (is_array($type)) {
+ $plugin = $type;
+ }
+ else {
+ $plugin = ctools_get_content_type($type);
+ }
+
+ if ($function = ctools_plugin_get_function($plugin, 'admin info')) {
+ $output = $function($subtype, $conf, $context);
+ }
+
+ if (empty($output) || !is_object($output)) {
+ $output = new stdClass();
+ // replace the _ with " " for a better output
+ $subtype = check_plain(str_replace("_", " ", $subtype));
+ $output->title = $subtype;
+ $output->content = t('No info available.');
+ }
+ return $output;
+}
+
+/**
+ * Add the default FAPI elements to the content type configuration form
+ */
+function ctools_content_configure_form_defaults($form, &$form_state) {
+ $plugin = $form_state['plugin'];
+ $subtype = $form_state['subtype'];
+ $contexts = isset($form_state['contexts']) ? $form_state['contexts'] : NULL;
+ $conf = $form_state['conf'];
+
+ $add_submit = FALSE;
+ if (!empty($subtype['required context']) && is_array($contexts)) {
+ $form['context'] = ctools_context_selector($contexts, $subtype['required context'], isset($conf['context']) ? $conf['context'] : array());
+ $add_submit = TRUE;
+ }
+
+ ctools_include('dependent');
+
+ // Unless we're not allowed to override the title on this content type, add this
+ // gadget to all panes.
+ if (empty($plugin['no title override']) && empty($subtype['no title override'])) {
+ $form['aligner_start'] = array(
+ '#markup' => '<div class="option-text-aligner clearfix">',
+ );
+ $form['override_title'] = array(
+ '#type' => 'checkbox',
+ '#default_value' => isset($conf['override_title']) ? $conf['override_title'] : '',
+ '#title' => t('Override title'),
+ '#id' => 'override-title-checkbox',
+ );
+ $form['override_title_text'] = array(
+ '#type' => 'textfield',
+ '#default_value' => isset($conf['override_title_text']) ? $conf['override_title_text'] : '',
+ '#size' => 35,
+ '#id' => 'override-title-textfield',
+ '#dependency' => array('override-title-checkbox' => array(1)),
+ '#dependency_type' => 'disable',
+ );
+ $form['aligner_stop'] = array(
+ '#markup' => '</div>',
+ );
+ if (is_array($contexts)) {
+ $form['override_title_markup'] = array(
+ '#prefix' => '<div class="description">',
+ '#suffix' => '</div>',
+ '#markup' => t('You may use %keywords from contexts, as well as %title to contain the original title.'),
+ );
+ }
+ $add_submit = TRUE;
+ }
+
+ if ($add_submit) {
+ // '#submit' is already set up due to the wizard.
+ $form['#submit'][] = 'ctools_content_configure_form_defaults_submit';
+ }
+ return $form;
+}
+
+/**
+ * Submit handler to store context/title override info.
+ */
+function ctools_content_configure_form_defaults_submit(&$form, &$form_state) {
+ if (isset($form_state['values']['context'])) {
+ $form_state['conf']['context'] = $form_state['values']['context'];
+ }
+ if (isset($form_state['values']['override_title'])) {
+ $form_state['conf']['override_title'] = $form_state['values']['override_title'];
+ $form_state['conf']['override_title_text'] = $form_state['values']['override_title_text'];
+ }
+}
+
+/**
+ * Get the config form.
+ *
+ * The $form_info and $form_state need to be preconfigured with data you'll need
+ * such as whether or not you're using ajax, or the modal. $form_info will need
+ * your next/submit callbacks so that you can cache your data appropriately.
+ *
+ * @return
+ * If this function returns false, no form exists.
+ */
+function ctools_content_form($op, $form_info, &$form_state, $plugin, $subtype_name, $subtype, &$conf, $step = NULL) {
+ $form_state += array(
+ 'plugin' => $plugin,
+ 'subtype' => $subtype,
+ 'subtype_name' => $subtype_name,
+ 'conf' => &$conf,
+ 'op' => $op,
+ );
+
+ $form_info += array(
+ 'id' => 'ctools_content_form',
+ 'show back' => TRUE,
+ );
+
+ // Turn the forms defined in the plugin into the format the wizard needs.
+ if ($op == 'add') {
+ if (!empty($subtype['add form'])) {
+ _ctools_content_create_form_info($form_info, $subtype['add form'], $subtype, $subtype, $op);
+ }
+ else if (!empty($plugin['add form'])) {
+ _ctools_content_create_form_info($form_info, $plugin['add form'], $plugin, $subtype, $op);
+ }
+ }
+
+ if (empty($form_info['order'])) {
+ // Use the edit form for the add form if add form was completely left off.
+ if (!empty($subtype['edit form'])) {
+ _ctools_content_create_form_info($form_info, $subtype['edit form'], $subtype, $subtype, $op);
+ }
+ else if (!empty($plugin['edit form'])) {
+ _ctools_content_create_form_info($form_info, $plugin['edit form'], $plugin, $subtype, $op);
+ }
+ }
+
+ if (empty($form_info['order'])) {
+ return FALSE;
+ }
+
+ ctools_include('wizard');
+ return ctools_wizard_multistep_form($form_info, $step, $form_state);
+
+}
+
+function _ctools_content_create_form_info(&$form_info, $info, $plugin, $subtype, $op) {
+ if (is_string($info)) {
+ if (empty($subtype['title'])) {
+ $title = t('Configure');
+ }
+ else if ($op == 'add') {
+ $title = t('Configure new !subtype_title', array('!subtype_title' => $subtype['title']));
+ }
+ else {
+ $title = t('Configure !subtype_title', array('!subtype_title' => $subtype['title']));
+ }
+ $form_info['order'] = array('form' => $title);
+ $form_info['forms'] = array(
+ 'form' => array(
+ 'title' => $title,
+ 'form id' => $info,
+ 'wrapper' => 'ctools_content_configure_form_defaults',
+ ),
+ );
+ }
+ else if (is_array($info)) {
+ $form_info['order'] = array();
+ $form_info['forms'] = array();
+ $count = 0;
+ $base = 'step';
+ $wrapper = NULL;
+ foreach ($info as $form_id => $title) {
+ // @todo -- docs say %title can be used to sub for the admin title.
+ $step = $base . ++$count;
+ if (empty($wrapper)) {
+ $wrapper = $step;
+ }
+
+ if (is_array($title)) {
+ if (!empty($title['default'])) {
+ $wrapper = $step;
+ }
+ $title = $title['title'];
+ }
+
+ $form_info['order'][$step] = $title;
+ $form_info['forms'][$step] = array(
+ 'title' => $title,
+ 'form id' => $form_id,
+ );
+ }
+ if ($wrapper) {
+ $form_info['forms'][$wrapper]['wrapper'] = 'ctools_content_configure_form_defaults';
+ }
+ }
+}
+
+/**
+ * Get an array of all available content types that can be fed into the
+ * display editor for the add content list.
+ *
+ * @param $context
+ * If a context is provided, content that requires that context can apepar.
+ * @param $has_content
+ * Whether or not the display will have incoming content
+ * @param $allowed_types
+ * An array of allowed content types (pane types) keyed by content_type . '-' . sub_type
+ * @param $default_types
+ * A default allowed/denied status for content that isn't known about
+ */
+function ctools_content_get_available_types($contexts = NULL, $has_content = FALSE, $allowed_types = NULL, $default_types = NULL) {
+ $plugins = ctools_get_content_types();
+ $available = array();
+
+ foreach ($plugins as $id => $plugin) {
+ foreach (ctools_content_get_subtypes($plugin) as $subtype_id => $subtype) {
+ // exclude items that require content if we're saying we don't
+ // provide it.
+ if (!empty($subtype['requires content']) && !$has_content) {
+ continue;
+ }
+
+ // Check to see if the content type can be used in this context.
+ if (!empty($subtype['required context'])) {
+ if (!ctools_context_match_requirements($contexts, $subtype['required context'])) {
+ continue;
+ }
+ }
+
+ // Check to see if the passed-in allowed types allows this content.
+ if ($allowed_types) {
+ $key = $id . '-' . $subtype_id;
+ if (!isset($allowed_types[$key])) {
+ $allowed_types[$key] = isset($default_types[$id]) ? $default_types[$id] : $default_types['other'];
+ }
+ if (!$allowed_types[$key]) {
+ continue;
+ }
+ }
+
+ // If we made it through all the tests, then we can use this content.
+ $available[$id][$subtype_id] = $subtype;
+ }
+ }
+ return $available;
+}
+
+/**
+ * Get an array of all content types that can be fed into the
+ * display editor for the add content list, regardless of
+ * availability.
+ *
+ */
+function ctools_content_get_all_types() {
+ $plugins = ctools_get_content_types();
+ $available = array();
+
+ foreach ($plugins as $id => $plugin) {
+ foreach (ctools_content_get_subtypes($plugin) as $subtype_id => $subtype) {
+ // If we made it through all the tests, then we can use this content.
+ $available[$id][$subtype_id] = $subtype;
+ }
+ }
+ return $available;
+}
+
+/**
+ * Select the context to be used for a piece of content, based upon config.
+ *
+ * @param $plugin
+ * The content plugin
+ * @param $subtype
+ * The subtype of the content.
+ * @param $conf
+ * The configuration array that should contain the context.
+ * @param $contexts
+ * A keyed array of available contexts.
+ *
+ * @return
+ * The matching contexts or NULL if none or necessary, or FALSE if
+ * requirements can't be met.
+ */
+function ctools_content_select_context($plugin, $subtype, $conf, $contexts) {
+ // Identify which of our possible contexts apply.
+ if (empty($subtype)) {
+ return;
+ }
+
+ $subtype_info = ctools_content_get_subtype($plugin, $subtype);
+ if (empty($subtype_info)) {
+ return;
+ }
+
+ if (!empty($subtype_info['all contexts']) || !empty($plugin['all contexts'])) {
+ return $contexts;
+ }
+
+ // If the content requires a context, fetch it; if no context is returned,
+ // do not display the pane.
+ if (empty($subtype_info['required context'])) {
+ return;
+ }
+
+ // Deal with dynamic required contexts not getting updated in the panes.
+ // For example, Views let you dynamically change context info. While
+ // we cannot be perfect, one thing we can do is if no context at all
+ // was asked for, and then was later added but none is selected, make
+ // a best guess as to what context should be used. THis is right more
+ // than it's wrong.
+ if (is_array($subtype_info['required context'])) {
+ if (empty($conf['context']) || count($subtype_info['required context']) != count($conf['context'])) {
+ foreach ($subtype_info['required context'] as $index => $required) {
+ if (!isset($conf['context'][$index])) {
+ $filtered = ctools_context_filter($contexts, $required);
+ if ($filtered) {
+ $keys = array_keys($filtered);
+ $conf['context'][$index] = array_shift($keys);
+ }
+ }
+ }
+ }
+ }
+ else {
+ if (empty($conf['context'])) {
+ $filtered = ctools_context_filter($contexts, $subtype_info['required context']);
+ if ($filtered) {
+ $keys = array_keys($filtered);
+ $conf['context'] = array_shift($keys);
+ }
+ }
+ }
+
+ if (empty($conf['context'])) {
+ return;
+ }
+
+ $context = ctools_context_select($contexts, $subtype_info['required context'], $conf['context']);
+
+ return $context;
+}
+
+/**
+ * Fetch a piece of content from the addressable content system.
+ *
+ * @param $address
+ * A string or an array representing the address of the content.
+ * @param $type
+ * The type of content to return. The type is dependent on what
+ * the content actually is. The default, 'content' means a simple
+ * string representing the content. However, richer systems may
+ * offer more options. For example, Panels might allow the
+ * fetching of 'display' and 'pane' objects. Page Manager
+ * might allow for the fetching of 'task_handler' objects
+ * (AKA variants).
+ */
+function ctools_get_addressable_content($address, $type = 'content') {
+ if (!is_array($address)) {
+ $address = explode('::', $address);
+ }
+
+ if (!$address) {
+ return;
+ }
+
+ // This removes the module from the address so the
+ // implementor is not responsible for that part.
+ $module = array_shift($address);
+ return module_invoke($module, 'addressable_content', $address, $type);
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.menu.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.menu.inc
new file mode 100644
index 0000000..11a686a
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.menu.inc
@@ -0,0 +1,75 @@
+<?php
+
+/**
+ * @file
+ * Contains menu item registration for the content tool.
+ *
+ * The menu items registered are AJAX callbacks for the things like
+ * autocomplete and other tools needed by the content types.
+ */
+
+function ctools_content_menu(&$items) {
+ $base = array(
+ 'access arguments' => array('access content'),
+ 'type' => MENU_CALLBACK,
+ 'file' => 'includes/content.menu.inc',
+ );
+ $items['ctools/autocomplete/%'] = array(
+ 'page callback' => 'ctools_content_autocomplete_entity',
+ 'page arguments' => array(2),
+ ) + $base;
+}
+
+/**
+ * Helper function for autocompletion of entity titles.
+ */
+function ctools_content_autocomplete_entity($type, $string = '') {
+ $entity = entity_get_info($type);
+ if ($string != '') {
+ // @todo verify the query logic here, it's untested.
+ // Set up the query
+ $query = db_select($entity['base table'], 'b');
+ if ($entity['entity keys']['label']) {
+ $query->fields('b', array($entity['entity keys']['id'], $entity['entity keys']['label']))->range(0, 10);
+ }
+ else {
+ $query->fields('b', array($entity['entity keys']['id']))->range(0, 10);
+ }
+
+ $preg_matches = array();
+ $match = preg_match('/\[id: (\d+)\]/', $string, $preg_matches);
+ if (!$match) {
+ $match = preg_match('/^id: (\d+)/', $string, $preg_matches);
+ }
+ if ($match) {
+ $query->condition('b.' . $entity['entity keys']['id'], $preg_matches[1]);
+ }
+ elseif ($entity['entity keys']['label']) {
+ $query->condition('b.' . $entity['entity keys']['label'], '%' . db_like($string) . '%', 'LIKE');
+ }
+
+ $matches = array();
+ if ($type == 'node') {
+ $query->addTag('node_access');
+ $query->join('users', 'u', 'b.uid = u.uid');
+ $query->addField('u', 'name', 'name');
+
+ foreach ($query->execute() as $nodeish) {
+ $name = empty($nodeish->name) ? variable_get('anonymous', t('Anonymous')) : check_plain($nodeish->name);
+ $matches[$nodeish->title . " [id: $nodeish->nid]"] = '<span class="autocomplete_title">' . check_plain($nodeish->title) . '</span> <span class="autocomplete_user">(' . t('by @user', array('@user' => $name)) . ')</span>';
+ }
+ }
+ else {
+ foreach ($query->execute() as $item) {
+ $id = $item->{$entity['entity keys']['id']};
+ if ($entity['entity keys']['label']) {
+ $matches[$item->{$entity['entity keys']['label']} . " [id: $id]"] = '<span class="autocomplete_title">' . check_plain($item->{$entity['entity keys']['label']}) . '</span>';
+ }
+ else {
+ $matches["[id: $id]"] = '<span class="autocomplete_title">' . check_plain($item->{$entity['entity keys']['id']}) . '</span>';
+ }
+ }
+ }
+ drupal_json_output($matches);
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.plugin-type.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.plugin-type.inc
new file mode 100644
index 0000000..4c767ae
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.plugin-type.inc
@@ -0,0 +1,17 @@
+<?php
+
+/**
+ * @file
+ * Contains plugin type registration information for the content tool.
+ */
+
+function ctools_content_plugin_type(&$items) {
+ $items['content_types'] = array(
+ 'cache' => FALSE,
+ 'process' => array(
+ 'function' => 'ctools_content_process',
+ 'file' => 'export-ui.inc',
+ 'path' => drupal_get_path('module', 'ctools') . '/includes',
+ ),
+ );
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.theme.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.theme.inc
new file mode 100644
index 0000000..ae4456a
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/content.theme.inc
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * @file
+ * Contains theme registry and theme implementations for the content types.
+ */
+
+/**
+ * Implements hook_theme to load all content plugins and pass thru if
+ * necessary.
+ */
+function ctools_content_theme(&$theme) {
+ ctools_include('content');
+
+ $plugins = ctools_get_content_types();
+ foreach ($plugins as $plugin) {
+ if ($function = ctools_plugin_get_function($plugin, 'hook theme')) {
+ $function($theme, $plugin);
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-access-admin.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-access-admin.inc
new file mode 100644
index 0000000..76643cf
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-access-admin.inc
@@ -0,0 +1,486 @@
+<?php
+
+/**
+ * @file
+ * Contains administrative screens for the access control plugins.
+ *
+ * Access control can be implemented by creating a list of 0 or more access
+ * plugins, each with settings. This list can be ANDed together or ORed
+ * together. When testing access, each plugin is tested until success
+ * or failure can be determined. We use short circuiting techniques to
+ * ensure we are as efficient as possible.
+ *
+ * Access plugins are part of the context system, and as such can require
+ * contexts to work. That allows the use of access based upon visibility
+ * of an object, or even more esoteric things such as node type, node language
+ * etc. Since a lot of access depends on the logged in user, the logged in
+ * user should always be provided as a context.
+ *
+ * In the UI, the user is presented with a table and a 'add access method' select.
+ * When added, the user will be presented with the config wizard and, when
+ * confirmed, table will be refreshed via AJAX to show the new access method.
+ * Each item in the table will have controls to change the settings or remove
+ * the item. Changing the settings will invoke the modal for update.
+ *
+ * Currently the modal is not degradable, but it could be with only a small
+ * amount of work.
+ *
+ * A simple radio
+ * control is used to let the user pick the and/or logic.
+ *
+ * Access control is stored in an array:
+ * @code
+ * array(
+ * 'plugins' => array(
+ * 0 => array(
+ * 'name' => 'name of access plugin',
+ * 'settings' => array(), // These will be set by the form
+ * ),
+ * // ... as many as needed
+ * ),
+ * 'logic' => 'AND', // or 'OR',
+ * ),
+ * @endcode
+ *
+ * To add this widget to your UI, you need to do a little bit of setup.
+ *
+ * The form will utilize two callbacks, one to get the cached version
+ * of the access settings, and one to store the cached version of the
+ * access settings. These will be used from AJAX forms, so they will
+ * be completely out of the context of this page load and will not have
+ * knowledge of anything sent to this form (the 'module' and 'argument'
+ * will be preserved through the URL only).
+ *
+ * The 'module' is used to determine the location of the callback. It
+ * does not strictly need to be a module, so that if your module defines
+ * multiple systems that use this callback, it can use anything within the
+ * module's namespace it likes.
+ *
+ * When retrieving the cache, the cache may not have already been set up;
+ * In order to efficiently use cache space, we want to cache the stored
+ * settings *only* when they have changed. Therefore, the get access cache
+ * callback should first look for cache, and if it finds nothing, return
+ * the original settings.
+ *
+ * The callbacks:
+ * - $module . _ctools_access_get($argument) -- get the 'access' settings
+ * from cache. Must return array($access, $contexts); This callback can
+ * perform access checking to make sure this URL is not being gamed.
+ * - $module . _ctools_access_set($argument, $access) -- set the 'access'
+ * settings in cache.
+ * - $module . _ctools_access_clear($argument) -- clear the cache.
+ *
+ * The ctools_object_cache is recommended for this purpose, but you can use
+ * any caching mechanism you like. An example:
+ *
+ * @code{
+ * ctools_include('object-cache');
+ * ctools_object_cache_set("$module:argument", $access);
+ * }
+ *
+ * To utilize this form:
+ * @code
+ * ctools_include('context-access-admin');
+ * $form_state = array(
+ * 'access' => $access,
+ * 'module' => 'module name',
+ * 'callback argument' => 'some string',
+ * 'contexts' => $contexts, // an array of contexts. Optional if no contexts.
+ * // 'logged-in-user' will be added if not present as the access system
+ * // requires this context.
+ * ),
+ * $output = drupal_build_form('ctools_access_admin_form', $form_state);
+ * if (!empty($form_state['executed'])) {
+ * // save $form_state['access'] however you like.
+ * }
+ * @endcode
+ *
+ * Additionally, you may add 'no buttons' => TRUE if you wish to embed this
+ * form into your own, and instead call
+ *
+ * @code{
+ * $form = ctools_access_admin_form($form, $form_state);
+ * }
+ *
+ * You'll be responsible for adding a submit button.
+ *
+ * You may use ctools_access($access, $contexts) which will return
+ * TRUE if access is passed or FALSE if access is not passed.
+ */
+
+/**
+ * Administrative form for access control.
+ */
+function ctools_access_admin_form($form, &$form_state) {
+ ctools_include('context');
+ $argument = isset($form_state['callback argument']) ? $form_state['callback argument'] : '';
+ $fragment = $form_state['module'];
+ if ($argument) {
+ $fragment .= '-' . $argument;
+ }
+
+ $contexts = isset($form_state['contexts']) ? $form_state['contexts'] : array();
+
+ $form['access_table'] = array(
+ '#markup' => ctools_access_admin_render_table($form_state['access'], $fragment, $contexts),
+ );
+
+ $form['add-button'] = array(
+ '#theme' => 'ctools_access_admin_add',
+ );
+ // This sets up the URL for the add access modal.
+ $form['add-button']['add-url'] = array(
+ '#attributes' => array('class' => array("ctools-access-add-url")),
+ '#type' => 'hidden',
+ '#value' => url("ctools/context/ajax/access/add/$fragment", array('absolute' => TRUE)),
+ );
+
+ $plugins = ctools_get_relevant_access_plugins($contexts);
+ $options = array();
+ foreach ($plugins as $id => $plugin) {
+ $options[$id] = $plugin['title'];
+ }
+
+ asort($options);
+
+ $form['add-button']['type'] = array(
+ // This ensures that the form item is added to the URL.
+ '#attributes' => array('class' => array("ctools-access-add-url")),
+ '#type' => 'select',
+ '#options' => $options,
+ '#required' => FALSE,
+ );
+
+ $form['add-button']['add'] = array(
+ '#type' => 'submit',
+ '#attributes' => array('class' => array('ctools-use-modal')),
+ '#id' => "ctools-access-add",
+ '#value' => t('Add'),
+ );
+
+ $form['logic'] = array(
+ '#type' => 'radios',
+ '#options' => array(
+ 'and' => t('All criteria must pass.'),
+ 'or' => t('Only one criteria must pass.'),
+ ),
+ '#default_value' => isset($form_state['access']['logic']) ? $form_state['access']['logic'] : 'and',
+ );
+
+ if (empty($form_state['no buttons'])) {
+ $form['buttons']['save'] = array(
+ '#type' => 'submit',
+ '#value' => t('Save'),
+ '#submit' => array('ctools_access_admin_form_submit'),
+ );
+ }
+
+ return $form;
+}
+
+/**
+ * Render the table. This is used both to render it initially and to rerender
+ * it upon ajax response.
+ */
+function ctools_access_admin_render_table($access, $fragment, $contexts) {
+ ctools_include('ajax');
+ ctools_include('modal');
+ $rows = array();
+
+ if (empty($access['plugins'])) {
+ $access['plugins'] = array();
+ }
+
+ foreach ($access['plugins'] as $id => $test) {
+ $row = array();
+ $plugin = ctools_get_access_plugin($test['name']);
+ $title = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name']));
+
+ $row[] = array('data' => $title, 'class' => array('ctools-access-title'));
+
+ $description = ctools_access_summary($plugin, $contexts, $test);
+ $row[] = array('data' => $description, 'class' => array('ctools-access-description'));
+
+ $operations = ctools_modal_image_button(ctools_image_path('icon-configure.png'), "ctools/context/ajax/access/configure/$fragment/$id", t('Configure settings for this item.'));
+ $operations .= ctools_ajax_image_button(ctools_image_path('icon-delete.png'), "ctools/context/ajax/access/delete/$fragment/$id", t('Remove this item.'));
+
+ $row[] = array('data' => $operations, 'class' => array('ctools-access-operations'), 'align' => 'right');
+
+ $rows[] = $row;
+ }
+
+ $header = array(
+ array('data' => t('Title'), 'class' => array('ctools-access-title')),
+ array('data' => t('Description'), 'class' => array('ctools-access-description')),
+ array('data' => '', 'class' => array('ctools-access-operations'), 'align' => 'right'),
+ );
+
+ if (empty($rows)) {
+ $rows[] = array(array('data' => t('No criteria selected, this test will pass.'), 'colspan' => count($header)));
+ }
+
+ ctools_modal_add_js();
+ return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'ctools-access-table')));
+}
+
+/**
+ * Theme the 'add' portion of the access form into a table.
+ */
+function theme_ctools_access_admin_add($vars) {
+ $rows = array(array(drupal_render_children($vars['form'])));
+ $output = '<div class="container-inline">';
+ $output .= theme('table', array('rows' => $rows));
+ $output .= '</div>';
+ return $output;
+}
+
+function ctools_access_admin_form_submit($form, &$form_state) {
+ $form_state['access']['logic'] = $form_state['values']['logic'];
+
+ $function = $form_state['module'] . '_ctools_access_clear';
+ if (function_exists($function)) {
+ $function($form_state['callback argument']);
+ }
+}
+
+// --------------------------------------------------------------------------
+// AJAX menu entry points.
+
+/**
+ * AJAX callback to add a new access test to the list.
+ */
+function ctools_access_ajax_add($fragment = NULL, $name = NULL) {
+ ctools_include('ajax');
+ ctools_include('modal');
+ ctools_include('context');
+
+ if (empty($fragment) || empty($name)) {
+ ctools_ajax_render_error();
+ }
+
+ $plugin = ctools_get_access_plugin($name);
+ if (empty($plugin)) {
+ ctools_ajax_render_error();
+ }
+
+ // Separate the fragment into 'module' and 'argument'
+ if (strpos($fragment, '-') === FALSE) {
+ $module = $fragment;
+ $argument = NULL;
+ }
+ else {
+ list($module, $argument) = explode('-', $fragment, 2);
+ }
+
+ $function = $module . '_ctools_access_get';
+ if (!function_exists($function)) {
+ ctools_ajax_render_error(t('Missing callback hooks.'));
+ }
+
+ list($access, $contexts) = $function($argument);
+
+ // Make sure we have the logged in user context
+ if (!isset($contexts['logged-in-user'])) {
+ $contexts['logged-in-user'] = ctools_access_get_loggedin_context();
+ }
+
+ if (empty($access['plugins'])) {
+ $access['plugins'] = array();
+ }
+
+ $test = ctools_access_new_test($plugin);
+
+ $id = $access['plugins'] ? max(array_keys($access['plugins'])) + 1 : 0;
+ $access['plugins'][$id] = $test;
+
+ $form_state = array(
+ 'plugin' => $plugin,
+ 'id' => $id,
+ 'test' => &$access['plugins'][$id],
+ 'access' => &$access,
+ 'contexts' => $contexts,
+ 'title' => t('Add criteria'),
+ 'ajax' => TRUE,
+ 'modal' => TRUE,
+ 'modal return' => TRUE,
+ );
+
+ $output = ctools_modal_form_wrapper('ctools_access_ajax_edit_item', $form_state);
+ if (!isset($output[0])) {
+ $function = $module . '_ctools_access_set';
+ if (function_exists($function)) {
+ $function($argument, $access);
+ }
+
+ $table = ctools_access_admin_render_table($access, $fragment, $contexts);
+ $output = array();
+ $output[] = ajax_command_replace('table#ctools-access-table', $table);
+ $output[] = ctools_modal_command_dismiss();
+ }
+
+ print ajax_render($output);
+}
+
+/**
+ * AJAX callback to edit an access test in the list.
+ */
+function ctools_access_ajax_edit($fragment = NULL, $id = NULL) {
+ ctools_include('ajax');
+ ctools_include('modal');
+ ctools_include('context');
+
+ if (empty($fragment) || !isset($id)) {
+ ctools_ajax_render_error();
+ }
+
+ // Separate the fragment into 'module' and 'argument'
+ if (strpos($fragment, '-') === FALSE) {
+ $module = $fragment;
+ $argument = NULL;
+ }
+ else {
+ list($module, $argument) = explode('-', $fragment, 2);
+ }
+
+ $function = $module . '_ctools_access_get';
+ if (!function_exists($function)) {
+ ctools_ajax_render_error(t('Missing callback hooks.'));
+ }
+
+ list($access, $contexts) = $function($argument);
+
+ if (empty($access['plugins'][$id])) {
+ ctools_ajax_render_error();
+ }
+
+ // Make sure we have the logged in user context
+ if (!isset($contexts['logged-in-user'])) {
+ $contexts['logged-in-user'] = ctools_access_get_loggedin_context();
+ }
+
+ $plugin = ctools_get_access_plugin($access['plugins'][$id]['name']);
+ $form_state = array(
+ 'plugin' => $plugin,
+ 'id' => $id,
+ 'test' => &$access['plugins'][$id],
+ 'access' => &$access,
+ 'contexts' => $contexts,
+ 'title' => t('Edit criteria'),
+ 'ajax' => TRUE,
+ 'ajax' => TRUE,
+ 'modal' => TRUE,
+ 'modal return' => TRUE,
+ );
+
+ $output = ctools_modal_form_wrapper('ctools_access_ajax_edit_item', $form_state);
+ if (!isset($output[0])) {
+ $function = $module . '_ctools_access_set';
+ if (function_exists($function)) {
+ $function($argument, $access);
+ }
+
+ $table = ctools_access_admin_render_table($access, $fragment, $contexts);
+ $output = array();
+ $output[] = ajax_command_replace('table#ctools-access-table', $table);
+ $output[] = ctools_modal_command_dismiss();
+ }
+
+ print ajax_render($output);
+}
+
+/**
+ * Form to edit the settings of an access test.
+ */
+function ctools_access_ajax_edit_item($form, &$form_state) {
+ $test = &$form_state['test'];
+ $plugin = &$form_state['plugin'];
+ if (isset($plugin['required context'])) {
+ $form['context'] = ctools_context_selector($form_state['contexts'], $plugin['required context'], $test['context']);
+ }
+ $form['settings'] = array('#tree' => TRUE);
+ if ($function = ctools_plugin_get_function($plugin, 'settings form')) {
+ $form = $function($form, $form_state, $test['settings']);
+ }
+
+ $form['not'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Reverse (NOT)'),
+ '#default_value' => !empty($test['not']),
+ );
+
+ $form['save'] = array(
+ '#type' => 'submit',
+ '#value' => t('Save'),
+ );
+
+ return $form;
+}
+
+/**
+ * Validate handler for argument settings.
+ */
+function ctools_access_ajax_edit_item_validate($form, &$form_state) {
+ if ($function = ctools_plugin_get_function($form_state['plugin'], 'settings form validate')) {
+ $function($form, $form_state);
+ }
+}
+
+/**
+ * Submit handler for argument settings.
+ */
+function ctools_access_ajax_edit_item_submit($form, &$form_state) {
+ if ($function = ctools_plugin_get_function($form_state['plugin'], 'settings form submit')) {
+ $function($form, $form_state);
+ }
+
+ $form_state['test']['settings'] = $form_state['values']['settings'];
+ if (isset($form_state['values']['context'])) {
+ $form_state['test']['context'] = $form_state['values']['context'];
+ }
+ $form_state['test']['not'] = !empty($form_state['values']['not']);
+}
+
+/**
+ * AJAX command to remove an access control item.
+ */
+function ctools_access_ajax_delete($fragment = NULL, $id = NULL) {
+ ctools_include('ajax');
+ ctools_include('modal');
+ ctools_include('context');
+
+ if (empty($fragment) || !isset($id)) {
+ ajax_render_error();
+ }
+
+ // Separate the fragment into 'module' and 'argument'
+ if (strpos($fragment, '-') === FALSE) {
+ $module = $fragment;
+ $argument = NULL;
+ }
+ else {
+ list($module, $argument) = explode('-', $fragment, 2);
+ }
+
+ $function = $module . '_ctools_access_get';
+ if (!function_exists($function)) {
+ ajax_render_error(t('Missing callback hooks.'));
+ }
+
+ list($access, $contexts) = $function($argument);
+
+ if (isset($access['plugins'][$id])) {
+ unset($access['plugins'][$id]);
+ }
+
+ // re-cache
+ $function = $module . '_ctools_access_set';
+ if (function_exists($function)) {
+ $function($argument, $access);
+ }
+
+ $table = ctools_access_admin_render_table($access, $fragment, $contexts);
+ $output = array();
+ $output[] = ajax_command_replace('table#ctools-access-table', $table);
+
+ print ajax_render($output);
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-admin.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-admin.inc
new file mode 100644
index 0000000..7e5cd02
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-admin.inc
@@ -0,0 +1,819 @@
+<?php
+
+/**
+ * @file includes/common-context.inc
+ * Provide API for adding contexts for modules that embed displays.
+ *
+ * Note that most of this code was directly copied from Panels 2, and as such
+ * a lot of this code is crusty. It could probably stand to be rewritten,
+ * and brought up to date, or at least better commented.
+ */
+
+/**
+ * Provide a list of the ways contexts can be embedded.
+ *
+ * This provides a full list of context types that the tool understands
+ * and can let modules utilize.
+ */
+function ctools_context_info($type = NULL) {
+ static $info = NULL;
+
+ // static doesn't work with functions like t().
+ if (empty($info)) {
+ $info = array(
+ 'argument' => array(
+ 'title' => t('Arguments'),
+ 'singular title' => t('argument'),
+ 'description' => '', // t("Arguments are parsed from the URL and translated into contexts that may be added to the display via the 'content' tab. These arguments are parsed in the order received, and you may use % in your URL to hold the place of an object; the rest of the arguments will come after the URL. For example, if the URL is node/%/panel and your user visits node/1/panel/foo, the first argument will be 1, and the second argument will be foo."),
+ 'add button' => t('Add argument'),
+ 'context function' => 'ctools_get_argument',
+ 'key' => 'arguments', // the key that data will be stored on an object, eg $panel_page
+ 'sortable' => TRUE,
+ 'settings' => 'argument_settings',
+ ),
+ 'relationship' => array(
+ 'title' => t('Relationships'),
+ 'singular title' => t('relationship'),
+ 'description' => '', // t('Relationships are contexts that are created from already existing contexts; the add relationship button will only appear once there is another context available. Relationships can load objects based upon how they are related to each other; for example, the author of a node, or a taxonomy term attached to a node, or the vocabulary of a taxonomy term.'),
+ 'add button' => t('Add relationship'),
+ 'context function' => 'ctools_get_relationship',
+ 'key' => 'relationships',
+ 'sortable' => FALSE,
+ 'settings' => 'relationship_settings',
+ ),
+ 'context' => array(
+ 'title' => t('Contexts'),
+ 'singular title' => t('context'),
+ 'description' => '', // t('Contexts are embedded directly into the panel; you generally must select an object in the panel. For example, you could select node 5, or the term "animals" or the user "administrator"'),
+ 'add button' => t('Add context'),
+ 'context function' => 'ctools_get_context',
+ 'key' => 'contexts',
+ 'sortable' => FALSE,
+ 'settings' => 'context_settings',
+ ),
+ 'requiredcontext' => array(
+ 'title' => t('Required contexts'),
+ 'singular title' => t('required context'),
+ 'description' => '', // t('Required contexts are passed in from some external source, such as a containing panel. If a mini panel has required contexts, it can only appear when that context is available, and therefore will not show up as a standard Drupal block.'),
+ 'add button' => t('Add required context'),
+ 'context function' => 'ctools_get_context',
+ 'key' => 'requiredcontexts',
+ 'sortable' => FALSE,
+ ),
+ );
+ }
+
+ if ($type === NULL) {
+ return $info;
+ }
+
+ return $info[$type];
+}
+
+
+/**
+ * Get the data belonging to a particular context.
+ */
+function ctools_context_get_plugin($type, $name) {
+ $info = ctools_context_info($type);
+ if (function_exists($info['context function'])) {
+ return $info['context function']($name);
+ }
+}
+
+/**
+ * Add the argument table plus gadget plus javascript to the form.
+ */
+function ctools_context_add_argument_form($module, &$form, &$form_state, &$form_location, $object, $cache_key = NULL) {
+ if (empty($cache_key)) {
+ $cache_key = $object->name;
+ }
+
+ $form_location = array(
+ '#prefix' => '<div id="ctools-arguments-table">',
+ '#suffix' => '</div>',
+ '#theme' => 'ctools_context_item_form',
+ '#cache_key' => $cache_key,
+ '#ctools_context_type' => 'argument',
+ '#ctools_context_module' => $module,
+ );
+
+ $args = ctools_get_arguments();
+ $choices = array();
+ foreach ($args as $name => $arg) {
+ if (empty($arg['no ui'])) {
+ $choices[$name] = $arg['title'];
+ }
+ }
+
+ asort($choices);
+
+ if (!empty($choices) || !empty($object->arguments)) {
+ ctools_context_add_item_table('argument', $form_location, $choices, $object->arguments);
+ }
+}
+
+function ctools_context_add_context_form($module, &$form, &$form_state, &$form_location, $object, $cache_key = NULL) {
+ if (empty($cache_key)) {
+ $cache_key = $object->name;
+ }
+
+ $form_location = array(
+ '#prefix' => '<div id="ctools-contexts-table">',
+ '#suffix' => '</div>',
+ '#theme' => 'ctools_context_item_form',
+ '#cache_key' => $cache_key,
+ '#ctools_context_type' => 'context',
+ '#ctools_context_module' => $module,
+ );
+
+ // Store the order the choices are in so javascript can manipulate it.
+ $form_location['markup'] = array(
+ '#markup' => '&nbsp;',
+ );
+
+ $choices = array();
+ foreach (ctools_get_contexts() as $name => $arg) {
+ if (empty($arg['no ui'])) {
+ $choices[$name] = $arg['title'];
+ }
+ }
+
+ asort($choices);
+
+ if (!empty($choices) || !empty($object->contexts)) {
+ ctools_context_add_item_table('context', $form_location, $choices, $object->contexts);
+ }
+
+}
+
+function ctools_context_add_required_context_form($module, &$form, &$form_state, &$form_location, $object, $cache_key = NULL) {
+ if (empty($cache_key)) {
+ $cache_key = $object->name;
+ }
+
+ $form_location = array(
+ '#prefix' => '<div id="ctools-requiredcontexts-table">',
+ '#suffix' => '</div>',
+ '#theme' => 'ctools_context_item_form',
+ '#cache_key' => $cache_key,
+ '#ctools_context_type' => 'requiredcontext',
+ '#ctools_context_module' => $module,
+ );
+
+ // Store the order the choices are in so javascript can manipulate it.
+ $form_location['markup'] = array(
+ '#value' => '&nbsp;',
+ );
+
+ $choices = array();
+ foreach (ctools_get_contexts() as $name => $arg) {
+ if (empty($arg['no required context ui'])) {
+ $choices[$name] = $arg['title'];
+ }
+ }
+
+ asort($choices);
+
+ if (!empty($choices) || !empty($object->contexts)) {
+ ctools_context_add_item_table('requiredcontext', $form_location, $choices, $object->requiredcontexts);
+ }
+}
+
+function ctools_context_add_relationship_form($module, &$form, &$form_state, &$form_location, $object, $cache_key = NULL) {
+ if (empty($cache_key)) {
+ $cache_key = $object->name;
+ }
+
+ $form_location = array(
+ '#prefix' => '<div id="ctools-relationships-table">',
+ '#suffix' => '</div>',
+ '#theme' => 'ctools_context_item_form',
+ '#cache_key' => $cache_key,
+ '#ctools_context_type' => 'relationship',
+ '#ctools_context_module' => $module,
+ );
+
+ // Store the order the choices are in so javascript can manipulate it.
+ $form_location['markup'] = array(
+ '#value' => '&nbsp;',
+ );
+
+ $base_contexts = isset($object->base_contexts) ? $object->base_contexts : array();
+ $available_relationships = ctools_context_get_relevant_relationships(ctools_context_load_contexts($object, TRUE, $base_contexts));
+
+ ctools_context_add_item_table('relationship', $form_location, $available_relationships, $object->relationships);
+}
+
+/**
+ * Include all context administrative include files, css, javascript.
+ */
+function ctools_context_admin_includes() {
+ ctools_include('context');
+ ctools_include('modal');
+ ctools_include('ajax');
+ ctools_include('object-cache');
+ ctools_modal_add_js();
+ ctools_modal_add_plugin_js(ctools_get_contexts());
+ ctools_modal_add_plugin_js(ctools_get_relationships());
+}
+
+/**
+ * Add the context table to the page.
+ */
+function ctools_context_add_item_table($type, &$form, $available_contexts, $items) {
+ $form[$type] = array(
+ '#tree' => TRUE,
+ );
+
+ $module = $form['#ctools_context_module'];
+ $cache_key = $form['#cache_key'];
+
+ if (isset($items) && is_array($items)) {
+ foreach ($items as $position => $context) {
+ ctools_context_add_item_to_form($module, $type, $cache_key, $form[$type][$position], $position, $context);
+ }
+ }
+
+ $type_info = ctools_context_info($type);
+ $form['description'] = array(
+ '#prefix' => '<div class="description">',
+ '#suffix' => '</div>',
+ '#markup' => $type_info['description'],
+ );
+
+ ctools_context_add_item_table_buttons($type, $module, $form, $available_contexts);
+}
+
+function ctools_context_add_item_table_buttons($type, $module, &$form, $available_contexts) {
+ drupal_add_library('system', 'drupal.ajax');
+ $form['buttons'] = array(
+ '#tree' => TRUE,
+ );
+
+ if (!empty($available_contexts)) {
+ $type_info = ctools_context_info($type);
+
+ $module = $form['#ctools_context_module'];
+ $cache_key = $form['#cache_key'];
+
+ // The URL for this ajax button
+ $form['buttons'][$type]['add-url'] = array(
+ '#attributes' => array('class' => array("ctools-$type-add-url")),
+ '#type' => 'hidden',
+ '#value' => url("ctools/context/ajax/add/$module/$type/$cache_key", array('absolute' => TRUE)),
+ );
+
+ asort($available_contexts);
+ // This also will be in the URL.
+ $form['buttons'][$type]['item'] = array(
+ '#attributes' => array('class' => array("ctools-$type-add-url")),
+ '#type' => 'select',
+ '#options' => $available_contexts,
+ '#required' => FALSE,
+ );
+
+ $form['buttons'][$type]['add'] = array(
+ '#type' => 'submit',
+ '#attributes' => array('class' => array('ctools-use-modal')),
+ '#id' => "ctools-$type-add",
+ '#value' => $type_info['add button'],
+ );
+ }
+}
+
+/**
+ * Add a row to the form. Used both in the main form and by
+ * the ajax to add an item.
+ */
+function ctools_context_add_item_to_form($module, $type, $cache_key, &$form, $position, $item) {
+ // This is the single function way to load any plugin by variable type.
+ $info = ctools_context_get_plugin($type, $item['name']);
+ $form['title'] = array(
+ '#markup' => check_plain($item['identifier']),
+ );
+
+ // Relationships not sortable.
+ $type_info = ctools_context_info($type);
+
+ if (!empty($type_info['sortable'])) {
+ $form['position'] = array(
+ '#type' => 'weight',
+ '#default_value' => $position,
+ '#attributes' => array('class' => array('drag-position')),
+ );
+ }
+
+ $form['remove'] = array(
+ '#markup' => ctools_ajax_image_button(ctools_image_path('icon-delete.png'), "ctools/context/ajax/delete/$module/$type/$cache_key/$position", t('Remove this item.')),
+ );
+
+ $form['settings'] = array(
+ '#markup' => ctools_modal_image_button(ctools_image_path('icon-configure.png'), "ctools/context/ajax/configure/$module/$type/$cache_key/$position", t('Configure settings for this item.')),
+ );
+}
+
+
+// ---------------------------------------------------------------------------
+// AJAX forms and stuff.
+
+/**
+ * Ajax entry point to add an context
+ */
+function ctools_context_ajax_item_add($mechanism = NULL, $type = NULL, $cache_key = NULL, $name = NULL, $step = NULL) {
+ ctools_include('ajax');
+ ctools_include('modal');
+ ctools_include('context');
+ ctools_include('cache');
+ ctools_include('plugins-admin');
+
+ if (!$name) {
+ return ctools_ajax_render_error();
+ }
+
+ // Load stored object from cache.
+ if (!($object = ctools_cache_get($mechanism, $cache_key))) {
+ ctools_ajax_render_error(t('Invalid object name.'));
+ }
+
+ // Get info about what we're adding, i.e, relationship, context, argument, etc.
+ $plugin_definition = ctools_context_get_plugin($type, $name);
+ if (empty($plugin_definition)) {
+ ctools_ajax_render_error(t('Invalid context type'));
+ }
+
+ // Set up the $conf array for this plugin
+ if (empty($step) || empty($object->temporary)) {
+ // Create the basis for our new context.
+ $conf = ctools_context_get_defaults($plugin_definition, $object, $type);
+ $object->temporary = &$conf;
+ }
+ else {
+ $conf = &$object->temporary;
+ }
+
+ // Load the contexts that may be used.
+ $base_contexts = isset($object->base_contexts) ? $object->base_contexts : array();
+ $contexts = ctools_context_load_contexts($object, TRUE, $base_contexts);
+
+ $type_info = ctools_context_info($type);
+ $form_state = array(
+ 'ajax' => TRUE,
+ 'modal' => TRUE,
+ 'modal return' => TRUE,
+ 'object' => &$object,
+ 'conf' => &$conf,
+ 'plugin' => $plugin_definition,
+ 'type' => $type,
+ 'contexts' => $contexts,
+ 'title' => t('Add @type "@context"', array('@type' => $type_info['singular title'], '@context' => $plugin_definition['title'])),
+ 'type info' => $type_info,
+ 'op' => 'add',
+ 'step' => $step,
+ );
+
+ $form_info = array(
+ 'path' => "ctools/context/ajax/add/$mechanism/$type/$cache_key/$name/%step",
+ 'show cancel' => TRUE,
+ 'default form' => 'ctools_edit_context_form_defaults',
+ 'auto caching' => TRUE,
+ 'cache mechanism' => $mechanism,
+ 'cache key' => $cache_key,
+ // This is stating what the cache will be referred to in $form_state
+ 'cache storage' => 'object',
+ );
+
+ if ($type == 'requiredcontext') {
+ $form_info += array(
+ 'add form name' => 'required context add form',
+ 'edit form name' => 'required context edit form',
+ );
+ }
+
+ $output = ctools_plugin_configure_form($form_info, $form_state);
+
+ if (!empty($form_state['cancel'])) {
+ $output = array(ctools_modal_command_dismiss());
+ }
+ else if (!empty($form_state['complete'])) {
+ // Successful submit -- move temporary data to location.
+
+ // Create a reference to the place our context lives. Since this is fairly
+ // generic, this is the easiest way to get right to the place of the
+ // object without knowing precisely what data we're poking at.
+ $ref = &$object->{$type_info['key']};
+
+ // Figure out the position for our new context.
+ $position = empty($ref) ? 0 : max(array_keys($ref)) + 1;
+
+ $conf['id'] = ctools_context_next_id($ref, $name);
+ $ref[$position] = $conf;
+
+ if (isset($object->temporary)) {
+ unset($object->temporary);
+ }
+
+ ctools_cache_operation($mechanism, $cache_key, 'finalize', $object);
+
+ // Very irritating way to update the form for our contexts.
+ $arg_form_state = array('values' => array());
+
+ $arg_form = array(
+ '#post' => array(),
+ '#programmed' => FALSE,
+ '#tree' => FALSE,
+ );
+
+ // Build a chunk of the form to merge into the displayed form
+ $arg_form[$type] = array(
+ '#tree' => TRUE,
+ );
+ $arg_form[$type][$position] = array(
+ '#tree' => TRUE,
+ );
+
+ ctools_context_add_item_to_form($mechanism, $type, $cache_key, $arg_form[$type][$position], $position, $ref[$position]);
+ $arg_form = form_builder('ctools_context_form', $arg_form, $arg_form_state);
+
+ // Build the relationships table so we can ajax it in.
+ // This is an additional thing that goes in here.
+ $rel_form = array(
+ '#theme' => 'ctools_context_item_form',
+ '#cache_key' => $cache_key,
+ '#ctools_context_type' => 'relationship',
+ '#ctools_context_module' => $mechanism,
+ '#only_buttons' => TRUE,
+ '#post' => array(),
+ '#programmed' => FALSE,
+ '#tree' => FALSE,
+ );
+
+ $rel_form['relationship'] = array(
+ '#tree' => TRUE,
+ );
+
+ // Allow an object to set some 'base' contexts that come from elsewhere.
+ $rel_contexts = isset($object->base_contexts) ? $object->base_contexts : array();
+ $all_contexts = ctools_context_load_contexts($object, TRUE, $rel_contexts);
+ $available_relationships = ctools_context_get_relevant_relationships($all_contexts);
+
+ $output = array();
+ if (!empty($available_relationships)) {
+ ctools_context_add_item_table_buttons('relationship', $mechanism, $rel_form, $available_relationships);
+ $rel_form = form_builder('dummy_form_id', $rel_form, $arg_form_state);
+ $output[] = ajax_command_replace('div#ctools-relationships-table div.buttons', drupal_render($rel_form));
+ }
+
+ $theme_vars = array();
+ $theme_vars['type'] = $type;
+ $theme_vars['form'] = $arg_form[$type][$position];
+ $theme_vars['position'] = $position;
+ $theme_vars['count'] = $position;
+ $text = theme('ctools_context_item_row', $theme_vars);
+ $output[] = ajax_command_append('#' . $type . '-table tbody', $text);
+ $output[] = ajax_command_changed('#' . $type . '-row-' . $position, '.title');
+ $output[] = ctools_modal_command_dismiss();
+ }
+ else {
+ $output = ctools_modal_form_render($form_state, $output);
+ }
+ print ajax_render($output);
+ exit;
+}
+
+/**
+ * Ajax entry point to edit an item
+ */
+function ctools_context_ajax_item_edit($mechanism = NULL, $type = NULL, $cache_key = NULL, $position = NULL, $step = NULL) {
+ ctools_include('ajax');
+ ctools_include('modal');
+ ctools_include('context');
+ ctools_include('cache');
+ ctools_include('plugins-admin');
+
+ if (!isset($position)) {
+ return ctools_ajax_render_error();
+ }
+
+ // Load stored object from cache.
+ if (!($object = ctools_cache_get($mechanism, $cache_key))) {
+ ctools_ajax_render_error(t('Invalid object name.'));
+ }
+
+ $type_info = ctools_context_info($type);
+
+ // Create a reference to the place our context lives. Since this is fairly
+ // generic, this is the easiest way to get right to the place of the
+ // object without knowing precisely what data we're poking at.
+ $ref = &$object->{$type_info['key']};
+
+ if (empty($step) || empty($object->temporary)) {
+ // Create the basis for our new context.
+ $conf = $object->{$type_info['key']}[$position];
+ $object->temporary = &$conf;
+ }
+ else {
+ $conf = &$object->temporary;
+ }
+
+ $name = $ref[$position]['name'];
+ if (empty($name)) {
+ ctools_ajax_render_error();
+ }
+
+ // load the plugin definition
+ $plugin_definition = ctools_context_get_plugin($type, $name);
+ if (empty($plugin_definition)) {
+ ctools_ajax_render_error(t('Invalid context type'));
+ }
+
+ // Load the contexts
+ $base_contexts = isset($object->base_contexts) ? $object->base_contexts : array();
+ $contexts = ctools_context_load_contexts($object, TRUE, $base_contexts);
+
+ $form_state = array(
+ 'ajax' => TRUE,
+ 'modal' => TRUE,
+ 'modal return' => TRUE,
+ 'object' => &$object,
+ 'conf' => &$conf,
+ 'position' => $position,
+ 'plugin' => $plugin_definition,
+ 'type' => $type,
+ 'contexts' => $contexts,
+ 'title' => t('Edit @type "@context"', array('@type' => $type_info['singular title'], '@context' => $plugin_definition['title'])),
+ 'type info' => $type_info,
+ 'op' => 'add',
+ 'step' => $step,
+ );
+
+ $form_info = array(
+ 'path' => "ctools/context/ajax/configure/$mechanism/$type/$cache_key/$position/%step",
+ 'show cancel' => TRUE,
+ 'default form' => 'ctools_edit_context_form_defaults',
+ 'auto caching' => TRUE,
+ 'cache mechanism' => $mechanism,
+ 'cache key' => $cache_key,
+ // This is stating what the cache will be referred to in $form_state
+ 'cache storage' => 'object',
+ );
+
+ if ($type == 'requiredcontext') {
+ $form_info += array(
+ 'add form name' => 'required context add form',
+ 'edit form name' => 'required context edit form',
+ );
+ }
+
+ $output = ctools_plugin_configure_form($form_info, $form_state);
+
+ if (!empty($form_state['cancel'])) {
+ $output = array(ctools_modal_command_dismiss());
+ }
+ else if (!empty($form_state['complete'])) {
+ // successful submit
+ $ref[$position] = $conf;
+ if (isset($object->temporary)) {
+ unset($object->temporary);
+ }
+
+ ctools_cache_operation($mechanism, $cache_key, 'finalize', $object);
+
+ $output = array();
+ $output[] = ctools_modal_command_dismiss();
+
+ $arg_form = array(
+ '#post' => array(),
+ '#programmed' => FALSE,
+ '#tree' => FALSE,
+ );
+
+ // Build a chunk of the form to merge into the displayed form
+ $arg_form[$type] = array(
+ '#tree' => TRUE,
+ );
+ $arg_form[$type][$position] = array(
+ '#tree' => TRUE,
+ );
+
+ ctools_context_add_item_to_form($mechanism, $type, $cache_key, $arg_form[$type][$position], $position, $ref[$position]);
+ $arg_form = form_builder('ctools_context_form', $arg_form, $arg_form_state);
+
+ $theme_vars = array();
+ $theme_vars['type'] = $type;
+ $theme_vars['form'] = $arg_form[$type][$position];
+ $theme_vars['position'] = $position;
+ $theme_vars['count'] = $position;
+ $output[] = ajax_command_replace('#' . $type . '-row-' . $position, theme('ctools_context_item_row', $theme_vars));
+ $output[] = ajax_command_changed('#' . $type . '-row-' . $position, '.title');
+ }
+ else {
+ $output = ctools_modal_form_render($form_state, $output);
+ }
+ print ajax_render($output);
+ exit;
+}
+
+/**
+ * Get the defaults for a new instance of a context plugin.
+ *
+ * @param $plugin_definition
+ * The metadata definition of the plugin from ctools_get_plugins().
+ * @param $object
+ * The object the context plugin will be added to.
+ * @param $type
+ * The type of context plugin. i.e, context, requiredcontext, relationship
+ */
+function ctools_context_get_defaults($plugin_definition, $object, $type) {
+ // Fetch the potential id of the plugin so we can append
+ // title and keyword information for new ones.
+ $type_info = ctools_context_info($type);
+ $id = ctools_context_next_id($object->{$type_info['key']}, $plugin_definition['name']);
+
+ $conf = array(
+ 'identifier' => $plugin_definition['title'] . ($id > 1 ? ' ' . $id : ''),
+ 'keyword' => ctools_get_keyword($object, $plugin_definition['keyword']),
+ 'name' => $plugin_definition['name'],
+ );
+
+ if (isset($plugin_definition['defaults'])) {
+ $defaults = $plugin_definition['defaults'];
+ }
+ else if (isset($subtype['defaults'])) {
+ $defaults = $subtype['defaults'];
+ }
+
+ if (isset($defaults)) {
+ if (is_string($defaults) && function_exists($defaults)) {
+ if ($settings = $defaults($plugin_definition)) {
+ $conf += $settings;
+ }
+ }
+ else if (is_array($defaults)) {
+ $conf += $defaults;
+ }
+ }
+
+ return $conf;
+}
+
+/**
+ * Form wrapper for the edit context form.
+ *
+ * @todo: We should uncombine these.
+ */
+function ctools_edit_context_form_defaults($form, &$form_state) {
+ // Basic values required to orient ourselves
+ $object = $form_state['object'];
+ $plugin_definition = $form_state['plugin'];
+ $type_info = $form_state['type info'];
+ $contexts = $form_state['contexts'];
+ $conf = $form_state['conf'];
+
+ if ($type_info['key'] == 'arguments' && !isset($conf['default'])) {
+ $conf['default'] = 'ignore';
+ $conf['title'] = '';
+ }
+
+ $form['description'] = array(
+ '#prefix' => '<div class="description">',
+ '#suffix' => '</div>',
+ '#markup' => check_plain($plugin_definition['description']),
+ );
+
+ if ($type_info['key'] == 'relationships') {
+ $form['context'] = ctools_context_selector($contexts, $plugin_definition['required context'], isset($conf['context']) ? $conf['context'] : '');
+ }
+ if ($type_info['key'] == 'arguments') {
+ $form['default'] = array(
+ '#type' => 'select',
+ '#title' => t('Default'),
+ '#options' => array(
+ 'ignore' => t('Ignore it; content that requires this context will not be available.'),
+ '404' => t('Display page not found or display nothing at all.'),
+ ),
+ '#default_value' => $conf['default'],
+ '#description' => t('If the argument is missing or is not valid, select how this should behave.'),
+ );
+
+ $form['title'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Title'),
+ '#default_value' => $conf['title'],
+ '#description' => t('Enter a title to use when this argument is present. You may use %KEYWORD substitution, where the keyword is specified below.'),
+ );
+ }
+
+ $form['identifier'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Identifier'),
+ '#description' => t('Enter a name to identify this !type on administrative screens.', array('!type' => t('context'))),
+ '#default_value' => $conf['identifier'],
+ );
+
+ $form['keyword'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Keyword'),
+ '#description' => t('Enter a keyword to use for substitution in titles.'),
+ '#default_value' => $conf['keyword'],
+ );
+
+ $form['#submit'][] = 'ctools_edit_context_form_defaults_submit';
+
+ return $form;
+}
+
+/**
+ * Submit handler to store context identifier and keyword info.
+ */
+function ctools_edit_context_form_defaults_submit(&$form, &$form_state) {
+ if ($form_state['type info']['key'] == 'relationships') {
+ $form_state['conf']['context'] = $form_state['values']['context'];
+ }
+ if ($form_state['type info']['key'] == 'arguments') {
+ $form_state['conf']['default'] = $form_state['values']['default'];
+ $form_state['conf']['title'] = $form_state['values']['title'];
+ }
+
+ $form_state['conf']['identifier'] = $form_state['values']['identifier'];
+ $form_state['conf']['keyword'] = $form_state['values']['keyword'];
+}
+
+/**
+ * Ajax entry point to edit an item
+ */
+function ctools_context_ajax_item_delete($mechanism = NULL, $type = NULL, $cache_key = NULL, $position = NULL) {
+ ctools_include('ajax');
+ ctools_include('context');
+ ctools_include('cache');
+
+ if (!isset($position)) {
+ return ctools_ajax_render_error();
+ }
+
+ // Load stored object from cache.
+ if (!($object = ctools_cache_get($mechanism, $cache_key))) {
+ ctools_ajax_render_error(t('Invalid object name.'));
+ }
+
+ $type_info = ctools_context_info($type);
+
+ // Create a reference to the place our context lives. Since this is fairly
+ // generic, this is the easiest way to get right to the place of the
+ // object without knowing precisely what data we're poking at.
+ $ref = &$object->{$type_info['key']};
+
+ if (!array_key_exists($position, $ref)) {
+ ctools_ajax_render_error(t('Unable to delete missing item!'));
+ }
+
+ unset($ref[$position]);
+ ctools_cache_operation($mechanism, $cache_key, 'finalize', $object);
+
+ $output = array();
+ $output[] = ajax_command_replace('#' . $type . '-row-' . $position, '');
+ $output[] = ajax_command_restripe("#$type-table");
+ print ajax_render($output);
+ exit;
+}
+
+// --- End of contexts
+
+function ctools_save_context($type, &$ref, $form_values) {
+ $type_info = ctools_context_info($type);
+
+ // Organize arguments
+ $new = array();
+ $order = array();
+
+ foreach ($ref as $id => $context) {
+ $position = $form_values[$type][$id]['position'];
+ $order[$position] = $id;
+ }
+
+ ksort($order);
+ foreach ($order as $id) {
+ $new[] = $ref[$id];
+ }
+ $ref = $new;
+}
+
+function ctools_get_keyword($page, $word) {
+ // Create a complete set of keywords
+ $keywords = array();
+ foreach (array('arguments', 'relationships', 'contexts', 'requiredcontexts') as $type) {
+ if (!empty($page->$type) && is_array($page->$type)) {
+ foreach ($page->$type as $info) {
+ $keywords[$info['keyword']] = TRUE;
+ }
+ }
+ }
+
+ $keyword = $word;
+ $count = 1;
+ while (!empty($keywords[$keyword])) {
+ $keyword = $word . '_' . ++$count;
+ }
+ return $keyword;
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-task-handler.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-task-handler.inc
new file mode 100644
index 0000000..10fd793
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context-task-handler.inc
@@ -0,0 +1,534 @@
+<?php
+
+/**
+ * @file
+ * Support for creating 'context' type task handlers.
+ *
+ * Context task handlers expect the task to provide 0 or more contexts. The
+ * task handler should use those contexts as selection rules, as well as
+ * rendering with them.
+ *
+ * The functions and forms in this file should be common to every context type
+ * task handler made.
+ *
+ * Forms:
+ * - ...
+ */
+
+/**
+ * Render a context type task handler given a list of handlers
+ * attached to a type.
+ *
+ * @param $task
+ * The $task object in use.
+ * @param $subtask
+ * The id of the subtask in use.
+ * @param $contexts
+ * The context objects in use.
+ * @param $args
+ * The raw arguments behind the contexts.
+ * @param $page
+ * If TRUE then this renderer owns the page and can use theme('page')
+ * for no blocks; if false, output is returned regardless of any no
+ * blocks settings.
+ * @return
+ * Either the output or NULL if there was output, FALSE if no handler
+ * accepted the task. If $page is FALSE then the $info block is returned instead.
+ */
+function ctools_context_handler_render($task, $subtask, $contexts, $args) {
+ // Load the landlers, choosing only enabled handlers.
+ $handlers = page_manager_load_sorted_handlers($task, $subtask ? $subtask['name'] : '', TRUE);
+
+ $id = ctools_context_handler_get_render_handler($task, $subtask, $handlers, $contexts, $args);
+ if ($id) {
+ return ctools_context_handler_render_handler($task, $subtask, $handlers[$id], $contexts, $args);
+ }
+
+ return FALSE;
+}
+
+/**
+ * Figure out which of the listed handlers should be used to render.
+ */
+function ctools_context_handler_get_render_handler($task, $subtask, $handlers, $contexts, $args) {
+ // Try each handler.
+ foreach ($handlers as $id => $handler) {
+ $plugin = page_manager_get_task_handler($handler->handler);
+ // First, see if the handler has a tester.
+ $function = ctools_plugin_get_function($plugin, 'test');
+ if ($function) {
+ $test = $function($handler, $contexts, $args);
+ if ($test) {
+ return $id;
+ }
+ }
+ else {
+ // If not, if it's a 'context' type handler, use the default tester.
+ if ($plugin['handler type'] == 'context') {
+ $test = ctools_context_handler_default_test($handler, $contexts, $args);
+ if ($test) {
+ return $id;
+ }
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ * Default test function to see if a task handler should be rendered.
+ *
+ * This tests against the standard selection criteria that most task
+ * handlers should be implementing.
+ */
+function ctools_context_handler_default_test($handler, $base_contexts, $args) {
+ ctools_include('context');
+ // Add my contexts
+ $contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler);
+
+ // Test.
+ return ctools_context_handler_select($handler, $contexts);
+}
+
+/**
+ * Render a task handler.
+ */
+function ctools_context_handler_render_handler($task, $subtask, $handler, $contexts, $args, $page = TRUE) {
+ $function = page_manager_get_renderer($handler);
+ if (!$function) {
+ return NULL;
+ }
+
+ $info = $function($handler, $contexts, $args);
+ if (!$info) {
+ return NULL;
+ }
+
+ $context = array(
+ 'args' => $args,
+ 'contexts' => $contexts,
+ 'task' => $task,
+ 'subtask' => $subtask,
+ 'handler' => $handler
+ );
+ drupal_alter('ctools_render', $info, $page, $context);
+
+ // If we don't own the page, let the caller deal with rendering.
+ if (!$page) {
+ return $info;
+ }
+
+ if ($subtask) {
+ $task_name = page_manager_make_task_name($task['name'], $subtask['name']);
+ }
+ else {
+ $task_name = $task['name'];
+ }
+
+ page_manager_get_current_page(array(
+ 'name' => $task_name,
+ 'task' => $task,
+ 'subtask' => $subtask,
+ 'contexts' => $contexts,
+ 'arguments' => $args,
+ 'handler' => $handler,
+ ));
+
+ if (!empty($info['response code']) && $info['response code'] != 200) {
+ switch ($info['response code']) {
+ case 403:
+ return MENU_ACCESS_DENIED;
+ case 404:
+ return MENU_NOT_FOUND;
+ case 301:
+ case 302:
+ case 303:
+ case 304:
+ case 305:
+ case 307:
+ $info += array(
+ 'query' => array(),
+ 'fragment' => '',
+ );
+ $options = array(
+ 'query' => $info['query'],
+ 'fragment' => $info['fragment'],
+ );
+ return drupal_goto($info['destination'], $options, $info['response code']);
+ // @todo -- should other response codes be supported here?
+ }
+ }
+
+ $plugin = page_manager_get_task_handler($handler->handler);
+
+ if (module_exists('contextual') && user_access('access contextual links') && isset($handler->task)) {
+ // Provide a contextual link to edit this, if we can:
+ $callback = isset($plugin['contextual link']) ? $plugin['contextual link'] : 'ctools_task_handler_default_contextual_link';
+ if ($callback && function_exists($callback)) {
+ $links = $callback($handler, $plugin, $contexts, $args);
+ }
+
+ if (!empty($links) && is_array($links)) {
+ $build = array(
+ '#theme_wrappers' => array('container'),
+ '#attributes' => array('class' => array('contextual-links-region')),
+ );
+
+ if (!is_array($info['content'])) {
+ $build['content']['#markup'] = $info['content'];
+ }
+ else {
+ $build['content'] = $info['content'];
+ }
+
+ $build['contextual_links'] = 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')),
+ ),
+ );
+ $info['content'] = $build;
+ }
+ }
+
+ foreach (ctools_context_handler_get_task_arguments($task, $subtask) as $id => $argument) {
+ $plugin = ctools_get_argument($argument['name']);
+ $cid = ctools_context_id($argument, 'argument');
+ if (!empty($contexts[$cid]) && ($function = ctools_plugin_get_function($plugin, 'breadcrumb'))) {
+ $function($argument['settings'], $contexts[$cid]);
+ }
+ }
+
+ if (isset($info['title'])) {
+ drupal_set_title($info['title'], PASS_THROUGH);
+ }
+
+ // Only directly output if $page was set to true.
+ if (!empty($info['no_blocks'])) {
+ ctools_set_no_blocks(FALSE);
+ }
+ return $info['content'];
+}
+
+/**
+ * Default function to provide contextual link for a task as defined by the handler.
+ *
+ * This provides a simple link to th main content operation and is suitable
+ * for most normal handlers. Setting 'contextual link' to a function overrides
+ * this and setting it to FALSE will prevent a contextual link from appearing.
+ */
+function ctools_task_handler_default_contextual_link($handler, $plugin, $contexts, $args) {
+ if (!user_access('administer page manager')) {
+ return;
+ }
+
+ $task = page_manager_get_task($handler->task);
+
+ $title = !empty($task['tab title']) ? $task['tab title'] : t('Edit @type', array('@type' => $plugin['title']));
+ $trail = array();
+ if (!empty($plugin['tab operation'])) {
+ if (is_array($plugin['tab operation'])) {
+ $trail = $plugin['tab operation'];
+ }
+ else if (function_exists($plugin['tab operation'])) {
+ $trail = $plugin['tab operation']($handler, $contexts, $args);
+ }
+ }
+ $path = page_manager_edit_url(page_manager_make_task_name($handler->task, $handler->subtask), $trail);
+
+ $links = array(array(
+ 'href' => $path,
+ 'title' => $title,
+ 'query' => drupal_get_destination(),
+ ));
+
+ return $links;
+}
+
+/**
+ * Called to execute actions that should happen before a handler is rendered.
+ */
+function ctools_context_handler_pre_render($handler, $contexts, $args) { }
+
+/**
+ * Compare arguments to contexts for selection purposes.
+ *
+ * @param $handler
+ * The handler in question.
+ * @param $contexts
+ * The context objects provided by the task.
+ *
+ * @return
+ * TRUE if these contexts match the selection rules. NULL or FALSE
+ * otherwise.
+ */
+function ctools_context_handler_select($handler, $contexts) {
+ if (empty($handler->conf['access'])) {
+ return TRUE;
+ }
+
+ ctools_include('context');
+ return ctools_access($handler->conf['access'], $contexts);
+}
+
+/**
+ * Get the array of summary strings for the arguments.
+ *
+ * These summary strings are used to communicate to the user what
+ * arguments the task handlers are selecting.
+ *
+ * @param $task
+ * The loaded task plugin.
+ * @param $subtask
+ * The subtask id.
+ * @param $handler
+ * The handler to be checked.
+ */
+function ctools_context_handler_summary($task, $subtask, $handler) {
+ if (empty($handler->conf['access']['plugins'])) {
+ return array();
+ }
+
+ ctools_include('context');
+ $strings = array();
+ $contexts = ctools_context_handler_get_all_contexts($task, $subtask, $handler);
+
+ foreach ($handler->conf['access']['plugins'] as $test) {
+ $plugin = ctools_get_access_plugin($test['name']);
+ if ($string = ctools_access_summary($plugin, $contexts, $test)) {
+ $strings[] = $string;
+ }
+ }
+
+ return $strings;
+}
+
+// --------------------------------------------------------------------------
+// Tasks and Task handlers can both have their own sources of contexts.
+// Sometimes we need all of these contexts at once (when editing
+// the task handler, for example) but sometimes we need them separately
+// (when a task has contexts loaded and is trying out the task handlers,
+// for example). Therefore there are two paths we can take to getting contexts.
+
+/**
+ * Load the contexts for a task, using arguments.
+ *
+ * This creates the base array of contexts, loaded from arguments, suitable
+ * for use in rendering.
+ */
+function ctools_context_handler_get_task_contexts($task, $subtask, $args) {
+ $contexts = ctools_context_handler_get_base_contexts($task, $subtask);
+ $arguments = ctools_context_handler_get_task_arguments($task, $subtask);
+ ctools_context_get_context_from_arguments($arguments, $contexts, $args);
+
+ return $contexts;
+}
+
+/**
+ * Load the contexts for a task handler.
+ *
+ * This expands a base set of contexts passed in from a task with the
+ * contexts defined on the task handler. The contexts from the task
+ * must already have been loaded.
+ */
+function ctools_context_handler_get_handler_contexts($contexts, $handler) {
+ $object = ctools_context_handler_get_handler_object($handler);
+ return ctools_context_load_contexts($object, FALSE, $contexts);
+}
+
+/**
+ * Load the contexts for a task and task handler together.
+ *
+ * This pulls the arguments from a task and everything else from a task
+ * handler and loads them as a group. Since there is no data, this loads
+ * the contexts as placeholders.
+ */
+function ctools_context_handler_get_all_contexts($task, $subtask, $handler) {
+ $contexts = array();
+
+ $object = ctools_context_handler_get_task_object($task, $subtask, $handler);
+ $contexts = ctools_context_load_contexts($object, TRUE, $contexts);
+ ctools_context_handler_set_access_restrictions($task, $subtask, $handler, $contexts);
+ return $contexts;
+}
+
+/**
+ * Create an object suitable for use with the context system that kind of
+ * expects things in a certain, kind of clunky format.
+ */
+function ctools_context_handler_get_handler_object($handler) {
+ $object = new stdClass;
+ $object->name = $handler->name;
+ $object->contexts = isset($handler->conf['contexts']) ? $handler->conf['contexts'] : array();
+ $object->relationships = isset($handler->conf['relationships']) ? $handler->conf['relationships'] : array();
+
+ return $object;
+}
+
+/**
+ * Create an object suitable for use with the context system that kind of
+ * expects things in a certain, kind of clunky format. This one adds in
+ * arguments from the task.
+ */
+function ctools_context_handler_get_task_object($task, $subtask, $handler) {
+ $object = new stdClass;
+ $object->name = !empty($handler->name) ? $handler->name : 'temp';
+ $object->base_contexts = ctools_context_handler_get_base_contexts($task, $subtask, TRUE);
+ $object->arguments = ctools_context_handler_get_task_arguments($task, $subtask);
+ $object->contexts = isset($handler->conf['contexts']) ? $handler->conf['contexts'] : array();
+ $object->relationships = isset($handler->conf['relationships']) ? $handler->conf['relationships'] : array();
+
+ return $object;
+}
+
+/**
+ * Get base contexts from a task, if it has any.
+ *
+ * Tasks can get their contexts either from base contexts or arguments; base
+ * contexts extract their information from the environment.
+ */
+function ctools_context_handler_get_base_contexts($task, $subtask, $placeholders = FALSE) {
+ if ($function = ctools_plugin_get_function($task, 'get base contexts')) {
+ return $function($task, $subtask, $placeholders);
+ }
+
+ return array();
+}
+
+/**
+ * Get the arguments from a task that are used to load contexts.
+ */
+function ctools_context_handler_get_task_arguments($task, $subtask) {
+ if ($function = ctools_plugin_get_function($task, 'get arguments')) {
+ return $function($task, $subtask);
+ }
+
+ return array();
+}
+
+/**
+ * Set any access restrictions on the contexts for a handler.
+ *
+ * Both the task and the handler could add restrictions to the contexts
+ * based upon the access control. These restrictions might be useful
+ * to limit what kind of content appears in the add content dialog;
+ * for example, if we have an access item that limits a node context
+ * to only 'story' and 'page' types, there is no need for content that
+ * only applies to the 'poll' type to appear.
+ */
+function ctools_context_handler_set_access_restrictions($task, $subtask, $handler, &$contexts) {
+ // First, for the task:
+ if ($function = ctools_plugin_get_function($task, 'access restrictions')) {
+ $function($task, $subtask, $contexts);
+ }
+
+ // Then for the handler:
+ if (isset($handler->conf['access'])) {
+ ctools_access_add_restrictions($handler->conf['access'], $contexts);
+ }
+}
+
+/**
+ * Form to choose context based selection rules for a task handler.
+ *
+ * The configuration will be assumed to go simply in $handler->conf and
+ * will be keyed by the argument ID.
+ */
+function ctools_context_handler_edit_criteria($form, &$form_state) {
+ if (!isset($form_state['handler']->conf['access'])) {
+ $form_state['handler']->conf['access'] = array();
+ }
+
+ ctools_include('context');
+ ctools_include('modal');
+ ctools_include('ajax');
+ ctools_modal_add_plugin_js(ctools_get_access_plugins());
+ ctools_include('context-access-admin');
+ $form_state['module'] = 'page_manager_task_handler';
+ // Encode a bunch of info into the argument so we can get our cache later
+ $form_state['callback argument'] = $form_state['task_name'] . '*' . $form_state['handler']->name;
+ $form_state['access'] = $form_state['handler']->conf['access'];
+ $form_state['no buttons'] = TRUE;
+ $form_state['contexts'] = ctools_context_handler_get_all_contexts($form_state['task'], $form_state['subtask'], $form_state['handler']);
+
+ $form['markup'] = array(
+ '#markup' => '<div class="description">' .
+ t('If there is more than one variant on a page, when the page is visited each variant is given an opportunity to be displayed. Starting from the first variant and working to the last, each one tests to see if its selection rules will pass. The first variant that meets its criteria (as specified below) will be used.') .
+ '</div>',
+ );
+ $form = ctools_access_admin_form($form, $form_state);
+ return $form;
+}
+
+/**
+ * Submit handler for rules selection
+ */
+function ctools_context_handler_edit_criteria_submit(&$form, &$form_state) {
+ $form_state['handler']->conf['access']['logic'] = $form_state['values']['logic'];
+}
+
+/**
+ * Edit contexts that go with this panel.
+ */
+function ctools_context_handler_edit_context($form, &$form_state) {
+ ctools_include('context-admin');
+ ctools_context_admin_includes();
+
+ $handler = $form_state['handler'];
+ $page = $form_state['page'];
+ $cache_name = $handler->name ? $handler->name : 'temp';
+ if (isset($page->context_cache[$cache_name])) {
+ $cache = $page->context_cache[$cache_name];
+ }
+ else {
+ $cache = ctools_context_handler_get_task_object($form_state['task'], $form_state['subtask'], $form_state['handler']);
+ $form_state['page']->context_cache[$cache_name] = $cache;
+ }
+
+ $form['right'] = array(
+ '#prefix' => '<div class="clearfix"><div class="right-container">',
+ '#suffix' => '</div>',
+ );
+
+ $form['left'] = array(
+ '#prefix' => '<div class="left-container">',
+ '#suffix' => '</div></div>',
+ );
+
+ $module = 'page_manager_context::' . $page->task_name;
+ ctools_context_add_context_form($module, $form, $form_state, $form['right']['contexts_table'], $cache);
+ ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $cache);
+
+ $theme_vars = array();
+ $theme_vars['object'] = $cache;
+ $theme_vars['header'] = t('Summary of contexts');
+ $form['left']['summary'] = array(
+ '#prefix' => '<div class="page-manager-contexts">',
+ '#suffix' => '</div>',
+ '#markup' => theme('ctools_context_list', $theme_vars),
+ );
+
+ $form_state['context_object'] = &$cache;
+ return $form;
+}
+
+/**
+ * Process submission of the context edit form.
+ */
+function ctools_context_handler_edit_context_submit(&$form, &$form_state) {
+ $handler = &$form_state['handler'];
+
+ $cache_name = $handler->name ? $handler->name : 'temp';
+
+ $handler->conf['contexts'] = $form_state['context_object']->contexts;
+ $handler->conf['relationships'] = $form_state['context_object']->relationships;
+ if (isset($form_state['page']->context_cache[$cache_name])) {
+ unset($form_state['page']->context_cache[$cache_name]);
+ }
+}
+
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context.inc
new file mode 100644
index 0000000..720a6fc
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/includes/context.inc
@@ -0,0 +1,1583 @@
+<?php
+
+/**
+ * @file
+ *
+ * Contains code related to the ctools system of 'context'.
+ *
+ * Context, originally from Panels, is a method of packaging objects into
+ * a more generic bundle and providing a plugin system so that a UI can
+ * take advantage of them. The idea is that the context objects
+ * represent 'the context' that a given operation (usually a page view)
+ * is operating in or on.
+ *
+ * For example, when viewing a page, the 'context' is a node object. When
+ * viewing a user, the 'context' is a user object. Contexts can also
+ * have related contexts. For example, when viewing a 'node' you may need
+ * to know something about the node author. Therefore, the node author
+ * is a related context.
+ */
+
+/**
+ * The context object is largely a wrapper around some other object, with
+ * an interface to finding out what is contained and getting to both
+ * the object and information about the object.
+ *
+ * Each context object has its own information, but some things are very
+ * common, such as titles, data, keywords, etc. In particulare, the 'type'
+ * of the context is important.
+ */
+class ctools_context {
+ var $type = NULL;
+ var $data = NULL;
+ // The title of this object.
+ var $title = '';
+ // The title of the page if this object exists
+ var $page_title = '';
+ // The identifier (in the UI) of this object
+ var $identifier = '';
+ var $argument = NULL;
+ var $keyword = '';
+ var $original_argument = NULL;
+ var $restrictions = array();
+ var $empty = FALSE;
+
+ function ctools_context($type = 'none', $data = NULL) {
+ $this->type = $type;
+ $this->data = $data;
+ $this->title = t('Unknown context');
+ }
+
+ function is_type($type) {
+ if ($type == 'any' || $this->type == 'any') {
+ return TRUE;
+ }
+
+ $a = is_array($type) ? $type : array($type);
+ $b = is_array($this->type) ? $this->type : array($this->type);
+ return (bool) array_intersect($a, $b);
+ }
+
+ function get_argument() {
+ return $this->argument;
+ }
+
+ function get_original_argument() {
+ if (!is_null($this->original_argument)) {
+ return $this->original_argument;
+ }
+ return $this->argument;
+ }
+
+ function get_keyword() {
+ return $this->keyword;
+ }
+
+ function get_identifier() {
+ return $this->identifier;
+ }
+
+ function get_title() {
+ return $this->title;
+ }
+
+ function get_page_title() {
+ return $this->page_title;
+ }
+}
+
+/**
+ * Used to create a method of comparing if a list of contexts
+ * match a required context type.
+ */
+class ctools_context_required {
+ var $keywords = '';
+
+ /**
+ * If set, the title will be used in the selector to identify
+ * the context. This is very useful when multiple contexts
+ * are required to inform the user will be used for what.
+ */
+ var $title = NULL;
+
+ /**
+ * Test to see if this context is required.
+ */
+ var $required = TRUE;
+
+ /**
+ * If TRUE, skip the check in ctools_context_required::select()
+ * for contexts whose names may have changed.
+ */
+ var $skip_name_check = FALSE;
+
+ /**
+ *
+ * @param $title
+ * The first parameter should be the 'title' of the context for use
+ * in UYI selectors when multiple contexts qualify.
+ * @param ...
+ * One or more keywords to use for matching which contexts are allowed.
+ */
+ function ctools_context_required($title) {
+ $args = func_get_args();
+ $this->title = array_shift($args);
+
+ // If we have a boolean value at the end for $skip_name_check, store it
+ if (is_bool(end($args))) {
+ $this->skip_name_check = array_pop($args);
+ }
+
+ // If we were given restrictions at the end, store them.
+ if (count($args) > 1 && is_array(end($args))) {
+ $this->restrictions = array_pop($args);
+ }
+
+ if (count($args) == 1) {
+ $args = array_shift($args);
+ }
+ $this->keywords = $args;
+ }
+
+ function filter($contexts) {
+ $result = array();
+
+ // See which of these contexts are valid
+ foreach ((array) $contexts as $cid => $context) {
+ if ($context->is_type($this->keywords)) {
+ // Compare to see if our contexts were met.
+ if (!empty($this->restrictions) && !empty($context->restrictions)) {
+ foreach ($this->restrictions as $key => $values) {
+ // If we have a restriction, the context must either not have that
+ // restriction listed, which means we simply don't know what it is,
+ // or there must be an intersection of the restricted values on
+ // both sides.
+ if (!is_array($values)) {
+ $values = array($values);
+ }
+ if (!empty($context->restrictions[$key]) && !array_intersect($values, $context->restrictions[$key])) {
+ continue 2;
+ }
+ }
+ }
+ $result[$cid] = $context;
+ }
+ }
+
+ return $result;
+ }
+
+ function select($contexts, $context) {
+ if (!is_array($contexts)) {
+ $contexts = array($contexts);
+ }
+
+ // If we had requested a $context but that $context doesn't exist
+ // in our context list, there is a good chance that what happened
+ // is our context IDs changed. See if there's another context
+ // that satisfies our requirements.
+ if (!$this->skip_name_check && !empty($context) && !isset($contexts[$context])) {
+ $choices = $this->filter($contexts);
+
+ // If we got a hit, take the first one that matches.
+ if ($choices) {
+ $keys = array_keys($choices);
+ $context = reset($keys);
+ }
+ }
+
+ if (empty($context) || empty($contexts[$context])) {
+ return FALSE;
+ }
+ return $contexts[$context];
+ }
+}
+
+/**
+ * Used to compare to see if a list of contexts match an optional context. This
+ * can produce empty contexts to use as placeholders.
+ */
+class ctools_context_optional extends ctools_context_required {
+ var $required = FALSE;
+ function ctools_context_optional() {
+ $args = func_get_args();
+ call_user_func_array(array($this, 'ctools_context_required'), $args);
+ }
+
+ /**
+ * Add the 'empty' context which is possible for optional
+ */
+ function add_empty(&$contexts) {
+ $context = new ctools_context('any');
+ $context->title = t('No context');
+ $context->identifier = t('No context');
+ $contexts = array_merge(array('empty' => $context), $contexts);
+ }
+
+ function filter($contexts) {
+ $this->add_empty($contexts);
+ return parent::filter($contexts);
+ }
+
+ function select($contexts, $context) {
+ $this->add_empty($contexts);
+ if (empty($context)) {
+ return $contexts['empty'];
+ }
+
+ $result = parent::select($contexts, $context);
+
+ // Don't flip out if it can't find the context; this is optional, put
+ // in an empty.
+ if ($result == FALSE) {
+ $result = $contexts['empty'];
+ }
+ return $result;
+ }
+}
+
+/**
+ * Return a keyed array of context that match the given 'required context'
+ * filters.
+ *
+ * Functions or systems that require contexts of a particular type provide a
+ * ctools_context_required or ctools_context_optional object. This function
+ * examines that object and an array of contexts to determine which contexts
+ * match the filter.
+ *
+ * Since multiple contexts can be required, this function will accept either
+ * an array of all required contexts, or just a single required context object.
+ *
+ * @param $contexts
+ * A keyed array of all available contexts.
+ * @param $required
+ * A ctools_context_required or ctools_context_optional object, or an array
+ * of such objects.
+ *
+ * @return
+ * A keyed array of contexts that match the filter.
+ */
+function ctools_context_filter($contexts, $required) {
+ if (is_array($required)) {
+ $result = array();
+ foreach ($required as $r) {
+ $result = array_merge($result, _ctools_context_filter($contexts, $r));
+ }
+ return $result;
+ }
+
+ return _ctools_context_filter($contexts, $required);
+}
+
+function _ctools_context_filter($contexts, $required) {
+ $result = array();
+
+ if (is_object($required)) {
+ $result = $required->filter($contexts);
+ }
+
+ return $result;
+}
+
+/**
+ * Create a select box to choose possible contexts.
+ *
+ * This only creates a selector if there is actually a choice; if there
+ * is only one possible context, that one is silently assigned.
+ *
+ * If an array of required contexts is provided, one selector will be
+ * provided for each context.
+ *
+ * @param $contexts
+ * A keyed array of all available contexts.
+ * @param $required
+ * The required context object or array of objects.
+ *
+ * @return
+ * A form element, or NULL if there are no contexts that satisfy the
+ * requirements.
+ */
+function ctools_context_selector($contexts, $required, $default) {
+ if (is_array($required)) {
+ $result = array('#tree' => TRUE);
+ $count = 1;
+ foreach ($required as $id => $r) {
+ $result[] = _ctools_context_selector($contexts, $r, isset($default[$id]) ? $default[$id] : '', $count++);
+ }
+ return $result;
+ }
+
+ return _ctools_context_selector($contexts, $required, $default);
+}
+
+function _ctools_context_selector($contexts, $required, $default, $num = 0) {
+ $filtered = ctools_context_filter($contexts, $required);
+ $count = count($filtered);
+
+ $form = array();
+
+ if ($count >= 1) {
+ // If there's more than one to choose from, create a select widget.
+ foreach ($filtered as $cid => $context) {
+ $options[$cid] = $context->get_identifier();
+ }
+ if (!empty($required->title)) {
+ $title = $required->title;
+ }
+ else {
+ $title = $num ? t('Context %count', array('%count' => $num)) : t('Context');
+ }
+
+ return array(
+ '#type' => 'select',
+ '#options' => $options,
+ '#title' => $title,
+ '#default_value' => $default,
+ );
+ }
+}
+
+/**
+ * Are there enough contexts for a plugin?
+ *
+ * Some plugins can have a 'required contexts' item which can either
+ * be a context requirement object or an array of them. When contexts
+ * are required, items that do not have enough contexts should not
+ * appear. This tests an item to see if it has enough contexts
+ * to actually appear.
+ *
+ * @param $contexts
+ * A keyed array of all available contexts.
+ * @param $required
+ * The required context object or array of objects.
+ *
+ * @return
+ * TRUE if there are enough contexts, FALSE if there are not.
+ */
+function ctools_context_match_requirements($contexts, $required) {
+ if (!is_array($required)) {
+ $required = array($required);
+ }
+
+ // Get the keys to avoid bugs in PHP 5.0.8 with keys and loops.
+ // And use it to remove optional contexts.
+ $keys = array_keys($required);
+ foreach ($keys as $key) {
+ if (empty($required[$key]->required)) {
+ unset($required[$key]);
+ }
+ }
+
+ $count = count($required);
+ return (count(ctools_context_filter($contexts, $required)) >= $count);
+}
+
+/**
+ * Create a select box to choose possible contexts.
+ *
+ * This only creates a selector if there is actually a choice; if there
+ * is only one possible context, that one is silently assigned.
+ *
+ * If an array of required contexts is provided, one selector will be
+ * provided for each context.
+ *
+ * @param $contexts
+ * A keyed array of all available contexts.
+ * @param $required
+ * The required context object or array of objects.
+ *
+ * @return
+ * A form element, or NULL if there are no contexts that satisfy the
+ * requirements.
+ */
+function ctools_context_converter_selector($contexts, $required, $default) {
+ if (is_array($required)) {
+ $result = array('#tree' => TRUE);
+ $count = 1;
+ foreach ($required as $id => $r) {
+ $result[] = _ctools_context_converter_selector($contexts, $r, isset($default[$id]) ? $default[$id] : '', $count++);
+ }
+ return $result;
+ }
+
+ return _ctools_context_converter_selector($contexts, $required, $default);
+}
+
+function _ctools_context_converter_selector($contexts, $required, $default, $num = 0) {
+ $filtered = ctools_context_filter($contexts, $required);
+ $count = count($filtered);
+
+ $form = array();
+
+ if ($count > 1) {
+ // If there's more than one to choose from, create a select widget.
+ $options = array();
+ foreach ($filtered as $cid => $context) {
+ if ($context->type == 'any') {
+ $options[''] = t('No context');
+ continue;
+ }
+ $key = $context->get_identifier();
+ if ($converters = ctools_context_get_converters($cid . '.', $context)) {
+ $options[$key] = $converters;
+ }
+ }
+ if (empty($options)) {
+ return array(
+ '#type' => 'value',
+ '#value' => 'any',
+ );
+ }
+ if (!empty($required->title)) {
+ $title = $required->title;
+ }
+ else {
+ $title = $num ? t('Context %count', array('%count' => $num)) : t('Context');
+ }
+
+ return array(
+ '#type' => 'select',
+ '#options' => $options,
+ '#title' => $title,
+ '#description' => t('Please choose which context and how you would like it converted.'),
+ '#default_value' => $default,
+ );
+ }
+}
+
+/**
+ * Get a list of converters available for a given context.
+ */
+function ctools_context_get_converters($cid, $context) {
+ if (empty($context->plugin)) {
+ return array();
+ }
+
+ return _ctools_context_get_converters($cid, $context->plugin);
+}
+
+/**
+ * Get a list of converters available for a given context.
+ */
+function _ctools_context_get_converters($id, $plugin_name) {
+ $plugin = ctools_get_context($plugin_name);
+ if (empty($plugin['convert list'])) {
+ return array();
+ }
+
+ $converters = array();
+ if (is_array($plugin['convert list'])) {
+ $converters = $plugin['convert list'];
+ }
+ else if ($function = ctools_plugin_get_function($plugin, 'convert list')) {
+ $converters = (array) $function($plugin);
+ }
+
+ foreach (module_implements('ctools_context_convert_list_alter') as $module) {
+ $function = $module . '_ctools_context_convert_list_alter';
+ $function($plugin, $converters);
+ }
+
+ // Now, change them all to include the plugin:
+ $return = array();
+ foreach ($converters as $key => $title) {
+ $return[$id . $key] = $title;
+ }
+
+ natcasesort($return);
+ return $return;
+}
+
+/**
+ * Get a list of all contexts + converters available.
+ */
+function ctools_context_get_all_converters() {
+ $contexts = ctools_get_contexts();
+ $converters = array();
+ foreach ($contexts as $name => $context) {
+ if (empty($context['no required context ui'])) {
+ $context_converters = _ctools_context_get_converters($name . '.', $name);
+ if ($context_converters) {
+ $converters[$context['title']] = $context_converters;
+ }
+ }
+ }
+
+ return $converters;
+}
+
+/**
+ * Let the context convert an argument based upon the converter that was given.
+ */
+function ctools_context_convert_context($context, $converter, $converter_options = array()) {
+ // Contexts without plugins might be optional placeholders.
+ if (empty($context->plugin)) {
+ return;
+ }
+
+ $value = $context->argument;
+ $plugin = ctools_get_context($context->plugin);
+ if ($function = ctools_plugin_get_function($plugin, 'convert')) {
+ $value = $function($context, $converter, $converter_options);
+ }
+
+ foreach (module_implements('ctools_context_converter_alter') as $module) {
+ $function = $module . '_ctools_context_converter_alter';
+ $function($context, $converter, $value, $converter_options);
+ }
+
+ return $value;
+}
+
+/**
+ * Choose a context or contexts based upon the selection made via
+ * ctools_context_filter.
+ *
+ * @param $contexts
+ * A keyed array of all available contexts
+ * @param $required
+ * The required context object provided by the plugin
+ * @param $context
+ * The selection made using ctools_context_selector
+ */
+function ctools_context_select($contexts, $required, $context) {
+ if (is_array($required)) {
+ $result = array();
+ foreach ($required as $id => $r) {
+ if (empty($required[$id])) {
+ continue;
+ }
+
+ if (($result[] = _ctools_context_select($contexts, $r, $context[$id])) === FALSE) {
+ return FALSE;
+ }
+ }
+ return $result;
+ }
+
+ return _ctools_context_select($contexts, $required, $context);
+}
+
+function _ctools_context_select($contexts, $required, $context) {
+ if (!is_object($required)) {
+ return FALSE;
+ }
+
+ return $required->select($contexts, $context);
+}
+
+/**
+ * Create a new context object.
+ *
+ * @param $type
+ * The type of context to create; this loads a plugin.
+ * @param $data
+ * The data to put into the context.
+ * @param $empty
+ * Whether or not this context is specifically empty.
+ * @param $conf
+ * A configuration structure if this context was created via UI.
+ *
+ * @return
+ * A $context or NULL if one could not be created.
+ */
+function ctools_context_create($type, $data = NULL, $conf = FALSE) {
+ ctools_include('plugins');
+ $plugin = ctools_get_context($type);
+
+ if ($function = ctools_plugin_get_function($plugin, 'context')) {
+ return $function(FALSE, $data, $conf, $plugin);
+ }
+}
+
+/**
+ * Create an empty context object.
+ *
+ * Empty context objects are primarily used as placeholders in the UI where
+ * the actual contents of a context object may not be known. It may have
+ * additional text embedded to give the user clues as to how the context
+ * is used.
+ *
+ * @param $type
+ * The type of context to create; this loads a plugin.
+ *
+ * @return
+ * A $context or NULL if one could not be created.
+ */
+function ctools_context_create_empty($type) {
+ $plugin = ctools_get_context($type);
+ if ($function = ctools_plugin_get_function($plugin, 'context')) {
+ $context = $function(TRUE, NULL, FALSE, $plugin);
+ if (is_object($context)) {
+ $context->empty = TRUE;
+ }
+
+ return $context;
+ }
+}
+
+/**
+ * Perform keyword and context substitutions.
+ */
+function ctools_context_keyword_substitute($string, $keywords, $contexts, $converter_options = array()) {
+ // Ensure a default keyword exists:
+ $keywords['%%'] = '%';
+
+ // Match contexts to the base keywords:
+ $context_keywords = array();
+ foreach ($contexts as $context) {
+ if (isset($context->keyword)) {
+ $context_keywords[$context->keyword] = $context;
+ }
+ }
+
+ // Look for context matches we we only have to convert known matches.
+ $matches = array();
+ if (preg_match_all('/%([a-zA-Z0-9%:_-]+)/us', $string, $matches)) {
+ foreach ($matches[1] as $keyword) {
+ // Ignore anything it finds with %%.
+ if ($keyword[0] == '%') {
+ continue;
+ }
+
+ // If the keyword is already set by something passed in, don't try to
+ // overwrite it.
+ if (!empty($keywords['%' . $keyword])) {
+ continue;
+ }
+
+ // Figure out our keyword and converter, if specified.
+ if (strpos($keyword, ':')) {
+ list($context, $converter) = explode(':', $keyword, 2);
+ }
+ else {
+ $context = $keyword;
+ if (isset($context_keywords[$keyword])) {
+ $plugin = ctools_get_context($context_keywords[$context]->plugin);
+
+ // Fall back to a default converter, if specified.
+ if ($plugin && !empty($plugin['convert default'])) {
+ $converter = $plugin['convert default'];
+ }
+ }
+ }
+
+ if (empty($context_keywords[$context]) || !empty($context_keywords[$context]->empty)) {
+ $keywords['%' . $keyword] = '';
+ }
+ else if (!empty($converter)) {
+ $keywords['%' . $keyword] = ctools_context_convert_context($context_keywords[$context], $converter, $converter_options);
+ }
+ else {
+ $keywords['%' . $keyword] = $context_keywords[$keyword]->title;
+ }
+ }
+ }
+ return strtr($string, $keywords);
+}
+
+/**
+ * Determine a unique context ID for a context
+ *
+ * Often contexts of many different types will be placed into a list. This
+ * ensures that even though contexts of multiple types may share IDs, they
+ * are unique in the final list.
+ */
+function ctools_context_id($context, $type = 'context') {
+ if (!$context['id']) {
+ $context['id'] = 1;
+ }
+
+ return $type . '_' . $context['name'] . '_' . $context['id'];
+}
+
+/**
+ * Get the next id available given a list of already existing objects.
+ *
+ * This finds the next id available for the named object.
+ *
+ * @param $objects
+ * A list of context descriptor objects, i.e, arguments, relationships, contexts, etc.
+ * @param $name
+ * The name being used.
+ */
+function ctools_context_next_id($objects, $name) {
+ $id = 0;
+ // Figure out which instance of this argument we're creating
+ if (!$objects) {
+ return $id + 1;
+ }
+
+ foreach ($objects as $object) {
+ if (isset($object['name']) && $object['name'] == $name) {
+ if ($object['id'] > $id) {
+ $id = $object['id'];
+ }
+ }
+ }
+
+ return $id + 1;
+}
+
+
+// ---------------------------------------------------------------------------
+// Functions related to contexts from arguments.
+
+/**
+ * Fetch metadata on a specific argument plugin.
+ *
+ * @param $argument
+ * Name of an argument plugin.
+ *
+ * @return
+ * An array with information about the requested argument plugin.
+ */
+function ctools_get_argument($argument) {
+ ctools_include('plugins');
+ return ctools_get_plugins('ctools', 'arguments', $argument);
+}
+
+/**
+ * Fetch metadata for all argument plugins.
+ *
+ * @return
+ * An array of arrays with information about all available argument plugins.
+ */
+function ctools_get_arguments() {
+ ctools_include('plugins');
+ return ctools_get_plugins('ctools', 'arguments');
+}
+
+/**
+ * Get a context from an argument.
+ *
+ * @param $argument
+ * The configuration of an argument. It must contain the following data:
+ * - name: The name of the argument plugin being used.
+ * - argument_settings: The configuration based upon the plugin forms.
+ * - identifier: The human readable identifier for this argument, usually
+ * defined by the UI.
+ * - keyword: The keyword used for this argument for substitutions.
+ *
+ * @param $arg
+ * The actual argument received. This is expected to be a string from a URL but
+ * this does not have to be the only source of arguments.
+ * @param $empty
+ * If true, the $arg will not be used to load the context. Instead, an empty
+ * placeholder context will be loaded.
+ *
+ * @return
+ * A context object if one can be loaded.
+ */
+function ctools_context_get_context_from_argument($argument, $arg, $empty = FALSE) {
+ ctools_include('plugins');
+ if (empty($argument['name'])) {
+ return;
+ }
+
+ if ($function = ctools_plugin_load_function('ctools', 'arguments', $argument['name'], 'context')) {
+ // Backward compatibility: Merge old style settings into new style:
+ if (!empty($argument['settings'])) {
+ $argument += $argument['settings'];
+ unset($argument['settings']);
+ }
+
+ $context = $function($arg, $argument, $empty);
+
+ if (is_object($context)) {
+ $context->identifier = $argument['identifier'];
+ $context->page_title = isset($argument['title']) ? $argument['title'] : '';
+ $context->keyword = $argument['keyword'];
+ $context->id = ctools_context_id($argument, 'argument');
+ $context->original_argument = $arg;
+
+ if (!empty($context->empty)) {
+ $context->placeholder = array(
+ 'type' => 'argument',
+ 'conf' => $argument,
+ );
+ }
+ }
+ return $context;
+ }
+}
+
+/**
+ * Retrieve a list of empty contexts for all arguments.
+ */
+function ctools_context_get_placeholders_from_argument($arguments) {
+ $contexts = array();
+ foreach ($arguments as $argument) {
+ $context = ctools_context_get_context_from_argument($argument, NULL, TRUE);
+ if ($context) {
+ $contexts[ctools_context_id($argument, 'argument')] = $context;
+ }
+ }
+ return $contexts;
+}
+
+/**
+ * Load the contexts for a given list of arguments.
+ *
+ * @param $arguments
+ * The array of argument definitions.
+ * @param &$contexts
+ * The array of existing contexts. New contexts will be added to this array.
+ * @param $args
+ * The arguments to load.
+ *
+ * @return
+ * FALSE if an argument wants to 404.
+ */
+function ctools_context_get_context_from_arguments($arguments, &$contexts, $args) {
+ foreach ($arguments as $argument) {
+ // pull the argument off the list.
+ $arg = array_shift($args);
+ $id = ctools_context_id($argument, 'argument');
+
+ // For % arguments embedded in the URL, our context is already loaded.
+ // There is no need to go and load it again.
+ if (emp