2
0

ManageAttachments.template.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. // Template template wraps around the simple settings page to add javascript functionality.
  13. function template_avatar_settings_above()
  14. {
  15. }
  16. function template_avatar_settings_below()
  17. {
  18. echo '
  19. <script type="text/javascript"><!-- // --><![CDATA[
  20. var fUpdateStatus = function ()
  21. {
  22. document.getElementById("avatar_max_width_external").disabled = document.getElementById("avatar_download_external").checked;
  23. document.getElementById("avatar_max_height_external").disabled = document.getElementById("avatar_download_external").checked;
  24. document.getElementById("avatar_action_too_large").disabled = document.getElementById("avatar_download_external").checked;
  25. document.getElementById("custom_avatar_dir").disabled = document.getElementById("custom_avatar_enabled").value == 0;
  26. document.getElementById("custom_avatar_url").disabled = document.getElementById("custom_avatar_enabled").value == 0;
  27. }
  28. addLoadEvent(fUpdateStatus);
  29. // ]]></script>
  30. ';
  31. }
  32. function template_browse()
  33. {
  34. global $context, $settings, $options, $scripturl, $txt;
  35. echo '
  36. <div id="manage_attachments">
  37. <div class="cat_bar">
  38. <h3 class="catbg">', $txt['attachment_manager_browse_files'], '</h3>
  39. </div>
  40. <div class="windowbg2">
  41. <span class="topslice"><span></span></span>
  42. <div class="content">
  43. <a href="', $scripturl, '?action=admin;area=manageattachments;sa=browse">', $context['browse_type'] === 'attachments' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="&gt;" /> ' : '', $txt['attachment_manager_attachments'], '</a> |
  44. <a href="', $scripturl, '?action=admin;area=manageattachments;sa=browse;avatars">', $context['browse_type'] === 'avatars' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="&gt;" /> ' : '', $txt['attachment_manager_avatars'], '</a> |
  45. <a href="', $scripturl, '?action=admin;area=manageattachments;sa=browse;thumbs">', $context['browse_type'] === 'thumbs' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="&gt;" /> ' : '', $txt['attachment_manager_thumbs'], '</a>
  46. </div>
  47. <span class="botslice"><span></span></span>
  48. </div>
  49. </div>';
  50. template_show_list('file_list');
  51. echo '
  52. <br class="clear" />';
  53. }
  54. function template_maintenance()
  55. {
  56. global $context, $settings, $options, $scripturl, $txt;
  57. echo '
  58. <div id="manage_attachments">
  59. <div class="cat_bar">
  60. <h3 class="catbg">', $txt['attachment_stats'], '</h3>
  61. </div>
  62. <div class="windowbg">
  63. <span class="topslice"><span></span></span>
  64. <div class="content">
  65. <dl class="settings">
  66. <dt><strong>', $txt['attachment_total'], ':</strong></dt><dd>', $context['num_attachments'], '</dd>
  67. <dt><strong>', $txt['attachment_manager_total_avatars'], ':</strong></dt><dd>', $context['num_avatars'], '</dd>
  68. <dt><strong>', $txt['attachmentdir_size' . ($context['attach_multiple_dirs'] ? '_current' : '')], ':</strong></dt><dd>', $context['attachment_total_size'], ' ', $txt['kilobyte'], '</dd>
  69. <dt><strong>', $txt['attachment_space' . ($context['attach_multiple_dirs'] ? '_current' : '')], ':</strong></dt><dd>', isset($context['attachment_space']) ? $context['attachment_space'] . ' ' . $txt['kilobyte'] : $txt['attachmentdir_size_not_set'], '</dd>
  70. </dl>
  71. </div>
  72. <span class="botslice"><span></span></span>
  73. </div>
  74. <div class="cat_bar">
  75. <h3 class="catbg">', $txt['attachment_integrity_check'], '</h3>
  76. </div>
  77. <div class="windowbg">
  78. <span class="topslice"><span></span></span>
  79. <div class="content">
  80. <form action="', $scripturl, '?action=admin;area=manageattachments;sa=repair;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
  81. <p>', $txt['attachment_integrity_check_desc'], '</p>
  82. <hr class="hrcolor" />
  83. <input type="submit" name="repair" value="', $txt['attachment_check_now'], '" class="button_submit" />
  84. <br class="clear_right" />
  85. </form>
  86. </div>
  87. <span class="botslice"><span></span></span>
  88. </div>
  89. <div class="cat_bar">
  90. <h3 class="catbg">', $txt['attachment_pruning'], '</h3>
  91. </div>
  92. <div class="windowbg">
  93. <span class="topslice"><span></span></span>
  94. <div class="content">
  95. <form action="', $scripturl, '?action=admin;area=manageattachments" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['attachment_pruning_warning'], '\');" style="margin: 0 0 2ex 0;">
  96. ', $txt['attachment_remove_old'], ' <input type="text" name="age" value="25" size="4" class="input_text" /> ', $txt['days_word'], '<br />
  97. ', $txt['attachment_pruning_message'], ': <input type="text" name="notice" value="', $txt['attachment_delete_admin'], '" size="40" class="input_text" /><br />
  98. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  99. <input type="hidden" name="type" value="attachments" />
  100. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  101. <input type="hidden" name="sa" value="byAge" />
  102. <br class="clear_right" />
  103. </form>
  104. <hr />
  105. <form action="', $scripturl, '?action=admin;area=manageattachments" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['attachment_pruning_warning'], '\');" style="margin: 0 0 2ex 0;">
  106. ', $txt['attachment_remove_size'], ' <input type="text" name="size" id="size" value="100" size="4" class="input_text" /> ', $txt['kilobyte'], '<br />
  107. ', $txt['attachment_pruning_message'], ': <input type="text" name="notice" value="', $txt['attachment_delete_admin'], '" size="40" class="input_text" /><br />
  108. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  109. <input type="hidden" name="type" value="attachments" />
  110. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  111. <input type="hidden" name="sa" value="bySize" />
  112. <br class="clear_right" />
  113. </form>
  114. <hr />
  115. <form action="', $scripturl, '?action=admin;area=manageattachments" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['attachment_pruning_warning'], '\');" style="margin: 0 0 2ex 0;">
  116. ', $txt['attachment_manager_avatars_older'], ' <input type="text" name="age" value="45" size="4" class="input_text" /> ', $txt['days_word'], '<br />
  117. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  118. <input type="hidden" name="type" value="avatars" />
  119. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  120. <input type="hidden" name="sa" value="byAge" />
  121. <br class="clear_right" />
  122. </form>
  123. </div>
  124. <span class="botslice"><span></span></span>
  125. </div>
  126. </div>
  127. <br class="clear" />';
  128. }
  129. function template_attachment_repair()
  130. {
  131. global $context, $txt, $scripturl, $settings;
  132. // If we've completed just let them know!
  133. if ($context['completed'])
  134. {
  135. echo '
  136. <div id="manage_attachments">
  137. <div class="cat_bar">
  138. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  139. </div>
  140. <div class="windowbg">
  141. <span class="topslice"><span></span></span>
  142. <div class="content">
  143. ', $txt['repair_attachments_complete_desc'], '
  144. </div>
  145. <span class="botslice"><span></span></span>
  146. </div>
  147. </div>
  148. <br class="clear" />';
  149. }
  150. // What about if no errors were even found?
  151. elseif (!$context['errors_found'])
  152. {
  153. echo '
  154. <div id="manage_attachments">
  155. <div class="cat_bar">
  156. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  157. </div>
  158. <div class="windowbg">
  159. <span class="topslice"><span></span></span>
  160. <div class="content">
  161. ', $txt['repair_attachments_no_errors'], '
  162. </div>
  163. <span class="botslice"><span></span></span>
  164. </div>
  165. </div>
  166. <br class="clear" />';
  167. }
  168. // Otherwise, I'm sad to say, we have a problem!
  169. else
  170. {
  171. echo '
  172. <div id="manage_attachments">
  173. <form action="', $scripturl, '?action=admin;area=manageattachments;sa=repair;fixErrors=1;step=0;substep=0;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
  174. <div class="cat_bar">
  175. <h3 class="catbg">', $txt['repair_attachments'], '</h3>
  176. </div>
  177. <div class="windowbg">
  178. <span class="topslice"><span></span></span>
  179. <div class="content">
  180. <p>', $txt['repair_attachments_error_desc'], '</p>';
  181. // Loop through each error reporting the status
  182. foreach ($context['repair_errors'] as $error => $number)
  183. {
  184. if (!empty($number))
  185. echo '
  186. <input type="checkbox" name="to_fix[]" id="', $error, '" value="', $error, '" class="input_check" />
  187. <label for="', $error, '">', sprintf($txt['attach_repair_' . $error], $number), '</label><br />';
  188. }
  189. echo ' <br />
  190. <input type="submit" value="', $txt['repair_attachments_continue'], '" class="button_submit" />
  191. <input type="submit" name="cancel" value="', $txt['repair_attachments_cancel'], '" class="button_submit" />
  192. </div>
  193. <span class="botslice"><span></span></span>
  194. </div>
  195. </form>
  196. </div>
  197. <br class="clear" />';
  198. }
  199. }
  200. function template_attachment_paths()
  201. {
  202. template_show_list('attach_paths');
  203. }
  204. ?>