Merge pull request 'Correctly manage maximum lengths of certain HMT fields' (#30) from df/webif:df-hmtfieldlength-patch into master

Reviewed-on: hummypkg/webif#30
This commit is contained in:
af123 2021-02-24 13:04:14 +00:00
commit a1cf871a84
2 changed files with 7 additions and 5 deletions

View File

@ -103,6 +103,8 @@ if {[llength $plugins(dmenu)]} {
} }
} }
# the maxlength values for title and synopsis are 1 less than the maximum to
# allow for an extra byte to indicate character encoding (see rename.jim)
puts { puts {
</ul> </ul>
@ -131,7 +133,7 @@ puts {
</th> </th>
<td> <td>
<input type=text name="rename_title" id="rename_title" <input type=text name="rename_title" id="rename_title"
value="" size=70 maxlength=48 value="" size=70 maxlength=47
class="text ui-widget-content ui-corner-all"> class="text ui-widget-content ui-corner-all">
</td> </td>
</tr> </tr>
@ -144,7 +146,7 @@ puts {
</th> </th>
<td> <td>
<textarea name="rename_synopsis" id="rename_synopsis" <textarea name="rename_synopsis" id="rename_synopsis"
value="" cols=70 rows=4 value="" cols=70 rows=4 maxlength=251
class="text ui-widget-content ui-corner-all"></textarea> class="text ui-widget-content ui-corner-all"></textarea>
</td> </td>
</tr> </tr>

View File

@ -296,21 +296,21 @@ ts method copy {dst} {
} }
ts method settitle {newtitle} { ts method settitle {newtitle} {
if {[string length newtitle] > 48} { return } if {[string length $newtitle] > 48} { return }
exec /mod/bin/hmt "+settitle=${newtitle}" $file exec /mod/bin/hmt "+settitle=${newtitle}" $file
set title $newtitle set title $newtitle
} }
ts method setsynopsis {newsynopsis} { ts method setsynopsis {newsynopsis} {
if {[string length newsynopsis] > 252} { return } if {[string length $newsynopsis] > 252} { return }
exec /mod/bin/hmt "+setsynopsis=${newsynopsis}" $file exec /mod/bin/hmt "+setsynopsis=${newsynopsis}" $file
set synopsis $newsynopsis set synopsis $newsynopsis
} }
ts method setguidance {newguidance} { ts method setguidance {newguidance} {
if {[string length newguidance] > 48} { return } if {[string length $newguidance] > 74} { return }
if {$newguidance eq ""} { if {$newguidance eq ""} {
exec /mod/bin/hmt "-guidance" $file exec /mod/bin/hmt "-guidance" $file