summaryrefslogtreecommitdiff
path: root/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/create_group.html
blob: 0f529244e3298dbd4c7a513e21aa770b8b67575e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
{% extends "ndf/base.html" %}
{% load i18n %}
{% load ndf_tags %}

{% block title %} Create a new group {% endblock %}

{% block meta_content %}
  {% blocktrans %}
    <h3>Types of Groups</h3>
    <h5>Open Groups</h5>
    <p class="subheader">Open groups are ideal for projects that require a high level of collaboration and participation. Any metastudio user can join this group without prior approval</p>
    <h5>Closed Groups</h5>
    <p class="subheader">Closed groups are ideal for projects that require restricted access to content and documents. Users can only join after their membership request is approved or have been invited.</p>
  {% endblocktrans %}
{% endblock %}

{% block related_content %}
  {% if groups %}
   <b>{% trans " Existing Groups:" %}</b>

    {% get_existing_groups_excluding_username as groups%}
    {% for items in groups %}  
      <br>{{items.name|truncatechars:25}}
    {% endfor %}
  {% endif %}
{% endblock %}

{% block body_content %} 

  <h2>{% trans "Create a new user group" %}</h2>

  <form id="create_group" class="row" method="post" action="{% url 'create_group' group_id %}">
    {% csrf_token %}

      <div class="small-12 columns" style='display:table;  border:1px;   border-spacing:10px; '>
        <div style='display:table-row;' >
          <div style='display:table-cell;'> 
            <font size="3">{% trans "Name of the Group" %}</font> 
          </div>
          <div style='display:table-cell;'> 
            <input type="text"  id="group_name" name="groupname" placeholder="Enter Group Name">
            <label id="message" style="display:none; color:red"></label>
            <!-- <div id="message" style="display:none; color:red"></div> -->
          </div>

          <div style='display:table-cell;'> 
            <font size="3" >{% trans "Group Type" %}</font>
          </div>
          <div style='display:table-cell;'> 
            <select name="group_type" class="gtype">
              <option id="PUBLIC">{% trans "PUBLIC" %}</option>
              <option id="PRIVATE">{% trans "PRIVATE" %}</option>
              <option id="ANONYMOUS">{% trans "ANONYMOUS" %}</option>
            </select> 
          </div>
        </div>

        <div style='display:table-row;'>
          <div style='display:table-cell;'> 
            <font size="3" >Group Editing policy</font>
          </div>
          <div style='display:table-cell;'> 
            <select name="edit_policy" class="editp">
              <option id="EDITABLE_NON_MODERATED">{% trans "EDITABLE_NON_MODERATED" %}</option>
              <option id="EDITABLE_MODERATED">{% trans "EDITABLE_MODERATED" %}</option>
              <option id="NON_EDITABLE">{% trans "NON_EDITABLE" %}</option>
            </select> 
          </div>
          <div style='display:table-cell;'> 
            <font size="3" >Group Subscription policy</font>
          </div>
          <div style='display:table-cell;'> 
            <select name="subscription" class="subscptn">
              <option id="OPEN">{% trans "OPEN" %}</option>
              <option id="BY_REQUEST">{% trans "BY_REQUEST" %}</option>
              <option id="BY_INVITATION">{% trans "BY_INVITATION" %}</option>
            </select>
          </div>
        </div>

        <div style='display:table-row;'>
          <div style='display:table-cell;'> 
            <font size="3" >{% trans "Group Agency Types" %}</font>
          </div>
          {% get_group_agency_types as agency_types %}
          <div style='display:table-cell;'> 
            <select name="agency_type" class="agencygrp">
              {% for each in agency_types %}
                <option id="{{each}}">{{each}}</option>
              {% endfor %}
            </select>
          </div>

          <div style='display:table-cell;'> 
            <font size="3">{% trans "Group Member Visibility" %}</font>
          </div>
          <div style='display:table-cell;'> 
            <select name="member" class="mem" disabled>
              <option id="DISCLOSED_TO_MEM">{% trans "DISCLOSED_TO_MEM" %}</option>
              <option id="NOT_DISCLOSED_TO_MEM">{% trans "NOT_DISCLOSED_TO_MEM" %}</option>
            </select>
          </div>
        </div>

        <div style='display:table-row;'>
          <div style='display:table-cell;'> 
            <font size="3" >{% trans "Group Encryption policy" %}</font>
          </div>
          <div style='display:table-cell;'> 
            <select name="encryption" class="encr" disabled>
              <option id="NOT_ENCRYPTED">{% trans "NOT_ENCRYPTED" %}</option>
              <option id="ENCRYPTED">{% trans "ENCRYPTED" %}</option>
            </select>
          </div>  

          <div style='display:table-cell;'> 
            <font size="3" >{% trans "Group Existance visibility" %}</font>
          </div>
          <div style='display:table-cell;'> 
            <select name="existance" class="existance" disabled>
              <option id="ANNOUNCED">{% trans "ANNOUNCED" %}</option>
              <option id="NOT_ANNOUNCED">{% trans "NOT_ANNOUNCED" %}</option>
            </select>
          </div>
        </div>
        <div style='display:table-row;'>
          <div style='display:table-cell;' colspan='2' align="middle"> 
            <!-- <input type="button" id="savegrp" value="Create Group"  class="button" onClick="check_values()">
            <input type="submit" id="grpsubmit" value="Create Group" class="button" style="visibility:hidden" > -->
            <input type="submit" value="Create Group" id="grpsubmit" class="button">
          </div>
        </div>
        <!-- <input type="hidden" id="nodes_list" value="{{nodes_list}}">            -->
      </div>
  </form>
{% endblock %}

{% block head %}
<script type="text/javascript">
  /*
  function check_group_name()
  {
     var gname=$("#group_name").val();
      $.ajax({
        url: '/home/group/check_group/',
        data: {gname:gname},
        success: function(data){
          if (data=="success"){
           alert("group already exists");
           $("#group_name").val("");
           $("#group_name").focus();
         }
        }
      });  //end_ajax
  }

  function check_values()
  {
    check_group_name();
    var gpname = $("#group_name").val();
    if (gpname == "")
    {
     alert("Group name can not be empty")
     $("#group_name").focus();
   }
   else
   {
    $("#grpsubmit").trigger("click");
  }
  }
  */

  $(document).ready(function()
  {
    /*
      $("#group_name").change(function(){
      var name = $("#group_name").val().trim();
      var nodes = $("#nodes_list").val();
      if (nodes.indexOf(name) > 0)  
      {
        $("#message").css("display", "block");
        $("#message").html("Name '"+ name +"' already exist .. Please choose another name");
        $("#group_name").val("");
      }
      else
      {
        $("#message").css("display", "none");
      }
    });
    */

    // New Form: Conditional Display 
      $(".login-mode").change(function(){
        /* Hide other options if anonymous login is allowed */
        $("#closed-group").slideToggle();     
      });

      $("#member-mode").slideToggle();
      $("[name='join-mode']").change(function(){
        /* Hide invitation options if open membership */
        $("#member-mode").slideToggle();     
      });

      $("[name='edit-mode']").change(function(){
        /* Hide moderation options if editing is disabled */
        $("#moderate-mode").slideToggle();     
      });
    
      // $("#group_name").focusout(function(){
      //    check_group_name();
      // }); //end_focusout
  }); //end_document_ready

</script>
{% endblock %}

{% block script %}

  $("#node_search_form").parent().hide();

  // method to provide autocomplete/intellisence of forum names

  $("#create_group").submit(function(event){
    var name = $("#group_name").val().trim().toLowerCase();
    var nodes = {{nodes_list|safe}} 

    if (name != "")
    {
      if (nodes.indexOf(name) != -1)  
      { 
        $("#message").css("display", "block");
        $("#message").text("Group '"+ name +"' already exist. Please choose another name");
        event.preventDefault();
      }
    }
    else if (name == ""){
      $("#message").css("display", "block");
      $("#message").text("Group name cannot be empty.");
      event.preventDefault();
    }
    else
    {
      $("#message").css("display", "none");
    }
  });

{% endblock %}