Example #1
0
function PageContent()
{
    global $message;
    global $template_id;
    global $menu_title;
    global $page_title;
    global $title_tag;
    global $friendly_url;
    global $meta_keywords;
    global $meta_description;
    global $is_menu;
    global $published;
    global $parent_page_id;
    global $id;
    ?>

	<script type="text/javascript" src="tinymce/js/tinymce/tinymce.min.js"></script>
	<script type="text/javascript">
	tinyMCE.init({
	    selector : "textarea.mceEditor",
	    plugins : "image code pagebreak table spellchecker preview searchreplace print contextmenu paste fullscreen link nonbreaking",
	    image_advtab : true,
	    forced_root_block : "",
	    setup: function (editor) {
	        editor.on('init', function(args) {
	            editor = args.target;
	
	            editor.on('NodeChange', function(e) {
	                if (e && e.element.nodeName.toLowerCase() == 'img') {
	//                     width = e.element.width;
	//                     height = e.element.height;
	                    tinyMCE.DOM.setAttribs(e.element, {'class':'img_responsive', 'height' : null, 'width' : null});
	                    tinyMCE.DOM.setStyle(e.element, 'max-width', '100%');
	                }
	            });
	        });
	    },
		content_css : ["../css/bootstrip.min.css"],
	    document_base_url : "http://havells.boxkitemedia.com"
	});
	</script>

	<div id="content">

		<div class="layout">
	        <?php 
    if ($id == 0) {
        $bread_title = 'Page Add';
    } else {
        $bread_title = 'Page Edit';
    }
    $aLabels = array();
    $aLinks = array();
    $aLabels[0] = 'Home';
    $aLinks[0] = 'mainpage.php';
    $aLabels[1] = 'Pages';
    $aLinks[1] = 'page_list.php';
    $aLabels[2] = $bread_title;
    $aLinks[2] = '';
    echo Helpers::CreateBreadCrumbs($aLabels, $aLinks);
    ?>

		    <p class="larger botspace heading"><?php 
    echo $bread_title;
    ?>
</p>

			<div class="formstyle ">
                <?php 
    if ($message != "") {
        echo "<p class=\"err\">" . $message . "</p>";
    }
    ?>
				<form method="post" action="page_admin.php">
					<table class="form-table">
         <?php 
    if (!isset($id) || $id == 0) {
        ?>
         <tr>
            <td class="table-label" align="right"><strong>Page Template: </strong></td>
            <td>
               <select name="template_id">
                   <option value=""></option>
               <?php 
        $objTemplate = new Template();
        $oTemplate = $objTemplate->GetAllTemplate('name');
        foreach ($oTemplate as $template) {
            $cSelected = '';
            if ($template_id == $template->Id) {
                $cSelected = 'selected';
            }
            echo '<option ' . $cSelected . ' value="' . $template->Id . '">' . $template->Name . '</option>';
        }
        ?>
               </select>
            </td>
         </tr>
         <?php 
    }
    ?>
         <tr>
            <td class="table-label" align="right"><strong>Menu Title: </strong></td>
            <td>
               <input type="text" class="form midform" class="form midform" maxlength="100" size="40" value="<?php 
    echo $menu_title;
    ?>
" name="menu_title" /> <em>(This is what displays in the menu dropdown)</em>
            </td>
         </tr>
         <tr>
            <td class="table-label" align="right"><strong>Page Title: </strong></td>
            <td>
               <input type="text" class="form midform" class="form midform" maxlength="100" size="40" value="<?php 
    echo $page_title;
    ?>
" name="page_title" /> <em>(This is what displays on the top of this page)</em>
            </td>
         </tr>
         <!--
         <tr>
            <td class="table-label" align="right"><strong>Friendly URL: </strong></td>
            <td>
               <input type="text" class="form midform" maxlength="100" size="40" value="<?php 
    echo $friendly_url;
    ?>
" name="friendly_url" />
            </td>
         </tr>
         -->
         <tr>
            <td class="table-label" align="right"><strong>Title Tag: </strong></td>
            <td>
               <input type="text" class="form midform" maxlength="100" size="60" value="<?php 
    echo $title_tag;
    ?>
" name="title_tag" />
            </td>
         </tr>
         <tr>
            <td class="table-label" align="right"><strong>META Keywords: </strong></td>
            <td>
               <input type="text" class="form midform" maxlength="255" size="60" value="<?php 
    echo $meta_keywords;
    ?>
" name="meta_keywords" />
            </td>
         </tr>
         <tr>
            <td class="table-label" align="right" valign="top"><strong>META Description: </strong></td>
            <td>
               <textarea rows="3" cols="60" class="mceNoEditor" name="meta_description" style="width: 400px;"><?php 
    echo $meta_description;
    ?>
</textarea>
            </td>
         </tr>
         <tr>
            <td colspan="2">&nbsp;</td>
         </tr>
         
         <?php 
    if (isset($id)) {
        $objPagePart = new PagePart();
        $oPageParts = $objPagePart->GetAllPagePartByPageId($id);
        foreach ($oPageParts as $pagepart) {
            $objTemplatePartType = new TemplatePartType($pagepart->TemplatePartId);
            if ($objTemplatePartType->Name == 'Right Column' && $pagepart->Content == '') {
                $content = '%%P3_REQUEST_A_QUOTE_SIDE%% %%P3_VIDEO_SIDE%% %%P3_TESTIMONIAL_SIDE%%';
            } else {
                $content = $pagepart->Content;
            }
            ?>
             <tr>
                <td class="table-label" align="right" valign="top"><strong><?php 
            echo $objTemplatePartType->Name;
            ?>
: </strong></td>
                <td>
                   <textarea style="width:90%; height:400px;" class="mceEditor" id="page_part_<?php 
            echo $pagepart->Id;
            ?>
" name="page_part_<?php 
            echo $pagepart->Id;
            ?>
"><?php 
            echo $content;
            ?>
</textarea>
                </td>
             </tr>
             <tr>
                <td colspan="2">&nbsp;</td>
             </tr>
             <?php 
        }
    }
    ?>
         <!--
         <tr>
            <td class="table-label" align="right"><strong>Is Menu Page?: </strong></td>
            <td valign="bottom">
               <input type="checkbox" <?php 
    if ($is_menu == '1') {
        echo 'checked';
    }
    ?>
 value="1" name="is_menu" />
            </td>
         </tr>
         -->
         <!--
         <tr>
            <td class="table-label" align="right"><strong>Parent Page: </strong></td>
            <td>
               <select name="parent_page_id">
                   <option value=""></option>
                   <option <?php 
    if ($parent_page_id == '1') {
        echo 'selected';
    }
    ?>
 value="1">Products</option>
                   <option <?php 
    if ($parent_page_id == '2') {
        echo 'selected';
    }
    ?>
 value="2">Media + Resources</option>
                   <option <?php 
    if ($parent_page_id == '3') {
        echo 'selected';
    }
    ?>
 value="3">Company</option>
                   <option <?php 
    if ($parent_page_id == '4') {
        echo 'selected';
    }
    ?>
 value="4">Contact</option>
               </select>
            </td>
         </tr>
         -->
         <tr>
            <td class="table-label" align="right"><strong>Published?: </strong></td>
            <td valign="bottom">
               <input type="checkbox" <?php 
    if ($published == '1') {
        echo 'checked';
    }
    ?>
 value="1" name="published" />
            </td>
         </tr>
					</table>
				
					<p class="submit"><input type="submit" name="commit" value="Save Page">&nbsp;&nbsp;<input type="submit" name="commit" value="Cancel"></p>
				
                    <input type="hidden" name="page_id" value="<?php 
    echo $id;
    ?>
" id="page_id">
                   	<input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
" />

				</form>
		</div>

	</div>

<?php 
}