CREATE OR REPLACE PACKAGE BODY EXAMPLE_AJAX AS
--############################################################################
--# ORBADA : To change this template, choose Tools | Templates
--# Autor : akaluza
--# Stworzono: 2010-06-30 18:35:29
--# Opis :
--# Zmiany :
--# Data: Autor: Wersja:
--# ---------- -------------- ------------------------------------------------
--############################################################################
--
procedure home is
begin
examples.header('Ajax with jQuery example',' <link rel="stylesheet" type="text/css" href="example_ajax.styles">');
--
http.p('<script type="text/javascript" src="http.process_download?pname=jquery.js"></script>');
http.p('<script type="text/javascript">');
http.p('$(function () {');
http.p(' function ajaxify(aurl) {');
http.p(' $.ajax({');
http.p(' url : aurl,');
http.p(' success : function (data) {');
http.p(' $("#wrapper").html(data);');
http.p(' }');
http.p(' });');
http.p(' }');
http.p(' $("div#nav ul li a").click(function(){');
http.p(' $(''#nav ul li a.current'').removeClass(''current'');');
http.p(' $(this).addClass(''current'');');
http.p(' ajaxify($(this).attr(''href''));');
http.p(' return false;');
http.p(' });');
http.p('});');
http.p('</script>');
--
http.p('<h3>Instruction</h3>');
http.p('1. Go to DBPages home<br>');
http.p('2. Upload jquery.js from dbpages.zip/res in section "Upload file to HTTP_DOCS table"<br>');
http.p('3. Go back to this page<br>');
http.p('4. Click one of below link<br>');
http.p('</head>');
http.p('<body>');
http.p('<div id="nav">');
http.p('<h3>Contents</h3>');
http.p('<ul>');
http.p('<li><a href="example_ajax.tables_table">Tables</a></li>');
http.p('<li><a href="example_ajax.views_table">Views</a></li>');
http.p('</ul>');
http.p('</div>');
http.p('<div id="wrapper"></div>');
--
examples.footer;
end;
--
procedure tables_table is
begin
http.p('<table border=1>');
http.p('<tr><th>Owner</th><th>Name</th></tr>');
for c in (select owner, table_name from all_tables where rownum <= 100 order by table_name) loop
http.p('<tr><td>'||c.owner||'</td><td>'||c.table_name||'</td></tr>');
end loop;
http.p('</table>');
end;
--
procedure views_table is
begin
http.p('<table border=1>');
http.p('<tr><th>Owner</th><th>Name</th></tr>');
for c in (select owner, view_name from all_views where rownum <= 100 order by view_name) loop
http.p('<tr><td>'||c.owner||'</td><td>'||c.view_name||'</td></tr>');
end loop;
http.p('</table>');
end;
--
procedure styles is
begin
http.set_content_type('text/css');
http.p( '.current {font-weight: bold;}' );
end;
--
END EXAMPLE_AJAX;