Example #1
0
 function RenderChunk($slug = "", $cachelength = "")
 {
     if (!empty($slug)) {
         // Returns a new query or a cached one
         $cache_folder = SERVER_CACHE_ROOT;
         // This usually points to /htdocs/cache/ on Modwest servers
         if (empty($cachelength)) {
             $cachelength = 60 * 60 * 3;
         }
         // seconds * minutes * hours = cache for 3 hours
         $usecache = false;
         $cachefile = $cache_folder . $slug . '.html';
         $user = Users::GetCurrentUser();
         // Skip using a cached file is there is a user logged in right now
         if (empty($user)) {
             // Check if we have this request cached recently;
             if (file_exists($cachefile)) {
                 if (time() - filemtime($cachefile) <= $cachelength) {
                     // Is this file recent enough to use?
                     $cachecontents = file_get_contents($cachefile);
                     // Return the cached xml
                     if (!empty($cachecontents)) {
                         return $cachecontents;
                         $usecache = true;
                         // not neccesary, as the return statement stops execution
                     }
                 } else {
                     unlink($cachefile);
                 }
                 // File stale or empty, delete
             }
         }
         if (!$usecache) {
             $result = Chunks::FindBySlug($slug);
             $result = image_display($result->content);
             $result = email_display($result);
             // Store our cache version
             file_put_contents($cachefile, $result);
             return $result;
         }
     } else {
         return null;
     }
 }
Example #2
0
 function FindPageOrIndex($area, $name, $isdraft = false)
 {
     $draftcond = "";
     if ($isdraft) {
         $draftcond = "AND p.content_file = 'draft'";
     }
     // if the page name is index and a specific "index" page isn't found, return the first page in the area as the index
     $found_pages = MyActiveRecord::FindBySql('Pages', "SELECT p.* FROM pages p INNER JOIN areas_pages ap ON ap.pages_id = p.id INNER JOIN areas a ON a.id = ap.areas_id WHERE p.name like '" . $name . "' {$draftcond} AND a.name like '" . $area->name . "' ORDER BY id ASC");
     // index not found. select all pages ordered by display_order
     if ($name == "index" && count($found_pages) == 0) {
         $found_pages = Pages::FindByArea($area);
     } else {
         if (count($found_pages) == 0) {
             $all_area_pages = MyActiveRecord::FindBySql('Pages', "SELECT p.* FROM pages p INNER JOIN areas_pages ap ON ap.pages_id = p.id INNER JOIN areas a ON a.id = ap.areas_id WHERE a.name like '" . $area->name . "' ORDER BY id ASC");
             if (SUB_PAGES) {
                 foreach ($all_area_pages as $page) {
                     $all_children = $page->get_all_children();
                     foreach ($all_children as $child) {
                         if ($child->name == $name) {
                             return $child;
                         }
                     }
                 }
             }
         }
     }
     $page = array_shift($found_pages);
     // Now that we have a page, allow users logged in to see non-public pages.
     $user = Users::GetCurrentUser();
     $logged_in = false;
     if ($user) {
         $logged_in = true;
     }
     // If not logged in, make sure the first page returned is not a non-public page. Could throw an error.
     if (!$logged_in) {
         while ($page && $page->public == false) {
             $page = array_shift($found_pages);
         }
     }
     return $page;
 }
function display_page_content()
{
    $area_id = requestIdParam();
    $area = Areas::FindById($area_id);
    $user = Users::GetCurrentUser();
    ?>

	<script type="text/javascript">
		$().ready(function() {
			$("#add_area").validate({
				rules : {
					display_name: "required"
				},
				messages: {
					display_name: "Please enter a name you would like to be displayed for this area"
				}
			});
		});
	</script>
	
	<div id="edit-header" class="portareanav">
		<h1>Edit Portfolio Area : <a href="<?php 
    $area->the_url();
    ?>
" title="View <?php 
    $area->the_url();
    ?>
">View Area</a></h1>
	</div>
	
	<form method="POST" id="add_area">
		<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">Display Name:</label>
			<input type="text" name="display_name" value="<?php 
    echo $area->display_name;
    ?>
" class="required: true" /><br />
			<span class="hint">This is the Proper Name of the area; how it will display in the navigation. Keep it simple, but use capitals and spaces, please. </span>
		</p>
		
		<p>
			<label for="seo_title">Title (for SEO):</label>
			<?php 
    textField("seo_title", $area->seo_title);
    ?>
<br />
			<span class="hint">This title is used in title meta tags (good for SEO). Might also show when a user hovers their mouse over a link. </span>
		</p>
		
		<div id="public" class="column half">
			<p>
				<label for="public">Public:</label>&nbsp; <?php 
    checkBoxField("public", $area->public);
    ?>
<br />
				<span class="hint">This determines whether or not the Portfolio Area will appear in the navigation as a &ldquo;Public&rdquo; link. If this Portfolio Area is not public, then no sections within it &ndash; Public or not &ndash; will be visible. A nice way to create a new Portfolio Area is to make the Portfolio Area NOT Public, and all the sections within it Public, so one click can turn it all on when it is ready. </span>
			</p>
		
		</div>
		<div id="template" class="column half">
			<p><label for="template">Template:</label>
				<select id="template" name="template">
				<?php 
    $templates = list_available_templates();
    foreach ($templates as $template) {
        $text = $template;
        echo "<option value=\"{$template}\"";
        if ($template == $area->template) {
            echo " selected=\"selected\"";
        }
        echo ">{$text}</option>";
    }
    ?>
				
				</select><br />
				<span class="hint">When a Page inside this Area uses the template &ldquo;inherit&rdquo;, the Page will inherit this Area&rsquo;s template selection. So, changing this Template may change the display of all Pages within this Area. </span>
			</p>
		</div>
		<div class="clearleft"></div>
		
		<p><label for="area_content">Portfolio Area Description (optional):</label>
			<?php 
    textArea("area_content", $area->content, 98, EDIT_WINDOW_HEIGHT);
    ?>
		
		</p>
<?php 
    require_once snippetPath("admin-insert_configs");
    ?>
		
		
		<div id="edit-footer" class="portareanav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Edit Area" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
				</p>
				
			</div>
			<div class="column half last">
				
			<?php 
    if ($user->has_role() && !in_array($area->id, explode(",", PROTECTED_ADMIN_AREAS))) {
        ?>
				
				<p><label for="delete">Delete this Area? <input name="delete" id="delete" class="boxes" type="checkbox" value="<?php 
        echo $area->id;
        ?>
"></label>
				<span class="hint">Check the box and click &ldquo;Edit&rdquo; to delete from the database. Any sections or items contained within will become orphans and will be shown in the list for reassignment.</span></p>
			<?php 
    } else {
        ?>
		
				<p>This area is being protected, it can not be deleted.</p>
			<?php 
    }
    ?>
			
			</div>
		</div>
		
	</form>
<?php 
}
Example #4
0
function display_page_content()
{
    if (requestIdParam() == "add") {
        $chunk = $chunkslug = $chunkdescription = $chunkcontent = null;
        $chunkhtml = 0;
    } else {
        $chunk_id = requestIdParam();
        $chunk = Chunks::FindById($chunk_id);
        $chunkslug = $chunk->slug;
        $chunkdescription = $chunk->description;
        $chunkhtml = $chunk->full_html;
        $chunkcontent = $chunk->content;
    }
    $user = Users::GetCurrentUser();
    ?>

	<script type="text/javascript">
		$().ready(function() {
			$("#edit_chunk").validate({
				rules : {
					slug: "required", 
					content: "required"
				},
				messages: {
					slug: "Please enter a title for this video", 
					content: "Please enter some content for this chunk"
				}
			});
			<?php 
    if ($chunkhtml) {
        echo 'loadTinyMce("chunk_content");';
    }
    ?>
			
		});
	</script>
	
	<div id="edit-header" class="chunknav">
		<h1>Edit Chunk</h1>
	</div>
	
	<form method="POST" id="edit_chunk">
		<div class="column half">
    		
<?php 
    if ($user->email == '*****@*****.**') {
        ?>
    		
    		<p class="display_name">
    			<label for="slug">Chunk Slug:</label>
    			<?php 
        textField("slug", $chunkslug, "required: true");
        ?>
    		</p>
    		
    		<p>
    			<label for="full_html">Full Html?:</label>&nbsp; <?php 
        checkBoxField("full_html", $chunkhtml);
        ?>
 <br>
    			<span class="hint">Do we need to allow full HTML capabilities on the content field? Checked for &ldquo;Yes&rdquo;, not checked for &ldquo;No&rdquo;.</span>
    		</p>
    		
    		<p>
    			<label for="description">Chunk Description:</label>
    			<?php 
        textField("description", $chunkdescription);
        ?>
    		</p>

<?php 
    } else {
        ?>

            <h2><?php 
        echo $chunkslug;
        ?>
</h2>
    		
    		<p><strong><?php 
        echo $chunkdescription;
        ?>
</strong></p>

<?php 
    }
    ?>

    		<div class="clearit"></div>
		</div>
		<div class="column half last">
    		
    		<p>
    			<label for="chunk_content">Content:</label>
    			<?php 
    textArea("chunk_content", $chunkcontent, 98, 18);
    ?>
    		</p>
    		
		</div>
		<div class="clearleft"></div>
		
		
		<div id="edit-footer" class="chunknav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Save Chunk" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Save and Return to List" />
				</p>
				
			</div>
			<div class="column half last">
<?php 
    if ($user->email == '*****@*****.**') {
        ?>
	
				<p><label for="delete">Delete this chunk?</label>
					<input name="delete" class="boxes" type="checkbox" value="<?php 
        echo $chunk->id;
        ?>
" />
					<span class="hint">Check the box and then click &ldquo;Save&rdquo; above to delete this chunk from the database</span>
				</p>
<?php 
    }
    ?>
			</div>
		</div>
	
	</form>
<?php 
}
Example #5
0
function display_page_content()
{
    $event_id = getRequestVarAtIndex(4);
    $event = Events::FindById($event_id);
    $event_types = EventTypes::FindAll();
    $event_periods = EventPeriods::FindAll();
    $year = getRequestVarAtIndex(2);
    $month = getRequestVarAtIndex(3);
    $recurrences = Recurrence::FindForEvent($event_id);
    $days = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    $user = Users::GetCurrentUser();
    ?>

<script type="text/javascript">
	//<![CDATA[
	$().ready(function() {
		setupDateFields("<?php 
    echo $event->eventperiod_id;
    ?>
");
		
		$.datepicker.setDefaults({
            showButtonPanel: true,
			showOtherMonths: true,
			selectOtherMonths: true
        });
        
        $( "#date_start" ).datepicker();
		$( "#time_start" ).timepicker({timeFormat: 'hh:mm:ss tt',stepMinute: 5});
		$( "#date_end" ).datepicker();
		$( "#time_end" ).timepicker({timeFormat: 'hh:mm:ss tt',stepMinute: 5});
		$( "#not_date" ).datepicker();
		
		$("a#notdate_add").click(function() {
			var date = $("input[name='not_date']").val();
			if (date != "") {
				$("input[name='not_date']").val('');
				var all_dates_vis = $("span#notdates").html();
				$("span#notdates").html("<label for=\"notdates[]\">"+date+"&nbsp;<a href=\"javascript:;\" onClick=\"$(this).parent().remove();\">X</a><input type=\"hidden\" name=\"notdates[]\" value=\""+date+"\" /></label>"+all_dates_vis);
			}
		});
		
		$("#eventperiod_id").change(function() { 
			var selected = $(this).val();
			setupDateFields(selected);
		});

		$("#edit_event").validate({
			rules: {
				title: "required",
				date_start: "required",
			},
			messages: {
				title: "Please enter a title for this event",
				date_start: "Please at least a start date for this event",
			}
		});
	});
	//]]>
</script>

<div id="edit-header" class="event">
	<h1>Edit Event</h1>
</div>

<div id="calendar_div"></div>

<form method="POST" id="edit_event">
	
	<p class="display_name">
        <label for="title">Title</label>
    	<?php 
    textField("title", $event->title, "required: true");
    ?>
	</p>
    
    <?php 
    if (ALLOW_EVENT_TYPES && count($event_types) > 1) {
        ?>
	<p>
	    <label for="eventtype_id">Event Type</label>
    	<select name="eventtype_id" id="eventtype_id">
		<?php 
        foreach ($event_types as $event_type) {
            echo "<option value='{$event_type->id}' ";
            if ($event_type->id == $event->eventtype_id) {
                echo " selected ";
            }
            echo ">{$event_type->name}</option>\r\n";
        }
        ?>
    	</select>
	</p>
    <?php 
    }
    ?>
    
	<div id="eventdateselects" class="dropslide">
		<p><label for="eventperiod_id">Event Period:</label>
    		<select name="eventperiod_id" id="eventperiod_id">
			<?php 
    foreach ($event_periods as $event_period) {
        echo "<option value='{$event_period->id}' ";
        if ($event_period->id == $event->eventperiod_id) {
            echo " selected ";
        }
        echo ">{$event_period->name}</option>\r\n";
    }
    ?>
    		</select>
		</p>
	
		<p>
		    <label for="date_start">Start Date / Time</label>
    		<input type="text" name="date_start" id="date_start" style="width: 6.5em;" value="<?php 
    echo $event->getDateStart("date");
    ?>
" class="required: true" />&nbsp;
    		<input type="text" name="time_start" id="time_start" style="width: 6.5em;" value="<?php 
    echo $event->getDateStart("time");
    ?>
" />&nbsp;&nbsp; 
		
    		<label for="date_start">End Date / Time</label>
    		<input type="text" name="date_end" id="date_end" style="width: 6.5em;" value="<?php 
    echo $event->getDateEnd("date");
    ?>
" />&nbsp;
    		<input type="text" name="time_end" id="time_end" style="width: 6.5em;" value="<?php 
    echo $event->getDateEnd("time");
    ?>
" />
        </p>
		
		<div id="recurrence_rules" <?php 
    if ($event->eventperiod_id != 3) {
        echo "style=\"display: none; \"";
    }
    ?>
>
			<p><label for="not_date">Exclusion Date(s)</label>
				<input type="text" name="not_date" id="not_date" style="width: 6.5em;"/>&nbsp;<a href="javascript:;" id="notdate_add">Add to list&rarr;</a> 
				<span id="notdates">
				<?php 
    foreach (explode(",", $event->getNotDates()) as $date) {
        if ($date != "") {
            echo "<label for=\"{$date}\">{$date} &nbsp;<a href=\"javascript:;\" onClick=\"\$(this).parent().remove();\">&times;</a><input type=\"hidden\" name=\"notdates[]\" value=\"{$date}\" /></label>";
        }
    }
    ?>
				</span>
			</p>
	
			<label>Recurrence Rules</label>
			<table>
				<tbody>
					<tr>
						<th>&nbsp;</th>
						<th>Sunday</th>
						<th>Monday</th>
						<th>Tuesday</th>
						<th>Wednesday</th>
						<th>Thursday</th>
						<th>Friday</th>
						<th>Saturday</th>
					</tr>
					<tr>
						<td>Every</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 0);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>First</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 1);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Second</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 2);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Third</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 3);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Fourth</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 4);
        echo "</td>";
    }
    ?>
					</tr>
					<tr>
						<td>Last</td>
						<?php 
    foreach ($days as $day) {
        echo "<td>";
        get_recurrence_tag($recurrences, $day, 5);
        echo "</td>";
    }
    ?>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
	
    <p>
        <label for="name">Event Description</label><br />
        <?php 
    textArea("description", $event->description, 98, EDIT_WINDOW_HEIGHT);
    ?>
    </p>
	
	<?php 
    require_once snippetPath("admin-insert_configs");
    ?>
	
	<div id="edit-footer" class="eventnav clearfix">
		<div class="column half">
			<p>
				<input type="submit" class="submitbutton" name="submit" value="Edit Event" /> <br />
				<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
			</p>
		</div>
		<div class="column half last">
			
		<?php 
    if ($user->has_role()) {
        ?>
			
			<p><label for="delete">Delete this Event? <input name="delete" id="delete" class="boxes" type="checkbox" value="<?php 
        echo $event->id;
        ?>
"></label>
    		<span class="hint">Check the box and click &ldquo;Save&rdquo; to delete this event from the database</span></p>
		<?php 
    }
    ?>
		
		</div>
	</div>
	
</form>
<?php 
}
Example #6
0
function display_page_content()
{
    $document_id = requestIdParam();
    $document = Documents::FindById($document_id);
    ?>

	<script type="text/javascript">
		$().ready(function() {
			$("#edit_document").validate({
				rules : {
					name: "required"
				},
				messages: {
					name: "Please enter a name for this document"
				}
			});
		});
	</script>
	
	<div id="edit-header" class="documentnav">
		<h1>Edit Document</h1>
	</div>
	
	<form method="POST" enctype="multipart/form-data" id="edit_document">
		<input type="hidden" name="MAX_FILE_SIZE" value="15800000">
		
		<p class="display_name">
			<label for="name">Name:</label>
			<?php 
    textField("name", $document->name, "required: true");
    ?>
<br />
			<span class="hint">This is a more descriptive name for the file that will be displayed as the link when you insert it into a page. The name can start with the words &ldquo;Click here to download&hellip;&rdquo; in order t be most clear on the front-end display, but that is up to you.</span>
		</p>
		
		<p>
			<label for="filename">File Name (uneditable):</label>
			<?php 
    echo $document->filename;
    ?>
<br />
			<span class="hint">This is the physical name of the file that was uploaded.</span>
		</p>
		
		<p>
			<label for="file">Replace with a new document:</label>
			<?php 
    fileField('file');
    ?>
		</p>
		
		
		<div id="edit-footer" class="documentnav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Save Document" /> <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()) {
        ?>
	
				<p><label for="delete">Delete this document?</label>
					<input name="delete" class="boxes" type="checkbox" value="<?php 
        echo $document->id;
        ?>
" />
					<span class="hint">Check the box and then click &ldquo;Save&rdquo; above to delete this document from the database</span>
				</p>
<?php 
    }
    ?>
			</div>
		</div>
	
	</form>
<?php 
}
Example #7
0
function display_page($params = array())
{
    // canonicalize the input
    $area_name = $page_name = "";
    // GET /
    if (count($params) == 0) {
        $area_name = "index";
        $page_name = "index";
    }
    // GET /area_name
    if (count($params) == 1) {
        $area_name = $params[0];
        $page_name = "index";
    }
    // GET /area_name/page_name
    if (count($params) > 1) {
        $area_name = $params[0];
        $page_name = $params[1];
    }
    if (ALIAS_INSTALL) {
        // Test the MyActiveRecord connection
        if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'alias'")) == 1) {
            // check the alias' in the database and see if there is a match
            $alias = Alias::FindAll();
            /* die(print_r($alias)); */
            foreach ($alias as $entry) {
                if ($entry->alias == $area_name || $entry->alias == "/" . $area_name) {
                    redirect($entry->path);
                }
            }
        }
    }
    // check the routes to see if the requested page has an explicit route setup
    $page_options = $GLOBALS['ROUTES'];
    if (isset($page_options["/" . $area_name . "/" . $page_name])) {
        $page = StaticPage::FindByAreaAndName($area_name, $page_name);
        if (isset($page)) {
            display_admin_with_template($page);
            return true;
        }
    }
    // check for pages that are in the "global" area and have params (ie /calendar/2008/1)
    $global_area = Areas::FindByName('index');
    $possible_page = Pages::FindByAreaAndName($global_area, $page_name) ? Pages::FindByAreaAndName($global_area, $area_name) : '';
    if (!empty($possible_page)) {
        $area = $global_area;
        $page = $possible_page;
    } else {
        // for now, just include the first page that comes back. later we can handle multiple pages
        $area = Areas::FindByName($area_name);
        if (!isset($area)) {
            return false;
        }
        if (strstr($area_name, "-portfolio")) {
            if ($page_name != "index") {
                $page = Sections::FindByName($page_name);
            } else {
                $pages = $area->getSections();
                $page = array_shift($pages);
            }
        } else {
            $page = Pages::FindPageOrIndex($area, $page_name);
        }
    }
    if (!isset($page)) {
        return false;
    }
    // check if the page is public or not
    $is_admin = false;
    $user = Users::GetCurrentUser();
    if ($user) {
        $logged_in = true;
    }
    if ($page->public || !$page->public && $logged_in) {
        display_with_template($area, $page);
    } else {
        return false;
    }
    return true;
}
Example #8
0
function display_page_content()
{
    $gallery = Galleries::FindById(requestIdParam());
    $photos = $gallery->get_photos();
    $user = Users::GetCurrentUser();
    ?>

	<script type="text/javascript">
		$().ready(function() {
			$("#edit_gallery").validate({
				errorLabelContainer: $("#error_container"),
				rules: {
					name: "required"
				},
				messages: {
					name: "Please enter a name for this gallery<br/>"
				}
			});
		});
		
		$().ready(function() {
			$("#photo_list_order").sortable({
				stop: function() {
					$("#photo_list_order li input[type=hidden]").each(function(i) {
						$(this).val(i+1);
					});
				}
			});
		});
	</script>
	
	<div id="edit-header" class="documentnav">
		<h1>Edit Gallery</h1>
	</div>

<?php 
    // DEBUG block. Run some tests. NOT PERFECT but should help point in the right direction.
    if (HCd_debug()) {
        echo '<div class="debug-block">';
        // Check the folder path to see if it exists
        if (is_dir(SERVER_DOCUMENTS_ROOT)) {
            echo '<span class="debug-feedback passed">&ldquo;' . SERVER_DOCUMENTS_ROOT . '&rdquo; exists</span>';
            $permmode = substr(sprintf('%o', fileperms(SERVER_DOCUMENTS_ROOT)), -4);
            if ($permmode == '0777' || $permmode == '0775') {
                echo '<span class="debug-feedback passed">The folder permission is <strong>' . $permmode . '</strong></span>';
            } else {
                echo '<span class="debug-feedback failed">The folder permission is <strong>' . $permmode . '</strong></span>';
            }
            if (is_dir(SERVER_DOCUMENTS_ROOT . "gallery_photos")) {
                echo '<span class="debug-feedback passed">&ldquo;' . SERVER_DOCUMENTS_ROOT . 'gallery_photos&rdquo; exists</span>';
                $permmode2 = substr(sprintf('%o', fileperms(SERVER_DOCUMENTS_ROOT . "gallery_photos")), -4);
                if ($permmode2 == '0777' || $permmode2 == '0775') {
                    echo '<span class="debug-feedback passed">The folder permission is <strong>' . $permmode2 . '</strong></span>';
                } else {
                    echo '<span class="debug-feedback failed">The folder permission is <strong>' . $permmode2 . '</strong></span>';
                }
            } else {
                echo '<span class="debug-feedback failed">&ldquo;' . SERVER_DOCUMENTS_ROOT . 'gallery_photos&rdquo; does NOT exist or can not be seen</span>';
            }
        } else {
            echo '<span class="debug-feedback failed">&ldquo;' . SERVER_DOCUMENTS_ROOT . '&rdquo; does NOT exist</span>';
        }
        $test_file = SERVER_INCLUDES_ROOT . "www/lib/admin_images/hcdlogo_24.png";
        if (is_file($test_file)) {
            $test_imagecreatefromjpeg = @imagecreatefrompng($test_file);
            if ($test_imagecreatefromjpeg !== false) {
                echo '<span class="debug-feedback passed">&ldquo;@imagecreatefrompng&rdquo; works</span>';
            } else {
                echo '<span class="debug-feedback failed">&ldquo;@imagecreatefrompng&rdquo; returns false</span>';
            }
        } else {
            echo '<span class="debug-feedback failed">Test file does not exist. &ldquo;imagecreatefrompng&rdquo; test cannot run. </span>';
            echo '<span class="debug-feedback failed">Test file path: &ldquo;' . $test_file . '&rdquo;</span>';
        }
        echo '</div>';
    }
    ?>
	
	<form method="POST" id="edit_gallery" enctype="multipart/form-data">
		<p><span class="hint">If a text box is underlined in red, it is a required field</span></p>
		<a name="top"></a>
		
		<p class="display_name">
			<label for="name">Gallery Display Name:</label> <span class="hint">This is the Proper Name of the gallery.</span><br />
			<?php 
    textField("name", $gallery->name, "required: true");
    ?>
		</p>
		
		<p class="announce">
			<strong>Note:</strong> While the server will attempt to upload very large images and resize them, doing so may take a very long time. Please try to resize images to reasonable dimensions (about 800 pixels wide) before uploading. We recommend the Adobe Photoshop &ldquo;Save for Web&rdquo; feature, which makes the image file size very small (In Photoshop, under File > Save for Web. Use JPEG file type and a compression of about 60%. Click Progressive as well).<br />
		<br />
		The server will attempt to resize an image to a maximum dimension of: <strong><?php 
    echo MAX_GALLERY_IMAGE_WIDTH;
    ?>
 pixels wide by <?php 
    echo MAX_GALLERY_IMAGE_HEIGHT;
    ?>
 pixels tall</strong>. This is best for viewing images for the web. </p>
		<p>&nbsp;</p>
			
<!-- Start the Show/Hide for editing photos and changing order -->
		<div id="gallery-options" class="clearfix">
			
			<a name="editgal"></a>
			<ul id="gallery-options-nav" class="menu tabs">
				<li><a href="#gallery_sort" class="openclose opened">Change Photo Order</a></li>
				<li><a href="#add_edit_images" class="openclose">Add / Edit Photos and Captions</a></li>
			</ul>
		
			<div id="gallery_sort" class="dropslide">
				<h2>Click and Drag the image to change the order of the display in the Gallery</h2>
				<div id="sortable_container">
<?php 
    if (count($photos) > 0) {
        echo "\t\t\t\t<ol id=\"photo_list_order\">\n";
        foreach ($photos as $photo) {
            echo "\t\t\t\t\n\t<li><img class=\"changeorderThumb\" src=\"{$photo->getPublicUrl()}\" /><input type=\"hidden\" name=\"photos_display_order[" . $photo->id . "]\" value=\"" . $photo->display_order . "\" /></li>\n";
        }
        echo "\t\t\t\t</ol>\n";
    } else {
        echo "\n\n\n\n<h3>There are no photos to put in order. Go ahead and add some.</h3>\n";
    }
    ?>
								
				</div>
				<div class="clearleft"></div>
			</div>
			
			<div id="add_edit_images" class="dropslide" style="display: none;">
				<div id="add_image_wrap">
					<h2>Add an Additional Gallery Image</h2>
					<p><span class="hint">Images for your site would be best displayed at <?php 
    echo MAX_GALLERY_IMAGE_WIDTH;
    ?>
 pixels wide. If an image is larger, the system will attempt to resize it. Images that are too large might require more memory than the system can handle, and an error may result.</span></p>
					<p><label for="new_photo">Add an additional image:</label>
						<input type="file" name="new_photo" id="new_photo" value="" />
					</p>
					<p><label for="new_photo_caption">Caption for new image:</label>
						<?php 
    textField("new_photo_caption", "", "");
    ?>
					</p>
					<p><input type="submit" class="submitbutton" name="submit" value="Add Image to Gallery" /></p>
				</div>
				
				<p>&nbsp;</p>
				<h2>Edit Existing Gallery Photos (delete photos or edit captions. Click Save when done)</label></h2>
				<p><span class="hint"><strong>Image size:</strong> The CSS control for the images designates that they display here (for ease of use) at 50% their actual size. Dont&rsquo;t worry if they appear smaller than on the front-end.<!--[if IE 6]><br /><b>IE 6 Users: The CSS can only force the image to be 240 pixels wide, which for some images, may be larger than normal, resulting in pixellation. </b><![endif]--></span></p>				                                                                                                                                                  
	<?php 
    if (count($photos) > 0) {
        echo "<ul id=\"add_photo_list\">\n";
        foreach ($photos as $photo) {
            echo "<li><img src=\"{$photo->getPublicUrl()}\" />\n";
            echo "<div><input type=\"checkbox\" name=\"deleted_photos[]\" value=\"{$photo->id}\"/>&nbsp;DELETE</div>";
            textField("captions[{$photo->id}]", "{$photo->caption}", "");
            echo "</li>\n";
        }
        echo "</ul>\n";
    } else {
        echo "<h3>There are no photos to edit. Go ahead and add some.</h3>\n";
    }
    ?>
								
				<p><a href="#top">Back to the Top of the Page</a></p>
			</div>
		
		</div>
<!-- End the Show/Hide -->
			
		
		<div id="edit-footer" class="gallerynav clearfix">
			<div id="error_container"></div>
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Edit Gallery" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
				</p>
				
			</div>
			<div class="column half last">
				
			<?php 
    if ($user->has_role() && !in_array($gallery->id, explode(",", PROTECTED_ADMIN_GALLERIES))) {
        ?>
				
				<p><label for="delete">Delete this Gallery?</label>
				<input name="delete" class="boxes" type="checkbox" value="<?php 
        echo $gallery->id;
        ?>
" />
				<span class="hint">Check the box and click &ldquo;Edit&rdquo; to delete from the database</span></p>
			<?php 
    } else {
        ?>
			
			    <p>This gallery is being used by a template, so it can not be deleted. Please edit its name or contents only. </p>
			<?php 
    }
    ?>
			
			</div>
		</div>
	
	</form>
<?php 
}
Example #9
0
<!--[if IE 8]>         <html class="no-js lt-ie9 ie8">            <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en">             <!--<![endif]-->

<?php 
// Sometimes cache-busting seems to be needed on CSS and JS.
// Use ?ver=<?php echo date("njHis")
if (!isset($page)) {
    $page = null;
}
// Set the title of the page: Check the strings to do some fancy stuff...
$page_title = $description = $bodyclass = $template = "";
$blogitem = $category = null;
$template = isset($area) && isset($page) ? $page->getTemplateForArea($area) : "no-template-specified";
$current_user = Users::GetCurrentUser();
$admin_class = is_object($current_user) ? ' loggedin' : ' no-loggedin';
$admin_class = is_object(Users::GetCurrentUser()) ? ' loggedin' : '';
// CUSTOM
$var0 = getRequestVarAtIndex(0);
$var1 = getRequestVarAtIndex(1);
$var2 = getRequestVarAtIndex(2);
$var3 = getRequestVarAtIndex(3);
if (BLOG_INSTALL && $var0 == BLOG_STATIC_AREA) {
    $blogarea = Areas::FindById(3);
    // Might need to change this on a per project basis
    $page_title = $blogarea->get_title() . " | " . SITE_NAME;
    $bodyclass = "blog archive";
    if ($var1 == "category") {
        $category = Categories::FindByName($var2);
        $description = $category->get_excerpt(160);
        $page_title = $category->get_title() . " | " . $blogarea->get_title() . " | " . SITE_NAME;
        $bodyclass = "blog category-archive";
function display_page_content()
{
    $areas = Areas::FindPortAreas();
    // get all Portfolio Areas, public or not
    $user = Users::GetCurrentUser();
    ?>

	<div id="edit-header" class="sectionnav">
		<h1>Add Portfolio Section</h1>
	</div>
	
	<form method="POST" id="add_section">
		<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">Display Name:</label>
			<?php 
    textField("display_name", "", "required: true");
    ?>
<br />
			<span class="hint">This is the Proper Name of the section; how it will display in the navigation. Keep it simple, but use capitals and spaces, please.</span>
		</p>

		<?php 
    if (ALLOW_SHORT_PAGE_NAMES) {
        ?>
					
		<p>
			<label for="name">Name</label>
			<?php 
        textField("name", "", "required: true");
        ?>
<br />
			<span class="hint">This is the short name of the section for the link and the database. No spaces, commas, or quotes, please.</span>
		</p>
		<?php 
    }
    ?>
		
	<?php 
    if ($user->email == "*****@*****.**") {
        ?>
		<p><label for="template">Template:</label>
			<select id="template" name="template">
			<?php 
        $templates = list_available_templates();
        foreach ($templates as $template) {
            $text = $template;
            echo "<option value=\"{$template}\">{$text}</option>";
        }
        ?>
			
			</select></p>
	<?php 
    } else {
        hiddenField("template", "portfolio");
    }
    ?>
		
		<p>
			<label for="public">Public?</label><input type="checkbox" name="public" class="boxes"/><br />
			<span class="hint">This determines whether or not the Section will appear in the navigation as a &ldquo;Public&rdquo; link. If this Section is not public, then no items within it &ndash; Public or not &ndash; will be visible. A nice way to create a new Section and make sure it works well is to make the Section NOT Public, and all the items within it Public, so one click can turn it all on when it is ready. </span>
		</p>
		
		<p>
			<label for="content">Section Description:</label>
			<?php 
    textArea("section_content", "", 98, EDIT_WINDOW_HEIGHT);
    ?>
		
		</p>
<?php 
    require_once snippetPath("admin-insert_configs");
    ?>
		
		
<?php 
    require_once snippetPath("admin-portfolio-area");
    ?>
	

	
		<div id="edit-footer" class="sectionnav clearfix">
			<div id="error_container"></div>
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Add New Section" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Add and Return to List" />
				</p>
				
			</div>
			<div class="column half last">
				<p>To ensure that a new Section does not become public without any Items inside of it, a new section will automatically be set to <strong>Not Public</strong>. Add some Items and edit this Section later to make it public and visible. </p>
			</div>
		</div>
	</form>
	
	<script type="text/javascript">
		$().ready(function() {
			errorLabelContainer: $("#error_container"),
<?php 
    if (ALLOW_SHORT_PAGE_NAMES) {
        ?>
					
			
			$("#add_section").validate({
					rules : {
						name: "required",
						display_name: "required",
						"selected_areas[]": "required"
					},
					messages: {
							name: "Please enter a name for this Section",
							display_name: "Please enter a display name for this Section",
							"selected_areas[]": "Almost forgot! Select at least one area to include the page in" 
						}
				});
		});
<?php 
    } else {
        ?>
					
		
			$("#add_section").validate({
					rules : {
						display_name: "required",
						"selected_areas[]": "required"
					},
					messages: {
							display_name: "Please enter a display name for this Section",
							"selected_areas[]": "Almost forgot! Select at least one area to include the page in" 
						}
				});
<?php 
    }
    ?>

		});					
	</script>
	
<?php 
}
Example #11
0
function display_page_content()
{
    $portareas = Areas::FindPortAreas(false);
    $item_id = getRequestVaratIndex(3);
    $item = Items::FindById($item_id);
    $next_item = $prev_item = "";
    $sectionname = getRequestVaratIndex(2);
    if ($sectionname != "orphan_section") {
        // Problem is, there could be two sections with the same name in different Areas. So, loop through the Sections attached to this item
        $item_sections = $item->getSections();
        foreach ($item_sections as $thissect) {
            if ($thissect->name == $sectionname) {
                $a_section = Sections::FindById($thissect->id);
                $thisarea = $a_section->thePortfolioArea();
                $next_item = $item->findNext($a_section, "");
                $prev_item = $item->findPrev($a_section, "");
                break;
            }
        }
    }
    $user = Users::GetCurrentUser();
    // If a gallery gets detached or this item doesn't have one, don't create an error.
    $gallery = $item->getGallery();
    if (is_object($gallery)) {
        $photos = $gallery->get_photos();
        $photocount = count($photos) == 0 ? "None" : count($photos);
        // Sometimes the following statement throws errors. Check it out if this page behaves funny.
        if (ITEM_VIDEOS) {
            $gallery_items = $gallery->get_photos_and_videos();
            $photocount = count($gallery_items) == 0 ? "None" : count($gallery_items);
            $itemvideos = $item->findVideos($gallery, 'display_order DESC');
            $vidcount = count($itemvideos) == 0 ? "None" : count($itemvideos);
        }
    } else {
        $gallery = false;
        $photos = $itemvideos = $gallery_items = null;
        $photocount = 0;
        $vidcount = "None";
    }
    if (ITEM_DOCUMENTS) {
        $itemdocuments = $item->findDocuments('display_order DESC');
        $doccount = count($itemdocuments) == 0 ? "None" : count($itemdocuments);
    }
    ?>

	<script type="text/javascript">
	//<![CDATA[
		$().ready(function() {
			
			$("#edit_item").validate({
				errorLabelContainer: "#error_container",
				rules: {
						display_name: "required",
						"selected_sections[]": "required",
					},
				messages: {
						display_name: "Please enter a name that should be displayed for this item",
						"selected_sections[]": "Almost forgot! Select at least one section to include this item in", 
					}
			});
			
			$("#photo_list_order").sortable({
				stop: function() {
					$("#photo_list_order li input.displayorder").each(function(i) {
						$(this).val(i+1);
					});
				}
			});
			
			$("#document_list").sortable({
				stop: function() {
					$("#document_list li input[type=hidden]").each(function(i) {
						$(this).val(i+1);
					});
				}
			});
		});
	//]]>
	</script>

	<div id="edit-header" class="itemnav threecolumnnav">
		<div class="nav-left column">
			<h1>Edit Item<?php 
    if ($sectionname != "orphan_section") {
        ?>
 : <a href="<?php 
        $item->the_url($thisarea, $a_section);
        ?>
" title="View &ldquo;<?php 
        $item->the_title();
        ?>
&rdquo;">View Item</a><?php 
    }
    ?>
</h1>
		</div>
		<div class="nav-center column">
			<?php 
    if ($prev_item != "") {
        ?>
<a href="<?php 
        echo get_link("/admin/portfolio_edit/" . $a_section->name . "/" . $prev_item->id);
        ?>
" title="<?php 
        $prev_item->the_title();
        ?>
">&larr; Previous Item</a><?php 
    }
    ?>
		</div>
		<div class="nav-right column">
			<?php 
    if ($next_item != "") {
        ?>
<a href="<?php 
        echo get_link("/admin/portfolio_edit/" . $a_section->name . "/" . $next_item->id);
        ?>
" title="<?php 
        $next_item->the_title();
        ?>
">Next Item &rarr;</a><?php 
    }
    ?>
			
		</div>
		<div class="clearleft"></div>
	</div>


<?php 
    // NEW! Debug messages.
    if (HCd_debug()) {
        echo '<div class="debug-block">';
        if (!$gallery) {
            echo '<span class="debug-feedback failed">$gallery is false! Was never created or got detached...</span>';
        }
        // Check the folder path to see if it exists
        if (is_dir(SERVER_DOCUMENTS_ROOT)) {
            echo '<span class="debug-feedback passed">&ldquo;' . SERVER_DOCUMENTS_ROOT . '&rdquo; is a writeable folder</span>';
            echo '<span class="debug-feedback passed">The folder permission is <strong>' . substr(sprintf('%o', fileperms(SERVER_DOCUMENTS_ROOT)), -4) . '</strong></span>';
            if (is_dir(SERVER_DOCUMENTS_ROOT . "gallery_photos")) {
                echo '<span class="debug-feedback passed">&ldquo;' . SERVER_DOCUMENTS_ROOT . 'gallery_photos&rdquo; is a writeable folder</span>';
                echo '<span class="debug-feedback passed">The folder permission is <strong>' . substr(sprintf('%o', fileperms(SERVER_DOCUMENTS_ROOT . "gallery_photos")), -4) . '</strong></span>';
            } else {
                echo '<span class="debug-feedback failed">&ldquo;' . SERVER_DOCUMENTS_ROOT . 'gallery_photos&rdquo; is NOT a writeable folder</span>';
            }
        } else {
            echo '<span class="debug-feedback failed">&ldquo;' . SERVER_DOCUMENTS_ROOT . '&rdquo; is NOT a writeable folder</span>';
        }
        echo '</div>';
    }
    ?>


	<form method="POST" id="edit_item" 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">Display Name:</label>
			<?php 
    textField("display_name", $item->display_name, "required: true");
    ?>
		</p>
		
<?php 
    if (PORTFOLIOTHUMB_IMAGE) {
        ?>
		<div id="thumbnail" class="column half">
			
			<p><label for="thumbnail">Thumbnail:</label></p>
			<p>
				<img src="<?php 
        echo get_link("portfolio/thumbnail/{$item->id}");
        ?>
" />
			    &nbsp;Select a new image to use as a thumbnail:<br />
			    &nbsp;<input type="file" name="thumbnail" id="id_thumbnail" value="" class="" />
			</p>
		</div>
		<div class="column half last">
<?php 
    } else {
        ?>
	
		<div>
<?php 
    }
    ?>
		
<?php 
    if (ITEM_SKU) {
        ?>
			<p>
				<label for="item_sku">Item Sku (unique ID):</label>
				<?php 
        textField("item_sku", $item->sku);
        ?>
			</p>

<?php 
    }
    if (ITEM_PRICE) {
        ?>
			<p>
				<label for="item_price">Item Price:</label>
				<?php 
        textField("item_price", $item->price);
        ?>
			</p>

<?php 
    }
    if (ITEM_TAXONOMY) {
        require_once snippetPath("item-taxonomy");
    }
    ?>
			
			<p><label for="public">Public:</label><?php 
    checkBoxField("public", $item->public);
    ?>
&nbsp; <span class="hint">Visible or not visible to the public? If you are working on an item that is not yet ready, leave this off until it is complete.</span></p>
	
		</div>
		<div class="clearleft"></div>

		<p>
			<label for="item_content">Item Description:</label><br />
			<?php 
    textArea("item_content", $item->content, 98, EDIT_WINDOW_HEIGHT);
    ?>
		</p>
		
		
<?php 
    require_once snippetPath("admin-insert_configs");
    ?>
						
						
<!-- Start the Show/Hide for editing photos and changing order -->
		<div id="gallery-options">
			
			<a name="editgal"></a>
			<ul id="gallery-options-nav" class="menu tabs">
				<li><a href="#section_selector" class="openclose">Edit Sections this Item is in</a></li>
				<li><a href="#gallery_sort" class="openclose opened">Change Media Order <span>(<?php 
    echo $photocount;
    ?>
)</span></a></li>
				<li><a href="#add_edit_images" class="openclose">Add / Edit Photos and Captions</a></li>
				<?php 
    if (ITEM_VIDEOS) {
        ?>
				<li><a href="#add_videos" class="openclose">Add / Edit Videos <span>(<?php 
        echo $vidcount;
        ?>
)</span></a></li>
				<?php 
    }
    if (ITEM_DOCUMENTS) {
        ?>
				<li><a href="#add_edit_documents" class="openclose">Add / Edit Documents <span>(<?php 
        echo $doccount;
        ?>
)</span></a></li>
				<?php 
    }
    ?>
				
			</ul>
			
			
			<!-- Select a Section -->
			<div id="section_selector" class="dropslide" style="display:none;">
				<h2><legend>Select a Section to include this Item in:</legend></h2>
				<fieldset>
	<?php 
    foreach ($portareas as $area) {
        echo "<p><strong>" . $area->get_title() . ":</strong><br />";
        $sections = $area->getSections(true);
        foreach ($sections as $section) {
            $checked = $labelchecked = "";
            if (isset($item_sections)) {
                foreach ($item_sections as $item_section) {
                    if ($item_section->id == $section->id) {
                        $checked = "checked='checked'";
                        $labelchecked = " class='selected'";
                    }
                }
            }
            echo "\t\t\t\t\t<label for='selected_sections[]'{$labelchecked}>{$section->display_name}&nbsp;<input id=\"selected_areas[]\" name='selected_sections[]' class='boxes' {$checked} type='checkbox' value='{$section->id}' /></label>\n";
        }
        echo "</p>\n";
    }
    ?>
									
					<p><span class="hint">Any item can be in more than one Section. If no sections are selected, this item will not be viewable by the public and it will appear under &ldquo;Orphaned Items&rdquo;.</span></p>
				</fieldset>
				<div class="clearleft"></div>
			</div><!-- #section_selector -->
			
			
			<!-- Sort gallery order of the items. Could be mixed images AND videos. -->
			<div id="gallery_sort" class="dropslide">
				<h2>Click and Drag the image to change the order of the display in the Gallery <!--<small>(ID= <?php 
    echo $gallery->id;
    ?>
)</small>--></h2>
				<div id="sortable_container">
<?php 
    if (ITEM_VIDEOS && !is_null($gallery_items)) {
        // There could be videos AND photos in this gallery
        if (count($gallery_items) > 0) {
            echo "\t\t\t\t<ol id=\"photo_list_order\">\n";
            foreach ($gallery_items as $galitem) {
                if ($galitem->type == 'photo') {
                    // Treat as a photo
                    echo "\t\t\t\t\t<li><img class=\"changeorderThumb\" src=\"{$galitem->getPublicUrl()}\" />\n        \t\t\t\t\t\t<input type=\"hidden\" name=\"galitem_display_order[" . $galitem->id . "]\" class=\"displayorder\" value=\"" . $galitem->display_order . "\" />\n        \t\t\t\t\t\t<input type=\"hidden\" name=\"galitem_type[" . $galitem->id . "]\" value=\"" . $galitem->type . "\" /></li>\n";
                } else {
                    // Treat as a video
                    echo "\t\t\t\t\t<li><div class=\"changeorderThumb videoThumb\">Video: " . $galitem->get_title() . "</div>\n        \t\t\t\t\t\t<input type=\"hidden\" name=\"galitem_display_order[" . $galitem->id . "]\" class=\"displayorder\" value=\"" . $galitem->display_order . "\" />\n        \t\t\t\t\t\t<input type=\"hidden\" name=\"galitem_type[" . $galitem->id . "]\" value=\"" . $galitem->type . "\" /></li>\n";
                }
            }
            echo "\t\t\t\t</ol>\n";
        } else {
            echo "<h3 class=\"empty-list\">There are no photos or videos to put in order. Go ahead and add some.</h3>\n";
        }
    } elseif (is_object($gallery)) {
        if (count($photos) > 0) {
            echo "\t\t\t\t<ol id=\"photo_list_order\">\n";
            foreach ($photos as $photo) {
                echo "\t\t\t\t\t<li><img class=\"changeorderThumb\" src=\"{$photo->getPublicUrl()}\" />\n    \t\t\t\t\t\t<input type=\"hidden\" name=\"photos_display_order[" . $photo->id . "]\" class=\"displayorder\" value=\"" . $photo->display_order . "\" /></li>\n";
            }
            echo "\t\t\t\t</ol>\n";
        } else {
            echo "<h3 class=\"empty-list\">There are no photos to put in order. Go ahead and add some.</h3>\n";
        }
    } else {
        echo "<h3 class=\"empty-list\">Whoops, there is no Gallery! Save this item to create a new one.</h3>\n";
    }
    ?>
								
				</div>
				<div class="clearleft"></div>
			</div><!-- #gallery_sort -->
			
			
			<!-- Upload a new image or edit captions / delete images -->
			<div id="add_edit_images" class="dropslide" style="display:none;">
				<div id="add_image_wrap">
					<h2>Add an Additional Image</h2>
					<p><span class="hint">Images for your site would be best displayed at <?php 
    echo MAX_PORTFOLIO_IMAGE_WIDTH;
    ?>
 pixels wide. If an image is larger, the system will attempt to resize it. Images that are too large might require more memory than the system can handle, and an error may result.</span></p>
					<p><label for="new_photo">Add an additional image:</label>
						<input type="file" name="new_photo" id="new_photo" value="" />
					</p>
					<p><label for="new_photo_caption">Caption for new image:</label>
						<?php 
    textField("new_photo_caption", "", "");
    ?>
					</p>
					<p><input type="submit" class="submitbutton" name="submit" value="Add Image" /></p>
				</div>
				<p>&nbsp;</p>
				<h2>Edit Existing Photos (delete photos or edit captions. Click Save when done)</label></h2>
				<p><span class="hint"><b>Image size:</b> The CSS control for the images designates that they display here (for ease of use) at 50% their actual size. Dont&rsquo;t worry if they appear smaller than on the front-end.<!--[if IE 6]><br /><b>IE 6 Users: The CSS can only force the image to be 240 pixels wide, which for some images, may be larger than normal, resulting in pixellation. </b><![endif]--></span></p>
				<ul id="add_photo_list">                                                                                                                                                    
<?php 
    if (is_object($gallery)) {
        if (count($photos) > 0) {
            foreach ($photos as $photo) {
                echo "\t\t\t\t<li><img src=\"{$photo->getPublicUrl()}\" />\n";
                echo "\t\t\t\t\t<div><input type=\"checkbox\" name=\"deleted_photos[]\" value=\"{$photo->id}\"/>&nbsp;DELETE</div>";
                textField("captions[{$photo->id}]", "{$photo->caption}", "");
                echo "\n\t\t\t\t</li>\n";
            }
        } else {
            echo "\t\t\t\t<h3 class=\"empty-list\">There are no photos to edit. Go ahead and add some.</h3>\n";
        }
    }
    ?>
    				
				</ul>
				<p class="clear:left;"><a href="#top">Back to the Top of the Page</a></p>
			</div>
		</div><!-- #add_edit_images -->
		
		
		<!-- Item Videos -->
		<?php 
    if (ITEM_VIDEOS) {
        ?>
		<div id="add_videos" class="dropslide" style="display:none;">
			<div id="add_video_wrap">
			    <h2>Add a new Video</h2>
			    <p><span class="hint">Video can be &ldquo;attached&rdquo; to an item. They will still be available to pages via the &ldquo;Insert Videos&rdquo; drop down menu. Once uploaded here, they must be further edited or deleted in the <a href="<?php 
        echo get_link("admin/list_videos");
        ?>
">Videos section</a>. </span></p>
			    
			    <!-- Add a new video -->
			    <p>
        			<label for="newvideo">Video Title:</label>
        			<?php 
        textField("newvideo", '');
        ?>
<br />
        		</p>
        		
        		<div class="column half">
            		<div class="column half">
                		<p>
                		    <label for="vidwidth">Width:</label>
                		    <?php 
        textField("vidwidth", '');
        ?>
                		</p>
            		</div>
            		<div class="column half last">
                		<p>
                		    <label for="vidheight">Height:</label>
                		    <?php 
        textField("vidheight", '');
        ?>
                		</p>
            		</div>
            		<div class="clearit"></div>
            		
            		<p><label for="vidservice">Hosting Service:</label>
            			<select id="vidservice" name="vidservice">
            				<option value="youtube">YouTube</option>
            				<option value="vimeo">Vimeo</option>
            			</select><br />
            		</p>
        		</div>
        		<div class="column half last">
            		<p>
            			<label for="vidembed">Unique ID:</label>
            			<?php 
        textField("vidembed", '');
        ?>
<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="clearit"></div>
        		<p><input type="submit" class="submitbutton" name="submit" value="Add or Edit Video" /></p>
            </div>
			<p>&nbsp;</p>
            
            <!-- Edit Videos that are already attached -->
			<h2>Edit Attached Videos</h2>
			<p class="hint">Edit titles or embed codes and click Save Videos. Reorder by dragging and dropping the thumbnails in the gallery. Click Save when done. To delete or do more serious editing, please visit <a href="<?php 
        echo get_link("admin/list_videos");
        ?>
">the Video&rsquo;s edit page</a> instead. </p>
			
			<ol id="video_list" class="managelist"> 
        		<?php 
        foreach ($itemvideos as $thevid) {
            echo '<li><span class="item-link">';
            textField("vidnames[{$thevid->id}]", $thevid->get_title(), "");
            echo '</span>
    				<span class="item-public">';
            textField("vidcodes[{$thevid->id}]", $thevid->embed, "");
            echo '</span>
    				<span class="item-revised"><label for="removevideo"><input name="removevideo" class="boxes" type="checkbox" value="' . $thevid->id . '"> Remove Video?</label></span>
    				<span class="item-created"><a href="' . get_link("admin/edit_video/" . $thevid->id) . '">Edit Video</a></span>
				</li>';
        }
        ?>
    		
    		</ol>
        </div>
		<?php 
    }
    // end if ITEM_VIDEOS
    ?>
		
		
		<?php 
    if (ITEM_DOCUMENTS) {
        ?>
		<div id="add_edit_documents" class="dropslide" style="display:none;">
			<div id="add_document_wrap">
				<h2>Add, Delete or Reorder Documents</h2>
				<p><span class="hint">Documents can be &ldquo;attached&rdquo; to an item. They will still be available to pages via the &ldquo;Insert Document&rdquo; drop down menu. </span></p>
				<p><label for="new_document">Add a document:</label>
					<input type="file" name="new_document" id="new_document" value="" />
				</p>
				<p><label for="new_document_title">Title for document (Optional. If empty, one will be created from the name of the document):</label>
					<?php 
        textField("new_document_title", "", "");
        ?>
				
				</p>
				<p><input type="submit" class="submitbutton" name="submit" value="Add Document" /></p>
			</div>
			<p>&nbsp;</p>

			<h2>Edit Attached Documents</h2>
			<p class="hint">Delete documents or edit titles. Reorder by dragging and dropping. Click Save when done. NOTE: The filename may or may not be used in your template when this item is displayed. <strong>Filenames should not contain a period unless it precedes the filetype extension</strong>. </p>
			
			<div id="sortable_container">
				<ol id="document_list" class="managelist">                                                                                                                                                    
<?php 
        if ($doccount > 0) {
            foreach ($itemdocuments as $doc) {
                echo "\t\t\t\t\t<li>\n";
                hiddenField("document_display_order[{$doc->id}]", $doc->display_order);
                echo "\n\t\t\t\t\t\t<span class=\"item-link\">";
                textField("docname[{$doc->id}]", $doc->name, "");
                echo "</span>\n\t\t\t\t\t\t\t<span class=\"item-public\">File type: {$doc->file_type}</span>\n\t\t\t\t\t\t\t<span class=\"item-revised\"><a href=\"" . $doc->getPublicUrl() . "\" title=\"" . $doc->get_title() . "\">View Document</a></span>\n\t\t\t\t\t\t\t<span class=\"item-created\"><input type=\"checkbox\" name=\"deleted_documents[]\" value=\"{$doc->id}\"/>&nbsp;DELETE</span>\n\t\t\t\t\t\t</li>\n";
            }
        } else {
            echo "\t\t\t\t\t<h3 class=\"empty-list\">There are no documents to edit.</h3>\n";
        }
        ?>
							
				</ol>
			</div>	
			<p class="clear:left;"><a href="#top">Back to the Top of the Page</a></p>
		</div><!-- #add_edit_documents -->
		<?php 
    }
    // end if ITEM_DOCUMENTS
    ?>

		<div id="edit-footer" class="itemnav clearfix">
			<div id="error_container"></div>
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Save Item" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Save and Return to List" />
				</p>
				
			</div>
			<div class="column half last">
				
			<?php 
    if ($user->has_role()) {
        ?>
				
				<p><label for="delete">Delete this item? <input name="delete" id="delete" class="boxes" type="checkbox" value="<?php 
        echo $item->id;
        ?>
" /></label>
				<span class="hint">Check this box and then click &ldquo;Save&rdquo; to delete from the database</span></p>
			<?php 
    }
    ?>
			
			</div>
		</div>
		
	</form>
<?php 
}
Example #12
0
function display_page_content()
{
    // Double check that the proper columns exist
    $add_testimonial = requestIdParam() == "add" ? true : false;
    if ($add_testimonial) {
        $testimonial = $testimonialtitle = $testimonialcontent = $testimonialatt = $testimonialfeat = null;
    } else {
        $testimonial_id = requestIdParam();
        $testimonial = Testimonials::FindById($testimonial_id);
        $testimonialtitle = $testimonial->get_title();
        $testimonialcontent = $testimonial->content;
        $testimonialatt = $testimonial->attribution;
        $testimonialfeat = $testimonial->is_featured;
    }
    ?>

	<script type="text/javascript">
		$().ready(function() {
			$("#edit_testimonial").validate({
				rules : {
					title: "required" 
				},
				messages: {
					title: "Please enter a title for this testimonial" 
				}
			});
		});
	</script>
	
	<div id="edit-header" class="testimonialnav">
		<h1><?php 
    if ($add_testimonial) {
        echo 'Add';
    } else {
        echo 'Edit';
    }
    ?>
 Testimonial</h1>
	</div>
	
	<form method="POST" id="edit_testimonial">
		
		<p class="display_name">
			<label for="title">Testimonial Display Name:</label>
			<?php 
    textField("display_name", $testimonialtitle, "required: true");
    ?>
<br />
			<span class="hint">This name will be used in the admin only &mdash; it will not display on the front-end</span>
		</p>
		
		<p>
			<label for="content">Testimonial Content:</label> <span class="hint">Quotes will get added when displayed, so please do not add quotes here.</span><br />
			<?php 
    textArea("content", $testimonialcontent, 98, EDIT_WINDOW_HEIGHT / 2);
    ?>
		</p>
		
		<p>
			<label for="attribution">Testimonial attribution:</label>
			<?php 
    textField("attribution", $testimonialatt);
    ?>
<br />
			<span class="hint">Optional. A &ldquo;credit&rdquo; for the testimonial quote.</span>
		</p>
        
        <p>
            <label for="featured">
                <input type="checkbox" name="featured" id="featured"<?php 
    if ($testimonialfeat) {
        ?>
 checked="checked"<?php 
    }
    ?>
>
                Feature this Testimonial
            </label>
            <span class="hint">Optionally show this testimonial in special places as dictated by the site design.</span>
        </p>
        
		<div id="edit-footer" class="testimonialnav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Save Testimonial" /> <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 testimonial? <input name="delete" id="delete" class="boxes" type="checkbox" value="<?php 
        echo $testimonial->id;
        ?>
" /></label>
					
					<span class="hint">Check the box and then click &ldquo;Save&rdquo; to delete this testimonial from the database. Warning: if this testimonial is removed but still being used in content, an error will be displayed.</span>
				</p>
<?php 
    }
    ?>
			</div>
		</div>
	
	</form>
<?php 
}
Example #13
0
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&gt;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();
        ?>
">&larr; 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 &rarr;</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> &nbsp; <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> &nbsp; 
				<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 . '&nbsp;';
        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 &ldquo;Uncategorized&rdquo; 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 &ldquo;Save&rdquo; above to delete this entry from the database</span>
				<?php 
    } else {
        echo '&nbsp;';
    }
    ?>
				</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 
}
Example #14
0
function display_page_content()
{
    $types = EventTypes::FindAll();
    $type_id = requestIdParam();
    $type = EventTypes::FindById($type_id);
    $user = Users::GetCurrentUser();
    ?>

<script type="text/javascript">
	$().ready(function() {
		$("#edit_type").validate({
			rules : {
				name: "required"
			},
			messages: {
					name: "Please enter an name for this event type.<br/>"
				}
		});
		$("#color_picker table td").click(function() {
			var thecolor = $(this).attr('bgcolor');
			$('.colorselected').css("background-color",thecolor);
			$('input.thecolor').val(thecolor);
		});
	});
</script>

<div id="edit-header" class="eventtype">
	<h1>Edit Event Type</h1>
</div>

<form method="POST" id="edit_type">
	
	<div class="column half">
		<p class="display_name">
            <label for="name">Name: </label>
    		<?php 
    textField("name", $type->name, "required: true");
    ?>
		</p>
    </div>
    <div class="column half last">
		<p>
    		<label for="colorselected">Color: </label>
    		<span class="colorselected" style="background-color:<?php 
    echo $type->color;
    ?>
">&nbsp;</span>
		</p>
	</div>
	<div class="clearleft"></div>
	
	<p><label for="new_color">Select New Color:</label> <span class="hint">Click any color below to select it, then click the Save button below.</span>
		<input class="thecolor" type="hidden" name="color" value="<?php 
    echo $type->color;
    ?>
" />
		<?php 
    require_once snippetPath("color-picker");
    ?>
	</p>
	
	<p>&nbsp;</p>
	
	<h2>Other Event Types for comparison</h2>
	<div id="table-header" class="eventlist">
		<strong class="item-link">Click Name to Edit</strong>
		<span class="item-filename">Color Preview</span>
	</div>
	<ul id="listitems" class="managelist">
<?php 
    foreach ($types as $thetype) {
        echo "\t\t\t\t\t\t<li><a class=\"item-link\" href=\"" . get_link("/admin/edit_type/{$thetype->id}") . "\">{$thetype->name}</a> <span class=\"colorpreview\" style=\"background-color: {$thetype->color}; color: {$thetype->text_color};\">{$thetype->name}</span></li>\n";
    }
    ?>
	
	</ul>
	
	<div id="edit-footer" class="eventtypenav clearfix">
		<div class="column half">
	
			<p>
				<input type="submit" class="submitbutton" name="submit" value="Save Type" /> <br />
				<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
			</p>
			
		</div>
		<div class="column half last">
			
		<?php 
    if ($user->has_role() && $type->id != 1) {
        ?>
			
			<p><label for="delete">Delete this Event Type?</label>
    		<input name="delete" class="boxes" type="checkbox" value="<?php 
        echo $type->id;
        ?>
" />
    		<span class="hint">Check the box and click &ldquo;Save&rdquo; to delete this type from the database</span></p>
		<?php 
    }
    ?>
		
		</div>
	</div>
	
</form>
<?php 
}
Example #15
0
function display_page_content()
{
    $page_id = requestIdParam();
    $page = Pages::FindById($page_id);
    // get all the areas
    $areas = Areas::FindAll();
    $page_areas = $page->getAreas();
    // I know MOST pages dont use the error_container anymore, but this one should! If the user uses any of the drop downs before they pick an Area, the page will not submit and the user will not be able to see the error.
    ?>

	<script type="text/javascript">
	//<![CDATA[
		$().ready(function() {
			$("#edit_page").validate({
				errorLabelContainer: $("#error_container"),
<?php 
    if (SUB_PAGES) {
        ?>
	
				rules: {
					display_name: "required"
				},
				messages: {
					display_name: "Please enter a display name for this page"
				}
<?php 
    } else {
        ?>
	
				rules: {
					display_name: "required",
					"selected_areas[]": "required"
				},
				messages: {
					display_name: "Please enter a display name for this page",
					"selected_areas[]": "You unchecked an area and forgot to choose a new one! Select at least one area to include the page in. If you need to hide it, make it not public." 
				}
<?php 
    }
    ?>
	
			});
		});
	//]]>
	</script>
	
	<div id="edit-header" class="areanav">
		<div class="nav-left column">
			<h1>Edit Page : <a href="<?php 
    $page->the_url();
    ?>
" title="View <?php 
    $page->the_url();
    ?>
">View Page</a></h1>
		</div>
		<div class="nav-right column">
			<?php 
    quick_link();
    ?>
			
		</div>
		<div class="clearleft"></div>
	</div>
	
	<form method="POST" id="edit_page">
		<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">Display Name:</label><span class="hint">This is the Proper Name of the page; how it will display in the navigation.</span><br />
			<?php 
    textField("display_name", $page->display_name, "required: true");
    ?>
		</p>
	<?php 
    if (ALLOW_SHORT_PAGE_NAMES) {
        ?>
		
		<p>
			<label for="name">Short Name:</label><span class="hint">This is the short name of the page, which gets used in the link. No spaces, commas, or quotes please.</span><br />
			<?php 
        textField("name", $page->name);
        ?>
		</p>
	<?php 
    } else {
        hiddenField("name", $page->name);
        ?>
	    <p class="page-url">Page URL: <span class="page-url"><?php 
        echo 'http://' . SITE_URL . BASEHREF . "<mark>" . ltrim($page->get_url(), "/") . "</mark>";
        ?>
</span></p>
	<?php 
    }
    ?>
		
		<p>
			<label for="name">Public:</label>&nbsp; <?php 
    checkBoxField("public", $page->public);
    ?>
			<span class="hint">This determines whether or not this page will be visible to the public.</span>
		</p>
		
		<p>
			<label for="page_content">Content:</label><br />
			<?php 
    textArea("page_content", $page->content, 98, EDIT_WINDOW_HEIGHT);
    ?>
		</p>
		
<?php 
    require_once snippetPath("admin-insert_configs");
    // We decided to hide templates from everyone except ourselves
    $thisuser = Users::GetCurrentUser();
    if ($thisuser->id == "1") {
        ?>
	
		<p>
			<label for="template">Template:</label>
			<select id="template" name="template">
				<?php 
        $templates = list_available_templates();
        $templates[] = "";
        foreach ($templates as $template) {
            $text = $template;
            if ($text == "") {
                $text = "(inherit)";
            }
            echo "<option value=\"{$template}\"";
            if ($template == $page->template) {
                echo " selected=\"selected\"";
            }
            echo ">{$text}</option>\r\n";
        }
        ?>
				
			</select>
		</p>
<?php 
    } else {
        hiddenField("template", $page->template);
    }
    ?>
				
		<div id="edit-footer" class="pagenav clearfix">
			<div id="error_container"></div>
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Save Page" /> <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() && !in_array($page->id, explode(",", PROTECTED_ADMIN_PAGES))) {
        ?>
	
				<p>
					<label for="delete">Delete this page?</label>
					<input name="delete" class="boxes" type="checkbox" value="<?php 
        echo $page->id;
        ?>
" />
					<span class="hint">Check the box and then click &ldquo;Save&rdquo; above to delete this page from the database</span>
				</p>
	<?php 
    } else {
        ?>
		
				<p class="red">This page is being protected, it can not be deleted.</p>
	<?php 
    }
    ?>
	
			</div>
		</div>
		
	</form>
<?php 
}
Example #16
0
function display_page_content()
{
    $add_area = requestIdParam() == "add" ? true : false;
    if ($add_area) {
        $area = $is_global = $area_id = $areadisplayname = $areaseotitle = $areaname = $areapublic = $areatemplate = null;
    } else {
        $area_id = requestIdParam();
        $area = Areas::FindById($area_id);
        $is_global = $area->id == 1 ? true : false;
        $areaid = $area->id;
        $areadisplayname = $area->display_name;
        $areaseotitle = $area->seo_title;
        $areaname = $area->name;
        $areapublic = $area->public;
        $areatemplate = $area->template;
    }
    ?>

<div id="edit-header" class="areanav">
	<div class="nav-left column">
		<h1>
    		<?php 
    if ($add_area) {
        echo 'Add Area';
    } else {
        echo 'Edit Area : ';
        echo '<a href="' . $area->get_url() . '" title="View ' . $area->get_url() . '">View Area</a>';
    }
    ?>
        </h1>
	</div>
	<div class="nav-right column"><?php 
    quick_link();
    ?>
</div>
	<div class="clearleft"></div>
</div>

<?php 
    // Start the form
    ?>
<form method="POST" id="js-validate">

	<p class="display_name">
		<label for="display_name">Display Name:</label> 
		<?php 
    textField("display_name", $areadisplayname, "required: true");
    ?>
<br />
		<span class="hint">This is the Proper Name of the area; how it will display in the navigation.</span>
	</p>
		
<?php 
    // If not Index, not a Portfolio Area, and not the Blog area
    if ($is_global != 1 && !strstr($areaname, "_portfolio") && $area_id != 3) {
        if (ALLOW_SHORT_PAGE_NAMES) {
            ?>
	<p>
		<label for="name">Short Name</label> 
		<?php 
            textField("name", $areaname);
            ?>
<br />
		<span class="hint">This is the short name of the page, which gets used in the URL. No spaces, commas, or quotes please.</span>
	</p>
<?php 
        }
    } else {
        hiddenField("name", $areaname);
    }
    if (!$add_area) {
        echo '<p class="page-url">Area URL: <span class="page-url">http://' . SITE_URL . '/<mark>' . ltrim($area->get_url(), "/") . '</mark></span></p>';
    }
    ?>
    
	<div class="column half">
    <?php 
    if (!$is_global) {
        ?>
		<p>
			<label for="public">Public:</label>&nbsp; <?php 
        checkBoxField("public", $areapublic);
        ?>
<br />
			<span class="hint">This determines whether or not the Area will appear in the navigation as a &ldquo;Public&rdquo; link. You may place new pages inside this Area and make them &ldquo;public&rdquo;, but they will still not be visible until the Area is also Public. </span>
		</p>
	<?php 
    } else {
        echo '<p><input type="hidden" name="public" value="1"></p>';
    }
    ?>
	
    </div>
	<div class="column half last">
		<p>
			<label for="seo_title">SEO Title:</label>
			<?php 
    textField("seo_title", $areaseotitle);
    ?>
<br />
			<span class="hint">This title is used in title meta tags (good for SEO). Might also show when a user hovers their mouse over a link. Best to be as short as possible.</span>
		</p>
	</div>
	<div class="clearleft"></div>

    <?php 
    // Template
    ?>
	<p><label for="template">Template:</label>
		<select id="template" name="template">
		<?php 
    $templates = list_available_templates();
    foreach ($templates as $template) {
        $thistemplate = $template == $areatemplate ? ' selected="selected"' : '';
        echo '<option value="' . $template . '"' . $thistemplate . '>' . ucwords($template) . '</option>';
    }
    ?>
		</select><br />
		<span class="hint">When a Page inside this Area uses the template &ldquo;inherit&rdquo;, the Page will inherit this Area&rsquo;s template selection. So, changing this Template may change the display of all Pages within this Area. </span>
	</p>
		
	
	<div id="edit-footer" class="areanav clearfix">
		<div class="column half">
			<p>
				<input type="submit" class="submitbutton" name="submit" value="Save Area" /> <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() && !in_array($area_id, explode(",", PROTECTED_ADMIN_AREAS)) && requestIdParam() != "add") {
        ?>
		
			<p>
				<label for="delete">Delete this Area?</label>
				<input name="delete" class="boxes" type="checkbox" value="<?php 
        echo $area_id;
        ?>
" />
				<span class="hint">Check the box and then click &ldquo;Edit&rdquo; above to delete from the database. This will move any pages contained within this area to the Global Area, so they do not become Orphans.</span></p>
		<?php 
    } elseif (requestIdParam() != "add") {
        ?>
			
			<p class="red">This area is being protected, it can not be deleted.</p>
		<?php 
    }
    ?>
		</div>
	</div>
		
</form>
	
<script type="text/javascript">
	$().ready(function() {
		$("#js-validate").validate({
			rules : {
				display_name: "required"
			},
			messages: {
				display_name: "Please enter a name you would like to be displayed for this area"
			}
		});
	});

</script>
<?php 
}
Example #17
0
function HCd_debug()
{
    if (HCD_DEBUG) {
        $user = Users::GetCurrentUser();
        if (is_object($user) && strpos($user->email, 'highchairdesign.com') !== false) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
Example #18
0
function initialize_page()
{
    // If the user requested the login page but has a bookmarked place to go (or they were logged out while working)
    $optionalredirect = "";
    if (getRequestVarAtIndex(1) != "" && getRequestVarAtIndex(1) != " " && getRequestVarAtIndex(1) != "login") {
        $optionalredirect .= getRequestVarAtIndex(1);
    }
    if (getRequestVarAtIndex(2) != "" && getRequestVarAtIndex(2) != " ") {
        $optionalredirect .= "/" . getRequestVarAtIndex(2);
    }
    if (getRequestVarAtIndex(3) != "") {
        $optionalredirect .= "/" . getRequestVarAtIndex(3);
    }
    if (getRequestVarAtIndex(4) != "") {
        $optionalredirect .= "/" . getRequestVarAtIndex(4);
    }
    if (getRequestVarAtIndex(5) != "") {
        $optionalredirect .= "/" . getRequestVarAtIndex(5);
    }
    if (getRequestVarAtIndex(6) != "") {
        $optionalredirect .= "/" . getRequestVarAtIndex(6);
    }
    if (Users::GetCurrentUser()) {
        // If the user is still logged in and they hit this page, redirect them to the homepage or somewhere else
        redirect("/admin" . $optionalredirect);
    }
    $post_action = "";
    if (isset($_POST['submit'])) {
        $post_action = $_POST['submit'];
    }
    if ($post_action == "Login") {
        $email = $_POST['email'];
        $password = $_POST['password'];
        if ($email == "" || $password == "") {
            setFlash("<h3>Please enter a username and password</h3>");
        } else {
            $user = Users::FindByEmail($email);
            if (is_object($user)) {
                /* Check to see if we are in maintenance mode */
                if (MAINTENANCE_MODE) {
                    if ($user->email != "*****@*****.**") {
                        setFlash("<h3>We are sorry, the site is in maintenance mode right now. Please try to log-in later.</h3>");
                    } else {
                        if ($user->authenticate($password)) {
                            $user->set_ticket();
                            setFlash("<h3>Thank you for logging in during Maintenance Mode, Admin</h3>");
                            redirect(Users::GetRedirect("/admin/" . $optionalredirect));
                        }
                    }
                } else {
                    if ($user->authenticate($password)) {
                        $user->set_ticket();
                        // Backup database on successful Log in
                        $params = @parse_url(MYACTIVERECORD_CONNECTION_STR) or trigger_error("MyActiveRecord::Connection() - could not parse connection string: " . MYACTIVERECORD_CONNECTION_STR, E_USER_ERROR);
                        $backupDatabase = new Backup_Database($params['host'], $params['user'], $params['pass'], trim($params['path'], ' /'));
                        $success = $backupDatabase->backupDatabase(SERVER_DBBACKUP_ROOT, 5) ? 'The database has been archived.' : 'The database archive FAILED.';
                        setFlash("<h3>Thank you for logging in. {$success}</h3>");
                        redirect(Users::GetRedirect("/admin/" . $optionalredirect));
                    } else {
                        $_SESSION[LOGIN_TICKET_NAME] = NULL;
                        setFlash("<h3>User not found, or password incorrect</h3>");
                    }
                }
            }
        }
    }
}
Example #19
0
function display_page_content()
{
    $message = PORTFOLIO_INSTALL ? 'Edit or Re-order a Portfolio Area (red), an Area (blue), or Page (white)' : 'Edit or Re-order an Area (blue) or Page (white)';
    ?>

<script type="text/javascript">
	$().ready(function() {
		$(".drop_item_link").click(function() {
			$(this).next().slideToggle();
			if ($(this).text() == "[view pages]") {
				$(this).text("[hide pages]");
			} else {
				$(this).text("[view pages]");
			}
		});
		$("ul.cat_drag, div.item_drag, div.sub_drag").sortable({
			stop: function() {
				var count = 1;
				$("ul#listpages ul.row li input.area_order").each(function() {
					$(this).val(count);
					count++;
				});
				var count = 1;
				$("ul#listpages ul.row li input.page_order").each(function() {
					$(this).val(count);
					count++;
				});
				<?php 
    if (SUB_PAGES) {
        ?>
				var count = 1;
				$("ul#listpages ul.row li input.sub_page_order").each(function() {
					$(this).val(count);
					count++;
				});
				<?php 
    }
    ?>
				$.post("<?php 
    echo get_link('admin/order_parse/areaspages');
    ?>
", $("form#order_item").serialize());
			}
		});
	});
</script>

	<div id="edit-header" class="areanav">
    	<div class="nav-left column">
			<h1><?php 
    echo $message;
    ?>
</h1>
		</div>
		<div class="nav-right column">
			<a class="hcd_button" href="<?php 
    echo get_link("admin/add_page");
    ?>
">Add a Page</a>  
    		<a class="hcd_button" href="<?php 
    echo get_link("admin/edit_area/add");
    ?>
">Add an Area</a> 
		</div>
		<div class="clearleft"></div>
	</div>
	
	<form id="order_item" method="POST">
		<p>1) Click name to edit. &nbsp;2) &ldquo;Grab&rdquo; a page or area and drag it to change order. (Pages can not be dragged from one area to another. Reassign the page to another area by editing the Page and using the &ldquo;Areas&rdquo; tab.)</p>
		
		<div id="table-header">
			<strong class="item-link">Area / Page Name</strong>
			<span class="item-public">Public</span>
			<span class="item-path">Item Path</span>
		</div>
<?php 
    echo "\t<ul id=\"listpages\" class=\"cat_drag clearfix\">\n";
    // ! Get Portfolio Areas
    $areas = Areas::FindAdminListAreas();
    //$area_count = 0;
    //$num_areas = count($areas);
    foreach ($areas as $area) {
        $thisAreaName = $area->display_name;
        $thisShortName = $area->name;
        if ($thisShortName == "") {
            $thisAreaName = "Global";
            $thisShortName = "";
        }
        $arealink = get_link("/admin/edit_area/" . $area->id);
        $areapublic = $area->public ? "<span class=\"light\">public</span>" : " <span class=\"red\">not public &rarr; <a href=\"" . get_link($area->name) . "\" target=\"_blank\">Preview</a></span>";
        $isportclass = "c_group";
        if ($area->is_portfolioarea()) {
            $arealink = get_link("/admin/portfolio_edit_area/" . $area->id);
            $isportclass = " c_cat";
        }
        echo <<<EOT

\t\t<ul class="row">
\t\t\t<li class="{$isportclass}">
\t\t\t\t<!-- Don't reorder these elements -->
\t\t\t\t<input class="area_order" type="hidden" title="AreaOrder_{$area->id}" name="AreaOrder_{$area->id}" value="{$area->display_order}" />
\t\t\t\t<span class="item-link"><a name=\\"jump_{$thisShortName}\\"></a><a href="{$arealink}">{$thisAreaName}<small>Edit</small></a></span>
\t\t\t\t<span class="item-public">{$areapublic}</span>
\t\t\t\t<span class="item-path">/{$thisShortName}</span>
EOT;
        $pages = $area->findPages(true);
        //$pagenum = count( $pages );
        //if ( $pagenum > 8 ) {
        //	echo "\t\t\t\t<a href=\"#jump_{$thisShortName}\" class=\"drop_item_link\">[view pages]</a>\n";
        //	echo "\t\t\t\t<div class=\"item_drag\" style=\"display:none\">\n";
        //} else {
        echo "\t\t\t\t<div class=\"item_drag\">\n";
        //}
        foreach ($pages as $page) {
            $pagelink = get_link("/admin/edit_page/" . $page->id);
            $pagepublic = $page->public ? "<span class=\"light\">public</span>" : " <span class=\"red\">not public &rarr; <a href=\"" . get_link($area->name . "/" . $page->name) . "\" target=\"_blank\">Preview</a></span>";
            $inputname = $area->id . "_" . $page->id;
            $pageorder = $page->getOrderInArea($area);
            echo <<<EOT

\t\t\t\t\t<ul class="row">
\t\t\t\t\t\t<li class="item_line">
\t\t\t\t\t\t\t<input class="page_order" type="hidden" title="PageOrder_{$page->id}" name="{$inputname}" value="{$pageorder}" />
\t\t\t\t\t\t\t<span class="item-link"><a href="{$pagelink}">{$page->display_name}<small>Edit</small></a></span>
\t\t\t\t\t\t\t<span class="item-public">{$pagepublic}</span>
\t\t\t\t\t\t\t<span class="item-path">/{$thisShortName}/{$page->name}</span>
EOT;
            if (SUB_PAGES) {
                $children = $page->get_children();
                if (count($children > 0)) {
                    echo "\t\t\t\t\t<div class=\"sub_drag\">\n";
                    foreach ($children as $page) {
                        $pagelink = get_link("/admin/edit_page/" . $page->id);
                        $pagepublic = $page->public ? "" : " <span class=\"red\">not public &rarr; <a href=\"" . get_link($area->name . "/" . $page->name) . "\" target=\"_blank\">Preview</a></span>";
                        $inputname = "SubPage_" . $page->id;
                        $pageorder = $page->getOrderInArea($area);
                        echo <<<EOT
\t\t\t\t\t\t<ul class="row">
\t\t\t\t\t\t\t<li class="item_line sub_page">
\t\t\t\t\t\t\t\t<span class="item-link"><a href="{$pagelink}">{$page->display_name}<small>Edit</small></a></span>
\t\t\t\t\t\t\t\t<span class="item-public">{$pagepublic}</span>
\t\t\t\t\t\t\t\t<span class="item-path">/{$thisShortName}/{$page->name}</span>
\t\t\t\t\t\t\t\t<input class="sub_page_order" type="hidden" title="PageOrder_{$page->id}" name="{$inputname}" value="{$pageorder}" />
\t\t\t\t\t\t\t</li>
\t\t\t\t\t\t</ul>
EOT;
                    }
                    echo "\t\t\t\t\t</div>\n";
                }
            }
            echo <<<EOT
\t\t\t\t\t\t</li>
\t\t\t\t\t</ul>
EOT;
        }
        // End item_drag div
        echo "\t\t\t\t\t\t\t</div>\n";
        // End li.c_group
        echo "\t\t\t\t\t\t</li>\n";
        // End ul.row
        echo "\t\t\t\t\t</ul>\n";
    }
    // End foreach section
    // End ul.row cat_drag
    echo "\t\t\t\t</ul>\n";
    // End ul.row
    echo "\t\t\t</ul>\n";
    // end first li
    echo "\t</ul>\n";
    // Find Orphans
    $orphanlist = "";
    $allpages = Pages::FindAll();
    foreach ($allpages as $page) {
        $possiblearea = $page->getAreas();
        if (!$possiblearea) {
            $orphanlist .= "\t<a href=\"" . get_link("/admin/edit_page/" . $page->id) . "\">{$page->display_name}</a><br />\n";
        }
    }
    if ($orphanlist != "") {
        echo "\t<p>&nbsp;</p>\n\t<h3>Orphaned Pages</h3>\n";
        echo $orphanlist;
    }
    ?>

	<p>&nbsp;</p>
	<p><strong>Extra:</strong> If a page is not Public, you can still view it by clicking the red &ldquo;Preview&rdquo; link. This will open a new window with the page as long as you are logged in (the content will be as recent as the most recent Save). As long as you remain logged in, you may edit the page in one window or tab and preview the content in another window or tab (click refresh after each page save to see the latest changes). </p>
</form>

<?php 
    // Content Chunks
    $chunks = Chunks::FindAll();
    if (count($chunks) > 0) {
        ?>
    
    <h1 id="chunks-list">Content Chunks</h1>
	
	<p class="announce">Content Chunks are small pieces of editable text that are used by templates. Typically, they do not deserve an entire page, so we put them here. Chunks can not be created or deleted, as they have been set up when templates were set up. </p>
			
	<div id="table-header" class="documents">
		<strong class="item-link">Chunk Name</strong>
		<span class="item-filename">Description</span>
	</div>
	
	<ul id="listitems" class="managelist">
<?php 
        foreach ($chunks as $chunk) {
            echo "\t\t<li>\n\t\t\t<span class=\"item-link\"><a href=\"" . get_link("/admin/edit_chunk/{$chunk->id}") . "\">{$chunk->slug} <small>EDIT</small></a></span>\n\t\t\t<span class=\"item-filename\" style=\"width: 50%\">{$chunk->description}</span>\n\t\t</li>\n";
        }
        ?>
    </ul>
<?php 
    }
    $thisuser = Users::GetCurrentUser();
    if ($thisuser->id == "1") {
        echo '<p><a class="hcd_button" href="' . get_link("admin/edit_chunk/add") . '">Create a new Chunk</a></p>';
    }
}
Example #20
0
function display_page_content()
{
    $user_id = requestIdParam();
    $user = Users::FindById($user_id);
    $thisuser = Users::GetCurrentUser();
    /*<style>
    	.passmask { position: relative; }
    	.hideshow { text-transform: uppercase; font-size: .75em; color: #0c2347; padding-right: .5em; position: absolute; top: .2em; right: 7%;padding: .9em; }
    	</style>
    	
        	<p><label for="password">Password:</label>
        	    <fieldset class="passmask">
            	    <input type="password" class="js-hide-show-password" id="password" name="password" value="" placeholder="To reset a password, enter at least 6 characters" autocomplete="off" autocorrect="off" autocapitalize="off" />
                </fieldset><br />
    			Passwords do not have to contain fancy characters or numbers, but should not contain spaces &mdash; instead, we recommend a long phrase that you will remember easily. (Example: "elvislivesinmemphis". The longer the better)
    		</p>*/
    ?>

	<div id="edit-header" class="usernav">
		<h1>Edit User</h1>
	</div>
	
	<form method="POST" id="edit_user">
		
		<p class="display_name">
			<label for="title">Display Name:</label>
			<?php 
    textField("display_name", $user->display_name, "required: true");
    ?>
<br />
			<span class="hint">This is a proper name or nickname for the user &mdash; how they will display on the site.</span>
		</p>
	
    	<p><label for="email">Email:</label>
    	    <input type="email" id="email" name="email" value="<?php 
    echo $user->email;
    ?>
" autocorrect="off" autocapitalize="off" class="required: true" /><br />
        	<span class="hint">A user will use this email address as their login information.</span>
    	</p>
	
    	<p><label for="password">Password:</label>
    	    <input type="password" id="password" name="password" value="" placeholder="To reset a password, enter at least 6 characters" autocomplete="off" autocorrect="off" autocapitalize="off" /><br />
			Passwords do not have to contain fancy characters or numbers, but should not contain spaces &mdash; instead, we recommend a long phrase that you will remember easily. (Example: "elvislivesinmemphis". The longer the better)
		</p>

<?php 
    $thisuser = Users::GetCurrentUser();
    if ($thisuser->has_role()) {
        ?>
	
	
    	<p class="announce">An &ldquo;Admin&rdquo; has Master Access &ndash; they can edit all features of the site. <b>If this box is not checked, the user is considered a Non-admin. Non-admins may NOT delete content, edit PayPal accounts or create new users.</b> They will be able to create or edit content, upload new images and documents, and create new galleries.</p>
    	<p>&nbsp;</p>
    	<h2>Privileges:</h2>
    	<hr noshade />
    	<p><label for="is_admin">Admin?</label>
    	<?php 
        checkBoxField("is_admin", $user->is_admin);
        ?>
</p>
	
<?php 
    }
    ?>

        <div id="edit-footer" class="usernav clearfix">
    		<div class="column half">
    			<p>
    				<input type="submit" class="submitbutton" name="submit" value="Edit User" /> <br />
    				<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
    			</p>
    		</div>
    		<div class="column half last">
    			
    		<?php 
    if ($thisuser->has_role()) {
        ?>
    			
    			<p><label for="delete">Delete this User?</label>
        		<input name="delete" class="boxes" type="checkbox" value="<?php 
        echo $user->id;
        ?>
" />
        		<span class="hint">Check the box and click &ldquo;Edit&rdquo; to delete this user from the database</span></p>
    		<?php 
    }
    ?>
    		
    		</div>
    	</div>
    		
    </form>
    
    <script type="text/javascript">
		$().ready(function() {
			$("#edit_user").validate({
					rules : {
						display_name: "required",
						email: "required"
					},
					messages: {
							display_name: "Please enter an email for this user",
							email: "Please enter an email for this user"
						}
				});
		});
		
		/* From PolarB.com and the great Luke Wroblewski
		 * Throws an error in browsers because prior to jQuery 1.9, changing the type of an input is not allowed (IE6/7/8 would error).
		 * Need to use jQuery 2.0 or 1.9 Migrate to get this to work 
		!function(){$(document).ready(function(){$(".js-hide-show-password").each(function(){var $input=$(this),$hideShowLink=$('<span class="hideshow js-hide-show-link">Show</span>');$hideShowLink.click(function(e){e.preventDefault();var inputType=$input.attr("type");"text"==inputType?($input.attr("type","password"),$hideShowLink.text("Show")):($input.attr("type","text"),$hideShowLink.text("Hide")),$input.focus()}),$input.parent().append($hideShowLink)})})}(); */
	</script>
	
<?php 
}
Example #21
0
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&gt;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 &mdash; 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 &ldquo;Save&rdquo; above to delete this video from the database</span>
				</p>
<?php 
    }
    ?>
			</div>
		</div>
	
	</form>
<?php 
}
Example #22
0
function display_page_content()
{
    $image_id = getRequestVarAtIndex(2);
    $image = Images::FindById($image_id);
    //$imagenum = $image->howManyReferencing();
    ?>

	<div id="edit-header" class="imagenav">
		<h1>Edit Image</h1>
	</div>
	
	<form method="POST" id="edit_image" enctype="multipart/form-data">
		<input type="hidden" name="MAX_FILE_SIZE" value="8400000">
		
		<?php 
    //<p><strong>Number of references: <?php echo $imagenum </strong></p>
    ?>
		
		<img src="<?php 
    echo get_link('images/view/' . $image->id);
    ?>
" alt="<?php 
    echo $image->get_title();
    ?>
" />
		<p><span class="hint">The CSS will restrict the display width of this image to a max of 360 pixels wide. Don&rsquo;t worry if it appears smaller than normal. <!--[if IE 6]><br /><b>IE 6 Users: The CSS can only force the image to be 240 pixels high, which for some images, may be larger than normal, resulting in pixellation. </b><![endif]--></span></p>
		
		<!--<p>
			<label for="new_image">Select a new image to replace the current one:</label>
			<input type="file" name="new_image" id="new_image" value="" class="required: true" />
		</p>-->
		
		<p class="display_name">
			<label for="title">Title:</label>
			<?php 
    textField("title", $image->get_title(), "required: true");
    ?>
<br />
			<span class="hint">The Proper &ndash; or Pretty &ndash; name. Spaces, commas and quotes are acceptable. </span>
		</p>
		
		<?php 
    if (ALLOW_SHORT_PAGE_NAMES) {
        ?>
		<p>
			<label for="name">Short Name: </label> 
			<span class="hint">This will be used by the database only and in links. No spaces, commas or quotes please. </span><br />
			<?php 
        textField("name", $image->name, "");
        ?>
		</p>
		<?php 
    }
    ?>
		
		<p>
			<label for="description">Caption:</label>
			<?php 
    textField("description", esc_html($image->description), "");
    ?>
<br />
			<span class="hint">A caption may or may not be used on the front-end display. This field can be left blank.</span>
		</p>
		
		<p><strong>A Trick:</strong> If the caption starts with &ldquo;http://&rdquo;, the system will treat the image as a link (called a &ldquo;hot-link&rdquo;). In this case, the title will become the text for the link, displayed under the image, and the image will be clickable (the cursor will turn into a hand when passed over the image). The image can still be placed to float right or left, or not float at all. </p>
		<p>If you are linking to your own page, use the full URL= <em>http://<?php 
    echo SITE_URL;
    ?>
/thearea/thepage</em>. </p>
		
		
		<div id="edit-footer" class="imagenav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Save Image" /> <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()) {
        ?>
				
				<p>
					<label for="delete">Delete this image?</label>
					<input name="delete" class="boxes" type="checkbox" value='<?php 
        echo $image->id;
        ?>
' />
					<span class="hint">Check the box and then click &ldquo;Save&rdquo; above to delete this image from the database</span>
				</p>
			<?php 
    }
    ?>
			
			</div>
		</div>
	
    </form>
    
    <script type="text/javascript">
		$().ready(function() {
			$("#edit_image").validate({
				rules : {
					title: "required",
					image: "required"
				},
				messages: {
						title: "Please enter a title for this image<br/>",
						image: "Please select a file<br/>"
					}
			});
		});
	</script>
    
<?php 
}
Example #23
0
function display_page_content()
{
    $users = Users::FindAll();
    $cur_user = Users::GetCurrentUser();
    $blog = Blogs::FindByUser($cur_user->id);
    ?>

					<script type="text/javascript">
						loadTinyMce("blog_description");
						
						$().ready(function() {
							$("#add_blog").validate({
									rules: {
											name: "required"
										},
									messages: {
											name: "Please enter a name for this blog"
										}
								});
						});
					</script>
					
					<form method="POST" id="add_blog">
						<h1>Edit Blog User</h1>
						<p>Instructions: <span class="hint">Name the Blog first, then use the <b>Add Entry</b> page to add info to it.</span></p>
						
						<p><label for="name">Display Name:</label>
						<span class="hint">This is the Proper Name of the blog.</span><br />
						<?php 
    textField("name", $blog->name, "required: true");
    ?>
</p>
						
					<?php 
    if ($cur_user->has_role()) {
        ?>
						<p><label for="name">User:</label>
						<span class="hint">This is the User associated with the blog.</span><br />
						<?php 
        echo "\t\t\t\t\t\t<select name='user_id' id='user_id'>";
        foreach ($users as $user) {
            if ($user->id == $blog->user_id) {
                $selected = "selected";
            } else {
                $selected = "";
            }
            echo "\t\t\t\t\t\t\t<option {$selected} value='{$user->id}'>{$user->email}</option>\n";
        }
        echo "\t\t\t\t\t\t</select>";
        ?>
						</p>
					<?php 
    } else {
        ?>
						<p><label for="name">User:</label> <?php 
        foreach ($users as $user) {
            if ($user->id == $blog->user_id) {
                echo $user->email;
            }
        }
        ?>
</p>
					<?php 
    }
    ?>
	
						<p><input type="submit" class="submitbutton" name="submit" value="Edit" /><br />
						
						<p id="delete"><label for="delete">Delete this blog?</label>
						<input name='delete' class='boxes' type='checkbox' />
						<span class="hint">Check the box and then click &ldquo;Save&rdquo; above to delete this blog from the database</span></p>
					</form>
<?php 
}
Example #24
0
function display_page_content()
{
    // get all the areas
    $areas = Areas::FindAll();
    // I know MOST pages dont use the error_container anymore, but this one should! If the user uses any of the drop downs before they pick an Area, the page will not submit and the user will not be able to see the error.
    ?>

	<script type="text/javascript">
	//<![CDATA[
	    $().ready(function() {
			$("#add_page").validate({
				errorLabelContainer: $("#error_container"),
<?php 
    if (SUB_PAGES) {
        ?>
	
				rules: {
					display_name: "required"
				},
				messages: {
					display_name: "Please enter a display name for this page"
				}
<?php 
    } else {
        ?>

				rules: {
					display_name: "required",
					"selected_areas[]": "required"
				},
				messages: {
					display_name: "Please enter a display name for this page",
					"selected_areas[]": "Almost forgot! Select at least one area to include the page in" 
				}
<?php 
    }
    ?>
			});
		});
	//]]>
	</script>

	<div id="edit-header" class="pagenav">
		<div class="nav-left column">
			<h1>Add Page</h1>
		</div>
		<div class="nav-right column">
			<?php 
    quick_link();
    ?>
			
		</div>
		<div class="clearleft"></div>
	</div>

	<form method="POST" id="add_page">
		<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">Display Name:</label>
			<span class="hint">This is the Proper Name of the page; how it will display in the navigation.</span><br />
			<?php 
    textField("display_name", "", "required: true");
    ?>
		</p>
	
		<?php 
    if (ALLOW_SHORT_PAGE_NAMES) {
        ?>
		<p>
			<label for="name">Short Name:</label>
			<span class="hint">This is the short name of the page, which gets used in the link. No spaces, commas, or quotes please.</span><br />
			<?php 
        textField("name", "");
        ?>
		</p>
		<?php 
    }
    ?>
		
		<p>
			<label for="name">Public:</label>&nbsp; <?php 
    checkBoxField("public");
    ?>
			<span class="hint">This determines whether or not the page will be visible to the public.</span>
		</p>
		
		<p>
			<label for="page_content">Content:</label><br />
			<?php 
    textArea("page_content", "", 98, EDIT_WINDOW_HEIGHT);
    ?>
		</p>
	
<?php 
    require_once snippetPath("admin-insert_configs");
    // We decided to hide templates from everyone except ourselves
    $thisuser = Users::GetCurrentUser();
    if ($thisuser->id == "1") {
        ?>

		<p><label for="template">Template:</label>
			<select id="template" name="template">
				<?php 
        $templates = list_available_templates();
        $templates[] = "";
        foreach ($templates as $template) {
            $text = $template;
            if ($text == "") {
                $text = "(inherit)";
            }
            echo "<option value=\"{$template}\">{$text}</option>\r\n";
        }
        ?>
				
			</select>
		</p>
<?php 
    }
    ?>
	
		<div id="edit-footer" class="pagenav clearfix">
			<div id="error_container"></div>
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Add Page" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Add and Return to List" />
				</p>
				
			</div>
			<div class="column half last"></div>
		</div>
		
	</form>
<?php 
}
Example #25
0
function display_page_content()
{
    $product_id = requestIdParam();
    $product = Product::FindById($product_id);
    $account = Paypal_Config::GetAccount();
    ?>
										
	<script type="text/javascript">		
		$().ready(function() {
			$("#edit_product").validate({
				rules: {
						display_name: "required",
						price: "required"
					},
				messages: {
						display_name: "Please enter a name that should be displayed for this product",
						price: "Please enter a price for this product"
					}
			});
		});
	</script>
	
	<div id="edit-header" class="productnav">
		<h1>Edit Product</h1>
	</div>
	
	<form method="POST" id="edit_product" enctype="multipart/form-data">
		<?php 
    hiddenField("accountId", $account->id);
    ?>
		
		<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">Display Name:</label>
		    <span class="hint">This is the Proper Name of the product.</span><br />
			<?php 
    textField("display_name", $product->display_name, "required: true");
    ?>
		</p>
		
		<p><label for="price">Price:</label><span class="hint">This is the price of the product.</span><br />
		<?php 
    textField("price", $product->price, "required: true");
    ?>
</p>
		
		<p><?php 
    $product->displayThumbnail();
    ?>
<br />
		    <label for="id_image">Select a new image to use:</label><input type="file" name="image" id="id_image" value="" />
		</p>
		
		<p><label for="product_description">Description:</label><br />
		<?php 
    textArea("product_description", $product->description, 98, 30);
    ?>
		</p>
			
		<p><input type="submit" class="submitbutton" name="submit" value="Save Product" /></p>
	
	
    	<div id="edit-footer" class="productnav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Edit Product" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
				</p>
				
			</div>
			<div class="column half last">
	<?php 
    $thisuser = Users::GetCurrentUser();
    if ($thisuser->has_role()) {
        ?>
		
        		<p>
        		    <label for="delete">Delete this product? <input name="delete" id="delete" class="boxes" type="checkbox" value="<?php 
        echo $product->id;
        ?>
"></label>
            		<span class="hint">Check the box and then click &ldquo;Edit&rdquo; above to delete this product from the database</span>
                </p>
	<?php 
    }
    ?>
    			
			</div>
		</div>
		
	</form>
<?php 
}
Example #26
0
    $optionalredirect .= "/" . getRequestVarAtIndex(4);
}
if (getRequestVarAtIndex(5) != "") {
    $optionalredirect .= "/" . getRequestVarAtIndex(5);
}
if (getRequestVarAtIndex(6) != "") {
    $optionalredirect .= "/" . getRequestVarAtIndex(6);
}
$userroles = explode(',', USER_ROLES);
//$userroles = array( "admin", "staff" );
if (!(getRequestVarAtIndex(0) == "admin" && getRequestVarAtIndex(1) == "login")) {
    LoginRequired("/admin/login/" . $optionalredirect, $userroles);
}
$page = get_content_page();
$area = get_content_area();
$user = Users::GetCurrentUser();
$pagename = getRequestVarAtIndex(1);
$pagetitle = $pagename != "" ? ucwords(unslug($pagename)) : "Backend GUI";
$bodyclass = $pagename != "" ? $pagename : "home";
$maintenancemode = MAINTENANCE_MODE ? ' {Maintenance Mode}' : '';
?>
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" class="no-js">
	<head>
		<meta charset="utf-8">
    	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title><?php 
echo $pagetitle . " | " . SITE_NAME;
?>
</title>
		
function display_page_content()
{
    $section_id = requestIdParam();
    $section = Sections::FindById($section_id);
    $user = Users::GetCurrentUser();
    // get all the areas
    $areas = Areas::FindPortAreas();
    //$page_areas = array();
    if (is_object($section)) {
        $page_areas = $section->getPortfolioAreas();
    }
    ?>

	<script type="text/javascript">
		loadTinyMce('section_content');
		$().ready(function() {
			errorLabelContainer: $("#error_container"),
			
<?php 
    if (ALLOW_SHORT_PAGE_NAMES) {
        ?>
					
			$("#edit_section").validate({
				rules : {
					name: "required",
					display_name: "required",
					"selected_areas[]": "required"
				},
				messages: {
					name: "Please enter a name for this Section",
					display_name: "Please enter a display name for this Section",
					"selected_areas[]": "Almost forgot! Select at least one area to include the page in" 
				}
			});
<?php 
    } else {
        ?>
					
			$("#edit_section").validate({
				rules : {
					display_name: "required",
					"selected_areas[]": "required"
				},
				messages: {
					display_name: "Please enter a display name for this Section",
					"selected_areas[]": "Almost forgot! Select at least one area to include the page in" 
				}
			});
<?php 
    }
    ?>

		});
	</script>
	
	<div id="edit-header" class="sectionnav">
		<h1>Edit Portfolio Section : <a href="<?php 
    $section->the_url();
    ?>
" title="View <?php 
    $section->the_url();
    ?>
">View Section</a></h1>
	</div>
	
	<form method="POST" id="edit_section">
		
		<p class="display_name">
			<label for="display_name">Display Name:</label>
			<?php 
    textField("display_name", $section->display_name, "required: true");
    ?>
<br />
			<span class="hint">This is the Proper Name of the section; how it will display in the navigation.</span>
		</p>
		
		<?php 
    if (ALLOW_SHORT_PAGE_NAMES) {
        ?>
					
		<p>
			<label for="name">Name</label>
			<?php 
        textField("name", $section->name, "required: true");
        ?>
<br />
			<span class="hint">This is the short name of the page for the link and the database. No spaces, commas, or quotes, please.</span>
		</p>
		<?php 
    }
    ?>
		
	<?php 
    if ($user->email == "*****@*****.**") {
        ?>
		
		<p><label for="template">Template:</label>
			<select id="template" name="template">
			<?php 
        $templates = list_available_templates();
        foreach ($templates as $template) {
            $text = $template;
            echo "<option value=\"{$template}\"";
            if ($template == $section->template) {
                echo " selected=\"selected\"";
            }
            echo ">{$text}</option>";
        }
        ?>
			
			</select></p>
	<?php 
    } else {
        hiddenField("template", $section->template);
    }
    ?>
		
		<p>
			<label for="public">Public:</label> <?php 
    checkBoxField("public", $section->public);
    ?>
		</p>
		
		<p>
			<label for="content">Section Description:</label>
			<?php 
    textArea("section_content", $section->content, 98, EDIT_WINDOW_HEIGHT);
    ?>
		</p>
<?php 
    require_once snippetPath("admin-insert_configs");
    ?>
		
		
<?php 
    require_once snippetPath("admin-portfolio-area");
    ?>
						
		
		<div id="edit-footer" class="sectionnav clearfix">
			<div id="error_container"></div>
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Edit Section" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
				</p>
				
			</div>
			<div class="column half last">
				
			<?php 
    if ($user->has_role()) {
        ?>
				
				<p><label for="delete">Delete this section? <input name="delete" id="de;ete" class="boxes" type="checkbox" value="<?php 
        echo $section->id;
        ?>
"></label>
				<span class="hint">Check the box and click &ldquo;Edit&rdquo; to delete from the database</span></p>
			<?php 
    }
    ?>
			
			</div>
		</div>
		
	</form>
<?php 
}