Compare commits

..

1 Commits

Author SHA1 Message Date
Romain Quetiez
18529b1330 Official release 1.0.2
SVN:1.0.2[1056]
2011-01-19 10:01:55 +00:00
12 changed files with 31 additions and 80 deletions

View File

@@ -326,16 +326,6 @@ EOF
{
// User is Ok, let's save it in the session and proceed with normal login
UserRights::Login($sAuthUser, $sAuthentication); // Login & set the user's language
if (MetaModel::GetConfig()->Get('log_usage'))
{
$oLog = new EventLoginUsage();
$oLog->Set('userinfo', UserRights::GetUser());
$oLog->Set('user_id', UserRights::GetUserObject()->GetKey());
$oLog->Set('message', 'Successful login');
$oLog->DBInsertNoReload();
}
$_SESSION['auth_user'] = $sAuthUser;
$_SESSION['login_mode'] = $sLoginMode;
}

View File

@@ -155,15 +155,14 @@ EOF
$sHTMLValue .= "<input type=\"hidden\" id=\"$this->iId\" name=\"attr_{$this->sFieldPrefix}{$this->sAttCode}{$this->sNameSuffix}\" value=\"$this->value\" />\n";
// Scripts to start the autocomplete and bind some events to it
$sDialogTitle = addslashes($this->sTitle);
$oPage->add_ready_script(
<<<EOF
oACWidget_{$this->iId} = new ExtKeyWidget('{$this->iId}', '{$this->sClass}', '{$this->sAttCode}', '{$this->sNameSuffix}', $sSelectMode, oWizardHelper{$this->sFormPrefix});
oACWidget_{$this->iId}.emptyHtml = "<div style=\"background: #fff; border:0; text-align:center; vertical-align:middle;\"><p>$sMessage</p></div>";
$('#label_$this->iId').autocomplete('../pages/ajax.render.php', { scroll:true, minChars:{$iMinChars}, formatItem:formatItem, autoFill:false, matchContains:true, keyHolder:'#{$this->iId}', extraParams:{operation:'autocomplete', sclass:'{$this->sClass}',attCode:'{$this->sAttCode}'}});
$('#label_$this->iId').autocomplete('./ajax.render.php', { scroll:true, minChars:{$iMinChars}, formatItem:formatItem, autoFill:false, matchContains:true, keyHolder:'#{$this->iId}', extraParams:{operation:'autocomplete', sclass:'{$this->sClass}',attCode:'{$this->sAttCode}'}});
$('#label_$this->iId').blur(function() { $(this).search(); } );
$('#label_$this->iId').result( function(event, data, formatted) { OnAutoComplete('{$this->iId}', event, data, formatted); } );
$('#ac_dlg_$this->iId').dialog({ width: $(window).width()*0.8, height: $(window).height()*0.8, autoOpen: false, modal: true, title: '$sDialogTitle', resizeStop: oACWidget_{$this->iId}.UpdateSizes, close: oACWidget_{$this->iId}.OnClose });
$('#ac_dlg_$this->iId').dialog({ width: $(window).width()*0.8, height: $(window).height()*0.8, autoOpen: false, modal: true, title: '{$this->sTitle}', resizeStop: oACWidget_{$this->iId}.UpdateSizes, close: oACWidget_{$this->iId}.OnClose });
EOF
);
@@ -241,12 +240,11 @@ EOF
*/
public function GetObjectCreationForm(WebPage $oPage)
{
$sDialogTitle = addslashes($this->sTitle);
$oPage->add('<div id="ac_create_'.$this->iId.'"><div class="wizContainer" style="vertical-align:top;"><div id="dcr_'.$this->iId.'">');
$oPage->add("<h1>".MetaModel::GetClassIcon($this->sTargetClass)."&nbsp;".Dict::Format('UI:CreationTitle_Class', MetaModel::GetName($this->sTargetClass))."</h1>\n");
cmdbAbstractObject::DisplayCreationForm($oPage, $this->sTargetClass, null, array(), array('formPrefix' => $this->iId, 'noRelations' => true));
$oPage->add('</div></div></div>');
$oPage->add_ready_script("\$('#ac_create_$this->iId').dialog({ width: $(window).width()*0.8, height: 'auto', autoOpen: false, modal: true, title: '$sDialogTitle'});\n");
$oPage->add_ready_script("\$('#ac_create_$this->iId').dialog({ width: $(window).width()*0.8, height: 'auto', autoOpen: false, modal: true, title: '$this->sTitle'});\n");
$oPage->add_ready_script("$('#dcr_{$this->iId} form').removeAttr('onsubmit');");
$oPage->add_ready_script("$('#dcr_{$this->iId} form').bind('submit.uilinksWizard', oACWidget_{$this->iId}.DoCreateObject);");
}
@@ -266,6 +264,8 @@ EOF
$oObj->DBInsertTracked($oMyChange);
return array('name' => $oObj->GetName(), 'id' => $oObj->GetKey());
//return array('name' => 'test', 'id' => '42');
}
}
?>

View File

@@ -132,7 +132,7 @@ class UILinksWizard
function AddObjects()
{
// TO DO: compute the list of objects already linked with the current Object
$.post( '../pages/ajax.render.php', { 'operation': 'addObjects',
$.post( 'ajax.render.php', { 'operation': 'addObjects',
'class': '{$this->m_sClass}',
'linkageAttr': '{$this->m_sLinkageAttr}',
'linkedClass': '{$this->m_sLinkedClass}',
@@ -175,7 +175,7 @@ class UILinksWizard
theMap['operation'] = 'searchObjectsToAdd';
// Run the query and display the results
$.post( '../pages/ajax.render.php', theMap,
$.post( 'ajax.render.php', theMap,
function(data)
{
$('#SearchResultsToAdd').html(data);
@@ -223,7 +223,7 @@ class UILinksWizard
theMap['operation'] = 'doAddObjects';
// Run the query and display the results
$.post( '../pages/ajax.render.php', theMap,
$.post( 'ajax.render.php', theMap,
function(data)
{
//console.log('Data: ' + data);

View File

@@ -865,10 +865,8 @@ class BulkChange
// Assumption: there is only one class of objects being loaded
// Then the last class found gives us the class for every object
if ( ($iModified > 0) || ($iCreated > 0))
{
$aDetails[] = array('date' => $sDate, 'user' => $sUser, 'class' => $sClass, 'created' => $iCreated, 'modified' => $iModified);
}
$aDetails[] = array('date' => $sDate, 'user' => $sUser, 'class' => $sClass, 'created' => $iCreated, 'modified' => $iModified);
}

View File

@@ -205,14 +205,6 @@ class Config
'source_of_value' => '',
'show_in_conf_sample' => true,
),
'log_usage' => array(
'type' => 'bool',
'description' => 'Log the usage of the application (i.e. the date/time and the user name of each login)',
'default' => false,
'value' => false,
'source_of_value' => '',
'show_in_conf_sample' => false,
),
);
public function IsProperty($sPropCode)
@@ -341,7 +333,7 @@ class Config
'application/menunode.class.inc.php',
'application/user.preferences.class.inc.php',
'application/audit.rule.class.inc.php',
// Romain - That's dirty, because those classes are in fact part of the core
// Romain - That's dirty, because those 3 classes are in fact part of the core
// but I needed those classes to be derived from cmdbAbstractObject
// (to be managed via the GUI) and this class in not really known from
// the core, PLUS I needed the includes to be there also for the setup

View File

@@ -258,35 +258,4 @@ class EventWebService extends Event
}
}
class EventLoginUsage extends Event
{
public static function Init()
{
$aParams = array
(
"category" => "core/cmdb,view_in_gui",
"key_type" => "autoincrement",
"name_attcode" => "",
"state_attcode" => "",
"reconc_keys" => array(),
"db_table" => "priv_event_loginusage",
"db_key_field" => "id",
"db_finalclass_field" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"user_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contact_name", array("allowed_values"=>null, "extkey_attcode"=>"user_id", "target_attcode"=>"contactid", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contact_email", array("allowed_values"=>null, "extkey_attcode"=>"user_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
// Display lists
MetaModel::Init_SetZListItems('details', array('date', 'user_id', 'contact_name', 'contact_email', 'userinfo', 'message')); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', array('date', 'user_id', 'contact_name', 'contact_email', 'userinfo')); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems('standard_search', array('date', 'user_id', 'contact_name', 'contact_email')); // Criteria of the std search form
// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
}
}
?>

View File

@@ -114,7 +114,7 @@ function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
me.StopPendingRequest();
// Run the query and display the results
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( 'ajax.render.php', theMap,
function(data)
{
$(sSearchAreaId).html(data);
@@ -150,7 +150,7 @@ function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
me.StopPendingRequest();
// Run the query and get the result back directly in JSON
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( 'ajax.render.php', theMap,
function(data)
{
$('#label_'+me.id).val(data.name);
@@ -205,7 +205,7 @@ function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
me.StopPendingRequest();
// Run the query and get the result back directly in HTML
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( 'ajax.render.php', theMap,
function(data)
{
$('#ajax_'+me.id).html(data);
@@ -275,7 +275,7 @@ function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
me.StopPendingRequest();
// Run the query and get the result back directly in JSON
me.ajax_request = $.post( '../pages/ajax.render.php', theMap,
me.ajax_request = $.post( 'ajax.render.php', theMap,
function(data)
{
if (me.bSelectMode)

View File

@@ -96,7 +96,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates)
$(sSearchAreaId).block();
// Run the query and display the results
$.post( '../pages/ajax.render.php', theMap,
$.post( 'ajax.render.php', theMap,
function(data)
{
$(sSearchAreaId).html(data);
@@ -147,7 +147,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates)
theMap['operation'] = 'doAddObjects';
$('#busy_'+me.iInputId).html('&nbsp;<img src="../images/indicator.gif"/>');
// Run the query and display the results
$.post( '../pages/ajax.render.php', theMap,
$.post( 'ajax.render.php', theMap,
function(data)
{
//console.log('Data: ' + data);

View File

@@ -21,7 +21,7 @@ function ReloadTruncatedList(divId, sSerializedFilter, sExtraParams)
console.log('Uh,uh, exception !');
}
}
aTruncatedLists[divId] = $.post('../pages/ajax.render.php?style=list',
aTruncatedLists[divId] = $.post('ajax.render.php?style=list',
{ operation: 'ajax', filter: sSerializedFilter, extra_params: sExtraParams },
function(data)
{
@@ -76,7 +76,7 @@ function ReloadBlock(divId, sStyle, sSerializedFilter, sExtraParams)
{
$('#'+divId).block();
//$('#'+divId).blockUI();
$.post('../pages/ajax.render.php?style='+sStyle,
$.post('ajax.render.php?style='+sStyle,
{ operation: 'ajax', filter: sSerializedFilter, extra_params: sExtraParams },
function(data){
$('#'+divId).empty();
@@ -136,7 +136,7 @@ function ReloadSearchForm(divId, sClassName, sBaseClass, sContext)
}
}
$.post('../pages/ajax.render.php?'+sContext,
$.post('ajax.render.php?'+sContext,
{ operation: 'search_form', className: sClassName, baseClass: sBaseClass, currentId: divId },
function(data) {
oDiv.empty();
@@ -182,7 +182,7 @@ function SetUserPreference(sPreferenceCode, sPrefValue, bPersistent)
oUserPreferences[sPreferenceCode] = sPrefValue;
if (bPersistent && (sPrefValue != sPreviousValue))
{
ajax_request = $.post('../pages/ajax.render.php',
ajax_request = $.post('ajax.render.php',
{ operation: 'set_pref', code: sPreferenceCode, value: sPrefValue} ); // Make it persistent
}
}

View File

@@ -9,7 +9,7 @@ function UpdateObjectList(sClass, sId, sExtKeyToRemote)
aRelatedObjectIds[0] = 0;
}
var oql = "SELECT "+sClass+" AS c WHERE c.id IN (" + aRelatedObjectIds.join(", ") + ")";
$.post("../pages/ajax.render.php?style=list&encoding=oql",
$.post("ajax.render.php?style=list&encoding=oql",
{ operation: "ajax", filter: oql },
function(data){
$("#related_objects_"+sId).empty();
@@ -42,7 +42,7 @@ function ManageObjects(sTitle, sClass, sId, sExtKeyToRemote)
function Manage_LoadSelect(sSelectedId, sFilter)
{
$('#'+sSelectedId).addClass('loading');
$.post('../pages/ajax.render.php',
$.post('ajax.render.php',
{ operation: 'combo_options', filter: sFilter },
function(data){
$('#'+sSelectedId).empty();

View File

@@ -133,7 +133,7 @@ function WizardHelper(sClass, sFormPrefix)
{
//console.log('data sent:', this.ToJSON());
//console.log('oWizard:', this);
$.post('../pages/ajax.render.php',
$.post('ajax.render.php',
{ operation: 'wizard_helper', json_obj: this.ToJSON() },
function(html){
$('#ajax_content').html(html);
@@ -149,7 +149,7 @@ function WizardHelper(sClass, sFormPrefix)
{
//console.log('data sent:', this.ToJSON());
//console.log('oWizard:', this);
$('#'+divId).load('../pages/ajax.render.php?operation=wizard_helper_preview',
$('#'+divId).load('ajax.render.php?operation=wizard_helper_preview',
{'json_obj': this.ToJSON()},
function(responseText, textStatus, XMLHttpRequest){
$('#wizStep'+ G_iCurrentStep).unblock( {fadeOut: 0} );

View File

@@ -59,10 +59,12 @@ function AddNodeDetails(&$oNode, $oObj)
* @param DBObject $oObj The current object
* @param string $sRelation The name of the relation to search with
*/
function GetRelatedObjectsAsXml(DBObject $oObj, $sRelationName, &$oLinks, &$oXmlDoc, &$oXmlNode, $iDepth = 0)
function GetRelatedObjectsAsXml(DBObject $oObj, $sRelationName, &$oLinks, &$oXmlDoc, &$oXmlNode)
{
$aResults = array();
$oObj->GetRelatedObjects($sRelationName, 1 /* iMaxDepth */, $aResults);
static $iDepth = 0;
$iDepth++;
if ($iDepth > MAX_RECURSION_DEPTH) return;
foreach($aResults as $sRelatedClass => $aObjects)
@@ -83,7 +85,7 @@ function GetRelatedObjectsAsXml(DBObject $oObj, $sRelationName, &$oLinks, &$oXml
AddNodeDetails($oLinkedNode, $oTargetObj);
$oSubLinks = $oXmlDoc->CreateElement('links');
// Recurse
GetRelatedObjectsAsXml($oTargetObj, $sRelationName, $oSubLinks, $oXmlDoc, $oLinkedNode, $iDepth++);
GetRelatedObjectsAsXml($oTargetObj, $sRelationName, $oSubLinks, $oXmlDoc, $oLinkedNode);
$oLinkingNode->AppendChild($oLinkedNode);
$oLinks->AppendChild($oLinkingNode);
}
@@ -137,7 +139,7 @@ try
$aResults = array();
$oObj->GetRelatedObjects($sRelation, MAX_RECURSION_DEPTH /* iMaxDepth */, $aResults);
$iBlock = 1; // Zero is not a valid blockid
$iBlock = 0;
foreach($aResults as $sClass => $aObjects)
{
$oSet = CMDBObjectSet::FromArray($sClass, $aObjects);
@@ -183,4 +185,4 @@ catch(Exception $e)
{
echo "Error: ".$e->getMessage();
}
?>
?>