Proyectos de Subversion Moodle

Rev

Rev 996 | Rev 998 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 996 Rev 997
Línea 9... Línea 9...
9
  var CONFIG;
9
  var CONFIG;
10
  var NODES = {
10
  var NODES = {
11
    DELETE_ICON: '<span class="delete">&#x274C;</span>',
11
    DELETE_ICON: '<span class="delete">&#x274C;</span>',
12
  };
12
  };
13
  var SELECTORS = {
13
  var SELECTORS = {
-
 
14
    cesa_notes_ROOT: ".inline-cesa_notes-opener",
14
    cesa_notes_BASE: "#cesa_notes_base",
15
    cesa_notes_BASE: "#cesa_notes_base",
15
    cesa_notes_OPENER: ".cesa_notes-opener",
16
    cesa_notes_OPENER: ".cesa_notes-opener",
16
    cesa_notes_LISTS: ".cesa_notes_list",
17
    cesa_notes_LISTS: ".cesa_notes_list",
17
  };
18
  };
18
  var CSS = {
19
  var CSS = {
Línea 831... Línea 832...
831
        M.cfg.wwwroot + "/blocks/cesa_notes/cesa_notes_ajax.php"
832
        M.cfg.wwwroot + "/blocks/cesa_notes/cesa_notes_ajax.php"
832
      );
833
      );
833
      var strtitle = M.util.get_string("showcesa_notes", "block_cesa_notes");
834
      var strtitle = M.util.get_string("showcesa_notes", "block_cesa_notes");
Línea 834... Línea 835...
834
 
835
 
-
 
836
      console.log('Execute init')
-
 
837
 
-
 
838
      str
-
 
839
      .get_strings([
-
 
840
        { key: "cesa_notes", component: "block_cesa_notes" },
-
 
841
        { key: "characterlimit", component: "block_cesa_notes" },
-
 
842
        { key: "save", component: "block_cesa_notes" },
-
 
843
        { key: "cancel" },
-
 
844
        {
-
 
845
          key: "cesa_notessavedundertab",
-
 
846
          component: "block_cesa_notes",
-
 
847
          param: CONFIG.contextareas[scope.currenttabindex],
-
 
848
        },
-
 
849
        { key: "placeholdercontent", component: "block_cesa_notes" },
-
 
850
      ])
-
 
851
      .done(function (s) {
-
 
852
        // Create basic tab structure
-
 
853
 
-
 
854
        let deleteModal = `<div id="cesa_notes_delete_modal">
-
 
855
                                    <div class="cesa_notes_delete_modal_content">
-
 
856
                                        <p>¿Estás seguro de que quieres eliminar este apunte?</p>
-
 
857
                                        <button id="cesa_notes_modal_cancel_delete">Cancelar</button>
-
 
858
                                        <button id="cesa_notes_modal_accept_delete">Eliminar</button>
-
 
859
                                    </div>
-
 
860
                                    </div>`;
-
 
861
 
-
 
862
        var el = $("<div></div>").append(
-
 
863
          $(
-
 
864
            '<div id="' +
-
 
865
              CSS.cesa_notes_BASE +
-
 
866
              '" class="' +
-
 
867
              CSS.cesa_notes_BASE +
-
 
868
              '">' +
-
 
869
              deleteModal +
-
 
870
              "</div>"
-
 
871
          )
-
 
872
            .append(
-
 
873
              '<div class="inputarea"><div class="responsetext"></div><div class="cesa-notes-limit" id="addmynote-label-' +
-
 
874
                CONFIG.instanceid +
-
 
875
                '">' +
-
 
876
                s[1] +
-
 
877
                " " +
-
 
878
                CONFIG.maxallowedcharacters +
-
 
879
                '<span class="warning"></span></div>' +
-
 
880
                '<div class="textarea"><textarea id="id_mynotecontent-' +
-
 
881
                CONFIG.instanceid +
-
 
882
                '" name="mynotecontent" rows="2">' +
-
 
883
                s[5] +
-
 
884
                "</textarea></div>" +
-
 
885
                '<p class="notesavedhint">' +
-
 
886
                s[4] +
-
 
887
                "</p>" +
-
 
888
                '<p class="cesa_notes_buttons_container"><button class="j-delete-cesa-note">Eliminar</button><input type="submit" id="addmynote_submit"/> </p>' +
-
 
889
                '<p class="cesa_note_bottom_container"><a class="cesa_notes_print" target="_blank" href="' +
-
 
890
                CONFIG.printapi +
-
 
891
                '">Imprimir notas</a> </p>' +
-
 
892
                "</div>"
-
 
893
            )
-
 
894
            .append($('<ul class="tabs-menu"></ul>'))
-
 
895
            .append($('<div class="tab"></div>'))
-
 
896
        );
-
 
897
        el.find("#addmynote_submit").attr("value", s[2]);
-
 
898
        el.find("#addmynote_cancel").attr("value", s[3]);
-
 
899
        var tabsmenu = "";
-
 
900
        var tabcontents = "";
-
 
901
        var i = "";
-
 
902
        for (i in CONFIG.contextareas) {
-
 
903
          if (scope.currenttabindex == i) {
-
 
904
            tabsmenu +=
-
 
905
              '<li class="current" id="tab-' +
-
 
906
              CONFIG.prefix +
-
 
907
              i +
-
 
908
              '"><div class="menu-item">' +
-
 
909
              CONFIG.contextareas[i] +
-
 
910
              "</div></li>";
-
 
911
          } else {
-
 
912
            tabsmenu +=
-
 
913
              '<li class="" id="tab-' +
-
 
914
              CONFIG.prefix +
-
 
915
              i +
-
 
916
              '"><div class="menu-item">' +
-
 
917
              CONFIG.contextareas[i] +
-
 
918
              "</div></li>";
-
 
919
          }
-
 
920
          tabcontents +=
-
 
921
            '<div class="tab-content" id="' +
-
 
922
            CONFIG.prefix +
-
 
923
            i +
-
 
924
            '" onpage="0" notes-count="0">' +
-
 
925
            '<div class="notes-info"><div class="cesa_notes-paging"></div><div class="count"></div></div>' +
-
 
926
            '<ul id="' +
-
 
927
            CONFIG.prefix +
-
 
928
            i +
-
 
929
            '-list" class="cesa_notes_lists"></ul>' +
-
 
930
            "</div>";
-
 
931
        }
-
 
932
        el.find(".tabs-menu").append(tabsmenu);
-
 
933
        el.find(".tab").append($(tabcontents));
835
      console.log('Execute init')
934
      
-
 
935
        $(SELECTORS.cesa_notes_ROOT).html(el.html());
-
 
936
 
-
 
937
        /* if (initnotes === null) {
-
 
938
          initnotes = true;
-
 
939
          // Get initial notes
-
 
940
          scope.getcesa_notes(0);
-
 
941
          $(SELECTORS.cesa_notes_BASE)
-
 
942
            .find(scope.currenttab)
-
 
943
            .attr("data-loaded", "true");
-
 
944
          $(SELECTORS.cesa_notes_BASE)
-
 
945
            .find(scope.currenttab)
-
 
946
            .css("display", "block");
-
 
947
        }
-
 
948
 
-
 
949
        scope.registerActions(); */
-
 
950
      });
Línea 836... Línea 951...
836
      $(".inline-cesa_notes-opener").html("hola");
951
 
837
      
952
      
Línea 838... Línea 953...
838
    },
953
    },