Skip to content

Commit

Permalink
rework input form design
Browse files Browse the repository at this point in the history
  • Loading branch information
ssahara committed May 18, 2014
1 parent ef7fcec commit 37d426d
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 36 deletions.
59 changes: 34 additions & 25 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ function html() {
echo $this->locale_xhtml('intro');
echo '</div>'.NL;

echo '<div id="langdelete__form">'.NL;
// inut guidance
echo '<p>'.$this->getLang('i_choose').'</p>'.NL;

// input form
$this->_html_form();
echo '</div>'.NL;
echo '<br />'.NL;

$lang_keep = $_REQUEST['langdelete_w'];
Expand All @@ -86,9 +88,9 @@ function html() {
echo '</div>';

if ($dryrun==true) {
echo '<div class="footnotes">'.NL;
echo $this->getLang('langdelete_attention');
echo '</div>'.NL;
echo '<br />'.NL;
msg($this->getLang('langdelete_attention'), 2);
echo '<br />'.NL;
}
}
}
Expand All @@ -100,29 +102,35 @@ function html() {
* @author Taggic <taggic@t-online.de>
*/
function _html_form(){
global $ID;
global $ID, $conf;

echo '<div class="level4" id="langdelete__input">'.$this->getLang('i_choose').'<br />'.NL;
echo '<form action="'.wl($ID).'" method="post">';
echo '<div class="no">'.NL;
echo '<div id="langdelete__form">'.NL;
echo '<form action="'.wl($ID).'" method="post">';
echo '<input type="hidden" name="do" value="admin" />'.NL;
echo '<input type="hidden" name="page" value="langdelete" />'.NL;
echo '<input type="hidden" name="sectok" value="'.getSecurityToken().'" />'.NL;
echo '<div class="langdelete__divinput">';
echo '<fieldset class="langdelete__fieldset"><legend>'.$this->getLang('i_legend').'</legend>'.NL;
echo '<input type="text" name="langdelete_w" class="edit" value="'.$_REQUEST['langdelete_w'].'" /><br />'.NL;
echo '<input type="checkbox" name="dryrun" checked="checked">&nbsp;'.$this->getLang('i_dryrun').'&nbsp;</input><br />'.NL;
echo '<div class="langdelete__divright">';
echo '<input type="submit" value="'.$this->getLang('btn_start').'" class="button"/>';
echo '</div>'.NL;
echo '</fieldset>';
echo '</div>'.NL;
echo '</div>'.NL;
echo '</form>'.NL;

echo '<fieldset class="langdelete__fieldset"><legend>'.$this->getLang('i_legend').'</legend>'.NL;

echo '<label class="formTitle">'.$this->getLang('i_using').':</label>';
echo '<div class="box">'.$conf['lang'].'</div>'.NL;

echo '<label class="formTitle" for="langdelete_w">'.$this->getLang('i_shouldkeep').':</label>';
echo '<input type="text" name="langdelete_w" class="edit" value="'.$_REQUEST['langdelete_w'].'" />'.NL;

echo '<label class="formTitle" for="option">'.$this->getLang('i_runoption').':</label>';
echo '<div class="box">'.NL;
echo '<input type="checkbox" name="dryrun" checked="checked" /> ';
echo '<label for "dryrun">'.$this->getLang('i_dryrun').'</label>'.NL;
echo '</div>'.NL;

echo '<input type="submit" value="'.$this->getLang('btn_start').'" class="button"/>'.NL;

echo '</fieldset>'.NL;
echo '</form>'.NL;
echo '</div>'.NL;
}


/**
* This function will read the full structure of a directory.
* It's recursive becuase it doesn't stop with the one directory,
Expand All @@ -134,8 +142,9 @@ function _list_language_dirs($path, $level,$lang_keep,$dryrun){
$ignore = array( 'cgi-bin', '.', '..' );
// Open the directory to the handle $dh
$dh = @opendir( $path );
while( false !== ($file = readdir($dh)) ){

// Loop through the directory
while( false !== ($file = readdir($dh)) ){
if( !in_array( $file, $ignore ) ){
// Check that this file is not to be ignored
if( is_dir( "$path/$file" ) ){
Expand All @@ -149,7 +158,7 @@ function _list_language_dirs($path, $level,$lang_keep,$dryrun){
}
if ((stripos("$path/$file",'/lang/')>0) && ($cFlag == false)) {
$dir = $path.'/'.$file;
if ($dryrun==true) {
if ($dryrun==true) {
echo '<strong>'.substr($dir,strlen(DOKU_INC),strlen($dir)-strlen(DOKU_INC)).'</strong><br />';
} else {
// now delete the lanuage sub-folder
Expand All @@ -163,16 +172,16 @@ function _list_language_dirs($path, $level,$lang_keep,$dryrun){
}
}
}
closedir( $dh );
// Close the directory handle
closedir( $dh );
}

/**
* This function will delete all folders and files which are in the specified directory.
* This is necessary due to only empty directories can be deleted.
*/
function rrmdir($dir) {
// replace "//" in $dir if existing
// replace "//" in $dir if existing
$dir = str_replace('//', '/', $dir);

if (is_dir($dir)) {
Expand Down
5 changes: 5 additions & 0 deletions lang/de/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
*/
$lang['menu'] = 'Sprachdateien löschen';
$lang['i_choose'] = '<br /><br />Bitte tragen Sie hier die ISO-Codes der Sprachen ein, welche Sie ausser Englisch behalten m&ouml;chten. M&ouml;chten Sie nur Englisch behalten, dann tragen Sie bitte <i>en</i> ein. Ein leeres Eingabefeld verhindert die Ausf&uuml;hrung der Funktion, um ein L&ouml;schen wegen Fehlbedienung zu verhindern. Wenn Sie meherere behalten m&ouml;chten, dann trennen Sie die jeweiligen ISO-Codes durch ein Komma voneinander. <br />';

$lang['i_legend'] = 'Eingabe';
//$lang['i_using'] = 'Current language';
//$lang['i_shouldkeep'] = 'Language(s) should be kept';
//$lang['i_runoption'] = 'Run option';
$lang['i_dryrun'] = 'nur Simulation';
$lang['btn_start'] = 'Start';

$lang['langdelete_willmsg'] = 'Die folgenden Ordner würden gelöscht werden.';
$lang['langdelete_delmsg'] = 'Die folgenden Datein und Ordner wurden gelöscht.';
$lang['langdelete_attention'] = 'Bitte überlegen Sie genau, welche Sprachen Sie löschen, eine Undo Funktion gibt es nicht.';
5 changes: 5 additions & 0 deletions lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
*/
$lang['menu'] = 'Delete languages';
$lang['i_choose'] = 'Please insert here the ISO codes for languages you want to keep (beside English). In the event you want to keep English only then <br />please insert <i>en</i>. An empty input field will not cause any effect to prevent any misuse/operation error. Please separate the ISO <br />language codes by comma if you want to keep multiple languages. <br />';

$lang['i_legend'] = 'Input';
$lang['i_using'] = 'Current language';
$lang['i_shouldkeep'] = 'Language(s) should be kept';
$lang['i_runoption'] = 'Run option';
$lang['i_dryrun'] = 'simulate only';
$lang['btn_start'] = 'Start';

$lang['langdelete_willmsg'] = 'The following language directories will be deleted.';
$lang['langdelete_delmsg'] = 'The following language directories are deleted now.';
$lang['langdelete_attention'] = 'Please take care that you select properly, which languages to be kept. There does not exist an Undo function.';
40 changes: 29 additions & 11 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
/* ----- Input Elements ---------- */
div .langdelete__divinput {
width: 170px;
text-align : left !important;
/* ----- Input Form Elements ---------- */
#langdelete__form fieldset {
margin: 1em;
width: 35em;
margin-bottom: 2em;
background-color: __background_alt__;
color: __text__;
padding: 0 1em;
}
#langdelete__form legend {
font-size: 1.25em;
}

.langdelete__fieldset {
width: 155px !important;
text-align: left !important;
border-radius: 0.5em;
#langdelete__form label.formTitle {
clear: both;
display: block;
width: 12em;
float: left;
margin-bottom: 10px;
color: #666;
font-weight: bold;
text-align: left;
}

div .langdelete__divright {
text-align: right;
}
#langdelete__form input.edit {
float: left;
}
#langdelete__form div.box {
float: left;
}
#langdelete__form input.button {
float: right;
}

0 comments on commit 37d426d

Please sign in to comment.