PageRenderTime 55ms CodeModel.GetById 9ms RepoModel.GetById 1ms app.codeStats 0ms

/cms/forms/pages_form.php

http://kancms.googlecode.com/
PHP | 235 lines | 216 code | 18 blank | 1 comment | 14 complexity | 6950a375bc6ad27001207cc9f5136934 MD5 | raw file
Possible License(s): BSD-2-Clause, GPL-2.0, LGPL-2.1
  1. <?php
  2. // prevent direct access
  3. if( !defined("SITE_ID") ) {
  4. die("Access Denied");
  5. }
  6. $edit_page = NULL;
  7. if( isset($_POST['id']) ) {
  8. $edit_page = $pm->getPage($_POST['id']);
  9. }
  10. ?>
  11. <form action="ajax_pages/pages.php" method="post" name="PageAddForm" id="PageAddForm" class="PagesForm">
  12. <table width="100%" align="center" cellpadding="6" cellspacing="0">
  13. <tr >
  14. <td colspan="2" nowrap="nowrap" class="sectionTitle3">
  15. Page Definition
  16. </td>
  17. </tr>
  18. <tr >
  19. <td width="156" align="right" nowrap="nowrap">
  20. Parent Page:
  21. </td>
  22. <td width="543" >
  23. <select name="ParentID" id="ParentID">
  24. <option value="">No Parent [Menu Level Page]</option>
  25. <option value="">---------------------------</option>
  26. <?php
  27. function printPageOptions($page_data, $level = 0) {
  28. global $edit_page;
  29. foreach($page_data as $data) {
  30. $dashes = str_repeat("--",$level);
  31. $selected = isset($edit_page) && $edit_page->getParentID() == $data['id'] ? 'selected="selected"' : "";
  32. echo "<option value='" . $data['id'] . "' $selected>" . $dashes . " " . $data['PageName'] . "</option>";
  33. if( isset($data['children']) ) {
  34. printPageOptions($data['children'], $l = $level + 1);
  35. }
  36. }
  37. }
  38. $parent_pages = $pm->getAdjacencyTree()->getFullNodes( array("id","PageName","PageDescription") );
  39. printPageOptions($parent_pages);
  40. ?>
  41. </select>
  42. </td>
  43. </tr>
  44. <tr >
  45. <td align="right" nowrap="nowrap">
  46. Page Title:
  47. </td>
  48. <td >
  49. <input type="text" id="PageName" name="PageName" size="50" value="<?php echo isset($edit_page) ? $edit_page->getName() : "Page Title"; ?>" />
  50. </td>
  51. </tr>
  52. <tr >
  53. <td align="right" nowrap="nowrap">
  54. Page Title Alias:
  55. </td>
  56. <td align="left" nowrap="nowrap">
  57. <input name="PageNameAlias" type="text" class="alias" id="PageNameAlias" value="<?php echo isset($edit_page) ? $edit_page->getAlias() : "page-title"; ?>" size="50" />
  58. </td>
  59. </tr>
  60. <tr >
  61. <td nowrap="nowrap" align="right">
  62. Position:
  63. </td>
  64. <td>
  65. <input name="PagePosition" type="text" id="PagePosition" value="<?php echo isset($edit_page) ? $edit_page->getPosition() : "1"; ?>" size="4" style="text-align: center;" />
  66. </td>
  67. </tr>
  68. <tr >
  69. <td align="right">
  70. Description:<br />
  71. <span class="small">(Used As A Meta Data or Tooltip)</span>
  72. </td>
  73. <td align="left" nowrap="nowrap">
  74. <textarea name="PageDescription" cols="50" rows="2" id="PageDescription"><?php echo isset($edit_page) ? htmlentities($edit_page->getDescription()) : ""; ?></textarea>
  75. </td>
  76. </tr>
  77. <tr >
  78. <td align="right" nowrap="nowrap">
  79. Content Layout:
  80. </td>
  81. <td align="left" nowrap="nowrap">
  82. <select id="PageLayout" name="PageLayout">
  83. <?php
  84. $layouts = $site->getTheme()->getOption('layouts');
  85. if( count($layouts) > 0 ) {
  86. foreach($layouts as $layout => $desc) {
  87. $selected = isset($edit_page) && $edit_page->getPageLayout() == $layout ? "selected=selected" : "";
  88. echo "<option value='{$layout}' {$selected}>{$desc}</option>";
  89. }
  90. } else {
  91. echo "<option value='sections.php'>Default Pages Layout</option>";
  92. } ?>
  93. </select>
  94. </td>
  95. </tr>
  96. <tr <?php echo !isAdminUser() ? 'style="display:none;"' : ""; ?>>
  97. <td align="right" nowrap="nowrap">
  98. Redirect To URL:
  99. </td>
  100. <td>
  101. <input class="page-linker" name="RedirectURL" type="text" id="RedirectURL" size="60" value="<?php echo isset($edit_page) ? $edit_page->getRedirectURL() : ""; ?>" />
  102. </td>
  103. </tr>
  104. <tr >
  105. <td align="right" colspan="2">&nbsp;
  106. </td>
  107. </tr>
  108. <tr >
  109. <td colspan="2" align="left" nowrap="nowrap" class="sectionTitle3">
  110. Page Summary <!--<span class="small">(Introductory text to page)</span>-->
  111. </td>
  112. </tr>
  113. <!--<tr >
  114. <td align="right" valign="top">
  115. Page Summary:<br />
  116. <span class="small">(Introductory text to page)</span>
  117. </td>
  118. <td>
  119. &nbsp;
  120. </td>
  121. </tr>-->
  122. <tr>
  123. <td colspan="2">
  124. <textarea name="PageSummary" id="PageSummary" cols="60" rows="7" style="width: 100%;"><?php echo isset($edit_page) ? kan_make_plain($edit_page->getSummary()) : ""; ?></textarea>
  125. </td>
  126. </tr>
  127. <tr >
  128. <td align="right" colspan="2">&nbsp;
  129. </td>
  130. </tr>
  131. <tr >
  132. <td colspan="2" align="left" nowrap="nowrap" class="sectionTitle3">
  133. Page Content
  134. </td>
  135. </tr>
  136. <!--<tr >
  137. <td colspan="2" align="left" valign="top">
  138. <div class="cms-form-message"><ul>
  139. <li>
  140. Use either the <strong>Formatted HTML</strong> or <strong>PHP Code</strong> to the main content for the page.
  141. </li>
  142. <li>
  143. Use the <strong>Page Blocks</strong> to provide custom code snippets
  144. or static HTML that can be displayed on the sidebar or as part of the content when the page is displayed by the theme.
  145. </li>
  146. </ul></div>
  147. </td>
  148. </tr>-->
  149. <tr >
  150. <td colspan="2" align="left" valign="top" nowrap="nowrap">
  151. <div id="page-tabs" class="ui-tabs" style="background: transparent;" >
  152. <ul class="ui-tabs-nav">
  153. <li id="html-tab" class="ui-tabs-selected">
  154. <a id="html" href="#html-pane">Formatted HTML</a>
  155. </li>
  156. <li id="php-tab">
  157. <a id="php" href="#php-pane">PHP Code</a>
  158. </li>
  159. <!--<li id="blocks-tab" style="margin-left: 80px;">
  160. <a id="blocks" href="#blocks-pane">Page Blocks</a>
  161. </li>-->
  162. </ul>
  163. <div id="html-pane" class="ui-tabs-panel">
  164. <textarea name="HTMLContent" cols="60" rows="20" id="HTMLContent" style="height:500px; width: 100%;"><?php echo isset($edit_page) && $edit_page->getContentType() == "html" ? kan_make_plain($edit_page->getContent()) : ""; ?></textarea>
  165. </div>
  166. <div id="php-pane" class="ui-tabs-panel">
  167. <div style="border: solid #eee 1px;">
  168. <?php
  169. $content = isset($edit_page) && $edit_page->getContentType() == "php" ? kan_make_plain($edit_page->getContent()) : "";
  170. $fileUtils->getEditorForContent($content);
  171. ?>
  172. </div>
  173. </div>
  174. <!--<div id="blocks-pane" class="ui-tabs-panel">
  175. Page Blocks Here
  176. </div>-->
  177. </div>
  178. <input type="hidden" name="PageContentType" id="ContentType" value="<?php echo isset($edit_page) ? $edit_page->getContentType() : "html"; ?>" />
  179. <textarea name="PageContent" cols="1" rows="1" id="Content" style="position:absolute; z-index: -1;"><?php echo isset($edit_page) ? kan_make_plain($edit_page->getContent()) : ""; ?></textarea>
  180. <input type="hidden" name="id" id="id" value="<?php echo isset($edit_page) ? $edit_page->getId() : ""; ?>" />
  181. </td>
  182. </tr>
  183. <tr style="display:none;" >
  184. <td colspan="2" align="left" nowrap="nowrap" class="sectionTitle3">
  185. Page Options
  186. </td>
  187. </tr>
  188. <tr style="display:none;">
  189. <td nowrap="nowrap" align="right">
  190. Use Accordion Mode:
  191. </td>
  192. <td>
  193. <select name="UseAccordionMode" class="sectionText1" id="UseAccordionMode">
  194. <option value="true">Yes</option>
  195. <option value="false">No</option>
  196. </select>
  197. <span class="small">(Enable / Disable Collapsing of Page Sections)</span>
  198. </td>
  199. </tr>
  200. <tr >
  201. <td nowrap="nowrap" align="right">&nbsp;
  202. </td>
  203. <td>&nbsp;
  204. </td>
  205. </tr>
  206. <tr >
  207. <td colspan="2" align="center" nowrap="nowrap">
  208. <div style="position: fixed; bottom: 45px; left: 50%; margin-left: -100px; width: 400px; text-align: center; background-color: rgba(240,240,240,0.8); padding: 5px; border: solid #ccc 1px; border-radius: 5px;">
  209. <input type="submit" class="form_button" id="submit-btn" value="<?php echo isset($edit_page) ? "Update Page" : "Save Page"; ?>" />
  210. <input name="button" type="button" class="form_button" id="cancel-btn" value="Cancel"/>
  211. </div>
  212. </td>
  213. </tr>
  214. </table>
  215. <input type="hidden" name="MM_insert" value="form2" />
  216. <input type="hidden" id="action" name="action" value="<?php echo isset($_GET['edit']) ? "update_page" : "add_page"; ?>" />
  217. </form>