index.tpl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. {{javascript}}
  2. <script type="text/javascript">
  3. {% if is_allowed_to_edit %}
  4. var sec_token = '{{sec_token}}';
  5. {% endif %}
  6. function delete_entry(name, btn){
  7. if(!confirm("{{'ConfirmYourChoice'|get_lang}}")){
  8. return false;
  9. }
  10. var item = $('#'+name);
  11. var id = item.attr('data-id');
  12. var c_id = item.attr('data-c_id');
  13. var f = function(data){
  14. if(data.success){
  15. item.remove();
  16. }
  17. message.update(data);
  18. $(btn).removeClass("loading");
  19. };
  20. CourseDescription.del(c_id, id, f);
  21. $(btn).addClass("loading");
  22. }
  23. function delete_all(){
  24. if(!confirm("{{'ConfirmYourChoice'|get_lang}}")){
  25. return false;
  26. }
  27. var f = function(data){
  28. if(data.success){
  29. var item = $('.course_descriptions');
  30. item.remove();
  31. }
  32. message.update(data);
  33. };
  34. CourseDescription.delete_by_course({{c_id}}, {{session_id}}, f);
  35. }
  36. </script>
  37. {% for message in messages %}
  38. {{ message }}
  39. {% endfor %}
  40. {% if is_allowed_to_edit %}
  41. <div class="btn-toolbar actions-bar" >
  42. <div class="btn-group edit new">
  43. {% for type in types %}
  44. <a href="{{root}}&amp;action=add&amp;description_type={{type.id}}" class="btn btn-default">
  45. <img title="{{type.title}}" alt="{{type.title}}" src="{{type.icon|icon(32)}} " width="32" height="32">
  46. </a>
  47. {% endfor %}
  48. </div>
  49. <div class="btn-group edit">
  50. <a href="{{root}}&amp;action=import_csv" class="btn btn-default" title="{{'ImportCSV'|get_lang}}">
  51. <em class="size-32 icon-import-csv"></em>
  52. </a>
  53. <a href="{{root}}&amp;action=export_csv" class="btn btn-default" title="{{'ExportAsCSV'|get_lang}}">
  54. <em class="size-32 icon-export-csv"></em>
  55. </a>
  56. <a href="javascript:void(0)" onclick="delete_all();return false;" class="btn btn-default" title="{{'DeleteAll'|get_lang}}">
  57. <em class="size-32 icon-delete-all"></em>
  58. </a>
  59. </div>
  60. </div>
  61. {% endif %}
  62. <ul style="list-style: none; margin-left:0;" class="course_descriptions">
  63. {% for description in descriptions %}
  64. <li id="description_{{description.id}}" class="course_description" data-id="{{description.id}}" data-c_id="{{description.c_id}}" data-type="course_description">
  65. <div class="title sectiontitle">
  66. {% if is_allowed_to_edit %}
  67. <div class="pull-right element-actions">
  68. {% if session_id == description.session_id %}
  69. <a href="{{root}}&amp;action=delete&amp;id={{description.id}}"
  70. onclick="delete_entry('description_{{description.id}}', this); return false;"
  71. title="{{'Delete'|get_lang}}">
  72. <em class="size-22 icon-delete"></em>
  73. </a>
  74. <a href="{{root}}&amp;action=edit&amp;id={{description.id}}"
  75. title="{{'Edit'|get_lang}}">
  76. <em class="size-22 icon-edit"></em>
  77. </a>
  78. {% else %}
  79. <img title="{{'EditionNotAvailableFromSession'|get_lang}}"
  80. alt="{{'EditionNotAvailableFromSession'|get_lang}}"
  81. src="{{'edit_na.png'|icon(22)}}" width="22" height="22"
  82. style="vertical-align:middle;">
  83. {% endif %}
  84. </div>
  85. {% endif %}
  86. <img title="{{description.type.title}}" alt="{{description.type.title}}" src="{{description.type.icon|icon(32)}}" class="icon">
  87. {{description.title}}
  88. </div>
  89. <div class="sectioncomment">
  90. {{description.content}}
  91. </div>
  92. </li>
  93. {% endfor %}
  94. </ul>