mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
- The object creation page now offers tha choice to create an instance of the sub-classes
- Made some objects abstract in the std config-management model - The creation button is now labelled "Create" instead of "Apply" ! - Better display of long messages (or errors) in SetuWebpage. SVN:trunk[529]
This commit is contained in:
@@ -1303,7 +1303,7 @@ EOF
|
||||
$oPage->add("<input type=\"hidden\" name=\"$sName\" value=\"$value\">\n");
|
||||
}
|
||||
$oPage->add("<button type=\"button\" class=\"action\" onClick=\"goBack()\"><span>".Dict::S('UI:Button:Cancel')."</span></button> \n");
|
||||
$oPage->add("<button type=\"submit\" class=\"action\"><span>".Dict::S('UI:Button:Apply')."</span></button>\n");
|
||||
$oPage->add("<button type=\"submit\" class=\"action\"><span>".Dict::S('UI:Button:Create')."</span></button>\n");
|
||||
$oPage->add("</form>\n");
|
||||
$aNewFieldsMap = array();
|
||||
foreach($aFieldsMap as $id => $sFieldCode)
|
||||
|
||||
@@ -356,7 +356,8 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'UI:Button:AddToList' => ' << Add ',
|
||||
'UI:Button:RemoveFromList' => ' Remove >> ',
|
||||
'UI:Button:FilterList' => ' Filter... ',
|
||||
'UI:Button:Delete' => 'Delete ! ',
|
||||
'UI:Button:Create' => ' Create ',
|
||||
'UI:Button:Delete' => ' Delete ! ',
|
||||
|
||||
'UI:SearchToggle' => 'Search',
|
||||
'UI:ClickToCreateNew' => 'Click here to create a new %1$s',
|
||||
@@ -636,6 +637,7 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'UI:CloneTitle_Class_Object' => 'Clone of %1$s: <span class=\"hilite\">%2$s</span>',
|
||||
'UI:CreationPageTitle_Class' => 'iTop - Creation of a new %1$s ',
|
||||
'UI:CreationTitle_Class' => 'Creation of a new %1$s',
|
||||
'UI:SelectTheTypeOf_Class_ToCreate' => 'Select the type of %1$s to create:',
|
||||
'UI:Class_Object_NotUpdated' => 'No change detected, %1$s (%2$s) has <strong>not</strong> been modified.',
|
||||
'UI:Class_Object_Updated' => '%1$s (%2$s) updated.',
|
||||
'UI:BulkDeletePageTitle' => 'iTop - Bulk Delete',
|
||||
|
||||
@@ -349,7 +349,8 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'UI:Button:AddToList' => ' << Ajouter ',
|
||||
'UI:Button:RemoveFromList' => ' Enlever >> ',
|
||||
'UI:Button:FilterList' => ' Filtrer... ',
|
||||
'UI:Button:Delete' => 'Supprimer ! ',
|
||||
'UI:Button:Create' => ' Créer ',
|
||||
'UI:Button:Delete' => ' Supprimer ! ',
|
||||
|
||||
'UI:SearchToggle' => 'Recherche',
|
||||
|
||||
@@ -630,6 +631,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'UI:CloneTitle_Class_Object' => ' %1$s - Duplication de <span class=\"hilite\">%2$s</span>',
|
||||
'UI:CreationPageTitle_Class' => 'iTop - Création d\'un objet de type %1$s ',
|
||||
'UI:CreationTitle_Class' => 'Création d\'un objet de type %1$s',
|
||||
'UI:SelectTheTypeOf_Class_ToCreate' => 'Sélectionnez le type de %1$s à créer :',
|
||||
'UI:Class_Object_NotUpdated' => 'Aucun changement détecté, %2$s (type : %2$s) n\'a <strong>pas</strong> été modifié.',
|
||||
'UI:Class_Object_Updated' => '%1$s (%2$s) mise à jour.',
|
||||
'UI:BulkDeletePageTitle' => 'iTop - Suppression massive',
|
||||
|
||||
@@ -703,7 +703,7 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'Class:Printer/Attribute:type/Value:Mopier+' => '',
|
||||
'Class:Printer/Attribute:type/Value:Printer' => 'Printer',
|
||||
'Class:Printer/Attribute:type/Value:Printer+' => '',
|
||||
'Class:Printer/Attribute:technology' => 'technology',
|
||||
'Class:Printer/Attribute:technology' => 'Technology',
|
||||
'Class:Printer/Attribute:technology+' => '',
|
||||
'Class:Printer/Attribute:technology/Value:Inkjet' => 'Inkjet',
|
||||
'Class:Printer/Attribute:technology/Value:Inkjet+' => '',
|
||||
@@ -841,8 +841,8 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'Menu:Person+' => 'All Persons',
|
||||
'Menu:Team' => 'Teams',
|
||||
'Menu:Team+' => 'All Teams',
|
||||
'Menu:FileDoc' => 'Documents',
|
||||
'Menu:FileDoc+' => 'All Documents',
|
||||
'Menu:Document' => 'Documents',
|
||||
'Menu:Document+' => 'All Documents',
|
||||
'Menu:Location' => 'Locations',
|
||||
'Menu:Location+' => 'All Locations',
|
||||
'Menu:ConfigManagementCI' => 'Configuration Items',
|
||||
|
||||
@@ -778,7 +778,7 @@ class BusinessProcess extends FunctionalCI
|
||||
MetaModel::Init_SetZListItems('list', array('status', 'owner_id', 'importance', 'description'));
|
||||
}
|
||||
}
|
||||
class ConnectableCI extends FunctionalCI
|
||||
abstract class ConnectableCI extends FunctionalCI
|
||||
{
|
||||
|
||||
public static function Init()
|
||||
@@ -848,7 +848,7 @@ class NetworkInterface extends ConnectableCI
|
||||
MetaModel::Init_SetZListItems('list', array('status', 'owner_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'device_id', 'logical_type', 'physical_type', 'ip_address', 'ip_mask', 'mac_address', 'speed', 'duplex', 'connected_if', 'connected_if_device_id'));
|
||||
}
|
||||
}
|
||||
class Device extends ConnectableCI
|
||||
abstract class Device extends ConnectableCI
|
||||
{
|
||||
|
||||
public static function Init()
|
||||
@@ -908,7 +908,7 @@ class PC extends Device
|
||||
MetaModel::Init_SetZListItems('list', array('status', 'owner_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'cpu', 'ram', 'hdd', 'os_family', 'os_version'));
|
||||
}
|
||||
}
|
||||
class MobileCI extends Device
|
||||
abstract class MobileCI extends Device
|
||||
{
|
||||
|
||||
public static function Init()
|
||||
@@ -965,7 +965,7 @@ class MobilePhone extends MobileCI
|
||||
MetaModel::Init_SetZListItems('list', array('status', 'owner_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'number', 'imei', 'hw_pin'));
|
||||
}
|
||||
}
|
||||
class InfrastructureCI extends Device
|
||||
abstract class InfrastructureCI extends Device
|
||||
{
|
||||
|
||||
public static function Init()
|
||||
@@ -1263,7 +1263,7 @@ $oContactNode = new TemplateMenuNode('Contact', '../business/templates/contacts_
|
||||
new OQLMenuNode('Person', 'SELECT Person', $oContactNode->GetIndex(), 1 /* fRank */);
|
||||
new OQLMenuNode('Team', 'SELECT Team', $oContactNode->GetIndex(), 2 /* fRank */);
|
||||
|
||||
new OQLMenuNode('FileDoc', 'SELECT FileDoc', $oConfigManagementGroup->GetIndex(), 2 /* fRank */);
|
||||
new OQLMenuNode('Document', 'SELECT Document', $oConfigManagementGroup->GetIndex(), 2 /* fRank */);
|
||||
new OQLMenuNode('Location', 'SELECT Location', $oConfigManagementGroup->GetIndex(), 3 /* fRank */);
|
||||
|
||||
|
||||
|
||||
79
pages/UI.php
79
pages/UI.php
@@ -717,6 +717,7 @@ try
|
||||
case 'new':
|
||||
$sClass = utils::ReadParam('class', '');
|
||||
$sStateCode = utils::ReadParam('state', '');
|
||||
$bCheckSubClass = utils::ReadParam('checkSubclass', true);
|
||||
if ( empty($sClass) )
|
||||
{
|
||||
throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'class'));
|
||||
@@ -730,19 +731,77 @@ try
|
||||
|
||||
$oContext = new UserContext();
|
||||
$aArgs = array_merge($oAppContext->GetAsHash(), utils::ReadParam('default', array()));
|
||||
$sClassLabel = MetaModel::GetName($sClass);
|
||||
|
||||
$oP->set_title(Dict::Format('UI:CreationPageTitle_Class', $sClassLabel));
|
||||
$oP->add("<h1><img src=\"".MetaModel::GetClassIcon($sClass)."\" style=\"vertical-align:middle;\">".Dict::Format('UI:CreationTitle_Class', $sClassLabel)."</h1>\n");
|
||||
$oP->add("<div class=\"wizContainer\">\n");
|
||||
$aDefaults = utils::ReadParam('default', array());
|
||||
$aContext = $oAppContext->GetAsHash();
|
||||
foreach($aContext as $key => $value)
|
||||
// If the specified class has subclasses, ask the user an instance of which class to create
|
||||
$aSubClasses = MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL); // Including the specified class itself
|
||||
$aPossibleClasses = array();
|
||||
$sRealClass = '';
|
||||
if ($bCheckSubClass)
|
||||
{
|
||||
$aDefaults[$key] = $value;
|
||||
foreach($aSubClasses as $sCandidateClass)
|
||||
{
|
||||
if (!MetaModel::IsAbstract($sCandidateClass))
|
||||
{
|
||||
$aPossibleClasses[$sCandidateClass] = MetaModel::GetName($sCandidateClass);
|
||||
}
|
||||
}
|
||||
// Only one of the subclasses can be instantiated...
|
||||
if (count($aPossibleClasses) == 1)
|
||||
{
|
||||
$aKeys = array_keys($aPossibleClasses);
|
||||
$sRealClass = $aKeys[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sRealClass = $sClass;
|
||||
}
|
||||
|
||||
if (!empty($sRealClass))
|
||||
{
|
||||
// Display the creation form
|
||||
$sClassLabel = MetaModel::GetName($sRealClass);
|
||||
$oP->set_title(Dict::Format('UI:CreationPageTitle_Class', $sClassLabel));
|
||||
$oP->add("<h1><img src=\"".MetaModel::GetClassIcon($sRealClass)."\" style=\"vertical-align:middle;\">".Dict::Format('UI:CreationTitle_Class', $sClassLabel)."</h1>\n");
|
||||
$oP->add("<div class=\"wizContainer\">\n");
|
||||
$aDefaults = utils::ReadParam('default', array());
|
||||
$aContext = $oAppContext->GetAsHash();
|
||||
foreach($aContext as $key => $value)
|
||||
{
|
||||
$aDefaults[$key] = $value;
|
||||
}
|
||||
cmdbAbstractObject::DisplayCreationForm($oP, $sRealClass, null /* $oObjToClone */, array('default' => $aDefaults));
|
||||
$oP->add("</div>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Select the derived class to create
|
||||
$sClassLabel = MetaModel::GetName($sClass);
|
||||
$oP->add("<h1><img src=\"".MetaModel::GetClassIcon($sClass)."\" style=\"vertical-align:middle;\">".Dict::Format('UI:CreationTitle_Class', $sClassLabel)."</h1>\n");
|
||||
$oP->add("<div class=\"wizContainer\">\n");
|
||||
$oP->add('<form>');
|
||||
$oP->add('<p>'.Dict::Format('UI:SelectTheTypeOf_Class_ToCreate', $sClassLabel));
|
||||
$aDefaults = utils::ReadParam('default', array());
|
||||
$oP->add($oAppContext->GetForForm());
|
||||
$oP->add("<input type=\"hidden\" name=\"state\" value=\"$sStateCode\">\n");
|
||||
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"new\">\n");
|
||||
foreach($aDefaults as $key => $value)
|
||||
{
|
||||
$oP->add("<input type=\"hidden\" name=\"default[$key]\" value=\"$value\">\n");
|
||||
$aDefaults[$key] = $value;
|
||||
}
|
||||
$oP->add('<select name="class">');
|
||||
asort($aPossibleClasses);
|
||||
foreach($aPossibleClasses as $sClassName => $sClassLabel)
|
||||
{
|
||||
$sSelected = ($sClassName == $sClass) ? 'selected' : '';
|
||||
$oP->add("<option $sSelected value=\"$sClassName\">$sClassLabel</option>");
|
||||
}
|
||||
$oP->add('</select>');
|
||||
$oP->add(" <input type=\"submit\" value=\"".Dict::S('UI:Button:Apply')."\"></p>");
|
||||
$oP->add('</form>');
|
||||
$oP->add("</div>\n");
|
||||
}
|
||||
cmdbAbstractObject::DisplayCreationForm($oP, $sClass, null /* $oObjToClone */, array('default' => $aDefaults));
|
||||
$oP->add("</div>\n");
|
||||
break;
|
||||
|
||||
case 'apply_modify':
|
||||
|
||||
@@ -101,22 +101,22 @@ button {
|
||||
p.info {
|
||||
padding-left: 50px;
|
||||
background: url(../images/info-mid.png) no-repeat left -5px;
|
||||
height: 48px;
|
||||
min-height: 48px;
|
||||
}
|
||||
p.ok {
|
||||
padding-left: 50px;
|
||||
background: url(../images/clean-mid.png) no-repeat left -8px;
|
||||
height: 48px;
|
||||
min-height: 48px;
|
||||
}
|
||||
p.warning {
|
||||
padding-left: 50px;
|
||||
background: url(../images/messagebox_warning-mid.png) no-repeat left -5px;
|
||||
height: 48px;
|
||||
min-height: 48px;
|
||||
}
|
||||
p.error {
|
||||
padding-left: 50px;
|
||||
background: url(../images/stop-mid.png) no-repeat left -5px;
|
||||
height: 48px;
|
||||
min-height: 48px;
|
||||
}
|
||||
td.label {
|
||||
text-align: left;
|
||||
|
||||
Reference in New Issue
Block a user