CREATE OR REPLACE procedure mobile_customize(
p_siteid in number default null,
p_pageid in number default null,
p_backurl in varchar2 default null,
p_action in varchar2 default null)
as
l_pageid number;
l_siteid number;
l_backurl varchar2(4000);
l_back_pageid number;
l_back_siteid number;
l_url varchar2(32767);
l_page wwpob_api_page.page_record;
l_dlg wwui_api_dialog;
l_button_list wwui_api_button_list;
l_language varchar2(32) := wwctx_api.get_nls_language;
begin
-- The user has submitted the form below because the mobile homepage
-- resolved to a desktop page, so perform the desired action
-- (either Cancel the operation, or Finish the operation)
if p_action = 'Cancel' then
-- The user wants to Cancel, so go back to the originating page
owa_util.redirect_url(p_backurl);
return;
elsif p_action = 'Finish' then
-- The user is happy to continue, so go to the customize page
owa_util.redirect_url( wwctx_api.get_proc_path(
'wwpob_page_customize.pageCustomize'||
'?p_pageid='|| p_pageid ||
'&p_siteid=' || p_siteid ||
'&p_back_url=' || wwutl_htf.url_encode(p_backurl)));
return;
end if;
if p_siteid is null or p_pageid is null then
wwpob_api_mobile.get_defaultmobilepage(
p_siteid => l_siteid,
p_pageid => l_pageid);
else
l_pageid := p_pageid;
l_siteid := p_siteid;
end if;
if p_backurl is null then
wwpob_api_page.get_defaultpage(p_siteid=>l_back_siteid, p_pageid=>l_back_pageid);
l_backurl := wwpob_page_util.get_page_url(
p_siteid=>l_back_siteid,
p_pageid=>l_back_pageid);
else
l_backurl := p_backurl;
end if;
l_page := wwpob_api_page.get( l_pageid, l_siteid );
-- Only redirect to the customization screen if the resulting page
-- is a MOBILE page, or we have already said we wish to continue
if p_action = 'Finish' or l_page.base_type = wwpob_api_page.PAGETYPE_MOBILE then
l_url := wwctx_api.get_proc_path(
'wwpob_page_customize.pageCustomize'||
'?p_pageid='|| l_pageid ||
'&p_siteid=' || l_siteid ||
'&p_back_url=' || wwutl_htf.url_encode(l_backurl));
owa_util.redirect_url(l_url);
else
-- This page is not a mobile page, explain what has happened and
-- give the user the option to continue to the customization screen
-- or to backtrack to the originating page
-- Construct the buttons (Yes and No Button)
l_button_list := wwui_api_button_list(
wwui_api_button.create_button(
p_button_name => wwnls_api.get_string(
wwnls_api.DOMAIN_WWC,
'pob', 'yes',
l_language),
p_button_url => 'javascript:finishSubmit()'),
wwui_api_button.create_button(
p_button_name => wwnls_api.get_string(
wwnls_api.DOMAIN_WWC,
'pob', 'no',
l_language),
p_button_url => 'javascript:cancelSubmit()'));
-- Construct the Dialog
l_dlg := wwui_api_dialog.create_dialog(
p_title => l_page.title,
p_dialog_image => wwctx_api.get_image_path('pobpage.jpg'),
p_subheader_text => wwnls_api.get_string(wwnls_api.DOMAIN_WWC, 'pob',
'mobilecusttitle',
l_language,
p1 => l_page.title )
);
-- Create a new HTML document template
htp.htmlopen;
htp.headOpen;
htp.title(l_page.title);
-- Javascript Functions
wwutl_javascript.open_script;
htp.p (' function finishSubmit()
{
document.mobilecustomizeform.p_action.value = "Finish";
document.mobilecustomizeform.submit();
}
');
htp.p (' function cancelSubmit()
{
document.mobilecustomizeform.p_action.value = "Cancel";
document.mobilecustomizeform.submit();
}
');
wwutl_javascript.close_script;
htp.headClose;
wwui_api_body.bodyopen(p_use_csstag => TRUE,
p_use_margin => TRUE);
-- FORM OPEN
htp.formOpen(curl => wwctx_api.get_product_schema
||'.mobile_customize',
cmethod => 'POST',
cattributes => 'NAME="mobilecustomizeform"');
wwui_api_body.banner;
-- Draw the Wizard
l_dlg.open_dialog(p_contenttable=>false);
htp.centerOpen;
-- Hidden form elements
htp.p('');
htp.p('');
htp.p('');
htp.p('');
htp.p(' ');
-- MAIN TABLE FOR THE LAYOUT FORM
htp.tableOpen(cattributes => 'width="70%"');
-- Delete Confirm Message
htp.tableRowOpen;
htp.tableData(htf.fontOpen(cface => 'arial,helvetica', csize => '-1')
|| wwnls_api.get_string(wwnls_api.DOMAIN_WWC, 'pob',
'mobilecustdlg1',
l_language)
|| htf.br
|| htf.br
|| wwnls_api.get_string(wwnls_api.DOMAIN_WWC, 'pob',
'proceed_confirm',
l_language)
|| htf.fontClose,
calign=>'center');
htp.tableRowClose;
-- MAIN TABLE CLOSE
htp.tableClose;
-- Display the Yes/No Buttons
htp.centerOpen;
wwui_api_util.draw_buttons(l_button_list);
htp.centerClose;
l_dlg.close_dialog(p_contenttable=>false);
-- FORM CLOSE
htp.formClose;
htp.bodyClose;
htp.htmlClose;
end if;
return;
exception
when others then
wwerr_api_error_ui.show_html;
end;
/