ACC SHELL
/**
* File: include/network/summary.ycp
* Package: Network configuration
* Summary: Summary and overview functions
* Authors: Michal Svec <msvec@suse.cz>
*
* $Id: summary.ycp 55847 2009-03-02 13:58:43Z mzugec $
*
* All config settings are stored in a global variable Devices.
* All hardware settings are stored in a global variable Hardware.
* Deleted devices are in the global list DELETED.
*/
{
textdomain "network";
import "String";
import "NetworkInterfaces";
/**
* Create list of Table items
* @param types list of types
* @param cur current type
* @return Table items
*/
define list<term> BuildTypesList(list<string> types, string cur) {
return maplist(string t, types, {
return `item(`id(t), NetworkInterfaces::GetDevTypeDescription(t, false), t == cur);
});
}
/**
* Create table widget for the overview screens with correct spacings
* @param caption table caption
* @param header table header
* @param contents table contents
* @param first table is first of the two tables
* @return table widget
*/
define term OverviewTableContents(string caption, term header, list contents, boolean first) {
term addbutton = nil;
term editbutton = nil;
term deletebutton = nil;
if(first) {
/* Pushbutton label */
addbutton = `PushButton(`id(`add), `opt(`key_F3), _("A&dd"));
/* Pushbutton label */
editbutton = `PushButton(`id(`edit), `opt(`key_F4), _("&Edit"));
/* Pushbutton label */
deletebutton = `PushButton(`id(`delete), `opt(`key_F5), _("De&lete"));
}
else {
/* Pushbutton label (different shortcut) */
addbutton = `PushButton(`id(`Add), _("&Add"));
/* Pushbutton label (different shortcut) */
editbutton = `PushButton(`id(`Edit), _("Ed&it"));
/* Pushbutton label (different shortcut) */
deletebutton = `PushButton(`id(`Delete), _("Dele&te"));
}
return `HBox(`HSpacing(1.5), `VBox(
`VSpacing(0.0),
caption != ""? `Left(`Heading(caption)) : `VSpacing(0.0),
`Table(
`id(first?`table:`Table),
`opt(`notify),
header,
contents
),
`VSpacing(0.4),
`HBox(
`opt(`hstretch),
addbutton,
editbutton,
deletebutton
),
`VSpacing(0.5)
), `HSpacing(1.5));
}
/**
* Create table widget for the overview screens
* @param header table header
* @param contents table contents
* @return table widget
*/
define term OverviewTable(term header, list contents) {
return `VBox(
`VSpacing(0.5),
OverviewTableContents("", header, contents, true)
);
}
/**
* Create two table widgets for the overview screens
* @param caption1 first table caption
* @param header1 first table header
* @param contents1 first table contents
* @param caption2 second table caption
* @param header2 second table header
* @param contents2 second table contents
* @return table widget
*/
define term OverviewTableDouble(string caption1, term header1, list contents1, string caption2, term header2, list contents2) {
return `VBox(
`VSpacing(0.5),
OverviewTableContents(caption1, header1, contents1, true),
OverviewTableContents(caption2, header2, contents2, false)
);
}
/* EOF */
}
ACC SHELL 2018