Difference between revisions of "Widget:CodeExplorerGroup"

From Coder Merlin
(Created page with "<noinclude> This widget is intended for Guides only. It is used to create and manage Code Explorer Groups. Parameters: ;userName: string: The current user's username ;sessio...")
 
(Updated for new server format)
Line 25: Line 25:


                   // Submit form via POST   
                   // Submit form via POST   
                  var username = "<!--{$userName}-->".toLowerCase();
                  var sessionID =  "<!--{$sessionID}-->"
                   var url = (subdomain() == "stg") ?  
                   var url = (subdomain() == "stg") ?  
                       "https://language-server-stg.codermerlin.com/" :
                       "https://language-server-stg.codermerlin.com/" :
                       "https://language-server.codermerlin.com/";  
                       "https://language-server.codermerlin.com/";  
                   url += "codeExplorerGroup/" + "guide/" + "<!--{$userName}-->/";
                   url += "codeExplorerGroups/" + "guides/" + username + "/";
   
   
                   $.post(url, {
                   $.ajax({
                      "username": "<!--{$userName}-->",
                      type: 'POST',
                      "sessionID": "<!--{$sessionID}-->"
                      url: url,  
                  })
                      headers: {
                  .done( function(data) {
                          "username": username,
                       var codeExplorerGroupResponse = $(data)[0];
                          "sessionID": sessionID
                      }
                    })
                    .done( function(data) {
                       var codeExplorerGroupResponse = JSON.parse(data);
                       var codeExplorerGroupID = codeExplorerGroupResponse.id;
                       var codeExplorerGroupID = codeExplorerGroupResponse.id;
                       console.log(codeExplorerGroupID);
                       console.log(codeExplorerGroupID);
                       window.location.href = "?codeExplorerGroupID=" + codeExplorerGroupID
                       window.location.href = "?codeExplorerGroupID=" + codeExplorerGroupID
                  })
                    })
                  .fail( function(xhr, textStatus, errorThrown) {
                    .fail( function(xhr, textStatus, errorThrown) {
                       console.log(textStatus);
                       console.log(textStatus);
                       console.log(errorThrown);
                       console.log(errorThrown);
                  });                   
                    });                   
              });
                });
             });
             });
         </script>
         </script>
     </form>
     </form>
</includeonly>
</includeonly>

Revision as of 05:52, 5 October 2021

This widget is intended for Guides only. It is used to create and manage Code Explorer Groups.

Parameters:

userName
string: The current user's username
sessionID
string: The ID of the current user's session

Example:

{{#widget:CodeExplorer
|userName=john-williams
|sessionID=qh0ubrrme911kcg7db0i0ec6lct94h7f
}}