stray closing /TABLE in the no-ticket case
[freeside.git] / httemplate / elements / mac_addr.html
1 % if (!$init) {
2 %   if ($clipboard_hack) {
3 <& init_overlib.html &>
4 <script>
5 <&| /elements/onload.js &>
6   var transform_text = function(str) {
7     var regexp = new RegExp('.*(..):(..):(..):(..):(..):(..).*');
8     return  str.replace(regexp, '$1$2$3$4$5$6');
9   }
10   var span_onclick = function() {
11     var input = document.createElement('INPUT');
12     // IE8 doesn't support textContent
13     var str = this.textContent || this.innerText || '';
14     input.value = transform_text(str);
15     input.style.position = 'absolute';
16     input.style.top = '0px';
17     input.style.left = '0px';
18     input.onblur = function() { input.parentNode.removeChild(input) }
19     this.appendChild(input);
20     input.select();
21   }
22   // set this on any ".mac_addr" object in the doc
23
24   // IE8 doesn't support getElementsByClassName
25   var els = document.getElementsByTagName('span');
26   for (var i = 0; i < els.length; i++) {
27     if (els[i].className = 'mac_addr') {
28       els[i].id = 'span_mac_addr' + i;
29       els[i].onclick = span_onclick;
30     }
31   }
32 </&>
33 </SCRIPT>
34 <style type="text/css">
35 .mac_addr {
36   border-bottom: 1px dotted blue;
37   color: blue;
38   position: relative;
39 }
40 </style>
41 %   } # if $clipboard_hack
42 % $init++;
43 % }
44 %# the only part to be included in every instance
45 <SPAN CLASS="mac_addr"><% $value |h %></SPAN>
46 <%shared>
47 my $init = 0;
48 </%shared>
49 <%init>
50 my $clipboard_hack =
51   $FS::CurrentUser::CurrentUser->option('enable_mask_clipboard_hack');
52 my $value = shift; # no other params
53 </%init>