ManageAttachments.template.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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.gif" 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.gif" 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.gif" 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. <input type="submit" name="submit" value="', $txt['attachment_check_now'], '" class="button_submit" />
  83. </form>
  84. </div>
  85. <span class="botslice"><span></span></span>
  86. </div>
  87. <div class="cat_bar">
  88. <h3 class="catbg">', $txt['attachment_pruning'], '</h3>
  89. </div>
  90. <div class="windowbg">
  91. <span class="topslice"><span></span></span>
  92. <div class="content">
  93. <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;">
  94. ', $txt['attachment_remove_old'], ' <input type="text" name="age" value="25" size="4" class="input_text" /> ', $txt['days_word'], '<br />
  95. ', $txt['attachment_pruning_message'], ': <input type="text" name="notice" value="', $txt['attachment_delete_admin'], '" size="40" class="input_text" /><br />
  96. <input type="submit" name="submit" value="', $txt['remove'], '" class="button_submit" />
  97. <input type="hidden" name="type" value="attachments" />
  98. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  99. <input type="hidden" name="sa" value="byAge" />
  100. </form>
  101. <hr />
  102. <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;">
  103. ', $txt['attachment_remove_size'], ' <input type="text" name="size" id="size" value="100" size="4" class="input_text" /> ', $txt['kilobyte'], '<br />
  104. ', $txt['attachment_pruning_message'], ': <input type="text" name="notice" value="', $txt['attachment_delete_admin'], '" size="40" class="input_text" /><br />
  105. <input type="submit" name="submit" value="', $txt['remove'], '" class="button_submit" />
  106. <input type="hidden" name="type" value="attachments" />
  107. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  108. <input type="hidden" name="sa" value="bySize" />
  109. </form>
  110. <hr />
  111. <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;">
  112. ', $txt['attachment_manager_avatars_older'], ' <input type="text" name="age" value="45" size="4" class="input_text" /> ', $txt['days_word'], '<br />
  113. <input type="submit" name="submit" value="', $txt['remove'], '" class="button_submit" />
  114. <input type="hidden" name="type" value="avatars" />
  115. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  116. <input type="hidden" name="sa" value="byAge" />
  117. </form>
  118. </div>
  119. <span class="botslice"><span></span></span>
  120. </div>
  121. </div>
  122. <br class="clear" />';
  123. }
  124. function template_attachment_repair()
  125. {
  126. global $context, $txt, $scripturl, $settings;
  127. // If we've completed just let them know!
  128. if ($context['completed'])
  129. {
  130. echo '
  131. <div id="manage_attachments">
  132. <div class="cat_bar">
  133. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  134. </div>
  135. <div class="windowbg">
  136. <span class="topslice"><span></span></span>
  137. <div class="content">
  138. ', $txt['repair_attachments_complete_desc'], '
  139. </div>
  140. <span class="botslice"><span></span></span>
  141. </div>
  142. </div>
  143. <br class="clear" />';
  144. }
  145. // What about if no errors were even found?
  146. elseif (!$context['errors_found'])
  147. {
  148. echo '
  149. <div id="manage_attachments">
  150. <div class="cat_bar">
  151. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  152. </div>
  153. <div class="windowbg">
  154. <span class="topslice"><span></span></span>
  155. <div class="content">
  156. ', $txt['repair_attachments_no_errors'], '
  157. </div>
  158. <span class="botslice"><span></span></span>
  159. </div>
  160. </div>
  161. <br class="clear" />';
  162. }
  163. // Otherwise, I'm sad to say, we have a problem!
  164. else
  165. {
  166. echo '
  167. <div id="manage_attachments">
  168. <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'], '">
  169. <div class="cat_bar">
  170. <h3 class="catbg">', $txt['repair_attachments'], '</h3>
  171. </div>
  172. <div class="windowbg">
  173. <span class="topslice"><span></span></span>
  174. <div class="content">
  175. <p>', $txt['repair_attachments_error_desc'], '</p>';
  176. // Loop through each error reporting the status
  177. foreach ($context['repair_errors'] as $error => $number)
  178. {
  179. if (!empty($number))
  180. echo '
  181. <input type="checkbox" name="to_fix[]" id="', $error, '" value="', $error, '" class="input_check" />
  182. <label for="', $error, '">', sprintf($txt['attach_repair_' . $error], $number), '</label><br />';
  183. }
  184. echo ' <br />
  185. <input type="submit" value="', $txt['repair_attachments_continue'], '" class="button_submit" />
  186. <input type="submit" name="cancel" value="', $txt['repair_attachments_cancel'], '" class="button_submit" />
  187. </div>
  188. <span class="botslice"><span></span></span>
  189. </div>
  190. </form>
  191. </div>
  192. <br class="clear" />';
  193. }
  194. }
  195. function template_attachment_paths()
  196. {
  197. template_show_list('attach_paths');
  198. }
  199. ?>