ManageAttachments.template.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. <div class="content">
  42. <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> |
  43. <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> |
  44. <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>
  45. </div>
  46. </div>
  47. </div>';
  48. template_show_list('file_list');
  49. echo '
  50. <br class="clear" />';
  51. }
  52. function template_maintenance()
  53. {
  54. global $context, $settings, $options, $scripturl, $txt;
  55. echo '
  56. <div id="manage_attachments">
  57. <div class="cat_bar">
  58. <h3 class="catbg">', $txt['attachment_stats'], '</h3>
  59. </div>
  60. <div class="windowbg">
  61. <div class="content">
  62. <dl class="settings">
  63. <dt><strong>', $txt['attachment_total'], ':</strong></dt><dd>', $context['num_attachments'], '</dd>
  64. <dt><strong>', $txt['attachment_manager_total_avatars'], ':</strong></dt><dd>', $context['num_avatars'], '</dd>
  65. <dt><strong>', $txt['attachmentdir_size' . ($context['attach_multiple_dirs'] ? '_current' : '')], ':</strong></dt><dd>', $context['attachment_total_size'], ' ', $txt['kilobyte'], '</dd>
  66. <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>
  67. </dl>
  68. </div>
  69. </div>
  70. <br class="clear" />
  71. <div class="cat_bar">
  72. <h3 class="catbg">', $txt['attachment_integrity_check'], '</h3>
  73. </div>
  74. <div class="windowbg">
  75. <div class="content">
  76. <form action="', $scripturl, '?action=admin;area=manageattachments;sa=repair;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
  77. <p>', $txt['attachment_integrity_check_desc'], '</p>
  78. <hr class="hrcolor" />
  79. <input type="submit" name="repair" value="', $txt['attachment_check_now'], '" class="button_submit" />
  80. <br class="clear_right" />
  81. </form>
  82. </div>
  83. </div>
  84. <br class="clear" />
  85. <div class="cat_bar">
  86. <h3 class="catbg">', $txt['attachment_pruning'], '</h3>
  87. </div>
  88. <div class="windowbg">
  89. <div class="content">
  90. <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;">
  91. ', $txt['attachment_remove_old'], ' <input type="text" name="age" value="25" size="4" class="input_text" /> ', $txt['days_word'], '<br />
  92. ', $txt['attachment_pruning_message'], ': <input type="text" name="notice" value="', $txt['attachment_delete_admin'], '" size="40" class="input_text" /><br />
  93. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  94. <input type="hidden" name="type" value="attachments" />
  95. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  96. <input type="hidden" name="sa" value="byAge" />
  97. <br class="clear_right" />
  98. </form>
  99. <hr />
  100. <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;">
  101. ', $txt['attachment_remove_size'], ' <input type="text" name="size" id="size" value="100" size="4" class="input_text" /> ', $txt['kilobyte'], '<br />
  102. ', $txt['attachment_pruning_message'], ': <input type="text" name="notice" value="', $txt['attachment_delete_admin'], '" size="40" class="input_text" /><br />
  103. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  104. <input type="hidden" name="type" value="attachments" />
  105. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  106. <input type="hidden" name="sa" value="bySize" />
  107. <br class="clear_right" />
  108. </form>
  109. <hr />
  110. <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;">
  111. ', $txt['attachment_manager_avatars_older'], ' <input type="text" name="age" value="45" size="4" class="input_text" /> ', $txt['days_word'], '<br />
  112. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  113. <input type="hidden" name="type" value="avatars" />
  114. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  115. <input type="hidden" name="sa" value="byAge" />
  116. <br class="clear_right" />
  117. </form>
  118. </div>
  119. </div>
  120. </div>
  121. <br class="clear" />';
  122. }
  123. function template_attachment_repair()
  124. {
  125. global $context, $txt, $scripturl, $settings;
  126. // If we've completed just let them know!
  127. if ($context['completed'])
  128. {
  129. echo '
  130. <div id="manage_attachments">
  131. <div class="cat_bar">
  132. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  133. </div>
  134. <div class="windowbg">
  135. <div class="content">
  136. ', $txt['repair_attachments_complete_desc'], '
  137. </div>
  138. </div>
  139. </div>
  140. <br class="clear" />';
  141. }
  142. // What about if no errors were even found?
  143. elseif (!$context['errors_found'])
  144. {
  145. echo '
  146. <div id="manage_attachments">
  147. <div class="cat_bar">
  148. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  149. </div>
  150. <div class="windowbg">
  151. <div class="content">
  152. ', $txt['repair_attachments_no_errors'], '
  153. </div>
  154. </div>
  155. </div>
  156. <br class="clear" />';
  157. }
  158. // Otherwise, I'm sad to say, we have a problem!
  159. else
  160. {
  161. echo '
  162. <div id="manage_attachments">
  163. <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'], '">
  164. <div class="cat_bar">
  165. <h3 class="catbg">', $txt['repair_attachments'], '</h3>
  166. </div>
  167. <div class="windowbg">
  168. <div class="content">
  169. <p>', $txt['repair_attachments_error_desc'], '</p>';
  170. // Loop through each error reporting the status
  171. foreach ($context['repair_errors'] as $error => $number)
  172. {
  173. if (!empty($number))
  174. echo '
  175. <input type="checkbox" name="to_fix[]" id="', $error, '" value="', $error, '" class="input_check" />
  176. <label for="', $error, '">', sprintf($txt['attach_repair_' . $error], $number), '</label><br />';
  177. }
  178. echo ' <br />
  179. <input type="submit" value="', $txt['repair_attachments_continue'], '" class="button_submit" />
  180. <input type="submit" name="cancel" value="', $txt['repair_attachments_cancel'], '" class="button_submit" />
  181. </div>
  182. </div>
  183. </form>
  184. </div>
  185. <br class="clear" />';
  186. }
  187. }
  188. function template_attachment_paths()
  189. {
  190. template_show_list('attach_paths');
  191. }
  192. ?>