text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:baselineAligned="true"
    android:weightSum="1"
    android:nestedScrollingEnabled="false">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Discovery"
            android:id="@+id/btn_discoverResource"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:weightSum="1"
            android:baselineAligned="true"
            android:layout_marginLeft="20dp"
            android:id="@+id/layout_Security"
            android:layout_marginRight="20dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/security_mode"
                android:id="@+id/text_EnableSecurity"
                android:phoneNumber="false"
                android:textSize="16sp"
                android:layout_marginTop="10dp"
                android:layout_marginLeft="20dp" />

            <ToggleButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/btn_Security"
                android:layout_marginLeft="40dp"
                android:layout_weight="0"
                android:textOff="Disable"
                android:textOn="Enable"
                android:layout_marginTop="10dp" />

        </LinearLayout>

    </LinearLayout>

    <View
        android:layout_height="2dip"
        android:background="#FF909090"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:layout_width="match_parent" />

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/layout_Excution"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/easysetup_sequence"
            android:id="@+id/textView22"
            android:layout_marginLeft="10dp"
            android:textSize="16sp" />

        <RadioGroup
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="5dp"
            android:id="@+id/rg_EasysetupProcess"
            android:layout_marginLeft="20dp">

            <RadioButton
                android:layout_width="160dp"
                android:layout_height="32dp"
                android:text="@string/securityprovisioning"
                android:id="@+id/btn_configurSec"
                android:checked="false"
                android:textSize="12sp" />

            <RadioButton
            android:layout_width="160dp"
            android:layout_height="32dp"
            android:text="GetConfiguration"
            android:id="@+id/btn_getConfiguration"
            android:checked="false"
            android:textSize="12sp" />

            <RadioButton
                android:layout_width="173dp"
                android:layout_height="32dp"
                android:text="ProvisionDeviceConfig"
                android:id="@+id/btn_provisionDevConf"
                android:textSize="12sp" />

            <RadioButton
                android:layout_width="160dp"
                android:layout_height="32dp"
                android:text="@string/cloudprovisioning"
                android:id="@+id/btn_provisionCloudConf"
                android:textSize="12sp" />
        </RadioGroup>

    </LinearLayout>

    <View
        android:layout_height="2dip"
        android:background="#FF909090"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:layout_width="match_parent" />

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/scrollView" >

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/layout_Infomation"
            android:gravity="center_horizontal"
            android:weightSum="1">

            <LinearLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:id="@+id/layout_ConfigurSec"
                android:layout_marginTop="10dp"
                android:weightSum="1"
                android:visibility="gone">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/security_provisioning_state"
                    android:id="@+id/textView10" />

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_secState"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="80dp"
                        android:layout_height="wrap_content"
                        android:text="State"
                        android:id="@+id/textView12"
                        android:layout_gravity="center_vertical" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="empty"
                        android:id="@+id/txt_secState" />

                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/linearLayout2"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="80dp"
                        android:layout_height="wrap_content"
                        android:text="Device ID"
                        android:id="@+id/textView"
                        android:layout_gravity="center_vertical" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="empty"
                        android:id="@+id/txt_secDevID" />
                </LinearLayout>

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="82dp"
                    android:layout_weight="0.64"></FrameLayout>

                <Button
                    android:layout_width="90dp"
                    android:layout_height="wrap_content"
                    android:text="START"
                    android:id="@+id/btn_startConfigureSec"
                    android:layout_marginTop="10dp"
                    android:layout_gravity="bottom|right" />

            </LinearLayout>

            <LinearLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:id="@+id/layout_GetConfiguration"
                android:layout_marginTop="10dp"
                android:visibility="gone">

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="@string/enrollee_property_data"
                        android:id="@+id/textView4" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="state : "
                        android:id="@+id/textView18"
                        android:layout_marginLeft="80dp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="wait"
                        android:id="@+id/txt_getConfigurationState" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_devName"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="devName"
                        android:id="@+id/textView7"
                        android:layout_gravity="center_vertical" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="empty"
                        android:id="@+id/txt_devName" />

                </LinearLayout>

		<LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_modelNumber"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="modelNumber"
                        android:id="@+id/textView7"
                        android:layout_gravity="center_vertical" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="empty"
                        android:id="@+id/txt_modelNumber" />

                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_devType"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="devType"
                        android:id="@+id/textView8"
                        android:layout_gravity="center_vertical" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="empty"
                        android:id="@+id/txt_devType" />

                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_devSubType"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="devSubType"
                        android:id="@+id/textView9"
                        android:layout_gravity="center_vertical" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="empty"
                        android:id="@+id/txt_devSubType" />

                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_wifimode"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="wifi mode"
                        android:id="@+id/textView20"
                        android:layout_gravity="center_vertical" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="empty"
                        android:id="@+id/txt_wifiMode" />

                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_wififreq"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="wifi freq"
                        android:id="@+id/textView21"
                        android:layout_gravity="center_vertical" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="empty"
                        android:id="@+id/txt_wifiFreq" />

                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_coludAccessAble"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="CloudAccessable"
                        android:id="@+id/textView14"
                        android:layout_gravity="center_vertical" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="empty"
                        android:id="@+id/txt_cloudAccessable" />

                </LinearLayout>

                <Button
                    android:layout_width="90dp"
                    android:layout_height="wrap_content"
                    android:text="@string/start"
                    android:id="@+id/btn_startGetConfiguration"
                    android:layout_gravity="bottom|right" />

            </LinearLayout>

            <LinearLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:id="@+id/layout_ProvisionDevConf"
                android:layout_marginTop="10dp"
                android:visibility="gone">

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="@string/enroller_infomation"
                        android:id="@+id/textView_DataProvisioning" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="state : "
                        android:id="@+id/textView19"
                        android:layout_marginLeft="80dp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="wait"
                        android:id="@+id/txt_provisionDevConfState" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/linearLayout3"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="language"
                        android:id="@+id/textView2"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_Language"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="korean" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/linearLayout4"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="country"
                        android:id="@+id/textView6"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_Country"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="korea" />
                </LinearLayout>

		<LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_InputLocation"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="location"
                        android:id="@+id/textView23"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_Location"
                        android:text="Test_Location"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_EnrollerSSID"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp">

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="@string/enroller_ssid"
                        android:id="@+id/txt_ssid"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_EnrollerSSID"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="SSID" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_EnrollerPW"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="Enter Enroller's PW"
                        android:id="@+id/txt_pass"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_EnrollerPW"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="PW" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_DiscoveryChannel"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="Enter Discovery Ch."
                        android:id="@+id/textView11"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_DiscoveryChannel"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="1" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_LocationAddr"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="Enter Addr"
                        android:id="@+id/textView11"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_LocationAddr"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="addr=Seoul, Rep. of Korea" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_LocationZip"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="Enter Zip code"
                        android:id="@+id/textView11"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_LocationZip"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="zip=02848" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_LocationBuilding"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="Enter Building name"
                        android:id="@+id/textView11"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_LocationBuilding"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="bd=apartment" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_EnrollerAuthType"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="@string/select_enroller_authentication_type"
                        android:id="@+id/txt_authtype"
                        android:layout_gravity="center_vertical" />

                    <Spinner
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/spinner_authType"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:spinnerMode="dropdown" />

                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/layout_EnrollerEncType"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="@string/select_enroller_encription_type"
                        android:id="@+id/textView5"
                        android:layout_gravity="center_vertical" />

                    <Spinner
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/spinner_encType"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:spinnerMode="dropdown" />

                </LinearLayout>

                <Button
                    android:layout_width="90dp"
                    android:layout_height="wrap_content"
                    android:text="START"
                    android:id="@+id/btn_startProvisionDevConf"
                    android:layout_marginTop="10dp"
                    android:layout_gravity="bottom|right" />

            </LinearLayout>

            <LinearLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:id="@+id/layout_ProvisionCloudConf"
                android:layout_marginTop="10dp"
                android:visibility="gone">

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="Cloud Information"
                        android:id="@+id/textView15" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="state : "
                        android:id="@+id/textView24"
                        android:layout_marginLeft="80dp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="wait"
                        android:id="@+id/txt_provisionCloudConfState" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/linearLayout11"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="Enter Target Cloud's Authcode"
                        android:id="@+id/textView16"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_authcode"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="authcode" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/linearLayout12"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="Enter Target Cloud's AuthProvider"
                        android:id="@+id/textView17"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_authprovider"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="authprovider" />
                </LinearLayout>

                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/linearLayout"
                    android:weightSum="1"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:layout_width="130dp"
                        android:layout_height="wrap_content"
                        android:text="Enter Target Cloud's Interface server"
                        android:id="@+id/textView3"
                        android:layout_gravity="center_vertical" />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/editText_ciserver"
                        android:layout_marginLeft="20dp"
                        android:layout_gravity="center_vertical"
                        android:text="ciserver" />
                </LinearLayout>

                <Button
                    android:layout_width="90dp"
                    android:layout_height="wrap_content"
                    android:text="START"
                    android:id="@+id/btn_startProvisionCloudConf"
                    android:layout_marginTop="10dp"
                    android:layout_gravity="bottom|right" />

            </LinearLayout>
        </LinearLayout>
    </ScrollView>

</LinearLayout>


text:
<?php

namespace erdiko\shopify\controllers;
use \erdiko\shopify\ShopifyApiException;
use \erdiko\shopify\ShopifyCurlException;

/**
 * ShopifyExample Class  extends \erdiko\shopify\Shopify
 */
class Shopify extends \erdiko\core\Controller
{
	/** Cache Object */
    private $cacheObj;

	/** Shopify Object */
	protected $shopify;

	/** Before */
	public function _before()
	{
		$this->setThemeName('bootstrap');
		$this->prepareTheme();
	}

	/**
	 * Get
	 *
	 * @param mixed $var
	 * @return mixed
	 */
	public function get($var = null)
	{
		if(!empty($var))
		{
			// load action based off of naming conventions
			return $this->_autoaction($var, 'get');

		} else {
			return $this->getIndex();
		}
	}

	/**
	 * Index Action
	 */
	public function getIndex()
	{
		$metafield = new \erdiko\shopify\models\Metafield; // instantiate model to force authentication

		$this->setTitle('Shopify Examples');
		$this->setContent( $this->getView('shopify/index', null, dirname(__DIR__)) );
	}

	/**
	 * Get Metafields
	 */
	public function getMetafields()
	{
		$metafield = new \erdiko\shopify\models\Metafield;
		$data = $metafield->getMetafields();

		$this->setTitle('Shopify Metafields');
		$this->setContent( $this->getLayout('json', $data, dirname(__DIR__)) );
	}

	/**
	 * Get Metafields
	 */
	public function getMetafieldsTest()
	{
		$metafield = new \erdiko\shopify\models\Metafield;
		$meta = array(
			"metafield" => array(
				"namespace" => $metafield->getNamespace(),
    			"key" => "warehouse",
    			"value" => 25,
                "value_type" => "integer"
        ));

		$data = $metafield->setMetafields($meta);

		$this->setTitle('Shopify Metafields');
		$this->setContent( $this->getLayout('json', $data, dirname(__DIR__)) );
	}

	/**
	 * Get Customers
	 */
	public function getCustomers()
	{
		$customer = new \erdiko\shopify\models\Customer;

		$message="";
		$isError=FALSE;

		try {
            $data = $customer->getCustomers();
		} catch(ShopifyApiException $e) {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in getting Customer list :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];
        	$isError=TRUE;
        } catch(ShopifyCurlException $e) {
           $message="Error :: Shopify Curl Exception";
           $isError=TRUE;
        } catch (Exception $e) {
           $message=$e->getMessage();
           $isError=TRUE;
        }

        if(!$isError) {
            $this->setTitle('Shopify Customers');
            $this->setContent( $this->getLayout('json', $data, dirname(__DIR__)) );
        } else {
            $this->setContent( $this->getLayout('message', $message) );
        }

	}

	/**
	 * Get Orders
	 */
	public function getOrders()
	{
		$order = new \erdiko\shopify\models\Order;

		$message="";
		$isError=FALSE;

        try {
            $data = $order->getOrders();
        } catch(ShopifyApiException $e) {
            $response_headers=$e->getResponseHeaders();
            $message = "Error in getting order list :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];
            $isError=TRUE;
        } catch(ShopifyCurlException $e) {
            $message="Error :: Shopify Curl Exception";
            $isError=TRUE;
        } catch (Exception $e) {
            $message=$e->getMessage();
            $isError=TRUE;
        }

        if(!$isError) {
            $this->setTitle('Shopify Orders');
            $this->setContent($this->getLayout('json', $data, dirname(__DIR__)));
        } else {
        	$this->setContent($this->getLayout('message', $message));
        }
	}

	/**
	 * Get Products
	 */
	public function getProducts()
	{
        $product = new \erdiko\shopify\models\Product;
        try {
            $data = $product->getProducts();
        } catch(ShopifyApiException $e) {
            $response_headers=$e->getResponseHeaders();
            $message = "Error in getting product list :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];
            $isError=TRUE;
        } catch(ShopifyCurlException $e) {
            $message="Error :: Shopify Curl Exception";
            $isError=TRUE;
        } catch (Exception $e) {
            $message=$e->getMessage();
            $isError=TRUE;
        }

        if(!$isError) {
            $this->setTitle('Shopify Product Grid');
            $this->setContent( $this->getLayout('grid/shopify', $data, dirname(__DIR__)) );
        } else{

        	$this->setContent( $this->getLayout('message', $message) );
        }
	}

	/**
	 * Create Metafield for a product
	 */
	public function getCreateProductMetaField()
	{
		$metafield = new \erdiko\shopify\models\Metafield;
		$productID=$_GET['product_id'];
		$args=array(
			"metafield"=>array("namespace" => "inventory",
    		"key" => $_GET['key'],
    		"value"=> $_GET['value'],
    		"value_type" =>$_GET['value_type'])
			);
		$message = "successfully processed the request";
		try{
			$metafield->setProductMetaField($productID,$args);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in adding Product Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
		$this->setContent( $this->getLayout('message', $message) );

	}

	/**
	 * Get Metafields of a product
	 */
	public function getProductMetaFields()
	{
		$metafield = new \erdiko\shopify\models\Metafield;
		$productID=$_GET['product_id'];

		$message="";
		$isError=FALSE;

		try{
			$data=$metafield->getProductMetaFields($productID);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in getting product list :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];
        	$isError=TRUE;
        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
           $isError=TRUE;
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
           $isError=TRUE;
        }

        if(!$isError){
        	$this->setTitle('Shopify: Metafields');
			$this->setContent( $this->getLayout('grid/metaDataListing', $data, dirname(__DIR__)) );
        } else{

        	$this->setContent( $this->getLayout('message', $message) );
        }

	}

	/**
	 * Edit Metafield of a product
	 */
	public function getEditProductMetaField()
	{
		$metafield = new \erdiko\shopify\models\Metafield;
		$productID=$_GET['product_id'];
		$metaFieldID=$_GET['id'];
		$args=array(
			"metafield"=>array(
			"id" => $_GET['id'],
    		"value"=> $_GET['value'],
    		"value_type"=>$_GET['value_type'])
			);
		$message = "successfully processed the request";
		try{
			$data=$metafield->updateProductMetaField($productID,$metaFieldID,$args);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in editing Product Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
		$this->setContent( $this->getLayout('message', $message) );
	}

	/**
	 * Delete Metafield of a product
	 */
    public function getDeleteProductMetaData()
    {
		$metafield = new \erdiko\shopify\models\Metafield;
		$productID=$_GET['product_id'];
		$metaFieldID=$_GET['id'];

		$message = "successfully processed the request";
		try{
			$metafield->deleteProductMetaField($productID,$metaFieldID,array());
		}
        catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in adding Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
        $this->setContent( $this->getLayout('message', $message) );
	}

	/**
	 * Show the userform to edit the Metafields
	 */
    public function getShowEdit()
    {
		$data=array(
			"product_id"=>$_GET['product_id'],
			"id"=>$_GET['id'],
			"key"=>$_GET['key'],
			"value"=>$_GET['value'],
			"value_type"=>$_GET['value_type']);
		$this->setTitle('Edit Meta Data Fields');
		$this->setContent( $this->getView('shopify/editForm',$data, dirname(__DIR__)) );
	}

	/**
	 * Show the userform to add Metafield of a product
	 */
    public function getShowForm()
    {
		$data=$_GET['product_id'];
		$this->setTitle('Create New Meta Field');
		$this->setContent($this->getView('shopify/formView',$data,dirname(__DIR__)));
	}

	/**
	 * Get the list of existing blogs
	 */
    public function getBlogs()
    {

		$blog = new \erdiko\shopify\models\Blog;

		$message="";
		$isError=FALSE;

		try{
			$data = $blog->getBlogs();
		} catch(ShopifyApiException $e) {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in adding Metafield :: "
                        . $response_headers['http_status_code'].":"
                        . $response_headers['http_status_message'];
        	$isError = TRUE;
        } catch(ShopifyCurlException $e) {
           $message = "Error :: Shopify Curl Exception";
           $isError = TRUE;
        } catch (Exception $e) {
           $message = $e->getMessage();
           $isError = TRUE;
        }

        if(!$isError){
        	$this->setTitle('Shopify Blogs');
            $this->setContent( $this->getLayout('json', $data, dirname(__DIR__)) );
        } else{

        	$this->setContent( $this->getLayout('message', $message) );
        }

	}

	/**
	 * Add Metafields to a blog
	 */
    public function getAddBlogMetaField()
    {

		$metafield = new \erdiko\shopify\models\Metafield;
		$data = array(
			"blog"=>array(
				"id" => $_GET['blog_id'],
				"metafields"=>array(array(
					"key" => $_GET['key'],
        			"value"=> $_GET['value'] ,
        			"value_type"=> $_GET['value_type'],
        			"namespace" => $metafield->getNamespace()
					))
				)
			);
		$message = "successfully processed the request";
		try{
			$metafield->setBlogMetaField($_GET['blog_id'],$data);
		}
        catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in adding Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
        $this->setContent( $this->getLayout('message', $message) );

	}

	/**
	 * Get the blog Metafields
	 */
    public function getBlogMetaFields()
    {
		$metafield = new \erdiko\shopify\models\Metafield;
		$blogID = $_GET['blog_id'];

		$message="";
		$isError=FALSE;

		try{
			$data=$metafield->getBlogMetaFields($blogID);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in adding Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];
        	$isError=TRUE;
        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
           $isError=TRUE;
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
           $isError=TRUE;
        }

        if(!$isError){
        	$this->setTitle('Shopify Blogs Metafields');
			$this->setContent( $this->getLayout('grid/blogsMetaDataListing', $data, dirname(__DIR__)) );
        } else{

        	$this->setContent( $this->getLayout('message', $message) );
        }
	}

	/**
	 * Edit Metafield of a blog
	 */
	public function getEditBlogMetaField()
	{
		$metafield = new \erdiko\shopify\models\Metafield;
		$blogID=$_GET['blog_id'];
		$metaFieldID=$_GET['id'];
		$args=array(
			"metafield"=>array(
			"id" => $_GET['id'],
    		"value"=> $_GET['value'],
    		"value_type"=>$_GET['value_type'])
			);

		$message = "successfully processed the request";
		try{
			$metafield->updateBlogMetaField($blogID,$metaFieldID,$args);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in editing Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
        $this->setContent( $this->getLayout('message', $message) );

	}

	/**
	 * Delete Metafield of a blog
	 */
    public function getDeleteBlogMetaData()
    {
		$metafield = new \erdiko\shopify\models\Metafield;
		$blogID=$_GET['blog_id'];
		$metaFieldID=$_GET['id'];

		$message = "successfully processed the request";
		try{
			$metafield->deleteBlogMetaField($blogID,$metaFieldID,array());
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in deleting Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
        $this->setContent( $this->getLayout('message', $message) );
	}

	/**
	 * Show the userform to edit the Blog Metafields
	 */
    public function getShowBlogEdit()
    {
		$data=array(
			"blog_id"=>$_GET['blog_id'],
			"id"=>$_GET['id'],
			"key"=>$_GET['key'],
			"value"=>$_GET['value'],
			"value_type"=>$_GET['value_type']);
		$this->setTitle('Edit Meta Data Fields');
		$this->setContent( $this->getView('shopify/editBlogForm',$data, dirname(__DIR__)) );
	}

	/**
	 * Show the userform to add Metafield of a product
	 */
    public function getShowBlogMetaDataAddForm()
    {
		$data=$_GET['blog_id'];
		$this->setTitle('Create New Meta Field');
		$this->setContent($this->getView('shopify/addBlogMetaDataFormView',$data,dirname(__DIR__)));
	}

	/**
	 *
	 */
    private function retrieveBlogArticlesHelper($blogID,$type)
    {
		$blog = new \erdiko\shopify\models\Blog;
		$data=$blog->getBlogArticles($blogID);

		$message="";
		$isError=FALSE;

		try{
			$data = $blog->getBlogArticles($blogID);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in adding Metafield :: "
                . $response_headers['http_status_code'] . ":"
                . $response_headers['http_status_message'];
        	$isError=TRUE;
        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
           $isError=TRUE;
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
           $isError=TRUE;
        }

        if(!$isError){
        	$this->setTitle('Blog Articles');
        	array_push($data,$blogID);
        	if(!strcmp($type,"articleInfoPage")){
                $this->setContent( $this->getLayout('json', $data, dirname(__DIR__)) );
        	} else{
                $this->setContent( $this->getLayout('json', $data, dirname(__DIR__)) );

        	}

        } else{

        	$this->setContent( $this->getLayout('message', $message) );
        }

	}

	/**
	 * Get All Blog Articles
	 */
    public function getBlogArticles()
    {
		$blogID=$_GET['blog_id'];
		$this->retrieveBlogArticlesHelper($blogID,"blogArticlesPage");
	}

	/**
	 * Get all the blog article metafields
	 */
    public function getBlogArticleMetafields()
    {
		$blogID = $_GET['blog_id'];
		$articleID = $_GET['article_id'];
		$metafield = new \erdiko\shopify\models\Metafield;

		$message="";
		$isError=FALSE;

		try{
			$data=$metafield->getBlogArticleMetaFields($articleID);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in adding Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];
        	$isError=TRUE;
        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
           $isError=TRUE;
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
           $isError=TRUE;
        }

        if(!$isError){
        	$this->setTitle('Blog Articles Metafields');
			$this->setContent( $this->getLayout('grid/articleMetaDataListing', $data, dirname(__DIR__)) );
        } else{

        	$this->setContent( $this->getLayout('message', $message) );
        }
	}

	/**
	 * Add Metafields to a blog article
	 */
    public function getAddBlogArticleMetaField()
    {

		$metafield = new \erdiko\shopify\models\Metafield;
		$data = array(
			"article"=>array(
				"id" => $_GET['article_id'],
				"metafields"=>array(array(
					"key" => $_GET['key'],
        			"value"=> $_GET['value'] ,
        			"value_type"=> $_GET['value_type'],
        			"namespace" => $metafield->getNamespace()
					))
				)
			);

		$message = "successfully processed the request";
		try{
			$metafield->setBlogArticleMetaField($_GET['blog_id'],$_GET['article_id'],$data);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in deleting Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
        $this->setContent( $this->getLayout('message', $message) );
	}

	/**
	 * Edit the blog article metafields
	 */
	public function getEditBlogArticleMetaField()
	{
		$metafield = new \erdiko\shopify\models\Metafield;

		$metaFieldID=$_GET['id'];
		$articleID = $_GET['article_id'];
		$args=array(
			"metafield"=>array(
			"id" => $_GET['id'],
    		"value"=> $_GET['value'],
    		"value_type"=>$_GET['value_type'])
			);

		$message = "successfully processed the request";
		try{
			$data=$metafield->updateBlogArticleMetaField($articleID,$metaFieldID,$args);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in editing Blog Article Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
        $this->setContent( $this->getLayout('message', $message) );
	}

    /**
     *
     */
    public function getAddArticleInfo()
    {

		$metafield = new \erdiko\shopify\models\Metafield;
		$data = array(
			"article"=>array(
				"id" => $_GET['article_id'],
				"metafields"=>array(array(

					"key" => "src",
        			"value"=> $_GET['src'] ,

        			"value_type"=> "string",
        			"namespace" => $metafield->getNamespace()
					),
				array(
					"key" => "url",
        			"value"=> $_GET['url'] ,
        			"value_type"=> "string",
        			"namespace" => $metafield->getNamespace()
					),
				array(
					"key" => "title",
        			"value"=> $_GET['title'] ,
        			"value_type"=> "string",
        			"namespace" => $metafield->getNamespace()
					))
				)
			);

		$message = "successfully processed the request";
		try{
			$metafield->setBlogArticleMetaField($_GET['blog_id'],$_GET['article_id'],$data);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in deleting Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
        $this->setContent( $this->getLayout('message', $message) );
    }

    /**
	 * Delete the blog article metafields
	 */
	public function getDeleteBlogArticleMetaField()
	{
		$metafield = new \erdiko\shopify\models\Metafield;
		$metaFieldID=$_GET['id'];
		$articleID = $_GET['article_id'];

		$message = "successfully processed the request";
		try{
			$metafield->deleteBlogArticleMetaField($articleID,$metaFieldID,array());
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in editing Blog Article Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
            $this->setContent( $this->getLayout('message', $message) );
	}

	/**
	 * Show the userform to edit the Blog Metafields
	 */
    public function getShowBlogArticleEdit()
    {
		$data=array(
			"article_id"=>$_GET['article_id'],
			"id"=>$_GET['id'],
			"key"=>$_GET['key'],
			"value"=>$_GET['value'],
			"value_type"=>$_GET['value_type']);
		$this->setTitle('Edit Meta Data Fields');
		$this->setContent( $this->getView('shopify/editBlogArticleMetaFieldForm',$data, dirname(__DIR__)) );
	}

	/**
	 * Show the userform to add Metafield of a blog article
	 */
    public function getShowBlogArticleMetaDataForm()
    {

		$data=array("article_id"=>$_GET['article_id'],
					"blog_id"=>$_GET['blog_id']);
		$this->setTitle('Create New Article Meta Field');
		$this->setContent($this->getView('shopify/addBlogArticleMetaDataForm',$data,dirname(__DIR__)));
	}

	/**
	 * Display article content
	 */
    public function getShowArticleContent()
    {
		$blog = new \erdiko\shopify\models\Blog;
		$blogID=$_GET['blog_id'];
		$articleID=$_GET['article_id'];
		$this->setTitle('Article Content');
		$data=$blog->getArticle($blogID,$articleID);
		$body=array('html'=>$data['body_html'],'title'=>$data['title']);
		$this->setContent($this->getView('shopify/grid/displayData',$body,dirname(__DIR__)));
    }

	/**
	 */
    public function getShowArticleInfo()
    {
		$metafield = new \erdiko\shopify\models\Metafield;
		$blogID=$_GET['blog_id'];
		$articleID=$_GET['article_id'];
		$data=$metafield->getArticleInfo($articleID,$blogID);
		$this->setContent($this->getView('shopify/grid/articleInfoView',$data,dirname(__DIR__)));
	}

	/**
     */
    public function getShowAddArticleInfo()
    {
    	$data=array("article_id"=>$_GET['article_id'],
					"blog_id"=>$_GET['blog_id']);
		$this->setTitle('Add Article Info');
		$this->setContent($this->getView('shopify/addArticleInfoForm',$data,dirname(__DIR__)));
    }

    /**
     */
    public function getDeleteArticleInfo()
    {
    	$metafield = new \erdiko\shopify\models\Metafield;
    	$srcID=$_GET['src_id'];
    	$urlID=$_GET['url_id'];
    	$titleID=$_GET['title_id'];
    	$articleID=$_GET['article_id'];

        $message = "successfully processed the request";
		try{

			$metafield->deleteBlogArticleMetaField($articleID,$srcID,$args=array());
    		$metafield->deleteBlogArticleMetaField($articleID,$urlID,$args=array());
        	$metafield->deleteBlogArticleMetaField($articleID,$titleID,$args=array());

		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in editing Blog Article Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
        $this->setContent( $this->getLayout('message', $message) );

    }

    /**
     *
     */
    public function getShowEditArticleInfo()
    {
    	$data=array(
    		"src_id"=>$_GET['src_id'],
    		"url_id"=>$_GET['url_id'],
    		"title_id"=>$_GET['title_id'],
			"article_id" => $_GET['article_id'],
			"src"=>$_GET['src'],
			"url"=>$_GET['url'],
			"title"=>$_GET['title']
		);
		$this->setTitle('Edit Article Info');
		$this->setContent($this->getView('shopify/editArticleInfoForm',$data,dirname(__DIR__)));

    }

    /**
     */
    public function getEditArticleInfo()
    {
    	$metafield = new \erdiko\shopify\models\Metafield;

		$srcID=$_GET['src_id'];
    	$urlID=$_GET['url_id'];
    	$titleID=$_GET['title_id'];
		$articleID = $_GET['article_id'];

		$args_src=array(
			"metafield"=>array(
			"id" => $srcID,
    		"value"=> $_GET['src'],
    		"value_type"=>"string")
			);
		$args_url=array(
			"metafield"=>array(
			"id" => $urlID,
    		"value"=> $_GET['url'],
    		"value_type"=>"string")
			);
		$args_title=array(
			"metafield"=>array(
			"id" => $titleID,
    		"value"=> $_GET['title'],
    		"value_type"=>"string")
			);

		$message = "successfully processed the request";
		try{

			$metafield->updateBlogArticleMetaField($articleID,$srcID,$args_src);
			$metafield->updateBlogArticleMetaField($articleID,$urlID,$args_url);
			$metafield->updateBlogArticleMetaField($articleID,$titleID,$args_title);
		}
		catch(ShopifyApiException $e)
        {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in editing Blog Article Metafield :: ".$response_headers['http_status_code'].":".$response_headers['http_status_message'];

        }
        catch(ShopifyCurlException $e)
        {
           $message="Error :: Shopify Curl Exception";
        }
        catch (Exception $e)
        {
           $message=$e->getMessage();
        }
        $this->setContent( $this->getLayout('message', $message) );
    }

    /**
     */
    public function getPages()
    {

		$page = new \erdiko\shopify\models\Page;

		$message = "";
		$isError = FALSE;

		try{
			$data = $page->getPages();
		} catch(ShopifyApiException $e) {
        	$response_headers=$e->getResponseHeaders();
            $message = "Error in adding Metafield :: "
                        . $response_headers['http_status_code'].":"
                        . $response_headers['http_status_message'];
        	$isError = TRUE;
        } catch(ShopifyCurlException $e) {
           $message = "Error :: Shopify Curl Exception";
           $isError = TRUE;
        } catch (Exception $e) {
           $message = $e->getMessage();
           $isError = TRUE;
        }

        if(!$isError){
        	$this->setTitle('Shopify Pages');
            $this->setContent( $this->getLayout('json', $data, dirname(__DIR__)) );
        } else{
        	$this->setContent( $this->getLayout('message', $message) );
        }

	}

}

redpajama_set_name: RedPajamaGithub


text:
#include "BootMaintenanceManager.h"

/**
  Delete Boot Option that represent a Deleted state in BootOptionMenu.

  @retval EFI_SUCCESS   If all boot load option EFI Variables corresponding to
                        BM_LOAD_CONTEXT marked for deletion is deleted.
  @retval EFI_NOT_FOUND If can not find the boot option want to be deleted.
  @return Others        If failed to update the "BootOrder" variable after deletion.

**/
EFI_STATUS
Var_DelBootOption (
  VOID
  )
{
  BM_MENU_ENTRY   *NewMenuEntry;
  BM_LOAD_CONTEXT *NewLoadContext;
  EFI_STATUS      Status;
  UINTN           Index;
  UINTN           Index2;

  Index2  = 0;
  for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
    NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, (Index - Index2));
    if (NULL == NewMenuEntry) {
      return EFI_NOT_FOUND;
    }

    NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
    if (!NewLoadContext->Deleted) {
      continue;
    }

    Status = EfiBootManagerDeleteLoadOptionVariable (NewMenuEntry->OptionNumber,LoadOptionTypeBoot);
    if (EFI_ERROR (Status)) {
     return Status;
    }
    Index2++;
    //
    // If current Load Option is the same as BootNext,
    // must delete BootNext in order to make sure
    // there will be no panic on next boot
    //
    if (NewLoadContext->IsBootNext) {
      EfiLibDeleteVariable (L"BootNext", &gEfiGlobalVariableGuid);
    }

    RemoveEntryList (&NewMenuEntry->Link);
    BOpt_DestroyMenuEntry (NewMenuEntry);
    NewMenuEntry = NULL;
  }

  BootOptionMenu.MenuNumber -= Index2;

  return EFI_SUCCESS;
}

/**
  Delete Load Option that represent a Deleted state in DriverOptionMenu.

  @retval EFI_SUCCESS       Load Option is successfully updated.
  @retval EFI_NOT_FOUND     Fail to find the driver option want to be deleted.
  @return Other value than EFI_SUCCESS if failed to update "Driver Order" EFI
          Variable.

**/
EFI_STATUS
Var_DelDriverOption (
  VOID
  )
{
  BM_MENU_ENTRY   *NewMenuEntry;
  BM_LOAD_CONTEXT *NewLoadContext;
  EFI_STATUS      Status;
  UINTN           Index;
  UINTN           Index2;

  Index2  = 0;
  for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
    NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, (Index - Index2));
    if (NULL == NewMenuEntry) {
      return EFI_NOT_FOUND;
    }

    NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
    if (!NewLoadContext->Deleted) {
      continue;
    }
    Status = EfiBootManagerDeleteLoadOptionVariable (NewMenuEntry->OptionNumber,LoadOptionTypeDriver);
    if (EFI_ERROR (Status)) {
      return Status;
    }

    Index2++;

    RemoveEntryList (&NewMenuEntry->Link);
    BOpt_DestroyMenuEntry (NewMenuEntry);
    NewMenuEntry = NULL;
  }

  DriverOptionMenu.MenuNumber -= Index2;

  return EFI_SUCCESS;
}

/**
  This function delete and build multi-instance device path for
  specified type of console device.

  This function clear the EFI variable defined by ConsoleName and
  gEfiGlobalVariableGuid. It then build the multi-instance device
  path by appending the device path of the Console (In/Out/Err) instance
  in ConsoleMenu. Then it scan all corresponding console device by
  scanning Terminal (built from device supporting Serial I/O instances)
  devices in TerminalMenu. At last, it save a EFI variable specifed
  by ConsoleName and gEfiGlobalVariableGuid.

  @param ConsoleName     The name for the console device type. They are
                         usually "ConIn", "ConOut" and "ErrOut".
  @param ConsoleMenu     The console memu which is a list of console devices.
  @param UpdatePageId    The flag specifying which type of console device
                         to be processed.

  @retval EFI_SUCCESS    The function complete successfully.
  @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.

**/
EFI_STATUS
Var_UpdateConsoleOption (
  IN UINT16                     *ConsoleName,
  IN BM_MENU_OPTION             *ConsoleMenu,
  IN UINT16                     UpdatePageId
  )
{
  EFI_DEVICE_PATH_PROTOCOL  *ConDevicePath;
  BM_MENU_ENTRY             *NewMenuEntry;
  BM_CONSOLE_CONTEXT        *NewConsoleContext;
  BM_TERMINAL_CONTEXT       *NewTerminalContext;
  EFI_STATUS                Status;
  VENDOR_DEVICE_PATH        Vendor;
  EFI_DEVICE_PATH_PROTOCOL  *TerminalDevicePath;
  UINTN                     Index;

  GetEfiGlobalVariable2 (ConsoleName, (VOID**)&ConDevicePath, NULL);
  if (ConDevicePath != NULL) {
    EfiLibDeleteVariable (ConsoleName, &gEfiGlobalVariableGuid);
    FreePool (ConDevicePath);
    ConDevicePath = NULL;
  };

  //
  // First add all console input device from console input menu
  //
  for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {
    NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);

    NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
    if (NewConsoleContext->IsActive) {
      ConDevicePath = AppendDevicePathInstance (
                        ConDevicePath,
                        NewConsoleContext->DevicePath
                        );
    }
  }

  for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
    NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);

    NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
    if (((NewTerminalContext->IsConIn != 0) && (UpdatePageId == FORM_CON_IN_ID)) ||
        ((NewTerminalContext->IsConOut != 0)  && (UpdatePageId == FORM_CON_OUT_ID)) ||
        ((NewTerminalContext->IsStdErr  != 0) && (UpdatePageId == FORM_CON_ERR_ID))
        ) {
      Vendor.Header.Type    = MESSAGING_DEVICE_PATH;
      Vendor.Header.SubType = MSG_VENDOR_DP;

      ASSERT (NewTerminalContext->TerminalType < (ARRAY_SIZE (TerminalTypeGuid)));
      CopyMem (
        &Vendor.Guid,
        &TerminalTypeGuid[NewTerminalContext->TerminalType],
        sizeof (EFI_GUID)
        );
      SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));
      TerminalDevicePath = AppendDevicePathNode (
                            NewTerminalContext->DevicePath,
                            (EFI_DEVICE_PATH_PROTOCOL *) &Vendor
                            );
      ASSERT (TerminalDevicePath != NULL);
      ChangeTerminalDevicePath (TerminalDevicePath, TRUE);
      ConDevicePath = AppendDevicePathInstance (
                        ConDevicePath,
                        TerminalDevicePath
                        );
    }
  }

  if (ConDevicePath != NULL) {
    Status = gRT->SetVariable (
                    ConsoleName,
                    &gEfiGlobalVariableGuid,
                    VAR_FLAG,
                    GetDevicePathSize (ConDevicePath),
                    ConDevicePath
                    );
    if (EFI_ERROR (Status)) {
      return Status;
    }
  }

  return EFI_SUCCESS;

}

/**
  This function delete and build multi-instance device path ConIn
  console device.

  @retval EFI_SUCCESS    The function complete successfully.
  @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
**/
EFI_STATUS
Var_UpdateConsoleInpOption (
  VOID
  )
{
  return Var_UpdateConsoleOption (L"ConIn", &ConsoleInpMenu, FORM_CON_IN_ID);
}

/**
  This function delete and build multi-instance device path ConOut
  console device.

  @retval EFI_SUCCESS    The function complete successfully.
  @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
**/
EFI_STATUS
Var_UpdateConsoleOutOption (
  VOID
  )
{
  return Var_UpdateConsoleOption (L"ConOut", &ConsoleOutMenu, FORM_CON_OUT_ID);
}

/**
  This function delete and build multi-instance device path ErrOut
  console device.

  @retval EFI_SUCCESS    The function complete successfully.
  @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
**/
EFI_STATUS
Var_UpdateErrorOutOption (
  VOID
  )
{
  return Var_UpdateConsoleOption (L"ErrOut", &ConsoleErrMenu, FORM_CON_ERR_ID);
}

/**
  This function create a currently loaded Drive Option from
  the BMM. It then appends this Driver Option to the end of
  the "DriverOrder" list. It append this Driver Opotion to the end
  of DriverOptionMenu.

  @param CallbackData    The BMM context data.
  @param HiiHandle       The HII handle associated with the BMM formset.
  @param DescriptionData The description of this driver option.
  @param OptionalData    The optional load option.
  @param ForceReconnect  If to force reconnect.

  @retval other                Contain some errors when excuting this function.See function
                               EfiBootManagerInitializeLoadOption/EfiBootManagerAddLoadOptionVariabl
                               for detail return information.
  @retval EFI_SUCCESS          If function completes successfully.

**/
EFI_STATUS
Var_UpdateDriverOption (
  IN  BMM_CALLBACK_DATA         *CallbackData,
  IN  EFI_HII_HANDLE            HiiHandle,
  IN  UINT16                    *DescriptionData,
  IN  UINT16                    *OptionalData,
  IN  UINT8                     ForceReconnect
  )
{
  UINT16          Index;
  UINT16          DriverString[12];
  BM_MENU_ENTRY   *NewMenuEntry;
  BM_LOAD_CONTEXT *NewLoadContext;
  BOOLEAN         OptionalDataExist;
  EFI_STATUS      Status;
  EFI_BOOT_MANAGER_LOAD_OPTION  LoadOption;
  UINT8                         *OptionalDesData;
  UINT32                        OptionalDataSize;

  OptionalDataExist = FALSE;
  OptionalDesData = NULL;
  OptionalDataSize = 0;

  Index             = BOpt_GetDriverOptionNumber ();
  UnicodeSPrint (
    DriverString,
    sizeof (DriverString),
    L"Driver%04x",
    Index
    );

  if (*DescriptionData == 0x0000) {
    StrCpyS (DescriptionData, MAX_MENU_NUMBER, DriverString);
  }

  if (*OptionalData != 0x0000) {
    OptionalDataExist = TRUE;
    OptionalDesData = (UINT8 *)OptionalData;
    OptionalDataSize = (UINT32)StrSize (OptionalData);
  }

  NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
  if (NULL == NewMenuEntry) {
    return EFI_OUT_OF_RESOURCES;
  }

  Status = EfiBootManagerInitializeLoadOption (
             &LoadOption,
             Index,
             LoadOptionTypeDriver,
             LOAD_OPTION_ACTIVE | (ForceReconnect << 1),
             DescriptionData,
             CallbackData->LoadContext->FilePathList,
             OptionalDesData,
             OptionalDataSize
           );
  if (EFI_ERROR (Status)){
    return Status;
  }

  Status = EfiBootManagerAddLoadOptionVariable (&LoadOption,(UINTN) -1 );
  if (EFI_ERROR (Status)) {
    EfiBootManagerFreeLoadOption(&LoadOption);
    return Status;
  }

  NewLoadContext                  = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
  NewLoadContext->Deleted         = FALSE;
  NewLoadContext->Attributes = LoadOption.Attributes;
  NewLoadContext->FilePathListLength = (UINT16)GetDevicePathSize (LoadOption.FilePath);

  NewLoadContext->Description = AllocateZeroPool (StrSize (DescriptionData));
  ASSERT (NewLoadContext->Description != NULL);
  NewMenuEntry->DisplayString = NewLoadContext->Description;
  CopyMem (
    NewLoadContext->Description,
    LoadOption.Description,
    StrSize (DescriptionData)
    );

  NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));
  ASSERT (NewLoadContext->FilePathList != NULL);
  CopyMem (
    NewLoadContext->FilePathList,
    LoadOption.FilePath,
    GetDevicePathSize (CallbackData->LoadContext->FilePathList)
    );

  NewMenuEntry->HelpString    = UiDevicePathToStr (NewLoadContext->FilePathList);
  NewMenuEntry->OptionNumber  = Index;
  NewMenuEntry->DisplayStringToken = HiiSetString (HiiHandle, 0, NewMenuEntry->DisplayString, NULL);
  NewMenuEntry->HelpStringToken = HiiSetString (HiiHandle, 0, NewMenuEntry->HelpString, NULL);

  if (OptionalDataExist) {
    NewLoadContext->OptionalData = AllocateZeroPool (LoadOption.OptionalDataSize);
    ASSERT (NewLoadContext->OptionalData != NULL);
    CopyMem (
      NewLoadContext->OptionalData,
      LoadOption.OptionalData,
      LoadOption.OptionalDataSize
      );
  }

  InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
  DriverOptionMenu.MenuNumber++;

  EfiBootManagerFreeLoadOption(&LoadOption);

  return EFI_SUCCESS;
}

/**
  This function create a currently loaded Boot Option from
  the BMM. It then appends this Boot Option to the end of
  the "BootOrder" list. It also append this Boot Opotion to the end
  of BootOptionMenu.

  @param CallbackData    The BMM context data.

  @retval other                Contain some errors when excuting this function. See function
                               EfiBootManagerInitializeLoadOption/EfiBootManagerAddLoadOptionVariabl
                               for detail return information.
  @retval EFI_SUCCESS          If function completes successfully.

**/
EFI_STATUS
Var_UpdateBootOption (
  IN  BMM_CALLBACK_DATA              *CallbackData
  )
{
  UINT16          BootString[10];
  UINT16          Index;
  BM_MENU_ENTRY   *NewMenuEntry;
  BM_LOAD_CONTEXT *NewLoadContext;
  BOOLEAN         OptionalDataExist;
  EFI_STATUS      Status;
  BMM_FAKE_NV_DATA  *NvRamMap;
  EFI_BOOT_MANAGER_LOAD_OPTION  LoadOption;
  UINT8                         *OptionalData;
  UINT32                        OptionalDataSize;

  OptionalDataExist = FALSE;
  NvRamMap = &CallbackData->BmmFakeNvData;
  OptionalData = NULL;
  OptionalDataSize = 0;

  Index = BOpt_GetBootOptionNumber () ;
  UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", Index);

  if (NvRamMap->BootDescriptionData[0] == 0x0000) {
    StrCpyS (NvRamMap->BootDescriptionData, sizeof (NvRamMap->BootDescriptionData) / sizeof (NvRamMap->BootDescriptionData[0]), BootString);
  }

  if (NvRamMap->BootOptionalData[0] != 0x0000) {
    OptionalDataExist = TRUE;
    OptionalData = (UINT8 *)NvRamMap->BootOptionalData;
    OptionalDataSize = (UINT32)StrSize (NvRamMap->BootOptionalData);
  }

  NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
  if (NULL == NewMenuEntry) {
    return EFI_OUT_OF_RESOURCES;
  }

  Status = EfiBootManagerInitializeLoadOption (
             &LoadOption,
             Index,
             LoadOptionTypeBoot,
             LOAD_OPTION_ACTIVE,
             NvRamMap->BootDescriptionData,
             CallbackData->LoadContext->FilePathList,
             OptionalData,
             OptionalDataSize
           );
  if (EFI_ERROR (Status)){
    return Status;
  }

  Status = EfiBootManagerAddLoadOptionVariable (&LoadOption,(UINTN) -1 );
  if (EFI_ERROR (Status)) {
    EfiBootManagerFreeLoadOption(&LoadOption);
    return Status;
  }

  NewLoadContext                  = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
  NewLoadContext->Deleted         = FALSE;
  NewLoadContext->Attributes = LoadOption.Attributes;
  NewLoadContext->FilePathListLength = (UINT16) GetDevicePathSize (LoadOption.FilePath);

  NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->BootDescriptionData));
  ASSERT (NewLoadContext->Description != NULL);

  NewMenuEntry->DisplayString = NewLoadContext->Description;

  CopyMem (
    NewLoadContext->Description,
    LoadOption.Description,
    StrSize (NvRamMap->BootDescriptionData)
    );

  NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));
  ASSERT (NewLoadContext->FilePathList != NULL);
  CopyMem (
    NewLoadContext->FilePathList,
    LoadOption.FilePath,
    GetDevicePathSize (CallbackData->LoadContext->FilePathList)
    );

  NewMenuEntry->HelpString    = UiDevicePathToStr (NewLoadContext->FilePathList);
  NewMenuEntry->OptionNumber  = Index;
  NewMenuEntry->DisplayStringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, NewMenuEntry->DisplayString, NULL);
  NewMenuEntry->HelpStringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, NewMenuEntry->HelpString, NULL);

  if (OptionalDataExist) {
    NewLoadContext->OptionalData = AllocateZeroPool (LoadOption.OptionalDataSize);
    ASSERT (NewLoadContext->OptionalData != NULL);
    CopyMem (
      NewLoadContext->OptionalData,
      LoadOption.OptionalData,
      LoadOption.OptionalDataSize
      );
  }

  InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
  BootOptionMenu.MenuNumber++;

  EfiBootManagerFreeLoadOption(&LoadOption);

  return EFI_SUCCESS;
}

/**
  This function update the "BootNext" EFI Variable. If there is
  no "BootNext" specified in BMM, this EFI Variable is deleted.
  It also update the BMM context data specified the "BootNext"
  vaule.

  @param CallbackData    The BMM context data.

  @retval EFI_SUCCESS    The function complete successfully.
  @return                The EFI variable can be saved. See gRT->SetVariable
                         for detail return information.

**/
EFI_STATUS
Var_UpdateBootNext (
  IN BMM_CALLBACK_DATA            *CallbackData
  )
{
  BM_MENU_ENTRY     *NewMenuEntry;
  BM_LOAD_CONTEXT   *NewLoadContext;
  BMM_FAKE_NV_DATA  *CurrentFakeNVMap;
  UINT16            Index;
  EFI_STATUS        Status;

  Status            = EFI_SUCCESS;
  CurrentFakeNVMap  = &CallbackData->BmmFakeNvData;
  for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
    NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
    ASSERT (NULL != NewMenuEntry);

    NewLoadContext              = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
    NewLoadContext->IsBootNext  = FALSE;
  }

  if (CurrentFakeNVMap->BootNext == NONE_BOOTNEXT_VALUE) {
    EfiLibDeleteVariable (L"BootNext", &gEfiGlobalVariableGuid);
    return EFI_SUCCESS;
  }

  NewMenuEntry = BOpt_GetMenuEntry (
                  &BootOptionMenu,
                  CurrentFakeNVMap->BootNext
                  );
  ASSERT (NewMenuEntry != NULL);

  NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
  Status = gRT->SetVariable (
                  L"BootNext",
                  &gEfiGlobalVariableGuid,
                  VAR_FLAG,
                  sizeof (UINT16),
                  &NewMenuEntry->OptionNumber
                  );
  NewLoadContext->IsBootNext              = TRUE;
  CallbackData->BmmOldFakeNVData.BootNext = CurrentFakeNVMap->BootNext;
  return Status;
}

/**
  This function update the "BootOrder" EFI Variable based on
  BMM Formset's NV map. It then refresh BootOptionMenu
  with the new "BootOrder" list.

  @param CallbackData    The BMM context data.

  @retval EFI_SUCCESS             The function complete successfully.
  @retval EFI_OUT_OF_RESOURCES    Not enough memory to complete the function.
  @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.

**/
EFI_STATUS
Var_UpdateBootOrder (
  IN BMM_CALLBACK_DATA            *CallbackData
  )
{
  EFI_STATUS  Status;
  UINT16      Index;
  UINT16      OrderIndex;
  UINT16      *BootOrder;
  UINTN       BootOrderSize;
  UINT16      OptionNumber;

  //
  // First check whether BootOrder is present in current configuration
  //
  GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrder, &BootOrderSize);
  if (BootOrder == NULL) {
    return EFI_OUT_OF_RESOURCES;
  }

  ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.BootOptionOrder) / sizeof (CallbackData->BmmFakeNvData.BootOptionOrder[0])));

  //
  // OptionOrder is subset of BootOrder
  //
  for (OrderIndex = 0; (OrderIndex < BootOptionMenu.MenuNumber) && (CallbackData->BmmFakeNvData.BootOptionOrder[OrderIndex] != 0); OrderIndex++) {
    for (Index = OrderIndex; Index < BootOrderSize / sizeof (UINT16); Index++) {
      if ((BootOrder[Index] == (UINT16) (CallbackData->BmmFakeNvData.BootOptionOrder[OrderIndex] - 1)) && (OrderIndex != Index)) {
        OptionNumber = BootOrder[Index];
        CopyMem (&BootOrder[OrderIndex + 1], &BootOrder[OrderIndex], (Index - OrderIndex) * sizeof (UINT16));
        BootOrder[OrderIndex] = OptionNumber;
      }
    }
  }

  Status = gRT->SetVariable (
                  L"BootOrder",
                  &gEfiGlobalVariableGuid,
                  VAR_FLAG,
                  BootOrderSize,
                  BootOrder
                  );
  FreePool (BootOrder);

  BOpt_FreeMenu (&BootOptionMenu);
  BOpt_GetBootOptions (CallbackData);

  return Status;

}

/**
  This function update the "DriverOrder" EFI Variable based on
  BMM Formset's NV map. It then refresh DriverOptionMenu
  with the new "DriverOrder" list.

  @param CallbackData    The BMM context data.

  @retval EFI_SUCCESS           The function complete successfully.
  @retval EFI_OUT_OF_RESOURCES  Not enough memory to complete the function.
  @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.

**/
EFI_STATUS
Var_UpdateDriverOrder (
  IN BMM_CALLBACK_DATA            *CallbackData
  )
{
  EFI_STATUS  Status;
  UINT16      Index;
  UINT16      *DriverOrderList;
  UINT16      *NewDriverOrderList;
  UINTN       DriverOrderListSize;

  DriverOrderList     = NULL;
  DriverOrderListSize = 0;

  //
  // First check whether DriverOrder is present in current configuration
  //
  GetEfiGlobalVariable2 (L"DriverOrder", (VOID **) &DriverOrderList, &DriverOrderListSize);
  NewDriverOrderList = AllocateZeroPool (DriverOrderListSize);

  if (NewDriverOrderList == NULL) {
    return EFI_OUT_OF_RESOURCES;
  }
  //
  // If exists, delete it to hold new DriverOrder
  //
  if (DriverOrderList != NULL) {
    EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
    FreePool (DriverOrderList);
  }

  ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.DriverOptionOrder) / sizeof (CallbackData->BmmFakeNvData.DriverOptionOrder[0])));
  for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
    NewDriverOrderList[Index] = (UINT16) (CallbackData->BmmFakeNvData.DriverOptionOrder[Index] - 1);
  }

  Status = gRT->SetVariable (
                  L"DriverOrder",
                  &gEfiGlobalVariableGuid,
                  VAR_FLAG,
                  DriverOrderListSize,
                  NewDriverOrderList
                  );
  if (EFI_ERROR (Status)) {
    return Status;
  }

  BOpt_FreeMenu (&DriverOptionMenu);
  BOpt_GetDriverOptions (CallbackData);
  return EFI_SUCCESS;
}

/**
  Update the Text Mode of Console.

  @param CallbackData  The context data for BMM.

  @retval EFI_SUCCSS If the Text Mode of Console is updated.
  @return Other value if the Text Mode of Console is not updated.

**/
EFI_STATUS
Var_UpdateConMode (
  IN BMM_CALLBACK_DATA            *CallbackData
  )
{
  EFI_STATUS        Status;
  UINTN             Mode;
  CONSOLE_OUT_MODE  ModeInfo;

  Mode = CallbackData->BmmFakeNvData.ConsoleOutMode;

  Status = gST->ConOut->QueryMode (gST->ConOut, Mode, &(ModeInfo.Column), &(ModeInfo.Row));
  if (!EFI_ERROR(Status)) {
    Status = PcdSet32S (PcdSetupConOutColumn, (UINT32) ModeInfo.Column);
    if (!EFI_ERROR (Status)) {
      Status = PcdSet32S (PcdSetupConOutRow, (UINT32) ModeInfo.Row);
    }
  }

  return Status;
}


text:
class CStringImpl : public CShared
{
public:
    CStringImpl() { }
    ~CStringImpl() { delete chars; }
    CChar *chars;
    unsigned int len;
};

CString::CString()
{
    _impl = NULL;
}

CString::CString(const char *utf8)
{
    _impl = new CStringImpl();
    _impl->len = strlen(utf8);
    _impl->chars = new CChar[_impl->len];
    // FIXME: Do propert UTF-8 decoding here
    for (unsigned int i = 0; i < _impl->len; i++)
        _impl->chars[i] = utf8[i];
}

CString::CString(CChar *chars, unsigned int length)
{
    _impl = new CStringImpl();
    _impl->chars = new CChar[length];
    _impl->len = length;
}

CString::CString(const CString &other)
{
    _impl = other._impl;
}

CString::~CString()
{
}

CString &CString::operator=(const CString &other)
{
    _impl = other._impl;
    return *this;
}

unsigned int CString::length() const
{
    if (_impl.isNull())
        return 0;
    else
        return _impl->len;
}

CChar CString::charAt(int index) const
{
    if (_impl.isNull())
        return 0;
    else
        return _impl->chars[index];
}


text:
//  boost/chrono/stopwatches/strict_stopwatch.hpp  ------------------------------------------------------------//
//  Copyright 2011 Vicente J. Botet Escriba
//  Copyright (c) Microsoft Corporation 2014
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//  See http://www.boost.org/libs/libs/chrono/stopwatches for documentation.

#ifndef BOOST_CHRONO_STOPWATCHES_STRICT_STOPWATCH__HPP
#define BOOST_CHRONO_STOPWATCHES_STRICT_STOPWATCH__HPP

#include <boost/chrono/config.hpp>

#include <boost/chrono/chrono.hpp>
#include <boost/chrono/detail/system.hpp>
#include <boost/chrono/thread_clock.hpp>
#include <boost/chrono/process_cpu_clocks.hpp>
#include <utility>

namespace boost
{
  namespace chrono
  {

    /**
     * This class provides the simpler stopwatch which is just able to give the elapsed time since its construction.
     */
    template<typename Clock=high_resolution_clock>
    class strict_stopwatch
    {
    public:
      typedef Clock clock;
      typedef typename Clock::duration duration;
      typedef typename Clock::time_point time_point;
      typedef typename Clock::rep rep;
      typedef typename Clock::period period;
      BOOST_STATIC_CONSTEXPR bool is_steady =             Clock::is_steady;

      strict_stopwatch() :
        start_(clock::now())
      {
      }
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
      explicit strict_stopwatch(system::error_code & ec) :
        start_(duration::zero())
      {
        time_point tmp = clock::now(ec);
        if (!BOOST_CHRONO_IS_THROWS(ec))
        {
          if (ec)
          {
            return;
          }
        }
        start_ = tmp;
      }
#endif

      ~strict_stopwatch() BOOST_NOEXCEPT
      {
      }

      duration elapsed()
      {
        return clock::now() - start_;
      }

#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
      duration elapsed(system::error_code & ec)
      {
        time_point tmp = clock::now(ec);
        if (!BOOST_CHRONO_IS_THROWS(ec))
        {
          if (ec)
            return duration::zero();
        }
        return tmp - start_;
      }
#endif
      /**
       * States if the Stopwatch is running.
       */
      bool is_running() const {
        return true;
      }
    private:
      time_point start_;
      strict_stopwatch(const strict_stopwatch&); // = delete;
      strict_stopwatch& operator=(const strict_stopwatch&); // = delete;
    };

    typedef strict_stopwatch<system_clock> system_strict_stopwatch;
#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
    typedef strict_stopwatch<steady_clock> steady_strict_stopwatch;
#endif
    typedef strict_stopwatch<high_resolution_clock> high_resolution_strict_stopwatch;

#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
    typedef strict_stopwatch<process_real_cpu_clock> process_real_cpu_strict_stopwatch;
#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
    typedef strict_stopwatch<process_user_cpu_clock> process_user_cpu_strict_stopwatch;
    typedef strict_stopwatch<process_system_cpu_clock> process_system_cpu_strict_stopwatch;
    typedef strict_stopwatch<process_cpu_clock> process_cpu_strict_stopwatch;
#endif
#endif

#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
    typedef strict_stopwatch<thread_clock> thread_strict_stopwatch;
#endif

  } // namespace chrono
} // namespace boost

#endif


text:
require 'spec_helper'

RSpec.feature 'Reset Digital Download', :js do
  stub_authorization!

  let(:order)     { create(:completed_order_with_totals, number: 'R100', line_items_count: 1) }
  let(:line_item) { order.line_items.first }
  let(:variant)   { line_item.variant }

  context 'link is present for an order' do
    let!(:digital) { create(:digital, variant: variant) }

    scenario 'when all variants have digitals' do
      visit spree.edit_admin_order_path(order)

      click_link Spree.t(:reset_downloads, scope: 'digitals')
      expect(page).to have_content(Spree.t(:downloads_reset, scope: 'digitals'))
    end
  end

  context 'link is absent for an order' do
    scenario 'when not all variants have digitals' do
      visit spree.edit_admin_order_path(order)

      expect(page).to_not have_content(Spree.t(:reset_downloads, scope: 'digitals'))
    end
  end
end