Initial commit
This commit is contained in:
93
masks/options.html
Normal file
93
masks/options.html
Normal file
@@ -0,0 +1,93 @@
|
||||
<div id="options">
|
||||
<div class="h1_wrap">
|
||||
<h1 class="round"><span>Options</span></h1>
|
||||
</div>
|
||||
<div id="options_container">
|
||||
<form id="options_form" name="options_form">
|
||||
<div id="options_input" class="round"><p class="loading">Chargement en cours...</p></div>
|
||||
<input type="button" value="Valider" name="options_submit" id="options_submit" class="button heavy round" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
databap.pageInit = function()
|
||||
{
|
||||
//TODO : to be replaced by tinyscrollbar
|
||||
databap.$main.css('overflow', 'auto');
|
||||
|
||||
databap.getInfo
|
||||
(
|
||||
'get_options',
|
||||
function(options)
|
||||
{
|
||||
var selectHtml = '';
|
||||
var optionHtml = '';
|
||||
var nameAndId = '';
|
||||
var selected = '';
|
||||
|
||||
//remove default text
|
||||
$('#options_input').find('.loading').hide();
|
||||
|
||||
//Display options
|
||||
$.each
|
||||
(
|
||||
options,
|
||||
function(optNameId, optInfo)
|
||||
{
|
||||
optionHtml = '<div class="option_line"><label>'+optInfo.option_name+'</label>';
|
||||
nameAndId = 'id="'+optNameId+'" name="'+optNameId+'"';
|
||||
switch(optInfo.type)
|
||||
{
|
||||
case databap.consts.opt_type_text:
|
||||
optionHtml += '<input type="text" '+nameAndId+' value="'+optInfo.user_value+'" class="round" />';
|
||||
break;
|
||||
case databap.consts.opt_type_select:
|
||||
selectHtml = selected = '';
|
||||
$.each
|
||||
(
|
||||
optInfo.select,
|
||||
function(selectId, selectName)
|
||||
{
|
||||
debug('id='+selectId+selectName);
|
||||
//selected = (optinfo.user_value_id && selectId==optinfo.user_value_id)?' selected':'';
|
||||
selectHtml += '<option value="'+selectId+'"'+selected+'>'+selectName+'</option>';
|
||||
}
|
||||
);
|
||||
optionHtml += '<select '+nameAndId+' class="round">'+selectHtml+'</select>';
|
||||
break;
|
||||
}
|
||||
$(optionHtml+'</div>').appendTo(databap.getMainElem('#options_input')).slideDown('fast');
|
||||
}
|
||||
);
|
||||
|
||||
//Init's end
|
||||
databap.setInitEnd(true);
|
||||
},
|
||||
{},
|
||||
'json',
|
||||
function(){},
|
||||
true
|
||||
);
|
||||
|
||||
databap.getMainElem('#options_submit').click
|
||||
(
|
||||
function()
|
||||
{
|
||||
databap.saveForm
|
||||
(
|
||||
'set_options',
|
||||
databap.getMainElem('#options_form'),
|
||||
function(result)
|
||||
{
|
||||
databap.addSuccessIcon();
|
||||
databap.goTo('options');
|
||||
},
|
||||
'#options_submit'
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
var warning = '<p class="warning">Attention : Une fois la sélection validée, la page se rafraichira automatiquement</p>';
|
||||
databap.getMainElem('#options_container').append(warning);
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user