function display_page_content() { // Double check that the proper columns exist $video_id = find_db_column('photos', 'video_id'); if (!$video_id) { echo '<h2 class="system-warning"><span>HCd>CMS says:</span> The Photos table does not have a column called "video_id"</h2>'; } $add_video = requestIdParam() == "add" ? true : false; if ($add_video) { $video = $videotitle = $videoservice = $videoembed = $videowidth = $videoheight = $videoposter = $attached_item = null; } else { $video_id = requestIdParam(); $video = Videos::FindById($video_id); $videotitle = $video->get_title(); $videoservice = $video->service; $videoembed = $video->embed; $videowidth = $video->width; $videoheight = $video->height; if ($video_id) { $possibleposter = Photos::FindVideoPoster($video_id); $videoposter = !empty($possibleposter) ? $possibleposter : null; } } ?> <script type="text/javascript"> $().ready(function() { $("#edit_video").validate({ rules : { title: "required", embed: "required" }, messages: { title: "Please enter a title for this video", embed: "Please enter an embed code for this video" } }); }); </script> <div id="edit-header" class="videonav"> <h1><?php if ($add_video) { echo 'Add'; } else { echo 'Edit'; } ?> Video</h1> </div> <form method="POST" id="edit_video" enctype="multipart/form-data"> <p class="display_name"> <label for="title">Video Display Name:</label> <?php textField("title", $videotitle, "required: true"); ?> <br /> <span class="hint">This name should match the name you use on the embedding service source (YouTube or Vimeo), but it does not have to.</span> </p> <div class="column half"> <p><label for="service">Hosting Service:</label> <select id="service" name="service"> <option value="youtube"<?php if (!empty($video)) { if ($video->service == 'youtube') { echo ' selected'; } } ?> >YouTube</option> <option value="vimeo"<?php if (!empty($video)) { if ($video->service == 'vimeo') { echo ' selected'; } } ?> >Vimeo</option> </select><br /> <span class="hint">Only two are supported at this time — YouTube is the default service.</span> </p> <p> <label for="embed">Unique ID:</label> <?php textField("embed", $videoembed, "required: true"); ?> <br /> <span class="hint">The unique identifier is a random string of numbers and letters associated with the file. <br /> YouTube example: http://www.youtube.com/embed/<mark>tVUCsnMK18E</mark> <br /> Vimeo example: http://player.vimeo.com/video/<mark>72632269</mark> <br /> In both cases, we are only interested in the text highlighted.</span> </p> </div> <div class="column half last"> <div class="column half"> <p> <label for="width">Video Width:</label> <?php textField("width", $videowidth); ?> </p> </div> <div class="column half last"> <p> <label for="height">Video Height:</label> <?php textField("height", $videoheight); ?> </p> </div> <div class="clearit"></div> <p class="hint">With responsive design, the width may be set to 100% by the templates, so that number may not always be used</p> <?php if ($video_id) { ?> <!-- Video poster image --> <p><label for="new_poster">Add/Edit a Poster image:</label> <input type="file" name="new_poster" id="new_poster" value="" /> </p> <p class="hint">A poster image may be used by your site to display a link to a pop up video player. </p> <?php if (!is_null($videoposter)) { echo '<h3>Existing Poster Image</h3>'; echo '<p><img src="' . $videoposter->getPublicUrl() . '" style="max-width:100%;" alt=""></p>'; } ?> <?php } ?> </div> <div class="clearleft"></div> <?php // Show an attached Item if there is one. if (is_object($video)) { $attached_gallery = $video->getGallery(); $attached_item = is_object($attached_gallery) ? $attached_gallery->get_item() : null; } if (is_object($attached_item)) { $section = array_shift($attached_item->getSections()); echo '<h2>This video is attached to this Portfolio Item:</h2>'; echo '<ol id="video_list" class="managelist">'; echo '<li><a href="' . get_link("admin/portfolio_edit/" . $section->name . "/" . $attached_item->id) . '">' . $attached_item->get_title() . ' <small>EDIT</small></a></li>'; echo '</ol>'; } ?> <div id="edit-footer" class="videonav clearfix"> <div class="column half"> <p> <input type="submit" class="submitbutton" name="submit" value="Save Video" /> <br /> <input type="submit" class="submitbuttonsmall" name="submit" value="Save and Return to List" /> </p> </div> <div class="column half last"> <?php $user = Users::GetCurrentUser(); if ($user->has_role() && requestIdParam() != "add") { ?> <p><label for="delete">Delete this video?</label> <input name="delete" class="boxes" type="checkbox" value="<?php echo $video->id; ?> " /> <span class="hint">Check the box and then click “Save” above to delete this video from the database</span> </p> <?php } ?> </div> </div> </form> <?php }
function display_page_content() { // Set all values to null by default $entry = $entrytitle = $entrypublic = $entrydate = $entryimage = $entrycontent = $entryexcerpt = $entryauthor = $entrytemplate = $preventry = $nextentry = null; // Get values from existing object if this is not the Add page if (requestIdParam() != 'add') { $entry_id = requestIdParam(); $entry = Blog_Entries::FindById($entry_id); $entrytitle = $entry->title; $entrypublic = $entry->public; $entrydate = $entry->getDateStart(); if (BLOG_ENTRY_IMAGES) { $possibleimage = $entry->getImage(); if (is_object($possibleimage)) { $entryimage = $possibleimage; } } $entrycontent = $entry->content; $entryexcerpt = $entry->excerpt; $entryauthor = $entry->author_id; $entrytemplate = $entry->template; } // Get other needed objects $the_blog = Blogs::FindById(BLOG_DEFAULT_ID); $authors = Users::FindAll(); $categories = Categories::FindAll(); $thisuser = Users::GetCurrentUser(); // Get Previous and Next links if (is_object($entry)) { $preventry = $the_blog->getPrevEntry($entry->date, false); $nextentry = $the_blog->getNextEntry($entry->date, false); } // Warning thrown // Double check that the proper columns exist $photo_entry_id = find_db_column('photos', 'entry_id'); if (!$photo_entry_id) { echo '<h2 class="system-warning"><span>HCd>CMS says:</span> The Photos table does not have a column called "entry_id"</h2>'; } // Language for the header if (is_object($entry)) { $header = 'Edit ' . ucwords(BLOG_STATIC_AREA) . ' Entry :: <a href="' . get_link(BLOG_STATIC_AREA . "/view/" . $entry->id . "/" . slug($entry->title)) . '" title="Click to View this Entry (save it first!)">View Entry</a>'; } else { $header = 'Create new ' . ucwords(BLOG_STATIC_AREA) . ' Entry'; } ?> <div id="edit-header" class="entrynav threecolumnnav"> <div class="nav-left column"> <h1><?php echo $header; ?> </h1> </div> <div class="nav-center column"> <?php if (!empty($preventry)) { ?> <a href="<?php echo get_link("/admin/edit_entry/" . $preventry->id); ?> " title="<?php $preventry->the_title(); ?> ">← Previous Entry</a><?php } ?> </div> <div class="nav-right column"> <?php if (!empty($nextentry)) { ?> <a href="<?php echo get_link("/admin/edit_entry/" . $nextentry->id); ?> " title="<?php $nextentry->the_title(); ?> ">Next Entry →</a><?php } ?> </div> <div class="clearleft"></div> </div> <form method="POST" id="edit_entry" enctype="multipart/form-data"> <p><span class="hint">If a text box is underlined in red, it is a required field</span></p> <p class="display_name"> <label for="display_name">Title:</label> <span class="hint">This is the Title of the entry; how it will display in the navigation.</span><br /> <?php textField("title", $entrytitle, "required: true"); ?> </p> <div id="entry_date" class="column half"> <p><label for="public">Public: <input type="checkbox" name="public" id="public" <?php if ($entrypublic) { ?> checked="checked"<?php } ?> ></label> <span class="hint">Visible or not visible to the public? If you are working on an entry that is not yet ready, leave this off until it is complete. </span></p> <p> <label for="date">Entry Date: </label> <input type="text" name="date" id="date" value="<?php echo $entrydate; ?> " /> </p> <?php if (!BLOG_ENTRY_IMAGES) { ?> </div> <div class="column half last"> <?php } ?> <p> <label for="author_id">Author:</label> <select name="author_id" id="author_id"> <?php foreach ($authors as $theauthor) { $selected = $theauthor->id == $entryauthor ? ' selected="selected"' : ''; echo "<option value=\"{$theauthor->id}\"{$selected}> " . $theauthor->get_username() . " </option>\r\n"; } ?> </select> </p> <?php if (BLOG_ENTRY_TEMPLATES) { ?> <p> <label for="template">Template:</label> <select id="template" name="template"> <?php require_once snippetPath("blog_templates_array"); foreach ($blog_templates as $template) { echo '<option value="' . $template . '"'; if ($template == $entrytemplate) { echo ' selected="selected"'; } echo '>' . $template . '</option>'; } ?> </select> </p> <?php } ?> <?php if (BLOG_ENTRY_IMAGES) { ?> </div> <div id="entry-thumb" class="column half last"> <!-- Entry image --> <div style="padding-bottom: 1em;"> <p><label for="entry_image"><?php echo empty($entryimage) ? 'Add' : 'Edit'; ?> an Entry Image:</label> <input type="file" name="entry_image" id="entry_image" value="" /> </p> <p class="hint">An image may be used by your site design on landing pages or menus. </p> <?php if (!empty($entryimage)) { echo '<h3>Existing Entry Image (reduced in size)</h3>'; echo '<p><img src="' . $entryimage->getPublicUrl() . '" style="max-width:100%;" alt=""></p>'; } echo '</div>'; } // end if BLOG_ENTRY_IMAGES ?> </div> <p class="clearleft"> <label for="entry_content">Content:</label><br /> <?php textArea("entry_content", $entrycontent, 98, EDIT_WINDOW_HEIGHT / 2); ?> </p> <?php require_once snippetPath("admin-insert_configs"); ?> <ul id="gallery-options-nav" class="menu tabs"> <li><a href="#section_selector" class="openclose opened">Edit Categories for this Entry</a></li> </ul> <div id="section_selector" class="dropslide"> <h2><legend>Select a Category to include this Entry in:</legend></h2> <fieldset> <p> <?php $entrycats = is_object($entry) ? $entry->getCategories() : false; foreach ($categories as $thecategory) { $checked = ""; if ($entrycats) { foreach ($entrycats as $entry_cat) { if ($thecategory->id == $entry_cat->id) { $checked = ' checked="checked"'; } } } echo '<label for="' . slug($thecategory->display_name) . '">' . $thecategory->display_name . ' '; echo '<input name="selected_cats[]" id="' . slug($thecategory->display_name) . '" class="boxes"' . $checked . ' type="checkbox" value="' . $thecategory->id . '" /></label>'; } ?> </p> <p><span class="hint">Any entry can be in more than one Category. If no categories are selected, this entry will be categorized in the default “Uncategorized” category.</span></p> </fieldset> </div><!-- #section_selector --> <p class="clearleft"> <label for="entry_excerpt">Excerpt:</label><br /> <?php textArea("entry_excerpt", $entryexcerpt, 98, EDIT_WINDOW_HEIGHT / 3); ?> <p><span class="hint"><i>Optional:</i> An excerpt is commonly used on landing pages or in special areas, like the meta (SEO) description. Keep it short and limit the use of HTML.</span></p> </p> <div id="edit-footer" class="entrynav clearfix"> <div class="column half"> <p> <input type="submit" class="submitbutton" name="submit" value="Save Entry"> <br /> <input type="submit" class="submitbuttonsmall" name="submit" value="Save and Return to List"> </p> </div> <div class="column half last"> <p> <?php if (is_object($entry)) { ?> <label for="delete">Delete this entry?</label> <input name="delete" class="boxes" type="checkbox" value='<?php echo $entry->id; ?> ' /> <span class="hint">Check the box and then click “Save” above to delete this entry from the database</span> <?php } else { echo ' '; } ?> </p> </div> </div> </form> <script type="text/javascript"> var entrydate; $().ready(function() { $( "#date" ).datetimepicker({ showButtonPanel: true, showOtherMonths: true, selectOtherMonths: true, timeFormat: 'hh:mm:ss tt', stepMinute: 5 }); $("#edit_entry").validate({ rules: { title: "required", }, messages: { title: "Please enter a title for this <?php echo BLOG_STATIC_AREA; ?> entry", } }); }); </script> <?php }