_organization.rhtml 4.59 KB
<h2><%= _('General information') %></h2>

  <%= required_fields_message if @profile.required_fields.any? %>

<% if @environment.enabled?('enable_organization_url_change') %>
  <script type="text/javascript">
    function updateUrlField(name_field, id) {
      url_field = $(id);
      url_field.value = convToValidIdentifier(name_field.value, "-");
      warn_value_change(url_field);
    }
  </script>
<% end %>

<div class="formfieldline">
  <label class="formlabel" for="profile_data_nickname"><%= _('Display name') %></label>
  <div class="formfield type-text">
    <%= text_field_tag 'profile_data[nickname]', @profile_data.nickname, :id => 'profile_data_nickname', :size => 30, :maxlength => 16, :onchange => (@environment.enabled?('enable_organization_url_change') ? "updateUrlField(this, 'profile_data_identifier')" : "") %>
    <em><%= _('A short name by which the organization is know.')%></em>
  </div>
</div>

<% if @environment.enabled?('enable_organization_url_change') %>
  <script type="text/javascript">
    function submit_button() {
      return $("profile_data_identifier").form.select("input.submit")[0];
    }

    function warn_value_change(field) {
      new Effect.Highlight($("profile-identifier-formitem"), {duration:3});
      $("identifier-change-confirmation").show();
      submit_button().disable();
      submit_button().addClassName("disabled");
    }

    function hide_warning() {
       submit_button().enable();
       submit_button().removeClassName("disabled");
       $("identifier-change-confirmation").hide()
    }
  </script>

    <%= hidden_field_tag 'old_profile_identifier', @profile.identifier %>
    <div id="profile-identifier-formitem">
      <%= labelled_form_field( _('Address'),
                              '<code>' + url_for(profile.url).gsub(/#{profile.identifier}$/, '') +
                                 text_field(:profile_data, :identifier, :onchange => "warn_value_change(this)", :size => 15) + '</code>' +
                                 content_tag('div',  '<strong>' + _('WARNING!') + '</strong> ' + _("You are about to change the address, and this will break external links to the homepage or to content inside it. Do you really want to change? ") +
                                                       '<div>' + button_to_function(:ok, _("Yes"), 'hide_warning()') + ' ' +
                                                       button_to_function(:cancel, _('No'), '$("profile_data_identifier").value = $("old_profile_identifier").value; hide_warning()') + '</div>',
                               :id => 'identifier-change-confirmation', :style => 'display: none;'
                                 )
          )
      %>
    </div>
<% end %>

  <%= f.text_field(:acronym) %>
  <%= f.text_field(:foundation_year) %>

  <%= render :partial => 'shared/custom_fields', :locals => { :f => f, :object_name => 'profile_data', :profile => @profile, :only_required => false } %>

  <%= labelled_check_box(_('Enable "contact us"'), 'profile_data[enable_contact_us]', "1", @profile.enable_contact_us) if @profile.enterprise? %>

  <h1><%= _('Moderation options') %></h1>
  <% if profile.community? %>
    <div style='margin-bottom: 1em'>
    <%= _('New members must be approved:')%>
    </div>
    <div style='margin-bottom: 0.5em'>
      <%= radio_button 'profile_data', 'closed', 'true', :style => 'float: left' %>
      <div style='margin-left: 30px'>
        <%= _('<strong>Before</strong> joining this group (a moderator has to accept the member in pending request before member can access the intranet and/or the website).') %>
      </div>
    </div>
    <div>
      <%= radio_button 'profile_data', 'closed', 'false', :style => 'float: left' %>
      <div style='margin-left: 30px'>
        <%= _('<strong>After</strong> joining this group (a moderator can always desactivate access for users later).') %>
      </div>
    </div>
    <br>
  <% end %>
  <div style='margin-bottom: 1em'>
  <%= _('New articles posted by members of this group must be approved:')%>

  </div>
  <div style='margin-bottom: 0.5em'>
    <%= radio_button 'profile_data', 'moderated_articles', 'true', :style => 'float: left' %>
    <div style='margin-left: 30px'>
      <%= _('<strong>Before</strong> being published in this group (a moderator has to accept the article in pending request before the article be listed as a article of this group.') %>
    </div>
  </div>
  <div>
    <%= radio_button 'profile_data', 'moderated_articles', 'false', :style => 'float: left' %>
    <div style='margin-left: 30px'>
      <%= _('<strong>After</strong> being published in this group (a moderator can always remove publicated articles later).') %>
    </div>
  </div>