App-SocialCalc-Multiplayer

 view release on metacpan or  search on metacpan

socialcalc/simpleedit15.pl  view on Meta::CPAN

      }

   $response = <<"EOF"; # output page with edit JS code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Simple Page Editor With Spreadsheets $versionstr</title>
<script type="text/javascript" src="${jsdir}socialcalcconstants.js"></script>
<script type="text/javascript" src="${jsdir}socialcalc-3.js"></script>
<script type="text/javascript" src="${jsdir}socialcalctableeditor.js"></script>
<script type="text/javascript" src="${jsdir}formatnumber2.js"></script>
<script type="text/javascript" src="${jsdir}formula1.js"></script>
<script type="text/javascript" src="${jsdir}socialcalcpopup.js"></script>
<script type="text/javascript" src="${jsdir}socialcalcspreadsheetcontrol.js"></script>
<style>
body, td, input, texarea
 {font-family:verdana,helvetica,sans-serif;font-size:small;}
</style>
</head>
<body>
<form name="f0" action="" method="POST">
<div style="padding:6px;background-color:#80A9F3;">
<div style="font-weight:bold;color:white;">SIMPLE SYSTEM FOR EDITING PAGES WITH SPREADSHEETS AND MORE</div>
<div style="color:#FDD;font-weight:bold;">$statusmessage &nbsp;</div>
<div style="margin-bottom:6px;">Editing page: <span style="font-style:italic;font-weight:bold;">$pagename</span></div>
<input type="submit" name="savespreadsheet" value="Save" onclick="dosave();">
<input type="submit" name="cancelspreadsheet" value="Cancel">
<textarea name="savestr" id="sheetdata" style="display:none;">$sheetstr</textarea>
<input type="hidden" name="newstr" id="newdata" value="">
<input type="hidden" name="pagename" value="$pagename">
<input type="hidden" name="sheetname" value="$sheetname">
</div>
</form>
<div id="msg" style="position:absolute;right:15px;">
<input type="button" style="font-size:x-small;" value="Clear" onclick="addmsg('',true);"><br>
 <input type="button" style="font-size:x-small;" value="ShowCols" onclick="showvalue();"><br>
 <textarea id="msgtext" style="margin-top:10px;width:140px;height:500px;"></textarea>
</div>
<div id="tableeditor" style="margin:8px 170px 10px 0px;">editor goes here</div>
<script>

document.getElementById("msgtext").value = "";

function setmsg(msg) {document.getElementById("msg").innerHTML = msg;}
function addmsg(msg, clear) {
   var msgtextid = document.getElementById("msgtext");
   if (!msgtextid) {
      document.getElementById("msg").innerHTML = '<textarea id="msgtext" cols="60" rows="5"></textarea>';
      msgtextid = document.getElementById("msgtext");
      }
   if (clear) msgtextid.value = "";
   if (msgtextid.value.length>0) msgtextid.value += "\\n";
   msgtextid.value += msg;
   }
var heights=[];
function showvalue() {
   addmsg(spreadsheet.editor.colwidth, true);
   }

// formatting callbacks

// Simple ExpandWiki code for testing

SocialCalc.Callbacks.expand_wiki = function(displayvalue, sheetobj, linkstyle, valueformat) {

   var subtype = valueformat.substring(9); // stuff after text-wiki
   var result = "";
   var matches, url, scestring;

   switch (subtype) {
      case "":
         result = SocialCalc.default_expand_markup(displayvalue, sheetobj, linkstyle);
         break;

      case "-pagelink":
         matches = displayvalue.match(/\\[(\\S+)\\s+(.+)\\]/);
         if (matches) {
            url = encodeURI(matches[1]);
            scestring = SocialCalc.special_chars(matches[2]);
            }
         else {
            matches = displayvalue.match(/\\[(.*)\\]/);
            if (matches) {
               url = encodeURI(matches[1]);
               scestring = SocialCalc.special_chars(matches[1]);
               }
            else {
               url = encodeURI(displayvalue);
               scestring = SocialCalc.special_chars(displayvalue);
               }
            }
         result = '<a href="?pagename='+url+'" target="_blank">'+scestring+'</a>';
         return result+ '<img src="'+spreadsheet.imagePrefix+'sc-wikilinkflag.gif" title="Link to other wiki page" alt="Link to other wiki page">';

      default:
         result = SocialCalc.special_chars(valueformat+": "+displayvalue);
         break;
      }

   return '<img src="'+spreadsheet.imagePrefix+'sc-wikiflag.gif" alt="Wikitext" title="Wikitext">' + result;

   }

// Page link code

SocialCalc.Callbacks.MakePageLink = function(pagename, workspace, linktyle, valueformat) {

   var result = "";

   if (workspace) {
      result = "?&workspace=" + encodeURI(workspace) + "&pagename=" + encodeURI(pagename);
      }
   else {
      result = "?&pagename=" + encodeURI(pagename);
      }

   return result;

   }



( run in 1.553 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )