Source: site.view [edit]
Function name: siteeditissue
Arguments: ctype,module,usecache,scrollToRow,flags
Description: Template form for editing issues.
Page type: html
Render function:  
Module: siteutil

Page source:

<html lang="en">
	
	<head>
        <title>Collaborama</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
        <link rel="stylesheet" type="text/css" href="/webl/WubHub_DoIt?cmdline=basiccss"/>				
		<link rel="stylesheet" href="/webl/WubHub_DoIt?cmdline=threeDcss">
		<link rel="stylesheet" href="/webl/WubHub_DoIt?cmdline=accordionCSS">      
 		<script src="http://codemirror.net/lib/codemirror.js"></script>
  		<link rel="stylesheet" href="http://codemirror.net/lib/codemirror.css">
  		<script src="http://codemirror.net/addon/search/searchcursor.js"></script>
  		<script src="http://codemirror.net/addon/search/search.js"></script>  
  
  		<script src="/static/cm/mode/wubhub/wubhub.js"></script>
  		<script src="/static/cm/mode/xml/xml.js"></script>
  		<script src="/static/cm/mode/javascript/javascript.js"></script>
  		<script src="/static/cm/mode/css/css.js"></script>
  		<script src="/static/cm/mode/htmlmixed/htmlmixed.js"></script>
  
    <style type="text/css">
      .CodeMirror {border: 1px solid grey; font-size:13px;background: #FFFFFF}
    </style>   

    <style type="text/css">      
      .CodeMirror-fullscreen {
        display: block;
        position: absolute;
        top: 0; left: 0;
        width: 100%;
        z-index: 9999;
      }

      .link-url {
        text-decoration:  underline;
        font-weight:      bold;
        color: blue;
        cursor: pointer;
      }
        
      .folded-url {
        display: inline-block;
        background: #46d5ff;
        border: solid 1px #2e8da9;
        color: white;
        font-weight: bold;
        cursor: pointer;
        border-radius: 10px;
        padding: 2px 6px;
        font-size: 80%;
        font-family: "helvetica neue", helvetica, arial, sans-serif;
      }
     </style>
      
	</head>
	
    <body onload='document.forms.wubhub.cmdline.focus(); setContentMode("<webl>ctype;</webl>");'>

		<div class="meny">
          <webl>Markup(WubCall("collabSidebar", []));</webl>      
		</div>

		<div class="meny-arrow"></div>

		<div class="meny-contents">
			<article>
              
<div id="header">

<div id="logo">
  <a href="/webl/WubHub_DoIt?cmdline=home"><img src="/static/clogo-white.png" height="30" alt="Collaborama">Collaborama</a>
</div>

<div id="cmdline">
<form name="wubhub" action="/webl/WubHub_DoIt" method="get">
  <input size="65" name="cmdline" title="Enter command">
  <input type="submit" value="Enter" title="Execute command">
</form>
</div>

<div id="navbar">
<ul>
  <li><a href="/webl/WubHub_DoIt?cmdline=site.about">About</a></li>
  <li><a href="/webl/WubHub_DoIt?cmdline=site.help">Help</a></li>
  <li><a href="/webl/WubHub_DoIt?cmdline=site.contact">Contact</a></li>
</ul>

<!-- User: <a href="/webl/WubHub_DoIt?cmdline=acheyer.profile">acheyer</a> [<a href="/webl/WubHub_DoIt?cmdline=site.logout">logout</a>] -->

</div>

</div>

<form action="/webl/WubHub_SaveFunction" method="post">
  
<div id="content">
<!-- <div id="content-header">Source: edit [<a href="/webl/WubHub_DoIt?cmdline=site.edit(edit)">edit</a>]
</div>  -->

<div id="main-text">

      <table width="100%">
        <tbody>
        <tr>
          <td>
	    <select name="module">
               <webl>
var SelectedOption = fun(item, desired)
   if (item == desired) then
       return ` selected="true"`
   else
       return " "
   end
end;

// -------------------------------------------------------------------------
// Returns HTML listing legal module options for a user
// -------------------------------------------------------------------------
export var LegalModuleOptions = fun(module)
   var s = "";
   every m in Wub_WritableModules() do
      s = s + "<option" + SelectedOption(m,module) + ` value="` + m + `">` + m + "</option>\n"
   end;
   return s;
end;
                  LegalModuleOptions(module);
               </webl>
            </select>                        
            <input name="name" value="%name%" size="15" title="Name of the issue"/>
            <input name="arglist" value="%arglist%" type="hidden"/>
            <input name="description" value="%description%" size="65" title="Title of the issue" />
            
            &nbsp;
            <a href="/webl/WubHub_DoIt?cmdline=edit(%module%.%name%.<webl>"%"+"prevVersion%"</webl>)">&lt;&lt;</a> Ver. %version% 
            <a href="/webl/WubHub_DoIt?cmdline=edit(%module%.%name%.<webl>"%"+"nextVersion%"</webl>)">&gt;&gt;</a>
            
          </td><td align="right">
             <input name="version" value="%version%" type="hidden" size="30"/>
             <input name="created" value="%created%" type="hidden" size="30"/>
             <input name="createdby" value="%createdby%" type="hidden" size="30"/>
             <input name="modified" value="%modified%" type="hidden" size="30"/>
             <input name="modifiedby" value="%modifiedby%" type="hidden" size="30"/>
             <input name="oldtags" value="<webl>`%old` + `tags%`</webl>" type="hidden" size="30"/>
             <input name="oldflags" value="<webl>`%old` + `flags%`</webl>" type="hidden" size="30"/>
             <input name="oldspecialtags" value="<webl>`%old` + `specialtags%`</webl>" type="hidden" size="30"/>

             <input type="submit" value="SAVE">
          
          </td>
        </tr>
        <tr>
          <td>&nbsp;
<webl>
if !(ctype member ["alias", "url", "webl", "javascript", "snippet", "html", "text"]) then
   ctype = "snippet";
end;
  
if !(flags member ["issueOpen", "issueInProgress", "issueFixed", "issueWontFix", "issueDuplicate", "issueCannotReproduce", "issueVerified", "issueClosed"]) then
   flags = "issueOpen";
end;
var cattr = fun(b)
   if b then `checked="checked"` else "" end;
end;
var c1 = cattr(flags=="issueOpen");
var c2 = cattr(flags=="issueInProgress");
var c3 = cattr(flags=="issueFixed");
var c4 = cattr(flags=="issueWontFix");
var c5 = cattr(flags=="issueDuplicate");
var c6 = cattr(flags=="issueCannotReproduce");
var c7 = cattr(flags=="issueVerified");
var c8 = cattr(flags=="issueClosed");
`<input type="hidden" name="ctype" value="` + ctype + `" />
<input type="radio" name="flags"  value="issueOpen"`    + c1 + `>Open
<input type="radio" name="flags"  value="issueInProgress"`     + c2 + `>In Progress
<input type="radio" name="flags"  value="issueFixed"`    + c3 + `>Fixed
<input type="radio" name="flags"  value="issueWontFix"`    + c4 + `>Won't Fix
<input type="radio" name="flags"  value="issueDuplicate"` + c5 + `>Duplicate
<input type="radio" name="flags"  value="issueCannotReproduce"`    + c6 + `>Cannot Reproduce
<input type="radio" name="flags"  value="issueVerified"`    + c7 + `>Verified
<input type="radio" name="flags"  value="issueClosed"`    + c8 + `>Closed
`
</webl>
          </td>
          <td align="right"><small>F3-fullscreen</small></td>
        </tr>
        </tbody>
     </table>
  </div>    
  
  <textarea id="exec" name="exec" title="Text, data, or source code">%exec%</textarea>
  
  <script>

    var editor = CodeMirror.fromTextArea(document.getElementById("exec"), {
        lineNumbers: true,
        lineWrapping: true,
        extraKeys: {
        "F3": function(cm) {
          setFullScreen(cm, !isFullScreen(cm));
        },
        "Esc": function(cm) {
          if (isFullScreen(cm)) setFullScreen(cm, false);
        } 
      }
     });

     function setContentMode(val)
     {
        if (val == "webl")
           editor.setOption("mode", "wubhub");
       else if (val == "text")
           editor.setOption("mode", "text/plain");
       else if (val == "javascript")
           editor.setOption("mode", "text/javascript");
       else 
           editor.setOption("mode", "text/html");
     }      
   
    
     function scanRange(cm, from, to) {
        from = from && from.line || 0
        to = to && to.line || cm.lineCount()
        for (var line=from; line<=to; line++) {
           scanLine(cm, line)
        }
     }
    
     function scanLine(cm, lineNumber) {
         var text = cm.getLine(lineNumber);
         if (text != undefined) {
            var PREFIX = 'URL[';
            var SUFFIX = ']';
            var SEPARATOR = "|";
            var start = text.indexOf(PREFIX)
            if (start >= 0) {
                var end = text.indexOf(SUFFIX, start+PREFIX.length)
                var cCol = cm.getCursor().ch;
                var cRow = cm.getCursor().line;
                var cursorInSpan = ((cRow == lineNumber) && (cCol >= start) && (cCol <= end));
                if (end >= 0 && (!cursorInSpan)) {
                    var sep = text.indexOf(SEPARATOR, start+PREFIX.length)
                    var label = "LINK";
                    var href = "";
                    if (sep >= 0) {
                      label = text.substring(start + PREFIX.length, sep).trim();
                      href = text.substring(sep+1, end).trim();
                    } else {
                      href = text.substring(start + PREFIX.length, end).trim();
                    }
                    insertWidget(cm,
                        CodeMirror.Pos(lineNumber, start),
                        CodeMirror.Pos(lineNumber, end + PREFIX.length),
                        label,
                        href
                    );
                }
            }
         }
     }
  
     function makeDom(tag) {
        var element = tag ? document.createElement(tag) : document.createDocumentFragment()
        for (var i=1; i<arguments.length; i++) {
            var arg = arguments[i]
            if (arg) {
                if (typeof arg !== 'object') {
                    arg = document.createTextNode(arg.toString())
                }
                if (arg.nodeType) {
                    element.appendChild(arg)
                } else {
                    Object.keys(arg).forEach(function (key) {
                        element.setAttribute(key, arg[key])
                    })
                }
            }
        }
        return element
     }
  
     function insertWidget(cm, from, to, label, url) {
         var dom = makeDom('span', {class:'link-url'}, label)
 
         cm.markText(from, to, {
             replacedWith: dom,
             clearOnEnter: true
             });
 
         CodeMirror.on(dom, "mousedown", function() {
           var r=confirm("Navigate to " + label + "?");
           if (r==true) {
              window.location.href = url;
           }           
          });
     }
   
    function isFullScreen(cm) {
      return /\bCodeMirror-fullscreen\b/.test(cm.getWrapperElement().className);
    }
    function winHeight() {
      return window.innerHeight || (document.documentElement || document.body).clientHeight;
    }
    function setFullScreen(cm, full) {
      var wrap = cm.getWrapperElement();
      if (full) {
        wrap.className += " CodeMirror-fullscreen";
        wrap.style.height = winHeight() + "px";
        document.documentElement.style.overflow = "hidden";
      } else {
        wrap.className = wrap.className.replace(" CodeMirror-fullscreen", "");
        wrap.style.height = "";
        document.documentElement.style.overflow = "";
      }
      cm.refresh();
    }
    CodeMirror.on(window, "resize", function() {
      var showing = document.body.getElementsByClassName("CodeMirror-fullscreen")[0];
      if (!showing) {
         editor.getWrapperElement().style.height = (winHeight() - 400) + "px";
      } else {
         showing.CodeMirror.getWrapperElement().style.height = winHeight() + "px";
      }
    }); 
  
  // Call it the first time
    editor.getWrapperElement().style.height = (winHeight() - 400) + "px";
 
    editor.on('change', function(cm, changeObj) {
       for (var line=changeObj.from.line; line<=changeObj.to.line; line++) {
           scanLine(cm, line)
       }
    })
    
    editor.on("cursorActivity", function(cm) {
       var cLine = cm.getCursor().line;
       scanLine(cm, cLine);
       scanLine(cm, cLine-1);
       scanLine(cm, cLine+1);
    })
    
    editor.on("gutterClick", function(cm, n) {
      var url = window.location.href;
      if (url.substring(url.length-1) == ")") {
         url = url.substring(0, url.length-1) + ">" + n + ")";
        } else {
         url = url + ">" + n;
      }
      url = "URL[LINK|" + 
               url + "]";
      window.prompt ("Copy to clipboard: Ctrl+C, Enter", url);
    });
 
    scanRange(editor);
    // Go to last line in system
    editor.setCursor(editor.lineCount(), 0);
    // The scroll up to requested line
    editor.scrollIntoView(%scrollToRow%-1, 0);
    
  
</script>
 
  <div id="main-text">
  
     <table>
       <tbody>  
          <input name="render" value="siteutil.renderIssue" type="hidden"/>

        <tr>
          <td>Assigned to:            
          
	    <select name="test">
               <webl>
var SelectedOption = fun(item, desired)
   if (item == desired) then
       return ` selected="true"`
   else
       return " "
   end
end;

export var GroupMembers = fun(module)
   var s = "";
   var members = ToList(Wub_GroupsMembers()[module]) ? nil;
   s = s + "<!--  " + ToString(members) + ToString(module) + " -->\n";
   if members == nil then
      members = [ wubinfo.user ]
   end;     
   every m in ToList(members) do
      s = s + "<option" + SelectedOption(m,module) + ` value="` + m + `">` + m + "</option>\n"
   end;
   return s;
end;
                  GroupMembers(module);
               </webl>
            </select> </td>                     
          
          <td>&nbsp; &nbsp; Tags:</td>
          <td><input name="tags" value="%tags%" size="45" title="Specify a comma-separated list of tags. Tags are user-defined, searchable mechanisms for classifying functions.  May be left blank."/> </td>
          <td>
          <!-- input name="flags" value="%flags%" type="hidden"/ --></td>
        </tr>
        <tr>
          
          <td>
<webl>

var cattr = fun(b)
   if b then `checked="checked"` else "" end;
end;
var c1 = cattr(usecache=="usecache");

`<input type="checkbox" name="usecache" value="usecache" ` + c1 + `type="hidden">
 `;
</webl>  &nbsp; &nbsp;
          </td><td>
            <input name="cacheexpire" value="%cacheexpire%" type="hidden"/> &nbsp; &nbsp;

           </td><td>
            <input name="cacherefreshrate" value="%cacherefreshrate%" type="hidden"/>

          </td><td align="right"> </td>
        </tr>
      </tbody>
    </table>

</div>
</div>
</form>


<div id="footer">
</div>        
			</article>
</div>        

		<script src="http://lab.hakim.se/meny/js/meny.min.js"></script>
		<script>
			// Create an instance of Meny
			var meny = Meny.create({
				// The element that will be animated in from off screen
				menuElement: document.querySelector( '.meny' ),

				// The contents that gets pushed aside while Meny is active
				contentsElement: document.querySelector( '.meny-contents' ),

				// [optional] The alignment of the menu (top/right/bottom/left)
				position: Meny.getQuery().p || 'left',

				// [optional] The height of the menu (when using top/bottom position)
				height: 200,

				// [optional] The width of the menu (when using left/right position)
				width: 260,

				// [optional] Distance from mouse (in pixels) when menu should open
				threshold: 40
			});

			// API Methods:
			// meny.open();
			// meny.close();
			// meny.isOpen();
			
			// Events:
			// meny.addEventListener( 'open', function(){ console.log( 'open' ); } );
			// meny.addEventListener( 'close', function(){ console.log( 'close' ); } );

			// Embed an iframe if a URL is passed in
			if( Meny.getQuery().u && Meny.getQuery().u.match( /^http/gi ) ) {
				var contents = document.querySelector( '.meny-contents' );
				contents.style.padding = '0px';
				contents.innerHTML = '<div class="cover"></div><iframe src="'+ Meny.getQuery().u +'" style="width: 100%; height: 100%; border: 0; position: absolute;"></iframe>';
			}
		</script>

	</body>
</html>