Admin Notes 2.x

Started by Apllicmz, January 20, 2011, 02:57:41 PM

Previous topic - Next topic

Apllicmz

Mod Name:  Admin Notes
Created By:  Robbo_
Link :http://custom.simplemachines.org/mods/index.php?mod=1810
Compatível com: 2.0 RC1,, 2.0 RC3,, 2.0 RC4
Translate and Manual Setup : Candidosa2

./Sources/Admin.php

// Load the credits stuff.
    require_once($sourcedir . '/Who.php');
    Credits(true);


// START ADMIN NOTES EDIT
    // Get the admin notes ready
    require_once($sourcedir . '/AdminNotes.php');
    adminNotes();
    // END ADMIN NOTES EDIT


/Themes/default/languages/Modifications.teuidioma.php

?>

// Admin Notes translate by candidosa2
$txt['admin_notes'] = 'Notas do admin';
$txt['admin_notes_help'] = 'Isto foi projetado para uma maneira r&aacute;pida e simples para os administradores para se comunicarem entre si.<br /><br /><b>Activar BBCode:</b> b, i, url, br, u, color, font, me, s';
$txt['admin_notes_confirm'] = 'Tem certeza que quer apagar esta nota?';
$txt['admin_notes_delete'] = 'Apagar a Nota';
$txt['admin_notes_add'] = 'Adicionar Nota...';
$txt['admin_notes_none'] = 'N&atilde;o existem notas para serem mostradas';


./Themes/default/Admin.template.php

?>

// This template will show the admin notes with a form at the bottom to add new notes
function template_adminNotes()
{
    global $context, $scripturl, $settings, $txt;
   
    echo '
             <table width="100%" cellspacing="1" cellpadding="5" class="bordercolor" id="admin_notes_table">
                <tr><td class="catbg"><a href="', $scripturl, '?action=helpadmin;help=admin_notes_help" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> ', $txt['admin_notes'], '</td></tr>
                <tr><td class="windowbg2">
                    <div style="overflow: auto; height: 183px;">';
         
    if(!empty($context['admin_notes']))
    {
       $row = 2;
       foreach($context['admin_notes'] as $note)
       {
          echo '
                       <div class="windowbg', $row, ' smalltext" style="padding-top: 5px; padding-bottom: 5px; border-bottom: 1px dashed #CCCCCC">
                          <a href="', $note['delete_href'], '" title="', $txt['admin_notes_delete'], '" onclick="return confirm('', $txt['admin_notes_confirm'], '')"><img src="', $settings['images_url'], '/pm_recipient_delete.gif" alt="X" /></a>
                          ', $note['poster']['link'], ': ', $note['note'], '
                       </div>';
          $row = $row == 2 ? '' : 2;
       }
    }
    else
       echo '
                       <span class="smalltext"><b>', $txt['admin_notes_none'], '</b></span>';

    echo'
                    </div>
                </td></tr>
                <tr class="windowbg3">
                    <td align="center">
                       <form action="', $scripturl, '?action=admin" method="post" id="note_form">
                       <textarea cols="40" rows="2" id="admin_notes_textarea" name="admin_note"></textarea>
                       <div style="margin: 0; padding: 0;">
                          <span style="margin-top: 5px; margin-right: 4px; float: right;"><input type="submit" value="', $txt['post'], '" name="add_note" /></span>
                          <span class="smalltext" style="float: left; margin-top: 8px; margin-left: 7px;">', $txt['pages'], ': ', $context['paginator'], '</span>
                          <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
                       </div>
                    </form>
                </td></tr>
             </table>
             <script language="JavaScript" type="text/javascript"><!-- // --><!', '[CDATA[
               
                var add_note_txt = "', $txt['admin_notes_add'], '";
             
                // Make textarea bigger if needed
                function setupAdminNotesTextarea()
                {
                    // Used later
                    window["alt_down"] = false;
               
                    var textarea = document.getElementById("admin_notes_textarea");
                   
                    createEventListener(textarea);
                   
                    // Pre-fill text
                    textarea.value = add_note_txt;
                   
                    // Event to remove pre filled text on focus
                    textarea.addEventListener("focus", function(event){
                       var target;
                       
                       if (!event)
                          event = window.event;
       
                       if (event.target)
                          target = event.target;
                       else if (e.srcElement)
                          target = e.srcElement;
                       else
                          target = null;
                       
                       if (target.nodeType == 3)
                          target = target.parentNode;
                         
                       if (target)
                          if (target.value == add_note_txt)
                             target.value = "";
                    }, false);
                   
                    // Event to add pre filled text on blur when tehre is nothing entered
                    textarea.addEventListener("blur", function(event){
                       var target;
                       
                       if (!event)
                          event = window.event;
                       
                       if (event.target)
                          target = event.target;
                       else if (e.srcElement)
                          target = e.srcElement;
                       else
                          target = null;
                       
                       if (target.nodeType == 3)
                          target = target.parentNode;
                         
                       if (target)
                          if (target.value == "")
                             target.value = add_note_txt;
                    }, false);
                   
                    // Make textarea a bit smaller then the table it is in
                    var newWidth = document.getElementById("admin_notes_table").offsetWidth - 50;
                    if (newWidth > textarea.offsetWidth)
                       textarea.style.width = newWidth   "px";
                }
               
                window.onload = setupAdminNotesTextarea;
       
             //]]', '></script>';
}



// Display the "live news" from simplemachines.org.
    echo '
          <td valign="top">
             <table width="100%" cellpadding="5" cellspacing="1" border="0" class="bordercolor">
                <tr>
                    <td class="catbg">
                       <a href="', $scripturl, '?action=helpadmin;help=live_news" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> ', $txt['live'], '
                    </td>
                </tr><tr>
                    <td class="windowbg2" valign="top" style="height: 18ex; padding: 0;">
                       <div id="smfAnnouncements" style="height: 18ex; overflow: auto; padding-right: 1ex;"><div style="margin: 4px; font-size: 0.85em;">', $txt['lfyi'], '</div></div>
                    </td>
                </tr>
             </table>
          </td>
          <td style="width: 1ex;">&nbsp;</td>';




// Display the "live news" from simplemachines.org.
    echo '
          <td valign="top">
             <table width="100%" cellpadding="5" cellspacing="1" border="0" class="bordercolor">
                <tr>
                    <td class="catbg">
                       <a href="', $scripturl, '?action=helpadmin;help=live_news" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> ', $txt['live'], '
                    </td>
                </tr><tr>
                    <td class="windowbg2" valign="top" style="height: 18ex; padding: 0;">
                       <div id="smfAnnouncements" style="height: 18ex; overflow: auto; padding-right: 1ex;"><div style="margin: 4px; font-size: 0.85em;">', $txt['lfyi'], '</div></div>
                    </td>
                </tr>
             </table>';




// Show the user version information from their server.
    echo '
          <td valign="top" style="width: 40%;">
             <table width="100%" cellpadding="5" cellspacing="1" border="0" class="bordercolor" id="supportVersionsTable">
                <tr>
                    <td class="catbg"><a href="', $scripturl, '?action=admin;area=credits">', $txt['support_title'], '</a></td>
                </tr><tr>
                    <td class="windowbg2" valign="top" style="height: 18ex;">
                       <b>', $txt['support_versions'], ':</b><br />
                       ', $txt['support_versions_forum'], ':
                       <i id="yourVersion" style="white-space: nowrap;">', $context['forum_version'], '</i><br />
                       ', $txt['support_versions_current'], ':
                       <i id="smfVersion" style="white-space: nowrap;">??</i><br />
                       ', $context['can_admin'] ? '<a href="' . $scripturl . '?action=admin;area=maintain;sa=version">' . $txt['version_check_more'] . '</a>' : '', '<br />';



// Show the user version information from their server.
    echo '
             <table width="100%" style="margin-top: 0.5em;" cellpadding="5" cellspacing="1" border="0" class="bordercolor" id="supportVersionsTable">
                <tr>
                    <td class="catbg"><a href="', $scripturl, '?action=admin;area=credits">', $txt['support_title'], '</a></td>
                </tr><tr>
                    <td class="windowbg2" valign="top" style="height: 18ex;">
                       <b>', $txt['support_versions'], ':</b><br />
                       ', $txt['support_versions_forum'], ':
                       <i id="yourVersion" style="white-space: nowrap;">', $context['forum_version'], '</i><br />
                       ', $txt['support_versions_current'], ':
                       <i id="smfVersion" style="white-space: nowrap;">??</i><br />
                       ', $context['can_admin'] ? '<a href="' . $scripturl . '?action=admin;area=maintain;sa=version">' . $txt['version_check_more'] . '</a>' : '', '<br />';


echo '
                    </td>
                </tr>
             </table>
          </td>
       </tr></table>';




echo '
                    </td>
                </tr>
             </table>
          </td>
          <td style="width: 1ex;">&nbsp;</td>
          <td valign="top" style="width: 40%;">', template_adminNotes(), '</td>
       </tr></table>';



Colocar o ficheiro em anexo na pasta Sources.

Duvidas sobre assunto colocar aqui...



Advertisement: