Skip to content
wiki.fftac.org

Page Manuscript Collaboration - Source Excerpt 03

Back to Page Manuscript Collaboration

Summary

This source excerpt preserves a bounded section of Spiralist/wp-content/plugins/ns12-manuscript/templates/page-manuscript-collaboration.php so readers can inspect the evidence without opening the full source file.

**Source path:** Spiralist/wp-content/plugins/ns12-manuscript/templates/page-manuscript-collaboration.php

<span>Alt text</span>
                                        <input type="text" name="submission_alt" value="<?php echo esc_attr((string) ($seed['alt'] ?? '')); ?>" />
                                    </label>

                                    <label>
                                        <span>Upload manuscript image</span>
                                        <input type="file" name="manuscript_image" accept=".png,.jpg,.jpeg,.webp,.gif,.avif,image/*" />
                                    </label>

                                    <?php if (!empty($seed['image_url'])) : ?>
                                        <div class="spiralist-collaboration-preview">
                                            <img src="<?php echo esc_url((string) $seed['image_url']); ?>" alt="<?php echo esc_attr((string) ($seed['alt'] ?? 'Draft manuscript preview')); ?>" loading="lazy" decoding="async" />
                                        </div>
                                    <?php endif; ?>

                                    <div class="spiralist-collaboration-form__actions">
                                        <button class="spiralist-button spiralist-button--secondary" type="submit" name="submission_operation" value="save">Save Draft</button>
                                        <button class="spiralist-button spiralist-button--primary" type="submit" name="submission_operation" value="submit">Submit For Review</button>
                                    </div>
                                </form>
                            </section>

                            <aside class="spiralist-collaboration-panel">
                                <h2>Review state</h2>
                                <?php if (empty($record)) : ?>
                                    <p>New drafts start inside your private collaborator layer. Save a draft first to generate a profile-share link.</p>
                                <?php else : ?>
                                    <div class="spiralist-collaboration-meta-stack">
                                        <?php $render_badge((string) ($record['status_label'] ?? 'Draft'), (string) ($record['status_tone'] ?? 'neutral')); ?>
                                        <p><?php echo esc_html((string) ($record['status_description'] ?? '')); ?></p>
                                        <?php if (!empty($record['review_notes'])) : ?><p><strong>Admin notes:</strong> <?php echo esc_html((string) $record['review_notes']); ?></p><?php endif; ?>
                                        <?php if (!empty($record['profile_share_url'])) : ?><p><strong>Private share link:</strong> <a href="<?php echo esc_url((string) $record['profile_share_url']); ?>"><?php echo esc_html((string) ($record['profile_share_url'] ?? '')); ?></a></p><?php endif; ?>
                                        <?php if (!empty($record['public_url'])) : ?><p><strong>Current public version:</strong> <a href="<?php echo esc_url((string) $record['public_url']); ?>"><?php echo esc_html((string) ($record['public_url'] ?? '')); ?></a></p><?php endif; ?>
                                    </div>
                                <?php endif; ?>
                            </aside>
                        </div>

                        <section class="spiralist-collaboration-panel">
                            <div class="spiralist-collaboration-panel__header">
                                <h2>Your manuscript pages</h2>
                                <a class="spiralist-button spiralist-button--secondary" href="<?php echo esc_url(spiralist_book_pages_get_manuscript_studio_url()); ?>">Create Another Page</a>
                            </div>
                            <?php if (empty($records)) : ?>
                                <p>You have not created any manuscript pages yet.</p>
                            <?php else : ?>
                                <div class="spiralist-collaboration-grid">
                                    <?php foreach ($records as $user_record) : ?>
                                        <?php $render_record_card($user_record, true); ?>
                                    <?php endforeach; ?>
                                </div>
                            <?php endif; ?>
                        </section>
                    <?php endif; ?>

                <?php elseif ($mode === 'profile') : ?>
                    <?php
                    $profile_user = spiralist_book_pages_get_collaboration_profile_user($profile_slug);

                    $missing_profile = !($profile_user instanceof WP_User);

                    if ($missing_profile) {
                        $set_404();
                    }
                    ?>

                    <?php if ($missing_profile) : ?>
                        <div class="spiralist-collaboration-panel">
                            <h1>This contributor profile could not be found.</h1>
                            <p>The requested profile slug does not match a collaborator account in the current site.</p>
                        </div>
                    <?php elseif ($profile_user instanceof WP_User && $submission_slug !== '') : ?>
                        <?php
                        $record = spiralist_book_pages_get_collaboration_submission_by_slug($submission_slug, (int) $profile_user->ID);
                        $can_view_private = !empty($record)
                            ? spiralist_book_pages_can_view_profile_submission($record, $share_token)
                            : false;

                        if (empty($record)) {
                            $set_404();
                        }
                        ?>

                        <?php if (!empty($record) && $can_view_private) : ?>
                            <?php $copy = !empty($record['working_copy']) ? (array) $record['working_copy'] : (array) ($record['live_copy'] ?? []); ?>
                            <?php
                            $profile_discussion_context = spiralist_book_pages_get_discussion_context_for_collaboration_record(
                                $record,
                                'profile',
                                spiralist_book_pages_get_current_request_url(),
                                $share_token
                            );
                            ?>
                            <div class="spiralist-collaboration-hero">
                                <div>
                                    <p class="spiralist-collaboration-kicker">Private Profile Manuscript Page</p>
                                    <h1><?php echo esc_html((string) ($copy['title'] ?? 'Profile Manuscript Page')); ?></h1>
                                    <p>This route belongs to <?php echo esc_html((string) $profile_user->display_name); ?>'s collaborator profile layer. It is omitted from the public directory and search indexing until an admin approves a public release.</p>
                                    <div class="spiralist-collaboration-meta-row">
                                        <?php $render_badge((string) ($record['status_label'] ?? 'Draft'), (string) ($record['status_tone'] ?? 'neutral')); ?>
                                        <span>Contributor: <?php echo esc_html((string) $profile_user->display_name); ?></span>
                                        <?php if (!empty($record['public_url'])) : ?><span>Live public version also exists.</span><?php endif; ?>
                                    </div>
                                </div>
                                <div class="spiralist-collaboration-hero__actions">
                                    <?php if (!empty($record['public_url'])) : ?><a class="spiralist-button spiralist-button--secondary" href="<?php echo esc_url((string) $record['public_url']); ?>">Open Public Version</a><?php endif; ?>
                                </div>
                            </div>

                            <div class="spiralist-collaboration-single">
                                <?php $render_image($copy, (string) ($copy['title'] ?? 'Profile Manuscript Page')); ?>
                                <article class="spiralist-collaboration-panel">
                                    <h2>Preview details</h2>
                                    <p><?php echo esc_html((string) ($copy['summary'] ?? '')); ?></p>
                                    <?php if (!empty($record['review_notes'])) : ?><p><strong>Admin notes:</strong> <?php echo esc_html((string) $record['review_notes']); ?></p><?php endif; ?>
                                </article>
                            </div>
                            <?php if (!empty($profile_discussion_context)) : ?>