user_menu.rhtml 3.54 KB
<div id="user_menu" class="top_extra_menu AOM_paddingBottom_6"<%=
  ' help="'+ _('This menu gives you access to your personal functionalities.') +'"' if logged_in?
  %>>

  <% if logged_in? %>

    <div id="user_menu_head">
      <img src="<%=
      (current_user.person.image)?
      current_user.person.image.public_filename(:icon) : "/images/icons-bar/photo.png"
      %>" alt="<%= current_user.name %> Icon-Photo" title="" height="20" border="0"/>
      <span><%= _("%s's Menu") % current_user.person.short_name %> </span>
    </div>

    <div id="user_menu_ul">
      <ul>

        <li>
          <%= link_to( '<span class="icon-menu-home"></span>' + __('My Home Page'), user.url, :help => _('Go to your home page.'))%>
        </li>

        <li>
        <%= link_to('<span class="icon-menu-my-groups"></span>' + _('My groups'), { :controller => 'memberships', :profile => user.identifier, :action => 'index' }) %>
        </li>

        <% for enterprise in user.enterprises %>
          <li><%= link_to('<span class="icon-menu-enterprise"></span>' + (_('Manage %s') % enterprise.short_name), { :controller => 'profile_editor', :profile => enterprise.identifier, :action => 'index' }) %></li>
        <% end %>

        <!-- li><a href="#"><span class="icon-menu-blog"></span> Meu Blog</a></li -->

        <% if MailConf.enabled? && current_user.enable_email %>
          <li>
          <%= link_to '<span class="icon-menu-mail"></span>' + _('Webmail'), MailConf.webmail_url(user.identifier, current_user.email_domain) %>
          </li>
        <% end %>

        <li>
        <%= link_to('<span class="icon-menu-ctrl-panel"></span>'+ _('Control panel'), { :controller => 'profile_editor', :action => 'index', :profile => user.identifier }, :id => 'link_edit_profile', :help => _('Control panel: change your picture, edit your personal information, create content or change the way your home page looks.')) %>
        </li>

        <% if user.is_admin?(environment) %>
          <li><%= link_to( '<span class="icon-menu-admin"></span>'+ _('Admin'),
                             {:controller => 'admin_panel' },
                             :id => 'link_admin_panel',
                             :help => _('Access the site administration panel.')
                             )%></li>
        <% end %>

        <li><%= link_to( '<span class="icon-menu-logout"></span>'+ _('Logout'),
                                  {:controller => 'account', :action => 'logout'},
                                  :id => 'link_logout',
                                  :help => _('This link takes you out of the system. You should logout if other people are willing to use the same computer after you.')
                                ) %></li>

      </ul>
    </div><!-- id="user_menu_ul" -->

  <% else %>

    <% if params[:controller] != 'account' || params[:action] != 'signup' %>
      <% if theme_option( :menu_login ) == 'full_form' %>
        <%= render :file => 'account/login_block' %>
      <% else %>
        <%= thickbox_inline_popup_link('<span class="icon-menu-login"></span>'+ _('Login'), 'inlineLoginBox', login_url, :id => 'link_login', :help => _('Click here to enter your username and password and be recognized by the system.')) %>
        <div id='inlineLoginBox' style='display: none;'>
          <%= render :file => 'account/login' %>
          <center><%= thickbox_close_button _('Close') %></center>
        </div>
      <% end %>
    <% end %>

  <% end %>

</div><!-- fim id="user_menu" -->

<%= javascript_tag 'setAutoOpenMenu( $("user_menu") )' if theme_option( :menu_login ) != 'full_form' %>