forked from rpavlik/generate-cpp-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·110 lines (98 loc) · 3.58 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php require_once('common.php') ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>C++ Boilerplate Generator</title>
<script type="text/javascript" src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
<script src="ICanHaz.min.js" type="text/javascript">
</script>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<script id="checkboxsection" type="text/html">
<div id="checkbox_panel">
<input type="checkbox" checked="true">Use spiffy javascript interface</input>
</div>
</script>
<script id="downloadsection" type="text/html">
<div id="download_panel">
<h2>Download Links</h2>
<ul id="download_links"></ul>
<button id="redo">Start Over</button>
</div>
</script>
<script id="downloadlink" type="text/html">
<li><a href="download.php?{{ query_string }}&ext={{ ext }}">Click to download the .{{ ext }} file</a></li>
</script>
<script type="text/javascript">
//<![CDATA[
// when the dom's ready
$(document).ready(function () {
//$("#container").prepend(ich.checkboxsection({}));
var dlsection;
dlsection = ich.downloadsection({});
dlsection.hide();
$('#container').append(dlsection);
$('#redo').click(function() {
$('#download_panel').fadeOut();
$('#formsection').fadeIn();
});
// add a simple click handler for the "submit" button.
$('form').submit(function () {
if ($('input:text').val() === "") {
// Need something there!
$('input:text').after("<em>File base name is required.<\/em>");
$('input:text').focus(function () {
$(this).next().fadeOut();
});
return false;
}
/*
alert($('input:checkbox').val());
if (! $('input:checkbox').val()) {
// do the normal stuff.
return true;
}
*/
var linkdata, linkitem;
linkdata = {
query_string: $(this).serialize()
}
// Empty the output to make way for us.
$('#download_links').empty();
linkdata["ext"] = "cpp";
$('#download_links').append(ich.downloadlink(linkdata));
linkdata["ext"] = "h";
$('#download_links').append(ich.downloadlink(linkdata));
linkdata["ext"] = "ch";
$('#download_links').append(ich.downloadlink(linkdata));
$('#formsection').slideUp();
$('#download_panel').slideDown();
// Don't actually want to submit the normal way now.
return false;
});
});
//]]>
</script>
</head>
<body>
<h1><img src="favicon_48.png" style="float:right;"/>C++ Boilerplate Generator</h1>
<div id="container">
<div id="formsection">
<h2>Input Data</h2>
<form action="family.php" method="get">
<p>
<label for="filebase">Base of filename (no extension):</label><br/>
<input type="text" name="filebase" />
</p>
<p>
<label for="authorlines">Your author information:</label><br/>
<textarea name="authorlines" rows="6" cols="60"><?php print(htmlspecialchars($defaults['author'])); ?></textarea>
</p><input type="submit" />
</form>
</div>
</div>
<p>Get the source code to this app and make it better: <a href="https://github.com/rpavlik/generate-cpp-boilerplate">generate-cpp-boilerplate on GitHub</a></p>
</body>
</html>