ویژگی ها جدید اوراکل اپکس 20.2

00:00 – Introduction to Oracle APEX 20.2 New Features

03:44 – Lesson 1: Redwood UI CSS Variables

13:05 – Lesson 2: Developer Enhancements

30:33 – Lesson 3: Cards Region

46:49 – Lesson 4: Reporting Printing

53:25 – Summary to Oracle APEX 20.2 New Features

Recaptcha در اوراکل اپکس

با سلام

ابتدا باید شما با کاربر SYS وارد شوید و دسترسی چند Package و Table را به کاربر استفاده کننده بدهید

:کد

GRANT EXECUTE ON APEX_040200.WWV_FLOW_PLATFORM to public;

GRANT EXECUTE ON APEX_040200.wwv_flow_image_generator to public;
GRANT SELECT  ON APEX_040200.wwv_flow_request_verifications TO PUBLIC;
GRANT EXECUTE ON APEX_UTIL  TO PUBLIC;

سپس شما در صفحه مورد نظر یک PLSQL Region بسازید با این کد

:کد

sys.htp.p(‘<p>’ || wwv_flow_lang.system_message(p_name=>’SERVICE_SIGNUP.ACCEPT’)||'</p>’);
sys.htp.p(‘<table class=”htmldbStandard3″ cellspacing=”0″ cellpadding=”0″ border=”0″ summary=””>’);
sys.htp.p(‘<tr>’);
sys.htp.p(‘<td class=”htmldbFDB”>
<img src=”APEX_040200.wwv_flow_image_generator.get_image?p_position=1&p_sessionid=’|| :APP_SESSION ||'” height=”60″, width=”40″/>
<img src=”APEX_040200.wwv_flow_image_generator.get_image?p_position=2&p_sessionid=’|| :APP_SESSION ||'” height=”60″, width=”40″/>
<img src=”APEX_040200.wwv_flow_image_generator.get_image?p_position=3&p_sessionid=’|| :APP_SESSION ||'” height=”60″, width=”40″/>
<img src=”APEX_040200.wwv_flow_image_generator.get_image?p_position=4&p_sessionid=’|| :APP_SESSION ||'” height=”60″, width=”40″/>
<img src=”APEX_040200.wwv_flow_image_generator.get_image?p_position=5&p_sessionid=’|| :APP_SESSION ||'” height=”60″, width=”40″/>
</td>’);
sys.htp.p(‘</tr>’);
sys.htp.p(‘</table>’);
sys.htp.p(‘<a href=”f?p=&APP_ID.:&APP_PAGE_ID.:’||:APP_SESSION||'”>’||wwv_flow_lang.system_message(‘REGEN_VER’)||'</a>’);

در اين مرحله آيتمي از نوع Text Filed ايجاد نموده تا كد امنيتي توسط كاربر وارد شود

جهت کنترل آيتم كد امنيتي Validation Beforsubmit Function Returning Boolean با کد زیر بسازید باید توجه داشته باشید در این کد نام آیتم مورد نظر خود را بگذارید

:کد

begin
for c1 in (
select * from APEX_040200.wwv_flow_request_verifications
where session_id = :APP_SESSION
) loop
if c1.verification_string = :P51_VERIFICATION_CODE then
;      return true;
else
— Reset incorrectly entered verification code in session state
— since this value is not very useful (the user will see a new
— code).
apex_util.set_session_state(
p_name  => ‘P51_VERIFICATION_CODE’,
p_value => ”
);
return false;
end if;
end loop;

return false;
end;

مديريت فايل و دايركتوري درمحيط اوراكل و اپكس(Apex)

يكي از مشكلات در محيط اوراكل ساخت دايركتوري ، فايل و … مي باشد و با استفاده از دستورات اوراكل فقط مي توان Oracle Directory ساخت و هر Oracle Directory فقط به يك دايركتوري متصل مي باشد و امكان دسترسي به Subdirectory وجود ندارد
براي حل اين مشكل از Java مي توان استفاده نمود به روش زير:

1- با كاربر SYS به بانك متصل شويد.
2- يك Java Sourec با نام “FileHandler” به روش زير ايجاد نمائيد.

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED “FileHandler” AS
import java.lang.*;
import java.util.*;
import java.io.*;
import java.sql.Timestamp;

public class FileHandler
{
private static int SUCCESS = 1;
private static int FAILURE = 0;

public static int canRead (String path) {
File myFile = new File (path);
if (myFile.canRead()) return SUCCESS; else return FAILURE;
}

public static int canWrite (String path) {
File myFile = new File (path);
if (myFile.canWrite()) return SUCCESS; else return FAILURE;
}

public static int createNewFile (String path) throws IOException {
File myFile = new File (path);
if (myFile.createNewFile()) return SUCCESS; else return FAILURE;
}

public static int delete (String path) {
File myFile = new File (path);
if (myFile.delete()) return SUCCESS; else return FAILURE;
}

public static int exists (String path) {
File myFile = new File (path);
if (myFile.exists()) return SUCCESS; else return FAILURE;
}

public static int isDirectory (String path) {
File myFile = new File (path);
if (myFile.isDirectory()) return SUCCESS; else return FAILURE;
}

public static int isFile (String path) {
File myFile = new File (path);
if (myFile.isFile()) return SUCCESS; else return FAILURE;
}

public static int isHidden (String path) {
File myFile = new File (path);
if (myFile.isHidden()) return SUCCESS; else return FAILURE;
}

public static Timestamp lastModified (String path) {
File myFile = new File (path);
return new Timestamp(myFile.lastModified());
}

public static long length (String path) {
File myFile = new File (path);
return myFile.length();
}

public static String list (String path) {
String list = “”;
File myFile = new File (path);
String[] arrayList = myFile.list();

Arrays.sort(arrayList, String.CASE_INSENSITIVE_ORDER);

for (int i=0; i < arrayList.length; i++) {
// Prevent directory listing expanding if we will blow VARCHAR2 limit.
if ((list.length() + arrayList[i].length() + 1) > 32767)
break;

if (!list.equals(“”))
list += “,” + arrayList[i];
else
list += arrayList[i];
}
return list;
}

public static int mkdir (String path) {
File myFile = new File (path);
if (myFile.mkdir()) return SUCCESS; else return FAILURE;
}

public static int mkdirs (String path) {
File myFile = new File (path);
if (myFile.mkdirs()) return SUCCESS; else return FAILURE;
}

public static int renameTo (String fromPath, String toPath) {
File myFromFile = new File (fromPath);
File myToFile = new File (toPath);
if (myFromFile.renameTo(myToFile)) return SUCCESS; else return FAILURE;
}

public static int setReadOnly (String path) {
File myFile = new File (path);
if (myFile.setReadOnly()) return SUCCESS; else return FAILURE;
}

public static int copy (String fromPath, String toPath) {
try {
File myFromFile = new File (fromPath);
File myToFile = new File (toPath);

InputStream in = new FileInputStream(myFromFile);
OutputStream out = new FileOutputStream(myToFile);

byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
return SUCCESS;
}
catch (Exception ex) {
return FAILURE;
}
}
};
/

—————————–

3- يك Package با نام Nepaco_file_api به روش زير ايجاد نمائيد

CREATE OR REPLACE PACKAGE Nepaco_file_api AS

FUNCTION canRead (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.canRead (java.lang.String) return java.lang.int‘;

FUNCTION canWrite (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.canWrite (java.lang.String) return java.lang.int‘;

FUNCTION createNewFile (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.createNewFile (java.lang.String) return java.lang.int‘;

FUNCTION delete (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.delete (java.lang.String) return java.lang.int‘;

FUNCTION exists (p_path IN VARCHAR2) RETURN N UMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.exists (java.lang.String) return java.lang.int‘;

FUNCTION isDirectory (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.isDirectory (java.lang.String) return java.lang.int‘;

FUNCTION isFile (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.isFile (java.lang.String) return java.lang.int‘;

FUNCTION isHidden (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.isHidden (java.lang.String) return java.lang.int‘;

FUNCTION lastModified (p_path IN VARCHAR2) RETURN DATE
AS LANGUAGE JAVA
NAME ‘FileHandler.lastModified (java.lang.String) return java.sql.Timestamp‘;

FUNCTION length (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.length (java.lang.String) return java.lang.long‘;

FUNCTION list (p_path IN VARCHAR2) RETURN VARCHAR2
AS LANGUAGE JAVA
NAME ‘FileHandler.list (java.lang.String) return java.lang.String‘;

FUNCTION mkdir (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.mkdir (java.lang.String) return java.lang.int‘;

FUNCTION mkdirs (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.mkdirs (java.lang.String) return java.lang.int‘;

FUNCTION renameTo (p_from_path IN VARCHAR2,
p_to_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.renameTo (java.lang.String, java.lang.String) return java.lang.int‘;

FUNCTION setReadOnly (p_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.setReadOnly (java.lang.String) return java.lang.int‘;

FUNCTION copy (p_from_path IN VARCHAR2,
p_to_path IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME ‘FileHandler.copy (java.lang.String, java.lang.String) return java.lang.int‘;

END file_api;
/

دسترسي هاي زير را به كاربر SYS اعطا نمائيد

BEGIN
DBMS_JAVA.grant_permission(‘SYS’, ‘java.io.FilePermission‘, ‘<<ALL FILES>>’, ‘read ,write, execute, delete‘);
DBMS_JAVA.grant_permission(‘SYS’, ‘SYS:java.lang.RuntimePermission’, ‘writeFileDescriptor‘, ”);
DBMS_JAVA.grant_permission(‘SYS’, ‘SYS:java.lang.RuntimePermission’, ‘readFileDescriptor‘, ”);
END;
GRANT JAVAUSERPRIV TO SYS;

dir=”LTR”>private static int FAILURE = 0;

public static int canRead (String path) {
File myFile = new File (path);
if (myFile.canRead()) return SUCCESS; else return FAILURE;
}

public static int canWrite (String path) {
File myFile = new File (path);
if (myFile.canWrite()) return SUCCESS; else return FAILURE;
}

public static int createNewFile (String path) throws IOException {
File myFile = new File (path);
if (myFile.createNewFile()) return SUCCESS; else return FAILURE;
}

public static int delete (String path) {
File myFile = new File (path);
if (myFile.delete()) return SUCCESS; else return FAILURE;
}

public static int exists (String path) {
File myFile = new File (path);
if (myFile.exists()) return SUCCESS; else return FAILURE;
}

public static int isDirectory (String path) {
File myFile = new File (path);
if (myFile.isDirectory()) return SUCCESS; else return FAILURE;
}

public static int isFile (String path) {
File myFile = new File (path);
if (myFile.isFile()) return SUCCESS; else return FAILURE;
}

public static int isHidden (String path) {
File myFile = new File (path);
if (myFile.isHidden()) return SUCCESS; else return FAILURE;
}

public static Timestamp lastModified (String path) {
File myFile = new File (path);
return new Timestamp(myFile.lastModified());
}

public static long length (String path) {
File myFile = new File (path);
return myFile.length();
}

public static String list (String path) {
String list = “”;
File myFile = new File (path);
String[] arrayList = myFile.list();

Arrays.sort(arrayList, String.CASE_INSENSITIVE_ORDER);

for (int i=0; i < arrayList.length; i++) {
// Prevent directory listing expanding if we will blow VARCHAR2 limit.
if ((list.length() + arrayList[i].length() + 1) > 32767)
break;

if (!list.equals(“”))
list += “,” + arrayList[i];
else
list += arrayList[i];
}
return list;
}

public static int mkdir (String path) {
File myFile = new File (path);
if (myFile.mkdir()) return SUCCESS; else return FAILURE;
}

public static int mkdirs (String path) {
File myFile = new File (path);
if (myFile.mkdirs()) return SUCCESS; else return FAILURE;
}

public static int renameTo (String fromPath, String toPath) {

Auto Redirect in Oracle apex

1. Copy Code in Html Header Region In Edit page 

<meta http-equiv="refresh" content="5; URL=http://192.168.1.3:7777/apex423/f?p=175:1:&SESSION.">
<meta name="keywords" content="automatic redirection">