Difference between revisions of "选项卡"
Jump to navigation
Jump to search
Tag: 2017 source edit |
|||
Line 14: | Line 14: | ||
{{TemplateMainPageZh}} | {{TemplateMainPageZh}} | ||
− | = | + | =Dolibarr选项卡系统= |
− | + | Dolibarr在由多个选项卡组成的视图中显示元素(发票、仓库、用户等)的信息。 | |
− | + | 您可以添加自己的选项卡、删除选项卡或替换现有选项卡。 | |
− | = | + | =添加您自己的选项卡= |
− | 1) | + | 1) 首先,您需要确定要添加、删除或修改的选项卡所指向的对象类型及其代码“objectType”。以下是完整清单: |
− | * 'thirdparty' | + | |
− | * 'intervention' | + | *'thirdparty' --------- 要在合作方视图中添加选项卡 |
− | * 'supplier_order' | + | *'intervention' ------ 要在现场服务视图中添加选项卡 |
− | * 'supplier_invoice' | + | *'supplier_order' --- 要在供应商订单视图中添加选项卡 |
− | * 'invoice' to add a tab in customer invoice view | + | *'supplier_invoice' - 要在供应商发票视图中添加选项卡 |
− | * 'order' to add a tab in customer order view | + | *'invoice' to add a tab in customer invoice view |
− | * 'product' to add a tab in product view | + | *'order' to add a tab in customer order view |
− | * 'stock' to add a tab in stock view | + | *'product' to add a tab in product view |
− | * 'propal' to add a tab in propal view | + | *'stock' to add a tab in stock view |
− | * 'member' to add a tab in fundation member view | + | *'propal' to add a tab in propal view |
− | * 'contract' to add a tab in contract view | + | *'member' to add a tab in fundation member view |
− | * 'user' to add a tab in user view | + | *'contract' to add a tab in contract view |
− | * 'group' to add a tab in group view | + | *'user' to add a tab in user view |
− | * 'contact' to add a tab in contact view | + | *'group' to add a tab in group view |
− | * 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) | + | *'contact' to add a tab in contact view |
− | * 'member_stats', 'order_stats', 'supplier_order_stats', 'invoice_stats', 'supplier_invoice_stats', 'trip_stats', 'propal_stats' to add a tab in statistic view of elements. | + | *'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
− | * 'member_admin', 'company_admin', 'product_admin' for admin pages | + | *'member_stats', 'order_stats', 'supplier_order_stats', 'invoice_stats', 'supplier_invoice_stats', 'trip_stats', 'propal_stats' to add a tab in statistic view of elements. |
+ | *'member_admin', 'company_admin', 'product_admin' for admin pages | ||
2) 然后添加您的选项卡,创建一个新的模块文件。见 [[模块开发]] 。 | 2) 然后添加您的选项卡,创建一个新的模块文件。见 [[模块开发]] 。 | ||
Line 51: | Line 52: | ||
这里: | 这里: | ||
− | * objecttype 是您将使用的Tab的名称。 | + | |
− | * +tabname 是一个名称来标识您的选项卡,前面是动作(+ 添加或 - 删除,您可以删除其他选项卡,包括默认的)。 | + | *objecttype 是您将使用的Tab的名称。 |
− | * TitleOfTab 是一个你选择的标题,它将被翻译。 | + | *+tabname 是一个名称来标识您的选项卡,前面是动作(+ 添加或 - 删除,您可以删除其他选项卡,包括默认的)。 |
− | * @mymodule 是语言文件,里面是翻译条目。 (如: mytitlelang@mymodule 会查找 '''/htdocs/mymodule/langs/xx_XX/mytitlelang''' ''' xx_XX''' 是当前语言如: en_US, fr_FR, etc.). | + | *TitleOfTab 是一个你选择的标题,它将被翻译。 |
− | * $conditiontoshowtab 是否显示: 是真则显示,假则不显示。如: you can use the Dolibarr rights system, eg: $user->rights->product->creer or $user->admin or any other variable you want. 此项是可选项,跳过也是可以的。不要忘记分号也要删除。 | + | *@mymodule 是语言文件,里面是翻译条目。 (如: mytitlelang@mymodule 会查找 '''/htdocs/mymodule/langs/xx_XX/mytitlelang''' ''' xx_XX''' 是当前语言如: en_US, fr_FR, etc.). |
− | * urloftab?id=__ID__ 是选项卡指向的URL。使用占位符 __ID__ 替代'''id'''。如:DOL_DOCUMENT_ROOT.'/mymodule/lib/mytab.php' | + | *$conditiontoshowtab 是否显示: 是真则显示,假则不显示。如: you can use the Dolibarr rights system, eg: $user->rights->product->creer or $user->admin or any other variable you want. 此项是可选项,跳过也是可以的。不要忘记分号也要删除。 |
+ | *urloftab?id=__ID__ 是选项卡指向的URL。使用占位符 __ID__ 替代'''id'''。如:DOL_DOCUMENT_ROOT.'/mymodule/lib/mytab.php' | ||
Line 71: | Line 73: | ||
5) 测试新选项卡 | 5) 测试新选项卡 | ||
− | = 删除现在的选项卡 = | + | =删除现在的选项卡= |
删除选项卡的操作与添加选项卡相同,在模块文件的tabs数组中使用以下语句: | 删除选项卡的操作与添加选项卡相同,在模块文件的tabs数组中使用以下语句: | ||
<source lang="php"> | <source lang="php"> | ||
Line 81: | Line 83: | ||
注意:在这种情况下不需要其他参数。 | 注意:在这种情况下不需要其他参数。 | ||
− | == 如何确定你要删除的选项卡的名称== | + | ==如何确定你要删除的选项卡的名称== |
− | * 打开浏览器的开发者工具。 | + | |
− | * 单击选择元素按钮 | + | *打开浏览器的开发者工具。 |
− | * 在窗口中选择你要删除的Dolibarr选顶卡。 | + | *单击选择元素按钮 |
− | * 在开发者工具中查看 tab 属性 | + | *在窗口中选择你要删除的Dolibarr选顶卡。 |
+ | *在开发者工具中查看 tab 属性 | ||
[[File:企业微信截图 20180829160108.png|800px]] | [[File:企业微信截图 20180829160108.png|800px]] | ||
− | = 替换选项卡 = | + | =替换选项卡= |
执行 "添加选项卡" 和 "删除现在的选项卡"。如果新标签的标题与删除的标题相同,则错觉是完美的。 | 执行 "添加选项卡" 和 "删除现在的选项卡"。如果新标签的标题与删除的标题相同,则错觉是完美的。 | ||
− | = 将标签显示在自己的页面中 = | + | =将标签显示在自己的页面中= |
更多关于如何在页面中显示标签的信息在页面上可用。 | 更多关于如何在页面中显示标签的信息在页面上可用。 | ||
[[Module_development#The_tab_management]] | [[Module_development#The_tab_management]] |
Revision as of 08:51, 25 September 2023
Dolibarr选项卡系统
Dolibarr在由多个选项卡组成的视图中显示元素(发票、仓库、用户等)的信息。
您可以添加自己的选项卡、删除选项卡或替换现有选项卡。
添加您自己的选项卡
1) 首先,您需要确定要添加、删除或修改的选项卡所指向的对象类型及其代码“objectType”。以下是完整清单:
- 'thirdparty' --------- 要在合作方视图中添加选项卡
- 'intervention' ------ 要在现场服务视图中添加选项卡
- 'supplier_order' --- 要在供应商订单视图中添加选项卡
- 'supplier_invoice' - 要在供应商发票视图中添加选项卡
- 'invoice' to add a tab in customer invoice view
- 'order' to add a tab in customer order view
- 'product' to add a tab in product view
- 'stock' to add a tab in stock view
- 'propal' to add a tab in propal view
- 'member' to add a tab in fundation member view
- 'contract' to add a tab in contract view
- 'user' to add a tab in user view
- 'group' to add a tab in group view
- 'contact' to add a tab in contact view
- 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
- 'member_stats', 'order_stats', 'supplier_order_stats', 'invoice_stats', 'supplier_invoice_stats', 'trip_stats', 'propal_stats' to add a tab in statistic view of elements.
- 'member_admin', 'company_admin', 'product_admin' for admin pages
2) 然后添加您的选项卡,创建一个新的模块文件。见 模块开发 。
3) 然后进入描述符文件,编辑$this->tab,使用以下语法添加选项卡:
$this->tabs = array(
'objecttype:+tabname:TitleOfTab:@mymodule:$conditiontoshowtab:urloftab?id=__ID__'
);
这是一个由5或6个元素组成的字符串(取决于你是否选择使用$conditiontoshowtab),用;分隔。
这里:
- objecttype 是您将使用的Tab的名称。
- +tabname 是一个名称来标识您的选项卡,前面是动作(+ 添加或 - 删除,您可以删除其他选项卡,包括默认的)。
- TitleOfTab 是一个你选择的标题,它将被翻译。
- @mymodule 是语言文件,里面是翻译条目。 (如: mytitlelang@mymodule 会查找 /htdocs/mymodule/langs/xx_XX/mytitlelang xx_XX 是当前语言如: en_US, fr_FR, etc.).
- $conditiontoshowtab 是否显示: 是真则显示,假则不显示。如: you can use the Dolibarr rights system, eg: $user->rights->product->creer or $user->admin or any other variable you want. 此项是可选项,跳过也是可以的。不要忘记分号也要删除。
- urloftab?id=__ID__ 是选项卡指向的URL。使用占位符 __ID__ 替代id。如:DOL_DOCUMENT_ROOT.'/mymodule/lib/mytab.php'
例如:
$this->tabs = array(
'product:+tabname1:Title1:@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 in objecttype product (Products/Services)
'product:+tabname2:Title2:@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2 in objecttype product (Products/Services)
);
4) 激活模块
5) 测试新选项卡
删除现在的选项卡
删除选项卡的操作与添加选项卡相同,在模块文件的tabs数组中使用以下语句:
$this->tabs = array(
'objecttype:-tabnametobedeleted'
); // To remove an existing tab identified by code tabnametobedeleted
注意:在这种情况下不需要其他参数。
如何确定你要删除的选项卡的名称
- 打开浏览器的开发者工具。
- 单击选择元素按钮
- 在窗口中选择你要删除的Dolibarr选顶卡。
- 在开发者工具中查看 tab 属性
替换选项卡
执行 "添加选项卡" 和 "删除现在的选项卡"。如果新标签的标题与删除的标题相同,则错觉是完美的。
将标签显示在自己的页面中
更多关于如何在页面中显示标签的信息在页面上可用。 Module_development#The_tab_management