Permalink
Browse files

Prepend URIPrefix to web interface links

Prefix links in templates with URIPrefix and add the input field to the
Listener editor.

The URIPrefix is provided as a top-level template variable. All URIs
have been changed to have the prefix prepended.
  • Loading branch information...
1 parent d796fc8 commit 4376b373d841253c8a6dac4207567d4661724432 @uu1101 uu1101 committed Feb 8, 2014
@@ -1,12 +1,12 @@
<? INC Header.tmpl ?>
<? IF Cert ?>
-<p>You already have a certificate set, use the form below to overwrite the current certificate. Alternatively click <a href="<? VAR ModPath ?>delete">here</a> to <a href="<? VAR ModPath ?>delete">delete</a> your certificate.</p>
+<p>You already have a certificate set, use the form below to overwrite the current certificate. Alternatively click <a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?>delete">here</a> to <a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?>delete">delete</a> your certificate.</p>
<? ELSE ?>
<p>You do not have a cert.</p>
<? ENDIF ?>
-<form method="post" action="<? VAR ModPath ?>update">
+<form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath ?>update">
<? INC _csrf_check.tmpl ?>
<div class="section">
<h3>Certificate</h3>
@@ -1,6 +1,6 @@
<? INC Header.tmpl ?>
-<form method="post" action="<? VAR ModPath ?>add">
+<form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath ?>add">
<? INC _csrf_check.tmpl ?>
<div class="section">
<h3>Add A Note</h3>
@@ -17,8 +17,8 @@
<td><? VAR LastSeen DEFAULT="- unknown -" ?></td>
<td><? VAR Info ?></td>
<? IF WebAdminLoaded TOP ?><td><span class="nowrap">
- [<a href="/mods/global/webadmin/edituser?user=<?VAR Username ESC=URL?>">Edit</a>]
- <? IF !IsSelf ?>[<a href="/mods/global/webadmin/deluser?user=<?VAR Username ESC=URL?>">Delete</a>]<? ENDIF ?>
+ [<a href="<? VAR URIPrefix TOP ?>/mods/global/webadmin/edituser?user=<?VAR Username ESC=URL?>">Edit</a>]
+ <? IF !IsSelf ?>[<a href="<? VAR URIPrefix TOP ?>/mods/global/webadmin/deluser?user=<?VAR Username ESC=URL?>">Delete</a>]<? ENDIF ?>
</span></td><? ENDIF ?>
</tr>
<? ENDLOOP ?>
@@ -1,6 +1,6 @@
<? INC Header.tmpl ?>
-<form method="post" action="<? VAR ModPath ?>addnote">
+<form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath ?>addnote">
<? INC _csrf_check.tmpl ?>
<div class="section">
<h3>Add A Note</h3>
@@ -37,7 +37,7 @@
<tbody>
<? LOOP NotesLoop ?>
<tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>">
- <td><a href="<? VAR ModPath TOP ?>delnote?key=<? VAR Key ESC=URL,HTML ?>"><img src="<? VAR ModFilesPath TOP ?>trash.gif" alt="[del]" /></a></td>
+ <td><a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>delnote?key=<? VAR Key ESC=URL,HTML ?>"><img src="<? VAR URIPrefix TOP ?><? VAR ModFilesPath TOP ?>trash.gif" alt="[del]" /></a></td>
<td><? VAR Key ?></td>
<td><? VAR Note ?></td>
</tr>
@@ -1,6 +1,6 @@
<? INC Header.tmpl ?>
-<form method="post" action="<? VAR ModPath ?>">
+<form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath ?>">
<? INC _csrf_check.tmpl ?>
<div class="section">
<h3>Perform</h3>
@@ -1,7 +1,7 @@
<? ADDROW JSLoop HREF=/modfiles/user/send_raw/select.js ?>
<? INC Header.tmpl ?>
-<form method="post" action="<? VAR ModPath ?>">
+<form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath ?>">
<? INC _csrf_check.tmpl ?>
<div class="section">
@@ -1,6 +1,6 @@
<? INC Header.tmpl ?>
-<form action="" method="post">
+<form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>">
<? INC _csrf_check.tmpl ?>
<table class="data">
<thead>
@@ -1,6 +1,6 @@
<? INC Header.tmpl ?>
-<form action="<? IF Edit ?>editchan<? ELSE ?>addchan<? ENDIF ?>" method="post">
+<form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?><? IF Edit ?>editchan<? ELSE ?>addchan<? ENDIF ?>" method="post">
<? INC _csrf_check.tmpl ?>
<div class="section">
<input type="hidden" name="submitted" value="1" />
@@ -5,7 +5,7 @@
<p>To connect to this network from your IRC client, you can set the server password field as follows: <code><? VAR Username ?>/<? IF Edit ?><? VAR Name ?><? ELSE ?>&lt;network&gt;<? ENDIF ?>:&lt;password&gt;</code> or username field as <code><? VAR Username ?>/<? IF Edit ?><? VAR Name ?><? ELSE ?>&lt;network&gt;<? ENDIF ?></code></p>
</div>
-<form action="<? IF Edit ?>editnetwork<? ELSE ?>addnetwork<? ENDIF ?>" method="post">
+<form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?><? IF Edit ?>editnetwork<? ELSE ?>addnetwork<? ENDIF ?>" method="post">
<? INC _csrf_check.tmpl ?>
<div class="section">
<input type="hidden" name="submitted" value="1" />
@@ -116,7 +116,7 @@
<table>
<thead>
<tr>
- <td>[<a href="addchan?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Name ESC=URL ?>">Add</a>]</td>
+ <td>[<a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>addchan?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Name ESC=URL ?>">Add</a>]</td>
<? IF ChannelLoop ?>
<td>Save</td>
<td>Name</td>
@@ -135,7 +135,7 @@
<tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>">
<td>
<input type="hidden" name="channel" value="<? VAR Name ?>" />
- [<a href="editchan?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Network ESC=URL ?>&amp;name=<? VAR Name ESC=URL ?>">Edit</a>] [<a href="delchan?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Network ESC=URL ?>&amp;name=<? VAR Name ESC=URL ?>">Del</a>]
+ [<a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>editchan?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Network ESC=URL ?>&amp;name=<? VAR Name ESC=URL ?>">Edit</a>] [<a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>delchan?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Network ESC=URL ?>&amp;name=<? VAR Name ESC=URL ?>">Del</a>]
</td>
<td><input type="checkbox" name="save_<? VAR Name ?>"<? IF InConfig ?> checked="checked"<? ENDIF ?> /></td>
<td><? VAR Name ?></td>
@@ -1,6 +1,6 @@
<? INC Header.tmpl ?>
-<form action="<? IF Edit ?>edituser<? ELSE ?>adduser<? ENDIF ?>" method="post">
+<form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?><? IF Edit ?>edituser<? ELSE ?>adduser<? ENDIF ?>" method="post">
<? INC _csrf_check.tmpl ?>
<div class="section">
<input type="hidden" name="submitted" value="1" />
@@ -128,7 +128,7 @@
<table>
<thead>
<tr>
- <td>[<a href="addnetwork?user=<? VAR Username ESC=URL ?>">Add</a>]</td>
+ <td>[<a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>addnetwork?user=<? VAR Username ESC=URL ?>">Add</a>]</td>
<? IF NetworkLoop ?>
<td>Name</td>
<td>Clients</td>
@@ -145,7 +145,7 @@
<tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>">
<td>
<input type="hidden" name="network" value="<? VAR Name ?>" />
- [<a href="editnetwork?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Name ESC=URL ?>">Edit</a>] [<a href="delnetwork?user=<? VAR Username ESC=URL ?>&amp;name=<? VAR Name ESC=URL ?>">Del</a>]
+ [<a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>editnetwork?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Name ESC=URL ?>">Edit</a>] [<a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>delnetwork?user=<? VAR Username ESC=URL ?>&amp;name=<? VAR Name ESC=URL ?>">Del</a>]
</td>
<td><? VAR Name ?></td>
<td><? VAR Clients ?></td>
@@ -6,13 +6,13 @@
<div class="sectionbody">
<div class="subsection">
Are you sure you want to delete "<? VAR Username ?>/<? VAR Network ?>"?
- <form action="delnetwork" method="post">
+ <form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>delnetwork" method="post">
<? INC _csrf_check.tmpl ?>
<input type="hidden" name="user" value="<? VAR Username ?>" />
<input type="hidden" name="name" value="<? VAR Network ?>" />
<div class="yesnobutton"><input type="submit" value="Yes" /></div>
</form>
- <form action="listusers" method="get">
+ <form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>listusers" method="get">
<div class="yesnobutton"><input type="submit" value="No" /></div>
</form>
</div>
@@ -6,13 +6,13 @@
<div class="sectionbody">
<div class="subsection">
Are you sure you want to delete "<? VAR Username ?>"?
- <form action="deluser" method="post">
+ <form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>deluser" method="post">
<? INC _csrf_check.tmpl ?>
<input type="hidden" name="submitted" value="1" />
<input type="hidden" name="user" value="<? VAR Username ?>" />
<div class="yesnobutton"><input type="submit" value="Yes" /></div>
</form>
- <form action="listusers" method="get">
+ <form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>listusers" method="get">
<div class="yesnobutton"><input type="submit" value="No" /></div>
</form>
</div>
@@ -2,7 +2,7 @@
<?IF !UserLoop?>
<div class="textsection">
- There are no users defined. Click <a href="adduser">here</a> if you would like to add one.
+ There are no users defined. Click <a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>adduser">here</a> if you would like to add one.
</div>
<?ELSE?>
<div class="toptable">
@@ -21,9 +21,9 @@
<tr class="<?IF __EVEN__?>evenrow<?ELSE?>oddrow<?ENDIF?>">
<td>
<span class="nowrap">
- [<a href="edituser?user=<?VAR Username ESC=URL?>">Edit</a>]
- [<a href="adduser?clone=<? VAR Username ESC=URL ?>" alt="Clone <? VAR Username ESC=URL ?>">Clone</a>]
- <? IF !IsSelf ?>[<a href="deluser?user=<?VAR Username ESC=URL?>">Delete</a>]<? ENDIF ?>
+ [<a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>edituser?user=<?VAR Username ESC=URL?>">Edit</a>]
+ [<a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>adduser?clone=<? VAR Username ESC=URL ?>" alt="Clone <? VAR Username ESC=URL ?>">Clone</a>]
+ <? IF !IsSelf ?>[<a href="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>deluser?user=<?VAR Username ESC=URL?>">Delete</a>]<? ENDIF ?>
</span>
</td>
<td><? VAR Username ?></td>
@@ -42,7 +42,7 @@
<td><? VAR URIPrefix ?></td>
<td>
<? IF SuggestDeletion ?>
- <form action="del_listener" method="post">
+ <form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>del_listener" method="post">
<? INC _csrf_check.tmpl ?>
<input name="host" type="hidden" value="<? VAR BindHost ?>"/>
<input name="port" type="hidden" value="<? VAR Port ?>"/>
@@ -55,7 +55,7 @@
</tr>
<? ENDLOOP ?>
<tr>
- <form action="add_listener" method="post">
+ <form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>add_listener" method="post">
<? INC _csrf_check.tmpl ?>
<td><input name="port" type="number" min="1" max="65535" class="number"/></td>
<td><input name="host" type="text" value="*" class="sixth"/></td>
@@ -74,7 +74,7 @@
</div>
</div>
-<form action="settings" method="post">
+<form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>settings" method="post">
<? INC _csrf_check.tmpl ?>
<input type="hidden" name="submitted" value="1" />
View
@@ -325,6 +325,7 @@ void CWebSock::SetVars() {
m_Template["Version"] = CZNC::GetVersion();
m_Template["SkinName"] = GetSkinName();
m_Template["_CSRF_Check"] = GetCSRFCheck();
+ m_Template["URIPrefix"] = GetURIPrefix();
if (GetSession()->IsAdmin()) {
m_Template["IsAdmin"] = "true";
@@ -473,6 +474,7 @@ CWebSock::EPageReqResult CWebSock::PrintStaticFile(const CString& sPath, CString
CWebSock::EPageReqResult CWebSock::PrintTemplate(const CString& sPageName, CString& sPageRet, CModule* pModule) {
SetVars();
+
m_Template["PageName"] = sPageName;
if (pModule) {
@@ -247,6 +247,11 @@ input.third, textarea.third,
width: 150px;
}
+input.sixth, textarea.sixth,
+.sixth input, .sixth textarea {
+ width: 75px;
+}
+
input.number {
width: 40px;
}
@@ -299,7 +304,7 @@ tr.evenrow td {
.subsection input, .subsection select, .subsection textarea {
margin: 5px 0 5px 0;
- min-width: 100px;
+ min-width: 75px;
vertical-align: middle;
}
@@ -6,11 +6,11 @@
<meta charset="UTF-8" />
<title>ZNC - <? VAR Title DEFAULT="Web Frontend" ?></title>
<? LOOP CSSLoop ?>
- <?IF HREF?><link rel="stylesheet" type="text/css" href="<? VAR HREF ?>" /><?ENDIF?>
+ <?IF HREF?><link rel="stylesheet" type="text/css" href="<? VAR URIPrefix TOP ?><? VAR HREF ?>" /><?ENDIF?>
<?ENDLOOP?>
<? LOOP JSLoop ?>
- <?IF HREF?><script type="text/javascript" src="<? VAR HREF ?>"></script><?ENDIF?>
+ <?IF HREF?><script type="text/javascript" src="<? VAR URIPrefix TOP ?><? VAR HREF ?>"></script><?ENDIF?>
<?ENDLOOP?>
<? INC ExtraHeader.tmpl ?>
@@ -1,9 +1,9 @@
<? IF LoggedIn ?>
- <span class="logoutbox"><a href="/logout">Logout</a></span>
+ <span class="logoutbox"><a href="<? VAR URIPrefix TOP ?>/logout">Logout</a></span>
<? ELSE IF !ModName && PageName == "login" ?>
<span class="logoutbox">&nbsp;</span>
<? ELSE ?>
- <form action="/login" method="post">
+ <form action="<? VAR URIPrefix TOP ?>/login" method="post">
<div class="loginbox">
<input type="hidden" name="submitted" value="1" />
User:<input type="text" name="user" />
@@ -1,14 +1,14 @@
<div id="menu">
<ul class="nav">
- <li class="topitem<? IF !ModName && PageName == "index" ?> active<? ENDIF ?>"><a href="/">Home</a></li>
+ <li class="topitem<? IF !ModName && PageName == "index" ?> active<? ENDIF ?>"><a href="<? VAR URIPrefix TOP ?>/">Home</a></li>
<? IF GlobalModLoop ?>
<li class="topitem parent"><span class="title">Global Modules</span>
<ul>
<? LOOP GlobalModLoop SORTASC=ModName ?>
- <li class="modtitle<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR ModPath ?>"><? VAR Title ?></a></li>
+ <li class="modtitle<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?>"><? VAR Title ?></a></li>
<? LOOP SubPageLoop ?>
- <li class="subitem<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR ModPath ?><? VAR PageName ?><? IF Params ?>?<? VAR Params ?><? ENDIF ?>"><? VAR Title ?></a></li>
+ <li class="subitem<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?><? VAR PageName ?><? IF Params ?>?<? VAR Params ?><? ENDIF ?>"><? VAR Title ?></a></li>
<? ENDLOOP ?>
<? ENDLOOP ?>
</ul>
@@ -19,9 +19,9 @@
<li class="topitem parent"><span class="title">User Modules</span>
<ul>
<? LOOP UserModLoop SORTASC=ModName ?>
- <li class="modtitle<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR ModPath ?>"><? VAR Title ?></a></li>
+ <li class="modtitle<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?>"><? VAR Title ?></a></li>
<? LOOP SubPageLoop ?>
- <li class="subitem<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR ModPath ?><? VAR PageName ?><? IF Params ?>?<? VAR Params ?><? ENDIF ?>"><? VAR Title ?></a></li>
+ <li class="subitem<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?><? VAR PageName ?><? IF Params ?>?<? VAR Params ?><? ENDIF ?>"><? VAR Title ?></a></li>
<? ENDLOOP ?>
<? ENDLOOP ?>
</ul>
@@ -34,9 +34,9 @@
<li class="topitem parent"><span class="title">Network Modules (<? VAR NetworkName ?>)</span>
<ul>
<? LOOP ModLoop SORTASC=ModName ?>
- <li class="modtitle<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR ModPath ?>"><? VAR Title ?></a></li>
+ <li class="modtitle<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?>"><? VAR Title ?></a></li>
<? LOOP SubPageLoop ?>
- <li class="subitem<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR ModPath ?><? VAR PageName ?><? IF Params ?>?<? VAR Params ?><? ENDIF ?>"><? VAR Title ?></a></li>
+ <li class="subitem<? IF Active ?> active<? ENDIF ?>"><a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?><? VAR PageName ?><? IF Params ?>?<? VAR Params ?><? ENDIF ?>"><? VAR Title ?></a></li>
<? ENDLOOP ?>
<? ENDLOOP ?>
</ul>
@@ -167,6 +167,11 @@ input.third, textarea.third,
width: 100px;
}
+input.sixth, textarea.sixth,
+.sixth input, .sixth textarea {
+ width: 50px;
+}
+
.checkboxandlabel {
white-space: nowrap;
}
View
@@ -141,6 +141,11 @@ input.third, textarea.third,
width: 125px;
}
+input.sixth, textarea.sixth,
+.sixth input, .sixth textarea {
+ width: 62px;
+}
+
.subsection div.checkbox {
padding: 9px 0 0 3px;
}

0 comments on commit 4376b37

Please sign in to comment.