Guest User

Untitled

a guest
Oct 15th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. <cfset helper = new cfcs.builderHelper(ideeventinfo)>
  2. <cfset runType = helper.getRunType()>
  3.  
  4. <!--- Step One: Do we have gist info? --->
  5. <cfif not fileExists(expandPath("./settings.json"))>
  6.  
  7. <cfheader name="Content-Type" value="text/xml">
  8. <cfoutput>
  9. <response showresponse="true">
  10. <ide url="#helper.getRootURL()#getinfo.cfm">
  11. <dialog width="455" height="470" title="Gist Setup" />
  12. </ide>
  13. </response>
  14. </cfoutput>
  15.  
  16. <cfelse>
  17.  
  18. <!--- load and cache the auth info --->
  19. <!--- todo: validate it still works --->
  20. <cfif not structKeyExists(application, "githubdata")>
  21. <cfset application.githubdata = deserializeJSON(fileRead(expandPath("./settings.json")))>
  22. <!--- set the u/p values in our service - note that this is an application specific cfc, but that's normal in extensions --->
  23. <cfset application.gistService.username = application.githubdata.username>
  24. <cfset application.gistService.password = application.githubdata.password>
  25. </cfif>
  26.  
  27. <!---
  28. So, if we were in the editor, get the stuff they selected. If they selected nothing, get the entire file.
  29. If they were in the project view, get the file.
  30. --->
  31. <cfif runtype is "editor">
  32.  
  33. <cfset selection = helper.getSelectedText()>
  34. <cfset filename = listLast(selection.path, "\/")>
  35. <cfset text = selection.text>
  36.  
  37. <cfelseif runtype is "projectview">
  38.  
  39. <cfset filepath = helper.getSelectedResource().path>
  40. <cfset text = fileRead(filepath)>
  41. <cfset filename = listlast(filepath, "\/")>
  42.  
  43. </cfif>
  44.  
  45. <cfset application.result = application.gistService.createGist(filename, text)>
  46.  
  47. <cfheader name="Content-Type" value="text/xml">
  48. <cfoutput>
  49. <response showresponse="true">
  50. <ide url="#helper.getRootURL()#result.cfm">
  51. <dialog width="455" height="300" title="Gist Result" />
  52. </ide>
  53. </response>
  54. </cfoutput>
  55.  
  56. </cfif>
Add Comment
Please, Sign In to add comment