1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
--
-- $Id$
--
-- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
-- project.
--
-- Copyright (C) 1998-2018 OpenLink Software
--
-- This project is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; only version 2 of the License, dated June 1991.
--
-- This program is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
-- ---------------------------------------------------
-- OpenX 'MODULE_NAME' code generation file.
-- ---------------------------------------------------
-- Reconnect as application user
--
create procedure OMAIL.WA.res_get_mime_ext(
IN _mime_id INTEGER,
IN _ext_id INTEGER)
{
return coalesce((SELECT MIME_ID FROM OMAIL.WA.RES_MIME_EXT WHERE EXT_ID = _ext_id), _mime_id);
}
;
create procedure OMAIL.WA.res_get_mime_ext_id(
IN _ext varchar)
{
return coalesce((SELECT EXT_ID FROM OMAIL.WA.RES_MIME_EXT WHERE EXT_NAME = OMAIL.WA.res_mime_ext(_ext)), 0);
}
;
--
--
create procedure OMAIL.WA.res_image(
inout path ANY,
inout params ANY,
inout lines ANY)
{
DECLARE
v_id,
e_id,
v_size,
S ANY;
v_id := atoi(get_keyword('id', params, '0'));
e_id := atoi(get_keyword('ext', params, '0'));
v_size := get_keyword('size', params, '');
S := coalesce((SELECT ICON16 FROM OMAIL.WA.RES_MIME_TYPES WHERE ID=OMAIL.WA.res_get_mime_ext(v_id, e_id)), '');
if (S = '')
S := coalesce((SELECT ICON16 FROM OMAIL.WA.RES_MIME_TYPES WHERE ID = 30100), '');
OMAIL.WA.utl_myhttp(S, null, 'image/gif', null, null, null);
return;
}
;
create procedure OMAIL.WA.res_mime_create(
IN p_id INTEGER,
IN p_type VARCHAR,
IN p_descr VARCHAR)
{
DECLARE
state VARCHAR;
state := '00000';
DECLARE EXIT HANDLER FOR SQLSTATE '*' {state := __SQL_MESSAGE; goto ERROR;};
{
INSERT REPLACING OMAIL.WA.RES_MIME_TYPES(ID, MIME_TYPE, DESCRIPTION)
VALUES(p_id, p_type, p_descr);
};
ERROR:
return p_id;
}
;
create procedure OMAIL.WA.res_mime_edit(
IN p_id INTEGER,
IN p_ext VARCHAR,
IN p_type VARCHAR,
IN p_descr VARCHAR,
IN p_icon16 VARCHAR,
IN p_icon32 VARCHAR)
{
DECLARE
state VARCHAR;
state := '00000';
DECLARE EXIT HANDLER FOR SQLSTATE '*' {state := __SQL_MESSAGE; goto ERROR;};
{
UPDATE
OMAIL.WA.RES_MIME_TYPES
SET
MIME_TYPE = p_type,
DESCRIPTION = p_descr,
ICON16 = p_icon16,
ICON32 = p_icon32
WHERE
ID = p_id;
};
ERROR:
return p_id;
}
;
create procedure OMAIL.WA.res_mime_ext(
IN p_name VARCHAR)
{
DECLARE
V ANY;
if(not length(p_name)) return '';
V := split_and_decode (p_name, 0, '\0\0.');
return lcase(aref(V, length(V)-1));
}
;
create procedure OMAIL.WA.res_get_mimetype_id(
IN _name VARCHAR,
IN _default INTEGER := 30100)
{
return coalesce((SELECT ID FROM OMAIL.WA.RES_MIME_TYPES WHERE MIME_TYPE = _name), _default);
}
;
|