ManageAttachments.template.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2012 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. }
  50. function template_maintenance()
  51. {
  52. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  53. echo '
  54. <div id="manage_attachments">
  55. <div class="cat_bar">
  56. <h3 class="catbg">', $txt['attachment_stats'], '</h3>
  57. </div>
  58. <div class="windowbg">
  59. <div class="content">
  60. <dl class="settings">
  61. <dt><strong>', $txt['attachment_total'], ':</strong></dt><dd>', $context['num_attachments'], '</dd>
  62. <dt><strong>', $txt['attachment_manager_total_avatars'], ':</strong></dt><dd>', $context['num_avatars'], '</dd>
  63. <dt><strong>', $txt['attachmentdir_size'], ':</strong></dt><dd>', $context['attachment_total_size'], ' ', $txt['kilobyte'], '</dd>
  64. <dt><strong>', $txt['attach_current_dir'], ':</strong></dt><dd>', $modSettings['attachmentUploadDir'][$modSettings['currentAttachmentUploadDir']], '</dd>
  65. <dt><strong>', $txt['attachmentdir_size_current'], ':</strong></dt><dd>', $context['attachment_current_size'], ' ', $txt['kilobyte'], '</dd>
  66. <dt><strong>', $txt['attachment_space'], ':</strong></dt><dd>', isset($context['attachment_space']) ? $context['attachment_space'] . ' ' . $txt['kilobyte'] : $txt['attachmentdir_size_not_set'], '</dd>
  67. <dt><strong>', $txt['attachmentdir_files_current'], ':</strong></dt><dd>', $context['attachment_current_files'], '</dd>
  68. <dt><strong>', $txt['attachment_files'], ':</strong></dt><dd>', isset($context['attachment_files']) ? $context['attachment_files'] : $txt['attachmentdir_files_not_set'], '</dd>
  69. </dl>
  70. </div>
  71. </div>
  72. <div class="cat_bar">
  73. <h3 class="catbg">', $txt['attachment_integrity_check'], '</h3>
  74. </div>
  75. <div class="windowbg">
  76. <div class="content">
  77. <form action="', $scripturl, '?action=admin;area=manageattachments;sa=repair;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
  78. <p>', $txt['attachment_integrity_check_desc'], '</p>
  79. <hr class="hrcolor" />
  80. <input type="submit" name="repair" value="', $txt['attachment_check_now'], '" class="button_submit" />
  81. <br class="clear_right" />
  82. </form>
  83. </div>
  84. </div>
  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. </form>
  117. </div>
  118. </div>
  119. </div>';
  120. echo '
  121. <div id="transfer" class="cat_bar">
  122. <h3 class="catbg">', $txt['attachment_transfer'], '</h3>
  123. </div>';
  124. if (!empty($context['results']))
  125. echo '
  126. <div class="noticebox">', $context['results'], '</div>';
  127. echo '
  128. <div class="windowbg">
  129. <div class="content">
  130. <form action="', $scripturl, '?action=admin;area=manageattachments;sa=transfer" method="post" accept-charset="', $context['character_set'], '">
  131. <p>', $txt['attachment_transfer_desc'], '</p>
  132. <hr class="hrcolor" />
  133. <dl class="settings">
  134. <dt>', $txt['attachment_transfer_from'], '</dt>
  135. <dd><select name="from">
  136. <option value="0">', $txt['attachment_transfer_select'], '</option>';
  137. foreach ($context['attach_dirs'] as $id => $dir)
  138. echo '
  139. <option value="', $id, '">', $dir, '</option>';
  140. echo '
  141. </select></dd>
  142. <dt>', $txt['attachment_transfer_auto'], '</dt>
  143. <dd><select name="auto">
  144. <option value="0">', $txt['attachment_transfer_auto_select'], '</option>
  145. <option value="-1">', $txt['attachment_transfer_forum_root'], '</option>';
  146. if (!empty($context['base_dirs']))
  147. foreach ($context['base_dirs'] as $id => $dir)
  148. echo '
  149. <option value="', $id, '">', $dir, '</option>';
  150. else
  151. echo '
  152. <option value="0" disabled="disabled">', $txt['attachment_transfer_no_base'], '</option>';
  153. echo '
  154. </select></dd>
  155. <dt>', $txt['attachment_transfer_to'], '</dt>
  156. <dd><select name="to">
  157. <option value="0">', $txt['attachment_transfer_select'], '</option>';
  158. foreach($context['attach_dirs'] as $id => $dir)
  159. echo '
  160. <option value="', $id, '">', $dir, '</option>';
  161. echo '
  162. </select></dd>';
  163. if (!empty($modSettings['attachmentDirFileLimit']))
  164. echo '
  165. <dt>', $txt['attachment_transfer_empty'], '</dt>
  166. <dd><input type="checkbox" name="empty_it"', $context['checked'] ? ' checked="checked"' : '', ' /></dd>';
  167. echo '
  168. </dl>
  169. <hr class="hrcolor"/>
  170. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  171. <input type="submit" onclick="start_progress()" name="transfer" value="', $txt['attachment_transfer_now'], '" class="button_submit" />
  172. <div id="progress_msg"></div>
  173. <div id="show_progress" class="padding"></div>
  174. <br class="clear_right" />
  175. </form>
  176. <script type="text/javascript"><!-- // --><![CDATA[
  177. function start_progress() {
  178. setTimeout(\'show_msg()\', 1000);
  179. }
  180. function show_msg() {
  181. $(\'#progress_msg\').html(\'<div><img src="', $settings['actual_images_url'], '/loading.gif" alt="loading.gif" width="35" height="35" />&nbsp; ', $txt['attachment_transfer_progress'] , '<\/div>\');
  182. show_progress();
  183. }
  184. function show_progress() {
  185. $(\'#show_progress\').load("progress.php");
  186. setTimeout(\'show_progress()\', 1500);
  187. }
  188. // ]]></script>
  189. </div>
  190. </div>
  191. <br class="clear" />';
  192. }
  193. function template_attachment_repair()
  194. {
  195. global $context, $txt, $scripturl, $settings;
  196. // If we've completed just let them know!
  197. if ($context['completed'])
  198. {
  199. echo '
  200. <div id="manage_attachments">
  201. <div class="cat_bar">
  202. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  203. </div>
  204. <div class="windowbg">
  205. <div class="content">
  206. ', $txt['repair_attachments_complete_desc'], '
  207. </div>
  208. </div>
  209. </div>
  210. <br class="clear" />';
  211. }
  212. // What about if no errors were even found?
  213. elseif (!$context['errors_found'])
  214. {
  215. echo '
  216. <div id="manage_attachments">
  217. <div class="cat_bar">
  218. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  219. </div>
  220. <div class="windowbg">
  221. <div class="content">
  222. ', $txt['repair_attachments_no_errors'], '
  223. </div>
  224. </div>
  225. </div>
  226. <br class="clear" />';
  227. }
  228. // Otherwise, I'm sad to say, we have a problem!
  229. else
  230. {
  231. echo '
  232. <div id="manage_attachments">
  233. <form id="admin_form_wrapper" 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'], '">
  234. <div class="cat_bar">
  235. <h3 class="catbg">', $txt['repair_attachments'], '</h3>
  236. </div>
  237. <div class="windowbg">
  238. <div class="content">
  239. <p>', $txt['repair_attachments_error_desc'], '</p>';
  240. // Loop through each error reporting the status
  241. foreach ($context['repair_errors'] as $error => $number)
  242. {
  243. if (!empty($number))
  244. echo '
  245. <input type="checkbox" name="to_fix[]" id="', $error, '" value="', $error, '" class="input_check" />
  246. <label for="', $error, '">', sprintf($txt['attach_repair_' . $error], $number), '</label><br />';
  247. }
  248. echo ' <br />
  249. <input type="submit" value="', $txt['repair_attachments_continue'], '" class="button_submit" />
  250. <input type="submit" name="cancel" value="', $txt['repair_attachments_cancel'], '" class="button_submit" />
  251. </div>
  252. </div>
  253. </form>
  254. </div>
  255. <br class="clear" />';
  256. }
  257. }
  258. function template_attachment_paths()
  259. {
  260. global $modSettings;
  261. if (!empty($modSettings['attachment_basedirectories']))
  262. {
  263. template_show_list('base_paths');
  264. }
  265. template_show_list('attach_paths');
  266. }
  267. ?>