Permalink
Browse files

Switches template structure so that there is a /single/ directory, to…

… better match other BP components, and to make way for a more robust set of templates. Fixes #169
  • Loading branch information...
1 parent 6b74345 commit df72d4f3701f0671347855cd68d9507b43713287 @boonebgorges committed Feb 2, 2012
View
@@ -100,6 +100,11 @@ function load_constants() {
if ( !defined( 'BP_DOCS_INCLUDES_PATH' ) )
define( 'BP_DOCS_INCLUDES_PATH', BP_DOCS_INSTALL_PATH . 'includes/' );
+ // Ditto^2. For deprecated files, we need a non-system path. Note: doesn't work
+ // right with symlinks
+ if ( !defined( 'BP_DOCS_INCLUDES_PATH_ABS' ) )
+ define( 'BP_DOCS_INCLUDES_PATH_ABS', str_replace( ABSPATH, '', BP_DOCS_INCLUDES_PATH ) );
+
// The main slug
if ( !defined( 'BP_DOCS_SLUG' ) )
define( 'BP_DOCS_SLUG', 'docs' );
@@ -1,64 +1,10 @@
<?php
-
/**
- * Mostly borrowed from BuddyPress Default
+ * Deprecated. Use single/comments.php instead.
*
+ * @package BuddyPress_Docs
*/
-$num_comments = 0;
-$num_trackbacks = 0;
-foreach ( (array)$comments as $comment ) {
- if ( 'comment' != get_comment_type() )
- $num_trackbacks++;
- else
- $num_comments++;
-}
-
-?>
-
-<?php if ( bp_docs_current_user_can( 'read_comments' ) ) : ?>
- <div id="comments">
- <h3>
- <?php printf( __( 'Discussion (%d)', 'bp-docs' ), $num_comments ) ?>
- </h3>
-
- <?php do_action( 'bp_before_blog_comment_list' ) ?>
-
- <?php if ( have_comments() ) : ?>
-
- <ol class="commentlist">
- <?php bp_docs_list_comments() ?>
- </ol><!-- .comment-list -->
-
- <?php do_action( 'bp_after_blog_comment_list' ) ?>
-
- <?php if ( get_option( 'page_comments' ) ) : ?>
- <div class="comment-navigation paged-navigation">
- <?php paginate_comments_links() ?>
- </div>
- <?php endif; ?>
-
- <?php else : ?>
-
- <p class="comments-closed comments-empty">
- <?php _e( 'There are no comments for this doc yet.', 'bp-docs' ) ?>
- </p>
-
- <?php endif ?>
-
- </div><!-- #comments -->
-
-<?php else : ?>
- <p class="comments-closed comment-display-disabled">
- <?php _e( 'Comment display has been disabled on this doc.', 'bp-docs' ) ?>
- </p>
-
-<?php endif; ?>
-
-<?php if ( comments_open() && bp_docs_current_user_can( 'post_comments' ) ) : ?>
- <?php comment_form( array(), get_the_ID() ) ?>
-<?php else : ?>
- <p class="comments-closed comment-posting-disabled">
- <?php _e( 'Comment posting has been disabled on this doc.', 'bp-docs' ) ?>
- </p>
-<?php endif; ?>
+_deprecated_file( basename(__FILE__), '1.2', BP_DOCS_INCLUDES_PATH_ABS . 'templates/docs/single/comments.php' );
+require_once ( BP_DOCS_INCLUDES_PATH . 'templates/docs/single/comments.php');
+?>
@@ -1,166 +1,10 @@
-<?php include( apply_filters( 'bp_docs_header_template', bp_docs_locate_template( 'docs-header.php' ) ) ) ?>
-
<?php
-// No media support at the moment. Want to integrate with something like BP Group Documents
-// include_once ABSPATH . '/wp-admin/includes/media.php' ;
-
-if ( !function_exists( 'wp_editor' ) ) {
- require_once ABSPATH . '/wp-admin/includes/post.php' ;
- wp_tiny_mce();
-}
-
-?>
-
-<div class="doc-content">
-
-<div id="idle-warning" style="display:none">
- <p><?php _e( 'You have been idle for <span id="idle-warning-time"></span>', 'bp-docs' ) ?></p>
-</div>
-
-<form action="" method="post" class="standard-form" id="doc-form">
- <div class="doc-header">
- <?php if ( bp_docs_is_existing_doc() ) : ?>
- <input type="hidden" id="existing-doc-id" value="<?php the_ID() ?>" />
- <?php endif ?>
- </div>
- <div class="doc-content-wrapper">
- <div id="doc-content-title">
- <label for="doc[title]"><?php _e( 'Title', 'bp-docs' ) ?></label>
- <input type="text" id="doc-title" name="doc[title]" class="long" value="<?php bp_docs_edit_doc_title() ?>" />
- </div>
-
- <?php if ( bp_docs_is_existing_doc() ) : ?>
- <div id="doc-content-permalink">
- <label for="doc[permalink]"><?php _e( 'Permalink', 'bp-docs' ) ?></label>
- <code><?php echo trailingslashit( bp_get_group_permalink() ) . BP_DOCS_SLUG . '/' ?></code><input type="text" id="doc-permalink" name="doc[permalink]" class="long" value="<?php bp_docs_edit_doc_slug() ?>" />
- </div>
- <?php endif ?>
-
- <div id="doc-content-textarea">
- <label id="content-label" for="doc[content]"><?php _e( 'Content', 'bp-docs' ) ?></label>
- <div id="editor-toolbar">
- <?php /* No media support for now
- <div id="media-toolbar">
- <?php echo bpsp_media_buttons(); ?>
- </div>
- */ ?>
- <?php
- if ( function_exists( 'wp_editor' ) ) {
- wp_editor( bp_docs_get_edit_doc_content(), 'doc[content]', array(
- 'media_buttons' => false,
- 'dfw' => false
- ) );
- } else {
- the_editor( bp_docs_get_edit_doc_content(), 'doc[content]', 'doc[title]', false );
- }
- ?>
- </div>
- </div>
-
- <div id="doc-meta">
- <div id="doc-tax" class="doc-meta-box">
- <div class="toggleable">
- <p id="tags-toggle-edit" class="toggle-switch"><?php _e( 'Tags', 'bp-docs' ) ?></p>
-
- <div class="toggle-content">
- <table class="toggle-table" id="toggle-table-tags">
- <tr>
- <td class="desc-column">
- <label for="bp_docs_tag"><?php _e( 'Tags are words or phrases that help to describe and organize your Docs.', 'bp-docs' ) ?></label>
- <span class="description"><?php _e( 'Separate tags with commas (for example: <em>orchestra, snare drum, piccolo, Brahms</em>)', 'bp-docs' ) ?></span>
- </td>
-
- <td>
- <?php bp_docs_post_tags_meta_box() ?>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </div>
-
- <div id="doc-parent" class="doc-meta-box">
- <div class="toggleable">
- <p class="toggle-switch" id="parent-toggle"><?php _e( 'Parent', 'bp-docs' ) ?></p>
-
- <div class="toggle-content">
- <table class="toggle-table" id="toggle-table-parent">
- <tr>
- <td class="desc-column">
- <label for="parent_id"><?php _e( 'Select a parent for this Doc.', 'bp-docs' ) ?></label>
-
- <span class="description"><?php _e( '(Optional) Assigning a parent Doc means that a link to the parent will appear at the bottom of this Doc, and a link to this Doc will appear at the bottom of the parent.', 'bp-docs' ) ?></span>
- </td>
-
- <td class="content-column">
- <?php bp_docs_edit_parent_dropdown() ?>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </div>
-
- <?php if ( bp_docs_current_user_can( 'manage' ) ) : ?>
- <div id="doc-settings" class="doc-meta-box">
- <div class="toggleable">
- <p class="toggle-switch" id="settings-toggle"><?php _e( 'Settings', 'bp-docs' ) ?></p>
-
- <div class="toggle-content">
- <table class="toggle-table" id="toggle-table-settings">
- <?php bp_docs_doc_settings_markup() ?>
- </table>
- </div>
- </div>
- </div>
- <?php endif ?>
- </div>
-
- <div style="clear: both"> </div>
-
- <div id="doc-submit-options">
-
- <?php wp_nonce_field( 'bp_docs_save' ) ?>
-
- <input type="submit" name="doc-edit-submit" id="doc-edit-submit" value="<?php _e( 'Save', 'bp-docs' ) ?>"> <a href="<?php bp_docs_cancel_edit_link() ?>" class="action safe"><?php _e( 'Cancel', 'bp-docs' ); ?></a>
-
- <?php if ( bp_docs_current_user_can( 'manage' ) ) : ?><a class="delete-doc-button confirm" href="<?php bp_docs_delete_doc_link() ?>">Delete</a><?php endif ?>
- </div>
-
-
- <div style="clear: both"> </div>
- </div>
-</form>
-
-</div><!-- .doc-content -->
-
-<?php bp_docs_inline_toggle_js() ?>
-
-<?php if ( !function_exists( 'wp_editor' ) ) : ?>
-<script type="text/javascript">
-jQuery(document).ready(function($){
- /* On some setups, it helps TinyMCE to load if we fire the switchEditors event on load */
- if ( typeof(switchEditors) == 'object' ) {
- if ( !$("#edButtonPreview").hasClass('active') ) {
- switchEditors.go('doc[content]', 'tinymce');
- }
- }
-},(jQuery));
-</script>
-<?php endif ?>
-
-<script type="text/javascript" >
- var tb_closeImage = "<?php bp_root_domain() ?>/wp-includes/js/thickbox/tb-close.png";
-</script>
-
-<?php /* Important - do not remove. Needed for autosave stuff */ ?>
-<div id="still_working_content" name="still_working_content" style="display:none;">
- <br />
- <h3><?php _e( 'Are you still there?', 'bp-docs' ) ?></h3>
-
- <p><?php _e( 'In order to prevent overwriting content, only one person can edit a given doc at a time. For that reason, you must periodically ensure the system that you\'re still actively editing. If you are idle for more than 30 minutes, your changes will be auto-saved, and you\'ll be sent out of Edit mode so that others can access the doc.', 'bp-docs' ) ?></p>
-
- <a href="#" onclick="tb_remove(); return false" class="button"><?php _e( 'I\'m still editing!', 'bp-docs' ) ?></a>
-
-
-</div>
+/**
+ * Deprecated. Use single/edit.php instead.
+ *
+ * @package BuddyPress_Docs
+ */
+
+_deprecated_file( basename(__FILE__), '1.2', BP_DOCS_INCLUDES_PATH_ABS . 'templates/docs/single/edit.php' );
+require_once ( BP_DOCS_INCLUDES_PATH . 'templates/docs/single/edit.php');
+?>
@@ -1,63 +1,10 @@
-<?php if ( have_posts() ) : while ( have_posts() ) : the_post() ?>
-
-<?php include( apply_filters( 'bp_docs_header_template', bp_docs_locate_template( 'docs-header.php' ) ) ) ?>
-
-<div class="doc-content">
-
-<?php if ( bp_docs_history_is_latest() ) : ?>
-
- <p><?php _e( "Click on a revision date from the list below to view that revision.", 'bp-docs' ) ?></p>
-
- <p><?php _e( "Alternatively, you can compare two revisions by selecting them in the 'Old' and 'New' columns, and clicking 'Compare Revisions'.", 'bp-docs' ) ?></p>
-
-<?php endif ?>
-
-<table class="form-table ie-fixed">
- <col class="th" />
-
- <?php if ( 'diff' == bp_docs_history_action() ) : ?>
- <tr id="revision">
- <th scope="row"></th>
- <th scope="col" class="th-full">
- <span class="alignleft"><?php printf( __( 'Older: %s', 'bp-docs' ), bp_docs_history_post_revision_field( 'left', 'post_title' ) ); ?></span>
- <span class="alignright"><?php printf( __( 'Newer: %s', 'bp-docs' ), bp_docs_history_post_revision_field( 'right', 'post_title' ) ); ?></span>
- </th>
- </tr>
- <?php elseif ( !bp_docs_history_is_latest() ) : ?>
- <tr id="revision">
- <th scope="row"></th>
- <th scope="col" class="th-full">
- <span class="alignleft"><?php printf( __( 'You are currently viewing a revision titled "%1$s", saved on %2$s by %3$s', 'bp-docs' ), bp_docs_history_post_revision_field( false, 'post_title' ), bp_format_time( strtotime( bp_docs_history_post_revision_field( false, 'post_date' ) ) ), bp_core_get_userlink( bp_docs_history_post_revision_field( false, 'post_author' ) ) ); ?></span>
- </th>
- </tr>
- <?php endif ?>
-
- <?php foreach ( _wp_post_revision_fields() as $field => $field_title ) : ?>
- <?php if ( 'diff' == bp_docs_history_action() ) : ?>
- <tr id="revision-field-<?php echo $field; ?>">
- <th scope="row"><?php echo esc_html( $field_title ); ?></th>
- <td><div class="pre"><?php echo wp_text_diff( bp_docs_history_post_revision_field( 'left', $field ), bp_docs_history_post_revision_field( 'right', $field ) ) ?></div></td>
- </tr>
- <?php elseif ( !bp_docs_history_is_latest() ) : ?>
- <tr id="revision-field-<?php echo $field; ?>">
- <th scope="row"><?php echo esc_html( $field_title ); ?></th>
- <td><div class="pre"><?php echo bp_docs_history_post_revision_field( false, $field ) ?></div></td>
- </tr>
-
- <?php endif ?>
-
- <?php endforeach ?>
-
- <?php if ( 'diff' == bp_docs_history_action() && bp_docs_history_revisions_are_identical() ) : ?>
- <tr><td colspan="2"><div class="updated"><p><?php _e( 'These revisions are identical.', 'bp-docs' ); ?></p></div></td></tr>
- <?php endif ?>
-
-</table>
-
-<br class="clear" />
-
-<?php bp_docs_list_post_revisions( get_the_ID() ) ?>
-
-</div>
-
-<?php endwhile; endif ?>
+<?php
+/**
+ * Deprecated. Use single/history.php instead.
+ *
+ * @package BuddyPress_Docs
+ */
+
+_deprecated_file( basename(__FILE__), '1.2', BP_DOCS_INCLUDES_PATH_ABS . 'templates/docs/single/history.php' );
+require_once ( BP_DOCS_INCLUDES_PATH . '/templates/docs/single/history.php');
+?>
@@ -1,41 +1,10 @@
-<?php if ( have_posts() ) : while ( have_posts() ) : the_post() ?>
-
-<?php include( apply_filters( 'bp_docs_header_template', bp_docs_locate_template( 'docs-header.php' ) ) ) ?>
-
-<?php if ( bp_docs_is_doc_edit_locked() && bp_docs_current_user_can( 'edit' ) ) : ?>
- <div class="toggleable doc-is-locked">
- <span class="toggle-switch" id="toggle-doc-is-locked"><?php _e( 'Locked', 'bp-docs' ) ?> <span class="hide-if-no-js description"><?php _e( '(click for more info)', 'bp-docs' ) ?></span></span>
- <div class="toggle-content">
- <p><?php printf( __( 'This doc is currently being edited by %1$s. In order to prevent edit conflicts, only one user can edit a doc at a time.', 'bp-docs' ), bp_docs_get_current_doc_locker_name() ) ?></p>
-
- <?php if ( is_super_admin() || bp_group_is_admin() ) : ?>
- <p><?php printf( __( 'Please try again in a few minutes. Or, as an admin, you can <a href="%s">force cancel</a> the edit lock.', 'bp-docs' ), bp_docs_get_force_cancel_edit_lock_link() ) ?></p>
- <?php else : ?>
- <p><?php _e( 'Please try again in a few minutes.', 'bp-docs' ) ?></p>
- <?php endif ?>
- </div>
- </div>
-
- <?php bp_docs_inline_toggle_js() ?>
-<?php endif ?>
-
-<div class="doc-content">
- <?php the_content() ?>
-</div>
-
-<div class="doc-meta">
- <?php do_action( 'bp_docs_single_doc_meta' ) ?>
-</div>
-
-<?php comments_template( '/docs/comments.php' ) ?>
-
-<?php endwhile; ?>
-
-<?php else : ?>
-
- <p><?php _e( 'No Doc by this name exists.', 'bp-docs' ) ?></p>
-
- <p><?php printf( __( '<a href="%1$s">View all Docs in this group</a> or <a href="%2$s">create a new Doc</a>.', 'bp-docs' ), bp_docs_get_item_docs_link(), bp_docs_get_item_docs_link() . 'create' ) ?></p>
-
-<?php endif; ?>
-
+<?php
+/**
+ * Deprecated. Use single/index.php instead.
+ *
+ * @package BuddyPress_Docs
+ */
+
+_deprecated_file( basename(__FILE__), '1.2', BP_DOCS_INCLUDES_PATH_ABS . 'templates/docs/single/index.php' );
+require_once ( BP_DOCS_INCLUDES_PATH . 'templates/docs/single/index.php');
+?>
Oops, something went wrong.

0 comments on commit df72d4f

Please sign in to comment.