#!../rebol276 -cs REBOL [] print "content-type: text/html^/" print ["Sitebuilder"] read-cgi: func [/local data buffer][ switch system/options/cgi/request-method [ "POST" [ data: make string! 1020 buffer: make string! 16380 while [positive? read-io system/ports/input buffer 16380][ append data buffer clear buffer ] ] "GET" [data: system/options/cgi/query-string] ] data ] submitted: decode-cgi submitted-bin: read-cgi ; if no data has been submitted, request user/pass: if ((submitted/2 = none) or (submitted/4 = none)) [ print ["W A R N I N G - "] print ["Private Server, Login Required:"

] print [
] print [" Username: "

] print [" Password: "

] print [] print [
] print {} quit ] ; check user/pass every time - end program if incorrect: username: "cmstest" password: "cmstest" myusername: submitted/2 mypassword: submitted/4 either ((username = myusername) and (password = mypassword)) or ((find submitted/2 {Content-Disposition: form-data;}) <> none) [ ; if user/pass is ok, go on ][ print "Incorrect Username/Password." print {} quit ] if not exists? %sitemap.r [ write %sitemap.r {%Home []} write %Home {} ] if submitted/6 = "submit" [ ; write/append %sitemap.r "" ; make sure it exists print rejoin [ {

Create New Page:
} ] pages: sort read %. dont-show-suffixs: [%.html %.jpg %.gif %.png %.bmp %.rip %.exe %.pdf %.cgi %.php %.zip %.txt %.tpl %.r %.tgz %.tmp %.md] remove-each page pages [find dont-show-suffixs (suffix? page)] remove-each page pages [find to-string page "/"] ; don't show directories dont-show-files: [%rebol276 %sitemap %.ftpquota] ; and a few other odd files remove-each page pages [find dont-show-files page] print "

Edit Existing Pages:

" foreach page pages [ print rejoin [ {} to-string page {     } ;
} ] ] print {


} print rejoin [{Edit Site Map          }] print rejoin [{Build Site          }] print rejoin [{View Home Page          }] print rejoin [{Instructions}] print {
} quit ] ; if constructed edit link has been submitted: if submitted/6 = "edit" [ write/append to-file rejoin [what-dir submitted/8] "" ; create new if it doesn't exist ; backup (before changes are made): cur-time: to-string replace/all to-string now/time ":" "-" document_text: read to-file rejoin [what-dir submitted/8] make-dir %edit_history write to-file rejoin [ what-dir "edit_history/" to-string (second split-path to-file submitted/8) "--" now/date "_" cur-time ".txt" ] document_text ; note the POST method in the HTML form: prin rejoin [ {
Be sure to SUBMIT when done:

" "<\/textarea>" {

} ] print {} quit ] ; non-wysiwyg edit: if ((submitted/6 = "cleanedit") and (submitted/8 = "sitemap.r")) [ write/append to-file rejoin [what-dir submitted/8] "" ; create new file if it doesn't exist ; backup (before changes are made): cur-time: to-string replace/all to-string now/time ":" "-" document_text: read to-file rejoin [what-dir submitted/8] make-dir %edit_history write to-file rejoin [ what-dir "edit_history/" to-string (second split-path to-file submitted/8) "--" now/date "_" cur-time ".txt" ] document_text ; note the POST method in the HTML form: prin rejoin [ {
Be sure to SUBMIT when done:

" "<\/textarea>" {
Files

} ] print {} quit ] ; if edited file text has been submitted: if submitted/6 = "save" [ ; save newly edited document: write (to-file rejoin [what-dir submitted/8]) (replace/all submitted/10 "<\/textarea>" "") either (submitted/8 <> "sitemap.r") and (submitted/8 <> (to-string first load %sitemap.r)) [ print {
Document Saved

} recurse-sitemap: func [page] [ append sitemap-pages page/1 if not (page/2 = []) [foreach block page/2 [recurse-sitemap block]] ] sitemap-pages: copy [] recurse-sitemap load %sitemap.r prin {
Now ADD this page as a SUB-PAGE of another in your site map:

} foreach page sitemap-pages [ prin rejoin [ {} page {          } ] ] print rejoin [{

If you've ALREADY added this page to your site map, or if you do not want it in your site map click here

}] ] [ print rejoin [{}] ] print {} quit ] ; If page has been added to site map via link: if submitted/6 = "addsitemap" [ recurse-add-sitemap: func [page] [ if page/1 = (to-file submitted/10) [ new-block: copy [] append new-block (to-file submitted/8) append/only new-block [] insert/only page/2 new-block ] if not (page/2 = []) [foreach block page/2 [recurse-add-sitemap block]] ] recurse-add-sitemap new-site-map: load %sitemap.r save %sitemap.r new-site-map print rejoin [{}] ] ; Build site: if submitted/6 = "buildsite" [ if not exists? %makedocsitebuilder.r [ write %makedocsitebuilder.r decompress #{ 789C953B6B73E3B891DFF92BB0F44DE649EB61CF6447D6A3F636BB557795DCA5 6637C9071EA78A2221893714C990D4C85E67FE7BFA018000497966E5B24502DD 4077A3D12FC01F7EFACFFFFDB3083D019F5FB336970BE1FF25FE24FF5426622E 02F1EB418A0F04F34B1B17695CA702BA4E4759B4E2E7B23EC66D2B6B9FD0FF2E EB262B8B85985FBFBD7E474D3F96D5439DED0F2D8CCAA3FC2A934351E6E53E93 8D98BD7FFF3E984FA76F79801F4EEDA1AC01F4C7B8CEC52F71D3C8A28EDB03F7 FE9C2171CF8E405C5A26F3EB9A5AFF14B7D03AFF63F0DF7141437991D7CA6395 437BB06314FD7E7D688FB9F7AA49E2A290F5AB8548CAA295F72DB0FF59D6DBB2 01E072B7F352B93DED1762772A1211A6711B4722CC7642C188B0AA33E09E3A70 B27BE0AE280BE955711DABC7A44CA57A6C59AAF49CCB5D1BECF278CF139555DB 2C441879E5A9E5EFAA250912707DCA257637E55102A9C723C8BF893CFDB450AB 56C8739E01383E1F640D53BD200644E80741F0D71F3EFCF2D3C207FCEA610204 B60423765991F293428F5ED200FF02ACD56AE5C3831FCC023F12C85F8010E285 3C666DD0C8046914B30E01A66184F95308F30EE1F5EBD78C70F314C24D87707D 7DCD08B74F21DC6A04FFEAEACA176D2924704930F48452D52057FE2B5F09903F A1BF5ED31CAF5EE929B679997C52F8DB539ECBF646E01ABF3468481B60119A2F 2EA2CD076817002DB8C8107AE5124A740EF065713A0EA923E24661BF8124041B 2508D429953B943FE8AB562085A43A6A999E12D82AB4BD708CA813FCFFF5F8C9 0A5F218352825D09B2C25A2AC54851B6D2EFAFBCC05604C77607BC8DB7F9083C 358F22ECEBF254693AE865948C04E8037BA7E0F86D1CB0CC4F47C318BFB9809D 3C275F130898874B12B1E4300AA50461B33F0A37C2FF28DCA800C621C724E042 7622B8B355DAB4AE5CC150038C50C1203CAA7A69EBEC38894FB0E1D1EE3A5464 C7780FFCD397DD5E9767572AD0F06D3C0CA1D86A372EB142C4C543AF053F4D15 27E0FAD01E0B461C01528AD096893FDA87CB7F3A36173B596F2EE396C1D7219E 9CBC0C9E9C1FD195D37D12065DE34580324F8336DE5F9EA52E4B3016B8B22330 91781157159A7DF4B2E00C827359A74AE42F1DF0C81B3EE1D6D11C08F4C04172 88EB46BCA8653768F85CC388B8A16883B43872B55BDEC700248D12A5D252D854 82FA596AFB2FB296FB3AAE0EE285A146662D386B41F212218D83606C59F99DFB 54B041ED84AD476D3E65950E0CFCCD66F38F1F3EFCCF4288BF15B54CCA7D91FD 2653FF25C44EA49E101921B3E08F7CF131F0BDA2C477B7F5E3C4F7E81DC328E4 8F424286E4513042C13D402F30B211A28E69A8837702F9090E741082C32AB2DC 4064378A05DC1EEA93095EBCCE78D8935AB2B43C55243CD30ED034244993E60F 799D9DE1234FAD2110A31068191981B7924C51CAD8A01DA26E0774FD88CCD8AC 0FA7F2D8A4E144CA2EF445C50A64E11014191B1F23B7D0FFC8E1181890E882C0 CCDEE0C1D019461EC885BD374F6E619630188C39672DEA640D8CE1EED3912846 B71B31B658DDCA5A4A0D2135764E666205A6FD19505ECB63F959ED2161E038C2 B63758B72FC849220DBD8823832826447A948B8A8409BDD5BE10A0EC44B0AB8D 3EB681C1B723F5E2258813ADBEDBBCDB81D03C45974E179A16E60AC1DA30B1B0 CF05367948A986794E96482516448D0ED821F4FEE92FFFF52BA4400261985490 13497B436D22C4BF0B91960C22340C4C9315FB0D8D0B14A08569E32CE7790848 9B2EF098614782C7C4E9285A1309F65D5347520EB505FDFF12C2181FA17D4140 664594F169EB93444B0286E239E65A01A46B9D74C444B94B664ACF91E432AE91 347B244A83147B1A2BB4F587D2188E599F6B7F02947674449625E688410D83F6 9BB7570B868D7842E2FC8F938F13CA1EA8B3427B3789F35CD96904A1B44C5365 724243150870665E76652DE3E4608B9BC5EFF81FCE27ED25B17B61961798128A D7907389B5782BC22D8CFAA9EFB5F82FC71520465CD75798F03A79AE72DCB4C3 3D76F20B7E609979263450CDCABFC19B76C7F06839DE050B8A33DD320972F959 E6D03A176C1B820A1278D0679FF5612F8B008952FAC0CA0FEA11D2227EC73C4C EC45EA75C1739C6B67A79D6F7BACBCA8A7474C1747B249794286A68A5416817E 4111986792827E5382309D5A16D460C4C15BCB9248A70A5A7D81F5C0E669C1E6 9AD98BA2014C2373D85E2498E7AA4D2B9C3511781E4BC2CF26C65A403660D36B 695BB79C44809A87E8E842197BF64EC4764D2572F7602E37DD5A84D61C2D3EB7 68D7E3D440440E36D23A866B4748BBF894B7861D5BDB2D669DAD4F066D5B0265 35F21175AA4166AEE9239789252442C626C0348D7D641E12766E5907C931B56C 15EC7972932955D01C738586C4DDFA591150FAE134FE26EB7263ABAE70BA9168 327C6197CF991C26C279C1A53E89810970876098E80C8A4B240B84101299E723 D17273CE5A30739638988A9E9DC3204B7D28680DA80541E7AECD4339CF1C486C 11B34BB0F321ECFC12ECCD10F6E612ECED10F6760C56556F2CD80CD495548004 31063DFF5DD037DF084D451B87EAAF41CF7F17F4CD37435368A9A153F4338442 CD664FEA8F4AE4BF0D58D5982C3AA06508C671A1432EB58CAC9FD91606945A2E 839644AC051A406435068865051710F79C2B285345528062C94DEB51389A5AC1 4D46017555ACE3065BC6983175230772C88B2988219CE3536D2B0501CA189A92 9583768CEFC5D4410EFAC85D31D0B04B91C03F4F40E27A14D611CD45E0AE18A7 811F97BCDC5B88C064BD9A0A3473559CA61050AF6EC5394BDBC36A369D3E5B2F DB1A7E53F139CEB37DB16ACB6AFD6574748B94C7E5A44DD7F0A7C63F38D1388E E8164CE35C9CC97682B45D0EE862B5C31A4A403BBCB198E0582D74AAC69DA60B 12861C92220A80014CF8FFC1151B8EBF9E004BA96C5294E7493A329E02A2A8B4 687D13F5E3874E42309EEBF833991DB978008838BBD0E192CE58D4ABCE28C8BD 17109A98CC41DE676DA47D34C5E55815087B3B82A2C3BEFFC478A0DFC44A3700 EC0B51B73B2223565504E9345AF11D8B20D4698E154062E446611BE7382E4F28 07951AF65843BE147FAEA502033EC222F3D7E3F4097A287FD9C5798314455E3F 6E5B88476F89B1FFDA5B7E17047F45530CE980AC63AC9D6C1FF8983108A01B95 19BE48646BD639D80FF4E62D9BF60163FF874AAE7CAA1F244DE3AF3D1CF90DEC E0F4E18DA8DE88367D23F24C3CEE40C9825D7CCCF2070848EB2C06A0262E1A70 E675B67B03FB26FF2CDB2C89EF048136D96F40E96C5AB5775FBCC34C0DA05ADF 41ABF8191BFE21F954730B8B88807317F016016157E369E6D57C7A338DA76388 6C5970BAE9B33B122F5B20085DDBB63C4247752F9A32CF5271954CDF4FDF4D71 AE1B77AEF9B7CD0588B72EE2F49B11DF8E208E01B66D4FE03ED8F63A8320BC90 67FF8D3896454965963742751802D2B8FEB4AFA52C6098AA963C0E0F4C133E39 540132924A8071F209DD4A91069A3539C59F3BA10C3AADE3FD9D12F542CB379E E20F4A1C28B886BD006B7F8CEB3D44E858F401ACE4E8EA08099E1ACEAE18107B DEC39EF7B12F0891AB6BA94C4AD817E62C580D7AD31BF46674D0A746B8ED8D70 3B3A82921CACC7C313C3A998ED51CB790A9FEFA73D911478472047708A411E47 D66707ABF37EEA6E86DFB75858E67A3444C70F0E4BDFD3565E4EC86E80FD9828 EB82A6426CF784B6F2CF0788657D343A1409B0CBF7DFBD9BFA4E30E0DFF23BAA 1EBD43BF8A1AE011D1EBB5877FC1B0A00056FE0C9A97ECFF5510E0A92062AD3D A0151F303A43A958011E90540060E3F9856F0BE03D0855F3FB0E65369D3A3546 AA024EB8DCADFC610126AFD55F24330C52947725785D508EBC73530DCBFD1420 426C885E4BCF038F7A026AEDEE19C02B5719C85BE01B0CCAF3B6BA0A6B88D9D3 316817BC408BAE4BDA9351351A809B1667C03055CD0DCB97ABE2EF82DD9386B5 BD20D7971579D89FCB62DF1E36349DF1863486A68CAAD738DB78BFC52042A270 506A8A4DAA63439B0A668021D5DFC936F441BCFE4BF88DE0F71A7EDFF85885F4 01B849E24A52B9CC16804ACE8DBBDFD5E5115C7824109032A6062B2E56488694 69284FB300D474080BA0E30F30EF1FE263758707074B7CC95B7A5EE3F31E9ED5 82A08A340E454AC48349F569C3725BAFADB5E5D94D01606C282CF8AAF0685099 81F5A7D1FD6582A42DDB96BE26F87D11F44C30DBB50D0D1BEB098C4663648C90 59F05641395C566B46594EAAB5A9A6F30520B5172133B54BE94B70706B5B6DFB 7594B1E2894AA7393D082DDD5079DD683EADA09760AE0A91E471D3AC7CEEF2D7 623006708080EB689067704ADE95B52CFE816BCD8D0B14CCB52CD421913A02A8 6462CAB8DDF66442BBC5E0034F0406BA56E23927BA286DC10991BE89B08E7005 3A8AA994FFB8CC8E6025EA64E57F11E10B6AEB8AA53CECECA578F4ED9C0AD7CF ECD4ED09ABD8A12AECE88A8DAAC5E046A62A7A48E516AEA25075841003301874 101979D5A93904D0A4B987C7C86838190FAC903E6C8441A3828F58AE05AC56DB 355B25397574D761C093A3C5EAF86B79CAD7CB325F47602BC0DF6ED469093066 3090D3AAAC7A14EAE5C1FB616A5EBE58D6593B3D0A8F49D2C0D76854AB87654F 2C48F619EF17BD86327020C66F57E0C048EBA083E82C709BD2ADB72706361433 CF9ADD4ED65CB30603BF610939D8C3AD33BA34135C9BC9F8E25CA04D1D8E6200 C5EEC5053196076B7296E51154A3B3361C13A41593BA6D6B96676B630DE059D5 B95947A8E3464F0409DE8885CBA8123709E6B87ECF55A9AE27045D6F7122A977 7624A503B0F76F9FC11E1DD8DC6ECFAA7A8C029F43B005CEAAD836E8C628AEB2 404D31C56FCBCA4CF13DC66D0668BB66CD22118011D68345584F593F3DA2833A 47BF1EF569A0C8AEE34609EBC691952900E95291923706D063BE522D5C9A7DD6 269EAE86ADC12C223BCA3721F1967FD2753EACD4CBC6F14E131869EDE1A505AE 5862B01360D08C0138E5F73A30A34E0BBFC3A03360D5A4514DDB58CDCD9FF602 EBD930F036C1FAD5DB29FED8EB0611B7E96E32C8E96B15766F417D228BE001D3 1DD1CC9BA1D01FD6ED7C772824508F253A44DEE38F4661341DC3AA1E2B623F09 F91275627327ACCB739F7677612CF13A49C5D7E78489AC332E3D8B7A995ED34F E4A105EDDF14A0235F6D61B6A76305B949630EF629C8B55A593866E1C2190F2D 667A0AD333BD9EA99ED9A087FAA86736E8813ED5A32ACA78F90348A4677A5A60 F47C148A39FA12AF99F457442681F25132D96566D1BF9EFADD202030CCC16801 2853B5A58161015D76C0DA9A124D5E682FAEA21BBA5D40609D3CFC90EF6A2334 5DBC89BA081568E53BCD7DCF427718C8B935FD2E1866615DD980650BE8DA866B 84D43928B9F19046AB25218574079896CCBF163EDB346671256674B545176909 5E5F54730E54612BC4DA3441CF1735C0A32F0EB5DCC176FE42DC623446D2584E E2F5C07BC220078DF91AA67E14598AD19D83095AEF02E9F8CEB9E5E22E152D13 AF5053585E8C62002518550A6584E50A6F42A1D2807F588B6974F9C8A129785D CC15F54E1109C55620357A431751BE898868F45C441B0C0CC6BB28407178B678 547EE3300797F92357229A057A4D68E99594A9B44B579B52676581C2B30A9142 3EB3E5D3583E67A513D448DD5A72A2A4F382AACBF71B71764BCE301EB2D6DD24 19BB41DB17EA7900C2ACD9D2A58D7856D2A584F42B719B9623DF221811251F47 64C5AEA483135305E11B086E78EA5CA9700E02EC1E92606709FE5610683A9272 1E666B353FACD66C74B5C0DA8FAD1676613A85D9E4F0941F3690A54BE43BFB20 9CFEE3F063D8E4F2AC215C7CBBFE424A436C132D7337FCC70B4EBD15511C5877 19DC4B40E6F887F5CDBA2315750B43D7A2D23250FF45B4108718EFD114C1E74C 9E377497451C9BBDB0035AD5B9E0CD088C9FE4463C6704FAABC44FB7009B8706 289A34499D55ED24AEF7E6AE096844A0EFE8D13C2163E8BB8274B146381BDFF0 CD4C5B6A23EFB3A66D36E219260B847F6D0ECD3A349E202FE3740C90C6617B9D 94C52E038F08E6181D63E87F90555D26B2697CA6D5DFF8FDE3A421A7D625981E 211D312EC4D00BEDDCD451D16716686CC85AFEF324157393B2C81F9EA600DCBB F0F19FC98AF8080BE98F8168ABAB7254BAC6C9173AEDC5FA3A1FDD89A36AD6EB D66313546ED109FFA7BA2EEB85963C056206D78F2ECB26CEB1240963C1522197 F8646B4C6B9179279A18B249572D3A1DE3528E04BD4885B9B3672E73D27D2E03 7BA72B125DC034A11C96E8BFA2A2E6F55199311630C50ACC9EE939D7108872A3 3EC7D6FBC0B0886218EA5D84BBBD3C37F6B2107590C3EC46E029DBC25D11A0B6 A051D7F620FA37FC87BCC40F390000 } ] if not exists? %menu.tpl [ write %menu.tpl decompress #{ 789CB556DB4EDB40107DE72B0623A456AA63C7691E00AFA5247649A484A46129 E2A9F265B15D8C9DAE9D00ADFA41FDCBCEAEED90847015355292DD999D3D73E6 CC1873D71EF7E8C5C4813E1D0D6172D61D0E7AA0A89A76DEEA699A4DEDD2F0B9 A103E56E9AC7459CA56EA269CE8962ED98C268997DA7635B261DD0A163EDE063 EEAA2AA02BF3E6711230FEBD888B8481AA5A20CD5AE96A8E1CDA81A828662AFB 398F17A497A5054B0B95DECD18F8E5822805BB2DB4A8B84E8EC08F5C9EB382DC C46990DDE46AD3681B02860CD4A774A23A5FCF06DF88327143A63A18802BD01B 9F50E7841265CA16CC4D641A1FC09E7357E4428C4FF78991A6F151C43BA51743 07042FD5F57E9EE3BE7B18650BC6E137824B327E085E326747203CD480F95919 F110E629269DC429DA3CD7BF0A79863B87B0F7E5C0B11D1BFE2003F206BC4993 DCED98DDB17D015ED81371C99E2E1FDCA69D2E027193384C89CF443E2B1189A2 809771BC8BE8E0B32499B84110A72131E4EA74E6FAE52A62711821934D5DDF57 E0260E8A882807ED7D912A15378BEFA9F8B037C35788121120E4EC0E161D09A6 C8664B78EF85482EDE00A93A6EB4CAD3DB3055676E2214658DB0B986B0A9BF1C 220868880C6F9BAC15072D5F506DA53C48374110D807BF1869A1E5944EC727C7 F8C38588B34BA2A088D96D43285BB1FAD9353335D712CAA8DC34114A7C4F7017 2FC30F418826132CB79EA0C79397574934756B13A96CC41A49435BC5620E46C7 95B3E7E64C0819974885D0AA3385C1A873ECAC143ACA9134863F72EE8B581173 D1D0F8310B3116E654F6FC7A16756D9F97D35A3EFF5B5CD551437F58DAD5CA96 3A929535ACBAB02396CE97E5ABAAB72D6DC1C6EB1AED0194AE909F24ABCC0E7B D9326BE3E6F0C5FA5DE562F89A5AEDB2D45085AE1ECB5321B792A1DA074C8F57 4E0F51BFB87A7B97F279DFFA9945F02C8BF7055DF273CF4211BCB81ACB38CBF1 29E0949AA83AFCD102CCDC22DAE0FF125F6E2B00DE21918DBE5A0F87AA457A53 D25AE7F63513BCD97E6B976D657855DD9B7C556FFE923231E56A716E6AF3BEB3 1EB73CF71AD90B5AE2AF4EA7BD6DA6D76DF25498F295FD449847E647D3EA65B3 3B2E4EC15F3074FD006814E770CE3C3845AF06749204A43D07CE72C6172C686C 1D2F2FA747125A954893FFC3EDFC039C3D1A760A0A0000 } ] if not exists? %nomenu.tpl [ write %nomenu.tpl decompress #{ 789CAD556D6FDA3010FECEAFB8A6AAB4490B09B47C288D235192162468197557 F5D3E4246E92CD4B9863A0DDB41FB47FB973121874636DA7FA83E397E3B9E79E 3B1FCE9E77D9A7B7131F06743C82C9F5E968D807C3B4AC9BC3BE6579D4AB2E8E 9A3650C9B22255699E316159FE85E1361C7DE93A03BFE7B90E1DD291EF420387 B3679A80B63C98A722E2F2A34A95E0609AF5B555D9369CB14F7B90283533F9D7 79BA20FD3C533C53267D987108AB0D3114BF5756A2BE88130813260BAEC832CD A27C5998AD76A76DAC8006944E4CFFFDF5F00331262CE6A68F00D280FEE505F5 2F2831A67CC19928037903DE5C321D0D69BFFB1D1A691DBDD57857F476E48356 A6761F16059EB36E922FB884EF484EE4B20B8198F313D01666C4C3BC42ECC23C C3A8459AE15DC0C2CFB1CCF1A40BFB67C7BEE77BF00325283DA027AB54AFE19C 5E7AB710C47D8D4BF6ED72E031ED9D221126D2382321D7F16C2012C3802097E8 8BD8107221262C8AD22C26ED7277356361B54B781A27A864CBB60F0C58A6914A 8871DC39D0A152ED597FA77AF21EC3D78C840688257F8045AF24A3F2D99ADE6B 312A37DB9476330A041EAF705AB6EB4CB66472CB4A6390487E478CA68505C3EF 9BBA8A0CD7198ECF6BE380155C270AB7C846E7C29FC270DC3BF73702490AE4CD 7151C89018096778DCFC348B11C96295236B826BEAE969BA53CCA7A55BE5FFAE 1CAF2B253C2BBD355A1B05AD8574ACF5424565B42F016AD9EB7AD38CD6A08F5B C48CA94477880D6F28E74BBDEDA6FDCFC4E06B463D3372B82DE64B0ABCD5F9CF B4FC3DC28D52F943AABA31566AD52295E1E154E2E257D3DEA8C8DD374F3DFCBA 15ADC2E9A0EDA387E69C617FAD1A225926C813C97EE3A4E5F6F3D983D4BF829F D0B6ED63A0495AC00D0FE00AAD9A003D21A0342840F282CB058F9A8EA5E1DCED 07F5FCC050885A5AABFC736AFC02A1651F4AE3060000 } ] homepage: to-string first load %sitemap.r current-path: rejoin [ {} homepage {} ] begin-recurse: true recurse: func [page current-path][ either begin-recurse = true [ print-path: (to-string page/1) ] [ print-path: rejoin [current-path { : } (to-string page/1)] ] begin-recurse: false do/args %makedocsitebuilder.r (to-file page/1) either (page/2 = []) [ constructed: replace (read %nomenu.tpl) {} (read join to-file page/1 ".md") constructed: replace constructed {} (to-string page/1) constructed: replace constructed {} print-path ] [ constructed: replace (read %menu.tpl){}(read join to-file page/1 ".md") link-list: copy {} foreach item page/2 [ link-list: rejoin [ link-list { } {
} {} (to-string item/1) {} {
} newline ] ] constructed: replace constructed {} link-list constructed: replace constructed {} (to-string page/1) constructed: replace constructed {} print-path ] write (to-file join page/1 ".html") constructed print page/1 print { ... DONE
} if not (page/2 = []) [ if (to-string page/1) <> homepage [ current-path: rejoin [ current-path { : } (to-string page/1) {} ] ] foreach block page/2 [recurse block current-path] ] ] print {
} recurse mymap: load %sitemap.r current-path print rejoin [{

Back to Sitebuilder
}] if not exists? %index.html [ write %index.html rejoin [{
}] ] quit ] ; Print instructions: if submitted/6 = "instructions" [ print {
}
    print instructions: {
    REBOL WEB SITE BUILDER:

    This script enables you to easily create, edit, and arrange HTML pages on your web
    site.  The first step is to create and/or upload page content.  The built-in 
    WSYIWYG HTML editor allows you to layout pages visually, without having to write
    any code.  It works just like a word processor, except it runs directly in your
    browser, right on your web site.  You can adjust fonts, colors, and all essential
    formatting/layout options.  You can add tables, images, links, and other elements,
    all without writing any code.  Of course, if you prefer to write your own HTML code
    or copy/paste from other sources, you can switch instantly between visual and code
    view, for complete control and instant preview.  The built-in file upload allows
    you to upload any HTML files, scripts, images, or binary files of any sort,
    from any computer.  The template system automatically builds menu links to other
    pages, using a simple and quick site map layout that you specify, and the generated
    pages are all wrapped in templates that you can upload or create/edit directly online
    (2 generic templates are included to get you started).  Because this whole system
    runs in your browser, you can add pages, upload files, and edit site content
    instantly from any location, using any OS, without installing any software.


    CREATING AND EDITING PAGES:

    To create a new page for your web site, simply type in a name for the page and click
    the "Create New Page" link.  The visual editor will open, and you can begin editing
    content.  You can create new pages from scratch or copy/paste content directly into
    the visual view.  Page names should NEVER CONTAIN SPACES (use underscores instead),
    and should not have any file extensions.  It's suggested that title case be used for
    page names (every important word capitalized).

    To upload images, scripts, or any other content that you've created on your local 
    computer, simply click the "Choose" button and then the "Upload" button. 

    You can edit any text or code on a page, whether it was created using the online editor,
    or uploaded, by simply clicking the file name in "Edit Existing Pages".  To add an
    image to a page, simply click the image icon and type in the file name of any image
    that you've uploaded.  Adding, editing, and previewing scripts is as simple as clicking
    the HTML/Text button, and using the built-in preview button.  Centering and aligning
    content, changing font sizes, styles and colors, creating bulleted lists, and all 
    typical operations function just like they do in  most word processors.  Just select
    items and click on the icons to adjust your layout.  It's all very easy and intuitive,
    even for absolute beginners.


    THE SITE MAP:

    When you are done editing/uploading content pages, you will be asked if you want to add
    them as SUB-PAGES of other pages on your site.  A site map is automatically generated,
    and published pages contain automatically generated menus which enable users to easily
    navigate around your site.  The site map can be edited to easily arrange page links on
    your site, based on the simple sub-page layout.  Any page content added to the site map
    is also automatically framed in nicely designed templates, to give your entire site a
    consistent look and feel.

    If you want to edit the order of pages in your site map, or add/remove pages from your
    site, click the "Edit Site Map" link.  Starting with the home page, every entry in your
    site map is simply a BLOCK containing 2 items: 
 
    SOURCE FILE NAME:

        This is a file name containing page content that you've created, which you want
        to appear in an .html page of the same name on your site.  Content file names should
        be listed exactly as they were named when creating or uploading them, as they appear
        in the edit list.  In the site map, all source file names MUST BE PRECEDED BY A
        PERCENT SYMBOL ("%").

    SUB-PAGE LINKS: 

        Each page entry in your site map must be followed by a pair of square brackets.
        These brackets contain a block of links to other pages on the site, to appear in a
        link menu on the current page.  The home page can contain as many sub-pages (menu 
        links) as you want, and any sub-pages can contain as many sub-page links as you want,
        and so on, for as many levels deep as you want.  

    Your site map must have one and only one "home" page.  It can be any file name you've
    created - typically "Home" (a %Home file is automatically created when this script is
    first run).  This script automatically creates an index.html page that forwards to
    your home page, if no index.html exists.  It's recommended that you keep your home page
    file named "Home".

    Here's an example of how your site map would look if you only wanted one page to appear
    on your web site, labeled "Home.html":

    %Home []

    The file name (%Home above) contains the name of a source file to be processed (a 
    content file that you've previously uploaded or created with the built-in editor).
    The block following it (empty above) contains the names of any SUB-PAGES that will
    be processed and automatically linked to it (none in the case above).

    Below is an example of how the site map would look if you wanted a site made up of a
    home page and two sub-pages.  Home.html, Page_One.html and Page_Two.html would all be
    created from the source files listed, and a menu bar would be automatically generated
    and placed on Home.html, linking to the 2 other pages.  Neither Page_One.html nor
    Page_Two.html would contain any menu bars with links, because they don't contain any
    sub-pages:

    %Home [                         ; your home page (index.html forwards to it)
        [%Page_One []]              ; Page_One.html appears in the menu bar of Home.html
        [%Page_Two []]              ; Page_Two.html appears in the menu bar of Home.html
    ]

    The next example site map below contains a home page with 5 sub pages, the 3rd of
    which contains 2 sub pages, and the 2nd of that contains 3 sub pages.  In the
    generated .html pages, link menus are only placed on pages which have sub-pages (i.e.,
    only Home.html, Page_Three.html and Page_Three_B.html below would contain link menus):

    %Home [                      ; your home page
        [%Page_One []]           ; Page_One.html appears in the menu bar of Home.html
        [%Page_Two []]           ; Page_Two.html appears in the menu bar of Home.html
        [%Page_Three [           ; Page_Three.html appears in the menu bar of Home.html
            [%Page_Three_A []]   ; Page_Three_A.html appears in the menu bar of Page_Three_A.html
            [%Page_Three_B [     ; Page_Three_B.html appears in the menu bar of Page_Three_B.html
                [%Page_3_B_1 []] ; Page_3_B_1.html appears in the menu bar of Page_Three_B.html
                [%Page_3_B_2 []] ; Page_3_B_2.html appears in the menu bar of Page_Three_B.html
                [%Page_3_B_3 []] ; Page_3_B_3.html appears in the menu bar of Page_Three_B.html
            ]]
        ]]
        [%Page_Four []]          ; Page_Four.html appears in the menu bar of Home.html
        [%Page_Five []]          ; Page_Five.html appears in the menu bar of Home.html
    ]

    The key to understanding the site map is that any source file names followed by a 
    link block will contain an auto-generated menu of links to those sub-pages in the
    created .html file.  Pages without link blocks do not contain any sub-page links.
    They are simply wrapped in a template.  Of course, you can manually link to any page
    that you've created, if you don't want any auto-generated link menus or template
    design to appear on your site.  You can use this script to simply upload content,
    or to create/edit HTML/script files.  If that's the case, you don't need to create
    a site map.

    Once you've finished creating content files, and have arranged them into a site map,
    simply click the "Build Site" link.  You can then view the generated web site by
    clicking the "View Home Page" link.


    OTHER FEATURES:

    If you need to perform any file or OS operations, click the "Console" link.  You can
    run operating system commands using the following format (replace "dir" with any OS
    command):

        call {dir}

    You can also use the console to run any REBOL functions/scripts (for any sort of batch
    file operations, text searches, to download file/directories from other FTP sites, etc.).
    This adds enormous power to the system:

        rename %oldfile.txt %newfile.txt
        delete %unwanted_file.txt
        foreach file (read ftp://u:%p--site--com/) [write file read (join http://site.com/ file)]
        (You can perform almost any non-interactive operation possible in the REBOL console)

    During use, backups are automatically created of any file which is edited using the
    built-in editor (saved in the %./edit_history subfolder), so you can always easily fix
    mistakes or revert to previous versions of a page or site map.  It's all extremely SIMPLE
    and QUICK to implement and use.  New users can learn the system in a matter of minutes
    (the syntax pattern for editing the site map is the only thing that requires any thought
    whatsoever, and that's only necessary if you want to make _changes_ to the site layout).


    INSTALLATION:

    To install, just copy this script and an appropriate REBOL interpreter to your web server,
    (version 2.76+ is required for console operations), set permissions and the shebang line
    of this script, then start adding/editing pages to your site.


    TEMPLATE FILES (for advanced users):

    Two generic page templates are built into this script, but ANY HTML template can be added
    and used on your site.  Template files are simply HTML files that act as a "frame" for new
    content that you create with this script.  They can be edited to radically change the look, 
    feel, and design of destination .html files generated by this script.

    Templates are extremely simple to create.  They can be created/edited directly online using
    the built-in editor, or uploaded and edited later using this script.  IMPORTANT:  Code files
    such as templates should be edited using the plain text editor (with no visual WYSIWYG),
    available by clicking the "Files" link, next to the "Upload" button on the main page of this
    script.

    NOTE:  The built-in templates insert a header image at the top of every page (%header.jpg
    by default).  If you want to use the built-in templates, you can simply upload a header
    image to appear at the top of every page in your site.  Just create your own image, save it
    as "header.jpg" and use the built-in upload facility to upload it to your web site.  That's
    all you need to do to create a minimally unique design for different sites.  If you do this,
    try to keep the header.jpg image download size small.  You can reduce the .jpg quality and
    number of colors in your image editing software.  The shape of a header image should be like
    a banner - avoid letting it get too wide or too tall, or it will take up too much screen
    real estate on your site (500x100 pixels is a good ball park size for the built in templates).

    Templates contain 4 short lines of code that indicate where the source file text/code should
    be placed on your destination pages, and where the link menu should be placed on pages with
    sub-page link blocks.  You can use existing HTML pages to create templates or create
    completely new designs for every web site.  To make them work with this script, simply insert
    the codes below where you want the content to appear on generated destination pages:

    sitebuilder_title     ; Page title in head tag  ** By default same as the source file name **
    sitebuilder_links     ; Link menu(s) generated by this script (as defined in your site map)
    sitebuilder_path      ; Links through the hierarchy of sub-pages, back to your home page
    sitebuilder_content   ; All of the data contained in the source file of each content page

    There are two main types of templates:  those with menu bars, and those without.  The built-
    in template %menu.tpl displays a menu of links on the left side of the page (each with a text
    rollover effect).  The %menu.tpl file is used for any source pages that have ONE OR MORE sub-
    page(s) in the link block.  The built-in %nomenu.tpl template is used for pages with EMPTY
    link blocks.  You can edit the built-in template files, or create new HTML templates from 
    scratch.  It literally takes just a few seconds to create template files from existing HTML
    pages.  Examine the built in templates to see how it works - it's very straightforward.
    Simply name your templates menu.tpl and nomenu.tpl, then upload them to the folder on your
    server which contains this script.  
    }
    print {
}
    quit
]

quit