annotate forum/Themes/Vamp/ManageAttachments.template.php @ 76:e3e11437ecea website

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