$showLayout = false; } // nomenu means suppress display of menu. Can only happen if diagram OR text hidden if (isset($_REQUEST["nomenu"])) { $showMenu = false; } else { $showMenu = true; } // readOnly means suppress ability to edit - passed to JavaScript $readOnly = isset($_REQUEST["readOnly"]); // $generateDefault = "#genclass"; if (isset($_REQUEST['generateDefault']) && $_REQUEST["generateDefault"] != "") { $generateDefault = "#gen" . $_REQUEST['generateDefault']; } $output = readTemporaryFile("ump/" . $filename); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="scripts/_load.js" type="text/javascript"></script> <title>UmpleOnline: Generate Java, C++, PHP, Alloy, NuSMV or Ruby code from Umple</title> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> </head> <body> <?php if ($showChrome) { ?> <div id="header" class="row">
saveFile($genericCode, $outputFilename); $command = "java -jar umplesync.jar -generate {$language} {$outputFilename} > {$secondOutFilename}"; } exec($command); $sourceCode = readTemporaryFile($secondOutFilename); $sourceCode = str_replace("<?php", "", $sourceCode); $sourceCode = str_replace("?>", "", $sourceCode); if ($sourceCode == "") { $sourceCode = "//Generated code did not compile in Umple, please review the Umple code below and then fix your VML code\n\n"; $sourceCode .= $genericCode; } } if ($language != "Json") { $sourceCode = htmlspecialchars($sourceCode); } if ($sourceCode == "") { $html = "\r\n //An error occurred interpreting your VML code, please review it and try again.\r\n //If the problem persists, please email the Umple code to\r\n //Andrew at aforward@site.uottawa.ca.\r\n "; echo $html; } else { echo $sourceCode; } } else { if (isset($_REQUEST["exampleCode"])) { $filename = "../ump/" . $_REQUEST["exampleCode"]; $outputUmple = readTemporaryFile($filename); echo $outputUmple; } else { echo "Invalid use of vml compiler"; } } }
function getErrorHtml($errorFilename, $offset = 1) { $errorMessage = readTemporaryFile($errorFilename); if ($errorMessage != "") { $errInfo = jsonDecode($errorMessage); $errhtml = "<a href='#' id='errorClick'>Show/Hide errors and warnings</a>"; $errhtml .= "<div id='errorRow' colspan='3' >"; // style='display:none' if ($errInfo == null) { $errhtml .= "Couldn't read results from the Umple compiler!"; } else { $results = $errInfo["results"]; foreach ($results as $result) { $url = $result["url"]; $line = intval($result["line"]) - $offset; $errorCode = $result["errorCode"]; $severityInt = intval($result["severity"]); if ($severityInt > 2) { $severity = "Warning"; $textcolor = "<font color=\"black\">"; } else { $severity = "Error"; $textcolor = "<font color=\"red\">"; } $msg = htmlspecialchars($result["message"]); $errhtml .= $textcolor . " {$severity} on <a href=\"javascript:Action.setCaretPosition({$line});Action.updateLineNumberDisplay();\">line {$line}</a> : {$msg}.</font> <i><a href=\"{$url}\" target=\"helppage\">More information ({$errorCode})</a></i></br>"; } } $errhtml .= "</div>"; $errhtml .= "<script type=\"text/javascript\">jQuery(\"#errorClick\").click(function(a){a.preventDefault();jQuery(\"#errorRow\").toggle();});</script>"; return $errhtml; } return ""; }
<?php require_once "scripts/compiler_config.php"; cleanupOldFiles(); $filename = extractFilename(); $output = readTemporaryFile($filename); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="scripts/_load_vml.js" type="text/javascript"></script> <title>UmpleOnline: Generate Java, PHP, Alloy, NuSMV or Ruby code from Umple</title> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> </head> <body> <table class="pagetitle"> <tr> <td> <img src="scripts/vmlonline_title.jpg" title="VML-Online" /> </td> <td> <p class="pagedescription"> Add your VML structure, and then include the appropriate invocations to generate the desired system.<br /> Note that this implementation has been set to work with <a href="http://cruise.site.uottawa.ca/umpleonline">UmpleOnline</a>,<br /> so if your generation code is Umple, you can compile it directly to Java, PHP, or Ruby. </p> </td> </tr> </table>