国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

openmediavault 4.1.3 插件開發

pcChao / 2464人閱讀

摘要:參考網址創建應用創建應用目錄創建菜單節點設置菜單節點圖標內創建對應內的張圖片創建設置面板刷新緩存創建腳本生成配置信息的腳本命令執行添加默認配置以下條命令用于安裝包安裝直接執行可注釋掉創建刪除配置信息的腳本執行命令

參考網址:https://forum.openmediavault....

創建應用GUI
創建應用目錄:/var/www/openmediavault/js/omv/module/admin/service/example
創建菜單節點: Node.js

// require("js/omv/WorkspaceManager.js")
OMV.WorkspaceManager.registerNode({
    id: "example",
    path: "/service",
    text: _("Example"),
    icon16: "images/example.png",
    iconSvg: "images/example.svg"
});

設置菜單節點圖標
var/www/openmediavault/images 內創建對應Node.js內的2張圖片

創建設置面板: Settings.js

// require("js/omv/WorkspaceManager.js")
// require("js/omv/workspace/form/Panel.js")
Ext.define("OMV.module.admin.service.example.Settings", {
    extend: "OMV.workspace.form.Panel",
    
    rpcService: "Example",
    rpcGetMethod: "getSettings",
    rpcSetMethod: "setSettings",
    
    getFormItems: function() {
        return [{
            xtype: "fieldset",
            title: _("General"),
            fieldDefaults: {
                labelSeparator: ""
            },
            items: [{
                xtype: "checkbox",
                name: "enable",
                fieldLabel: _("Enable"),
                checked: false
            },
            {
                xtype: "numberfield",
                name: "max_value",
                fieldLabel: _("Max value"),
                minValue: 0,
                maxValue: 100,
                allowDecimals: false,
                allowBlank: true
            }]
        }];
    }
});

OMV.WorkspaceManager.registerPanel({
    id: "settings",
    path: "/service/example",
    text: _("Settings"),
    position: 10,
    className: "OMV.module.admin.service.example.Settings"
});

刷新js緩存:

source /usr/share/openmediavault/scripts/helper-functions && omv_purge_internal_cache

創建shell腳本
生成配置信息的腳本postinst 命令執行:/bin/sh postinst configure

#!/bin/sh

set -e

. /etc/default/openmediavault
. /usr/share/openmediavault/scripts/helper-functions

case "$1" in
    configure)
        SERVICE_XPATH_NAME="example"
        SERVICE_XPATH="/config/services/${SERVICE_XPATH_NAME}"

        # 添加默認配置
        if ! omv_config_exists "${SERVICE_XPATH}"; then
            omv_config_add_element "/config/services" "${SERVICE_XPATH_NAME}"
            omv_config_add_element "${SERVICE_XPATH}" "enable" "0"
            omv_config_add_element "${SERVICE_XPATH}" "max_value" "0"
        fi

        # 以下2條命令用于安裝包安裝  直接執行可注釋掉
        dpkg-trigger update-fixperms
        dpkg-trigger update-locale
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0 

創建刪除配置信息的shell腳本 postrm 執行命令:/bin/sh postrm purge

#!/bin/sh

set -e

. /etc/default/openmediavault
. /usr/share/openmediavault/scripts/helper-functions

SERVICE_XPATH_NAME="example"
SERVICE_XPATH="/config/services/${SERVICE_XPATH_NAME}"

case "$1" in
    purge)
        if omv_config_exists ${SERVICE_XPATH}; then
            omv_config_delete ${SERVICE_XPATH}
        fi
    ;;

    remove)
    ;;

    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    ;;

    *)
        echo "postrm called with unknown argument `$1"" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0

創建rpc
在目錄/usr/share/openmediavault/engined/rpc創建example.inc

registerMethod("getSettings");
        $this->registerMethod("setSettings");
    }

    public function getSettings($params, $context) {
        // Validate the RPC caller context.
        $this->validateMethodContext($context, [
            "role" => OMV_ROLE_ADMINISTRATOR
        ]);
        // Get the configuration object.
        $db = OMVConfigDatabase::getInstance();
        $object = $db->get("conf.service.example");
        // Remove useless properties from the object.
        return $object->getAssoc();
    }

    public function setSettings($params, $context) {
        // Validate the RPC caller context.
        $this->validateMethodContext($context, [
            "role" => OMV_ROLE_ADMINISTRATOR
        ]);
        // Validate the parameters of the RPC service method.
        $this->validateMethodParams($params, "rpc.example.setsettings");
        // Get the existing configuration object.
        $db = OMVConfigDatabase::getInstance();
        $object = $db->get("conf.service.example");
        $object->setAssoc($params);
        $db->set($object);
        // Return the configuration object.
        return $object->getAssoc();
    }
}

創建對應的配置文件
在usrshareopenmediavaultdatamodels創建conf.service.example.json

{
    "type": "config",
    "id": "conf.service.example",
    "title": "EXAMPLE",
    "queryinfo": {
        "xpath": "http://services/example",
        "iterable": false
    },
    "properties": {
        "enable": {
            "type": "boolean",
            "default": false
        },
        "max_value": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 0
        }
    }
}

在usrshareopenmediavaultdatamodels創建rpc.example.json

[{
    "type": "rpc",
    "id": "rpc.example.setsettings",
    "params": {
        "type": "object",
        "properties": {
            "enable": {
                "type": "boolean",
                "required": true
            },
            "max_value": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100,
                "required": true
            }
        }
    }
}]

運行命令重啟omv服務:service openmediavault-engined restart

創建shell腳本獲取配置信息
創建執行腳本 example 執行命令:omv-mkconf example

#!/bin/sh

set -e

. /etc/default/openmediavault
. /usr/share/openmediavault/scripts/helper-functions

OMV_EXAMPLE_XPATH="/config/services/example"
OMV_EXAMPLE_CONF="/tmp/example.conf"

cat < ${OMV_EXAMPLE_CONF}
enable    = $(omv_config_get "${OMV_EXAMPLE_XPATH}/enable")
max_value = $(omv_config_get "${OMV_EXAMPLE_XPATH}/max_value")
EOF

exit 0

為了監聽觸發執行腳本,將腳本放在/usr/share/openmediavault/mkconf目錄下
腳本權限改為 chmod 755 example

配置保存事件監聽

/usr/share/openmediavault/engined/module創建監聽的example.inc

setRedirect2to1();
        $cmd->execute();
    }

    function bindListeners(OMVEngineNotifyDispatcher $dispatcher) {
        $dispatcher->addListener(OMV_NOTIFY_MODIFY,
            "org.openmediavault.conf.service.example",  // 和rpc內的配置文件一致conf.service.example
            [ $this, "setDirty" ]);
    }
}

運行命令重啟omv服務:service openmediavault-engined restart

創建deb包 https://blog.csdn.net/gatieme...

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/98425.html

相關文章

  • openmediavault 4.1.3 插件開發

    摘要:參考網址創建應用創建應用目錄創建菜單節點設置菜單節點圖標內創建對應內的張圖片創建設置面板刷新緩存創建腳本生成配置信息的腳本命令執行添加默認配置以下條命令用于安裝包安裝直接執行可注釋掉創建刪除配置信息的腳本執行命令 參考網址:https://forum.openmediavault.... 創建應用GUI 創建應用目錄:/var/www/openmediavault/js/om...

    xioqua 評論0 收藏0
  • SpringBoot 入門簡介

    摘要:這里使用的是數據庫啟動類上加上注解在啟動類中添加對包掃描掃描多個包下的可以有以下幾種方法掃描會自動加載相關配置,數據源就會自動注入到中,會自動注入到中,可以直接使用。有配置文件下的使用掃描多個包下的可以有以下幾種方法掃描 Spring-Boot 學習筆記 1 Spring-Boot 介紹 1.1 什么是Spring-Boot Spring-Boot是由Pivotal團隊提供的全新框架...

    chuyao 評論0 收藏0
  • TinyMCE插件開發

    摘要:目前網上關于插件開發的文章少得可憐,下面分享最近的經歷,如何快速上手開發一個插件。第六步調試插件在打開的網頁中可以看到工具欄中實現了插件。 TinyMCE是一個非常優秀的輕量級的所見即所得HTML編輯器,歷史悠久,開源,在github的start也非常高的,且長期保持更新。TinyMCE的官方插件不少,基本能滿足日常需求,但是有時候我們還需要一些結合業務的功能。這時官方插件無法滿足,就...

    aboutU 評論0 收藏0
  • 開發 2 個 Chrome 插件中學到的(對新手的 4 個提示和 6 個技巧)

    摘要:提示插件可以重寫默認的比如打開新時。這是在插件中定義的,因此不能后面做更改。把你的插件提交到的子版塊中。從圖中藍色點開始到后面的兩天曲線變化。曲線中間的那個小凸起,是二月份在發布的時候產生的。關于在插件中如何使用的教程在這里。 showImg(https://segmentfault.com/img/remote/1460000008971998?w=1920&h=1080); 本文...

    20171112 評論0 收藏0

發表評論

0條評論

最新活動
閱讀需要支付1元查看
<