คลังบทความของบล็อก

วันจันทร์ที่ 16 สิงหาคม พ.ศ. 2553

Ofbiz : การสร้าง Menu Widget

การสร้าง Menu Widget บน Ofbiz ดังรูป

1.เริ่มจากสร้างเข้าไปในไฟล์ controller.xml ดังภาพ
2.สร้าง request-map และ view map ในไฟล์ controller.xml ดังนี้
<request-map uri="mainmenu><security https="true" auth="true"/><response name="success" type="view" value="mainmenu"/></request-map>
<view-map name="mainmenu" type="screen" page="component://ที่อยู่ไฟล์ screen.xml #mainmenu"/>
3.จากนั้น controller จะเรียกใช้ screen ซึ่งภายใน screenก็จะเรียกใช้ form ที่เราสร้างเอาไว้อีกที
<screen name="mainmenu">
        <section>
            <actions>
                <set field="headerItem" value="mainmenu"/><!-- this highlights the selected menu-item with name "main" -->
            </actions>
            <widgets>
                <decorator-screen name="AppStudentCommonDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                     <container id="page">
                       <label>สร้างประวัติใหม่</label>     
                            <include-form location="component://ที่อยู่ไฟล์Forms.xml" name="CreateStudent" />                       
                        </container>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
โดยเราจะเรียกใช้ form ไว้ในภายใต้
<decorator-screen name="AppStudentCommonDecorator" location="${parameters.mainDecoratorLocation}">
คือใช้ แทมเพลทของ ofbiz เลยเพื่อที่จะสามารถสร้าง Menu Widget ใน Ofbiz ได้
4.จากนั้นเราจะมาสร้างเมนู ในไฟล์ AppStudentMenus.xml หรือ Menus.xml น่ันเอง ซึ่งชื่อไฟล์จะเปลี่ยนไปตามcomponent ของคุณ
<menu name="MainAppBar" title="ระเบียนประวัติ" extends="CommonAppBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
         <menu-item name="mainmenu" title="สร้างประวัติใหม่"><link target="mainmenu"/></menu-item>    
    </menu>
เพียงเท่านี้ เราก็จะสามารถสร้าง Menu Widget ใน decorator-screen ของ Ofbiz ได้แล้วคะ

วันพฤหัสบดีที่ 5 สิงหาคม พ.ศ. 2553

นอกเรื่อง :: เปลี่ยนภาษาด้วย ~ (ตัวหนอน หรือ Grave Accent ) บน Ubuntu 10.04

ถ้าใช้ Ubuntu แล้ว อยากเปลี่ยนภาษาด้วย ~ เหมือน windows

ให้ดาวน์โหลด
http://mirror.nytes.net/linux/clubuntu/Packages/xkb-data-grave.deb
หรือ
http://www.unzeen.com/download/xkb-data-grave.deb อันใดอันหนึ่ง
หลังจากดาวน์โหลดมาแล้ว ก็ดับเบิ้ลคลิก xkb-data-grave.deb ได้เลย เพื่อ
ทำการติดตั้ง แล้วคลิก install package จากนั้น ก็เข้าไปที่
System > Preferences > Keyboard เลือก Layouts แล้วคลิก Option ดังภาพ


จากนั้นเลือกที่ Layout switching ให้เลือก Grave switches layout ดังภาพ

แค่นี้เราก็จะสามารถ ใช้ ปุ่ม ตัวหนอน ~ เพื่อเปลี่ยนภาษาบน Ubuntu ได้แล้วคะ

credit : www.unzeen.com