function customerFields($data, $badFields)
{
    global $states;
    global $COUNTRIES;
    if (userLoggedIn() && array_key_exists("CID", $data) && $data["CID"] != "") {
        tableRow(array(tableData(prompt("<b>CID:</b>"), "right", "top"), tableData(prompt($data["CID"]), "left", "top")));
        prepDatePicker();
        tableRow(array(tableData(prompt("<b>Met Date:</b>"), "right", "top"), tableData(text($data, "metDate", "", "", "datepicker"), "left", "middle")));
    }
    tableRow(array(tableData(prompt("<b>First name*:</b>", in_array("fname", $badFields)), "right"), tableData(text($data, "fname"), "left", "middle"), tableData(prompt("<b>Last name*:</b>", in_array("lname", $badFields)), "right"), tableData(text($data, "lname"), "left", "middle")));
    tableRow(array(tableData(prompt("<b>Email*:</b>", in_array("email", $badFields)), "right"), tableData(text($data, "email"), "left", "middle"), tableData(prompt("<b>Phone Number:</b>", in_array("phoneNum", $badFields)), "right"), tableData(text($data, "phoneNum"), "left", "middle")));
    tableRow(array(tableData(prompt("<b>Title:</b>", in_array("title", $badFields)), "right"), tableData(radioButton($data, "title", "Mr.", false, "Mr."), "center", "middle"), tableData(radioButton($data, "title", "Ms.", false, "Ms."), "center", "middle"), tableData(radioButton($data, "title", "Mrs.", false, "Mrs."), "center", "middle"), tableData(radioButton($data, "title", "Dr.", false, "Dr."), "center", "middle")));
    if (!userLoggedIn()) {
        if ($data["charity"] == true) {
            tableRow(array(tableData(prompt("Tell us about your situtation, your team and why you need a ChapR. The more information the better!"), "middle", "top", 6)));
        } else {
            tableRow(array(tableData(prompt("Write anything else you would like us to know about you below: <br> team info (type, name, number), how you heard about us (where, from who?) etc."), "middle", "top", 6)));
        }
    }
    tableRow(array(tableData(prompt("<b>Comments:</b>", in_array("customerCNotes", $badFields), ""), "right", "top"), tableData(textArea($data, "customerCNotes", 3), "center", "", 5)));
    tableRow(array(tableData(prompt("<b>Street1*:</b>", in_array("street1", $badFields)), "right"), tableData(text($data, "street1"), "left", "middle", 3)));
    tableRow(array(tableData(prompt("<b>Street2:</b>", in_array("street2", $badFields)), "right"), tableData(text($data, "street2"), "left", "middle", 3)));
    $stateDirections = 'only applicable for domestic teams';
    tableRow(array(tableData(prompt("<b>City*:</b>", in_array("city", $badFields)), "right"), tableData(text($data, "city"), "left", "middle"), tableData(prompt("<b>State*:</b>", in_array("state", $badFields), "", $stateDirections), "right"), tableData(dropDown($data, "state", $states, "--------Choose Your State-------"), "left", "middle")));
    tableRow(array(tableData(prompt("<b>Zip*:</b>", in_array("zip", $badFields)), "right"), tableData(text($data, "zip"), "left", "middle"), tableData(prompt("<b>Country:</b>", in_array("country", $badFields)), "right"), tableData(dropDown($data, "country", $COUNTRIES), "left", "middle")));
    if (userLoggedIn()) {
        tableRow(array(tableData(prompt("<b>Admin Comments:</b>", in_array("adminCNotes", $badFields), "", $commentDirections), "right", "top"), tableData(textArea($data, "adminCNotes", 3), "center", "", 5)));
    }
    tableRow(array(tableData(hiddenField("CID", $data["CID"])), tableData(hiddenField("OID", $data["OID"]))));
}
function shippingFields($data, $badFields)
{
    tableRow(array(tableData(prompt("<b>OID*: </b>"), "right"), tableData(prompt($data["OID"]), "left")));
    $carriers = array("UPS" => "1 - UPS", "FedEx" => "2 - FedEx", "US Postal" => "3 - US Postal", "Other" => "4 - Other");
    tableRow(array(tableData(prompt("<b>Carrier*:</b>", in_array("carrier", $badFields)), "right"), tableData(dropDown($data, "carrier", $carriers, "--------Choose The Carrier-------"), "left", "middle")));
    tableRow(array(tableData(prompt("<b>Shipping Info (Tracking Num)*:</b>", in_array("trackingNum", $badFields)), "right"), tableData(text($data, "trackingNum"), "left", "middle")));
    tableRow(array(tableData(prompt("<b>Shipped Date*:</b>", in_array("shippedDate", $badFields)), "right"), tableData(text($data, "shippedDate", date("m/d/Y"), "", "datepicker"), "left", "middle")));
    tableRow(array(tableData(prompt("<b>Admin Order Notes:</b>", in_array("adminONotes", $badFields)), "right"), tableData(textArea($data, "adminONotes", 5), "left", "", 5)));
    hiddenField("OID", $data["OID"]);
}
function packageFields($data, $badFields)
{
    print_r("data");
    print_r($data);
    tableRow(array(tableData(prompt("<b>Package Name:</b>", in_array("packname", $badFields)), "right"), tableData(text($data, "packname", "", "30"), "left", "middle"), tableData(prompt("<b>Package Price:</b>", in_array("packprice", $badFields)), "right"), tableData(text($data, "packprice", "", "10"), "left", "middle"), tableData(prompt("<b>Active?</b>", in_array("active", $badFields)), "right"), tableData(checkBox($data, "active", "false", "YES"), "left", "middle", 3)));
    $pieces = $data["pieces"];
    // the list of all the pieces included in the package (as pulled from the pvp table)
    $i = 1;
    foreach ($pieces as $piece) {
        $pieceInfo = dbGetPiece($piece["PID"]);
        // get the info for the piece with that PID
        $pieceInfo["PID{$i}"] = $pieceInfo["PID"];
        $piecesOptions = dbGetPiecesNames();
        print_r("piecesOptions");
        print_r($piecesOptions);
        tableRow(array(tableData(prompt("<b>Piece{$i}:</b>", in_array("piece{$i}", $badFields)), "right"), tableData(dropDown($pieceInfo, "PID{$i}", $piecesOptions))));
        $i++;
    }
    hiddenField("PKID", $data["PKID"]);
    print "\n\n";
}
function orderFields($data, $badFields)
{
    global $SETTINGS;
    // display data not supposed to be visible for customers
    if (userLoggedIn()) {
        if (array_key_exists("OID", $data) && $data["OID"] != "") {
            tableRow(array(tableData(prompt("<b>OID: </b>"), "right", "top"), tableData(prompt($data["OID"]), "left", "top")));
        }
        tableRow(array(tableData(prompt("<b>Expedite:</b>"), "right", "top"), tableData(checkBox($data, "isExpedited", "true", "YES"), "left", "middle", 3)));
        prepDatePicker();
        tableRow(array(tableData(prompt("<b>Ordered Date:</b>"), "right", "top"), tableData(text($data, "orderedDate", "", "", "datepicker"), "left", "middle")));
    }
    // show the order amount change fields if the user has permission (and in WordPress)
    if (inWordPress() && current_user_can("can_change_amounts")) {
        tableRow(array(tableData(prompt("<b>Shipping Fee:</b>", in_array("shippingFee", $badFields)), "right"), tableData(text($data, "shippingFee", null, "10"), "left"), tableData(prompt("<b>Expedite Fee:</b>", in_array("expediteFee", $badFields)), "right"), tableData(text($data, "expediteFee", null, "10"), "left"), tableData(prompt("<b>Discount:</b>", in_array("discount", $badFields)), "right"), tableData(text($data, "discount", null, "10"), "left")));
    }
    // figure out how many rows to display initially ($i is set to that value)
    for ($i = $SETTINGS["MaxItems"]; $i > 1; $i--) {
        if (array_key_exists("packages{$i}", $data) && $data["packages{$i}"] != "" && $data["packages{$i}"] != 0 || array_key_exists("personality{$i}", $data) && $data["personality{$i}"] != "" && $data["personality{$i}"] != 0 || array_key_exists("quantity{$i}", $data) && $data["quantity{$i}"] != "" && $data["quantity{$i}"] != 0) {
            break;
        }
    }
    $initialRows = $i;
    // get currently available packages (from database) for display
    $rows = dbGetPackages();
    $displayPackages = array();
    foreach ($rows as $row) {
        if ($row["Active"]) {
            $displayPackages[$row["PackageName"]] = $row["PKID"];
        }
    }
    // get currently available personalities (from database) for display
    $rows = dbGetPersonalities();
    $displayPersonalities = array();
    foreach ($rows as $row) {
        if ($row["Active"]) {
            $displayPersonalities[$row["PieceName"]] = $row["PID"];
        }
    }
    if (!userLoggedIn()) {
        tableRow(array(tableData(prompt("Note: \"personality\" refers to the type of software or platform the firmware is compatible with.\n<br> It can be changed later using a USB stick, but we might as well set it for you."), "middle", "top", 6)));
    }
    for ($i = 1; $i <= $SETTINGS["MaxItems"]; $i++) {
        // note that the "table-row" setting for display is controversial and may
        // not work well in Microsoft IE
        // note, too, that the reason while rows 2 through 5 don't initially display
        // is that they are set as display = 'none' in the style sheet - if that
        // is turned off, then they will display right away
        $magicClick = "";
        if ($i != $SETTINGS["MaxItems"]) {
            $magicClick = "<button id=\"prodrowclick-";
            $magicClick .= $i;
            $magicClick .= "\"";
            if ($i != $initialRows) {
                $magicClick .= " style=\"visibility:hidden;\"";
            }
            $magicClick .= " type=\"button\" onclick=\"";
            $magicClick .= "document.getElementById('prodrow-";
            $magicClick .= $i + 1;
            // sets the next row to visible
            $magicClick .= "').style.display = 'table-row';";
            if ($i < $SETTINGS["MaxItems"] - 1) {
                $magicClick .= "document.getElementById('prodrowclick-";
                $magicClick .= $i + 1;
                // sets the next button to visible
                $magicClick .= "').style.visibility = 'visible';";
            }
            $magicClick .= "document.getElementById('prodrowclick-";
            $magicClick .= $i;
            // sets its own button to hidden
            $magicClick .= "').style.visibility = 'hidden';";
            $magicClick .= "\">+</button>";
        }
        if (userLoggedIn() && array_key_exists("iid{$i}", $data) && $data["IID"] != "") {
            tableRow(array(tableData(prompt("<b>IID{$i}:</b>"), "right", "top"), tableData(prompt($data["iid{$i}"]), "left", "top")));
        }
        tableRow(array(tableData(prompt("<b>Product*:</b>", in_array("product{$i}", $badFields)), "right"), tableData(dropDown($data, "packages{$i}", $displayPackages, "----------Select Product----------")), tableData(prompt("<b>Personality:</b>", in_array("personality{$i}", $badFields)), "right"), tableData(dropDown($data, "personality{$i}", $displayPersonalities, " ")), tableData(prompt("<b>Quantity*:</b>", in_array("quantity{$i}", $badFields)), "right"), tableData(text($data, "quantity{$i}", "", "2"), "left"), tableData($magicClick)), "prodrow-" . $i, $i <= $initialRows);
        hiddenField("iid{$i}", $data["iid{$i}"]);
    }
    if (!userLoggedIn()) {
        tableRow(array(tableData(prompt("Write anything you would like us to know about the order: <br> a deadline you need to meet, some option you want that isn't offered etc."), "middle", "top", 6)));
    }
    tableRow(array(tableData(prompt("<b>Order Notes:</b>"), "right", "top"), tableData(textArea($data, "customerONotes", 5), "left", "", 5)));
    if (userLoggedIn()) {
        tableRow(array(tableData(prompt("<b>Admin Order Notes:</b>"), "right", "top"), tableData(textArea($data, "adminONotes", 5), "left", "", 5)));
    }
    hiddenField("charity", $data["charity"]);
    hiddenField("OID", $data["OID"]);
}
Esempio n. 5
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 
}
Esempio n. 6
0
function display_page_content()
{
    $post_action = "";
    if (isset($_POST['submit'])) {
        $post_action = $_POST['submit'];
    }
    ?>

	<div id="mail_blaster">
		<?php 
    if (!$post_action) {
        $_SESSION['blaster'] = array();
        $lists = NLLists::FindAll();
        ?>
		
		<div id="edit-header" class="blaster">
    		<div class="nav-left column">
        		<h1>Email Blast Setup: Follow these Steps</h1>
    		</div>
    		<div class="nav-right column">
                <a href="<?php 
        echo get_link("admin/list_lists");
        ?>
" class="hcd_button">Manage Mailing Lists</a> 
    		</div>
    		<div class="clearleft"></div>
    	</div>
		
		<script type="text/javascript">
			//<![CDATA[
			$().ready(function() {
				$('.selectList').click(function() {
					$('a.blast_options').fadeIn();
				});
				
				$('.blast_options').click(function() {
					var value = "";
					$('#select_list .selectList').each(function() {
						if ($(this).attr('checked'))
						{
							value += $(this).val()+",";
						}
					});
					$('#session_add').load('<?php 
        echo BASEHREF;
        ?>
blaster/session_add/lists/'+value, function() { 
						$("#blast_options").load('<?php 
        echo BASEHREF;
        ?>
blaster/blast_options/', function() {
							$("#blast_options").slideDown();
						});
					});
					return false;
				});
				
				$('#step-one').click(function() {
    				$(this).fadeOut('slow');
				}); 
			});
			//]]>
		</script>
		
		<form id="select_list_form" method="POST">
		    <div id="select_list">
		        <h2><big>Step 1:</big> Choose a list to send an email to</h2>
<?php 
        foreach ($lists as $list) {
            echo '<p><label for="' . $list->name . '"><input class="selectList" name="list[]" type="checkbox" value="' . $list->name . '" id="' . $list->name . '"/> &nbsp; ' . $list->display_name . '</p>';
        }
        ?>
                    
                <a href="#" id="step-one" class="blast_options submitbutton" style="display:none;">Send a newsletter to selected list(s)</a>
			</div>
			
			<div id="blast_options" style="display: none;"></div>
		</form>
		
		<div id="session_add"></div>
<?php 
    } else {
        if ($post_action == "Submit All Options and Preview") {
            include_once mailPath('snippets/mail_config_parse');
            ?>
    
        <div id="edit-header" class="blaster">
    		<h1>Preview Your E-Newsletter Blast</h1>
    		<p><span class="hint">If you use your browser&rsquo;s &ldquo;Back&rdquo; button, you may lose any text or options you have configured here.</span></p>
    	</div>
    <?php 
            // ! Creates previews in Templates
            $templates_generated = array();
            $lists = "";
            foreach ($list_names as $slug) {
                $list = NLLists::FindBySlug($slug);
                $lists .= "<strong>{$list->display_name}</strong>";
                if (!in_array($list->template, $templates_generated)) {
                    echo "<p><strong>Template: {$list->template}</strong> (Please note: Things may look a little funky, as this is meant to be viewed in a mail browser)</p>\n";
                }
                $templates_generated[] = $list->template;
            }
            echo "<p>Your selected lists are: {$lists} </p>\n";
            echo "<p>Your email subject is: ";
            if ($_POST['subject_line']) {
                $subject = $_POST['subject_line'];
            } else {
                $subject = $list->display_name . " News: " . date("F j\\, Y");
            }
            echo "<strong>{$subject}</strong></p>";
            echo "<div class=\"mail_template\">\n";
            include_once mailPath("mail_layouts/" . $list->template . "_preview");
            echo "</div>\n";
            ?>

			<form id="send_list_form" method="POST">
				<?php 
            hiddenField("description", $_POST['description']);
            ?>
				<?php 
            hiddenField("subject_line", $subject);
            ?>
				
				<div id="edit-footer" class="blaster clearfix">
            		<div class="column half">
            			<p><input type="submit" class="submitbutton" name="submit" value="Send To Your Lists" /></p>
            		</div>
            		<div class="column half last">
            			<p>Be patient... depending on the number of addresses, this may take awhile.</p>
            		</div>
            	</div>
			</form>
<?php 
        } else {
            // Send the Mail
            include_once mailPath('snippets/mail_config_parse');
            // ! Creates previews in Templates
            $success = "";
            $failure = "";
            $subject = $_POST['subject_line'];
            foreach ($list_names as $slug) {
                $list = NLLists::FindBySlug($slug);
                // Include Template
                include_once mailPath("mail_layouts/" . $list->template);
                // stupid bug fix
                $mailed_content = str_replace(array("\\\\'", '\\\\"'), array("'", '"'), $mailed_content);
                $blast = MyActiveRecord::Create("MailBlast");
                $blast->email_subject = $subject;
                $blast->date_sent = date("Y-m-d");
                $blast->hash = md5(date('r', time()));
                $blast->content = $mailed_content;
                $blast->list_id = $list->id;
                $blast->save();
                $failure_num = 0;
                $success_num = 0;
                foreach ($list->findEmails() as $email) {
                    // To send HTML mail, the Content-type header must be set
                    $headers = 'MIME-Version: 1.0' . "\r\n";
                    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                    // Additional headers
                    $headers .= 'From: ' . $list->display_name . ' <' . SENDMAIL_FROM . '>' . "\r\n";
                    // Mail it
                    if (!mail($email->email, $subject, str_replace("{{-email-}}", $email->email, $blast->content), $headers)) {
                        $failure .= $list->display_name . ": " . $email->email . "<br />\n";
                        $failure_num++;
                    } else {
                        $success .= $list->display_name . ": " . $email->email . "<br />\n";
                        $success_num++;
                    }
                }
            }
            echo '<div id="edit-header" class="blaster"><h1>Success!</h1></div>';
            if ($failure_num != 0) {
                echo "<h2>{$failure_num} Email(s) failed:</h2>\n<p>" . $failure . "</p>\n<p>&nbsp;</p>\n";
            }
            echo "<h2>{$success_num} Emails got sent</h2>\n<p>" . $success . "</p>\n";
        }
    }
    ?>

	</div>
<?php 
}
Esempio n. 7
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 
}
Esempio n. 8
0
function display_page_content()
{
    $useremail = requestIDparam();
    // Check email by getting it from the database. Find the subscriptions associated with it. If it is not a valid email in our database, then do not display the interface below. Instead, maybe we redirect them to the home page.
    $email = NLEmails::FindByEmail($useremail);
    $lists = NLLists::FindAll();
    echo '<div class="subscriber"><div id"status_message"></div>';
    displayFlash();
    echo '<h1 class="subscriber--title">Manage your Newsletter Subscriptions</h1>';
    // There is no email that we can take out of the URL string
    if ($useremail == "") {
        ?>

			<h3 class="subscriber--subtitle subscriber--error">An email was not detected&hellip; please enter one below:</h3>
			
			<form class="form form__subscriber-profile" method="POST">
				
				<span class="form--input-group"><label for="email" class="screen-reader-text">Email</label><input type="email" id="email" name="email" class="form--input" placeholder="*****@*****.**" maxlength="128" required="required" tabindex="1" value=""></span>
                
				<p><input type="submit" class="button primary-action" name="submit" value="Manage This Email" tabindex="2"></p>
			</form>
<?php 
        // There is an email, but we didn't find a user associated with it
    } else {
        if (!is_object($email)) {
            ?>

			<h3 class="subscriber--subtitle subscriber--error">Whoops&hellip; that email is not subscribed to any lists</h3>
			<h3><a href="<?php 
            echo get_link("mail/subscribe/" . $useremail);
            ?>
" title="Click here to choose an email list to subscribe this email to">Subscribe to a list.</a></h3>
			
<?php 
            // Found the email and the user.
        } else {
            ?>
			
			<form class="form form__subscriber-profile form__wide" method="POST">
				
				<span class="form--input-group"><label for="email">Your Email</label>
                <input type="email" id="email" name="email" class="form--input" maxlength="128" required="required" value="<?php 
            echo $email->email;
            ?>
"></span>
				
				<h2 class="subscriber--subtitle">Subscriptions</h2>
				<p><em>You may uncheck a box to be removed from that list</em></p>
				
				<div class="subscriber--lists">
<?php 
            hiddenField("oldemail", $email->email);
            foreach ($lists as $list) {
                if ($list->public) {
                    if ($email->is_linked($list)) {
                        $checked = "checked";
                    } else {
                        $checked = "";
                    }
                    echo '<div class="subscriber--list-wrapper"><p class="subscriber--list"><label for="' . $list->name . '" class="check"><input type="checkbox" name="' . $list->name . '" id="' . $list->name . '" value="' . $list->id . '" ' . $checked . '> ' . $list->display_name . '</label></p>';
                    echo '<div class="subscriber--list--description">' . $list->description . '</div></div>';
                }
            }
            ?>
                
                </div>
                <p><input type="submit" class="button primary-action" name="submit" value="Save Subscription Settings"></p>
                
                <div class="subscriber--details">
    				<h3>Optional Information:</h3>
    				<span class="form--input-group"><label for="first_name">First Name</label> <input type="text" id="first_name" name="first_name" class="form--input" value="<?php 
            echo $email->first_name;
            ?>
"></span>
    				<span class="form--input-group"><label for="last_name">Last Name</label> <input type="text" id="last_name" name="last_name" class="form--input" value="<?php 
            echo $email->last_name;
            ?>
"></span>
    				<span class="form--input-group"><label for="address1">Address 1</label> <input type="text" id="address1" name="address1" class="form--input" value="<?php 
            echo $email->address1;
            ?>
"></span>
    				<span class="form--input-group"><label for="address2">Address 2</label> <input type="text" id="address2" name="address2" class="form--input" value="<?php 
            echo $email->address2;
            ?>
"></span>
    				<span class="form--input-group"><label for="city">City</label> <input type="text" id="city" name="city" class="form--input" value="<?php 
            echo $email->city;
            ?>
"></span>
    				<span class="form--input-group"><label for="state">State</label> <?php 
            echo StateSelectList("state", $email->state);
            ?>
</span>
    				<span class="form--input-group"><label for="zip">Zip Code</label> <input type="text" id="zip" name="zip" class="form--input" value="<?php 
            echo $email->zip;
            ?>
"></span>
    				<span class="form--input-group"><label for="phone">Phone</label> <input type="tel" id="phone" name="phone" class="form--input" value="<?php 
            echo $email->phone;
            ?>
"></span>
				</div>
				
				<p><label for="delete" class="check"><input type="checkbox" name="delete" id="delete" value="<?php 
            echo $email->email;
            ?>
">&nbsp; Remove my email from the site completely.</label></p>
				
				<p><input type="submit" class="button primary-action" name="submit" value="Save Subscription Settings"></p>
			</form>
<?php 
        }
    }
    echo '</div><!-- end .subscriber -->';
}
Esempio n. 9
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 
}
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 
}
Esempio n. 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 
}
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 
}
Esempio n. 13
0
function displayForm($data, $badFields)
{
    displayTitle();
    echo "<p style=\"text-align:center;margin:auto;width:80%\">";
    echo '<b>About SprocketR: </b>SprocketR is a web application to produce custom sprocket pairs based upon the parameters entered. The final output is a zip file of two 3D-printable STL files to download and test. During the process, the application will optimize the sprockets to create an appropriate amount of chain slack. In addition, it will give you the opportunity to change and balance your parameters to get the best sprockets for your application.</p>';
    echo '<table style="text-align:center;margin:auto;width:20%"><tr><td style="text-align:left;border:none">';
    echo '<a href="?page_id=2065"><button class="sprocketrButton">How It Was Created</button></a>';
    echo '</td><td style="text-align:right;border:none">';
    echo '<a href="?page_id=2090"><button class="sprocketrButton">How To Use</button></a>';
    echo '</td></tr></table>';
    echo '<div style="margin:auto;width:35%"><b>Instructions: </b>';
    echo '<ul><li>Start by entering the desired "gear ratio" (if necessary) and the center-to-center distance of the two sprockets.</li>';
    echo '<li>You may also enter the number of the teeth for one or both of the sprockets if needed.</li>';
    echo '<li>Choose the chain type desired.</li>';
    echo '<li>Choose the hub mounting holes for the sprockets (if any).</li>';
    echo '<li>Click "Generate Sprocket Options".</li>';
    echo '<li>The results page will provide the opportunity to change parameters to get the sprockets to best fit your application.</li>';
    echo '</ul></div>';
    echo "<p style=\"text-align:center;margin:auto;width:80%\">";
    //start form and table
    echo "<form action=\"\" class=\"sprocketrForm\" method=\"get\">\n     <table frame=\"void\" border=\"none\" class=\"form\" style=\"width:50%\" align=\"center\">\n     ";
    //add class="form" when ready to remove gridlines
    //gearRatioField
    if (array_key_exists("gearRatioField", $data)) {
        //check if gear ratio entered if so show in field
        tableRow(array(tableData(promptWithError("gearRatioField", "<b>Gear Ratio*: </b>", $badFields, "Must be in the form of #:#"), "left", "center"), tableData('<input
                               style="text-align: center;"
                               size="5"
                               type="text"
                               placeholder="#:#"
                               name="gearRatioField"
                               value="' . $data["gearRatioField"] . '"
                               title="Gear ratio of your sprockets, must be formatted like #:#"
                             />
                          ', "left", "center")));
        //gear ratio field
    } else {
        //if not entered show without data (see above comments, they still apply below)
        tableRow(array(tableData(promptWithError("gearRatioField", "<b>Gear Ratio*: </b>", $badFields, "Must be in the form of #:#"), "left", "center"), tableDataWidth('<input
                               style="text-align: center;"
                               size="5"
                               type="text"
                               placeholder="#:#"
                               name="gearRatioField"
                               title="Gear ratio of your sprockets, must be formatted like #:#"
                                                             />
                          ', "left", "center", 1, "gRatFieldRow")));
    }
    //centerToCenterField
    tableRow(array(tableData(promptWithError("centerToCenterField", "<b>Center to Center Distance (mm)*:</b>", $badFields, "Must be a number with optional decimal part"), "left", "center", 1), tableData(text($data, "centerToCenterField"), "left", "center", 2)));
    //chainSizeList
    tableRow(array(tableData(prompt("<b>Chain Size*: </b>"), "", "", "", "margin:0px"), tableData(dropDown($data, "chainSizeList", array("25" => "chain25", "35" => "chain35")))), "chainSize");
    //leftSprocketTeeth#Field
    tableRow(array(tableData(promptWithError("leftSprocketTeeth#Field", '<b>Number of Teeth on Sprocket 1: </b><span style="color:red"> (optional)</span>', $badFields, "Must be an integer less than " . NUM_TEETH_MAX . " or left blank"), "left", "center", 1), tableData(text($data, "leftSprocketTeeth#Field"), "left", "center", 1)), "leftSprocketTeeth");
    //rightSprocketTeeth#Field
    tableRow(array(tableData(promptWithError("rightSprocketTeeth#Field", '<b>Number of Teeth on Sprocket 2: </b><span style="color:red"> (optional)</span>', $badFields, "Must be an integer less than " . NUM_TEETH_MAX . " divisible by the gear ratio or left blank"), "left", "center", 1), tableData(text($data, "rightSprocketTeeth#Field"), "left", "center", 1)), "rightSprocketTeeth");
    //desiredSlackField
    tableRow(array(tableData(promptWithError("desiredSlackField", "<b>Desired Slack (default 1%): </b>", $badFields, "Must be a decimal or left blank")), tableData(text($data, "desiredSlackField"))), "desiredSlack");
    //holeOptionLabels
    echo "<tr><td class = \"form\"><b>Hub Choices:</b></td><td>";
    echo '<table><tr>';
    holeCheckBox("Versa Hub (small).png", $data, "holeOption_versaHub", " Versa Hub");
    holeCheckBox("Tetrix Hub (small).png", $data, "holeOption_tetrixHub", " Tetrix Hub");
    holeCheckBox("Versa Bearing Hole (small).png", $data, "holeOption_versaBearingHole", " Versa Bearing Hole");
    echo '</tr></table></td></tr>';
    // submit button & hidden field
    tableRow(array(tableData(hiddenField("page_id", $_GET["page_id"]))));
    echo '<tr><td class="centerCell" colspan=2 align="center">' . "<input type=\"submit\" class=\"sprocketrButton\" value=\"Generate Sprocket Options\">" . '</td></tr>';
    formFooter("sprocketrForm");
}
Esempio n. 14
0
function display_page_content()
{
    $account = Paypal_Config::GetAccount();
    ?>
										
	<script type="text/javascript">
		$().ready(function() {
			$("#add_product").validate({
				rules: {
						display_name: "required",
						price: "required"
					},
				messages: {
						display_name: "Please 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>Add Product</h1>
	</div>
	
	<form method="POST" id="add_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", "", "required: true");
    ?>
</p>
		
		<p><label for="price">Price:</label><span class="hint">This is the price of the product.</span><br />
		<?php 
    textField("price", "", "required: true");
    ?>
</p>
		
		<p>
		    <label for="id_image">Select an 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", "", 98, 30);
    ?>
		</p>
			
		<div id="edit-footer" class="productnav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Add Product" /> <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 
}