openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit c6c2a18fc88a294a1da03b97e620318e82c85015
parent e4228f1a46ff59124515be7827df3dfbffe5f9bd
Author: dankert <dankert@laptop-jan>
Date:   Mon, 18 Mar 2013 00:05:03 +0100

Die HTML-Ids in Eingabeelementen müssen pro View eindeutig sein. Daher wird zu Beginn des Requests eine Id festgelegt. Da der Request nur 1 View erzeugen kann, ist die Id dann für den ausgegebenen HTML-Baum eindeutig.

Diffstat:
init.php | 1+
themes/default/include/html/checkbox.inc.php | 2+-
themes/default/include/html/editor.inc.php | 4++--
themes/default/include/html/input.inc.php | 4++--
themes/default/include/html/label.inc.php | 2+-
themes/default/include/html/password.inc.php | 4++--
themes/default/include/html/radio.inc.php | 6+++---
themes/default/include/html/radiobox.inc.php | 2+-
themes/default/include/html/selectbox.inc.php | 2+-
themes/default/include/html/upload.inc.php | 4++--
10 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/init.php b/init.php @@ -47,6 +47,7 @@ define('OR_THEMES_EXT_DIR' ,defined('OR_BASE_URL')?slashify(OR_BASE_URL).'the define('OR_TMP_DIR' ,'./tmp/' ); define('OR_CONTROLLER_FILE' ,defined('OR_EXT_CONTROLLER_FILE')?OR_EXT_CONTROLLER_FILE:'dispatcher'); define('START_TIME' ,time() ); +define('REQUEST_ID' ,'req'.time().rand() ); define('SECURITY_GUEST',1); define('SECURITY_USER' ,2); diff --git a/themes/default/include/html/checkbox.inc.php b/themes/default/include/html/checkbox.inc.php @@ -5,7 +5,7 @@ $checked = $$attr_name; else $checked = $attr_default; -?><input class="checkbox" type="checkbox" id="id_<?php echo $attr_name ?>" name="<?php echo $attr_name ?>" <?php if ($attr_readonly) echo ' disabled="disabled"' ?> value="1" <?php if( $checked ) echo 'checked="checked"' ?> /><?php +?><input class="checkbox" type="checkbox" id="<?php echo REQUEST_ID ?>_<?php echo $attr_name ?>" name="<?php echo $attr_name ?>" <?php if ($attr_readonly) echo ' disabled="disabled"' ?> value="1" <?php if( $checked ) echo 'checked="checked"' ?> /><?php if ( $attr_readonly && $checked ) { diff --git a/themes/default/include/html/editor.inc.php b/themes/default/include/html/editor.inc.php @@ -3,7 +3,7 @@ function checkbox( $name,$value=false,$writable=true,$params=Array() ) { - $src = '<input type="checkbox" id="id_'.$name.'" name="'.$name.'"'; + $src = '<input type="checkbox" id="'.REQUEST_ID.'_'.$name.'" name="'.$name.'"'; foreach( $params as $name=>$val ) $src .= " $name=\"$val\""; @@ -46,7 +46,7 @@ function add_control($type,$image) { global $image_dir; - echo '<td><noscript>'.checkbox($type).'</noscript><label for="id_'.$type.'"><a href="javascript:'.$type.'();" title="'.langHtml('PAGE_EDITOR_ADD_'.$type).'"><img src="'.$image_dir.'/editor/'.$image.'" border"0" /></a></label>'; + echo '<td><noscript>'.checkbox($type).'</noscript><label for="'.REQUEST_ID.'_'.$type.'"><a href="javascript:'.$type.'();" title="'.langHtml('PAGE_EDITOR_ADD_'.$type).'"><img src="'.$image_dir.'/editor/'.$image.'" border"0" /></a></label>'; } diff --git a/themes/default/include/html/input.inc.php b/themes/default/include/html/input.inc.php @@ -6,8 +6,8 @@ ?><?php if (!$attr_readonly || $attr_type=='hidden') { /* Feld editieren */ -?><div class="<?php echo $attr_type!='hidden'?'inputholder':'inputhidden' ?>"><input<?php if ($attr_readonly) echo ' disabled="true"' ?><?php if ($attr_hint) echo ' data-hint="'.$attr_hint.'"'; ?> id="id_<?php echo $attr_name ?><?php if ($attr_readonly) echo '_disabled' ?>" name="<?php echo $attr_name ?><?php if ($attr_readonly) echo '_disabled' ?>" type="<?php echo $attr_type ?>" maxlength="<?php echo $attr_maxlength ?>" class="<?php echo str_replace(',',' ',$attr_class) ?>" value="<?php echo $tmp_value ?>" /><?php if ($attr_icon) echo '<img src="'.$image_dir.'icon_'.$attr_icon.IMG_ICON_EXT.'" width="16" height="16" />'; ?></div><?php +?><div class="<?php echo $attr_type!='hidden'?'inputholder':'inputhidden' ?>"><input<?php if ($attr_readonly) echo ' disabled="true"' ?><?php if ($attr_hint) echo ' data-hint="'.$attr_hint.'"'; ?> id="<?php echo REQUEST_ID ?>_<?php echo $attr_name ?><?php if ($attr_readonly) echo '_disabled' ?>" name="<?php echo $attr_name ?><?php if ($attr_readonly) echo '_disabled' ?>" type="<?php echo $attr_type ?>" maxlength="<?php echo $attr_maxlength ?>" class="<?php echo str_replace(',',' ',$attr_class) ?>" value="<?php echo $tmp_value ?>" /><?php if ($attr_icon) echo '<img src="'.$image_dir.'icon_'.$attr_icon.IMG_ICON_EXT.'" width="16" height="16" />'; ?></div><?php if ($attr_readonly) { /* Nur anzeigen */ -?><input type="hidden" id="id_<?php echo $attr_name ?>" name="<?php echo $attr_name ?>" value="<?php echo $tmp_value ?>" /><?php +?><input type="hidden" id="<?php echo REQUEST_ID ?>_<?php echo $attr_name ?>" name="<?php echo $attr_name ?>" value="<?php echo $tmp_value ?>" /><?php } } else { ?><a title="<?php echo langHtml('EDIT') ?>" href="<?php echo Html::url($actionName,$subactionName,0,array('mode'=>'edit')) ?>"><span class="<?php echo $attr_class ?>"><?php echo $tmp_value ?></span></a><?php } ?> \ No newline at end of file diff --git a/themes/default/include/html/label.inc.php b/themes/default/include/html/label.inc.php @@ -1,2 +1,2 @@ -<label<?php if (isset($attr_for)) { ?> for="id_<?php echo $attr_for ?><?php if (!empty($attr_value)) echo '_'.$attr_value ?>" <?php if(hasLang(@$attr_key.'_desc')) { ?> title="<?php echo lang(@$attr_key.'_desc')?>"<?php } ?> class="label"<?php } ?>> +<label<?php if (isset($attr_for)) { ?> for="<?php echo REQUEST_ID ?>_<?php echo $attr_for ?><?php if (!empty($attr_value)) echo '_'.$attr_value ?>" <?php if(hasLang(@$attr_key.'_desc')) { ?> title="<?php echo lang(@$attr_key.'_desc')?>"<?php } ?> class="label"<?php } ?>> <?php if (isset($attr_key)) { echo lang($attr_key); ?><?php if (isset($attr_text)) { echo $attr_text; } ?><?php } ?> \ No newline at end of file diff --git a/themes/default/include/html/password.inc.php b/themes/default/include/html/password.inc.php @@ -1 +1 @@ -<div class="inputholder"><input type="password" name="<?php echo $attr_name ?>" id="id_<?php echo $attr_name ?>" size="<?php echo $attr_size ?>" maxlength="<?php echo $attr_maxlength ?>" class="<?php echo $attr_class ?>" value="<?php echo isset($$attr_name)?$$attr_name:$attr_default ?>" /></div>- \ No newline at end of file +<div class="inputholder"><input type="password" name="<?php echo $attr_name ?>" id="<?php echo REQUEST_ID ?>_<?php echo $attr_name ?>" size="<?php echo $attr_size ?>" maxlength="<?php echo $attr_maxlength ?>" class="<?php echo $attr_class ?>" value="<?php echo isset($$attr_name)?$$attr_name:$attr_default ?>" /></div>+ \ No newline at end of file diff --git a/themes/default/include/html/radio.inc.php b/themes/default/include/html/radio.inc.php @@ -8,13 +8,13 @@ else $attr_tmp_default = ''; - ?><input onclick="" class="radio" type="radio" id="id_<?php echo $attr_name.'_'.$attr_value ?>" name="<?php echo $attr_prefix.$attr_name ?>"<?php if ( $attr_readonly ) echo ' disabled="disabled"' ?> value="<?php echo $attr_value ?>"<?php if($attr_value==$attr_tmp_default||@$attr_checked) echo ' checked="checked"' ?> /> + ?><input onclick="" class="radio" type="radio" id="<?php echo REQUEST_ID ?>_<?php echo $attr_name.'_'.$attr_value ?>" name="<?php echo $attr_prefix.$attr_name ?>"<?php if ( $attr_readonly ) echo ' disabled="disabled"' ?> value="<?php echo $attr_value ?>"<?php if($attr_value==$attr_tmp_default||@$attr_checked) echo ' checked="checked"' ?> /> <?php /* #IF-ATTR deactivated-children# */ ?> <script name="Javascript" type="text/javascript"> <!-- <?php foreach(explode(',',$attr_children) as $attr_tmp_child) { if (empty($attr_tmp_child)) continue; ?> -var e = document.getElementById('id_<?php echo $attr_tmp_child ?>'); +var e = document.getElementById('<?php echo REQUEST_ID ?>_<?php echo $attr_tmp_child ?>'); e.disabled = true; <?php } ?> @@ -24,7 +24,7 @@ function <?php echo $attr_name.'_'.$attr_value ?>_valueChanged(element) if (document.forms[0].elements[i].type == 'text') document.forms[0].elements[i].disabled = true; <?php foreach(explode(',',$attr_children) as $attr_tmp_child) { if (empty($attr_tmp_child)) continue; ?> - var e = document.getElementById('id_<?php echo $attr_tmp_child ?>'); + var e = document.getElementById('<?php echo REQUEST_ID ?>_<?php echo $attr_tmp_child ?>'); e.disabled = false; <?php } ?> } diff --git a/themes/default/include/html/radiobox.inc.php b/themes/default/include/html/radiobox.inc.php @@ -9,7 +9,7 @@ foreach( $attr_tmp_list as $box_key=>$box_value ) { $box_value = is_array($box_value)?(isset($box_value['lang'])?langHtml($box_value['lang']):$box_value['value']):$box_value; - $id = 'id_'.$attr_name.'_'.$box_key; + $id = REQUEST_ID.'_'.$attr_name.'_'.$box_key; echo '<input id="'.$id.'" name="'.$attr_name.'" type="radio" class="'.$attr_class.'" value="'.$box_key.'"'; if ($box_key==$attr_tmp_default) echo ' checked="checked"'; diff --git a/themes/default/include/html/selectbox.inc.php b/themes/default/include/html/selectbox.inc.php @@ -14,7 +14,7 @@ if ( $attr_addempty!==FALSE ) else $attr_tmp_list = array(''=>'- '.lang($attr_addempty).' -')+$attr_tmp_list; } -?><div class="inputholder"><select<?php if ($attr_readonly) echo ' disabled="disabled"' ?> id="id_<?php echo $attr_name ?>" name="<?php echo $attr_name; if ($attr_multiple) echo '[]'; ?>" onchange="<?php echo $attr_onchange ?>" title="<?php echo $attr_title ?>" class="<?php echo $attr_class ?>"<?php +?><div class="inputholder"><select<?php if ($attr_readonly) echo ' disabled="disabled"' ?> id="<?php echo REQUEST_ID ?>_<?php echo $attr_name ?>" name="<?php echo $attr_name; if ($attr_multiple) echo '[]'; ?>" onchange="<?php echo $attr_onchange ?>" title="<?php echo $attr_title ?>" class="<?php echo $attr_class ?>"<?php if (count($$attr_list)<=1) echo ' disabled="disabled"'; if ($attr_multiple) echo ' multiple="multiple"'; echo ' size="'.intval($attr_size).'"'; diff --git a/themes/default/include/html/upload.inc.php b/themes/default/include/html/upload.inc.php @@ -1 +1 @@ -<input size="<?php echo $attr_size ?>" id="id_<?php echo $attr_name ?>" type="file" <?php if (isset($attr_maxlength))echo ' maxlength="'.$attr_maxlength.'"' ?> name="<?php echo $attr_name ?>" class="<?php echo $attr_class ?>" />- \ No newline at end of file +<input size="<?php echo $attr_size ?>" id="<?php echo REQUEST_ID ?>_<?php echo $attr_name ?>" type="file" <?php if (isset($attr_maxlength))echo ' maxlength="'.$attr_maxlength.'"' ?> name="<?php echo $attr_name ?>" class="<?php echo $attr_class ?>" />+ \ No newline at end of file