<commit_before><?php
// Copyright: All contributors to the Umple Project
// This file is made available subject to the open source license found at:
// http://umple.org/license
//
// Main program that generates UmpleOnline
require_once ("scripts/compiler_config.php");
cleanupOldFiles();

if (isset($_REQUEST["model"])) {
  if (!is_file("ump/".$_REQUEST["model"]."/model.ump")) {
  
  
    header('HTTP/1.0 404 Not Found');
    readfile('../404.shtml');
    exit();
  }
}

$diagramtype = "";
$isCachedExample = false;
$imageoutput="";
$messageURL="";
if (isset($_REQUEST['example']) && $_REQUEST["example"] != "") {
  $cachedimage= "ump/imagecache/".htmlspecialchars($_REQUEST['example']).".svg";
  if (file_exists($cachedimage))
  {
    $isCachedExample=true;
  }
  else
  {
    $cachedimage= "ump/imagecachesm/".htmlspecialchars($_REQUEST['example']).".svg";
    if (file_exists($cachedimage))
    {
      $isCachedExample=true;
      $diagramtype="&diagramtype=state";
    }
    else
    {
      $cachedimage= "ump/imagecachestructure/".htmlspecialchars($_REQUEST['example']).".svg";
      if (file_exists($cachedimage))
      {
        $isCachedExample=true;
        $diagramtype="&diagramtype=structureDiagram&generateDefault=cpp";
      }    
    }
  }
  if($isCachedExample) {
    $imageoutput = "<br/><iframe src=\"".$cachedimage."\"></iframe><br\>";
    $messageURL = "<a href=\"?example=".$_REQUEST['example'].$diagramtype."\">URL for ".$_REQUEST['example']." example</a>";
  }
}

$filename = extractFilename();

// Core options after ? and between &. One of the first four is allowed

// example=xxx means load the .ump file named xxx

// filename=xxx means load the URL named xxx (but without the leading http://

// model=nnnn means load the saved bookmark

// text=zzzzz means load the URLencoded text for short examples (as in the user manual)

// nochrome means hide the banner at the top to save real estate
if (isset($_REQUEST["nochrome"])) {$showChrome=false;} else {$showChrome=true;}

// nodiagram means suppress creation of the diagram - passed to JavaScript
if (isset($_REQUEST["nodiagram"])) {$showDiagram=false;} else {$showDiagram=true;}

// diagramtype means choose some diagram other than the default which is class
$diagramType = "class";
if (isset($_REQUEST["diagramtype"])) {
  $diagramType=$_REQUEST["diagramtype"];
  if ($diagramType=="state") $diagramType = "GvState";
  else if ($diagramType=="structure") $diagramType = "structureDiagram";  
  else if ($diagramType !="GvState" && $diagramType !="GvClass" && $diagramType !="structureDiagram") $diagramType = "class";
}
if ($diagramtype=="") $diagramtype = "&diagramtype=".$diagramType;

// notext means suppress creation of the text pane - passed to JavaScript
// ignored if nodiagram is also set
if ($showDiagram && isset($_REQUEST["notext"])) {$showText=false;} else {$showText=true;}

// showlayout means allow the layout editor to appear
// ignored if notext is also set
if ($showText && isset($_REQUEST["showlayout"])) {$showLayout=true;} else {$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">
      <div class="inRow logo">
        <img src="scripts/umpleonline_title.jpg" title="UmpleOnline - Draw and Type your next model" />
      </div>
      <div class="inRow">
        <p class="pagedescription">
          Draw on the right, write (Umple) model code on the left. Generate Java, C++, PHP, Alloy, NuSMV or Ruby code from your models. <br/>
          Visit <a href="http://manual.umple.org" target="helppage">the User Manual</a> or <a href="http://www.umple.org">the Umple Home Page</a> for help.
          &nbsp;&nbsp;&nbsp;<a href="download_eclipse_umple_plugin.html">Download Umple</a>
          &nbsp;&nbsp;&nbsp;<a href="https://github.com/umple/umple/issues/new" target="newissue">Report an Issue</a>
        </p>
      </div>
    </div>
  <?php } ?>

  <noscript>
    <br/><font color="red">JavaScript is disabled so the dynamic features of this page will not work. To use UmpleOnline, turn Javascript on. Otherwise you can download the command-line Umple compiler or use Eclipse.</font>
    <?php echo $imageoutput ?>
    <pre>
      <?php echo $output ?>
    </pre>
  </noscript> 
          
  <input id="filename" type="hidden" value="<?php echo $filename ?>" />
  <input id="advancedMode" type="hidden" value="0" />

  <div id="topLine" class="bookmarkableUrl">
    <span id="linetext">Line=<input size=2 id="linenum" value=1 onChange="Action.setCaretPosition(value);"></input>&nbsp; &nbsp;</span> 
  
    <?php if (isBookmark($filename)) { ?>
      <a id="topBookmarkable" href="umple.php?model=<?php echo extractModelId($filename) ?>">Changes at this URL are saved</a>
    <?php } else { ?>
      <a id="topBookmarkable" href="bookmark.php?model=<?php echo extractModelId($filename) ?>">Create Bookmarkable URL</a>
    <?php } ?>
    
    <span id="restorecode" >&nbsp; &nbsp; <a href="#"> Restore Saved State</a></span>
    
    &nbsp; &nbsp;<span id=exampleMessage><?php echo $messageURL ?></span> <span id=feedbackMessage></span>
  </div><commit_msg>Updating UmpleOnline main web page to reflect Docker<commit_after><?php
// Copyright: All contributors to the Umple Project
// This file is made available subject to the open source license found at:
// http://umple.org/license
//
// Main program that generates UmpleOnline
require_once ("scripts/compiler_config.php");
cleanupOldFiles();

if (isset($_REQUEST["model"])) {
  if (!is_file("ump/".$_REQUEST["model"]."/model.ump")) {
  
  
    header('HTTP/1.0 404 Not Found');
    readfile('../404.shtml');
    exit();
  }
}

$diagramtype = "";
$isCachedExample = false;
$imageoutput="";
$messageURL="";
if (isset($_REQUEST['example']) && $_REQUEST["example"] != "") {
  $cachedimage= "ump/imagecache/".htmlspecialchars($_REQUEST['example']).".svg";
  if (file_exists($cachedimage))
  {
    $isCachedExample=true;
  }
  else
  {
    $cachedimage= "ump/imagecachesm/".htmlspecialchars($_REQUEST['example']).".svg";
    if (file_exists($cachedimage))
    {
      $isCachedExample=true;
      $diagramtype="&diagramtype=state";
    }
    else
    {
      $cachedimage= "ump/imagecachestructure/".htmlspecialchars($_REQUEST['example']).".svg";
      if (file_exists($cachedimage))
      {
        $isCachedExample=true;
        $diagramtype="&diagramtype=structureDiagram&generateDefault=cpp";
      }    
    }
  }
  if($isCachedExample) {
    $imageoutput = "<br/><iframe src=\"".$cachedimage."\"></iframe><br\>";
    $messageURL = "<a href=\"?example=".$_REQUEST['example'].$diagramtype."\">URL for ".$_REQUEST['example']." example</a>";
  }
}

$filename = extractFilename();

// Core options after ? and between &. One of the first four is allowed

// example=xxx means load the .ump file named xxx

// filename=xxx means load the URL named xxx (but without the leading http://

// model=nnnn means load the saved bookmark

// text=zzzzz means load the URLencoded text for short examples (as in the user manual)

// nochrome means hide the banner at the top to save real estate
if (isset($_REQUEST["nochrome"])) {$showChrome=false;} else {$showChrome=true;}

// nodiagram means suppress creation of the diagram - passed to JavaScript
if (isset($_REQUEST["nodiagram"])) {$showDiagram=false;} else {$showDiagram=true;}

// diagramtype means choose some diagram other than the default which is class
$diagramType = "class";
if (isset($_REQUEST["diagramtype"])) {
  $diagramType=$_REQUEST["diagramtype"];
  if ($diagramType=="state") $diagramType = "GvState";
  else if ($diagramType=="structure") $diagramType = "structureDiagram";  
  else if ($diagramType !="GvState" && $diagramType !="GvClass" && $diagramType !="structureDiagram") $diagramType = "class";
}
if ($diagramtype=="") $diagramtype = "&diagramtype=".$diagramType;

// notext means suppress creation of the text pane - passed to JavaScript
// ignored if nodiagram is also set
if ($showDiagram && isset($_REQUEST["notext"])) {$showText=false;} else {$showText=true;}

// showlayout means allow the layout editor to appear
// ignored if notext is also set
if ($showText && isset($_REQUEST["showlayout"])) {$showLayout=true;} else {$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">
      <div class="inRow logo">
        <img src="scripts/umpleonline_title.jpg" title="UmpleOnline - Draw and Type your next model" />
      </div>
      <div class="inRow">
        <p class="pagedescription">
          Draw on the right, write (Umple) model code on the left. Generate Java, C++, PHP, Alloy, NuSMV or Ruby code from your models. <br/>
          Visit <a href="http://manual.umple.org" target="helppage">the User Manual</a> or <a href="http://www.umple.org">the Umple Home Page</a> for help.
          &nbsp;&nbsp;&nbsp;<a href="download_eclipse_umple_plugin.html">Download Umple or run this in Docker for speed</a>
          &nbsp;&nbsp;&nbsp;<a href="https://github.com/umple/umple/issues/new" target="newissue">Report an Issue</a>
        </p>
      </div>
    </div>
  <?php } ?>

  <noscript>
    <br/><font color="red">JavaScript is disabled so the dynamic features of this page will not work. To use UmpleOnline, turn Javascript on. Otherwise you can download the command-line Umple compiler or use Eclipse.</font>
    <?php echo $imageoutput ?>
    <pre>
      <?php echo $output ?>
    </pre>
  </noscript> 
          
  <input id="filename" type="hidden" value="<?php echo $filename ?>" />
  <input id="advancedMode" type="hidden" value="0" />

  <div id="topLine" class="bookmarkableUrl">
    <span id="linetext">Line=<input size=2 id="linenum" value=1 onChange="Action.setCaretPosition(value);"></input>&nbsp; &nbsp;</span> 
  
    <?php if (isBookmark($filename)) { ?>
      <a id="topBookmarkable" href="umple.php?model=<?php echo extractModelId($filename) ?>">Changes at this URL are saved</a>
    <?php } else { ?>
      <a id="topBookmarkable" href="bookmark.php?model=<?php echo extractModelId($filename) ?>">Create Bookmarkable URL</a>
    <?php } ?>
    
    <span id="restorecode" >&nbsp; &nbsp; <a href="#"> Restore Saved State</a></span>
    
    &nbsp; &nbsp;<span id=exampleMessage><?php echo $messageURL ?></span> <span id=feedbackMessage></span>
  </div>
{'fraction_non_alphanumeric': 0.1737643514371794, 'fraction_numerical': 0.0037456233205765002, 'mean_word_length': 4.28258064516129, 'pattern_counts': {'":': 0, '<': 151, '<?xml version=': 0, '>': 151, 'https://': 2, 'lorem ipsum': 0, 'www.': 6, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7448721', 'n_tokens_mistral': 3940, 'n_tokens_neox': 3846, 'n_words': 1011}