PageRenderTime 53ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/themes/admin/content/output.php

https://github.com/myiek/swopr.ca
PHP | 234 lines | 190 code | 44 blank | 0 comment | 37 complexity | 4f3a64c1239c9c2acb93f15ff6b6fbfc MD5 | raw file
Possible License(s): LGPL-2.1
  1. <? if ($doc->saved()) { ?>
  2. <script>
  3. current_content = <?= $doc->id; ?>
  4. </script>
  5. <? } ?>
  6. <form method="post" action="<? $doc->POD->podRoot(); ?>/admin/content/" enctype="multipart/form-data" id="content_form" class="edit_form valid">
  7. <input type="hidden" name="action" value="update" />
  8. <? if ($doc->get('id')) { ?>
  9. <input type="hidden" name="id" value="<? $doc->write('id'); ?>" />
  10. <? } ?>
  11. <div id="options">
  12. <div class="option_set">
  13. <input type="submit" class="button" name="save" value="Save" />
  14. <p class="input">
  15. <label for="type">Type:</label>
  16. <span id="content_type">
  17. <? $doc->write('type'); ?>
  18. <a href="#" onclick="return changeType();">Change</a>
  19. </span>
  20. <? if ($doc->type=='spam'){?><input type="submit" name="notspam" value="Not Spam!" /><? } ?>
  21. <input id="type" name="type" autocomplete="off" class="required text" value="<? $doc->htmlspecialwrite('type'); ?>" style="display:none;"/>
  22. </p>
  23. <p class="input"><label for="privacy">Privacy:</label><select name="privacy" id="privacy">
  24. <option value="public" <? if ($doc->get('privacy')=="public") { ?>selected<? } ?>>Public</option>
  25. <option value="friends_only" <? if ($doc->get('privacy')=="friends_only") { ?>selected<? } ?>>Friends Only</option>
  26. <option value="group_only" <? if ($doc->get('privacy')=="group_only") { ?>selected<? } ?>>Group Only</option>
  27. </select></p>
  28. <p class="input"><label for="status">Status:</label><input name="status" class="text" value="<? $doc->htmlspecialwrite('status'); ?>" /></p>
  29. <p class="input"><label for="stub">Stub:</label><input name="stub" class="text" value="<? $doc->htmlspecialwrite('stub'); ?>" /></p>
  30. <p class="input"><label for="date">Date:</label><input id="date" name="date" class="text" value="<? $doc->htmlspecialwrite('date'); ?>" /></p>
  31. <p><a href="<?= $doc->permalink; ?>">View</a></p>
  32. </div>
  33. <? if ($doc->saved()) { ?>
  34. <? if ($doc->get('parentId')) {
  35. $parent = $this->POD->getContent(array('id'=>$doc->get('parentId')));
  36. ?>
  37. <div class="option_set">
  38. <h3>Parent Content</h3>
  39. <P>Child of <a href="<? $doc->POD->podRoot(); ?>/admin/content/?id=<? $parent->write('id'); ?>"><? $parent->write('headline'); ?></a>.</p>
  40. </div>
  41. <? } ?>
  42. <? if ($doc->get('groupId')) {
  43. $group = $this->POD->getGroup(array('id'=>$doc->get('groupId')));
  44. ?>
  45. <div class="option_set">
  46. <h3>Group</h3>
  47. <P>Belongs to the <a href="<? $doc->POD->podRoot(); ?>/admin/groups/?id=<? $group->write('id'); ?>"><? $group->write('groupname'); ?></a> group.</p>
  48. </div>
  49. <? } ?>
  50. <div class="option_set">
  51. <h3>Author</h3>
  52. <p class="input" id="creator_display">
  53. <label>Creator:</label>
  54. <? if ($file = $doc->creator()->files()->contains('file_name','img')) { ?>
  55. <img src="<?= $file->src('50',true); ?>" align="left" hspace="5"/>
  56. <? } ?>
  57. <a href="<? $doc->POD->podRoot(); ?>/admin/people/?id=<? echo $doc->creator('id'); ?>"><? echo $doc->creator('nick'); ?></a><br />
  58. <a href="<? $doc->POD->podRoot(); ?>/admin/content/search.php?userId=<? $doc->creator()->write('id'); ?>" class="tool">More from this person...</a><br />
  59. </p>
  60. <? if ($doc->author()->id!=$doc->creator()->id) { ?>
  61. <p class="input" id="author_display">
  62. <label>Author:</label>
  63. <? if ($file = $doc->author()->files()->contains('file_name','img')) { ?>
  64. <img src="<?= $file->src('50',true); ?>" align="left" hspace="5" />
  65. <? } ?>
  66. <a href="<? $doc->POD->podRoot(); ?>/admin/people/?id=<? echo $doc->author('id'); ?>"><? echo $doc->author('nick'); ?></a><br />
  67. <a href="<? $doc->POD->podRoot(); ?>/admin/content/search.php?userId=<? $doc->author()->write('id'); ?>" class="tool">More from this person...</a><br />
  68. </p>
  69. <? } ?>
  70. <a href="#" onclick="return changeAuthor();" id="changeAuthorLink">Change Author</a>
  71. <p class="input" id="author_edit" style="display:none;">
  72. <label>Change author to:</label>
  73. <input name="userId_autofill" id="userId_autofill" />
  74. <input name="userId" id="userId" type="hidden" value="<?= $doc->userId; ?>" />
  75. </p>
  76. <p class="input">
  77. <label>Last Modified:</label>
  78. <?= date('M j, Y \@ H:i',strtotime($doc->get('changeDate'))); ?>
  79. </p>
  80. </div>
  81. <div class="option_set">
  82. <a href="<? $doc->POD->podRoot(); ?>/admin/content/?id=<? $doc->write('id'); ?>&action=delete" onclick="return confirm('Really delete this document FOREVER?');" class="tool">Delete</a>
  83. </div>
  84. <? } ?>
  85. </div>
  86. <div class="panel panel_with_options" id="post_info_panel">
  87. <? if ($doc->saved()) { ?>
  88. <h1>
  89. <ul class="attachments">
  90. <li><a href="#comments" class="tool"><? echo $doc->comments()->totalCount(); ?> <? echo $this->POD->pluralize($doc->comments()->totalCount(),'Comment','Comments'); ?></a></li>
  91. <li><a href="#children" class="tool"><? echo $doc->children()->totalCount(); ?> <? echo $this->POD->pluralize($doc->children()->totalCount(),'Child post','Child posts'); ?></a></li>
  92. <li><a href="<? $doc->POD->podRoot(); ?>/admin/files/index.php?contentId=<? $doc->write('id'); ?>" class="tool"><? echo $doc->files()->totalCount(); ?> <? echo $this->POD->pluralize($doc->files()->totalCount(),'File','Files'); ?></a></li>
  93. <li><a href="<? $doc->POD->podRoot(); ?>/admin/flags/index.php?contentId=<? $doc->write('id'); ?>" class="tool">Flags</a></li>
  94. </ul>
  95. Edit <?= ucfirst($doc->type); ?>
  96. </h1>
  97. <? } else { ?>
  98. <h1>Add <?= ucfirst($doc->type); ?></h1>
  99. <? } ?>
  100. <? if ($this->hidden==1) { ?>
  101. <div class="info">
  102. This content was deleted and should no longer be available on the public site.
  103. </div>
  104. <? } ?>
  105. <p class="input">
  106. <label for="headline">Headline:</label>
  107. <textarea id="headline" name="headline" class="required text" wrap="virtual"><? $doc->htmlspecialwrite('headline'); ?></textarea>
  108. </p>
  109. <p class="input">
  110. <label for="body">Body:</label> <a href="#" onclick="tinyMCE.execCommand('mceAddControl', false,'body');return false;">Fancy</a> | <a href="#" onclick="tinyMCE.execCommand('mceRemoveControl', false,'body');return false;">HTML</a>
  111. <textarea id="body" name="body" class="text tinymce" wrap="virtual"><? $doc->htmlspecialwrite('body'); ?></textarea>
  112. </p>
  113. <p class="input" id="content_img" <? if (!$doc->saved() || !($file = $doc->files()->contains('file_name','img'))) {?>style="display: none;"<? } ?>>
  114. <label for="link">Primary Image:</label> <? if ($doc->saved()) { ?><a href="<? $POD->podRoot(); ?>/admin/files?contentId=<? $doc->write('id'); ?>">More Files</a><? } ?>
  115. <? if ($file) { ?>
  116. <br />
  117. <a href="<? $POD->podRoot(); ?>/admin/files?id=<?= $file->id; ?>"><img src="<?= $file->src('100',true); ?>" border="0"></a>
  118. <? } else { ?>
  119. <input name="img" type="file" class="text" />
  120. <? } ?>
  121. </p>
  122. <p class="input" id="content_link" <? if (!$doc->saved() || !$doc->link) {?>style="display: none;"<? } ?>>
  123. <label for="link">Link:</label> Include a link to an external site
  124. <input name="link" class="text url" value="<? $doc->htmlspecialwrite('link'); ?>" />
  125. </p>
  126. <p class="input" id="content_tags" <? if (!$doc->saved() || $doc->tags()->count()==0) {?>style="display: none;"<? } ?>>
  127. <label for="tags">Tags:</label>
  128. <input id="tags" name="tags" class="text" value="<? echo $doc->tagsAsString(); ?>" />
  129. </p>
  130. <? if (!$doc->saved() || !$doc->files()->contains('file_name','img')) {?>
  131. <a href="#" onclick="return showOptional(this,'#content_img');" class="optional_field">+ Add Image</a>
  132. <? } ?>
  133. <? if (!$doc->saved() || !$doc->link) {?>
  134. <a href="#" onclick="return showOptional(this,'#content_link');" class="optional_field">+ Add Link</a>
  135. <? } ?>
  136. <? if (!$doc->saved() || $doc->tags()->count()==0) {?>
  137. <a href="#" onclick="return showOptional(this,'#content_tags');" class="optional_field">+ Add Tags</a>
  138. <? } ?>
  139. <h2>Additional Information</h2>
  140. <? $meta = $doc->getMeta();
  141. if ($meta) {
  142. foreach ($meta as $field=>$value) { ?>
  143. <p class="input">
  144. <label for="meta_<? echo $field; ?>"><? echo $field; ?>:</label>
  145. <? if (strlen($value) > 50) { ?>
  146. <textarea class="text" name="meta_<? echo $field; ?>"><? echo htmlspecialchars($value); ?></textarea>
  147. <? } else { ?>
  148. <input class="text" type="text" name="meta_<? echo $field; ?>" id="meta_<? echo $field; ?>" value="<? echo htmlspecialchars($value); ?>"/>
  149. <? } ?>
  150. </p>
  151. <? }
  152. } ?>
  153. <div id="new_meta_fields">
  154. </div>
  155. <div id="new_meta" style="display:none;">
  156. <label for="new_meta_name">Name the new field:</label>
  157. <input id="new_meta_name" type="text" class="text meta_lookup" /><input type="submit" onclick="return addMetaField();" value="Add to Form">
  158. </div>
  159. <a href="#" onclick="return showOptional(this,'#new_meta');" class="optional_field" id="add_field_link">+ Add Field</a>
  160. </div>
  161. </form>
  162. <? if ($doc->saved()) {?>
  163. <!-- BEGIN COMMENTS -->
  164. <div id="comments_panel" class="panel panel_with_options">
  165. <h1><a name="comments"></a>Comments</h1>
  166. <? $doc->comments()->output('comment','header','footer',null,'This content has no comments.'); ?>
  167. </div>
  168. <!-- END COMMENTS -->
  169. <!-- BEGIN CHILD POSTS -->
  170. <div id="child_documents_panel" class="panel panel_with_options">
  171. <h1><a name="children"></a>Subordinate Content</h1>
  172. <form id="addChild" onsubmit="return addChildSearch();" class="new_item">
  173. <label for="addChild_q">Add Child</label>
  174. <input name="q" class="text" id="addChild_q" />
  175. <input type="button" onclick="return addChildSearch();" value="Find"/>
  176. </form>
  177. <div id="addChildResults"></div>
  178. <div id="child_documents">
  179. <? if ($doc->children()->exists()) {
  180. while ($child = $doc->children()->getNext()) {
  181. $child->output('child');
  182. }
  183. } else { ?>
  184. <p class="column_padding">This post has no child posts.</p>
  185. <? } ?>
  186. </div>
  187. </div>
  188. <!-- END CHILD POSTS -->
  189. <? } ?>
  190. </div>