import.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <?php
  2. // Copyright (C) 2010 Combodo SARL
  3. //
  4. // This program is free software; you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation; version 3 of the License.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. /**
  17. * Import web service
  18. *
  19. * @author Erwan Taloc <erwan.taloc@combodo.com>
  20. * @author Romain Quetiez <romain.quetiez@combodo.com>
  21. * @author Denis Flaven <denis.flaven@combodo.com>
  22. * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
  23. */
  24. //
  25. // Known limitations
  26. // - reconciliation is made on the first column
  27. //
  28. // Known issues
  29. // - ALMOST impossible to troubleshoot when an externl key has a wrong value
  30. // - no character escaping in the xml output (yes !?!?!)
  31. // - not outputing xml when a wrong input is given (class, attribute names)
  32. //
  33. require_once('../application/application.inc.php');
  34. require_once('../application/webpage.class.inc.php');
  35. require_once('../application/csvpage.class.inc.php');
  36. require_once('../application/xmlpage.class.inc.php');
  37. require_once('../application/startup.inc.php');
  38. class BulkLoadException extends Exception
  39. {
  40. }
  41. $aPageParams = array
  42. (
  43. 'class' => array
  44. (
  45. 'mandatory' => true,
  46. 'default' => null,
  47. 'description' => 'class of loaded objects',
  48. ),
  49. 'csvdata' => array
  50. (
  51. 'mandatory' => true,
  52. 'default' => null,
  53. 'description' => 'data',
  54. ),
  55. 'charset' => array
  56. (
  57. 'mandatory' => false,
  58. 'default' => 'UTF-8',
  59. 'description' => 'Character set encoding of the CSV data: UTF-8, ISO-8859-1, WINDOWS-1251, WINDOWS-1252, ISO-8859-15',
  60. ),
  61. // 'csvfile' => array
  62. // (
  63. // 'mandatory' => false,
  64. // 'default' => '',
  65. // 'description' => 'local data file, replaces csvdata if specified',
  66. // ),
  67. 'separator' => array
  68. (
  69. 'mandatory' => false,
  70. 'default' => ';',
  71. 'description' => 'column separator in CSV data',
  72. ),
  73. 'qualifier' => array
  74. (
  75. 'mandatory' => false,
  76. 'default' => '"',
  77. 'description' => 'test qualifier in CSV data',
  78. ),
  79. 'output' => array
  80. (
  81. 'mandatory' => false,
  82. 'default' => 'summary',
  83. 'description' => '[retcode] to return the count of lines in error, [summary] to return a concise report, [details] to get a detailed report (each line listed)',
  84. ),
  85. /*
  86. 'reportlevel' => array
  87. (
  88. 'mandatory' => false,
  89. 'default' => 'errors|warnings|created|changed|unchanged',
  90. 'description' => 'combination of flags to limit the detailed output',
  91. ),
  92. */
  93. 'reconciliationkeys' => array
  94. (
  95. 'mandatory' => false,
  96. 'default' => '',
  97. 'description' => 'name of the columns used to identify existing objects and update them, or create a new one',
  98. ),
  99. 'simulate' => array
  100. (
  101. 'mandatory' => false,
  102. 'default' => '0',
  103. 'description' => 'If set to 1, then the load will not be executed, but the expected report will be produced',
  104. ),
  105. 'comment' => array
  106. (
  107. 'mandatory' => false,
  108. 'default' => '',
  109. 'description' => 'Comment to be added into the change log',
  110. ),
  111. );
  112. function UsageAndExit($oP)
  113. {
  114. global $aPageParams;
  115. $oP->p("USAGE:\n");
  116. foreach($aPageParams as $sParam => $aParamData)
  117. {
  118. $sDesc = $aParamData['description'].', '.($aParamData['mandatory'] ? 'mandatory' : 'optional, defaults to ['.$aParamData['default'].']');
  119. $oP->p("$sParam = $sDesc\n");
  120. }
  121. $oP->output();
  122. exit;
  123. }
  124. function ReadParam($oP, $sParam)
  125. {
  126. global $aPageParams;
  127. assert(isset($aPageParams[$sParam]));
  128. assert(!$aPageParams[$sParam]['mandatory']);
  129. $sValue = utils::ReadParam($sParam, $aPageParams[$sParam]['default'], true /* Allow CLI */);
  130. return trim($sValue);
  131. }
  132. function ReadMandatoryParam($oP, $sParam)
  133. {
  134. global $aPageParams;
  135. assert(isset($aPageParams[$sParam]));
  136. assert($aPageParams[$sParam]['mandatory']);
  137. $sValue = utils::ReadParam($sParam, null, true /* Allow CLI */);
  138. if (is_null($sValue))
  139. {
  140. $oP->p("ERROR: Missing argument '$sParam'\n");
  141. UsageAndExit($oP);
  142. }
  143. return trim($sValue);
  144. }
  145. /////////////////////////////////
  146. // Main program
  147. if (false && utils::IsModeCLI())
  148. {
  149. // Mode CLI under construction... sorry!
  150. // Next steps:
  151. // implement a new page: CLIPage, that does a very clean output
  152. // branch if in CLI mode
  153. // enable the new argument 'csvfile'
  154. $sAuthUser = ReadMandatoryParam($oP, 'auth_user');
  155. $sAuthPwd = ReadMandatoryParam($oP, 'auth_user');
  156. $sCsvFile = ReadMandatoryParam($oP, 'csv_file');
  157. if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd))
  158. {
  159. UserRights::Login($sAuthUser); // Login & set the user's language
  160. }
  161. else
  162. {
  163. $oP->p("Access restricted or wrong credentials ('$sAuthUser')");
  164. exit;
  165. }
  166. }
  167. else
  168. {
  169. $_SESSION['login_mode'] = 'basic';
  170. require_once('../application/loginwebpage.class.inc.php');
  171. LoginWebPage::DoLogin(); // Check user rights and prompt if needed
  172. $oP = new CSVPage("iTop - Bulk import");
  173. }
  174. try
  175. {
  176. //////////////////////////////////////////////////
  177. //
  178. // Read parameters
  179. //
  180. $sClass = ReadMandatoryParam($oP, 'class');
  181. $sSep = ReadParam($oP, 'separator');
  182. $sQualifier = ReadParam($oP, 'qualifier');
  183. $sCSVData = utils::ReadPostedParam('csvdata');
  184. $sCharSet = ReadParam($oP, 'charset');
  185. $sOutput = ReadParam($oP, 'output');
  186. // $sReportLevel = ReadParam($oP, 'reportlevel');
  187. $sReconcKeys = ReadParam($oP, 'reconciliationkeys');
  188. $sSimulate = ReadParam($oP, 'simulate');
  189. $sComment = ReadParam($oP, 'comment');
  190. //////////////////////////////////////////////////
  191. //
  192. // Check parameters format/consistency
  193. //
  194. if (!MetaModel::IsValidClass($sClass))
  195. {
  196. throw new BulkLoadException("Unknown class: '$sClass'");
  197. }
  198. if (strlen($sSep) > 1)
  199. {
  200. throw new BulkLoadException("Separator is limited to one character, found '$sSep'");
  201. }
  202. if (strlen($sQualifier) > 1)
  203. {
  204. throw new BulkLoadException("Text qualifier is limited to one character, found '$sQualifier'");
  205. }
  206. if (!in_array($sOutput, array('retcode', 'summary', 'details')))
  207. {
  208. throw new BulkLoadException("Unknown output format: '$sOutput'");
  209. }
  210. /*
  211. $aReportLevels = explode('|', $sReportLevel);
  212. foreach($aReportLevels as $sLevel)
  213. {
  214. if (!in_array($sLevel, explode('|', 'errors|warnings|created|changed|unchanged')))
  215. {
  216. throw new BulkLoadException("Unknown level in reporting level: '$sLevel'");
  217. }
  218. }
  219. */
  220. if ($sSimulate == '1')
  221. {
  222. $bSimulate = true;
  223. }
  224. else
  225. {
  226. $bSimulate = false;
  227. }
  228. //////////////////////////////////////////////////
  229. //
  230. // Security
  231. //
  232. if (!UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_MODIFY))
  233. {
  234. throw new SecurityException(Dict::Format('UI:Error:BulkModifyNotAllowedOn_Class', $sClass));
  235. }
  236. //////////////////////////////////////////////////
  237. //
  238. // Parse first line, check attributes, analyse the request
  239. //
  240. if ($sCharSet == 'UTF-8')
  241. {
  242. $sUTF8Data = $sCSVData;
  243. }
  244. else
  245. {
  246. $sUTF8Data = iconv($sCharSet, 'UTF-8//IGNORE//TRANSLIT', $sCSVData);
  247. }
  248. $oCSVParser = new CSVParser($sUTF8Data, $sSep, $sQualifier);
  249. // Limitation: as the attribute list is in the first line, we can not match external key by a third-party attribute
  250. $aRawFieldList = $oCSVParser->ListFields();
  251. $iColCount = count($aRawFieldList);
  252. $aAttList = array();
  253. $aExtKeys = array();
  254. foreach($aRawFieldList as $iFieldId => $sFieldName)
  255. {
  256. if (preg_match('/^(.*)->(.*)$/', trim($sFieldName), $aMatches))
  257. {
  258. // The column has been specified as "extkey->attcode"
  259. //
  260. $sExtKeyAttCode = $aMatches[1];
  261. $sRemoteAttCode = $aMatches[2];
  262. if (!MetaModel::IsValidAttCode($sClass, $sExtKeyAttCode))
  263. {
  264. throw new BulkLoadException("Unknown attribute '$sExtKeyAttCode' (class: '$sClass')");
  265. }
  266. $oAtt = MetaModel::GetAttributeDef($sClass, $sExtKeyAttCode);
  267. if (!$oAtt->IsExternalKey())
  268. {
  269. throw new BulkLoadException("Not an external key '$sExtKeyAttCode' (class: '$sClass')");
  270. }
  271. $sTargetClass = $oAtt->GetTargetClass();
  272. if (!MetaModel::IsValidAttCode($sTargetClass, $sRemoteAttCode))
  273. {
  274. throw new BulkLoadException("Unknown attribute '$sRemoteAttCode' (key: '$sExtKeyAttCode', class: '$sTargetClass')");
  275. }
  276. $aExtKeys[$sExtKeyAttCode][$sRemoteAttCode] = $iFieldId;
  277. }
  278. else
  279. {
  280. // The column has been specified as "attcode"
  281. //
  282. if (!MetaModel::IsValidAttCode($sClass, $sFieldName))
  283. {
  284. throw new BulkLoadException("Unknown attribute '$sFieldName' (class: '$sClass')");
  285. }
  286. $oAtt = MetaModel::GetAttributeDef($sClass, $sFieldName);
  287. if ($oAtt->IsExternalKey())
  288. {
  289. $aExtKeys[$sFieldName]['id'] = $iFieldId;
  290. $aAttList[$sFieldName] = $iFieldId;
  291. }
  292. elseif ($oAtt->IsExternalField())
  293. {
  294. $sExtKeyAttCode = $oAtt->GetKeyAttCode();
  295. $sRemoteAttCode = $oAtt->GetExtAttCode();
  296. $aExtKeys[$sExtKeyAttCode][$sRemoteAttCode] = $iFieldId;
  297. }
  298. else
  299. {
  300. $aAttList[$sFieldName] = $iFieldId;
  301. }
  302. }
  303. }
  304. // Make sure there are some reconciliation keys
  305. //
  306. if (empty($sReconcKeys))
  307. {
  308. $aReconcSpec = array();
  309. // Base reconciliation scheme on the default one
  310. // The reconciliation attributes not present in the data will be ignored
  311. foreach(MetaModel::GetReconcKeys($sClass) as $sReconcKeyAttCode)
  312. {
  313. if (in_array($sReconcKeyAttCode, $aRawFieldList))
  314. {
  315. $aReconcSpec[] = $sReconcKeyAttCode;
  316. }
  317. }
  318. if (count($aReconcSpec) == 0)
  319. {
  320. throw new BulkLoadException("No reconciliation scheme could be defined, please add a column corresponding to one defined reconciliation key (class: '$sClass', reconciliation:".implode(',', MetaModel::GetReconcKeys($sClass)).")");
  321. }
  322. $sReconcKeys = implode(',', $aReconcSpec);
  323. }
  324. // Interpret the list of reconciliation keys
  325. //
  326. $aFinalReconcilKeys = array();
  327. $aReconcilKeysReport = array();
  328. foreach (explode(',', $sReconcKeys) as $sReconcKey)
  329. {
  330. $sReconcKey = trim($sReconcKey);
  331. if (empty($sReconcKey)) continue; // skip empty spec
  332. if (!in_array($sReconcKey, $aRawFieldList))
  333. {
  334. throw new BulkLoadException("Reconciliation keys not found in the input columns '$sReconcKey' (class: '$sClass')");
  335. }
  336. if (preg_match('/^(.*)->(.*)$/', trim($sReconcKey), $aMatches))
  337. {
  338. // The column has been specified as "extkey->attcode"
  339. //
  340. $sExtKeyAttCode = $aMatches[1];
  341. $sRemoteAttCode = $aMatches[2];
  342. $aFinalReconcilKeys[] = $sExtKeyAttCode;
  343. $aReconcilKeysReport[$sExtKeyAttCode][] = $sRemoteAttCode;
  344. }
  345. else
  346. {
  347. if (!MetaModel::IsValidAttCode($sClass, $sReconcKey))
  348. {
  349. // Safety net: should never happen, but...
  350. throw new BulkLoadException("Unknown reconciliation attribute '$sReconcKey' (class: '$sClass')");
  351. }
  352. $oAtt = MetaModel::GetAttributeDef($sClass, $sReconcKey);
  353. if ($oAtt->IsExternalKey())
  354. {
  355. $aFinalReconcilKeys[] = $sReconcKey;
  356. $aReconcilKeysReport[$sReconcKey][] = 'id';
  357. }
  358. elseif ($oAtt->IsExternalField())
  359. {
  360. $sReconcAttCode = $oAtt->GetKeyAttCode();
  361. $sReconcKeyReport = "$sReconcAttCode ($sReconcKey)";
  362. $aFinalReconcilKeys[] = $sReconcAttCode;
  363. $aReconcilKeysReport[$sReconcAttCode][] = $sReconcKeyReport;
  364. }
  365. else
  366. {
  367. $aFinalReconcilKeys[] = $sReconcKey;
  368. $aReconcilKeysReport[$sReconcKey] = array();
  369. }
  370. }
  371. }
  372. //////////////////////////////////////////////////
  373. //
  374. // Go for parsing and interpretation
  375. //
  376. $aData = $oCSVParser->ToArray();
  377. $iLineCount = count($aData);
  378. $oBulk = new BulkChange(
  379. $sClass,
  380. $aData,
  381. $aAttList,
  382. $aExtKeys,
  383. $aFinalReconcilKeys
  384. );
  385. if ($bSimulate)
  386. {
  387. $oMyChange = null;
  388. }
  389. else
  390. {
  391. $oMyChange = MetaModel::NewObject("CMDBChange");
  392. $oMyChange->Set("date", time());
  393. if (UserRights::IsImpersonated())
  394. {
  395. $sUserString = Dict::Format('UI:Archive_User_OnBehalfOf_User', UserRights::GetRealUser(), UserRights::GetUser());
  396. }
  397. else
  398. {
  399. $sUserString = UserRights::GetUser();
  400. }
  401. if (strlen($sComment) > 0)
  402. {
  403. $sMoreInfo = 'Web Service (CSV) - '.$sComment;
  404. }
  405. else
  406. {
  407. $sMoreInfo = 'Web Service (CSV)';
  408. }
  409. $oMyChange->Set("userinfo", $sUserString.', '.$sMoreInfo);
  410. $iChangeId = $oMyChange->DBInsert();
  411. }
  412. $aRes = $oBulk->Process($oMyChange);
  413. //////////////////////////////////////////////////
  414. //
  415. // Compute statistics
  416. //
  417. $iCountErrors = 0;
  418. $iCountWarnings = 0;
  419. $iCountCreations = 0;
  420. $iCountUpdates = 0;
  421. $iCountUnchanged = 0;
  422. foreach($aRes as $iRow => $aRowData)
  423. {
  424. $bWritten = false;
  425. $oStatus = $aRowData["__STATUS__"];
  426. switch(get_class($oStatus))
  427. {
  428. case 'RowStatus_NoChange':
  429. $iCountUnchanged++;
  430. break;
  431. case 'RowStatus_Modify':
  432. $iCountUpdates++;
  433. $bWritten = true;
  434. break;
  435. case 'RowStatus_NewObj':
  436. $iCountCreations++;
  437. $bWritten = true;
  438. break;
  439. case 'RowStatus_Issue':
  440. $iCountErrors++;
  441. break;
  442. }
  443. if ($bWritten)
  444. {
  445. // Something has been done, still there may be some issues to report
  446. foreach($aRowData as $key => $value)
  447. {
  448. if (!is_object($value)) continue;
  449. switch (get_class($value))
  450. {
  451. case 'CellStatus_Void':
  452. case 'CellStatus_Modify':
  453. break;
  454. case 'CellStatus_Issue':
  455. case 'CellStatus_Ambiguous':
  456. $iCountWarnings++;
  457. break;
  458. }
  459. }
  460. }
  461. }
  462. //////////////////////////////////////////////////
  463. //
  464. // Summary of settings and results
  465. //
  466. if ($sOutput == 'retcode')
  467. {
  468. $oP->add($iCountErrors);
  469. }
  470. if (($sOutput == "summary") || ($sOutput == 'details'))
  471. {
  472. $aReconciliationReport = array();
  473. foreach($aReconcilKeysReport as $sKey => $aKeyDetails)
  474. {
  475. if (count($aKeyDetails) > 0)
  476. {
  477. $aReconciliationReport[] = $sKey.' ('.implode(',', $aKeyDetails).')';
  478. }
  479. else
  480. {
  481. $aReconciliationReport[] = $sKey;
  482. }
  483. }
  484. $oP->add_comment("Class: ".$sClass);
  485. $oP->add_comment("Separator: ".$sSep);
  486. $oP->add_comment("Qualifier: ".$sQualifier);
  487. $oP->add_comment("Charset Encoding:".$sCharSet);
  488. $oP->add_comment("Data Size: ".strlen($sCSVData));
  489. $oP->add_comment("Data Lines: ".$iLineCount);
  490. $oP->add_comment("Columns: ".implode(', ', $aRawFieldList));
  491. $oP->add_comment("Reconciliation Keys: ".implode(', ', $aReconciliationReport));
  492. $oP->add_comment("Output format: ".$sOutput);
  493. // $oP->add_comment("Report level: ".$sReportLevel);
  494. $oP->add_comment("Simulate: ".($bSimulate ? '1' : '0'));
  495. $oP->add_comment("Change tracking comment: ".$sComment);
  496. $oP->add_comment("Issues: ".$iCountErrors);
  497. $oP->add_comment("Warnings: ".$iCountWarnings);
  498. $oP->add_comment("Created: ".$iCountCreations);
  499. $oP->add_comment("Updated: ".$iCountUpdates);
  500. $oP->add_comment("Unchanged: ".$iCountUnchanged);
  501. }
  502. if ($sOutput == 'details')
  503. {
  504. // Setup result presentation
  505. //
  506. $aDisplayConfig = array();
  507. $aDisplayConfig["__LINE__"] = array("label"=>"Line", "description"=>"");
  508. $aDisplayConfig["__STATUS__"] = array("label"=>"Status", "description"=>"");
  509. $aDisplayConfig["__OBJECT_CLASS__"] = array("label"=>"Object Class", "description"=>"");
  510. $aDisplayConfig["__OBJECT_ID__"] = array("label"=>"Object Id", "description"=>"");
  511. foreach($aExtKeys as $sExtKeyAttCode => $aRemoteAtt)
  512. {
  513. $sLabel = MetaModel::GetAttributeDef($sClass, $sExtKeyAttCode)->GetLabel();
  514. $aDisplayConfig["$sExtKeyAttCode"] = array("label"=>$sExtKeyAttCode, "description"=>$sLabel." - ext key");
  515. }
  516. foreach($aFinalReconcilKeys as $iCol => $sAttCode)
  517. {
  518. // $sLabel = MetaModel::GetAttributeDef($sClass, $sAttCode)->GetLabel();
  519. // $aDisplayConfig["$iCol"] = array("label"=>"$sLabel", "description"=>"");
  520. }
  521. foreach ($aAttList as $sAttCode => $iCol)
  522. {
  523. $sLabel = MetaModel::GetAttributeDef($sClass, $sAttCode)->GetLabel();
  524. $aDisplayConfig["$iCol"] = array("label"=>$sAttCode, "description"=>$sLabel);
  525. }
  526. $aResultDisp = array(); // to be displayed
  527. foreach($aRes as $iRow => $aRowData)
  528. {
  529. $aRowDisp = array();
  530. $aRowDisp["__LINE__"] = $iRow;
  531. if (is_object($aRowData["__STATUS__"]))
  532. {
  533. $aRowDisp["__STATUS__"] = $aRowData["__STATUS__"]->GetDescription();
  534. }
  535. else
  536. {
  537. $aRowDisp["__STATUS__"] = "*No status available*";
  538. }
  539. if (isset($aRowData["finalclass"]) && isset($aRowData["id"]))
  540. {
  541. $aRowDisp["__OBJECT_CLASS__"] = $aRowData["finalclass"];
  542. $aRowDisp["__OBJECT_ID__"] = $aRowData["id"]->GetValue();
  543. }
  544. else
  545. {
  546. $aRowDisp["__OBJECT_CLASS__"] = "n/a";
  547. $aRowDisp["__OBJECT_ID__"] = "n/a";
  548. }
  549. foreach($aRowData as $key => $value)
  550. {
  551. $sKey = (string) $key;
  552. if ($sKey == '__STATUS__') continue;
  553. if ($sKey == 'finalclass') continue;
  554. if ($sKey == 'id') continue;
  555. if (is_object($value))
  556. {
  557. $aRowDisp["$sKey"] = $value->GetValue().$value->GetDescription();
  558. }
  559. else
  560. {
  561. $aRowDisp["$sKey"] = $value;
  562. }
  563. }
  564. $aResultDisp[$iRow] = $aRowDisp;
  565. }
  566. $oP->table($aDisplayConfig, $aResultDisp);
  567. }
  568. }
  569. catch(BulkLoadException $e)
  570. {
  571. $oP->add_comment($e->getMessage());
  572. }
  573. catch(SecurityException $e)
  574. {
  575. $oP->add_comment($e->getMessage());
  576. }
  577. catch(Exception $e)
  578. {
  579. $oP->add_comment((string)$e);
  580. }
  581. $oP->output();
  582. ?>