Both sides previous revisionPrevious revisionNext revision | Previous revision |
custom:ssjs_template [2021/01/27 21:30] – "Footer" is apparently a special word in Dokuwiki, so we'll use some wacky cyrillic o's to get around that fuckery with some other fuckery. ecbbs | custom:ssjs_template [2021/02/19 11:35] (current) – [The SSJS Template Scheme] beautify (haha) and add useful example mortifis |
---|
privacy statements or anything else can be placed here and they will | privacy statements or anything else can be placed here and they will |
be displayed at the bottom of each page. | be displayed at the bottom of each page. |
| |
| === Custom .inc === |
| |
| To Add a custom link to the left side navigation list **using the nightshade theme** edit ''../web/lib/nightshade/leftnav_html.ssjs'' |
| and add the link to the list. \\ |
| note: the link expects an html tag "<li><a href="some-script.ssjs">My Link</a></li>" |
| |
| <code left_nav> |
| template.leftnav.push({html: '<li><a href="/members/externals.ssjs">External Programs</a></li><li><a href="logout.ssjs">Logout</a></li><li><a href="/members/lastcallers.ssjs">Last Callers</a></li><li><a href="/members/info.ssjs">Information</a></li><li><a href="/members/newpw.ssjs">Change Password</a></li><li><a href="/logout.ssjs">Logout</a></li><li><a href="/msgs/msgs.ssjs?msg_sub=mail">E-mail</a></li>' }); |
| </code> |
| |
| Here we added the link **Logout** to the left side navigation that points to logout.ssjs. |
| Now create the script called ''../web/root/logout.ssjs'' |
| |
| <code bbs> |
| <!-- ../web/root/logout.ssjs --> |
| |
| template.logout = '<br><br>'+user.alias+' Logging out ...<br><br><br>'; |
| write('<meta http-equiv="refresh" content="2; url=index.ssjs">'); |
| |
| user.number = 0; |
| |
| if(do_header) |
| write_template("header.inc"); |
| if(do_topnav) |
| load(topnav_html); |
| if(do_leftnav) |
| load(leftnav_html); |
| if(do_rightnav) |
| write_template("rightnav.inc"); |
| write_template("logout.inc"); |
| if(do_footer) |
| write_template("footer.inc"); |
| |
| </code> |
| |
| Now you need a corresponding ../web/root/templates/nightshade/logout.inc |
| |
| <code logout> |
| <!-- ../web/templates/nightshade/logout.inc --> |
| |
| <div id="contentcontainer"> |
| <div id="content2"> |
| @@logout@@ |
| </div> |
| </div> |
| </code> |
| |
| |
inefficient to have thirty of forty message definitions being loaded when a | inefficient to have thirty of forty message definitions being loaded when a |
user is looking at the statistics page. | user is looking at the statistics page. |
| |
| ===== Embedding fTelnet ===== |
| |
| To add an fTelnet Logon Screen to your Main landing page there are a few steps you can follow |
| |
| 1). Copy ../web/root/ftlnet.ssjs to ftelnet_main.ssjs |
| 2). Edit ../web/root/ftelnet_main.ssjs and **remove** (otherwise just using ftelnet.ssjs there would be a mirroring of the leftnav) |
| <code del_if_do> |
| |
| /* comment out this |
| if(do_header) |
| write_template("header.inc"); |
| if(do_topnav) |
| load(topnav_html); |
| if(do_leftnav) |
| load(leftnav_html); |
| if(do_rightnav) |
| write_template("rightnav.inc"); |
| write_template(templatefile); |
| if(do_footer) |
| write_template("footer.inc"); |
| */ |
| |
| </code> |
| |
| 3). Continuing editing ../web/root/ftelnet_main.ssjs and add contents of the ftelent spalsh screen |
| <code spalsh> |
| |
| template.splash = 'G1swOzQwOzM3bQ0KG1sxOzMwbSQkJCQkyMjIyMjIJCQkJCQkJCQkJMjIyMjIyCQkJCQkJCQkJCQkJCQkJCQkJCQkJLy8vLy8vCQkJCQkJCQkJCQkJCQkJCQkvLy8vLy8JCQNCiQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJLy8vP0nG1szMW0sG1swOzMxbSwsLHl5eXkkJCQkIBtbMTszMG0kJCQkJCS8vLy8vLwkJCQkJCQkJCQkJCQkDQokJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQgG1swOzMxbSQkJCQbWzFt/RtbMDszMW39/f0nJycnJCQkG1sxbSQgG1szMG0kJCQkJCQgG1szMW0kJCQkG1swOzMxbXl5eXksLCwsG1sxOzMwbWD9vLy8JA0KJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkIBtbMzFtJBtbMDszMW0kJBtbMW0kIBtbMzBteXl5JCS8IBtbMzFtJBtbMDszMW0kJB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G1swOzMxbSQbWzFtJBtbMDszMW0kIBtbMTszMG0kDQokJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCAbWzA7MzFtJCQkJHl5eRtbMW15G1swOzMxbSwbWzFtLCwbWzA7MzFtLBtbMW0kJBtbMDszMW0kG1sxbSQgG1szMG0kJEkkIBtbMDszMW0kJCQkIBtbMTszMG0kJCS8vLwgG1swOzMxbSQkG1sxbSQkIBtbMzBtJA0KJCQkJCQkG1swbW0bWzE7MzBtJBtbMG1vG1sxOzMwbSQbWzBtchtbMTszMG0kG1swbXQbWzE7MzBtJBtbMG1pG1sxOzMwbSQbWzBtZhtbMTszMG0kG1swbWkbWzE7MzBtJBtbMG1zG1sxOzMwbSQkG1swbTIbWzE7MzBtJBtbMG0wG1sxOzMwbSQbWzBtMhtbMTszMG0kG1swbTEbWzE7MzBtJCQkJCQkJCR5eXl5IBtbMDszMW1gYGBgG1sxbf0bWzA7MzFt/RtbMW39G1swOzMxbf0gG1sxOzMwbXl5eXkkJDskIBtbMDszMW0kJCQkLBtbMW0sG1swOzMxbSwsG1sxbXkbWzA7MzFteRtbMW15eRtbMDszMW0kG1sxbSQkJCAbWzMwbSQNCiQkJCQkJCQkJCQkJCQkJCQkyP39/bwkJCQkJCQkJCQkJCQkJCQkJCQkU7z9/f28UyQkJCQkJCQkJCR8JHl5eXkgG1swOzMxbf39G1sxbf0bWzA7MzFt/ScbWzFtJycnIBtbMzBteXl5eSQNCg=='; |
| |
| </code> |
| |
| 4). optionally you can visit https://embed-v2.ftelnet.ca/ and using their form generate the code using an ansi of your choosing. |
| note: you only need to copy/paste the Options.SplashScreen= 'whatever code' and save it as template.splash similar to above. |
| close and save. |
| |
| 5). add template.splash = '' value from above in ftelnet.ssjs as well |
| |
| 6). edit ../web/templates/nightshade/ftelnet.inc and add Options.SplashScreen = '@@splash@@'; |
| your ../web/templates/nightshade/ftelnet.inc options should like similar to |
| |
| <code opts> |
| |
| <!-- fTelnet --> |
| |
| <div id="fTelnetContainer" class="fTelnetContainer"></div> |
| <script>document.write('<script src="//embed-v2.ftelnet.ca/js/ftelnet-loader.norip.xfer.js?v=' + (new Date()).getTime() + '"><\/script>');</script> |
| <script> |
| var WSS = (location.protocol.toLowerCase() == 'https:'); |
| var Options = new fTelnetOptions(); |
| Options.BareLFtoCRLF = false; |
| Options.BitsPerSecond = 57600; |
| Options.ConnectionType = 'telnet'; |
| Options.Emulation = 'ansi-bbs'; |
| Options.Enter = '\r'; |
| Options.Font = 'CP437'; |
| Options.ForceWss = false; |
| Options.Hostname = '@@HostName@@'; |
| Options.LocalEcho = false; |
| Options.Port = (WSS ? @@WSSPort@@ : @@WSPort@@); |
| Options.ScreenColumns = 80; |
| Options.ScreenRows = 25; |
| Options.WebSocketUrlPath = '/?Port=@@TelnetPort@@'; |
| Options.SplashScreen = '@@splash@@'; |
| var fTelnet = new fTelnetClient('fTelnetContainer', Options); |
| </script> |
| |
| <!-- end fTelnet --> |
| </code> |
| |
| 7). edit ../web/root/index.ssjs and have it look similar to |
| |
| <code ibdx> |
| if(do_rightnav) |
| write_template("rightnav.inc"); |
| |
| //write_template("main.inc"); /* comment this out */ |
| |
| load('ftelnet_main.ssjs'); /* add this (this will add ftlenet logon screen to the main center portion */ |
| |
| if(do_footer) |
| write_template("footer.inc"); |
| |
| </code> |
| |
| 8). edit ../web/templates/nightshade/leftnav.inc and add an <li><a href="/ftelnet.ssjs">fTelnet Login</a></li> link to the exist nav list |
| |
| <code lnav> |
| |
| !-- Begin Left Nav --> |
| |
| <div id="navcontainer"> |
| <div id="navigation"> |
| <h4>Navigation</h4> |
| <ul> |
| <li><a href="/nodelist.ssjs">Who's Online</a></li><li><a href="/ftelnet.ssjs">fTelnet Login</a></li><<REPEAT leftnav>>@@leftnav:html@@<<END REPEAT leftnav>></ul> |
| </div> |
| </div> |
| |
| <!-- End Left Nav --> |
| |
| </code> |
| |
| 9). Confirm that your ws/wss ports are configured properly in ../ctrl/modopts.ini and that enabled and router ports are listening |
| |
| You should now have fTelnet links and fTelnet Logon Screen with a custom splash |
| |
| |
| |
===== See Also ===== | ===== See Also ===== |