summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--API.txt12
-rw-r--r--CHANGELOG.txt81
-rw-r--r--README.txt1
-rw-r--r--UPGRADE.txt63
-rw-r--r--bulk_export/bulk_export.css17
-rw-r--r--bulk_export/bulk_export.info5
-rw-r--r--bulk_export/bulk_export.module204
-rw-r--r--css/collapsible-div.css18
-rw-r--r--css/context.css10
-rw-r--r--css/ctools.css25
-rw-r--r--css/dropdown.css73
-rw-r--r--css/export-ui-list.css32
-rw-r--r--css/modal.css127
-rw-r--r--css/ruleset.css11
-rw-r--r--css/stylizer.css129
-rw-r--r--css/wizard.css8
-rw-r--r--ctools.api.php86
-rw-r--r--ctools.info7
-rw-r--r--ctools.install197
-rw-r--r--ctools.module782
-rw-r--r--ctools_access_ruleset/ctools_access_ruleset.info5
-rw-r--r--ctools_access_ruleset/ctools_access_ruleset.install82
-rw-r--r--ctools_access_ruleset/ctools_access_ruleset.module85
-rw-r--r--ctools_access_ruleset/plugins/access/ruleset.inc100
-rw-r--r--ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc29
-rw-r--r--ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php53
-rw-r--r--ctools_ajax_sample/css/ctools-ajax-sample.css134
-rw-r--r--ctools_ajax_sample/ctools_ajax_sample.info5
-rw-r--r--ctools_ajax_sample/ctools_ajax_sample.install19
-rw-r--r--ctools_ajax_sample/ctools_ajax_sample.module744
-rw-r--r--ctools_ajax_sample/images/ajax-loader.gifbin10819 -> 0 bytes
-rw-r--r--ctools_ajax_sample/images/loading-large.gifbin2545 -> 0 bytes
-rw-r--r--ctools_ajax_sample/images/loading.gifbin1849 -> 0 bytes
-rw-r--r--ctools_ajax_sample/images/popups-border.pngbin380 -> 0 bytes
-rw-r--r--ctools_ajax_sample/js/ctools-ajax-sample.js42
-rw-r--r--ctools_custom_content/ctools_custom_content.info5
-rw-r--r--ctools_custom_content/ctools_custom_content.install67
-rw-r--r--ctools_custom_content/ctools_custom_content.module98
-rw-r--r--ctools_custom_content/plugins/export_ui/ctools_custom_content.inc20
-rw-r--r--ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php122
-rw-r--r--ctools_plugin_example/README.txt14
-rw-r--r--ctools_plugin_example/ctools_plugin_example.info8
-rw-r--r--ctools_plugin_example/ctools_plugin_example.module94
-rw-r--r--ctools_plugin_example/ctools_plugin_example.pages_default.inc451
-rw-r--r--ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html17
-rw-r--r--ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html20
-rw-r--r--ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html19
-rw-r--r--ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html17
-rw-r--r--ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html21
-rw-r--r--ctools_plugin_example/help/Module-setup-and-hooks.html20
-rw-r--r--ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html18
-rw-r--r--ctools_plugin_example/help/ctools_plugin_example.help.ini42
-rw-r--r--ctools_plugin_example/plugins/access/arg_length.inc65
-rw-r--r--ctools_plugin_example/plugins/access/example_role.inc76
-rw-r--r--ctools_plugin_example/plugins/arguments/simplecontext_arg.inc52
-rw-r--r--ctools_plugin_example/plugins/content_types/icon_example.pngbin566 -> 0 bytes
-rw-r--r--ctools_plugin_example/plugins/content_types/no_context_content_type.inc116
-rw-r--r--ctools_plugin_example/plugins/content_types/relcontext_content_type.inc103
-rw-r--r--ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc129
-rw-r--r--ctools_plugin_example/plugins/contexts/relcontext.inc83
-rw-r--r--ctools_plugin_example/plugins/contexts/simplecontext.inc134
-rw-r--r--ctools_plugin_example/plugins/panels.pages.inc214
-rw-r--r--ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc50
-rw-r--r--help/about.html30
-rw-r--r--help/ajax.html0
-rw-r--r--help/context-access.html14
-rw-r--r--help/context-arguments.html19
-rw-r--r--help/context-content.html246
-rw-r--r--help/context-context.html12
-rw-r--r--help/context-relationships.html10
-rw-r--r--help/context.html0
-rw-r--r--help/ctools.help.ini93
-rw-r--r--help/export-ui.html84
-rw-r--r--help/export.html234
-rw-r--r--help/modal.html220
-rw-r--r--help/object-cache.html132
-rw-r--r--help/plugins-api.html54
-rw-r--r--help/plugins-creating.html189
-rw-r--r--help/plugins-implementing.html58
-rw-r--r--help/plugins.html5
-rw-r--r--help/wizard.html287
-rw-r--r--images/arrow-active.pngbin313 -> 0 bytes
-rw-r--r--images/collapsible-collapsed.pngbin108 -> 0 bytes
-rw-r--r--images/collapsible-expanded.pngbin106 -> 0 bytes
-rw-r--r--images/expanded-options.pngbin228 -> 0 bytes
-rw-r--r--images/icon-close-window.pngbin877 -> 0 bytes
-rw-r--r--images/icon-configure.pngbin765 -> 0 bytes
-rw-r--r--images/icon-delete.pngbin877 -> 0 bytes
-rw-r--r--images/no-icon.pngbin574 -> 0 bytes
-rw-r--r--images/status-active.gifbin2196 -> 0 bytes
-rw-r--r--images/throbber.gifbin3208 -> 0 bytes
-rw-r--r--includes/ajax.inc125
-rw-r--r--includes/cache.inc169
-rw-r--r--includes/cache.plugin-type.inc11
-rw-r--r--includes/cleanstring.inc205
-rw-r--r--includes/collapsible.theme.inc79
-rw-r--r--includes/content.inc773
-rw-r--r--includes/content.menu.inc72
-rw-r--r--includes/content.plugin-type.inc17
-rw-r--r--includes/content.theme.inc21
-rw-r--r--includes/context-access-admin.inc486
-rw-r--r--includes/context-admin.inc782
-rw-r--r--includes/context-task-handler.inc486
-rw-r--r--includes/context.inc1542
-rw-r--r--includes/context.menu.inc39
-rw-r--r--includes/context.plugin-type.inc24
-rw-r--r--includes/context.theme.inc344
-rw-r--r--includes/css.inc562
-rw-r--r--includes/dependent.inc154
-rw-r--r--includes/dropdown.theme.inc87
-rw-r--r--includes/export-ui.inc466
-rw-r--r--includes/export-ui.menu.inc24
-rw-r--r--includes/export-ui.plugin-type.inc20
-rw-r--r--includes/export.inc1015
-rw-r--r--includes/fields.inc102
-rw-r--r--includes/jump-menu.inc120
-rw-r--r--includes/math-expr.inc385
-rw-r--r--includes/menu.inc98
-rw-r--r--includes/modal.inc249
-rw-r--r--includes/object-cache.cron.inc16
-rw-r--r--includes/object-cache.inc174
-rw-r--r--includes/page-wizard.inc194
-rw-r--r--includes/page-wizard.menu.inc32
-rw-r--r--includes/plugins-admin.inc196
-rw-r--r--includes/plugins.inc880
-rw-r--r--includes/registry.inc77
-rw-r--r--includes/stylizer.inc1655
-rw-r--r--includes/stylizer.theme.inc28
-rw-r--r--includes/utility.inc44
-rw-r--r--includes/wizard.inc515
-rw-r--r--includes/wizard.theme.inc25
-rw-r--r--js/ajax-responder.js122
-rw-r--r--js/auto-submit.js74
-rw-r--r--js/collapsible-div.js240
-rw-r--r--js/dependent.js215
-rw-r--r--js/dropdown.js87
-rw-r--r--js/jump-menu.js34
-rw-r--r--js/modal.js494
-rw-r--r--js/stylizer.js219
-rw-r--r--page_manager/css/page-manager.css341
-rw-r--r--page_manager/help/about.html11
-rw-r--r--page_manager/help/api-task-handler.html43
-rw-r--r--page_manager/help/api-task-type.html2
-rw-r--r--page_manager/help/api-task.html38
-rw-r--r--page_manager/help/custom-pages-access.html2
-rw-r--r--page_manager/help/custom-pages-arguments.html2
-rw-r--r--page_manager/help/custom-pages-menu.html2
-rw-r--r--page_manager/help/custom-pages.html2
-rw-r--r--page_manager/help/getting-started-create.html2
-rw-r--r--page_manager/help/getting-started-custom-nodes.html2
-rw-r--r--page_manager/help/getting-started-custom-vocabulary.html2
-rw-r--r--page_manager/help/getting-started-members.html2
-rw-r--r--page_manager/help/getting-started-page-list.html2
-rw-r--r--page_manager/help/getting-started.html15
-rw-r--r--page_manager/help/page-task-type.html4
-rw-r--r--page_manager/help/page_manager.help.ini59
-rw-r--r--page_manager/help/variants.html2
-rw-r--r--page_manager/images/arrow-active.pngbin313 -> 0 bytes
-rw-r--r--page_manager/images/locked-other.pngbin262 -> 0 bytes
-rw-r--r--page_manager/images/locked.pngbin273 -> 0 bytes
-rw-r--r--page_manager/js/page-list.js44
-rw-r--r--page_manager/page_manager.admin.inc1849
-rw-r--r--page_manager/page_manager.info5
-rw-r--r--page_manager/page_manager.install202
-rw-r--r--page_manager/page_manager.module1177
-rw-r--r--page_manager/plugins/cache/page_manager_context.inc70
-rw-r--r--page_manager/plugins/task_handlers/http_response.inc286
-rw-r--r--page_manager/plugins/tasks/blog.inc104
-rw-r--r--page_manager/plugins/tasks/blog_user.inc134
-rw-r--r--page_manager/plugins/tasks/contact_site.inc104
-rw-r--r--page_manager/plugins/tasks/contact_user.inc133
-rw-r--r--page_manager/plugins/tasks/node_edit.inc167
-rw-r--r--page_manager/plugins/tasks/node_view.inc143
-rw-r--r--page_manager/plugins/tasks/page.admin.inc1517
-rw-r--r--page_manager/plugins/tasks/page.inc770
-rw-r--r--page_manager/plugins/tasks/poll.inc104
-rw-r--r--page_manager/plugins/tasks/search.inc292
-rw-r--r--page_manager/plugins/tasks/term_view.inc293
-rw-r--r--page_manager/plugins/tasks/user_view.inc131
-rw-r--r--page_manager/theme/page-manager-edit-page.tpl.php53
-rw-r--r--page_manager/theme/page_manager.theme.inc118
-rw-r--r--plugins/access/compare_users.inc70
-rw-r--r--plugins/access/context_exists.inc51
-rw-r--r--plugins/access/node.inc0
-rw-r--r--plugins/access/node_access.inc89
-rw-r--r--plugins/access/node_language.inc114
-rw-r--r--plugins/access/node_type.inc100
-rw-r--r--plugins/access/path_visibility.inc88
-rw-r--r--plugins/access/perm.inc73
-rw-r--r--plugins/access/php.inc64
-rw-r--r--plugins/access/role.inc79
-rw-r--r--plugins/access/site_language.inc87
-rw-r--r--plugins/access/string_equal.inc94
-rw-r--r--plugins/access/string_length.inc78
-rw-r--r--plugins/access/term.inc152
-rw-r--r--plugins/access/term_parent.inc86
-rw-r--r--plugins/access/term_vocabulary.inc87
-rw-r--r--plugins/access/theme.inc70
-rw-r--r--plugins/arguments/entity_id.inc66
-rw-r--r--plugins/arguments/nid.inc49
-rw-r--r--plugins/arguments/node_add.inc32
-rw-r--r--plugins/arguments/node_edit.inc51
-rw-r--r--plugins/arguments/rid.inc50
-rw-r--r--plugins/arguments/string.inc64
-rw-r--r--plugins/arguments/term.inc147
-rw-r--r--plugins/arguments/terms.inc77
-rw-r--r--plugins/arguments/uid.inc52
-rw-r--r--plugins/arguments/user_name.inc47
-rw-r--r--plugins/arguments/vid.inc45
-rw-r--r--plugins/cache/export_ui.inc39
-rw-r--r--plugins/cache/simple.inc45
-rw-r--r--plugins/content_types/block/block.inc415
-rw-r--r--plugins/content_types/block/icon_contrib_block.pngbin574 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_contrib_block_empty.pngbin450 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_contrib_menu.pngbin552 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_contrib_page.pngbin460 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_activeforumtopics.pngbin603 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_authorinformation.pngbin606 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_block.pngbin568 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_block_empty.pngbin450 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_block_menu.pngbin552 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_booknavigation.pngbin626 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_languageswitcher.pngbin601 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_navigation.pngbin818 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_newforumtopics.pngbin604 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_page.pngbin460 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_popularcontent.pngbin604 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_primarylinks.pngbin892 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_recentblogposts.pngbin681 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_recentcomments.pngbin662 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_recentpoll.pngbin608 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_searchform.pngbin717 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_syndicate.pngbin803 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_userlogin.pngbin601 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_whosnew.pngbin732 -> 0 bytes
-rw-r--r--plugins/content_types/block/icon_core_whosonline.pngbin744 -> 0 bytes
-rw-r--r--plugins/content_types/contact/contact.inc60
-rw-r--r--plugins/content_types/contact/icon_contact.pngbin606 -> 0 bytes
-rw-r--r--plugins/content_types/contact/user_contact.inc65
-rw-r--r--plugins/content_types/custom/custom.inc407
-rw-r--r--plugins/content_types/custom/icon_block_custom.pngbin522 -> 0 bytes
-rw-r--r--plugins/content_types/entity_context/entity_field.inc170
-rw-r--r--plugins/content_types/form/form.inc56
-rw-r--r--plugins/content_types/form/icon_form.pngbin460 -> 0 bytes
-rw-r--r--plugins/content_types/node/icon_node.pngbin460 -> 0 bytes
-rw-r--r--plugins/content_types/node/node.inc242
-rw-r--r--plugins/content_types/node_context/icon_node.pngbin460 -> 0 bytes
-rw-r--r--plugins/content_types/node_context/node_attachments.inc44
-rw-r--r--plugins/content_types/node_context/node_author.inc71
-rw-r--r--plugins/content_types/node_context/node_body.inc60
-rw-r--r--plugins/content_types/node_context/node_book_children.inc43
-rw-r--r--plugins/content_types/node_context/node_book_nav.inc43
-rw-r--r--plugins/content_types/node_context/node_comment_form.inc96
-rw-r--r--plugins/content_types/node_context/node_comments.inc129
-rw-r--r--plugins/content_types/node_context/node_content.inc203
-rw-r--r--plugins/content_types/node_context/node_created.inc74
-rw-r--r--plugins/content_types/node_context/node_links.inc105
-rw-r--r--plugins/content_types/node_context/node_terms.inc187
-rw-r--r--plugins/content_types/node_context/node_title.inc73
-rw-r--r--plugins/content_types/node_context/node_type_desc.inc47
-rw-r--r--plugins/content_types/node_context/node_updated.inc74
-rw-r--r--plugins/content_types/node_form/icon_node_form.pngbin460 -> 0 bytes
-rw-r--r--plugins/content_types/node_form/node_form_attachments.inc45
-rw-r--r--plugins/content_types/node_form/node_form_author.inc45
-rw-r--r--plugins/content_types/node_form/node_form_book.inc49
-rw-r--r--plugins/content_types/node_form/node_form_buttons.inc42
-rw-r--r--plugins/content_types/node_form/node_form_comment.inc45
-rw-r--r--plugins/content_types/node_form/node_form_input_format.inc43
-rw-r--r--plugins/content_types/node_form/node_form_log.inc32
-rw-r--r--plugins/content_types/node_form/node_form_menu.inc46
-rw-r--r--plugins/content_types/node_form/node_form_path.inc46
-rw-r--r--plugins/content_types/node_form/node_form_publishing.inc49
-rw-r--r--plugins/content_types/node_form/node_form_taxonomy.inc45
-rw-r--r--plugins/content_types/page/page_breadcrumb.inc32
-rw-r--r--plugins/content_types/page/page_feed_icons.inc32
-rw-r--r--plugins/content_types/page/page_help.inc33
-rw-r--r--plugins/content_types/page/page_logo.inc36
-rw-r--r--plugins/content_types/page/page_messages.inc33
-rw-r--r--plugins/content_types/page/page_primary_links.inc32
-rw-r--r--plugins/content_types/page/page_secondary_links.inc32
-rw-r--r--plugins/content_types/page/page_site_name.inc32
-rw-r--r--plugins/content_types/page/page_slogan.inc32
-rw-r--r--plugins/content_types/page/page_tabs.inc70
-rw-r--r--plugins/content_types/page/page_title.inc118
-rw-r--r--plugins/content_types/search/icon_search.pngbin717 -> 0 bytes
-rw-r--r--plugins/content_types/search/search_form.inc170
-rw-r--r--plugins/content_types/search/search_result.inc202
-rw-r--r--plugins/content_types/term_context/icon_term.pngbin460 -> 0 bytes
-rw-r--r--plugins/content_types/term_context/term_description.inc50
-rw-r--r--plugins/content_types/term_context/term_list.inc118
-rw-r--r--plugins/content_types/user_context/icon_user.pngbin606 -> 0 bytes
-rw-r--r--plugins/content_types/user_context/profile_fields.inc129
-rw-r--r--plugins/content_types/user_context/profile_fields_pane.tpl.php16
-rw-r--r--plugins/content_types/user_context/user_picture.inc41
-rw-r--r--plugins/content_types/user_context/user_profile.inc65
-rw-r--r--plugins/content_types/user_context/user_signature.inc39
-rw-r--r--plugins/content_types/vocabulary_context/icon_vocabulary.pngbin460 -> 0 bytes
-rw-r--r--plugins/content_types/vocabulary_context/vocabulary_terms.inc93
-rw-r--r--plugins/contexts/entity.inc252
-rw-r--r--plugins/contexts/node.inc178
-rw-r--r--plugins/contexts/node_add_form.inc117
-rw-r--r--plugins/contexts/node_edit_form.inc183
-rw-r--r--plugins/contexts/string.inc64
-rw-r--r--plugins/contexts/term.inc164
-rw-r--r--plugins/contexts/terms.inc97
-rw-r--r--plugins/contexts/token.inc61
-rw-r--r--plugins/contexts/user.inc168
-rw-r--r--plugins/contexts/vocabulary.inc68
-rw-r--r--plugins/export_ui/ctools_export_ui.class.php1448
-rw-r--r--plugins/export_ui/ctools_export_ui.inc24
-rw-r--r--plugins/relationships/book_parent.inc66
-rw-r--r--plugins/relationships/entity_from_field.inc94
-rw-r--r--plugins/relationships/entity_from_schema.inc89
-rw-r--r--plugins/relationships/node_edit_form_from_node.inc31
-rw-r--r--plugins/relationships/term_from_node.inc60
-rw-r--r--plugins/relationships/term_parent.inc68
-rw-r--r--plugins/relationships/terms_from_node.inc76
-rw-r--r--plugins/relationships/user_from_node.inc37
-rw-r--r--stylizer/plugins/export_ui/stylizer.inc45
-rw-r--r--stylizer/plugins/export_ui/stylizer_ui.class.php270
-rw-r--r--stylizer/stylizer.info6
-rw-r--r--stylizer/stylizer.install64
-rw-r--r--stylizer/stylizer.module135
-rw-r--r--tests/css.test69
-rw-r--r--tests/ctools.plugins.test100
-rw-r--r--tests/ctools_plugin_test.info8
-rw-r--r--tests/ctools_plugin_test.module72
-rw-r--r--tests/object_cache.test46
-rw-r--r--tests/plugins/cached/ctoolsCachedPluginArray.class.php7
-rw-r--r--tests/plugins/cached/ctoolsCachedPluginArray2.class.php7
-rw-r--r--tests/plugins/cached/plugin_array.inc20
-rw-r--r--tests/plugins/cached/plugin_array2.inc20
-rw-r--r--tests/plugins/cached/plugin_array_dne.inc15
-rw-r--r--tests/plugins/not_cached/ctoolsNotCachedPluginArray.class.php7
-rw-r--r--tests/plugins/not_cached/ctoolsNotCachedPluginArray2.class.php7
-rw-r--r--tests/plugins/not_cached/plugin_array.inc20
-rw-r--r--tests/plugins/not_cached/plugin_array2.inc20
-rw-r--r--tests/plugins/not_cached/plugin_array_dne.inc15
-rw-r--r--views_content/plugins/content_types/icon_views_block_legacy.pngbin599 -> 0 bytes
-rw-r--r--views_content/plugins/content_types/icon_views_page.pngbin716 -> 0 bytes
-rw-r--r--views_content/plugins/content_types/icon_views_page_legacy.pngbin587 -> 0 bytes
-rw-r--r--views_content/plugins/content_types/views.inc566
-rw-r--r--views_content/plugins/content_types/views_attachments.inc75
-rw-r--r--views_content/plugins/content_types/views_empty.inc52
-rw-r--r--views_content/plugins/content_types/views_exposed.inc52
-rw-r--r--views_content/plugins/content_types/views_feed.inc52
-rw-r--r--views_content/plugins/content_types/views_footer.inc52
-rw-r--r--views_content/plugins/content_types/views_header.inc52
-rw-r--r--views_content/plugins/content_types/views_pager.inc52
-rw-r--r--views_content/plugins/content_types/views_panes.inc614
-rw-r--r--views_content/plugins/content_types/views_row.inc189
-rw-r--r--views_content/plugins/contexts/view.inc134
-rw-r--r--views_content/plugins/relationships/node_from_view.inc64
-rw-r--r--views_content/plugins/relationships/term_from_view.inc64
-rw-r--r--views_content/plugins/relationships/user_from_view.inc64
-rw-r--r--views_content/plugins/views/views_content.views.inc58
-rw-r--r--views_content/plugins/views/views_content_plugin_display_ctools_context.inc155
-rw-r--r--views_content/plugins/views/views_content_plugin_display_panel_pane.inc403
-rw-r--r--views_content/plugins/views/views_content_plugin_style_ctools_context.inc57
-rw-r--r--views_content/views_content.admin.inc0
-rw-r--r--views_content/views_content.info10
-rw-r--r--views_content/views_content.module184
362 files changed, 1 insertions, 42903 deletions
diff --git a/API.txt b/API.txt
deleted file mode 100644
index f443e0d..0000000
--- a/API.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-API.txt: $Id$
-
-This file contains a log of changes to the API.
-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.
-
-Versions prior to 2.0 have been removed from this document. See the D6 version
-for that information.
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
deleted file mode 100644
index d14e621..0000000
--- a/CHANGELOG.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-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.
-
-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/README.txt b/README.txt
new file mode 100644
index 0000000..494c729
--- /dev/null
+++ b/README.txt
@@ -0,0 +1 @@
+The master branch is not used. See version branches.
diff --git a/UPGRADE.txt b/UPGRADE.txt
deleted file mode 100644
index 844ecce..0000000
--- a/UPGRADE.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-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/bulk_export/bulk_export.css b/bulk_export/bulk_export.css
deleted file mode 100644
index 41b0592..0000000
--- a/bulk_export/bulk_export.css
+++ /dev/null
@@ -1,17 +0,0 @@
-
-div.export-container {
- width: 48%;
- float: left;
- padding: .5em;
-}
-
-div.export-container table {
- width: 100%;
-}
-
-div.export-container table input,
-div.export-container table th,
-div.export-container table td {
- padding: 0 0 0 .5em;
- margin: 0;
-} \ No newline at end of file
diff --git a/bulk_export/bulk_export.info b/bulk_export/bulk_export.info
deleted file mode 100644
index 62077dc..0000000
--- a/bulk_export/bulk_export.info
+++ /dev/null
@@ -1,5 +0,0 @@
-name = Bulk Export
-description = Performs bulk exporting of data objects known about by Chaos tools.
-core = 7.x
-dependencies[] = ctools
-package = Chaos tool suite
diff --git a/bulk_export/bulk_export.module b/bulk_export/bulk_export.module
deleted file mode 100644
index 4804d91..0000000
--- a/bulk_export/bulk_export.module
+++ /dev/null
@@ -1,204 +0,0 @@
-<?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.
- */
-function bulk_export_export() {
- ctools_include('export');
- $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,
- );
- $output = drupal_build_form('bulk_export_export_form', $form_state);
- if (!empty($form_state['submitted'])) {
- drupal_set_title(t('Bulk export results'));
- $output = '';
- $module_code = '';
- $api_code = '';
- $dependencies = array();
- foreach ($form_state['code'] as $module => $api_info) {
- if ($module == 'general') {
- $module_code .= $api_info;
- }
- else {
- foreach ($api_info as $api => $info) {
- $api_code .= " if (\$module == '$module' && \$api == '$api') {\n";
- $api_code .= " return array('version' => $info[version]);\n";
- $api_code .= " }\n";
- $dependencies[$module] = TRUE;
-
- $file = $form_state['module'] . '.' . $api . '.inc';
- $code = "<?php\n";
- $code .= "// \$Id" . ": $\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'];
- $output .= drupal_render(drupal_get_form('ctools_export_form', $code, t('Place this in @file', array('@file' => $file))));
- }
- }
- }
-
- // Add hook_ctools_plugin_api at the top of the module code, if there is any.
- if ($api_code) {
- $api = "/**\n";
- $api .= " * Implements hook_ctools_plugin_api().\n";
- $api .= " */\n";
- $api .= "function $form_state[module]_ctools_plugin_api(\$module, \$api) {\n";
- $api .= $api_code;
- $api .= "}\n";
- $module_code = $api . $module_code;
- }
-
- if ($module_code) {
- $module = "<?php\n";
- $module .= "// \$Id" . ": $\n\n";
- $module .= "/**\n";
- $module .= " * @file\n";
- $module .= " * Bulk export of objects generated by Bulk export module.\n";
- $module .= " */\n\n";
- $module .= $module_code;
- $output = drupal_render(drupal_get_form('ctools_export_form', $module, t('Place this in @file', array('@file' => $form_state['module'] . '.module')))) . $output;
- }
-
- $info = "; \$Id" . ": $\n"; // The break in the string prevents CVS from subbing the ID.
- $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";
- $info .= "files[] = " . check_plain($form_state['module'] . '.info') . "\n";
- $output = drupal_render(drupal_get_form('ctools_export_form', $info, t('Place this in @file', array('@file' => $form_state['module'] . '.info')))) . $output;
-
- }
-
- 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) {
- $form['tables'] = array(
- '#prefix' => '<div class="clearfix">',
- '#suffix' => '</div>',
- '#tree' => TRUE,
- );
-
- $files = system_rebuild_module_data();
-
- $options = array();
- foreach ($form_state['exportables'] as $table => $list) {
- if (empty($list)) {
- continue;
- }
-
- foreach ($list as $id => $title) {
- $options[$table][$id] = array($title);
- }
-
- $module = $form_state['export_tables'][$table];
- $header = array("{$files[$module]->info['name']}: $table");
-
- $form['tables'][$table] = array(
- '#prefix' => '<div class="export-container">',
- '#suffix' => '</div>',
- '#type' => 'tableselect',
- '#header' => $header,
- '#options' => $options[$table],
- );
- }
-
- $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';
- 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'];
-
- foreach ($form_state['values']['tables'] as $table => $names) {
- $names = array_keys(array_filter($names));
- if ($names) {
- natcasesort($names);
- ctools_export_to_hook_code($code, $table, $names, $name);
- }
- }
-
- $form_state['code'] = $code;
- $form_state['module'] = $name;
-}
diff --git a/css/collapsible-div.css b/css/collapsible-div.css
deleted file mode 100644
index 91e7876..0000000
--- a/css/collapsible-div.css
+++ /dev/null
@@ -1,18 +0,0 @@
-
-.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 {
- cursor: pointer;
-}
-
-.ctools-collapsible-container .ctools-toggle-collapsed {
- background-image: url(../images/collapsible-collapsed.png);
-}
diff --git a/css/context.css b/css/context.css
deleted file mode 100644
index 5093104..0000000
--- a/css/context.css
+++ /dev/null
@@ -1,10 +0,0 @@
-.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/css/ctools.css b/css/ctools.css
deleted file mode 100644
index 7372988..0000000
--- a/css/ctools.css
+++ /dev/null
@@ -1,25 +0,0 @@
-.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/css/dropdown.css b/css/dropdown.css
deleted file mode 100644
index bb50f3f..0000000
--- a/css/dropdown.css
+++ /dev/null
@@ -1,73 +0,0 @@
-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/css/export-ui-list.css b/css/export-ui-list.css
deleted file mode 100644
index 8f7ef5e..0000000
--- a/css/export-ui-list.css
+++ /dev/null
@@ -1,32 +0,0 @@
-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 */
-}
diff --git a/css/modal.css b/css/modal.css
deleted file mode 100644
index c81a0f2..0000000
--- a/css/modal.css
+++ /dev/null
@@ -1,127 +0,0 @@
-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;
- float: right;
-}
-
-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;
-}
-
-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/css/ruleset.css b/css/ruleset.css
deleted file mode 100644
index 891455f..0000000
--- a/css/ruleset.css
+++ /dev/null
@@ -1,11 +0,0 @@
-.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/css/stylizer.css b/css/stylizer.css
deleted file mode 100644
index a16ec78..0000000
--- a/css/stylizer.css
+++ /dev/null
@@ -1,129 +0,0 @@
-
-/* 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/css/wizard.css b/css/wizard.css
deleted file mode 100644
index d42a2db..0000000
--- a/css/wizard.css
+++ /dev/null
@@ -1,8 +0,0 @@
-
-.wizard-trail {
- font-size: 120%;
-}
-
-.wizard-trail-current {
- font-weight: bold;
-}
diff --git a/ctools.api.php b/ctools.api.php
deleted file mode 100644
index 93efd6f..0000000
--- a/ctools.api.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?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
- * @{
- */
-
-/**
- * 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).
-}
-
-/**
- * @} End of "addtogroup hooks".
- */ \ No newline at end of file
diff --git a/ctools.info b/ctools.info
deleted file mode 100644
index b2c54ad..0000000
--- a/ctools.info
+++ /dev/null
@@ -1,7 +0,0 @@
-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
diff --git a/ctools.install b/ctools.install
deleted file mode 100644
index e4447db..0000000
--- a/ctools.install
+++ /dev/null
@@ -1,197 +0,0 @@
-<?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();
- drupal_install_modules(array('views_content'));
- }
-}
-
-/**
- * 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.
- drupal_install_modules(array('ctools_custom_content'));
- }
-
- return $ret;
-}
-
-
diff --git a/ctools.module b/ctools.module
deleted file mode 100644
index b6e6e2c..0000000
--- a/ctools.module
+++ /dev/null
@@ -1,782 +0,0 @@
-<?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-alpha1');
-
-/**
- * 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') {
- $dir = '/' . ($dir ? $dir . '/' : '');
- form_load_include($form_state, 'inc', $module, $dir . $file);
-}
-
-/**
- * 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.
- */
-function ctools_get_roles() {
- static $roles = NULL;
- if (!isset($roles)) {
- $roles = user_roles(TRUE);
- unset($roles[DRUPAL_AUTHENTICATED_RID]);
- }
-
- return $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) {
- $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($items, 'theme');
- return $items;
-}
-
-/**
- * Implements hook_menu().
- */
-function ctools_menu() {
- ctools_include('utility');
- $items = array();
- _ctools_passthrough($items, 'menu');
- return $items;
-}
-
-/**
- * Implementation of hook_cron. Clean up old caches.
- */
-function ctools_cron() {
- ctools_include('utility');
- _ctools_passthrough($items, 'cron');
-}
-
-/**
- * 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 (variable_get('cron_semaphore', FALSE)) {
- return;
- }
-
- ctools_include('css');
- ctools_css_flush_caches();
-}
-
-/**
- * Provide a search form with a different id so that form_alters will miss it
- * and thus not get advanced search settings.
- */
-function ctools_forms() {
- $forms['ctools_search_form']= array(
- 'callback' => 'search_form',
- );
-
- return $forms;
-}
-
-/**
- * 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($items, 'plugin-type');
-
- 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 'panel_identifier' attribute of the node is added when the pane is
- // rendered.
- if (!empty($vars['node']->panel_identifier)) {
- $vars['panel_identifier'] = check_plain($vars['node']->panel_identifier);
- $vars['template_files'][] = 'node-panel-' . check_plain($vars['node']->panel_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);
-
- if ($plugin) {
- // Get the load callback.
- $item = ctools_export_crud_load($plugin['schema'], $item_name);
- return empty($item) ? FALSE : $item;
- }
- }
-
- 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 (substr_compare($block->region, 'sidebar', 0)) {
- 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();
-}
diff --git a/ctools_access_ruleset/ctools_access_ruleset.info b/ctools_access_ruleset/ctools_access_ruleset.info
deleted file mode 100644
index 4d1d994..0000000
--- a/ctools_access_ruleset/ctools_access_ruleset.info
+++ /dev/null
@@ -1,5 +0,0 @@
-name = Custom rulesets
-description = Create custom, exportable, reusable access rulesets for applications like Panels.
-core = 7.x
-package = Chaos tool suite
-dependencies[] = ctools
diff --git a/ctools_access_ruleset/ctools_access_ruleset.install b/ctools_access_ruleset/ctools_access_ruleset.install
deleted file mode 100644
index b1613d8..0000000
--- a/ctools_access_ruleset/ctools_access_ruleset.install
+++ /dev/null
@@ -1,82 +0,0 @@
-<?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/ctools_access_ruleset/ctools_access_ruleset.module b/ctools_access_ruleset/ctools_access_ruleset.module
deleted file mode 100644
index fb39f37..0000000
--- a/ctools_access_ruleset/ctools_access_ruleset.module
+++ /dev/null
@@ -1,85 +0,0 @@
-<?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/ctools_access_ruleset/plugins/access/ruleset.inc b/ctools_access_ruleset/plugins/access/ruleset.inc
deleted file mode 100644
index fc8615e..0000000
--- a/ctools_access_ruleset/plugins/access/ruleset.inc
+++ /dev/null
@@ -1,100 +0,0 @@
-<?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) {
- $form['markup'] = array(
- '#value' => '<div class="description">' . check_plain($form_state['plugin']['ruleset']->admin_description) . '</div>',
- );
-}
-
-/**
- * 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) {
- return check_plain($plugin['ruleset']->admin_description);
-}
-
diff --git a/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc b/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc
deleted file mode 100644
index d2a1c60..0000000
--- a/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php b/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php
deleted file mode 100644
index b181464..0000000
--- a/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?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/ctools_ajax_sample/css/ctools-ajax-sample.css b/ctools_ajax_sample/css/ctools-ajax-sample.css
deleted file mode 100644
index dc83b0b..0000000
--- a/ctools_ajax_sample/css/ctools-ajax-sample.css
+++ /dev/null
@@ -1,134 +0,0 @@
-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;
-}
-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;
- height:10px;
-}
-div.ctools-sample-modal-content td.popups-tr { background-position: 0px -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; }
-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; }
-
-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/ctools_ajax_sample/ctools_ajax_sample.info b/ctools_ajax_sample/ctools_ajax_sample.info
deleted file mode 100644
index 1361f4f..0000000
--- a/ctools_ajax_sample/ctools_ajax_sample.info
+++ /dev/null
@@ -1,5 +0,0 @@
-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
diff --git a/ctools_ajax_sample/ctools_ajax_sample.install b/ctools_ajax_sample/ctools_ajax_sample.install
deleted file mode 100644
index 04325db..0000000
--- a/ctools_ajax_sample/ctools_ajax_sample.install
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-/**
- * @file
- */
-
-/**
- * Implementation of hook_install()
- */
-function ctools_ajax_sample_install() {
-
-}
-
-/**
- * Implementation of hook_uninstall()
- */
-function ctools_ajax_sample_uninstall() {
-
-}
diff --git a/ctools_ajax_sample/ctools_ajax_sample.module b/ctools_ajax_sample/ctools_ajax_sample.module
deleted file mode 100644
index de77e7f..0000000
--- a/ctools_ajax_sample/ctools_ajax_sample.module
+++ /dev/null
@@ -1,744 +0,0 @@
-<?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/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.
- $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($output)) {
- // empty $output signifies success, so we'll use it as our $commands
- // array.
- $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');
- $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 = ctools_jump_menu(array(), 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',
- '#attributes' => array('class' => array('ctools-ajax-sample-button-url')),
- '#value' => '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/ctools_ajax_sample/images/ajax-loader.gif b/ctools_ajax_sample/images/ajax-loader.gif
deleted file mode 100644
index d84f653..0000000
--- a/ctools_ajax_sample/images/ajax-loader.gif
+++ /dev/null
Binary files differ
diff --git a/ctools_ajax_sample/images/loading-large.gif b/ctools_ajax_sample/images/loading-large.gif
deleted file mode 100644
index 1c72ebb..0000000
--- a/ctools_ajax_sample/images/loading-large.gif
+++ /dev/null
Binary files differ
diff --git a/ctools_ajax_sample/images/loading.gif b/ctools_ajax_sample/images/loading.gif
deleted file mode 100644
index dc21df1..0000000
--- a/ctools_ajax_sample/images/loading.gif
+++ /dev/null
Binary files differ
diff --git a/ctools_ajax_sample/images/popups-border.png b/ctools_ajax_sample/images/popups-border.png
deleted file mode 100644
index ba939f8..0000000
--- a/ctools_ajax_sample/images/popups-border.png
+++ /dev/null
Binary files differ
diff --git a/ctools_ajax_sample/js/ctools-ajax-sample.js b/ctools_ajax_sample/js/ctools-ajax-sample.js
deleted file mode 100644
index 0273bc1..0000000
--- a/ctools_ajax_sample/js/ctools-ajax-sample.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
-* 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/ctools_custom_content/ctools_custom_content.info b/ctools_custom_content/ctools_custom_content.info
deleted file mode 100644
index a3f6665..0000000
--- a/ctools_custom_content/ctools_custom_content.info
+++ /dev/null
@@ -1,5 +0,0 @@
-name = Custom content panes
-description = Create custom, exportable, reusable content panes for applications like Panels.
-core = 7.x
-package = Chaos tool suite
-dependencies[] = ctools
diff --git a/ctools_custom_content/ctools_custom_content.install b/ctools_custom_content/ctools_custom_content.install
deleted file mode 100644
index 8348434..0000000
--- a/ctools_custom_content/ctools_custom_content.install
+++ /dev/null
@@ -1,67 +0,0 @@
-<?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/ctools_custom_content/ctools_custom_content.module b/ctools_custom_content/ctools_custom_content.module
deleted file mode 100644
index a2e8ee2..0000000
--- a/ctools_custom_content/ctools_custom_content.module
+++ /dev/null
@@ -1,98 +0,0 @@
-<?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/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc b/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc
deleted file mode 100644
index 467dc58..0000000
--- a/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php b/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php
deleted file mode 100644
index ea522d3..0000000
--- a/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-
-class ctools_custom_content_ui extends ctools_export_ui {
-
- function edit_form(&$form, &$form_state) {
- 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;
- }
-
- $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' => theme('links', array('links' => $operations)), '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/ctools_plugin_example/README.txt b/ctools_plugin_example/README.txt
deleted file mode 100644
index 42edcdc..0000000
--- a/ctools_plugin_example/README.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-
-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/ctools_plugin_example/ctools_plugin_example.info b/ctools_plugin_example/ctools_plugin_example.info
deleted file mode 100644
index d710125..0000000
--- a/ctools_plugin_example/ctools_plugin_example.info
+++ /dev/null
@@ -1,8 +0,0 @@
-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
diff --git a/ctools_plugin_example/ctools_plugin_example.module b/ctools_plugin_example/ctools_plugin_example.module
deleted file mode 100644
index 442969d..0000000
--- a/ctools_plugin_example/ctools_plugin_example.module
+++ /dev/null
@@ -1,94 +0,0 @@
-<?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/ctools_plugin_example/ctools_plugin_example.pages_default.inc b/ctools_plugin_example/ctools_plugin_example.pages_default.inc
deleted file mode 100644
index 10a7619..0000000
--- a/ctools_plugin_example/ctools_plugin_example.pages_default.inc
+++ /dev/null
@@ -1,451 +0,0 @@
-<?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/ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html b/ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html
deleted file mode 100644
index 781260e..0000000
--- a/ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<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/ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html b/ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html
deleted file mode 100644
index 4dd569d..0000000
--- a/ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<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/ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html b/ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html
deleted file mode 100644
index 7576c80..0000000
--- a/ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<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/ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html b/ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html
deleted file mode 100644
index 918a13c..0000000
--- a/ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<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/ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html b/ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html
deleted file mode 100644
index e8efbb3..0000000
--- a/ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<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/ctools_plugin_example/help/Module-setup-and-hooks.html b/ctools_plugin_example/help/Module-setup-and-hooks.html
deleted file mode 100644
index f816917..0000000
--- a/ctools_plugin_example/help/Module-setup-and-hooks.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<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/ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html b/ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html
deleted file mode 100644
index 7691245..0000000
--- a/ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<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/ctools_plugin_example/help/ctools_plugin_example.help.ini b/ctools_plugin_example/help/ctools_plugin_example.help.ini
deleted file mode 100644
index 6fb3d4c..0000000
--- a/ctools_plugin_example/help/ctools_plugin_example.help.ini
+++ /dev/null
@@ -1,42 +0,0 @@
-[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/ctools_plugin_example/plugins/access/arg_length.inc b/ctools_plugin_example/plugins/access/arg_length.inc
deleted file mode 100644
index 2a09eea..0000000
--- a/ctools_plugin_example/plugins/access/arg_length.inc
+++ /dev/null
@@ -1,65 +0,0 @@
-<?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/ctools_plugin_example/plugins/access/example_role.inc b/ctools_plugin_example/plugins/access/example_role.inc
deleted file mode 100644
index bbe364c..0000000
--- a/ctools_plugin_example/plugins/access/example_role.inc
+++ /dev/null
@@ -1,76 +0,0 @@
-<?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/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc b/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc
deleted file mode 100644
index 51c7c60..0000000
--- a/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc
+++ /dev/null
@@ -1,52 +0,0 @@
-<?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/ctools_plugin_example/plugins/content_types/icon_example.png b/ctools_plugin_example/plugins/content_types/icon_example.png
deleted file mode 100644
index 58c6bee..0000000
--- a/ctools_plugin_example/plugins/content_types/icon_example.png
+++ /dev/null
Binary files differ
diff --git a/ctools_plugin_example/plugins/content_types/no_context_content_type.inc b/ctools_plugin_example/plugins/content_types/no_context_content_type.inc
deleted file mode 100644
index 28d749b..0000000
--- a/ctools_plugin_example/plugins/content_types/no_context_content_type.inc
+++ /dev/null
@@ -1,116 +0,0 @@
-<?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];
- }
-} \ No newline at end of file
diff --git a/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc b/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc
deleted file mode 100644
index b0742e0..0000000
--- a/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc
+++ /dev/null
@@ -1,103 +0,0 @@
-<?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 blcok
- *
- * @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/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc b/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc
deleted file mode 100644
index 82291d0..0000000
--- a/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc
+++ /dev/null
@@ -1,129 +0,0 @@
-<?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];
- }
- }
-} \ No newline at end of file
diff --git a/ctools_plugin_example/plugins/contexts/relcontext.inc b/ctools_plugin_example/plugins/contexts/relcontext.inc
deleted file mode 100644
index 0c7ef11..0000000
--- a/ctools_plugin_example/plugins/contexts/relcontext.inc
+++ /dev/null
@@ -1,83 +0,0 @@
-<?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/ctools_plugin_example/plugins/contexts/simplecontext.inc b/ctools_plugin_example/plugins/contexts/simplecontext.inc
deleted file mode 100644
index e19a842..0000000
--- a/ctools_plugin_example/plugins/contexts/simplecontext.inc
+++ /dev/null
@@ -1,134 +0,0 @@
-<?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/ctools_plugin_example/plugins/panels.pages.inc b/ctools_plugin_example/plugins/panels.pages.inc
deleted file mode 100644
index d3022af..0000000
--- a/ctools_plugin_example/plugins/panels.pages.inc
+++ /dev/null
@@ -1,214 +0,0 @@
-<?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/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc b/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc
deleted file mode 100644
index 6224621..0000000
--- a/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc
+++ /dev/null
@@ -1,50 +0,0 @@
-<?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/help/about.html b/help/about.html
deleted file mode 100644
index 39493ff..0000000
--- a/help/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-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 ot 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!
-
-<h3>Tools provided by CTools</h3>
-<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 functionaly they offer can differ wildly.
-
-<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.
-
-<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 that 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 object can be exported into a piece of PHP code so that it can be moved from site to site or out of the database entirely. This library abstracts that so that 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' which 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> \ No newline at end of file
diff --git a/help/ajax.html b/help/ajax.html
deleted file mode 100644
index e69de29..0000000
--- a/help/ajax.html
+++ /dev/null
diff --git a/help/context-access.html b/help/context-access.html
deleted file mode 100644
index ef2ddbf..0000000
--- a/help/context-access.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-access plugins allow context based access control to pages.
-
-
- '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
-
-warning: Your settings array will be stored IN THE MENU SYSTEM to reduce loads, so be TRIM. \ No newline at end of file
diff --git a/help/context-arguments.html b/help/context-arguments.html
deleted file mode 100644
index f19f597..0000000
--- a/help/context-arguments.html
+++ /dev/null
@@ -1,19 +0,0 @@
-
-Arguments create a context from external input, which is assumed to be a
-string as though it came from a URL element.
-
- '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
diff --git a/help/context-content.html b/help/context-content.html
deleted file mode 100644
index 7c18d51..0000000
--- a/help/context-content.html
+++ /dev/null
@@ -1,246 +0,0 @@
-<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>
-
-<h3>Rendered content</h3>
-
-<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>
-
-<h3>Todo: example</h3>
-
-<p>Todo after implementations are updated to new version.</p>
diff --git a/help/context-context.html b/help/context-context.html
deleted file mode 100644
index 23a9631..0000000
--- a/help/context-context.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-Context plugin data:
-
- '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.
diff --git a/help/context-relationships.html b/help/context-relationships.html
deleted file mode 100644
index 547f891..0000000
--- a/help/context-relationships.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
- '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.
diff --git a/help/context.html b/help/context.html
deleted file mode 100644
index e69de29..0000000
--- a/help/context.html
+++ /dev/null
diff --git a/help/ctools.help.ini b/help/ctools.help.ini
deleted file mode 100644
index a3f2075..0000000
--- a/help/ctools.help.ini
+++ /dev/null
@@ -1,93 +0,0 @@
-[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
-
-[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/help/export-ui.html b/help/export-ui.html
deleted file mode 100644
index d291ce4..0000000
--- a/help/export-ui.html
+++ /dev/null
@@ -1,84 +0,0 @@
-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:
-
-<pre>
-function HOOK_ctools_plugin_directory($module, $plugin) {
- if ($module == 'ctools' && $plugin == 'export_ui') {
- return 'plugins/' . $plugin;
- }
-}
-</pre>
-
-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:
-
-<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>
-
-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.
-
-<h3>More advanced UIs</h3>
-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:
-
-<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>
-
-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.
diff --git a/help/export.html b/help/export.html
deleted file mode 100644
index bd5367d..0000000
--- a/help/export.html
+++ /dev/null
@@ -1,234 +0,0 @@
-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.
-
-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.
-
-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.
-
-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.
-
-<h3>Making your objects exportable</h3>
-To make your objects exportable, you do have to do a medium amount of work.
-<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>
-<h3>The export section of the schema file</h3>
-
-Exportable objects are created by adding definition to the schema in an 'export' section. For example:
-
-<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>Objects should contain a primary key which is a database identifier primarily used to determine if an object has been written or not. This is required for the default CRUD save callback to work.</dd>
-
-<dt>object</dt>
-<dd>The class the object should be created as. Defaults as stdClass.</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>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>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>
-</dl>
-
-<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 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>
-
-In addition, each field can contain the following:
-<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>
-
-<h3>Reserved keys on exportable objects</h3>
-
-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.
-<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>
-</dd>
-</dl>
-
-<h3>The load callback</h3>
-Calling ctools_export_crud_load($table, $name) will invoke your load 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.
-
-Typically, there will be two load functions. A 'single' load, to load just one object, 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.
-
-<pre>
-/**
-* Load a single myobj.
-*/
-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];
- }
-}
-</pre>
-
-<h3>The save callback</h3>
-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>
-
-<h3>Default hooks for your exports</h3>
-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.
diff --git a/help/modal.html b/help/modal.html
deleted file mode 100644
index 7fc3440..0000000
--- a/help/modal.html
+++ /dev/null
@@ -1,220 +0,0 @@
-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.
-
-<h3>Invoking the modal</h3>
-
-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:
-
-<pre>
-ctools_include('modal');
-ctools_modal_add_js();
-</pre>
-
-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:
-
-<pre>
-/**
- * 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');
-}
-</pre>
-
-Like with all CTools' AJAX functionality, the href of the link will be the destination, with any appearance of /nojs/ converted to /ajax/.
-
-
-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.
-
-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.
-
-<h3>Customizing the modal</h3>
-
-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.
-
-First, you need to create a settings array. You can do this most easily with a bit of PHP:
-
-<pre>
- drupal_add_js(array(
- 'my-modal-style' => array(
- 'modalSize' => array(
- 'type' => 'fixed',
- 'width' => 250,
- 'height' => 250,
- ),
- ),
- ), 'setting');
-</pre>
-
-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.
-
-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).
-
-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.
-
-You can set:
-<ul>
-<li> <b>modalSize</b>: an array of data to control the sizing of the modal. It can contain:
-<ul>
-<li> <b>type</b>: Either <i>fixed</i> or <i>scale</i>. If fixed, the modal will always be a fixed size. If <i>scale</i> the modal will scale to a percentage of the browser window. <i>Default: scale</i>.
-<li> <b>width</b>: If <i>fixed</i> the width in pixels. If <i>scale</i> the percentage of the screen expressed as a number less than zero. (For 80 percent, use .8, for example). <i>Default: .8</i></li>
-<li> <b>height</b>: If <i>fixed</i> the height in pixels. If <i>scale</i> the percentage of the screen expressed as a number less than zero. (For 80 percent, use .8, for example). <i>Default: .8</i></li>
-<li> <b>addWidth</b>: Any additional width to add to the modal in pixels. Only useful if the type is scale. <i>Default: 0</i></li>
-<li> <b>addHeight</b>: Any additional height to add to the modal in pixels. Only useful if the type is scale. <i>Default: 0</i></li>
-<li> <b>contentRight</b>: The number of pixels to remove from the content inside the modal to make room for scroll bar and decorations. <i>Default: 25</i></li>
-<li> <b>contentBottom</b>: The number of pixels to remove from the content inside the modal to make room for scroll bar and decorations. <i>Default: 45</i></li>
-</ul>
-</li>
-<li> <b>modalTheme</b>: The Drupal javascript themable function which controls how the modal will be rendered. This function must be in the <i>Drupal.theme.prototype</i> 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. <i>Default: CToolsModalDialog</i>
-<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> <b>throbberTheme</b>: The Drupal javascript themable function which controls how the modal throbber will be rendered. This function must be in the <i>Drupal.theme.prototype</i> 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. <i>Default: CToolsModalThrobber</i>
-<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> <b>modalOptions</b>: 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 <b>opacity</b> and <b>background</b>. <i>Default: array('opacity' => .55, 'background' => '#fff');</i></li>
-<li> <b>animation</b>: Controls how the modal is animated when it is first drawn. Either <b>show</b>, <b>fadeIn</b> or <b>slideDown</b>. <i>Default: show</i></li>
-<li> <b>animationSpeed</b>: 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. <i>Defaults: fast</i></li>
-<li><b>closeText</b>: The text to display for the close button. Be sure to wrap this in t() for translatability. <i>Default: t('Close window')</i></li>
-<li><b>closeImage</b>: The image to use for the close button of the modal. <i>Default: theme('image', array('path' => ctools_image_path('icon-close-window.png'), 'alt' => t('Close window'), 'title' => t('Close window')))</i></li>
-<li><b>loadingText</b>: The text to display for the modal title during loading, along with the throbber. Be sure to wrap this in t() for translatability. <i>Default: t('Close window')</i></li>
-<li><b>throbber</b>: 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. <i>Default: theme('image', array('path' => ctools_image_path('throbber.gif'), 'alt' => t('Loading...'), 'title' => t('Loading')))</i></li>
-<li>
-</ul>
-
-<h3>Rendering within the modal</h3>
-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.
-
-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.
-
-In your hook_menu, you can use the a CTools' AJAX convenience loader to help:
-
-<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>
-
-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:
-
-<pre>
-function ctools_ajax_sample_login($js) {
- if ($js) {
- // react with the modal
- }
- else {
- // react without the modal
- }
-}
-</pre>
-
-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:
-
-<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>
-
-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.
-
-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:
-
-<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 there is form output to be rendered.
- // 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 (empty($output) && $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>
-
-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.
diff --git a/help/object-cache.html b/help/object-cache.html
deleted file mode 100644
index 9648170..0000000
--- a/help/object-cache.html
+++ /dev/null
@@ -1,132 +0,0 @@
-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.
-
-The object cache consists of 3 normal functions for cache maintenance, and 2 additional functions to facilitate locking.
-
-To use any of these functions, you must first use ctools_include:
-
-<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 32 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 32 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 32 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>
-
-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:
-
-<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 32 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>
-
-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.
-
-To allow the concept of breaking a lock, that is, clearing another users changes:
-
-<pre>
-/**
- * Remove an object from the non-volatile ctools cache for all session IDs.
- *
- * This is useful for clearing a lock.
- *
- * @param $obj
- * A 32 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>
-
-Typical best practice is to use wrapper functions such as these:
-
-<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/help/plugins-api.html b/help/plugins-api.html
deleted file mode 100644
index 47e5d6b..0000000
--- a/help/plugins-api.html
+++ /dev/null
@@ -1,54 +0,0 @@
-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.
-
-Modules support this API by implementing hook_ctools_plugin_api($module, $api). If they support the API, they return a packet of data:
-<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>
-
-This implementation must be in the .module file.
-
-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:
-
-<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>
-
-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:
-
-<pre>
-mymodule_include_api();
-module_invoke('myhook', $data);
-</pre>
-
-If you need to pass references, this construct is standard:
-
-<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>
-
-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.
diff --git a/help/plugins-creating.html b/help/plugins-creating.html
deleted file mode 100644
index 77f0315..0000000
--- a/help/plugins-creating.html
+++ /dev/null
@@ -1,189 +0,0 @@
-There are two primary pieces to using plugins. The first is getting the data, and the second is using the data.
-
-<h3>Getting the data</h3>
-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>
-
-As a plugin creator, your module can also implement a hook to give more information about this plugin, and to enable a few features that are not normally enabled. If you need any of these features, simply implement hook_ctools_plugin_TYPE (where TYPE is the same $type sent to ctools_get_plugins). This isn't a true hook, it will only be called for the $module that was given. This hook returns an array:
-
-<pre>
-/**
- * Inform CTools that the layout plugin can be loaded from themes.
- */
-function panels_ctools_plugin_layouts() {
- return array(
- 'load themes' => TRUE,
- );
-}
-</pre>
-
-The following information can be specified:
-<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.
-
-<h3>Using the data</h3>
-
-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>
-
-Any of the above items can be overridden by the plugin itself, though the most likely one to be modified is the 'path'.
-
-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.
-
-<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>
-
-The second does not require the full $plugin object, and will load it:
-<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>
-
-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:
-
-<pre>
- 'callback_name' => 'actual_name_of_function_here',
-</pre>
-
-Or like this:
-<pre>
- 'callback_name' => array(
- 'file' => 'filename',
- 'path' => 'filepath', // optional, will use plugin path if absent
- 'function' => 'actual_name_of_function_here',
- ),
-</pre>
-
-An example, for 'plugin_example' type
-
-<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>
-
-To utilize this callback on this plugin:
-
-<pre>
-if ($function = ctools_plugin_get_function($plugin, 'example_callback')) {
- $function($arg1, $arg2, $etc);
-}
-</pre>
-
-<h3>Document your plugins!</h3>
-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.
-
diff --git a/help/plugins-implementing.html b/help/plugins-implementing.html
deleted file mode 100644
index 0ea1269..0000000
--- a/help/plugins-implementing.html
+++ /dev/null
@@ -1,58 +0,0 @@
-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.
-
-<h3>Telling it where your plugins live</h3>
-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.
-
-<pre>
-function hook_ctools_plugin_directory($module, $plugin) {
- if ($module == 'panels' && $plugin == 'content_types') {
- return 'plugins/content_types';
- }
-}
-</pre>
-
-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):
-
-<pre>
-function hook_ctools_plugin_directory($module, $plugin) {
- if ($module == 'panels') {
- return 'plugins/' . $plugin;
- }
-}
-</pre>
-
-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:
-<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>
-
-<h3>How a theme can implement plugins</h3>
-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:
-
-<pre>
-plugins[module][type] = directory
-</pre>
-
-<h3>How to structure the .inc file</h3>
-
-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.
-
-This array should look something like this:
-<pre>
-$plugin = array(
- 'key' => 'value',
-);
-</pre>
-
-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.
-
-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.
diff --git a/help/plugins.html b/help/plugins.html
deleted file mode 100644
index 906813e..0000000
--- a/help/plugins.html
+++ /dev/null
@@ -1,5 +0,0 @@
-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.
-
-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.
-
-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. \ No newline at end of file
diff --git a/help/wizard.html b/help/wizard.html
deleted file mode 100644
index a9ccde8..0000000
--- a/help/wizard.html
+++ /dev/null
@@ -1,287 +0,0 @@
-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.
-
-<h3>The form info array</h3>
-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:
-
-<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>
-
-The above array starts with an <b>id</b> which is used to identify the wizard in various places and a <b>path</b> which is needed to redirect to the next step between forms. It then creates some <b>settings</b> 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 <b>wizard callbacks</b> which allow the wizard to act appropriately when forms are submitted. Finally it contains a <b>list of forms</b> and their <b>order</b> 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 <b>step</b> and is used to identify each individual step of the wizard.
-
-Here is a full list of every item that can be in the form info array:
-
-<dl>
-<dt>id</dt>
-<dd>An id for wizard. This is used like a hook to automatically name <b>callbacks</b>, 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>
-
-<h3>Invoking the form wizard</h3>
-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.
-
-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:
-
-<pre>
- $form_state = array();
- ctools_include('wizard');
- $output = ctools_wizard_multistep_form($form_info, $step, $form_state);
-</pre>
-
-If using AJAX or the modal, This part is actually done! If not, you have one more small step:
-<pre>
- return $output;
-</pre>
-
-<h3>Forms and their callbacks</h3>
-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.
-
-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:
-
-<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>
-
-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).
-
-With this set up, the _next, _finish and _cancel callbacks are quite simple:
-
-<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>
-
-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:
-
-<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'];
-}
-</pre>
-
-No database operations were made during this _submit, and that's a very important distinction about this system.
-
-<h3>Proper handling of back button</h3>
-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.
-
-<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'),
- ),
- );
-}
-
-/**
- * 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>
-
-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.
-
-<h3>Required fields, cancel and back buttons</h3>
-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 :
-<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>
-
-<h3>Wizard for anonymous users</h3>
-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 :
-<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/images/arrow-active.png b/images/arrow-active.png
deleted file mode 100644
index 3bbd3c2..0000000
--- a/images/arrow-active.png
+++ /dev/null
Binary files differ
diff --git a/images/collapsible-collapsed.png b/images/collapsible-collapsed.png
deleted file mode 100644
index 95a214a..0000000
--- a/images/collapsible-collapsed.png
+++ /dev/null
Binary files differ
diff --git a/images/collapsible-expanded.png b/images/collapsible-expanded.png
deleted file mode 100644
index 46f39ec..0000000
--- a/images/collapsible-expanded.png
+++ /dev/null
Binary files differ
diff --git a/images/expanded-options.png b/images/expanded-options.png
deleted file mode 100644
index b7b755c..0000000
--- a/images/expanded-options.png
+++ /dev/null
Binary files differ
diff --git a/images/icon-close-window.png b/images/icon-close-window.png
deleted file mode 100644
index 5f0cf69..0000000
--- a/images/icon-close-window.png
+++ /dev/null
Binary files differ
diff --git a/images/icon-configure.png b/images/icon-configure.png
deleted file mode 100644
index e23d67c..0000000
--- a/images/icon-configure.png
+++ /dev/null
Binary files differ
diff --git a/images/icon-delete.png b/images/icon-delete.png
deleted file mode 100644
index 5f0cf69..0000000
--- a/images/icon-delete.png
+++ /dev/null
Binary files differ
diff --git a/images/no-icon.png b/images/no-icon.png
deleted file mode 100644
index fa78ec1..0000000
--- a/images/no-icon.png
+++ /dev/null
Binary files differ
diff --git a/images/status-active.gif b/images/status-active.gif
deleted file mode 100644
index 207e95c..0000000
--- a/images/status-active.gif
+++ /dev/null
Binary files differ
diff --git a/images/throbber.gif b/images/throbber.gif
deleted file mode 100644
index 8a084b8..0000000
--- a/images/throbber.gif
+++ /dev/null
Binary files differ
diff --git a/includes/ajax.inc b/includes/ajax.inc
deleted file mode 100644
index 981ee23..0000000
--- a/includes/ajax.inc
+++ /dev/null
@@ -1,125 +0,0 @@
-<?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_js('misc/ajax.js');
- 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) {
- 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()) {
- return array(
- 'command' => 'redirect',
- 'url' => url($url, $options),
- 'delay' => $delay,
- );
-}
-
-/**
- * Force a reload of the current page.
- */
-function ctools_ajax_command_reload() {
- 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) {
- 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/includes/cache.inc b/includes/cache.inc
deleted file mode 100644
index ca6e6f3..0000000
--- a/includes/cache.inc
+++ /dev/null
@@ -1,169 +0,0 @@
-<?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', $object);
-
-}
-
-/**
- * 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/includes/cache.plugin-type.inc b/includes/cache.plugin-type.inc
deleted file mode 100644
index 1ab4cdd..0000000
--- a/includes/cache.plugin-type.inc
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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/includes/cleanstring.inc b/includes/cleanstring.inc
deleted file mode 100644
index baed9e3..0000000
--- a/includes/cleanstring.inc
+++ /dev/null
@@ -1,205 +0,0 @@
-<?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{d800}-\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/includes/collapsible.theme.inc b/includes/collapsible.theme.inc
deleted file mode 100644
index f7bbbb3..0000000
--- a/includes/collapsible.theme.inc
+++ /dev/null
@@ -1,79 +0,0 @@
-<?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/includes/content.inc b/includes/content.inc
deleted file mode 100644
index c77f0a1..0000000
--- a/includes/content.inc
+++ /dev/null
@@ -1,773 +0,0 @@
-<?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';
- }
-
- // 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];
- }
- }
-}
-
-/**
- * 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);
-
- // 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();
- $output->title = t('No info');
- $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',
- '#process' => array('ctools_dependent_process'),
- '#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;
-}
diff --git a/includes/content.menu.inc b/includes/content.menu.inc
deleted file mode 100644
index 0454a54..0000000
--- a/includes/content.menu.inc
+++ /dev/null
@@ -1,72 +0,0 @@
-<?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');
- 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/includes/content.plugin-type.inc b/includes/content.plugin-type.inc
deleted file mode 100644
index 4c767ae..0000000
--- a/includes/content.plugin-type.inc
+++ /dev/null
@@ -1,17 +0,0 @@
-<?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/includes/content.theme.inc b/includes/content.theme.inc
deleted file mode 100644
index ae4456a..0000000
--- a/includes/content.theme.inc
+++ /dev/null
@@ -1,21 +0,0 @@
-<?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/includes/context-access-admin.inc b/includes/context-access-admin.inc
deleted file mode 100644
index b155800..0000000
--- a/includes/context-access-admin.inc
+++ /dev/null
@@ -1,486 +0,0 @@
-<?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 = array_merge($form, ctools_access_admin_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['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/includes/context-admin.inc b/includes/context-admin.inc
deleted file mode 100644
index a3b4b80..0000000
--- a/includes/context-admin.inc
+++ /dev/null
@@ -1,782 +0,0 @@
-<?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) {
- $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) {
- $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_js('misc/ajax.js');
- $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)),
- );
-
- // 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->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',
- );
-
- $output = ctools_plugin_configure_form($form_info, $form_state);
-
- // If $rc is FALSE, there was no actual form.
- if ($output === FALSE || !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',
- );
-
- $output = ctools_plugin_configure_form($form_info, $form_state);
-
- // If $rc is FALSE, there was no actual form.
- if ($output === FALSE || !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;
-}
-
-function ctools_context_get_defaults($plugin_definition) {
- $conf = array(
- 'identifier' => $plugin_definition['title'] . ($id > 1 ? ' ' . $id : ''),
- 'keyword' => ctools_get_keyword($object, $plugin_definition['keyword']),
- 'name' => $plugin_definition['name'],
- );
-
- 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 ($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'];
- $position = $form_state['position'];
- $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 = 0;
- while (!empty($keywords[$keyword])) {
- $keyword = $word . '_' . ++$count;
- }
- return $keyword;
-}
-
diff --git a/includes/context-task-handler.inc b/includes/context-task-handler.inc
deleted file mode 100644
index aa11eab..0000000
--- a/includes/context-task-handler.inc
+++ /dev/null
@@ -1,486 +0,0 @@
-<?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);
- }
-}
-
-/**
- * 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' => '',
- '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?
- }
- }
-
- 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']);
- }
-
- // Only directly output if $page was set to true.
- if (!empty($info['no_blocks'])) {
- ctools_set_no_blocks(FALSE);
- }
- return $info['content'];
-}
-
-/**
- * Called to execute actions that should happen before a handler is rendered.
- */
-function ctools_context_handler_pre_render($handler, $contexts, $args) {
- $plugin = page_manager_get_task_handler($handler->handler);
-
- if (user_access('administer page manager') && isset($handler->task)) {
- // Provide a tab to edit this context:
- ctools_include('menu');
- $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);
- }
- }
-
- ctools_menu_add_tab(array(
- 'title' => $title,
- 'href' => page_manager_edit_url(page_manager_make_task_name($handler->task, $handler->subtask), $trail),
- 'type' => MENU_LOCAL_ACTION
- ));
- }
-}
-
-/**
- * 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/includes/context.inc b/includes/context.inc
deleted file mode 100644
index cc46360..0000000
--- a/includes/context.inc
+++ /dev/null
@@ -1,1542 +0,0 @@
-<?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. Contexs 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;
-
- /**
- *
- * @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 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);
- }
-
- // Due to a bug, some contexts got recorded with an id of 0. This will
- // convert them to the correct ID allowing for some earlier panels
- // to continue to work.
- if (!empty($context) && $context[strlen($context) - 1] === '0') {
- $context[strlen($context) - 1] = 1;
- }
-
- 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) {
- $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) {
- // Contexts without plugins might be optional placeholders.
- if (empty($context->plugin)) {
- return;
- }
-
- $value = $context->argument;
- if ($function = ctools_plugin_load_function('ctools', 'contexts', $context->plugin, 'convert')) {
- $value = $function($context, $converter);
- }
-
- foreach (module_implements('ctools_context_converter_alter') as $module) {
- $function = $module . '_ctools_context_converter_alter';
- $function($context, $converter, $value);
- }
-
- 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 (($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_load_function('ctools', 'contexts', $type, '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) {
- // 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);
- }
- 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 (empty($contexts[$id])) {
- if ($context = ctools_context_get_context_from_argument($argument, $arg)) {
- $contexts[$id] = $context;
- }
- }
- else {
- $context = $contexts[$id];
- }
-
- if ((empty($context) || empty($context->data)) && !empty($argument['default']) && $argument['default'] == '404') {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-// ---------------------------------------------------------------------------
-// Functions related to contexts from relationships.
-
-/**
- * Fetch metadata on a specific relationship plugin.
- *
- * @param $content type
- * Name of a panel content type.
- *
- * @return
- * An array with information about the requested relationship.
- */
-function ctools_get_relationship($relationship) {
- ctools_include('plugins');
- return ctools_get_plugins('ctools', 'relationships', $relationship);
-}
-
-/**
- * Fetch metadata for all relationship plugins.
- *
- * @return
- * An array of arrays with information about all available relationships.
- */
-function ctools_get_relationships() {
- ctools_include('plugins');
- return ctools_get_plugins('ctools', 'relationships');
-}
-
-/**
- *
- * @param $relationship
- * The configuration of a relationship. It must contain the following data:
- * - name: The name of the relationship plugin being used.
- * - relationship_settings: The configuration based upon the plugin forms.
- * - identifier: The human readable identifier for this relationship, usually
- * defined by the UI.
- * - keyword: The keyword used for this relationship for substitutions.
- *
- * @param $source_context
- * The context this relationship is based upon.
- *
- * @param $placeholders
- * If TRUE, placeholders are acceptable.
- *
- * @return
- * A context object if one can be loaded.
- */
-function ctools_context_get_context_from_relationship($relationship, $source_context, $placeholders = FALSE) {
- ctools_include('plugins');
- if ($function = ctools_plugin_load_function('ctools', 'relationships', $relationship['name'], 'context')) {
- // Backward compatibility: Merge old style settings into new style:
- if (!empty($relationship['relationship_settings'])) {
- $relationship += $relationship['relationship_settings'];
- unset($relationship['relationship_settings']);
- }
-
- $context = $function($source_context, $relationship, $placeholders);
- if ($context) {
- $context->identifier = $relationship['identifier'];
- $context->page_title = isset($relationship['title']) ? $relationship['title'] : '';
- $context->keyword = $relationship['keyword'];
- if (!empty($context->empty)) {
- $context->placeholder = array(
- 'type' => 'relationship',
- 'conf' => $relationship,
- );
- }
- return $context;
- }
- }
-}
-
-/**
- * Fetch all relevant relationships.
- *
- * Relevant relationships are any relationship that can be created based upon
- * the list of existing contexts. For example, the 'node author' relationship
- * is relevant if there is a 'node' context, but makes no sense if there is
- * not one.
- *
- * @param $contexts
- * An array of contexts used to figure out which relationships are relevant.
- *
- * @return
- * An array of relationship keys that are relevant for the given set of
- * contexts.
- */
-function ctools_context_get_relevant_relationships($contexts) {
- $relevant = array();
- $relationships = ctools_get_relationships();
-
- // Go through each relationship
- foreach ($relationships as $rid => $relationship) {
- // For each relationship, see if there is a context that satisfies it.
- if (ctools_context_filter($contexts, $relationship['required context'])) {
- $relevant[$rid] = $relationship['title'];
- }
- }
-
- return $relevant;
-}
-
-/**
- * Fetch all active relationships
- *
- * @param $relationships
- * An keyed array of relationship data including:
- * - name: name of relationship
- * - context: context id relationship belongs to. This will be used to
- * identify which context in the $contexts array to use to create the
- * relationship context.
- *
- * @param $contexts
- * A keyed array of contexts used to figure out which relationships
- * are relevant. New contexts will be added to this.
- *
- * @param $placeholders
- * If TRUE, placeholders are acceptable.
- */
-function ctools_context_get_context_from_relationships($relationships, &$contexts, $placeholders = FALSE) {
- $return = array();
-
- foreach ($relationships as $rdata) {
- if (!isset($rdata['context'])) {
- continue;
- }
-
- if (is_array($rdata['context'])) {
- $rcontexts = array();
- foreach ($rdata['context'] as $cid) {
- if (empty($contexts[$cid])) {
- continue 2;
- }
- $rcontexts[] = $contexts[$cid];
- }
- }
- else {
- if (empty($contexts[$rdata['context']])) {
- continue;
- }
- $rcontexts = $contexts[$rdata['context']];
- }
-
- $cid = ctools_context_id($rdata, 'relationship');
- if ($context = ctools_context_get_context_from_relationship($rdata, $rcontexts)) {
- $contexts[$cid] = $context;
- }
- }
-}
-
-// ---------------------------------------------------------------------------
-// Functions related to loading contexts from simple context definitions.
-
-/**
- * Fetch metadata on a specific context plugin.
- *
- * @param $context
- * Name of a context.
- *
- * @return
- * An array with information about the requested panel context.
- */
-function ctools_get_context($context) {
- ctools_include('plugins');
- return ctools_get_plugins('ctools', 'contexts', $context);
-}
-
-/**
- * Fetch metadata for all context plugins.
- *
- * @return
- * An array of arrays with information about all available panel contexts.
- */
-function ctools_get_contexts() {
- ctools_include('plugins');
- return ctools_get_plugins('ctools', 'contexts');
-}
-
-/**
- *
- * @param $context
- * The configuration of a context. It must contain the following data:
- * - name: The name of the context plugin being used.
- * - context_settings: The configuration based upon the plugin forms.
- * - identifier: The human readable identifier for this context, usually
- * defined by the UI.
- * - keyword: The keyword used for this context for substitutions.
- * @param $type
- * This is either 'context' which indicates the context will be loaded
- * from data in the settings, or 'required_context' which means the
- * context must be acquired from an external source. This is the method
- * used to pass pure contexts from one system to another.
- *
- * @return
- * A context object if one can be loaded.
- */
-function ctools_context_get_context_from_context($context, $type = 'context', $argument = NULL) {
- ctools_include('plugins');
- $plugin = ctools_get_context($context['name']);
- if ($function = ctools_plugin_get_function($plugin, 'context')) {
- // Backward compatibility: Merge old style settings into new style:
- if (!empty($context['context_settings'])) {
- $context += $context['context_settings'];
- unset($context['context_settings']);
- }
-
- if (isset($argument) && isset($plugin['placeholder name'])) {
- $context[$plugin['placeholder name']] = $argument;
- }
-
- $return = $function($type == 'requiredcontext', $context, TRUE, $plugin);
- if ($return) {
- $return->identifier = $context['identifier'];
- $return->page_title = isset($context['title']) ? $context['title'] : '';
- $return->keyword = $context['keyword'];
-
- if (!empty($context->empty)) {
- $context->placeholder = array(
- 'type' => 'context',
- 'conf' => $context,
- );
- }
-
- return $return;
- }
- }
-}
-
-/**
- * Retrieve a list of base contexts based upon a simple 'contexts' definition.
- *
- * For required contexts this will always retrieve placeholders.
- *
- * @param $contexts
- * The list of contexts defined in the UI.
- * @param $type
- * Either 'context' or 'requiredcontext', which indicates whether the contexts
- * are loaded from internal data or copied from an external source.
- * @param $placeholders
- * If true, placeholders are acceptable.
- */
-function ctools_context_get_context_from_contexts($contexts, $type = 'context', $placeholders = FALSE) {
- $return = array();
- foreach ($contexts as $context) {
- $ctext = ctools_context_get_context_from_context($context, $type);
- if ($ctext) {
- if ($placeholders) {
- $ctext->placeholder = TRUE;
- }
- $return[ctools_context_id($context, $type)] = $ctext;
- }
- }
- return $return;
-}
-
-/**
- * Match up external contexts to our required contexts.
- *
- * This function is used to create a list of contexts with proper
- * IDs based upon a list of required contexts.
- *
- * These contexts passed in should match the numeric positions of the
- * required contexts. The caller must ensure this has already happened
- * correctly as this function will not detect errors here.
- *
- * @param $required
- * A list of required contexts as defined by the UI.
- * @param $contexts
- * A list of matching contexts as passed in from the calling system.
- */
-function ctools_context_match_required_contexts($required, $contexts) {
- $return = array();
- if (!is_array($required)) {
- return $return;
- }
-
- foreach ($required as $r) {
- $context = drupal_clone(array_shift($contexts));
- $context->identifier = $r['identifier'];
- $context->page_title = isset($r['title']) ? $r['title'] : '';
- $context->keyword = $r['keyword'];
- $return[ctools_context_id($r, 'requiredcontext')] = $context;
- }
-
- return $return;
-}
-
-/**
- * Load a full array of contexts for an object.
- *
- * Not all of the types need to be supported by this object.
- *
- * This function is not used to load contexts from external data, but may
- * be used to load internal contexts and relationships. Otherwise it can also
- * be used to generate a full set of placeholders for UI purposes.
- *
- * @param $object
- * An object that contains some or all of the following variables:
- *
- * - requiredcontexts: A list of UI configured contexts that are required
- * from an external source. Since these require external data, they will
- * only be added if $placeholders is set to TRUE, and empty contexts will
- * be created.
- * - arguments: A list of UI configured arguments that will create contexts.
- * Since these require external data, they will only be added if $placeholders
- * is set to TRUE.
- * - contexts: A list of UI configured contexts that have no external source,
- * and are essentially hardcoded. For example, these might configure a
- * particular node or a particular taxonomy term.
- * - relationships: A list of UI configured contexts to be derived from other
- * contexts that already exist from other sources. For example, these might
- * be used to get a user object from a node via the node author relationship.
- * @param $placeholders
- * If TRUE, this will generate placeholder objects for types this function
- * cannot load.
- * @param $contexts
- * An array of pre-existing contexts that will be part of the return value.
- */
-function ctools_context_load_contexts($object, $placeholders = TRUE, $contexts = array()) {
- if (!empty($object->base_contexts)) {
- $contexts += $object->base_contexts;
- }
-
- if ($placeholders) {
- // This will load empty contexts as placeholders for arguments that come
- // from external sources. If this isn't set, it's assumed these context
- // will already have been matched up and loaded.
- if (!empty($object->requiredcontexts) && is_array($object->requiredcontexts)) {
- $contexts += ctools_context_get_context_from_contexts($object->requiredcontexts, 'requiredcontext', $placeholders);
- }
-
- if (!empty($object->arguments) && is_array($object->arguments)) {
- $contexts += ctools_context_get_placeholders_from_argument($object->arguments);
- }
- }
-
- if (!empty($object->contexts) && is_array($object->contexts)) {
- $contexts += ctools_context_get_context_from_contexts($object->contexts, 'context', $placeholders);
- }
-
- // add contexts from relationships
- if (!empty($object->relationships) && is_array($object->relationships)) {
- ctools_context_get_context_from_relationships($object->relationships, $contexts, $placeholders);
- }
-
- return $contexts;
-}
-
-/**
- * Return the first context with a form id from a list of contexts.
- *
- * This function is used to figure out which contexts represents 'the form'
- * from a list of contexts. Only one contexts can actually be 'the form' for
- * a given page, since the @code{<form>} tag can not be embedded within
- * itself.
- */
-function ctools_context_get_form($contexts) {
- if (!empty($contexts)) {
- foreach ($contexts as $id => $context) {
- // if a form shows its id as being a 'required context' that means the
- // the context is external to this display and does not count.
- if (!empty($context->form_id) && substr($id, 0, 15) != 'requiredcontext') {
- return $context;
- }
- }
- }
-}
-
-/**
- * Replace placeholders with real contexts using data extracted from a form
- * for the purposes of previews.
- *
- * @param $contexts
- * All of the contexts, including the placeholders.
- * @param $arguments
- * The arguments. These will be acquired from $form_state['values'] and the
- * keys must match the context IDs.
- *
- * @return
- * A new $contexts array containing the replaced contexts. Not all contexts
- * may be replaced if, for example, an argument was unable to be converted
- * into a context.
- */
-function ctools_context_replace_placeholders($contexts, $arguments) {
- foreach ($contexts as $cid => $context) {
- if (empty($context->empty)) {
- continue;
- }
-
- $new_context = NULL;
- switch ($context->placeholder['type']) {
- case 'relationship':
- $relationship = $context->placeholder['conf'];
- if (isset($contexts[$relationship['context']])) {
- $new_context = ctools_context_get_context_from_relationship($relationship, $contexts[$relationship['context']]);
- }
- break;
- case 'argument':
- if (isset($arguments[$cid]) && $arguments[$cid] !== '') {
- $argument = $context->placeholder['conf'];
- $new_context = ctools_context_get_context_from_argument($argument, $arguments[$cid]);
- }
- break;
- case 'context':
- if (!empty($arguments[$cid])) {
- $context_info = $context->placeholder['conf'];
- $new_context = ctools_context_get_context_from_context($context_info, 'requiredcontext', $arguments[$cid]);
- }
- break;
- }
-
- if ($new_context && empty($new_context->empty)) {
- $contexts[$cid] = $new_context;
- }
- }
-
- return $contexts;
-}
-
-/**
- * Provide a form array for getting data to replace placeholder contexts
- * with real data.
- */
-function ctools_context_replace_form($form, $contexts) {
- foreach ($contexts as $cid => $context) {
- if (empty($context->empty)) {
- continue;
- }
-
- // Get plugin info from the context which should have been set when the
- // empty context was created.
- $info = NULL;
- $plugin = NULL;
- $settings = NULL;
- switch ($context->placeholder['type']) {
- case 'argument':
- $info = $context->placeholder['conf'];
- $plugin = ctools_get_argument($info['name']);
- break;
-
- case 'context':
- $info = $context->placeholder['conf'];
- $plugin = ctools_get_context($info['name']);
- break;
- }
-
- // Ask the plugin where the form is.
- if ($plugin && isset($plugin['placeholder form'])) {
- if (is_array($plugin['placeholder form'])) {
- $form[$cid] = $plugin['placeholder form'];
- }
- else if (function_exists($plugin['placeholder form'])) {
- $widget = $plugin['placeholder form']($info);
- if ($widget) {
- $form[$cid] = $widget;
- }
- }
-
- if (!empty($form[$cid])) {
- $form[$cid]['#title'] = t('@identifier (@keyword)', array('@keyword' => '%' . $context->keyword, '@identifier' => $context->identifier));
- }
- }
- }
-}
-
-// ---------------------------------------------------------------------------
-// Functions related to loading access control plugins
-
-/**
- * Fetch metadata on a specific access control plugin.
- *
- * @param $name
- * Name of a plugin.
- *
- * @return
- * An array with information about the requested access control plugin.
- */
-function ctools_get_access_plugin($name) {
- ctools_include('plugins');
- return ctools_get_plugins('ctools', 'access', $name);
-}
-
-/**
- * Fetch metadata for all access control plugins.
- *
- * @return
- * An array of arrays with information about all available access control plugins.
- */
-function ctools_get_access_plugins() {
- ctools_include('plugins');
- return ctools_get_plugins('ctools', 'access');
-}
-
-/**
- * Fetch a list of access plugins that are available for a given list of
- * contexts.
- *
- * if 'logged-in-user' is not in the list of contexts, it will be added as
- * this is required.
- */
-function ctools_get_relevant_access_plugins($contexts) {
- if (!isset($contexts['logged-in-user'])) {
- $contexts['logged-in-user'] = ctools_access_get_loggedin_context();
- }
-
- $all_plugins = ctools_get_access_plugins();
- $plugins = array();
- foreach ($all_plugins as $id => $plugin) {
- if (!empty($plugin['required context']) && !ctools_context_match_requirements($contexts, $plugin['required context'])) {
- continue;
- }
- $plugins[$id] = $plugin;
- }
-
- return $plugins;
-}
-
-/**
- * Create a context for the logged in user.
- */
-function ctools_access_get_loggedin_context() {
- global $user;
- $context = ctools_context_create('entity:user', $user);
- $context->identifier = t('Logged in user');
- $context->keyword = 'viewer';
- $context->id = 0;
-
- return $context;
-}
-
-/**
- * Get a summary of an access plugin's settings.
- */
-function ctools_access_summary($plugin, $contexts, $test) {
- if (!isset($contexts['logged-in-user'])) {
- $contexts['logged-in-user'] = ctools_access_get_loggedin_context();
- }
-
- $description = '';
- if ($function = ctools_plugin_get_function($plugin, 'summary')) {
- $required_context = isset($plugin['required context']) ? $plugin['required context'] : array();
- $context = isset($test['context']) ? $test['context'] : array();
- $description = $function($test['settings'], ctools_context_select($contexts, $required_context, $context), $plugin);
- }
-
- if (!empty($test['not'])) {
- $description = "NOT ($description)";
- }
-
- return $description;
-}
-
-/**
- * Get a summary of a group of access plugin's settings.
- */
-function ctools_access_group_summary($access, $contexts) {
- if (empty($access['plugins'])) {
- return;
- }
-
- $descriptions = array();
- foreach ($access['plugins'] as $id => $test) {
- $plugin = ctools_get_access_plugin($test['name']);
- $descriptions[] = ctools_access_summary($plugin, $contexts, $test);
- }
-
- $separator = $access['logic'] == 'and' ? t(', and ') : t(', or ');
- return implode($separator, $descriptions);
-}
-
-/**
- * Determine if the current user has access via plugin.
- *
- * @param $settings
- * An array of settings theoretically set by the user.
- * @param $contexts
- * An array of zero or more contexts that may be used to determine if
- * the user has access.
- *
- * @return
- * TRUE if access is granted, false if otherwise.
- */
-function ctools_access($settings, $contexts = array()) {
- if (empty($settings['plugins'])) {
- return TRUE;
- }
-
- if (!isset($settings['logic'])) {
- $settings['logic'] = 'and';
- }
-
- if (!isset($contexts['logged-in-user'])) {
- $contexts['logged-in-user'] = ctools_access_get_loggedin_context();
- }
-
- foreach ($settings['plugins'] as $test) {
- $pass = FALSE;
- $plugin = ctools_get_access_plugin($test['name']);
- if ($plugin && $function = ctools_plugin_get_function($plugin, 'callback')) {
- // Do we need just some contexts or all of them?
- if (!empty($plugin['all contexts'])) {
- $test_contexts = $contexts;
- }
- else {
- $required_context = isset($plugin['required context']) ? $plugin['required context'] : array();
- $context = isset($test['context']) ? $test['context'] : array();
- $test_contexts = ctools_context_select($contexts, $required_context, $context);
- }
-
- $pass = $function($test['settings'], $test_contexts, $plugin);
- if (!empty($test['not'])) {
- $pass = !$pass;
- }
- }
-
- if ($pass && $settings['logic'] == 'or') {
- // Pass if 'or' and this rule passed.
- return TRUE;
- }
- else if (!$pass && $settings['logic'] == 'and') {
- // Fail if 'and' and htis rule failed.
- return FALSE;
- }
- }
-
- // Return TRUE if logic was and, meaning all rules passed.
- // Return FALSE if logic was or, meaning no rule passed.
- return $settings['logic'] == 'and';
-}
-
-/**
- * Create default settings for a new access plugin.
- *
- * @param $plugin
- * The access plugin being used.
- *
- * @return
- * A default configured test that should be placed in $access['plugins'];
- */
-function ctools_access_new_test($plugin) {
- $test = array(
- 'name' => $plugin['name'],
- 'settings' => array(),
- );
-
- // Set up required context defaults.
- if (isset($plugin['required context'])) {
- if (is_object($plugin['required context'])) {
- $test['context'] = '';
- }
- else {
- $test['context'] = array();
- foreach ($plugin['required context'] as $required) {
- $test['context'][] = '';
- }
- }
- }
-
-
- $default = NULL;
- if (isset($plugin['default'])) {
- $default = $plugin['default'];
- }
- elseif (isset($plugin['defaults'])) {
- $default = $plugin['defaults'];
- }
-
- // Setup plugin defaults.
- if (isset($default)) {
- if (is_array($default)) {
- $test['settings'] = $default;
- }
- else if (function_exists($default)) {
- $test['settings'] = $default();
- }
- else {
- $test['settings'] = array();
- }
- }
-
- return $test;
-}
-
-/**
- * Apply restrictions to contexts based upon the access control configured.
- *
- * These restrictions allow the UI to not show content that may not
- * be relevant to all types of a particular context.
- */
-function ctools_access_add_restrictions($settings, $contexts) {
- if (empty($settings['plugins'])) {
- return;
- }
-
- if (!isset($settings['logic'])) {
- $settings['logic'] = 'and';
- }
-
- // We're not going to try to figure out restrictions on the or.
- if ($settings['logic'] == 'or' && count($settings['plugins']) > 1) {
- return;
- }
-
- foreach ($settings['plugins'] as $test) {
- $plugin = ctools_get_access_plugin($test['name']);
- if ($plugin && $function = ctools_plugin_get_function($plugin, 'restrictions')) {
- $required_context = isset($plugin['required context']) ? $plugin['required context'] : array();
- $context = isset($test['context']) ? $test['context'] : array();
- $contexts = ctools_context_select($contexts, $required_context, $context);
- $function($test['settings'], $contexts);
- }
- }
-}
diff --git a/includes/context.menu.inc b/includes/context.menu.inc
deleted file mode 100644
index 3cba932..0000000
--- a/includes/context.menu.inc
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains menu item registration for the context tool.
- *
- * The menu items registered are AJAX callbacks for the context configuration
- * popups. They are kept separately for organizational purposes.
- */
-
-function ctools_context_menu(&$items) {
- $base = array(
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK,
- 'file' => 'includes/context-admin.inc',
- );
- $items['ctools/context/ajax/add'] = array(
- 'page callback' => 'ctools_context_ajax_item_add',
- ) + $base;
- $items['ctools/context/ajax/configure'] = array(
- 'page callback' => 'ctools_context_ajax_item_edit',
- ) + $base;
- $items['ctools/context/ajax/delete'] = array(
- 'page callback' => 'ctools_context_ajax_item_delete',
- ) + $base;
-
- // For the access system
- $base['file'] = 'includes/context-access-admin.inc';
- $items['ctools/context/ajax/access/add'] = array(
- 'page callback' => 'ctools_access_ajax_add',
- ) + $base;
- $items['ctools/context/ajax/access/configure'] = array(
- 'page callback' => 'ctools_access_ajax_edit',
- ) + $base;
- $items['ctools/context/ajax/access/delete'] = array(
- 'page callback' => 'ctools_access_ajax_delete',
- ) + $base;
-
-}
diff --git a/includes/context.plugin-type.inc b/includes/context.plugin-type.inc
deleted file mode 100644
index 866def2..0000000
--- a/includes/context.plugin-type.inc
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains plugin type registration information for the context tool.
- *
- * Don't actually need to declare anything for these plugin types right now,
- * apart from the fact that they exist. So, an empty array.
- */
-
-function ctools_context_plugin_type(&$items) {
- $items['contexts'] = array(
- 'child plugins' => TRUE,
- );
- $items['arguments'] = array(
- 'child plugins' => TRUE,
- );
- $items['relationships'] = array(
- 'child plugins' => TRUE,
- );
- $items['access'] = array(
- 'child plugins' => TRUE,
- );
-}
diff --git a/includes/context.theme.inc b/includes/context.theme.inc
deleted file mode 100644
index 8f660b8..0000000
--- a/includes/context.theme.inc
+++ /dev/null
@@ -1,344 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains theme registry and theme implementations for the context tool.
- */
-
-/**
- * Implements hook_theme()
- */
-function ctools_context_theme(&$theme) {
- $theme['ctools_context_list'] = array(
- 'variables' => array('object' => NULL),
- 'file' => 'includes/context.theme.inc',
- );
- $theme['ctools_context_list_no_table'] = array(
- 'variables' => array('object' => NULL),
- 'file' => 'includes/context.theme.inc',
- );
- $theme['ctools_context_item_form'] = array(
- 'render element' => 'form',
-// 'variables' => array('form' => NULL),
- 'file' => 'includes/context.theme.inc',
- );
- $theme['ctools_context_item_row'] = array(
- 'variables' => array('type' => NULL, 'form' => NULL, 'position' => NULL, 'count' => NULL, 'with_tr' => TRUE),
- 'file' => 'includes/context.theme.inc',
- );
-
- // For the access plugin
- $theme['ctools_access_admin_add'] = array(
- 'render element' => 'form',
- 'file' => 'includes/context-access-admin.inc',
- );
-}
-
-/**
- * Theme the form item for the context entry.
- */
-function theme_ctools_context_item_row($vars) {
- $type = $vars['type'];
- $form = $vars['form'];
- $position = $vars['position'];
- $count = $vars['count'];
- $with_tr = $vars['with_tr'];
- $output = '<td class="title">&nbsp;' . render($form['title']) . '</td>';
- if (!empty($form['position'])) {
- $output .= '<td class="position">&nbsp;' . render($form['position']) . '</td>';
- }
- $output .= '<td class="operation">' . render($form['settings']);
- $output .= render($form['remove']) . '</td>';
-
- if ($with_tr) {
- $output = '<tr id="' . $type . '-row-' . $position . '" class="draggable ' . $type . '-row ' . ($count % 2 ? 'even' : 'odd') . '">' . $output . '</tr>';
- }
- return $output;
-}
-
-/**
- * Display the context item.
- */
-function theme_ctools_context_item_form($vars) {
- $form = $vars['form'];
-
- $output = '';
- $type = $form['#ctools_context_type'];
- $module = $form['#ctools_context_module'];
- $cache_key = $form['#cache_key'];
-
- $type_info = ctools_context_info($type);
-
- if (!empty($form[$type]) && empty($form['#only_buttons'])) {
- $count = 0;
- $rows = '';
- foreach (array_keys($form[$type]) as $id) {
- if (!is_numeric($id)) {
- continue;
- }
- $theme_vars = array();
- $theme_vars['type'] = $type;
- $theme_vars['form'] = $form[$type][$id];
- $theme_vars['position'] = $id;
- $theme_vars['count'] = $count++;
- $rows .= theme('ctools_context_item_row', $theme_vars);
- }
-
- $output .= '<table id="' . $type . '-table">';
- $output .= '<thead>';
- $output .= '<tr>';
- $output .= '<th class="title">' . $type_info['title'] . '</th>';
- if (!empty($type_info['sortable']) && $count) {
- $output .= '<th class="position">' . t('Weight') . '</th>';
- }
- $output .= '<th class="operation">' . t('Operation') . '</th>';
- $output .= '</tr>';
- $output .= '</thead>';
- $output .= '<tbody>';
-
- $output .= $rows;
-
- $output .= '</tbody>';
- $output .= '</table>';
- }
-
- if (!empty($form['buttons'])) {
- // Display the add context item.
- $row = array();
- $row[] = array('data' => render($form['buttons'][$type]['item']), 'class' => array('title'));
- $row[] = array('data' => render($form['buttons'][$type]['add']), 'class' => array('add'), 'width' => "60%");
- $output .= '<div class="buttons">';
- $output .= render($form['buttons'][$type]);
- $theme_vars = array();
- $theme_vars['header'] = array();
- $theme_vars['rows'] = array($row);
- $theme_vars['attributes'] = array('id' => $type . '-add-table');
- $output .= theme('table', $theme_vars);
- $output .= '</div>';
- }
- if (!empty($form['description'])) {
- $output .= render($form['description']);
- }
-
- if (!empty($type_info['sortable'])) {
- drupal_add_tabledrag($type . '-table', 'order', 'sibling', 'drag-position');
- }
-
- return $output;
-}
-
-/**
- * Create a visible list of all the contexts available on an object.
- * Assumes arguments, relationships and context objects.
- *
- * Contexts must be preloaded.
- */
-function theme_ctools_context_list($vars) {
- $object = $vars['object'];
- $header = $vars['header'];
- $description = (!empty($vars['description'])) ? $vars['description'] : NULL;
- $titles = array();
- $output = '';
- $count = 1;
-
- $contexts = ctools_context_load_contexts($object);
-
- // Describe 'built in' contexts.
- if (!empty($object->base_contexts)) {
- foreach ($object->base_contexts as $id => $context) {
- $output .= '<tr>';
- $output .= '<td valign="top"><em>' . t('Built in context') . '</em></td>';
- $desc = check_plain($context->identifier);
- if (isset($context->keyword)) {
- $desc .= '<div class="description">' . t('Keyword: %@keyword', array('@keyword' => $context->keyword));
- foreach (ctools_context_get_converters('%' . $context->keyword . ':', $context) as $keyword => $title) {
- $desc .= '<br />' . t('@keyword --&gt; @title', array('@keyword' => $keyword, '@title' => $title));
- }
- $desc .= '</div>';
-
- }
- if (isset($context->description)) {
- $desc .= '<div class="description">' . filter_xss_admin($context->description) . '</div>';
- }
- $output .= '<td>' . $desc . '</td>';
- $output .= '</tr>';
- $titles[$id] = $context->identifier;
- }
- }
-
- // First, make a list of arguments. Arguments are pretty simple.
- if (!empty($object->arguments)) {
- foreach ($object->arguments as $argument) {
- $output .= '<tr>';
- $output .= '<td valign="top"><em>' . t('Argument @count', array('@count' => $count)) . '</em></td>';
- $desc = check_plain($argument['identifier']);
- if (isset($argument['keyword'])) {
- $desc .= '<div class="description">' . t('Keyword: %@keyword', array('@keyword' => $argument['keyword']));
- if (isset($contexts[ctools_context_id($argument, 'argument')])) {
- foreach (ctools_context_get_converters('%' . $argument['keyword'] . ':', $contexts[ctools_context_id($argument, 'argument')]) as $keyword => $title) {
- $desc .= '<br />' . t('@keyword --&gt; @title', array('@keyword' => $keyword, '@title' => $title));
- }
- }
- $desc .= '</div>';
- }
- $output .= '<td>' . $desc . '</td>';
- $output .= '</tr>';
- $titles[ctools_context_id($argument, 'argument')] = $argument['identifier'];
- $count++;
- }
- }
-
- $count = 1;
- // Then, make a nice list of contexts.
- if (!empty($object->contexts)) {
- foreach ($object->contexts as $context) {
- $output .= '<tr>';
- $output .= '<td valign="top"><em>' . t('Context @count', array('@count' => $count)) . '</em></td>';
- $desc = check_plain($context['identifier']);
- if (isset($context['keyword'])) {
- $desc .= '<div class="description">' . t('Keyword: %@keyword', array('@keyword' => $context['keyword']));
- foreach (ctools_context_get_converters('%' . $context['keyword'] . ':', $contexts[ctools_context_id($context, 'context')]) as $keyword => $title) {
- $desc .= '<br />' . t('@keyword --&gt; @title', array('@keyword' => $keyword, '@title' => $title));
- }
- $desc .= '</div>';
- }
- $output .= '<td>' . $desc . '</td>';
- $output .= '</tr>';
- $titles[ctools_context_id($context)] = $context['identifier'];
- $count++;
- }
- }
-
- // And relationships
- if (!empty($object->relationships)) {
- foreach ($object->relationships as $relationship) {
- $output .= '<tr>';
- if (is_array($relationship['context'])) {
- $rtitles = array();
- foreach ($relationship['context'] as $cid) {
- $rtitles[$cid] = $titles[$cid];
- }
- $title = implode(' + ', $rtitles);
- }
- else {
- $title = $titles[$relationship['context']];
- }
- $output .= '<td valign="top"><em>' . t('From "@title"', array('@title' => $title)) . '</em></td>';
- $desc = check_plain($relationship['identifier']);
- if (isset($relationship['keyword'])) {
- $desc .= '<div class="description">' . t('Keyword: %@keyword', array('@keyword' => $relationship['keyword']));
- foreach (ctools_context_get_converters('%' . $relationship['keyword'] . ':', $contexts[ctools_context_id($relationship, 'relationship')]) as $keyword => $title) {
- $desc .= '<br />' . t('@keyword --&gt; @title', array('@keyword' => $keyword, '@title' => $title));
- }
- $desc .= '</div>';
- }
- $output .= '<td>' . $desc . '</td>';
- $output .= '</tr>';
- $titles[ctools_context_id($relationship, 'relationship')] = $relationship['identifier'];
- $count++;
- }
- }
-
- $head = '';
- if ($header) {
- if ($description) {
- $header .= '<div class="description">' . $description . '</div>';
- }
- $head .= '<thead><tr>';
- $head .= '<th colspan="2">' . $header . '</th>';
- $head .= '</tr></thead>';
- }
-
- return $output ? "<table>$head<tbody>$output</tbody></table>\n" : "<table>$head</table>\n";
-}
-
-/**
- * ctools_context_list() but not in a table format because tabledrag
- * won't let us have tables within tables and still drag.
- */
-function theme_ctools_context_list_no_table($vars) {
- $object = $vars['object'];
- ctools_add_css('context');
- $titles = array();
- $output = '';
- $count = 1;
- // Describe 'built in' contexts.
- if (!empty($object->base_contexts)) {
- foreach ($object->base_contexts as $id => $context) {
- $output .= '<div class="ctools-context-holder clearfix">';
- $output .= '<div class="ctools-context-title">' . t('Built in context') . '</div>';
- $desc = check_plain($context->identifier);
- if (isset($context->keyword)) {
- $desc .= '<div class="description">' . t('Keyword: %@keyword', array('@keyword' => $context->keyword)) . '</div>';
- }
- if (isset($context->description)) {
- $desc .= '<div class="description">' . filter_xss_admin($context->description) . '</div>';
- }
- $output .= '<div class="ctools-context-content">' . $desc . '</div>';
- $output .= '</div>';
- $titles[$id] = $context->identifier;
- $count++;
- }
- }
-
- // First, make a list of arguments. Arguments are pretty simple.
- if (!empty($object->arguments)) {
- foreach ($object->arguments as $argument) {
- $output .= '<div class="ctools-context-holder clearfix">';
- $output .= '<div class="ctools-context-title">' . t('Argument @count', array('@count' => $count)) . '</div>';
- $desc = check_plain($argument['identifier']);
- if (isset($argument['keyword'])) {
- $desc .= '<div class="description">' . t('Keyword: %@keyword', array('@keyword' => $argument['keyword'])) . '</div>';
- }
- $output .= '<div class="ctools-context-content">' . $desc . '</div>';
- $output .= '</div>';
- $titles[ctools_context_id($argument, 'argument')] = $argument['identifier'];
- $count++;
- }
- }
- $count = 1;
- // Then, make a nice list of contexts.
- if (!empty($object->contexts)) {
- foreach ($object->contexts as $context) {
- $output .= '<div class="ctools-context-holder clearfix">';
- $output .= '<div class="ctools-context-title">' . t('Context @count', array('@count' => $count)) . '</div>';
- $desc = check_plain($context['identifier']);
- if (isset($context['keyword'])) {
- $desc .= '<div class="description">' . t('Keyword: %@keyword', array('@keyword' => $context['keyword'])) . '</div>';
- }
- $output .= '<div class="ctools-context-content">' . $desc . '</div>';
- $output .= '</div>';
- $titles[ctools_context_id($context)] = $context['identifier'];
- $count++;
- }
- }
- // And relationships
- if (!empty($object->relationships)) {
- foreach ($object->relationships as $relationship) {
- $output .= '<div class="ctools-context-holder clearfix">';
- if (is_array($relationship['context'])) {
- $rtitles = array();
- foreach ($relationship['context'] as $cid) {
- $rtitles[$cid] = $titles[$cid];
- }
- $title = implode(' + ', $rtitles);
- }
- else {
- $title = $titles[$relationship['context']];
- }
-
- $output .= '<div class="ctools-context-title">' . t('From "@title"', array('@title' => $title)) . '</div>';
- $desc = check_plain($relationship['identifier']);
- if (isset($relationship['keyword'])) {
- $desc .= '<div class="description">' . t('Keyword: %@keyword', array('@keyword' => $relationship['keyword'])) . '</div>';
- }
- $output .= '<div class="ctools-context-content">' . $desc . '</div>';
- $output .= '</div>';
- $titles[ctools_context_id($relationship, 'relationship')] = $relationship['identifier'];
- $count++;
- }
- }
-
- return $output;
-}
-
diff --git a/includes/css.inc b/includes/css.inc
deleted file mode 100644
index bcb75a2..0000000
--- a/includes/css.inc
+++ /dev/null
@@ -1,562 +0,0 @@
-<?php
-
-/*
- * @file
- * CSS filtering functions. Contains a disassembler, filter, compressor, and
- * decompressor.
- *
- * The general usage of this tool is:
- *
- * To simply filter CSS:
- * @code
- * $filtered_css = ctools_css_filter($css, TRUE);
- * @endcode
- *
- * In the above, if the second argument is TRUE, the returned CSS will
- * be compressed. Otherwise it will be returned in a well formatted
- * syntax.
- *
- * To cache unfiltered CSS in a file, which will be filtered:
- *
- * @code
- * $filename = ctools_css_cache($css, TRUE);
- * @endcode
- *
- * In the above, if the second argument is FALSE, the CSS will not be filtered.
- *
- * This file will be cached within the Drupal files system. This system cannot
- * detect when this file changes, so it is YOUR responsibility to remove and
- * re-cache this file when the CSS is changed. Your system should also contain
- * a backup method of re-generating the CSS cache in case it is removed, so
- * that it is easy to force a re-cache by simply deleting the contents of the
- * directory.
- *
- * Finally, if for some reason your application cannot store the filename
- * (which is true of Panels where the style can't force the display to
- * resave unconditionally) you can use the ctools storage mechanism. You
- * simply have to come up with a unique Id:
- *
- * @code
- * $filename = ctools_css_store($id, $css, TRUE);
- * @endcode
- *
- * Then later on:
- * @code
- * $filename = ctools_css_retrieve($id);
- * drupal_add_css($filename);
- * @endcode
- *
- * The CSS that was generated will be stored in the database, so even if the
- * file was removed the cached CSS will be used. If the CSS cache is
- * cleared you may be required to regenerate your CSS. This will normally
- * only be cleared by an administrator operation, not during normal usage.
- *
- * You may remove your stored CSS this way:
- *
- * @code
- * ctools_css_clear($id);
- * @endcode
- */
-
-/**
- * Store CSS with a given id and return the filename to use.
- *
- * This function associates a piece of CSS with an id, and stores the
- * cached filename and the actual CSS for later use with
- * ctools_css_retrieve.
- */
-function ctools_css_store($id, $css, $filter = TRUE) {
- $filename = db_query('SELECT filename FROM {ctools_css_cache} WHERE cid = :cid', array(':cid' => $id))->fetchField();
- if ($filename && file_exists($filename)) {
- file_unmanaged_delete($filename);
- }
- // Remove any previous records.
- db_delete('ctools_css_cache')
- ->condition('cid', $id)
- ->execute();
-
- $filename = ctools_css_cache($css, $filter);
-
- db_insert('ctools_css_cache')
- ->fields(array(
- 'cid' => $id,
- 'filename' => $filename,
- 'css' => $css,
- 'filter' => intval($filter),
- ))
- ->execute();
-
- return $filename;
-}
-
-/**
- * Retrieve a filename associated with an id of previously cached CSS.
- *
- * This will ensure the file still exists and, if not, create it.
- */
-function ctools_css_retrieve($id) {
- $cache = db_query('SELECT * FROM {ctools_css_cache} WHERE cid = :cid', array(':cid' => $id))->fetchObject();
- if (!$cache) {
- return;
- }
-
- if (!file_exists($cache->filename)) {
- $filename = ctools_css_cache($cache->css, $cache->filter);
- if ($filename != $cache->filename) {
- db_update('ctools_css_cache')
- ->fields(array('filename' => $filename))
- ->condition('cid', $id)
- ->execute();
- $cache->filename = $filename;
- }
- }
-
- return $cache->filename;
-}
-
-/**
- * Remove stored CSS and any associated file.
- */
-function ctools_css_clear($id) {
- $cache = db_query('SELECT * FROM {ctools_css_cache} WHERE cid = :cid', array(':cid' => $id))->fetchObject();
- if (!$cache) {
- return;
- }
-
- if (file_exists($cache->filename)) {
- file_unmanaged_delete($cache->filename);
- // If we remove an existing file, there may be cached pages that refer
- // to it. We must get rid of them: FIXME same format in D7?
- cache_clear_all();
- }
-
- db_delete('ctools_css_cache')
- ->condition('cid', $id)
- ->execute();
-}
-
-/**
- * Write a chunk of CSS to a temporary cache file and return the file name.
- *
- * This function optionally filters the CSS (always compressed, if so) and
- * generates a unique filename based upon md5. It returns that filename that
- * can be used with drupal_add_css(). Note that as a cache file, technically
- * this file is volatile so it should be checked before it is used to ensure
- * that it exists.
- *
- * You can use file_exists() to test for the file and file_delete() to remove
- * it if it needs to be cleared.
- *
- * @param $css
- * A chunk of well-formed CSS text to cache.
- * @param $filter
- * If TRUE the css will be filtered. If FALSE the text will be cached
- * as-is.
- *
- * @return $filename
- * The filename the CSS will be cached in.
- */
-function ctools_css_cache($css, $filter = TRUE) {
- if ($filter) {
- $css = ctools_css_filter($css);
- }
-
- // Create the css/ within the files folder.
- $path = 'public://ctools/css';
- if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
-// if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY)) {
- drupal_set_message(t('Unable to create CTools CSS cache directory. Check the permissions on your files directory.'), 'error');
- return;
- }
-
- // @todo Is this slow? Does it matter if it is?
- $filename = $path . '/' . md5($css) . '.css';
-
- // This will do renames if the file already exists, ensuring we don't
- // accidentally overwrite other files who share the same md5. Yes this
- // is a very miniscule chance but it's safe.
- $filename = file_unmanaged_save_data($css, $filename);
-
- return $filename;
-}
-
-/**
- * Filter a chunk of CSS text.
- *
- * This function disassembles the CSS into a raw format that makes it easier
- * for our tool to work, then runs it through the filter and reassembles it.
- * If you find that you want the raw data for some reason or another, you
- * can use the disassemble/assemble functions yourself.
- *
- * @param $css
- * The CSS text to filter.
- * @param $compressed
- * If true, generate compressed output; if false, generate pretty output.
- * Defaults to TRUE.
- */
-function ctools_css_filter($css, $compressed = TRUE) {
- $css_data = ctools_css_disassemble($css);
-
- // Note: By using this function yourself you can control the allowed
- // properties and values list.
- $filtered = ctools_css_filter_css_data($css_data);
-
- return $compressed ? ctools_css_compress($filtered) : ctools_css_assemble($filtered);
-}
-
-/**
- * Re-assemble a css string and format it nicely.
- *
- * @param array $css_data
- * An array of css data, as produced by @see ctools_css_disassemble()
- * disassembler and the @see ctools_css_filter_css_data() filter.
- *
- * @return string $css
- * css optimized for human viewing.
- */
-function ctools_css_assemble($css_data) {
- // Initialize the output.
- $css = '';
- // Iterate through all the statements.
- foreach ($css_data as $selector_str => $declaration) {
- // Add the selectors, separating them with commas and line feeds.
- $css .= strpos($selector_str, ',') === FALSE ? $selector_str : str_replace(", ", ",\n", $selector_str);
- // Add the opening curly brace.
- $css .= " {\n";
- // Iterate through all the declarations.
- foreach ($declaration as $property => $value) {
- $css .= " " . $property . ": " . $value . ";\n";
- }
- // Add the closing curly brace.
- $css .= "}\n\n";
- }
- // Return the output.
- return $css;
-}
-
-/**
- * Compress css data (filter it first!) to optimize for use on view.
- *
- * @param array $css_data
- * An array of css data, as produced by @see ctools_css_disassemble()
- * disassembler and the @see ctools_css_filter_css_data() filter.
- *
- * @return string $css
- * css optimized for use.
- */
-function ctools_css_compress($css_data) {
- // Initialize the output.
- $css = '';
- // Iterate through all the statements.
- foreach ($css_data as $selector_str => $declaration) {
- if (empty($declaration)) {
- // Skip this statement if filtering removed all parts of the declaration.
- continue;
- }
- // Add the selectors, separating them with commas.
- $css .= $selector_str;
- // And, the opening curly brace.
- $css .= "{";
- // Iterate through all the statement properties.
- foreach ($declaration as $property => $value) {
- $css .= $property . ':' . $value . ';';
- }
- // Add the closing curly brace.
- $css .= "}";
- }
- // Return the output.
- return $css;
-}
-
-/**
- * Disassemble the css string.
- *
- * Strip the css of irrelevant characters, invalid/malformed selectors and
- * declarations, and otherwise prepare it for processing.
- *
- * @param string $css
- * A string containing the css to be disassembled.
- *
- * @return array $disassembled_css
- * An array of disassembled, slightly cleaned-up/formatted css statements.
- */
-function ctools_css_disassemble($css) {
- $disassembled_css = array();
- // Remove comments.
- $css = preg_replace("/\/\*(.*)?\*\//Usi", "", $css);
- // Split out each statement
- $statements = explode("}", $css);
- // If we have any statements, parse them.
- if (!empty($statements)) {
- // Iterate through all of the statements.
- foreach ($statements as $statement) {
- // Get the selector(s) and declaration.
- if (empty($statement) || !strpos($statement, '{')) {
- continue;
- }
-
- list($selector_str, $declaration) = explode('{', $statement);
-
- // If the selector exists, then disassemble it, check it, and regenerate
- // the selector string.
- $selector_str = empty($selector_str) ? FALSE : _ctools_css_disassemble_selector($selector_str);
- if (empty($selector_str)) {
- // No valid selectors. Bomb out and start the next item.
- continue;
- }
-
- // Disassemble the declaration, check it and tuck it into an array.
- $disassembled_css[$selector_str] = _ctools_css_disassemble_declaration($declaration);
- }
- }
- return $disassembled_css;
-}
-
-function _ctools_css_disassemble_selector($selector_str) {
- // Get all selectors individually.
- $selectors = explode(",", trim($selector_str));
- // Iterate through all the selectors, sanity check them and return if they
- // pass. Note that this handles 0, 1, or more valid selectors gracefully.
- foreach ($selectors as $key => $selector) {
- // Replace un-needed characters and do a little cleanup.
- $selector = preg_replace("/[\n|\t|\\|\s]+/", ' ', trim($selector));
- // Make sure this is still a real selector after cleanup.
- if (!empty($selector)) {
- $selectors[$key] = $selector;
- }
- else {
- // Selector is no good, so we scrap it.
- unset($selectors[$key]);
- }
- }
- // Check for malformed selectors; if found, we skip this declaration.
- if (empty($selectors)) {
- return FALSE;
- }
- return implode(', ', $selectors);
-}
-
-function _ctools_css_disassemble_declaration($declaration) {
- $formatted_statement = array();
- $propval_pairs = explode(";", $declaration);
- // Make sure we actually have some properties to work with.
- if (!empty($propval_pairs)) {
- // Iterate through the remains and parse them.
- foreach ($propval_pairs as $key => $propval_pair) {
- // Check that we have a ':', otherwise it's an invalid pair.
- if (strpos($propval_pair, ':') === FALSE) {
- continue;
- }
- // Clean up the current property-value pair.
- $propval_pair = preg_replace("/[\n|\t|\\|\s]+/", ' ', trim($propval_pair));
- // Explode the remaining fragements some more, but clean them up first.
- list($property, $value) = explode(':', $propval_pair, 2);
- // If the property survived, toss it onto the stack.
- if (!empty($property)) {
- $formatted_statement[trim($property)] = trim($value);
- }
- }
- }
- return $formatted_statement;
-}
-
-/**
- * Run disassembled $css through the filter.
- *
- * @param $css
- * CSS code disassembled by ctools_dss_disassemble().
- * @param $allowed_properties
- * A list of properties that are allowed by the filter. If empty
- * ctools_css_filter_default_allowed_properties() will provide the
- * list.
- * @param $allowed_values
- * A list of values that are allowed by the filter. If empty
- * ctools_css_filter_default_allowed_values() will provide the
- * list.
- *
- * @return
- * An array of disassembled, filtered CSS.
- */
-function ctools_css_filter_css_data($css, $allowed_properties = array(), $allowed_values = array(), $allowed_values_regex = '', $disallowed_values_regex = '') {
-//function ctools_css_filter_css_data($css, &$filtered = NULL, $allowed_properties = array(), $allowed_values = array(), $allowed_values_regex = '', $disallowed_values_regex = '') {
- // Retrieve the default list of allowed properties if none is provided.
- $allowed_properties = !empty($allowed_properties) ? $allowed_properties : ctools_css_filter_default_allowed_properties();
- // Retrieve the default list of allowed values if none is provided.
- $allowed_values = !empty($allowed_values) ? $allowed_values : ctools_css_filter_default_allowed_values();
- // Define allowed values regex if none is provided.
- $allowed_values_regex = !empty($allowed_values_regex) ? $allowed_values_regex : '/(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)/';
- // Define disallowed url() value contents, if none is provided.
- // $disallowed_values_regex = !empty($disallowed_values_regex) ? $disallowed_values_regex : '/[url|expression]\s*\(\s*[^\s)]+?\s*\)\s*/';
- $disallowed_values_regex = !empty($disallowed_values_regex) ? $disallowed_values_regex : '/(url|expression)/';
-
- foreach ($css as $selector_str => $declaration) {
- foreach ($declaration as $property => $value) {
- if (!in_array($property, $allowed_properties)) {
- // $filtered['properties'][$selector_str][$property] = $value;
- unset($css[$selector_str][$property]);
- continue;
- }
- $value = str_replace('!important', '', $value);
- if (preg_match($disallowed_values_regex, $value) || !(in_array($value, $allowed_values) || preg_match($allowed_values_regex, $value))) {
- // $filtered['values'][$selector_str][$property] = $value;
- unset($css[$selector_str][$property]);
- continue;
- }
- }
- }
- return $css;
-}
-
-/**
- * Provide a deafult list of allowed properties by the filter.
- */
-function ctools_css_filter_default_allowed_properties() {
- return array(
- 'azimuth',
- 'background',
- 'background-color',
- 'background-image',
- 'background-repeat',
- 'background-attachment',
- 'background-position',
- 'border',
- 'border-top-width',
- 'border-right-width',
- 'border-bottom-width',
- 'border-left-width',
- 'border-width',
- 'border-top-color',
- 'border-right-color',
- 'border-bottom-color',
- 'border-left-color',
- 'border-color',
- 'border-top-style',
- 'border-right-style',
- 'border-bottom-style',
- 'border-left-style',
- 'border-style',
- 'border-top',
- 'border-right',
- 'border-bottom',
- 'border-left',
- 'clear',
- 'color',
- 'cursor',
- 'direction',
- 'display',
- 'elevation',
- 'float',
- 'font',
- 'font-family',
- 'font-size',
- 'font-style',
- 'font-variant',
- 'font-weight',
- 'height',
- 'letter-spacing',
- 'line-height',
- 'margin',
- 'margin-top',
- 'margin-right',
- 'margin-bottom',
- 'margin-left',
- 'overflow',
- 'padding',
- 'padding-top',
- 'padding-right',
- 'padding-bottom',
- 'padding-left',
- 'pause',
- 'pause-after',
- 'pause-before',
- 'pitch',
- 'pitch-range',
- 'richness',
- 'speak',
- 'speak-header',
- 'speak-numeral',
- 'speak-punctuation',
- 'speech-rate',
- 'stress',
- 'text-align',
- 'text-decoration',
- 'text-indent',
- 'text-transform',
- 'unicode-bidi',
- 'vertical-align',
- 'voice-family',
- 'volume',
- 'white-space',
- 'width',
- 'fill',
- 'fill-opacity',
- 'fill-rule',
- 'stroke',
- 'stroke-width',
- 'stroke-linecap',
- 'stroke-linejoin',
- 'stroke-opacity',
- );
-}
-
-/**
- * Provide a default list of allowed values by the filter.
- */
-function ctools_css_filter_default_allowed_values() {
- return array(
- 'auto',
- 'aqua',
- 'black',
- 'block',
- 'blue',
- 'bold',
- 'both',
- 'bottom',
- 'brown',
- 'capitalize',
- 'center',
- 'collapse',
- 'dashed',
- 'dotted',
- 'fuchsia',
- 'gray',
- 'green',
- 'italic',
- 'inherit',
- 'left',
- 'lime',
- 'lowercase',
- 'maroon',
- 'medium',
- 'navy',
- 'normal',
- 'nowrap',
- 'olive',
- 'pointer',
- 'purple',
- 'red',
- 'right',
- 'solid',
- 'silver',
- 'teal',
- 'top',
- 'transparent',
- 'underline',
- 'uppercase',
- 'white',
- 'yellow',
- );
-}
-
-/**
- * Delegated implementation of hook_flush_caches()
- */
-function ctools_css_flush_caches() {
- // Remove all generated files.
- // @see http://drupal.org/node/573292
- // file_unmanaged_delete_recursive('public://render');
- $filedir = file_default_scheme() . '://ctools/css';
- file_unmanaged_delete_recursive($filedir);
-
- db_delete('ctools_css_cache')->execute();
-}
diff --git a/includes/dependent.inc b/includes/dependent.inc
deleted file mode 100644
index 7212e28..0000000
--- a/includes/dependent.inc
+++ /dev/null
@@ -1,154 +0,0 @@
-<?php
-
-/**
- * @file
- * Provide dependent checkboxes that can be easily used in forms.
- *
- * This system will ensure that form items are invisible if the dependency is
- * not met. What this means is that you set the #dependency of an item to a
- * list of form ids that must be set, and the list of values that qualify.
- *
- * For a simple use, setting an item to be dependent upon a select box, if
- * any of the listed values are selected, the item will be visible. Otherwise,
- * the item will be invisible.
- *
- * If dependent upon multiple items, use #dependency_count = X to set the
- * number of items that must be set in order to make this item visible. This
- * defaults to 1. If set to 2, then at least 2 form items in the list must
- * have their items set for the item to become visible.
- *
- * When hiding checkboxes and radios you need to add their id in a div
- * manually via #prefix and #suffix since they don't have their own id. You
- * actually need to add TWO divs because it's the parent that gets hidden.
- * Also be sure to retain the 'expand_checkboxes' in the #process array,
- * because the views process will override it.
- *
- * Fieldsets can not be hidden by default. Adding '#input' => TRUE to the
- * fieldset works around that.
- *
- * For radios, because they are selected a little bit differently, instead of
- * using the CSS id, use: radio:NAME where NAME is the #name of the property.
- * This can be quickly found by looking at the HTML of the generated form, but
- * it is usually derived from the array which contains the item. For example,
- * $form['menu']['type'] would have a name of menu[type]. This name is the same
- * field that is used to determine where in $form_state['values'] you will find
- * the value of the form.
- *
- * The item that is dependent on, should be set to #tree = TRUE.
- *
- * Usage:
- *
- * First, ensure this tool is loaded:
- * @code { ctools_include('dependent'); }
- *
- * On any form item, add
- * - @code '#process' => array('ctools_dependent_process'), @endcode
- * - @code '#dependency' => array('id-of-form-without-the-#' => array(list, of, values, that, make, this, gadget, visible)), @endcode
- *
- * A fuller example, that hides the menu title when no menu is selected:
- * @code
- *function ctools_dependent_example() {
- * $form = array();
- * $form['menu'] = array(
- * '#type' => 'fieldset',
- * '#title' => t('Menu settings'),
- * '#tree' => TRUE,
- * );
- * $form['menu']['type'] = array(
- * '#title' => t('Menu type'),
- * '#type' => 'radios',
- * '#options' => array(
- * 'none' => t('No menu entry'),
- * 'normal' => t('Normal menu entry'),
- * 'tab' => t('Menu tab'),
- * 'default tab' => t('Default menu tab'),
- * ),
- * '#default_value' => 'none',
- * );
- *
- * $form['menu']['title'] = array(
- * '#title' => t('Title'),
- * '#type' => 'textfield',
- * '#default_value' => '',
- * '#description' => t('If set to normal or tab, enter the text to use for the menu item.'),
- * '#process' => array('ctools_dependent_process'),
- * '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')),
- * );
- *
- * return system_settings_form($form);
- *}
- * @endcode
- *
- * An example for hiding checkboxes using #prefix and #suffix:
- * @code
- *function ctools_dependent_example_checkbox() {
- * $form = array();
- * $form['object'] = array(
- * '#type' => 'fieldset',
- * '#title' => t('Select object type'),
- * '#tree' => TRUE,
- * );
- * $form['object']['type'] = array(
- * '#title' => t('Object type'),
- * '#type' => 'radios',
- * '#options' => array(
- * 'view' => t('View'),
- * 'node' => t('Node'),
- * 'field' => t('Field'),
- * 'term' => t('Term'),
- * ),
- * '#default_value' => 'view',
- * );
- *
- * $form['object']['elements'] = array(
- * '#title' => t('Select the elements to load from the node.'),
- * '#type' => 'checkboxes',
- * '#prefix' => '<div id="edit-elements-wrapper"><div id="edit-elements">',
- * '#suffix' => '</div></div>',
- * '#process' => array('ctools_dependent_process', 'expand_checkboxes'),
- * '#dependency' => array('radio:menu[type]' => array('node')),
- * '#options' => array(
- * 'body' => t('Body'),
- * 'fields' => t('Fields'),
- * 'taxonomy' => t('Taxonomy'),
- * ),
- * '#default_value' => array('body', 'fields'),
- * );
- *
- * return system_settings_form($form);
- *}
- * @endcode
- */
-
-/**
- * Process callback to add dependency to form items.
- */
-function ctools_dependent_process($element, &$form_state, &$form) {
- if (isset($element['#dependency'])) {
- // Don't actually add any javascript until render time.
- $element['#pre_render'][] = 'ctools_dependent_pre_render';
- }
-
- return $element;
-}
-
-function ctools_dependent_pre_render($element) {
- if (!isset($element['#dependency_count'])) {
- $element['#dependency_count'] = 1;
- }
- if (!isset($element['#dependency_type'])) {
- $element['#dependency_type'] = 'hide';
- }
-
- $js = array(
- 'values' => $element['#dependency'],
- 'num' => $element['#dependency_count'],
- 'type' => $element['#dependency_type'],
- );
-
- ctools_add_js('dependent');
- $options['CTools']['dependent'][$element['#id']] = $js;
- drupal_add_js($options, 'setting');
-
- return $element;
-}
diff --git a/includes/dropdown.theme.inc b/includes/dropdown.theme.inc
deleted file mode 100644
index 2e21559..0000000
--- a/includes/dropdown.theme.inc
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-/**
- * @file
- * Provide a javascript based dropdown menu.
- *
- * The dropdown menu will show up as a clickable link; when clicked,
- * a small menu will slide down beneath it, showing the list of links.
- *
- * The dropdown will stay open until either the user has moved the mouse
- * away from the box for > .5 seconds, or can be immediately closed by
- * clicking the link again. The code is smart enough that if the mouse
- * moves away and then back within the .5 second window, it will not
- * re-close.
- *
- * Multiple dropdowns can be placed per page.
- *
- * If the user does not have javascript enabled, the link will not appear,
- * and instead by default the list of links will appear as a normal inline
- * list.
- *
- * The menu is heavily styled by default, and to make it look different
- * will require a little bit of CSS. You can apply your own class to the
- * dropdown to help ensure that your CSS can override the dropdown's CSS.
- *
- * In particular, the text, link, background and border colors may need to
- * be changed. Please see dropdown.css for information about the existing
- * styling.
- */
-
-/**
- * Delegated implementation of hook_theme()
- */
-function ctools_dropdown_theme(&$items) {
- $items['ctools_dropdown'] = array(
- 'variables' => array('title' => NULL, 'links' => NULL, 'image' => FALSE, 'class' => ''),
- 'file' => 'includes/dropdown.theme.inc',
- );
-}
-
-/**
- * Create a dropdown menu.
- *
- * @param $title
- * The text to place in the clickable area to activate the dropdown.
- * @param $links
- * A list of links to provide within the dropdown, suitable for use
- * in via Drupal's theme('links').
- * @param $image
- * If true, the dropdown link is an image and will not get extra decorations
- * that a text dropdown link will.
- * @param $class
- * An optional class to add to the dropdown's container div to allow you
- * to style a single dropdown however you like without interfering with
- * other dropdowns.
- */
-function theme_ctools_dropdown($vars) {
- // Provide a unique identifier for every dropdown on the page.
- static $id = 0;
- $id++;
-
- $class = 'ctools-dropdown-no-js ctools-dropdown' . ($vars['class'] ? (' ' . $vars['class']) : '');
-
- ctools_add_js('dropdown');
- ctools_add_css('dropdown');
-
- $output = '';
-
- $output .= '<div class="' . $class . '" id="ctools-dropdown-' . $id . '">';
- $output .= '<div class="ctools-dropdown-link-wrapper">';
- if ($vars['image']) {
- $output .= '<a href="#" class="ctools-dropdown-link ctools-dropdown-image-link">' . $vars['title'] . '</a>';
- }
- else {
- $output .= '<a href="#" class="ctools-dropdown-link ctools-dropdown-text-link">' . check_plain($vars['title']) . '</a>';
- }
-
- $output .= '</div>'; // wrapper
- $output .= '<div class="ctools-dropdown-container-wrapper">';
- $output .= '<div class="ctools-dropdown-container">';
- $output .= theme_links(array('links' => $vars['links'], 'attributes' => array(), 'heading' => ''));
- $output .= '</div>'; // container
- $output .= '</div>'; // container wrapper
- $output .= '</div>'; // dropdown
- return $output;
-}
-
diff --git a/includes/export-ui.inc b/includes/export-ui.inc
deleted file mode 100644
index 0987a15..0000000
--- a/includes/export-ui.inc
+++ /dev/null
@@ -1,466 +0,0 @@
-<?php
-
-/**
- * @file
- * Provide a tool for creating UIs for exportable objects.
- *
- * See Advanced Help for documentation.
- */
-
-/**
- * Process an export-ui plugin to provide it with defaults.
- */
-function ctools_export_ui_process(&$plugin, $info) {
- ctools_include('export');
-
- $plugin += array(
- 'has menu' => TRUE,
- 'title' => $plugin['name'],
- 'export' => array(),
- 'allowed operations' => array(),
- 'menu' => array(),
- 'form' => array(),
- 'strings' => array(),
- 'list' => NULL,
- 'access' => 'administer site configuration',
- );
-
- // Provide CRUD access defaults based on the base 'access' setting:
- $plugin += array(
- 'create access' => $plugin['access'],
- 'delete access' => $plugin['access'],
- );
-
- if (empty($plugin['has menu'])) {
- return;
- }
-
- // The following keys are required and the plugin cannot be processed
- // without them.
- $keys = array(
- 'title singular',
- 'title plural',
- 'title singular proper',
- 'title plural proper',
- 'schema',
- );
-
- foreach ($keys as $key) {
- if (empty($plugin[$key])) {
- drupal_set_message(t('The plugin definition of @plugin is missing the %key key.', array('%key' => $key, '@plugin' => $plugin['name'])), 'error');
- }
- }
-
- // If we're on the modules page and building a menu, there is a design flaw
- // in Drupal core that causes modules to be installed but the schema does
- // not become available until AFTER menu rebuild. This helps smooth that
- // out. This is a HACK but it should work:
- $schema = ctools_export_get_schema($plugin['schema']);
-
- if (empty($schema)) {
- // If we're updating the schema may not have been read yet, so don't report this error in that case.
- if (!defined('MAINTENANCE_MODE')) {
- drupal_set_message(t('The plugin definition of @plugin cannot locate schema %schema.', array('%schema' => $plugin['schema'], '@plugin' => $plugin['name'])), 'error');
- }
- return;
- }
-
- if (empty($schema['export'])) {
- drupal_set_message(t('The plugin definition of @plugin uses %schema, but it has no export section.', array('%schema' => $plugin['schema'], '@plugin' => $plugin['name'])), 'error');
- return;
- }
-
- $plugin['export'] += array(
- // Add the identifier key from the schema so we don't have to call
- // ctools_export_get_schema() just for that.
- 'key' => $schema['export']['key'],
- );
-
- // Add some default fields that appear often in exports
- // If these use different keys they can easily be specified in the
- // $plugin.
-
- if (empty($plugin['export']['admin_title']) && !empty($schema['fields']['admin_title'])) {
- $plugin['export']['admin_title'] = 'admin_title';
- }
- if (empty($plugin['export']['admin_description']) && !empty($schema['fields']['admin_description'])) {
- $plugin['export']['admin_description'] = 'admin_description';
- }
-
- // Define allowed operations, and the name of the operations.
- $plugin['allowed operations'] += array(
- 'edit' => array('title' => t('Edit')),
- 'enable' => array('title' => t('Enable'), 'ajax' => TRUE, 'token' => TRUE),
- 'disable' => array('title' => t('Disable'), 'ajax' => TRUE, 'token' => TRUE),
- 'revert' => array('title' => t('Revert')),
- 'delete' => array('title' => t('Delete')),
- 'clone' => array('title' => t('Clone')),
- 'import' => array('title' => t('Import')),
- 'export' => array('title' => t('Export')),
- );
-
- $plugin['menu'] += array(
- 'menu item' => str_replace(' ', '-', $plugin['name']),
- 'menu prefix' => 'admin/structure',
- 'menu title' => $plugin['title'],
- 'menu description' => '',
- );
- $base_path = ctools_export_ui_plugin_base_path($plugin);
- $prefix_count = count(explode('/', $plugin['menu']['menu prefix']));
-
- $plugin['menu'] += array(
- // Default menu items that should be declared.
- 'items' => array(),
- );
-
- $plugin['menu']['items'] += array(
- 'list callback' => array(
- 'path' => '',
- // Menu items are translated by the menu system.
- // TODO: We need more flexibility in title. The title of the admin page
- // is not necessarily the title of the object, plus we need
- // plural, singular, proper, not proper, etc.
- 'title' => $plugin['menu']['menu title'],
- 'description' => $plugin['menu']['menu description'],
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'list'),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'list'),
- 'type' => MENU_NORMAL_ITEM,
- ),
- 'list' => array(
- 'path' => 'list',
- 'title' => 'List',
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'list'),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'list'),
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- 'weight' => -10,
- ),
- 'add' => array(
- 'path' => 'add',
- 'title' => 'Add',
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'add'),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'add'),
- 'type' => MENU_LOCAL_ACTION,
- ),
- 'edit callback' => array(
- 'path' => 'list/%ctools_export_ui',
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'edit', $prefix_count + 2),
- 'load arguments' => array($plugin['name']),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'edit', $prefix_count + 2),
- 'type' => MENU_CALLBACK,
- ),
- 'edit' => array(
- 'path' => 'list/%ctools_export_ui/edit',
- 'title' => 'Edit',
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'edit', $prefix_count + 2),
- 'load arguments' => array($plugin['name']),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'edit', $prefix_count + 2),
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- ),
- );
-
- if ($plugin['allowed operations']['import']) {
- $plugin['menu']['items'] += array(
- 'import' => array(
- 'path' => 'import',
- 'title' => 'Import',
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'import'),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'import'),
- 'type' => MENU_LOCAL_ACTION,
- ),
- );
- }
-
- if ($plugin['allowed operations']['export']) {
- $plugin['menu']['items'] += array(
- 'export' => array(
- 'path' => 'list/%ctools_export_ui/export',
- 'title' => 'Export',
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'export', $prefix_count + 2),
- 'load arguments' => array($plugin['name']),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'export', $prefix_count + 2),
- 'type' => MENU_LOCAL_TASK,
- ),
- );
- }
-
- if ($plugin['allowed operations']['revert']) {
- $plugin['menu']['items'] += array(
- 'revert' => array(
- 'path' => 'list/%ctools_export_ui/revert',
- 'title' => 'Revert',
- 'page callback' => 'ctools_export_ui_switcher_page',
- // Note: Yes, 'delete' op is correct.
- 'page arguments' => array($plugin['name'], 'delete', $prefix_count + 2),
- 'load arguments' => array($plugin['name']),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'revert', $prefix_count + 2),
- 'type' => MENU_CALLBACK,
- ),
- );
- }
-
- if ($plugin['allowed operations']['delete']) {
- $plugin['menu']['items'] += array(
- 'delete' => array(
- 'path' => 'list/%ctools_export_ui/delete',
- 'title' => 'Delete',
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'delete', $prefix_count + 2),
- 'load arguments' => array($plugin['name']),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'delete', $prefix_count + 2),
- 'type' => MENU_CALLBACK,
- ),
- );
- }
-
- if ($plugin['allowed operations']['clone']) {
- $plugin['menu']['items'] += array(
- 'clone' => array(
- 'path' => 'list/%ctools_export_ui/clone',
- 'title' => 'Clone',
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'clone', $prefix_count + 2),
- 'load arguments' => array($plugin['name']),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'clone', $prefix_count + 2),
- 'type' => MENU_CALLBACK,
- ),
- );
- }
-
- if ($plugin['allowed operations']['enable']) {
- $plugin['menu']['items'] += array(
- 'enable' => array(
- 'path' => 'list/%ctools_export_ui/enable',
- 'title' => 'Enable',
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'enable', $prefix_count + 2),
- 'load arguments' => array($plugin['name']),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'enable', $prefix_count + 2),
- 'type' => MENU_CALLBACK,
- ),
- );
- }
-
- if ($plugin['allowed operations']['disable']) {
- $plugin['menu']['items'] += array(
- 'disable' => array(
- 'path' => 'list/%ctools_export_ui/disable',
- 'title' => 'Disable',
- 'page callback' => 'ctools_export_ui_switcher_page',
- 'page arguments' => array($plugin['name'], 'disable', $prefix_count + 2),
- 'load arguments' => array($plugin['name']),
- 'access callback' => 'ctools_export_ui_task_access',
- 'access arguments' => array($plugin['name'], 'disable', $prefix_count + 2),
- 'type' => MENU_CALLBACK,
- ),
- );
- }
-
- // Define some redirects that should happen after edit/add/clone operations.
- $plugin['redirect'] = array(
- 'add' => $base_path,
- 'clone' => $base_path,
- 'edit' => $base_path,
- 'import' => $base_path,
- );
-
- // Define form elements.
- $plugin['form'] += array(
- 'settings' => function_exists($plugin['name'] . '_form') ? $plugin['name'] . '_form' : '',
- 'validate' => function_exists($plugin['name'] . '_form_validate') ? $plugin['name'] . '_form_validate' : '',
- 'submit' => function_exists($plugin['name'] . '_form_submit') ? $plugin['name'] . '_form_submit' : '',
- );
-
- // Define strings.
-
- // For all strings, %title may be filled in at a later time via str_replace
- // since we do not know the title now.
- $plugin['strings'] += array(
- 'title' => array(),
- 'confirmation' => array(),
- 'help' => array(),
- 'message' => array(),
- );
-
- // Strings used in drupal_set_title().
- $plugin['strings']['title'] += array(
- 'add' => t('Add a new @plugin', array('@plugin' => $plugin['title singular'])),
- // The "%title" will be replaced in ctools_export_ui_form(), as in this
- // stage we dont have the specific exportable object.
- 'edit' => t('Edit @plugin %title', array('@plugin' => $plugin['title singular'])),
- 'clone' => t('Clone @plugin %title', array('@plugin' => $plugin['title singular'])),
-
- 'import' => t('Import @plugin', array('@plugin' => $plugin['title singular'])),
- 'export' => t('Export @plugin %title', array('@plugin' => $plugin['title singular'])),
- );
-
- // Strings used in confirmation pages.
- $plugin['strings']['confirmation'] += array(
- 'revert' => array(),
- 'delete' => array(),
- 'add' => array(),
- 'edit' => array(),
- );
-
- $plugin['strings']['confirmation']['revert'] += array(
- 'question' => t('Are you sure you want to revert %title?'),
- 'information' => t('This action will permanently remove any customizations made to this item.'),
- 'success' => t('The item has been reverted.'),
- );
-
- $plugin['strings']['confirmation']['delete'] += array(
- 'question' => t('Are you sure you want to delete %title?'),
- 'information' => t('This action will permanently remove this item from your database..'),
- 'success' => t('The item has been deleted.'),
- );
-
- $plugin['strings']['confirmation']['add'] += array(
- 'success' => t('%title has been created.'),
- 'fail' => t('%title could not be created.'),
- );
-
- $plugin['strings']['confirmation']['edit'] += array(
- 'success' => t('%title has been updated.'),
- 'fail' => t('%title could not be updated.'),
- );
-
- // Strings used in $forms.
- $plugin['strings']['help'] += array(
- 'import' => t('You can import an exported definition by pasting the exported object code into the field below.'),
- );
-
- // Strings used in drupal_set_message().
- $plugin['strings']['message'] += array(
- 'enable' => t('@plugin %title was enabled.', array('@plugin' => $plugin['title singular proper'])),
- 'disable' => t('@plugin %title was disabled.', array('@plugin' => $plugin['title singular proper'])),
- );
-}
-
-/**
- * Get the class to handle creating a list of exportable items.
- *
- * If a plugin does not define a lister class at all, then the default
- * lister class will be used.
- *
- * @return
- * Either the lister class or FALSE if one could not be had.
- */
-function ctools_export_ui_get_handler($plugin) {
- $cache = &drupal_static(__FUNCTION__, array());
- if (empty($cache[$plugin['name']])) {
- // If a list class is not specified by the plugin, fall back to the
- // default ctools_export_ui plugin instead.
- if (empty($plugin['handler'])) {
- $default = ctools_get_export_ui('ctools_export_ui');
- $class = ctools_plugin_get_class($default, 'handler');
- }
- else {
- $class = ctools_plugin_get_class($plugin, 'handler');
- }
-
- if ($class) {
- $cache[$plugin['name']] = new $class();
- $cache[$plugin['name']]->init($plugin);
- }
- }
- return !empty($cache[$plugin['name']]) ? $cache[$plugin['name']] : FALSE;
-}
-
-/**
- * Get the base path from a plugin.
- *
- * @param $plugin
- * The plugin.
- *
- * @return
- * The menu path to the plugin's list.
- */
-function ctools_export_ui_plugin_base_path($plugin) {
- return $plugin['menu']['menu prefix'] . '/' . $plugin['menu']['menu item'];
-}
-
-/**
- * Get the path to a specific menu item from a plugin.
- *
- * @param $plugin
- * The plugin name.
- * @param $item_id
- * The id in the menu items from the plugin.
- * @param $export_key
- * The export key of the item being edited, if it exists.
- * @return
- * The menu path to the plugin's list.
- */
-function ctools_export_ui_plugin_menu_path($plugin, $item_id, $export_key = NULL) {
- $path = $plugin['menu']['items'][$item_id]['path'];
- if ($export_key) {
- $path = str_replace('%ctools_export_ui', $export_key, $path);
- }
- return ctools_export_ui_plugin_base_path($plugin) . '/' . $path;
-}
-
-/**
- * Helper function to include CTools plugins and get an export-ui exportable.
- *
- * @param $plugin_name
- * The plugin that should be laoded.
- */
-function ctools_get_export_ui($plugin_name) {
- ctools_include('plugins');
- return ctools_get_plugins('ctools', 'export_ui', $plugin_name);
-
-}
-
-/**
- * Helper function to include CTools plugins and get all export-ui exportables.
- */
-function ctools_get_export_uis() {
- ctools_include('plugins');
- return ctools_get_plugins('ctools', 'export_ui');
-}
-
-/**
- * Main page callback to manipulate exportables.
- *
- * This simply loads the object defined in the plugin and hands it off to
- * a method based upon the name of the operation in use. This can easily
- * be used to add more ops.
- */
-function ctools_export_ui_switcher_page($plugin_name, $op) {
- $args = func_get_args();
- $js = !empty($_REQUEST['js']);
-
- // Load the $plugin information
- $plugin = ctools_get_export_ui($plugin_name);
- $handler = ctools_export_ui_get_handler($plugin);
-
- if ($handler) {
- $method = $op . '_page';
- if (method_exists($handler, $method)) {
- // replace the first two arguments:
- $args[0] = $js;
- $args[1] = $_POST;
- return call_user_func_array(array($handler, $method), $args);
- }
- }
- else {
- return t('Configuration error. No handler found.');
- }
-}
diff --git a/includes/export-ui.menu.inc b/includes/export-ui.menu.inc
deleted file mode 100644
index d27bf15..0000000
--- a/includes/export-ui.menu.inc
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * Delegated implementation of hook_menu().
- */
-function ctools_export_ui_menu(&$items) {
- ctools_include('export-ui');
-
- // If a menu rebuild is triggered because of module enable/disable,
- // this might be out of date. Reset the cache.
- ctools_include('plugins');
- ctools_get_plugins_reset();
-
- foreach (ctools_get_export_uis() as $plugin) {
- // We also need to make sure that the module hasn't been disabled. During
- // the disable process, the module's plugins still still appear.
- if ($plugin['has menu'] && module_exists($plugin['module'])) {
- $handler = ctools_export_ui_get_handler($plugin);
- if ($handler) {
- $handler->hook_menu($items);
- }
- }
- }
-}
diff --git a/includes/export-ui.plugin-type.inc b/includes/export-ui.plugin-type.inc
deleted file mode 100644
index f1a7510..0000000
--- a/includes/export-ui.plugin-type.inc
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains plugin type registration information for the context tool.
- *
- * Don't actually need to declare anything for these plugin types right now,
- * apart from the fact that they exist. So, an empty array.
- */
-
-function ctools_export_ui_plugin_type(&$items) {
- $items['export_ui'] = array(
- 'process' => array(
- 'function' => 'ctools_export_ui_process',
- 'file' => 'export-ui.inc',
- 'path' => drupal_get_path('module', 'ctools') . '/includes',
- ),
- 'classes' => array('handler'),
- );
-} \ No newline at end of file
diff --git a/includes/export.inc b/includes/export.inc
deleted file mode 100644
index d93b2a4..0000000
--- a/includes/export.inc
+++ /dev/null
@@ -1,1015 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains code to make it easier to have exportable objects.
- *
- * Documentation for exportable objects is contained in help/export.html
- */
-
-/**
- * A bit flag used to let us know if an object is in the database.
- */
-define('EXPORT_IN_DATABASE', 0x01);
-
-/**
- * A bit flag used to let us know if an object is a 'default' in code.
- */
-define('EXPORT_IN_CODE', 0x02);
-
-/**
- * @defgroup export_crud CRUD functions for export.
- * @{
- * export.inc supports a small number of CRUD functions that should always
- * work for every exportable object, no matter how complicated. These
- * functions allow complex objects to provide their own callbacks, but
- * in most cases, the default callbacks will be used.
- *
- * Note that defaults are NOT set in the $schema because it is presumed
- * that a module's personalized CRUD functions will already know which
- * $table to use and not want to clutter up the arguments with it.
- */
-
-/**
- * Create a new object for the given $table.
- *
- * @param $table
- * The name of the table to use to retrieve $schema values. This table
- * must have an 'export' section containing data or this function
- * will fail.
- * @param $set_defaults
- * If TRUE, which is the default, then default values will be retrieved
- * from schema fields and set on the object.
- *
- * @return
- * The loaded object.
- */
-function ctools_export_crud_new($table, $set_defaults = TRUE) {
- $schema = ctools_export_get_schema($table);
- $export = $schema['export'];
-
- if (!empty($export['create callback']) && function_exists($export['create callback'])) {
- return $export['create callback']($set_defaults);
- }
- else {
- return ctools_export_new_object($table, $set_defaults);
- }
-}
-
-/**
- * Load a single exportable object.
- *
- * @param $table
- * The name of the table to use to retrieve $schema values. This table
- * must have an 'export' section containing data or this function
- * will fail.
- * @param $name
- * The unique ID to load. The field for this ID will be specified by
- * the export key, which normally defaults to 'name'.
- *
- * @return
- * The loaded object.
- */
-function ctools_export_crud_load($table, $name) {
- $schema = ctools_export_get_schema($table);
- $export = $schema['export'];
-
- if (!empty($export['load callback']) && function_exists($export['load callback'])) {
- return $export['load callback']($name);
- }
- else {
- $result = ctools_export_load_object($table, 'names', array($name));
- if (isset($result[$name])) {
- return $result[$name];
- }
- }
-}
-
-/**
- * Load all exportable objects of a given type.
- *
- * @param $table
- * The name of the table to use to retrieve $schema values. This table
- * must have an 'export' section containing data or this function
- * will fail.
- * @param $reset
- * If TRUE, the static cache of all objects will be flushed prior to
- * loading all. This can be important on listing pages where items
- * might have changed on the page load.
- * @return
- * An array of all loaded objects, keyed by the unique IDs of the export key.
- */
-function ctools_export_crud_load_all($table, $reset = FALSE) {
- $schema = ctools_export_get_schema($table);
- if (empty($schema['export'])) {
- return array();
- }
-
- $export = $schema['export'];
-
- if ($reset) {
- ctools_export_load_object_reset($table);
- }
-
- if (!empty($export['load all callback']) && function_exists($export['load all callback'])) {
- return $export['load all callback']($reset);
- }
- else {
- return ctools_export_load_object($table, 'all');
- }
-}
-
-/**
- * Save a single exportable object.
- *
- * @param $table
- * The name of the table to use to retrieve $schema values. This table
- * must have an 'export' section containing data or this function
- * will fail.
- * @param $object
- * The fully populated object to save.
- *
- * @return
- * Failure to write a record will return FALSE. Otherwise SAVED_NEW or
- * SAVED_UPDATED is returned depending on the operation performed. The
- * $object parameter contains values for any serial fields defined by the $table
- */
-function ctools_export_crud_save($table, &$object) {
- $schema = ctools_export_get_schema($table);
- $export = $schema['export'];
-
- if (!empty($export['save callback']) && function_exists($export['save callback'])) {
- return $export['save callback']($object);
- }
- else {
- // Objects should have a serial primary key. If not, simply fail to write.
- if (empty($export['primary key'])) {
- return FALSE;
- }
-
- $key = $export['primary key'];
- if ($object->export_type & EXPORT_IN_DATABASE) {
- // Existing record.
- $update = array($key);
- }
- else {
- // New record.
- $update = array();
- $object->export_type = EXPORT_IN_DATABASE;
- }
- return drupal_write_record($table, $object, $update);
- }
-}
-
-/**
- * Delete a single exportable object.
- *
- * This only deletes from the database, which means that if an item is in
- * code, then this is actually a revert.
- *
- * @param $table
- * The name of the table to use to retrieve $schema values. This table
- * must have an 'export' section containing data or this function
- * will fail.
- * @param $object
- * The fully populated object to delete, or the export key.
- */
-function ctools_export_crud_delete($table, $object) {
- $schema = ctools_export_get_schema($table);
- $export = $schema['export'];
-
- if (!empty($export['delete callback']) && function_exists($export['delete callback'])) {
- return $export['delete callback']($object);
- }
- else {
- // If we were sent an object, get the export key from it. Otherwise
- // assume we were sent the export key.
- $value = is_object($object) ? $object->{$export['key']} : $object;
- db_delete($table)
- ->condition($export['key'], $value)
- ->execute();
- }
-}
-
-/**
- * Get the exported code of a single exportable object.
- *
- * @param $table
- * The name of the table to use to retrieve $schema values. This table
- * must have an 'export' section containing data or this function
- * will fail.
- * @param $object
- * The fully populated object to delete, or the export key.
- * @param $indent
- * Any indentation to apply to the code, in case this object is embedded
- * into another, for example.
- *
- * @return
- * A string containing the executable export of the object.
- */
-function ctools_export_crud_export($table, $object, $indent = '') {
- $schema = ctools_export_get_schema($table);
- $export = $schema['export'];
-
- if (!empty($export['export callback']) && function_exists($export['export callback'])) {
- return $export['export callback']($object, $indent);
- }
- else {
- return ctools_export_object($table, $object, $indent);
- }
-}
-
-/**
- * Turn exported code into an object.
- *
- * Note: If the code is poorly formed, this could crash and there is no
- * way to prevent this.
- *
- * @param $table
- * The name of the table to use to retrieve $schema values. This table
- * must have an 'export' section containing data or this function
- * will fail.
- * @param $code
- * The code to eval to create the object.
- *
- * @return
- * An object created from the export. This object will NOT have been saved
- * to the database. In the case of failure, a string containing all errors
- * that the system was able to determine.
- */
-function ctools_export_crud_import($table, $code) {
- $schema = ctools_export_get_schema($table);
- $export = $schema['export'];
-
- if (!empty($export['import callback']) && function_exists($export['import callback'])) {
- return $export['import callback']($code);
- }
- else {
- ob_start();
- eval($code);
- ob_end_clean();
-
- if (empty(${$export['identifier']})) {
- $errors = ob_get_contents();
- if (empty($errors)) {
- $errors = t('No item found.');
- }
- return $errors;
- }
-
- $item = ${$export['identifier']};
-
- // Set these defaults just the same way that ctools_export_new_object sets
- // them.
- $item->export_type = NULL;
- $item->type = t('Local');
-
- return $item;
- }
-}
-
-/**
- * @}
- */
-
-/**
- * Load some number of exportable objects.
- *
- * This function will cache the objects, load subsidiary objects if necessary,
- * check default objects in code and properly set them up. It will cache
- * the results so that multiple calls to load the same objects
- * will not cause problems.
- *
- * It attempts to reduce, as much as possible, the number of queries
- * involved.
- *
- * @param $table
- * The name of the table to be loaded from. Data is expected to be in the
- * schema to make all this work.
- * @param $type
- * A string to notify the loader what the argument is
- * - all: load all items. This is the default. $args is unused.
- * - names: $args will be an array of specific named objects to load.
- * - conditions: $args will be a keyed array of conditions. The conditions
- * must be in the schema for this table or errors will result.
- * @param $args
- * An array of arguments whose actual use is defined by the $type argument.
- */
-function ctools_export_load_object($table, $type = 'all', $args = array()) {
- $cache = &drupal_static(__FUNCTION__);
- $cached_database = &drupal_static('ctools_export_load_object_all');
-
- $schema = ctools_export_get_schema($table);
- if (empty($schema)) {
- return array();
- }
-
- $export = $schema['export'];
-
- if (!isset($cache[$table])) {
- $cache[$table] = array();
- }
-
- // If fetching all and cached all, we've done so and we are finished.
- if ($type == 'all' && !empty($cached_database[$table])) {
- return $cache[$table];
- }
-
- $return = array();
-
- // Don't load anything we've already cached.
- if ($type == 'names' && !empty($args)) {
- foreach ($args as $id => $name) {
- if (isset($cache[$table][$name])) {
- $return[$name] = $cache[$table][$name];
- unset($args[$id]);
- }
- }
-
- // If nothing left to load, return the result.
- if (empty($args)) {
- return $return;
- }
- }
-
- // Build the query
- $query = db_select($table, 't__0')->fields('t__0');
- $alias_count = 1;
- if (!empty($schema['join'])) {
- foreach ($schema['join'] as $join_key => $join) {
- if ($join_schema = drupal_get_schema($join['table'])) {
- $query->join($join['table'], 't__' . $alias_count, 't__0' . $join['left_key'] . ' = ' . 't__' . $alias_count . '.' . $join['right_key']);
- $query->fields('t__' . $alias_count);
- $alias_count++;
-
- // Allow joining tables to alter the query through a callback.
- if (isset($join['callback']) && function_exists($join['callback'])) {
- $join['callback']($query, $schema, $join_schema);
- }
- }
- }
- }
-
- $conditions = array();
- $query_args = array();
-
- // If they passed in names, add them to the query.
- if ($type == 'names') {
- $query->condition($export['key'], $args, 'IN');
- }
- else if ($type == 'conditions') {
- foreach ($args as $key => $value) {
- if (isset($schema['fields'][$key])) {
- $query->condition($key, $value);
- }
- }
- }
-
- $result = $query->execute();
-
- $status = variable_get($export['status'], array());
- // Unpack the results of the query onto objects and cache them.
- foreach ($result as $data) {
- $object = _ctools_export_unpack_object($schema, $data, $export['object']);
- $object->table = $table;
- $object->type = t('Normal');
- $object->export_type = EXPORT_IN_DATABASE;
- // Determine if default object is enabled or disabled.
- if (isset($status[$object->{$export['key']}])) {
- $object->disabled = $status[$object->{$export['key']}];
- }
-
- $cache[$table][$object->{$export['key']}] = $object;
- if ($type == 'conditions') {
- $return[$object->{$export['key']}] = $object;
- }
- }
-
- // Load subrecords.
- if (isset($export['subrecords callback']) && function_exists($export['subrecords callback'])) {
- $export['subrecords callback']($cache[$table]);
- }
-
- if ($defaults = _ctools_export_get_defaults($table, $export)) {
-
- foreach ($defaults as $object) {
- if ($type == 'conditions') {
- // if this does not match all of our conditions, skip it.
- foreach ($args as $key => $value) {
- if (!isset($object->$key) || $object->$key != $value) {
- continue 2;
- }
- }
- }
- else if ($type == 'names') {
- if (!in_array($object->{$export['key']}, $args)) {
- continue;
- }
- }
-
- // Determine if default object is enabled or disabled.
- if (isset($status[$object->{$export['key']}])) {
- $object->disabled = $status[$object->{$export['key']}];
- }
-
- if (!empty($cache[$table][$object->{$export['key']}])) {
- $cache[$table][$object->{$export['key']}]->type = t('Overridden');
- $cache[$table][$object->{$export['key']}]->export_type |= EXPORT_IN_CODE;
- if ($type == 'conditions') {
- $return[$object->{$export['key']}] = $cache[$table][$object->{$export['key']}];
- }
- }
- else {
- $object->type = t('Default');
- $object->export_type = EXPORT_IN_CODE;
- $object->in_code_only = TRUE;
- $object->table = $table;
-
- $cache[$table][$object->{$export['key']}] = $object;
- if ($type == 'conditions') {
- $return[$object->{$export['key']}] = $object;
- }
- }
- }
- }
-
- // If fetching all, we've done so and we are finished.
- if ($type == 'all') {
- $cached_database[$table] = TRUE;
- return $cache[$table];
- }
-
- if ($type == 'names') {
- foreach ($args as $name) {
- if (isset($cache[$table][$name])) {
- $return[$name] = $cache[$table][$name];
- }
- }
- }
-
- // For conditions,
- return $return;
-}
-
-/**
- * Reset all static caches in ctools_export_load_object() or static caches for
- * a given table in ctools_export_load_object().
- *
- * @param $table
- * String that is the name of a table. If not defined, all static caches in
- * ctools_export_load_object() will be reset.
- */
-function ctools_export_load_object_reset($table = NULL) {
- // Reset plugin cache to make sure new include files are picked up.
- ctools_include('plugins');
- ctools_get_plugins_reset();
- if (empty($table)) {
- drupal_static_reset('ctools_export_load_object');
- drupal_static_reset('ctools_export_load_object_all');
- drupal_static_reset('_ctools_export_get_defaults');
- }
- else {
- $cache = &drupal_static('ctools_export_load_object');
- $cached_database = &drupal_static('ctools_export_load_object_all');
- $cached_defaults = &drupal_static('_ctools_export_get_defaults');
- unset($cache[$table]);
- unset($cached_database[$table]);
- unset($cached_defaults[$table]);
- }
-}
-
-/**
- * Get the default version of an object, if it exists.
- *
- * This function doesn't care if an object is in the database or not and
- * does not check. This means that export_type could appear to be incorrect,
- * because a version could exist in the database. However, it's not
- * incorrect for this function as it is *only* used for the default
- * in code version.
- */
-function ctools_get_default_object($table, $name) {
- $schema = ctools_export_get_schema($table);
- $export = $schema['export'];
-
- if (!$export['default hook']) {
- return;
- }
-
- // @todo add a method to load .inc files for this.
- $defaults = _ctools_export_get_defaults($table, $export);
- $status = variable_get($export['status'], array());
-
- if (!isset($defaults[$name])) {
- return;
- }
-
- $object = $defaults[$name];
-
- // Determine if default object is enabled or disabled.
- if (isset($status[$object->{$export['key']}])) {
- $object->disabled = $status[$object->{$export['key']}];
- }
-
- $object->type = t('Default');
- $object->export_type = EXPORT_IN_CODE;
- $object->in_code_only = TRUE;
-
- return $object;
-}
-
-/**
- * Call the hook to get all default objects of the given type from the
- * export. If configured properly, this could include loading up an API
- * to get default objects.
- */
-function _ctools_export_get_defaults($table, $export) {
- $cache = &drupal_static(__FUNCTION__, array());
-
- if (!isset($cache[$table])) {
- $cache[$table] = array();
-
- if ($export['default hook']) {
- if (!empty($export['api'])) {
- ctools_include('plugins');
- $info = ctools_plugin_api_include($export['api']['owner'], $export['api']['api'],
- $export['api']['minimum_version'], $export['api']['current_version']);
- $modules = array_keys($info);
- }
- else {
- $modules = module_implements($export['default hook']);
- }
-
- foreach ($modules as $module) {
- $function = $module . '_' . $export['default hook'];
- if (function_exists($function)) {
- foreach ((array) $function($export) as $name => $object) {
- // Record the module that provides this exportable.
- $object->export_module = $module;
-
- if (empty($export['api'])) {
- $cache[$table][$name] = $object;
- }
- else {
- // If version checking is enabled, ensure that the object can be used.
- if (isset($object->api_version) &&
- $object->api_version >= $export['api']['minimum_version'] &&
- $object->api_version <= $export['api']['current_version']) {
- $cache[$table][$name] = $object;
- }
- }
- }
- }
- }
-
- drupal_alter($export['default hook'], $cache[$table]);
- }
- }
-
- return $cache[$table];
-}
-
-/**
- * Unpack data loaded from the database onto an object.
- *
- * @param $schema
- * The schema from drupal_get_schema().
- * @param $data
- * The data as loaded from the database.
- * @param $object
- * If an object, data will be unpacked onto it. If a string
- * an object of that type will be created.
- */
-function _ctools_export_unpack_object($schema, $data, $object = 'stdClass') {
- if (is_string($object)) {
- if (class_exists($object)) {
- $object = new $object;
- }
- else {
- $object = new stdClass;
- }
- }
-
- // Go through our schema and build correlations.
- foreach ($schema['fields'] as $field => $info) {
- $object->$field = empty($info['serialize']) ? $data->$field : unserialize($data->$field);
- }
-
- if (isset($schema['join'])) {
- foreach ($schema['join'] as $join_key => $join) {
- $join_schema = ctools_export_get_schema($join['table']);
- if (!empty($join['load'])) {
- foreach ($join['load'] as $field) {
- $info = $join_schema['fields'][$field];
- $object->$field = empty($info['serialize']) ? $data->$field : unserialize(db_decode_blob($data->$field));
- }
- }
- }
- }
-
- return $object;
-}
-
-/**
- * Unpack data loaded from the database onto an object.
- *
- * @param $table
- * The name of the table this object represents.
- * @param $data
- * The data as loaded from the database.
- */
-function ctools_export_unpack_object($table, $data) {
- $schema = ctools_export_get_schema($table);
- return _ctools_export_unpack_object($schema, $data, $schema['export']['object']);
-}
-
-/**
- * Export a field.
- *
- * This is a replacement for var_export(), allowing us to more nicely
- * format exports. It will recurse down into arrays and will try to
- * properly export bools when it can, though PHP has a hard time with
- * this since they often end up as strings or ints.
- */
-function ctools_var_export($var, $prefix = '') {
- if (is_array($var)) {
- if (empty($var)) {
- $output = 'array()';
- }
- else {
- $output = "array(\n";
- foreach ($var as $key => $value) {
- $output .= $prefix . " " . ctools_var_export($key) . " => " . ctools_var_export($value, $prefix . ' ') . ",\n";
- }
- $output .= $prefix . ')';
- }
- }
- else if (is_object($var) && get_class($var) === 'stdClass') {
- // var_export() will export stdClass objects using an undefined
- // magic method __set_state() leaving the export broken. This
- // workaround avoids this by casting the object as an array for
- // export and casting it back to an object when evaluated.
- $output .= '(object) ' . ctools_var_export((array) $var);
- }
- else if (is_bool($var)) {
- $output = $var ? 'TRUE' : 'FALSE';
- }
- else {
- $output = var_export($var, TRUE);
- }
-
- return $output;
-}
-
-/**
- * Export an object into code.
- */
-function ctools_export_object($table, $object, $indent = '', $identifier = NULL, $additions = array(), $additions2 = array()) {
- $schema = ctools_export_get_schema($table);
- if (!isset($identifier)) {
- $identifier = $schema['export']['identifier'];
- }
-
- $output = $indent . '$' . $identifier . ' = new ' . get_class($object) . ";\n";
-
- if ($schema['export']['can disable']) {
- $output .= $indent . '$' . $identifier . '->disabled = FALSE; /* Edit this to true to make a default ' . $identifier . ' disabled initially */' . "\n";
- }
- if (!empty($schema['export']['api']['current_version'])) {
- $output .= $indent . '$' . $identifier . '->api_version = ' . $schema['export']['api']['current_version'] . ";\n";
- }
-
- // Put top additions here:
- foreach ($additions as $field => $value) {
- $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n";
- }
-
- $fields = $schema['fields'];
- if (!empty($schema['join'])) {
- foreach ($schema['join'] as $join) {
- if (!empty($join['load'])) {
- foreach ($join['load'] as $join_field) {
- $fields[$join_field] = $join['fields'][$join_field];
- }
- }
- }
- }
-
- // Go through our schema and joined tables and build correlations.
- foreach ($fields as $field => $info) {
- if (!empty($info['no export'])) {
- continue;
- }
- if (!isset($object->$field)) {
- if (isset($info['default'])) {
- $object->$field = $info['default'];
- }
- else {
- $object->$field = '';
- }
- }
-
- // Note: This is the *field* export callback, not the table one!
- if (!empty($info['export callback']) && function_exists($info['export callback'])) {
- $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . $info['export callback']($object, $field, $value, $indent) . ";\n";
- }
- else {
- $value = $object->$field;
- if ($info['type'] == 'int') {
- $value = (isset($info['size']) && $info['size'] == 'tiny') ? (bool) $value : (int) $value;
- }
-
- $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n";
- }
- }
-
- // And bottom additions here
- foreach ($additions2 as $field => $value) {
- $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n";
- }
-
- return $output;
-}
-
-/**
- * Get the schema for a given table.
- *
- * This looks for data the export subsystem needs and applies defaults so
- * that it's easily available.
- */
-function ctools_export_get_schema($table) {
- $cache = &drupal_static(__FUNCTION__);
- if (empty($cache[$table])) {
- $schema = drupal_get_schema($table);
-
- // If our schema isn't loaded, it's possible we're in a state where it
- // simply hasn't been cached. If we've been asked, let's force the
- // issue.
- if (!$schema) {
- // force a schema reset:
- $schema = drupal_get_schema($table, TRUE);
- }
-
- if (!isset($schema['export'])) {
- return array();
- }
-
- if (empty($schema['module'])) {
- return array();
- }
-
- // Add some defaults
- $schema['export'] += array(
- 'key' => 'name',
- 'key name' => 'Name',
- 'object' => 'stdClass',
- 'status' => 'default_' . $table,
- 'default hook' => 'default_' . $table,
- 'can disable' => TRUE,
- 'identifier' => $table,
- 'primary key' => !empty($schema['primary key']) ? $schema['primary key'][0] : '',
- 'bulk export' => TRUE,
- 'list callback' => "$schema[module]_{$table}_list",
- 'to hook code callback' => "$schema[module]_{$table}_to_hook_code",
- );
-
- // If the export definition doesn't have the "primary key" then the CRUD
- // save callback won't work.
- if (empty($schema['export']['primary key']) && user_access('administer site configuration')) {
- drupal_set_message(t('The export definition of @table is missing the "primary key" property.', array('@table' => $table)), 'error');
- }
-
- // Notes:
- // The following callbacks may be defined to override default behavior
- // when using CRUD functions:
- //
- // create callback
- // load callback
- // load all callback
- // save callback
- // delete callback
- // export callback
- // import callback
- //
- // See the appropriate ctools_export_crud function for details on what
- // arguments these callbacks should accept. Please do not call these
- // directly, always use the ctools_export_crud_* wrappers to ensure
- // that default implementations are honored.
- $cache[$table] = $schema;
- }
-
- return $cache[$table];
-}
-
-/**
- * Gets the schemas for all tables with ctools object metadata.
- */
-function ctools_export_get_schemas($for_export = FALSE) {
- static $export_tables;
- if (is_null($export_tables)) {
- $export_tables = array();
- $schemas = drupal_get_schema();
- foreach ($schemas as $table => $schema) {
- if (!isset($schema['export'])) {
- unset($schemas[$table]);
- continue;
- }
- $export_tables[$table] = ctools_export_get_schema($table);
- }
- }
- return $for_export ? array_filter($export_tables, '_ctools_export_filter_export_tables') : $export_tables;
-}
-
-function _ctools_export_filter_export_tables($schema) {
- return !empty($schema['export']['bulk export']);
-}
-
-function ctools_export_get_schemas_by_module($modules = array(), $for_export = FALSE) {
- $export_tables = array();
- $list = ctools_export_get_schemas($for_export);
- foreach ($list as $table => $schema) {
- $export_tables[$schema['module']][$table] = $schema;
- }
- return empty($modules) ? $export_tables : array_keys($export_tables, $modules);
-}
-
-/**
- * Set the status of a default $object as a variable.
- *
- * The status, in this case, is whether or not it is 'disabled'.
- * This function does not check to make sure $object actually
- * exists.
- */
-function ctools_export_set_status($table, $name, $new_status = TRUE) {
- $schema = ctools_export_get_schema($table);
- $status = variable_get($schema['export']['status'], array());
-
- $status[$name] = $new_status;
- variable_set($schema['export']['status'], $status);
-}
-
-/**
- * Set the status of a default $object as a variable.
- *
- * This is more efficient than ctools_export_set_status because it
- * will actually unset the variable entirely if it's not necessary,
- * this saving a bit of space.
- */
-function ctools_export_set_object_status($object, $new_status = TRUE) {
- $table = $object->table;
- $schema = ctools_export_get_schema($table);
- $export = $schema['export'];
- $status = variable_get($schema['export']['status'], array());
-
- // Compare
- if (!$new_status && $object->export_type & EXPORT_IN_DATABASE) {
- unset($status[$object->{$export['key']}]);
- }
- else {
- $status[$object->{$export['key']}] = $new_status;
- }
-
- variable_set($schema['export']['status'], $status);
-}
-
-/**
- * Provide a form for displaying an export.
- *
- * This is a simple form that should be invoked like this:
- * @code
- * $output = drupal_get_form('ctools_export_form', $code, $object_title);
- * @endcode
- */
-function ctools_export_form($form, &$form_state, $code, $title = '') {
- $lines = substr_count($code, "\n");
- $form['code'] = array(
- '#type' => 'textarea',
- '#title' => $title,
- '#default_value' => $code,
- '#rows' => $lines,
- );
-
- return $form;
-}
-
-/**
- * Create a new object based upon schema values.
- *
- * Because 'default' has ambiguous meaning on some fields, we will actually
- * use 'object default' to fill in default values if default is not set
- * That's a little safer to use as it won't cause weird database default
- * situations.
- */
-function ctools_export_new_object($table, $set_defaults = TRUE) {
- $schema = ctools_export_get_schema($table);
- $export = $schema['export'];
-
- $object = new $export['object'];
- foreach ($schema['fields'] as $field => $info) {
- if (isset($info['object default'])) {
- $object->$field = $info['object default'];
- }
- else if (isset($info['default'])) {
- $object->$field = $info['default'];
- }
- else {
- $object->$field = NULL;
- }
- }
-
- if ($set_defaults) {
- // Set some defaults so this data always exists.
- // We don't set the export_type property here, as this object is not saved
- // yet. We do give it NULL so we don't generate notices trying to read it.
- $object->export_type = NULL;
- $object->type = t('Local');
- }
- return $object;
-}
-
-/**
- * Convert a group of objects to code based upon input and return this as a larger
- * export.
- */
-function ctools_export_to_hook_code(&$code, $table, $names = array(), $name = 'foo') {
- $schema = ctools_export_get_schema($table);
- $export = $schema['export'];
- // Use the schema-specified function for generating hook code, if one exists
- if (function_exists($export['to hook code callback'])) {
- $output = $export['to hook code callback']($names, $name);
- }
- // Otherwise, the following code generates basic hook code
- else {
- $output = ctools_export_default_to_hook_code($schema, $table, $names, $name);
- }
-
- if (!empty($output)) {
- if (isset($export['api'])) {
- if (isset($code[$export['api']['owner']][$export['api']['api']]['version'])) {
- $code[$export['api']['owner']][$export['api']['api']]['version'] = max($code[$export['api']['owner']][$export['api']['api']]['version'], $export['api']['minimum_version']);
- }
- else {
- $code[$export['api']['owner']][$export['api']['api']]['version'] = $export['api']['minimum_version'];
- $code[$export['api']['owner']][$export['api']['api']]['code'] = '';
- }
- $code[$export['api']['owner']][$export['api']['api']]['code'] .= $output;
- }
- else {
- if (empty($code['general'])) {
- $code['general'] = '';
- }
- $code['general'] .= $output;
- }
- }
-}
-
-/**
- * Default function to export objects to code.
- *
- * Note that if your module provides a 'to hook code callback' then it will
- * receive only $names and $name as arguments. Your module is presumed to
- * already know the rest.
- */
-function ctools_export_default_to_hook_code($schema, $table, $names, $name) {
- $export = $schema['export'];
- $output = '';
- $objects = ctools_export_load_object($table, 'names', $names);
- if ($objects) {
- $output = "/**\n";
- $output .= " * Implementation of hook_{$export['default hook']}()\n";
- $output .= " */\n";
- $output .= "function " . $name . "_{$export['default hook']}() {\n";
- $output .= " \${$export['identifier']}s = array();\n\n";
- foreach ($objects as $object) {
- $output .= ctools_export_crud_export($table, $object, ' ');
- $output .= " \${$export['identifier']}s['" . check_plain($object->$export['key']) . "'] = \${$export['identifier']};\n\n";
- }
- $output .= " return \${$export['identifier']}s;\n";
- $output .= "}\n";
- }
-
- return $output;
-}
-/**
- * Default function for listing bulk exportable objects.
- */
-function ctools_export_default_list($table, $schema) {
- $list = array();
-
- $items = ctools_export_crud_load_all($table);
- $export_key = $schema['export']['key'];
-
- foreach ($items as $item) {
- // Try a couple of possible obvious title keys:
- if (!empty($item->admin_title)) {
- $string = "$item->admin_title (" . $item->$export_key . ")";
- }
- elseif (!empty($item->title)) {
- $string = "$item->title (" . $item->$export_key . ")";
- }
- else {
- $string = $item->$export_key;
- }
- $list[$item->$export_key] = check_plain($string);
- }
- return $list;
-}
diff --git a/includes/fields.inc b/includes/fields.inc
deleted file mode 100644
index 6e5dcc3..0000000
--- a/includes/fields.inc
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-/**
- * @file
- * Extend core fields with some helper functions to reduce code complexity within views and ctools plugins.
- */
-
-
-/**
- * Fake an instance of a field.
- *
- * @param $field_name
- * The unique name for this field no matter what entity/bundle it may be used on.
- * @param $view_mode
- * We're building a new view mode for this function. Defaults to ctools, but we expect developers to actually name this something meaningful.
- * @param $formatter
- * The formatter key selected from the options provided by field_ui_formatter_options().
- * @param $formatter_settings
- * An array of key value pairs. These will be used as #default_value for the form elements generated by a call to hook_field_formatter_settings_form() for this field type.
- * Typically we'll pass an empty array to begin with and then pass this information back to ourselves on form submit so that we can set the values for later edit sessions.
- */
-function ctools_fields_fake_field_instance($field_name, $view_mode = 'ctools', $formatter, $formatter_settings) {
- $field = field_read_field($field_name);
-
- $field_type = field_info_field_types($field['type']);
-
- return array(
- // Build a fake entity type and bundle.
- 'field_name' => $field_name,
- 'entity_type' => 'ctools',
- 'bundle' => 'ctools',
-
- // Use the default field settings for settings and widget.
- 'settings' => field_info_instance_settings($field['type']),
- 'widget' => array(
- 'type' => $field_type['default_widget'],
- 'settings' => array(),
- ),
-
- // Build a dummy display mode.
- 'display' => array(
- $view_mode => array(
- 'type' => $formatter,
- 'settings' => $formatter_settings,
- ),
- ),
-
- // Set the other fields to their default values.
- // @see _field_write_instance().
- 'required' => FALSE,
- 'label' => $field_name,
- 'description' => '',
- 'deleted' => 0,
- );
-}
-
-/**
- * Helper function for calling hook_field_formatter_settings_form() without needing to load an instance of the field.
- *
- * @param $field
- * A fully loaded field.
- * @param $formatter_type
- * The formatter key selected from the options provided by field_ui_formatter_options().
- * @param $form
- * The full form from the function that's calling this function.
- * @param $form_state
- * The full form_state from the function that's calling this function.
- * @param $view_mode
- * We're passing a view mode from this function to the fake instance we're creating. Defaults to ctools, but we expect developers to actually name this something meaningful.
- */
-function ctools_fields_get_field_formatter_settings_form($field, $formatter_type, &$form, $form_state, $view_mode = 'ctools') {
- $conf = $form_state['conf'];
- $formatter = field_info_formatter_types($formatter_type);
- $function = $formatter['module'] . '_field_formatter_settings_form';
- if (function_exists($function)) {
- $instance = ctools_fields_fake_field_instance($field['field_name'], $view_mode, $formatter_type, $conf['formatter_settings']);
- $settings_form = $function($field, $instance, $view_mode, $form, $form_state);
- if ($settings_form) {
- $form['ctools_field_list']['#value'][] = $field;
- $form += $settings_form;
- }
- }
-}
-
-/**
- * Helper function for generating all the formatter information associated with any fields. Especially useful for determining the fields that will be added to form that executes hook_ield_formatter_settings_form().
- *
- * @param $fields
- * An array of fully loaded fields.
- */
-
-function ctools_fields_get_field_formatter_info($fields) {
- $info = array();
- foreach ($fields as $field) {
- $field_info = module_invoke($field['module'], 'field_formatter_info');
- if ($field_info) {
- $info += $field_info;
- }
- }
- drupal_alter('field_formatter_info', $info);
- return $info;
-}
diff --git a/includes/jump-menu.inc b/includes/jump-menu.inc
deleted file mode 100644
index 4caa052..0000000
--- a/includes/jump-menu.inc
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-
-/**
- * @file
- * Provides a simple "jump menu".
- *
- * A jump menu is a select box and an optional 'go' button which can be removed
- * if javascript is in use. Each item is keyed to the href that the button
- * should go to. With javascript, the page is immediately redirected. Without
- * javascript, the form is submitted and a drupal_goto() is given.
- *
- */
-
-/**
- * Generate a jump menu form.
- *
- * This can either be used with drupal_get_form() or directly added to a
- * form. The button provides its own submit handler so by default, other
- * submit handlers will not be called.
- *
- * One note: Do not use #tree = TRUE or it will be unable to find the
- * proper value.
- *
- * @code
- * ctools_include('jump-menu');
- * $output = drupal_get_form('ctools_jump_menu', $targets, $options);
- * @endcode
- *
- * @param $select
- * An array suitable for use as the #options. The keys will be the direct
- * URLs that will be jumped to, so you absolutely must encode these using
- * url() in order for them to work reliably.
- *
- * @param $options
- * $options may be an array with the following options:
- * - 'title': The text to display for the #title attribute.
- * - 'description': The text to display for the #description attribute.
- * - 'default_value': The text to display for the #default_value attribute.
- * - 'hide': If TRUE the go button will be set to hide via javascript and
- * will submit on change.
- * - 'button': The text to display on the button.
- * - 'image': If set, an image button will be used instead, and the image
- * set to this.
- * - 'inline': If set to TRUE (default) the display will be forced inline.
- */
-function ctools_jump_menu($form, &$form_state, $select, $options = array()) {
- $options += array(
- 'button' => t('Go'),
- 'choose' => t('- Choose -'),
- 'inline' => TRUE,
- 'hide' => TRUE,
- );
-
- ctools_add_js('jump-menu');
-
- if (!empty($options['choose'])) {
- $select = array('' => $options['choose']) + $select;
- }
-
- $form['jump'] = array(
- '#type' => 'select',
- '#options' => $select,
- '#attributes' => array(
- 'class' => array('ctools-jump-menu-select'),
- ),
- );
-
- if (!empty($options['title'])) {
- $form['jump']['#title'] = $options['title'];
- }
-
- if (!empty($options['description'])) {
- $form['jump']['#description'] = $options['description'];
- }
-
- if (!empty($options['default_value'])) {