<style type="text/css">
.edit_region_title {
display:none;
width:11px;
height:11px;
cursor:pointer;
}
.region_title {
display:none;
}
</style>
<link media="screen" type="text/css" href="r/insum/files/static/v2Y/impromptu.css" rel="stylesheet">
<link media="screen" type="text/css" href="r/insum/files/static/v2Y/jquery.jgrowl.css" rel="stylesheet">
<script src="http://www.google.com/jsapi" /></script>
<script>
// Load jQuery
google.load("jquery", "1.2.6", {uncompressed:false});
</script>
<script src="r/insum/files/static/v2Y/jquery.jgrowl.js" /></script>
<script src="r/insum/files/static/v2Y/jquery-impromptu.1.6.js" /></script>
<script src="r/insum/files/static/v2Y/jquery.corner.js" /></script>
<script>
function init_edit_region_title(){
var l_region_header_selector = '.t4RegionHeader';
var l_class_edit_link = 'edit_region_title';
var l_class_input_field = 'input_new_region_title';
$(l_region_header_selector).append('<img src="/i/e2.gif" class="'+l_class_edit_link+'" />');
//Handle click event on "EDIT LINKs"
$('.'+l_class_edit_link).click(function(e){
e.preventDefault();
//change this line of code to select your region id
var l_region_id = $(this).parents('table').attr('id');
var l_region_title_id = l_region_id+'_region_title';
var l_new_region_title_id = l_region_id+'_new_region_title';
var l_region_title = $('#'+l_region_title_id).text();
//Prompt this form to input the new region title
var l_prompt_data = '<label for="'+l_new_region_title_id+'"><span class="t4RequiredLabel">Please enter the new region title:</span></label><br />'+
'<input type="text"'+
' id="'+l_new_region_title_id+'"'+
' class="'+l_class_input_field+'"'+
' value="'+l_region_title+'" />'+
'';
//Prompt the user with the form to input the new region title
$.prompt(l_prompt_data,
{buttons: { Save: true, Cancel: false },
focus: 1,
//Functions to be executed after rendering the form
loaded: function(){
clear_value_on_focus('.'+l_class_input_field);
},
//Functions to be executed on prompt submit
submit: function(v,m){
var l_retval = true;
//if the "SAVE BUTTON" was PRESSED
if(v){
var l_new_region_title = m.children('#'+l_new_region_title_id).val();
function set_region_title(callback){
// send request
$.ajax({type: 'POST',
async: false,
url: 'wwv_flow.show',
data: {x01:l_region_id,
x02:l_new_region_title,
p_flow_id:$('#pFlowId').attr('value'),
p_flow_step_id:$('#pFlowStepId').attr('value'),
p_instance:$('#pInstance').attr('value'),
p_request:'APPLICATION_PROCESS=SET_PAGE_REGION_TITLE'
},
dataType: 'json',
success: function(data, textStatus){
$('#'+l_new_region_title_id+'_error').remove();
$('label[for="'+l_new_region_title_id+'"]')
.after('<div id="'+l_new_region_title_id+'_error" class="t4InlineError">'+data[0].message+'</div>');
if (data[0].error != "") {
callback(false,l_region_title);
}
else if (data[0].error == "") {
callback(true,l_new_region_title);
}
}
});
}
set_region_title(function(status,title){
l_retval = status;
$('#'+l_region_title_id).text(title);
});
}
return l_retval;
},
callback: function(v,m) {
if (!v){
$.jGrowl("action: rename<br />status: aborted", { header: 'Console - Edit region title' });
}
else if (v) {
$.jGrowl("action: rename<br />status: saved<br />old title: "+l_region_title+"<br />new title: "+m.children('#'+l_new_region_title_id).val(), { header: 'Console - Edit region title' });
}
}
}
).children('#jqi').corner();
});
$('.region_title')
.mouseover(function(e){
e.preventDefault();
$(this).siblings('.'+l_class_edit_link).fadeIn('slow');
})
.each(function(i){
var l_region_id = $(this).parents('table').attr("id");
function get_region_title(callback){
$.ajax({type: 'POST',
async: false,
url: 'wwv_flow.show',
data: {x01:l_region_id,
p_flow_id:$('#pFlowId').attr('value'),
p_flow_step_id:$('#pFlowStepId').attr('value'),
p_instance:$('#pInstance').attr('value'),
p_request:'APPLICATION_PROCESS=GET_PAGE_REGION_TITLE'
},
dataType: 'json',
success: function(data, textStatus){
callback(data[0].title);
}
});
}
var l_title;
get_region_title(function(title){l_title=title;});
$(this).html(l_title);
})
.show();
$(l_region_header_selector).bind("mouseleave",function(e){
$(this).children('.'+l_class_edit_link).fadeOut('slow');
});
$('.'+l_class_edit_link).parents('table').bind("mouseleave",function(e){
$(this).children('.'+l_class_edit_link).fadeOut('slow');
});
}
function clear_value_on_focus(s){
$(s).click(function(){
$(this).attr("value","");
});
}
$().ready(function() {
init_edit_region_title();
});
</script> |