src/cm/templates/site/dashboard.html
changeset 0 40c8f766c9b8
child 116 5ef5e558e361
equal deleted inserted replaced
-1:000000000000 0:40c8f766c9b8
       
     1 {% extends "site/layout/base_workspace.html" %}
       
     2 {% load com %}
       
     3 {% load i18n %}
       
     4 {% load local_perms %}
       
     5 {% load activity %}
       
     6 
       
     7 {% block head_base %}
       
     8 <link href="{% url public-feed %}" title="Workspace feed" type="application/rss+xml" rel="alternate" />
       
     9 {% endblock %}
       
    10 
       
    11 {% block title %}
       
    12 {% blocktrans %}Dashboard{% endblocktrans %}
       
    13 {% endblock %}
       
    14 
       
    15 {% block head %}
       
    16 {% endblock %}
       
    17 
       
    18 {% block main %}
       
    19 
       
    20 {% get_local_perm request can_create_text as can_create_text %}
       
    21 {% get_local_perm request can_manage_workspace as can_manage_workspace %}
       
    22 
       
    23 <script type="text/javascript">
       
    24 <!--
       
    25 tb_conf['current_tab'] = 'dashboard';
       
    26 -->
       
    27 </script>
       
    28 
       
    29 <script type="text/javascript">
       
    30 <!--
       
    31 $(function() {
       
    32     $(".hidden-text-actions").css('visibility','hidden');   
       
    33 }) ;
       
    34 -->
       
    35 </script>
       
    36 
       
    37 <div id="dashboard" class="tab-meta">   
       
    38 
       
    39 <div style="float:left;width:32%;">
       
    40 	<table class="dash_table">
       
    41 	    <thead>
       
    42 	        <tr>
       
    43 	        <th><span class="em">{% blocktrans %}Actions{% endblocktrans %}</span></th>
       
    44 			</tr>
       
    45 		</thead>
       
    46 		<tbody>
       
    47 	        <tr><td>	
       
    48             {% if can_create_text %}<div class="dash_action"><a class="" href="{% url text-create-content %}"><img align="middle" src="{{ MEDIA_URL }}img/sop_write.png"/>&nbsp;{% blocktrans %}Write a text{% endblocktrans %}</a></div>{% endif %}
       
    49             {% if can_create_text %}<div class="dash_action"><a class="" href="{% url text-create-upload %}"><img align="middle" src="{{ MEDIA_URL }}img/sop_upload.png"/>&nbsp;{% blocktrans %}Upload a text{% endblocktrans %}</a></div>{% endif %}
       
    50             {% if can_manage_workspace %}<div class="dash_action"><a class="" href="{% url user-add %}"><img align="middle" src="{{ MEDIA_URL }}img/group_add.png"/>&nbsp;{% blocktrans %}Invite user{% endblocktrans %}</a></div>{% endif %}
       
    51             <div class="dash_action"><a class="" href="{% url profile %}"><img align="middle" src="{{ MEDIA_URL }}img/user_edit.png"/>&nbsp;{% blocktrans %}Edit your profile{% endblocktrans %}</a></div>
       
    52             <div class="dash_action"><a class="" href="{% url text %}"><img align="middle" src="{{ MEDIA_URL }}img/page_white_stack.png"/>&nbsp;{% blocktrans %}View text list{% endblocktrans %}</a></div>
       
    53             {% if can_manage_workspace %}<div class="dash_action"><a class="" href="{% url settings %}"><img align="middle" src="{{ MEDIA_URL }}img/cog_edit.png"/>&nbsp;{% blocktrans %}Configure workspace{% endblocktrans %}</a></div>{% endif %}
       
    54             </td>
       
    55             </tr>
       
    56 		
       
    57 		</tbody>
       
    58 	</table>
       
    59 
       
    60 	{% if to_mod_profiles or to_mod_comments %}
       
    61 	<table class="dash_table">
       
    62 	    <thead>
       
    63 	        <tr>
       
    64 	        <th><span class="em">{% blocktrans %}Moderation queue{% endblocktrans %}</span></th>
       
    65 			</tr>
       
    66 		</thead>
       
    67 		<tbody>
       
    68 	        <tr><td>
       
    69             <ul class="dashlog_list">
       
    70             {% for profile in to_mod_profiles %}
       
    71             	{% with profile.user as user %}
       
    72             	<li class="dashlog_item">
       
    73 				    <div class="dashlog">            	
       
    74 						<img class="dashlog_img" src="{{ MEDIA_URL }}img/user_error_small.png"/>
       
    75 						<span class="dashlog_data">
       
    76             			{% blocktrans %}user {{ user }} awaits approval{% endblocktrans %}
       
    77             			</span>
       
    78             			<div class="mod_actions">
       
    79 <img src="{{ MEDIA_URL }}img/bullet_go_small.png"/>
       
    80 <a id="user-approve-{{ user.get_profile.key }}" href="#">{% blocktrans %}approve{% endblocktrans %}</a>/<a id="user-refuse-{{ user.get_profile.key }}" href="#">{% blocktrans %}refuse{% endblocktrans %}</a> {% blocktrans %}membership{% endblocktrans %}
       
    81 <script type="text/javascript">
       
    82 <!--
       
    83 $("#user-approve-{{ user.get_profile.key }}").click(function(){
       
    84     url = '{% url user-enable user.get_profile.key %}';
       
    85 	question = "{% blocktrans %}Are you sure you want to approve this user's membership to the workspace?{% endblocktrans %}";
       
    86     if (confirm(question)) {
       
    87         $.post(url, function(data){
       
    88               window.location = '{% url index %}';
       
    89             });                        
       
    90     }
       
    91 });
       
    92 $("#user-refuse-{{ user.get_profile.key }}").click(function(){
       
    93     url = '{% url user-suspend user.get_profile.key %}';
       
    94 	question = "{% blocktrans %}Are you sure you want to refuse this user's membership to the workspace?{% endblocktrans %}";
       
    95     if (confirm(question)) {
       
    96         $.post(url, function(data){
       
    97               window.location = '{% url index %}';
       
    98             });                        
       
    99     }
       
   100 });
       
   101 -->             			
       
   102 </script>
       
   103 </div>
       
   104 						
       
   105 					<div style="padding-left:22px;" class="dashlog_metadata">
       
   106 					{% blocktrans with profile.modified|timesince as duration %}registered {{ duration }} ago{% endblocktrans %}
       
   107                     </div>
       
   108 						  
       
   109 
       
   110 					</div>
       
   111             	</li>
       
   112             	{% endwith %}
       
   113             {% endfor %}
       
   114             {% for comment in to_mod_comments %}
       
   115             	<li class="dashlog_item">
       
   116 				    <div class="dashlog">            	
       
   117 						<img class="dashlog_img" src="{{ MEDIA_URL }}img/note_error_small.png"/>
       
   118 						<span class="dashlog_data">
       
   119             	
       
   120 		            	{% blocktrans %}comment{% endblocktrans %} <a href="{% url text-view-show-comment comment.text_version.text.key comment.key %}">{{ comment.title }}</a>
       
   121 		            	{% blocktrans with comment.user as cuser %}by {{ cuser }} on text{% endblocktrans %} <a href="{% url text-view comment.text_version.text.key %}">{{ comment.text_version.text.title }}</a> {% blocktrans %}awaits approval{% endblocktrans %}<br />
       
   122 		            	</span>
       
   123 		            	<div style="padding-left:22px;" class="mod_actions">
       
   124 <img src="{{ MEDIA_URL }}img/bullet_go_small.png"/>
       
   125 
       
   126 <a id="comment-approve-{{ comment.key }}" href="#">{% blocktrans %}approve{% endblocktrans %}</a>/<a id="comment-refuse-{{ comment.key }}" href="#">{% blocktrans %}refuse{% endblocktrans %}</a> {% blocktrans %}comment{% endblocktrans %},
       
   127 <a href="{% url text-view-show-comment comment.text_version.text.key comment.key %}">{% blocktrans %}view in context{% endblocktrans %}</a>
       
   128 <script type="text/javascript">
       
   129 <!--
       
   130 $("#comment-approve-{{ comment.key }}").click(function(){
       
   131     url = '{% url text-client-exchange %}';
       
   132 	question = "{% blocktrans %}Are you sure you want to approve this comment?{% endblocktrans %}";
       
   133     if (confirm(question)) {
       
   134         $.post(url,
       
   135                 {
       
   136             'comment_key':'{{ comment.key }}',
       
   137             'fun':'editComment',
       
   138             'key':'{{ comment.text_version.text.key }}',
       
   139             'state':'approved'
       
   140                  },
       
   141                function(data){
       
   142               window.location = '{% url index %}';
       
   143             });                        
       
   144     }
       
   145 });
       
   146 $("#comment-refuse-{{ comment.key }}").click(function(){
       
   147     url = '{% url text-client-exchange %}';
       
   148 	question = "{% blocktrans %}Are you sure you want to refuse this comment?{% endblocktrans %}";
       
   149     if (confirm(question)) {
       
   150         $.post(url,
       
   151                 {
       
   152             'comment_key':'{{ comment.key }}',
       
   153             'fun':'editComment',
       
   154             'key':'{{ comment.text_version.text.key }}',
       
   155             'state':'unapproved'
       
   156                  },
       
   157                function(data){
       
   158               window.location = '{% url index %}';
       
   159             });                        
       
   160     }
       
   161 });
       
   162 -->             			
       
   163 </script>		            	
       
   164 		            	</div>
       
   165 						<div style="padding-left:22px;" class="dashlog_metadata">
       
   166 						{% blocktrans with comment.modified|timesince as duration %}modified {{ duration }} ago{% endblocktrans %}
       
   167 	                    </div>
       
   168 		            </div>      
       
   169             	</li>           
       
   170             {% endfor %}
       
   171             </ul>
       
   172             </td></tr>		
       
   173 		</tbody>
       
   174 	</table>
       
   175 	{% endif %}	
       
   176 
       
   177 </div>	
       
   178 
       
   179 <div style="float:left;width:32%;padding-left:15px;">
       
   180 
       
   181 	<table class="dash_table">
       
   182 	    <thead>
       
   183 	        <tr>
       
   184 	        <th><span class="em">{% blocktrans %}Recent texts{% endblocktrans %}</span> (<a href="{% url text %}">{% blocktrans %}all{% endblocktrans %}</a>)</th>
       
   185 			</tr>
       
   186 		</thead>
       
   187 		<tbody>
       
   188 	        <tr><td>
       
   189             <ul class="dashlog_list">
       
   190             {% for text in last_texts %}
       
   191             <li class="dashlog_item">
       
   192 				    <div class="dashlog">            	
       
   193 						<img class="dashlog_img" src="{{ MEDIA_URL }}img/page_white.png"/>
       
   194 						<span class="dashlog_data">
       
   195 							<a href="{% url text-view text.key %}">{{ text.title }}</a>						
       
   196                     </span>
       
   197                     <div style="padding-left:22px;" class="dashlog_metadata">
       
   198                     {% nb_comments text as nb_comments %}
       
   199 					{% blocktrans count nb_comments as nb_comments %}{{ nb_comments }} comment{% plural %}{{ nb_comments }} comments{% endblocktrans %}, {% blocktrans with text.modified|timesince as duration %}modified {{ duration }} ago{% endblocktrans %}
       
   200                     </div>
       
   201                     </div>
       
   202                     </li>
       
   203             {% empty %}
       
   204             {% blocktrans %}No texts yet{% endblocktrans %}                    
       
   205             {% endfor %}
       
   206             
       
   207             </ul>
       
   208             </td></tr>		
       
   209 		</tbody>
       
   210 	</table>
       
   211 	
       
   212 	{% if can_manage_workspace %}
       
   213 	{% include "site/dashboard_bloc_recent_comments.html" %}
       
   214 	{% endif %}
       
   215 </div>
       
   216 
       
   217 
       
   218 <div style="float:left;width:32%;padding-left:15px;">
       
   219 	{% if can_manage_workspace %}
       
   220 	<table class="dash_table">
       
   221 	    <thead>
       
   222 	        <tr>
       
   223 	        <th><span class="em">{% blocktrans %}Workspace activity{% endblocktrans %}</span>
       
   224 		        ({% ifnotequal span 'month' %}<a href="?{% newparams 'span' 'month' %}">{% blocktrans %}month{% endblocktrans %}</a>{% else %}{% blocktrans %}month{% endblocktrans %}{% endifnotequal %}/{% ifnotequal span 'week' %}<a href="?{% newparams 'span' 'week' %}">{% blocktrans %}week{% endblocktrans %}</a>{% else %}{% blocktrans %}week{% endblocktrans %}{% endifnotequal %}/{% ifnotequal span 'day' %}<a href="?{% newparams 'span' 'day' %}">{% blocktrans %}24 hours{% endblocktrans %}</a>{% else %}{% blocktrans %}24 hours{% endblocktrans %}{% endifnotequal %})</th>
       
   225 			</tr>
       
   226 		</thead>
       
   227 		<tbody>
       
   228         <tr>
       
   229             <td>
       
   230                 <div>{% blocktrans %}Access{% endblocktrans %}</div>  
       
   231                 <div class="spark" id="access">{% blocktrans %}Loading...{% endblocktrans %}</div>
       
   232                 <script type="text/javascript">
       
   233                 $(function() {
       
   234                     $('#access').sparkline({% activity all all span auto 'text_view' 'raw' %}, {'width': '250px','height': '40px'});
       
   235                 });                
       
   236                 </script>
       
   237             </td>
       
   238         </tr>
       
   239         <tr>
       
   240             <td>
       
   241                 <div>{% blocktrans %}Commenting{% endblocktrans %}</div>  
       
   242                 <div class="spark" id="commenting">{% blocktrans %}Loading...{% endblocktrans %}</div>
       
   243                 <script type="text/javascript">
       
   244                 $(function() {
       
   245                     $('#commenting').sparkline({% activity all all span auto 'comment_created' 'raw' %}, {'width': '250px','height': '40px'});
       
   246                 });                
       
   247                 </script>
       
   248             </td>
       
   249         </tr>
       
   250 		</tbody>
       
   251 	</table>
       
   252 	
       
   253 	<table class="dash_table">
       
   254 	    <thead>
       
   255 	        <tr>
       
   256 	        <th>       
       
   257 	        {% include "site/macros/paginator.html" %}    
       
   258 		        <span class="em">{% blocktrans %}Activities{% endblocktrans %}</span>
       
   259 		        <br />
       
   260 	        <span class="view_options">
       
   261 	            <input type="checkbox" name="view_texts" {% ifequal view_texts 1 %}checked="checked"{% endifequal %} id="view_texts"/>{% blocktrans %}texts{% endblocktrans %}
       
   262 	            <input type="checkbox" name="view_comments" {% ifequal view_comments 1 %}checked="checked"{% endifequal %} id="view_comments"/>{% blocktrans %}comments{% endblocktrans %}
       
   263 		        {% if can_manage_workspace %}
       
   264 		            <input type="checkbox" name="view_users" {% ifequal view_users 1 %}checked="checked"{% endifequal %} id="view_users"/>{% blocktrans %}users{% endblocktrans %}
       
   265 		        {% endif %}
       
   266 	        </span>
       
   267 	        
       
   268         <script type="text/javascript">                
       
   269         <!--
       
   270         $(function() {
       
   271             $("#view_texts").click(function(){                
       
   272                 window.location = ($(this).attr('checked'))? '?{% newparams 'view_texts' '1' %}' : '?{% newparams 'view_texts' '0' %}' ;
       
   273             });
       
   274             $("#view_comments").click(function(){                
       
   275                 window.location = ($(this).attr('checked'))? '?{% newparams 'view_comments' '1' %}' : '?{% newparams 'view_comments' '0' %}' ;
       
   276             });
       
   277             $("#view_users").click(function(){                
       
   278                 window.location = ($(this).attr('checked'))? '?{% newparams 'view_users' '1' %}' : '?{% newparams 'view_users' '0' %}' ;
       
   279             });
       
   280         }) ;
       
   281         --> 
       
   282         </script>	        
       
   283 			</th>
       
   284 			</tr>
       
   285 		</thead>
       
   286 		<tbody>
       
   287 	        <tr><td>
       
   288 	        
       
   289                 <ul class="dashlog_list">
       
   290                 <!--     {{ activity.type }} {{ activity.text }} {{ activity.comment }} {{ activity.user }} -->
       
   291                 {% for activity in object_list %}
       
   292                     <li class="dashlog_item">
       
   293 				    <div class="dashlog">                    
       
   294                     <img class="dashlog_img" src={{ MEDIA_URL }}img/{{ activity.img_name }} />
       
   295                     <span class="dashlog_data">                    
       
   296                     {{ activity.printable_data }}
       
   297                     </span>
       
   298                     <div style="padding-left:22px;" class="dashlog_metadata">
       
   299                     {{ activity.printable_metadata }}
       
   300                     </div>
       
   301                     </div>
       
   302                     </li>
       
   303                 {% empty %}
       
   304             	{% blocktrans %}No activities{% endblocktrans %}
       
   305                 {% endfor %}
       
   306                 </ul>    
       
   307             </td></tr>		
       
   308 		</tbody>
       
   309 	</table>
       
   310 	{% else %}
       
   311 		{% include "site/dashboard_bloc_recent_comments.html" %}	
       
   312 	{% endif %}
       
   313 	
       
   314 </div>
       
   315 
       
   316 <div style="clear:both;"></div>
       
   317 
       
   318 </div>
       
   319 {% endblock %}