IF not exists (SELECT * FROM funit WHERE fu_id = in_myfu_id) THEN
ROLLBACK;
SET out_ret_code = CONCAT("ERROR: 操作人經營單位不存在資料庫中!",in_myfu_id);
CALL system_log(out_ret_code);
LEAVE proc_label;
END IF;
本網誌記錄網站設計的一些內容筆記。 網站設計需要整合很多工具與概念。 我畢業自淡江電子計算機科學學系,算是科班出身。但我們那個年代(50年代,唉!LKK了!),網路還只是剛開始,相關的技術都是出社會以後陸續接觸學習。 網站的建立與設計,牽涉的範圍真的很廣泛。 網站的目地是甚麼?銷售網頁、電子購物、廣告、社群經營、互動、教學、客戶服務、網站應用程式、...... 需要整合的人才,程式設計師、資料庫管理師、網頁美編、文字編輯、多媒體製作等等。 這裡將記錄一個LKK對網站系統重新學習與複習,還有教學使用的一些資料。
IF not exists (SELECT * FROM funit WHERE fu_id = in_myfu_id) THEN
ROLLBACK;
SET out_ret_code = CONCAT("ERROR: 操作人經營單位不存在資料庫中!",in_myfu_id);
CALL system_log(out_ret_code);
LEAVE proc_label;
END IF;
https://getbootstrap.com/docs/5.0/helpers/ratio/#example
<div class="ratio ratio-16x9">
<iframe src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" title="YouTube video" allowfullscreen></iframe>
</div>
如題。
使用 ScriptCase Grid 建立新的 Application 時,如果使用 SQL Builder,如果是較複雜的 SQL Stmt,導致可能產生 Grid 顯示時,Page Up/Down翻頁程式有錯誤。
此時,只要將該 SQL Stmt 改成 建立 view 的方式,再來做成 Grid Application ,這樣就正常了!
ScriptCase 的表單Form,有按鈕功能。
按鈕有四種型態:PHP/JAVASCRIPT/AJAX/LINK
如果僅是更新資料庫欄位裡面的值,使用AJAX PHP,就可以了。最快、簡便。
例如:
{confirmed} = 1;
{confirmed_dt} = date("Y-m-d H-i-s");
這是更新該筆資料紀錄裡面的兩個欄位值:Confirmed確認值為1、confirmed_dt 日期為當時日期。
如果一樣的程式碼,改成 PHP,那麼執行起來,就不一樣了。變成執行完程式,就離開這個Application!也沒有自動存檔,所以,這樣處理是不對的。
--------------------------------------------------------------------------
1. 在 Programming -> JavaScript Methods -> New Method
建立一個新的 Method,內容只有一行:
nm_atualiza ('alterar');
Name 例如為: jssave
這是SC本身執行 SAVE(或 UPDATE)的 JavaScript Code。
2. 建立一個 Ajax Button
程式碼:
{confirmed} = 1;
{confirmed_dt} = date("Y-m-d H-i-s");
sc_ajax_javascript('jssave', array());
{confirmed}、{confirmed_dt}這是兩個要改變內容值的欄位。
就 Scriptcase 而言,設計一個按鈕放在表頭、或是表尾,是一件非常簡單的事情。
但有時候,會希望將按鈕放在距離特定資料附近的位置,這樣比較直觀。
It’s easy to create a button on the top or bottom of a Scriptcase form or Grid application (as element of the toolbar).
But sometime you might need buttoms directly near certain elements within the form (or within the line of a grid).
One of the easiest ways is to use the Scriptcase macro:
sc_make_link(Application, Parameters)
example:
$string_link = sc_make_link(grid_images, ref_object_type='contact';ref_object_id={id});
The generates a string with the link to the Grid-application ‘grid_images’ and passes the parameters ‘ref_object_type’ and ‘ref_object_id’
Create a field of ‘Label’ type within the form / grid and insert it at the place the button will appear.
Our example uses a Label-field named ‘edit_picture’
Then the new field will be filled via PHP-code (i.e. in the event OnLoad):
Add a usual HTML link (via a href) as contact of the field:
{edit_pictures} = '<a href="' . $string_link . '" class="scButton_small" title="Edit the picture" style="vertical-align: middle; display:inline-block;">' . {lang_contact_edit_pictures} . '</a>';
We’re using the string generated in 1. as link.
‘class’ defines that a small button is to be used. You could also use class="scButton_default" for a standard button. Hint: Some templates do not support small buttons.
‘title’ defines which text is be shown as popup if the cursor is over the button (PC-browser only).
{lang_contact_edit_pictures} defines which text is shown on the button. (Our sample: Bilder Bearbeiten)
Hint: Use plain text instead of {lang_contact_edit_pictures} of your’re not using the multilingual feature of Scriptcase.
Example:
If the lable field is placed below a picture, ot could be show like:
上面的例子,是連結到外部的Application。
如果是自己FORM/GRID本身的Button呢?
可以先使用SC內的BUTTON功能,建立一個 Button,然後跑跑結果看,用檢視原始碼看該Button的Source Code連結,複製出來。
比照上面的作法,建立一個 Label 欄位,將上段Button複製下來的Source Code貼到該 Label 的內容裡面,
安排該Field顯示在適當的位置。這樣就完成了。
缺點是:原本預設顯示在表頭/表尾的按鈕,必須重複出現。因為如果把該按鈕不顯示,該功能就不行執行了!
CodeCharge checkbox 如果是只在 前端javascript 用,就不要用內建的 form->checkbox
如果在 html 使用 code-charge 內建的 checkbox ,他會 表現得跟單純的 html checkbox 不大一樣。
如果只是要在前端使用 javascript ,不會更新後端資料庫,就不要用CCS內建的checkbox!
他會不一樣!很頭大!
例如:寫 購物車,結帳,收件人與會員資料一樣,前面加個 check,讓用戶選擇,只要 click on, 就複製會員資料到收件人欄位裡,這個功能只要單純的 javascript 就可以了。
那麼,就使用單純的 html 的 checkbox 就好。千萬不要使用CCS內建的checkbox,會無法使用!
紀錄 下
<div class="form-group">
<label>請填寫送貨收件人資料 (請填入收件人真實姓名,以確保順利收件)</label>
</div>
<hr>
<div class="form-group">
<div class="checkbox">
<label for="contentorderssame_with_customer">
<input type="checkbox" id="contentorderssame_with_customer" onclick="same_with_customer()">
{res:same_with_customer}
</label>
</div>
</div>
<div class="form-group">
<label for="contentordersdelivery_name">{res:delivery_name}</label>
<input type="text" class="form-control" name="{delivery_name_Name}" value="{delivery_name}" id="contentordersdelivery_name">
</div>
<div class="form-group">
<label for="contentordersdelivery_telephone">{res:delivery_telephone}</label>
<input class="form-control" type="text" name="{delivery_telephone_Name}" value="{delivery_telephone}" id="contentordersdelivery_telephone">
</div>
<script language="JavaScript" type="text/javascript">
function same_with_customer()
{
if (document.getElementById("contentorderssame_with_customer").checked == true) {
document.getElementById("contentordersdelivery_name").value=document.getElementById("ss_customer_name").innerHTML;
document.getElementById("contentordersdelivery_telephone").value=document.getElementById("ss_customer_telephone").innerHTML;
} else {
document.getElementById("contentordersdelivery_name").value="";
document.getElementById("contentordersdelivery_telephone").value="";
}
}
</script>
只要用 if (empty({primary_key})) 就可以知道是否為新增模式了。 如果 {promary_key} 是空白的,那麼就是在新增模式;反之,就是更新模式。 以上。