From: <abe...@us...> - 2013-09-07 04:14:23
|
Revision: 6189 http://sourceforge.net/p/astlinux/code/6189 Author: abelbeck Date: 2013-09-07 04:14:20 +0000 (Sat, 07 Sep 2013) Log Message: ----------- web interface, make Edit tab shortcuts easier to define in the Prefs tab, multi-line return separated Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/prefs.php Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2013-09-06 23:45:01 UTC (rev 6188) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2013-09-07 04:14:20 UTC (rev 6189) @@ -10,6 +10,7 @@ // 04-28-2008 // 12-04-2008, Added Reload/Restart Menu // 02-18-2013, Added OpenVPN Client Config editing +// 09-06-2013, Added Shortcut support // $myself = $_SERVER['PHP_SELF']; @@ -598,14 +599,14 @@ putHtml('<table width="100%" class="stdtable">'); putHtml('<tr><td width="400" style="text-align: center;">'); foreach (explode(' ', $shortcut_str) as $shortcut) { - if (trim($shortcut) !== '') { + if ($shortcut !== '') { if (($pos = strpos($shortcut, '~')) !== FALSE) { $shortcut_label = substr($shortcut, $pos + 1); $shortcut = substr($shortcut, 0, $pos); } else { $shortcut_label = basename($shortcut); } - putHtml('<a href="'.$myself.'?file='.$shortcut.'" class="headerText">'.$shortcut_label.'</a>'); + putHtml('<a href="'.$myself.'?file='.$shortcut.'" class="headerText">'.htmlspecialchars($shortcut_label).'</a>'); } } putHtml('</td></tr></table>'); Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2013-09-06 23:45:01 UTC (rev 6188) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2013-09-07 04:14:20 UTC (rev 6189) @@ -16,6 +16,7 @@ // 09-28-2012, Added Show Latest System Logs/Hide Log Words // 09-28-2012, Added Show Custom Asterisk Command // 01-20-2013, Added Show XMPP Server Status +// 09-06-2013, Added Edit Tab Shortcut support // $myself = $_SERVER['PHP_SELF']; @@ -301,7 +302,12 @@ $value = 'edit_text_rows_cmdstr = "'.$value.'"'; fwrite($fp, $value."\n"); } - $value = 'edit_text_shortcut_cmdstr = "'.tuqp($_POST['edittext_shortcut']).'"'; + $value = tuqp(str_replace(chr(13), ' ', $_POST['edittext_shortcut'])); + $value = str_replace(chr(10), '', $value); + if (strlen($value) > 900) { // 1024 total line limit for prefs + $value = substr($value, 0, 900); + } + $value = 'edit_text_shortcut_cmdstr = "'.$value.'"'; fwrite($fp, $value."\n"); if (isset($_POST['backup_hostname_domain'])) { @@ -916,9 +922,17 @@ } putHtml('<input type="text" size="6" maxlength="2" value="'.$value.'" name="text_rows" /></td></tr>'); - putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">Shortcuts:</td><td colspan="4">'); - $value = getPREFdef($global_prefs, 'edit_text_shortcut_cmdstr'); - putHtml('<input type="text" size="48" maxlength="900" value="'.$value.'" name="edittext_shortcut" /></td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">Shortcuts:<br /><i>(Path~Label)</i></td><td colspan="4">'); + echo '<textarea name="edittext_shortcut" rows="4" cols="40" wrap="off" class="edititemText">'; + if (($value = getPREFdef($global_prefs, 'edit_text_shortcut_cmdstr')) !== '') { + foreach (explode(' ', $value) as $shortcut) { + if ($shortcut !== '') { + echo htmlspecialchars($shortcut), chr(13); + } + } + } + putHtml('</textarea>'); + putHtml('</td></tr>'); putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |