Changeset 508925
- Timestamp:
- 02/22/2012 05:01:46 PM (14 years ago)
- Location:
- jazzy-forms/trunk
- Files:
-
- 13 added
- 16 edited
-
3rdparty/mustache.js (modified) (17 diffs)
-
back/ctrl-forms.php (modified) (1 diff)
-
back/elements.js (modified) (4 diffs)
-
back/gui.css (modified) (8 diffs)
-
back/gui.js (modified) (10 diffs)
-
back/id.js (modified) (1 diff)
-
back/img (added)
-
back/img/c.png (added)
-
back/img/d.png (added)
-
back/img/del.png (added)
-
back/img/del_hi.png (added)
-
back/img/f.png (added)
-
back/img/h.png (added)
-
back/img/m.png (added)
-
back/img/n.png (added)
-
back/img/r.png (added)
-
back/img/t.png (added)
-
back/img/u.png (added)
-
back/tpl-forms.php (modified) (6 diffs)
-
core/Parser.php (modified) (3 diffs)
-
front/ctrl-shortcode.php (modified) (3 diffs)
-
front/jazzy-forms.js (modified) (2 diffs)
-
front/themes/1.css (modified) (2 diffs)
-
front/tmpl-list.php (modified) (5 diffs)
-
generated/Basic_Model.php (modified) (8 diffs)
-
generated/schema.sql (modified) (1 diff)
-
generated/update.sql (added)
-
jazzy-forms.php (modified) (5 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jazzy-forms/trunk/3rdparty/mustache.js
r491567 r508925 5 5 */ 6 6 7 var Mustache = function() { 8 var Renderer = function() {}; 7 var Mustache = function () { 8 var _toString = Object.prototype.toString; 9 10 Array.isArray = Array.isArray || function (obj) { 11 return _toString.call(obj) == "[object Array]"; 12 } 13 14 var _trim = String.prototype.trim, trim; 15 16 if (_trim) { 17 trim = function (text) { 18 return text == null ? "" : _trim.call(text); 19 } 20 } else { 21 var trimLeft, trimRight; 22 23 // IE doesn't match non-breaking spaces with \s. 24 if ((/\S/).test("\xA0")) { 25 trimLeft = /^[\s\xA0]+/; 26 trimRight = /[\s\xA0]+$/; 27 } else { 28 trimLeft = /^\s+/; 29 trimRight = /\s+$/; 30 } 31 32 trim = function (text) { 33 return text == null ? "" : 34 text.toString().replace(trimLeft, "").replace(trimRight, ""); 35 } 36 } 37 38 var escapeMap = { 39 "&": "&", 40 "<": "<", 41 ">": ">", 42 '"': '"', 43 "'": ''' 44 }; 45 46 function escapeHTML(string) { 47 return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) { 48 return escapeMap[s] || s; 49 }); 50 } 51 52 var regexCache = {}; 53 var Renderer = function () {}; 9 54 10 55 Renderer.prototype = { … … 18 63 context: {}, 19 64 20 render: function (template, context, partials, in_recursion) {65 render: function (template, context, partials, in_recursion) { 21 66 // reset buffer & set context 22 if (!in_recursion) {67 if (!in_recursion) { 23 68 this.context = context; 24 69 this.buffer = []; // TODO: make this non-lazy … … 26 71 27 72 // fail fast 28 if (!this.includes("", template)) {29 if (in_recursion) {73 if (!this.includes("", template)) { 74 if (in_recursion) { 30 75 return template; 31 76 } else { … … 35 80 } 36 81 82 // get the pragmas together 37 83 template = this.render_pragmas(template); 84 85 // render the template 38 86 var html = this.render_section(template, context, partials); 39 if(in_recursion) { 40 return this.render_tags(html, context, partials, in_recursion); 41 } 42 43 this.render_tags(html, context, partials, in_recursion); 87 88 // render_section did not find any sections, we still need to render the tags 89 if (html === false) { 90 html = this.render_tags(template, context, partials, in_recursion); 91 } 92 93 if (in_recursion) { 94 return html; 95 } else { 96 this.sendLines(html); 97 } 44 98 }, 45 99 … … 47 101 Sends parsed lines 48 102 */ 49 send: function (line) {50 if (line != "") {103 send: function (line) { 104 if (line !== "") { 51 105 this.buffer.push(line); 52 106 } 53 107 }, 54 108 109 sendLines: function (text) { 110 if (text) { 111 var lines = text.split("\n"); 112 for (var i = 0; i < lines.length; i++) { 113 this.send(lines[i]); 114 } 115 } 116 }, 117 55 118 /* 56 119 Looks for %PRAGMAS 57 120 */ 58 render_pragmas: function (template) {121 render_pragmas: function (template) { 59 122 // no pragmas 60 if (!this.includes("%", template)) {123 if (!this.includes("%", template)) { 61 124 return template; 62 125 } 63 126 64 127 var that = this; 65 var regex = new RegExp(this.otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" + 66 this.ctag); 67 return template.replace(regex, function(match, pragma, options) { 68 if(!that.pragmas_implemented[pragma]) { 69 throw({message: 128 var regex = this.getCachedRegex("render_pragmas", function (otag, ctag) { 129 return new RegExp(otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" + ctag, "g"); 130 }); 131 132 return template.replace(regex, function (match, pragma, options) { 133 if (!that.pragmas_implemented[pragma]) { 134 throw({message: 70 135 "This implementation of mustache doesn't understand the '" + 71 136 pragma + "' pragma"}); 72 137 } 73 138 that.pragmas[pragma] = {}; 74 if (options) {139 if (options) { 75 140 var opts = options.split("="); 76 141 that.pragmas[pragma][opts[0]] = opts[1]; … … 84 149 Tries to find a partial in the curent scope and render it 85 150 */ 86 render_partial: function (name, context, partials) {87 name = t his.trim(name);88 if (!partials || partials[name] === undefined) {151 render_partial: function (name, context, partials) { 152 name = trim(name); 153 if (!partials || partials[name] === undefined) { 89 154 throw({message: "unknown_partial '" + name + "'"}); 90 155 } 91 if (typeof(context[name])!= "object") {156 if (!context || typeof context[name] != "object") { 92 157 return this.render(partials[name], context, partials, true); 93 158 } … … 98 163 Renders inverted (^) and normal (#) sections 99 164 */ 100 render_section: function(template, context, partials) { 101 if(!this.includes("#", template) && !this.includes("^", template)) { 102 return template; 165 render_section: function (template, context, partials) { 166 if (!this.includes("#", template) && !this.includes("^", template)) { 167 // did not render anything, there were no sections 168 return false; 103 169 } 104 170 105 171 var that = this; 106 // CSW - Added "+?" so it finds the tighest bound, not the widest 107 var regex = new RegExp(this.otag + "(\\^|\\#)\\s*(.+)\\s*" + this.ctag + 108 "\n*([\\s\\S]+?)" + this.otag + "\\/\\s*\\2\\s*" + this.ctag + 109 "\\s*", "mg"); 172 173 var regex = this.getCachedRegex("render_section", function (otag, ctag) { 174 // This regex matches _the first_ section ({{#foo}}{{/foo}}), and captures the remainder 175 return new RegExp( 176 "^([\\s\\S]*?)" + // all the crap at the beginning that is not {{*}} ($1) 177 178 otag + // {{ 179 "(\\^|\\#)\\s*(.+)\\s*" + // #foo (# == $2, foo == $3) 180 ctag + // }} 181 182 "\n*([\\s\\S]*?)" + // between the tag ($2). leading newlines are dropped 183 184 otag + // {{ 185 "\\/\\s*\\3\\s*" + // /foo (backreference to the opening tag). 186 ctag + // }} 187 188 "\\s*([\\s\\S]*)$", // everything else in the string ($4). leading whitespace is dropped. 189 190 "g"); 191 }); 192 110 193 111 194 // for each {{#foo}}{{/foo}} section do... 112 return template.replace(regex, function(match, type, name, content) { 113 var value = that.find(name, context); 114 if(type == "^") { // inverted section 115 if(!value || that.is_array(value) && value.length === 0) { 195 return template.replace(regex, function (match, before, type, name, content, after) { 196 // before contains only tags, no sections 197 var renderedBefore = before ? that.render_tags(before, context, partials, true) : "", 198 199 // after may contain both sections and tags, so use full rendering function 200 renderedAfter = after ? that.render(after, context, partials, true) : "", 201 202 // will be computed below 203 renderedContent, 204 205 value = that.find(name, context); 206 207 if (type === "^") { // inverted section 208 if (!value || Array.isArray(value) && value.length === 0) { 116 209 // false or empty list, render it 117 re turnthat.render(content, context, partials, true);210 renderedContent = that.render(content, context, partials, true); 118 211 } else { 119 re turn"";212 renderedContent = ""; 120 213 } 121 } else if(type == "#") { // normal section 122 if(that.is_array(value)) { // Enumerable, Let's loop! 123 return that.map(value, function(row) { 124 return that.render(content, that.create_context(row), 125 partials, true); 214 } else if (type === "#") { // normal section 215 if (Array.isArray(value)) { // Enumerable, Let's loop! 216 renderedContent = that.map(value, function (row) { 217 return that.render(content, that.create_context(row), partials, true); 126 218 }).join(""); 127 } else if (that.is_object(value)) { // Object, Use it as subcontext!128 re turnthat.render(content, that.create_context(value),219 } else if (that.is_object(value)) { // Object, Use it as subcontext! 220 renderedContent = that.render(content, that.create_context(value), 129 221 partials, true); 130 } else if (typeof value === "function") {222 } else if (typeof value == "function") { 131 223 // higher order section 132 re turn value.call(context, content, function(text) {224 renderedContent = value.call(context, content, function (text) { 133 225 return that.render(text, context, partials, true); 134 226 }); 135 } else if (value) { // boolean section136 re turnthat.render(content, context, partials, true);227 } else if (value) { // boolean section 228 renderedContent = that.render(content, context, partials, true); 137 229 } else { 138 re turn"";230 renderedContent = ""; 139 231 } 140 232 } 233 234 return renderedBefore + renderedContent + renderedAfter; 141 235 }); 142 236 }, … … 145 239 Replace {{foo}} and friends with values from our view 146 240 */ 147 render_tags: function (template, context, partials, in_recursion) {241 render_tags: function (template, context, partials, in_recursion) { 148 242 // tit for tat 149 243 var that = this; 150 244 151 var new_regex = function() { 152 return new RegExp(that.otag + "(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?" + 153 that.ctag + "+", "g"); 245 var new_regex = function () { 246 return that.getCachedRegex("render_tags", function (otag, ctag) { 247 return new RegExp(otag + "(=|!|>|&|\\{|%)?([^#\\^]+?)\\1?" + ctag + "+", "g"); 248 }); 154 249 }; 155 250 156 251 var regex = new_regex(); 157 var tag_replace_callback = function (match, operator, name) {252 var tag_replace_callback = function (match, operator, name) { 158 253 switch(operator) { 159 254 case "!": // ignore comments … … 166 261 return that.render_partial(name, context, partials); 167 262 case "{": // the triple mustache is unescaped 263 case "&": // & operator is an alternative unescape method 168 264 return that.find(name, context); 169 265 default: // escape the value 170 return that.escape(that.find(name, context));266 return escapeHTML(that.find(name, context)); 171 267 } 172 268 }; … … 174 270 for(var i = 0; i < lines.length; i++) { 175 271 lines[i] = lines[i].replace(regex, tag_replace_callback, this); 176 if (!in_recursion) {272 if (!in_recursion) { 177 273 this.send(lines[i]); 178 274 } 179 275 } 180 276 181 if (in_recursion) {277 if (in_recursion) { 182 278 return lines.join("\n"); 183 279 } 184 280 }, 185 281 186 set_delimiters: function (delimiters) {282 set_delimiters: function (delimiters) { 187 283 var dels = delimiters.split(" "); 188 284 this.otag = this.escape_regex(dels[0]); … … 190 286 }, 191 287 192 escape_regex: function (text) {288 escape_regex: function (text) { 193 289 // thank you Simon Willison 194 if (!arguments.callee.sRE) {290 if (!arguments.callee.sRE) { 195 291 var specials = [ 196 292 '/', '.', '*', '+', '?', '|', … … 208 304 from the view object 209 305 */ 210 find: function (name, context) {211 name = t his.trim(name);306 find: function (name, context) { 307 name = trim(name); 212 308 213 309 // Checks whether a value is thruthy or false or 0 … … 217 313 218 314 var value; 219 if(is_kinda_truthy(context[name])) { 220 value = context[name]; 221 } else if(is_kinda_truthy(this.context[name])) { 222 value = this.context[name]; 223 } 224 225 if(typeof value === "function") { 315 316 // check for dot notation eg. foo.bar 317 if (name.match(/([a-z_]+)\./ig)) { 318 var childValue = this.walk_context(name, context); 319 if (is_kinda_truthy(childValue)) { 320 value = childValue; 321 } 322 } else { 323 if (is_kinda_truthy(context[name])) { 324 value = context[name]; 325 } else if (is_kinda_truthy(this.context[name])) { 326 value = this.context[name]; 327 } 328 } 329 330 if (typeof value == "function") { 226 331 return value.apply(context); 227 332 } 228 if (value !== undefined) {333 if (value !== undefined) { 229 334 return value; 230 335 } … … 233 338 }, 234 339 340 walk_context: function (name, context) { 341 var path = name.split('.'); 342 // if the var doesn't exist in current context, check the top level context 343 var value_context = (context[path[0]] != undefined) ? context : this.context; 344 var value = value_context[path.shift()]; 345 while (value != undefined && path.length > 0) { 346 value_context = value; 347 value = value[path.shift()]; 348 } 349 // if the value is a function, call it, binding the correct context 350 if (typeof value == "function") { 351 return value.apply(value_context); 352 } 353 return value; 354 }, 355 235 356 // Utility methods 236 357 237 358 /* includes tag */ 238 includes: function (needle, haystack) {359 includes: function (needle, haystack) { 239 360 return haystack.indexOf(this.otag + needle) != -1; 240 361 }, 241 362 242 /*243 Does away with nasty characters244 */245 escape: function(s) {246 s = String(s === null ? "" : s);247 return s.replace(/&(?!\w+;)|["<>\\]/g, function(s) {248 switch(s) {249 case "&": return "&";250 case "\\": return "\\\\";251 case '"': return '\"';252 case "<": return "<";253 case ">": return ">";254 default: return s;255 }256 });257 },258 259 363 // by @langalex, support for arrays of strings 260 create_context: function (_context) {261 if (this.is_object(_context)) {364 create_context: function (_context) { 365 if (this.is_object(_context)) { 262 366 return _context; 263 367 } else { 264 368 var iterator = "."; 265 if (this.pragmas["IMPLICIT-ITERATOR"]) {369 if (this.pragmas["IMPLICIT-ITERATOR"]) { 266 370 iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator; 267 371 } … … 272 376 }, 273 377 274 is_object: function (a) {378 is_object: function (a) { 275 379 return a && typeof a == "object"; 276 380 }, 277 381 278 is_array: function(a) {279 return Object.prototype.toString.call(a) === '[object Array]';280 },281 282 /*283 Gets rid of leading and trailing whitespace284 */285 trim: function(s) {286 return s.replace(/^\s*|\s*$/g, "");287 },288 289 382 /* 290 383 Why, why, why? Because IE. Cry, cry cry. 291 384 */ 292 map: function (array, fn) {385 map: function (array, fn) { 293 386 if (typeof array.map == "function") { 294 387 return array.map(fn); … … 301 394 return r; 302 395 } 396 }, 397 398 getCachedRegex: function (name, generator) { 399 var byOtag = regexCache[this.otag]; 400 if (!byOtag) { 401 byOtag = regexCache[this.otag] = {}; 402 } 403 404 var byCtag = byOtag[this.ctag]; 405 if (!byCtag) { 406 byCtag = byOtag[this.ctag] = {}; 407 } 408 409 var regex = byCtag[name]; 410 if (!regex) { 411 regex = byCtag[name] = generator(this.otag, this.ctag); 412 } 413 414 return regex; 303 415 } 304 416 }; … … 306 418 return({ 307 419 name: "mustache.js", 308 version: "0. 3.0",420 version: "0.4.0", 309 421 310 422 /* 311 423 Turns a template and view into HTML 312 424 */ 313 to_html: function (template, view, partials, send_fun) {425 to_html: function (template, view, partials, send_fun) { 314 426 var renderer = new Renderer(); 315 if (send_fun) {427 if (send_fun) { 316 428 renderer.send = send_fun; 317 429 } 318 renderer.render(template, view , partials);319 if (!send_fun) {430 renderer.render(template, view || {}, partials); 431 if (!send_fun) { 320 432 return renderer.buffer.join("\n"); 321 433 } -
jazzy-forms/trunk/back/ctrl-forms.php
r491567 r508925 11 11 $json = stripcslashes($_POST['form']); 12 12 $form = json_decode($json); 13 if( jzzf_set_form($form)) {13 if($current = jzzf_set_form($form)) { 14 14 $msg = "Form Saved."; 15 15 } else { -
jazzy-forms/trunk/back/elements.js
r502411 r508925 16 16 placeholder.replaceWith(li); 17 17 } else { 18 $('#jzzf_elements_list').append(html);19 li = $('#jzzf_elements_list li:last-child');18 li = $(html); 19 $('#jzzf_elements_list').append(li); 20 20 } 21 21 if(collapsed === undefined || collapsed) { … … 28 28 var counter = this.counter(); 29 29 data.counter = counter; 30 data.typeString = $('#jzzf_elements_toolbox_items li[jzzf_type="' + data.type + '"]').text(); 30 data.display_title = this.display_title(data.title); 31 data.typeString = $('.jzzf_elements_toolbox_items li[jzzf_type="' + data.type + '"]').text(); 31 32 if(data.options) { 32 33 $.each(data.options, function(idx) { … … 74 75 return false; 75 76 }); 77 element.find('.jzzf_element_title').change(function() { 78 element.find('.jzzf_header_title').text(self.display_title($(this).val())); 79 }); 76 80 element.find('.jzzf_option_table tbody').sortable(); 77 81 this.bind_options(); … … 115 119 } 116 120 121 this.display_title = function(title) { 122 if(title.length >= 50) { 123 return title.substring(0, 47) + '...'; 124 } else { 125 return title; 126 } 127 } 128 117 129 this.options_data = function(li) { 118 130 var options = []; -
jazzy-forms/trunk/back/gui.css
r502411 r508925 28 28 margin: 0 4px 0 0px; 29 29 border: 1px solid #ddd; 30 border-top-left-radius: 3px; 31 border-top-right-radius: 3px; 30 32 height: 13px; 31 33 z-index: 10; 32 34 background-color: #eee; 35 cursor: pointer; 33 36 } 34 37 … … 44 47 padding: 20px; 45 48 border: 1px solid #ddd; 46 } 47 48 #jzzf_elements_toolbox { 49 border-radius: 3px; 50 } 51 52 .jzzf_elements_toolbox { 49 53 display: block; 50 54 overflow: visible; 51 width: 200px;55 width: 350px; 52 56 float: left; 53 57 clear: both; 54 58 } 55 59 56 #jzzf_elements_toolbox_items items { 57 padding: 10px; 58 } 59 60 #jzzf_elements_toolbox_items li { 60 .jzzf_elements_toolbox_items { 61 display: block; 62 padding: 10px 10px 4px 10px; 63 overflow: hidden; 64 background: #eee; 65 border-radius: 3px; 66 width: 148px; 67 float: left; 68 } 69 70 #jzzf_toolbox_input { 71 margin-right: 10px; 72 } 73 74 #jzzf_toolbox_buttons { 75 margin-bottom: 10px; 76 } 77 78 .jzzf_elements_toolbox_items li { 61 79 background: #ddd; 62 80 border: 1px solid #ccc; 81 border-radius: 3px; 63 82 padding: 8px; 64 height: 20px; 65 width: 100px; 83 height: 14px; 84 width: 130px; 85 cursor: move; 86 } 87 88 .jzzf_elements_toolbox_items li:hover { 89 background-color: #e8e8e8; 66 90 } 67 91 … … 84 108 overflow: hidden; 85 109 background: #eee; 110 border-radius: 3px; 86 111 } 87 112 … … 89 114 margin: 5px; 90 115 border: 1px solid #ccc; 116 border-radius: 3px; 91 117 } 92 118 … … 95 121 border-bottom: 1px solid #ddd; 96 122 padding: 8px; 97 height: 20px; 123 height: 14px; 124 cursor: move; 125 } 126 127 .jzzf_element.jzzf_collapsed .jzzf_element_header { 128 border-bottom: none; 129 } 130 131 .jzzf_element_header:hover { 132 background-color: #e8e8e8; 98 133 } 99 134 100 135 .jzzf_element_header .jzzf_element_delete { 136 width: 16px; 137 height: 16px; 138 background: url('img/del.png') no-repeat center; 101 139 float: right; 140 } 141 142 .jzzf_element_header .jzzf_element_delete:hover { 143 background: url('img/del_hi.png') no-repeat center; 102 144 } 103 145 … … 105 147 background: #fff; 106 148 padding: 8px 12px; 149 border-bottom-left-radius: 3px; 150 border-bottom-right-radius: 3px; 151 } 152 153 .jzzf_element_body li { 154 margin-bottom: 2px; 107 155 } 108 156 … … 113 161 } 114 162 163 .jzzf_section .jzzf_checkbox_label { 164 width: 400px; 165 } 166 115 167 .jzzf_section > ul > li > input[type=checkbox] { 116 168 margin-right: 12px; … … 146 198 margin-right: 12px; 147 199 } 200 201 .jzzf_type { 202 width: 16px; 203 height: 16px; 204 float: left; 205 padding-right: 10px; 206 background: url('img/u.png') no-repeat center; 207 } 208 209 .jzzf_type_n { background-image: url('img/n.png'); } 210 .jzzf_type_c { background-image: url('img/c.png'); } 211 .jzzf_type_r { background-image: url('img/r.png'); } 212 .jzzf_type_d { background-image: url('img/d.png'); } 213 .jzzf_type_u { background-image: url('img/u.png'); } 214 .jzzf_type_f { background-image: url('img/f.png'); } 215 .jzzf_type_t { background-image: url('img/t.png'); } 216 .jzzf_type_h { background-image: url('img/h.png'); } 217 .jzzf_type_m { background-image: url('img/m.png'); } -
jazzy-forms/trunk/back/gui.js
r491567 r508925 1 1 (function($) { 2 2 var form = null; 3 var form_index = 0; 4 var dirty = false; 5 var text_unload = "The current form has unsaved changes."; 6 var text_dirty = text_unload + "\nAre you sure you want to discard them?"; 3 7 4 8 function new_element(type) { … … 28 32 } 29 33 30 function bind() { 31 $('#jzzf_elements_toolbox_items li').click(function() { 34 function warn_unload() { 35 return dirty ? text_unload : null; 36 } 37 38 function warn_dirty() { 39 if(dirty) { 40 return confirm(text_dirty); 41 } else { 42 return true; 43 } 44 } 45 46 function mark_dirty() { 47 if(!dirty) { 48 dirty = true; 49 window.onbeforeunload = warn_unload; 50 } 51 return true; 52 } 53 54 function mark_clean() { 55 if(dirty) { 56 dirty = false; 57 window.onbeforeunload = null; 58 } 59 return true; 60 } 61 62 function bind() { 63 $('#jzzf_main').delegate('input', 'change', mark_dirty); 64 65 $('.jzzf_elements_toolbox_items li').click(function() { 32 66 add_element($(this), false); 33 67 return false; … … 39 73 } 40 74 }); 41 $(' #jzzf_elements_toolbox_items li').draggable({75 $('.jzzf_elements_toolbox_items li').draggable({ 42 76 connectToSortable: "#jzzf_elements_list", 43 77 helper: "clone", 44 revert: "invalid" 78 revert: "invalid", 79 cursor: "move" 45 80 }); 46 81 … … 51 86 52 87 $('#jzzf_selector').change(function() { 53 set_current_form($('#jzzf_selector').val()); 54 }); 55 56 $('#jzzf_form *').delegate('*', 'click change sortupdate', function(event) { 88 if(warn_dirty()) { 89 set_current_form($('#jzzf_selector').val()); 90 return true; 91 } else { 92 reset_current_form(); 93 return false; 94 } 95 }); 96 97 $('#jzzf_form *, #jzzf_selection *').delegate('*', 'click change sortupdate', function(event) { 57 98 $('#message').hide(); 58 99 }); … … 83 124 $('#jzzf_name').val(form.name); 84 125 $('#jzzf_elements_list').html(''); 126 if(form.realtime == 1) { 127 $('#jzzf_realtime').attr('checked', 'checked'); 128 } else { 129 $('#jzzf_realtime').removeAttr('checked'); 130 } 85 131 for(var i=0; i<form.elements.length; i++) { 86 132 var element = jzzf_element.create(form.elements[i].type) … … 108 154 "name": $('#jzzf_name').val(), 109 155 "theme": $('#jzzf_default_css').is(':checked'), 156 "realtime": $('#jzzf_realtime').is(':checked'), 110 157 "css": $('#jzzf_css').val(), 111 158 "elements": get_elements() … … 114 161 115 162 function save() { 163 window.onbeforeunload = null; 116 164 var form = get_form(); 117 165 var serialized = JSON.stringify(form); … … 124 172 var id_helper = new jzzf_id(jzzf_forms); 125 173 var name = id_helper.suggest_name(title); 126 form = {'title': title, 'name': name, 'elements': [], 'theme': 1 };174 form = {'title': title, 'name': name, 'elements': [], 'theme': 1, 'realtime': true}; 127 175 elements = []; 128 176 $('#jzzf_form').show(); … … 133 181 } 134 182 183 function reset_current_form() { 184 $('#jzzf_selector option:eq(' + form_index + ')').attr('selected', 'selected'); 185 } 186 135 187 function set_current_form(idx) { 188 mark_clean(); 136 189 form = jzzf_forms[idx]; 190 form_index = idx; 137 191 set_form(form); 138 192 } … … 145 199 146 200 function new_form() { 147 form = null; 148 set_form(form); 201 $('#message').hide(); 202 if(warn_dirty()) { 203 form = null; 204 set_form(form); 205 } 149 206 } 150 207 151 208 $(function() { 209 form_index = $('#jzzf_selector option:selected').index(); 152 210 if(jzzf_forms.length == 0) { 153 211 new_form(); 154 212 } else { 155 set_current_form( 0);213 set_current_form(form_index); 156 214 } 157 215 bind(); -
jazzy-forms/trunk/back/id.js
r491567 r508925 15 15 var idx = 1; 16 16 while(this.column_occupied(name, 'name')) { 17 name = base + ' -' + idx;17 name = base + '_' + idx; 18 18 idx++; 19 19 } -
jazzy-forms/trunk/back/tpl-forms.php
r495032 r508925 1 <script id="jzzf_tmpl_common " type="text/html">1 <script id="jzzf_tmpl_common_raw" type="text/html"> 2 2 <li class="jzzf_element"> 3 3 <input type="hidden" value="{{id}}" class="jzzf_element_id"> 4 4 <input type="hidden" value="{{counter}}" class="jzzf_element_counter"> 5 <input type="hidden" class="jzzf_element_type" value="{{type}}"> 5 6 <div class="jzzf_element_header"> 6 < span class="jzzf_type jzzf_type_{{type}}">[{{typeString}}]</span>7 <span class="jzzf_header_title">{{ title}}</span>8 <a href="#" class="jzzf_element_delete" >(x)</a>7 <div class="jzzf_type jzzf_type_{{type}}"></div> 8 <span class="jzzf_header_title">{{display_title}}</span> 9 <a href="#" class="jzzf_element_delete" title="Delete Element"></a> 9 10 </div> 10 11 <div class="jzzf_element_body"> 12 </script> 13 <script id="jzzf_tmpl_common" type="text/html"> 14 {{>common_raw}} 11 15 <fieldset> 12 16 <ul class="jzzf_element_parameters"> 13 17 <li> 14 <input type="hidden" class="jzzf_element_type" value="{{type}}">15 18 <label for="jzzf_element_{{counter}}_title">Title</label> 16 19 <input type="text" id="jzzf_element_{{counter}}_title" class="jzzf_element_title" value="{{title}}"> … … 78 81 {{>common}} 79 82 <fieldset> 80 <legend>Formula</legend> 81 <label for="jzzf_element_{{counter}}_formula">Formula</label> 82 <input type="text" id="jzzf_element_{{counter}}_formula" class="jzzf_element_formula" value="{{formula}}"> 83 <ul> 84 <li> 85 <legend>Formula</legend> 86 <label for="jzzf_element_{{counter}}_formula">Formula</label> 87 <input type="text" id="jzzf_element_{{counter}}_formula" class="jzzf_element_formula" value="{{formula}}"> 88 </li> 89 </ul> 83 90 </fieldset> 84 91 {{>foot}} … … 88 95 {{>foot}} 89 96 </script> 97 <script id="jzzf_tmpl_t" type="text/html"> 98 {{>common_raw}} 99 <fieldset> 100 <ul> 101 <li> 102 <label for="jzzf_element_{{counter}}_title">Text</label> 103 <input type="text" id="jzzf_element_{{counter}}_title" class="jzzf_element_title" value="{{title}}"> 104 </li> 105 </ul> 106 </fieldset> 107 {{>foot}} 108 </script> 109 <script id="jzzf_tmpl_h" type="text/html"> 110 {{>common_raw}} 111 <fieldset> 112 <ul> 113 <li> 114 <label for="jzzf_element_{{counter}}_title">Heading</label> 115 <input type="text" id="jzzf_element_{{counter}}_title" class="jzzf_element_title" value="{{title}}"> 116 </li> 117 </ul> 118 </fieldset> 119 {{>foot}} 120 </script> 121 <script id="jzzf_tmpl_m" type="text/html"> 122 {{>common_raw}} 123 <fieldset> 124 <ul> 125 <li> 126 <label for="jzzf_element_{{counter}}_title">HTML code</label> 127 <input type="text" id="jzzf_element_{{counter}}_title" class="jzzf_element_title" value="{{title}}"> 128 </li> 129 </ul> 130 </fieldset> 131 {{>foot}} 132 </script> 133 90 134 <script id="jzzf_tmpl_options" type="text/html"> 91 135 <fieldset> … … 126 170 <select id="jzzf_selector"> 127 171 <?php $i=0; foreach($forms as $form) : ?> 128 <option value="<?php echo $i++ ?>" ><?php echo esc_attr($form->title) ?></option>172 <option value="<?php echo $i++ ?>"<?php if($form->id == $current) :?> selected="selected"<?php endif ?>><?php echo esc_attr($form->title) ?></option> 129 173 <?php endforeach; ?> 130 174 </select> … … 147 191 <div id="jzzf_main"> 148 192 <div class="jzzf_section" id="jzzf_section_elements"> 149 <div id="jzzf_elements_toolbox">193 <div class="jzzf_elements_toolbox"> 150 194 <div class="jzzf_column_heading" id="jzzf_elements_toolbox_description">Available form elements</div> 151 <ul id="jzzf_elements_toolbox_items"> 152 <li jzzf_type="n">Number Entry</li> 153 <li jzzf_type="d">Drop-down Menu</li> 154 <li jzzf_type="r">Radio Buttons</li> 155 <li jzzf_type="c">Checkbox</li> 156 <li jzzf_type="f">Output</li> 157 <li jzzf_type="u">Update Button</li> 195 <ul id="jzzf_toolbox_input" class="jzzf_elements_toolbox_items"> 196 <li jzzf_type="n"><div class="jzzf_type jzzf_type_n"></div>Number Entry</li> 197 <li jzzf_type="d"><div class="jzzf_type jzzf_type_d"></div>Drop-down Menu</li> 198 <li jzzf_type="r"><div class="jzzf_type jzzf_type_r"></div>Radio Buttons</li> 199 <li jzzf_type="c"><div class="jzzf_type jzzf_type_c"></div>Checkbox</li> 200 <li jzzf_type="f"><div class="jzzf_type jzzf_type_f"></div>Output</li> 201 </ul> 202 <ul id="jzzf_toolbox_buttons" class="jzzf_elements_toolbox_items"> 203 <li jzzf_type="u"><div class="jzzf_type jzzf_type_u"></div>Update Button</li> 204 </ul> 205 <ul id="jzzf_toolbox_text" class="jzzf_elements_toolbox_items"> 206 <li jzzf_type="t"><div class="jzzf_type jzzf_type_t"></div>Text</li> 207 <li jzzf_type="h"><div class="jzzf_type jzzf_type_h"></div>Heading</li> 208 <li jzzf_type="m"><div class="jzzf_type jzzf_type_m"></div>Free HTML</li> 158 209 </ul> 159 210 </div> … … 194 245 </p> 195 246 </li> 196 247 <li> 248 <input type="checkbox" id="jzzf_realtime"> 249 <label for="jzzf_realtime" class="jzzf_checkbox_label">Update output elements instantly</label> 250 </li> 197 251 </ul> 198 252 </div> -
jazzy-forms/trunk/core/Parser.php
r502411 r508925 4 4 try { 5 5 $tokens = jzzf_tokenize($notation); 6 return jzzf_parse_tokens($tokens); 6 7 } catch( Exception $e ) { 7 8 return null; 8 } 9 return jzzf_parse_tokens($tokens); 9 } 10 10 } 11 11 12 12 function jzzf_parse_tokens($in) { 13 $tokenizer = new Jzzf_Parser($in); 14 return $tokenizer->output(); 13 try { 14 $tokenizer = new Jzzf_Parser($in); 15 return $tokenizer->output(); 16 } catch( Exception $e ) { 17 return null; 18 } 15 19 } 16 20 … … 103 107 $result = array_merge($result, $next); 104 108 $num++; 109 } else { 110 throw new Exception("Closing bracket or comma expected"); 105 111 } 106 112 } … … 165 171 return $this->association(); 166 172 } 167 return array();173 return null; 168 174 } 169 175 } -
jazzy-forms/trunk/front/ctrl-shortcode.php
r499961 r508925 27 27 } 28 28 $graph = jzzf_get_graph($form->elements); 29 $tpl->graph( $form, $graph);29 $tpl->graph(jzzf_form_params($form), $graph); 30 30 $tpl->script($form); 31 31 $tpl->head($form); 32 foreach($form->elements as $element) { 33 $tpl->before($element); 32 for($idx=0; $idx<count($form->elements); $idx++) { 33 $element = $form->elements[$idx]; 34 if($idx < count($form->elements)-1) { 35 $ahead = $form->elements[$idx+1]; 36 } else { 37 $ahead = null; 38 } 39 $tpl->before($element, $ahead); 40 34 41 switch($element->type) { 35 42 case 'n': … … 54 61 $tpl->update($element); 55 62 break; 63 case 'h': 64 $tpl->heading($element); 65 break; 66 case 't': 67 $tpl->text($element); 68 break; 69 case 'm': 70 $tpl->html($element); 71 break; 56 72 } 57 73 $tpl->after($element); … … 61 77 return $output; 62 78 } 79 80 function jzzf_form_params($form) { 81 $params = clone $form; 82 unset($params->elements); 83 unset($params->css); 84 return $params; 85 86 } -
jazzy-forms/trunk/front/jazzy-forms.js
r502411 r508925 1 function jazzy_forms($, form_id, jzzf_data, jzzf_types, jzzf_dependencies, jzzf_formulas ) {1 function jazzy_forms($, form_id, jzzf_data, jzzf_types, jzzf_dependencies, jzzf_formulas, jzzf_params) { 2 2 3 3 jzzf_precision = Math.pow(10,9); … … 24 24 for(id in jzzf_types) { 25 25 update(id); 26 switch(jzzf_types[id]) { 27 case 'r': 28 element(id).find('input:radio').bind('change ready', function() { 29 update(element_id($(this).parents('.jzzf_radio'))); 30 }); 31 break; 32 default: 33 element(id).bind('change ready', function() { 34 update(element_id($(this))); 35 }); 36 37 } 38 } 39 } 40 26 if(jzzf_params.realtime) { 27 bind_realtime_update(id); 28 } 29 if(jzzf_types[id] == 'u') { 30 element(id).click(function() { 31 var id; 32 for(id in jzzf_types) { 33 update(id); 34 } 35 }); 36 } 37 } 38 } 39 40 function bind_realtime_update(id) { 41 switch(jzzf_types[id]) { 42 case 'r': 43 element(id).find('input:radio').bind('change ready', function() { 44 update(element_id($(this).parents('.jzzf_radio'))); 45 }); 46 break; 47 default: 48 element(id).bind('change ready', function() { 49 update(element_id($(this))); 50 }); 51 } 52 } 53 41 54 var just_updated; 42 55 -
jazzy-forms/trunk/front/themes/1.css
r491567 r508925 21 21 } 22 22 23 .jzzf_form .jzzf_element_label {23 .jzzf_form .jzzf_element_label, .jzzf_form .jzzf_element_heading { 24 24 display: block; 25 25 font-weight: bold; … … 28 28 .jzzf_form .jzzf_element { 29 29 padding-bottom: 1em; 30 } 31 32 .jzzf_form .jzzf_element_c.jzzf_ahead_c { 33 padding-bottom: inherit; 34 } 35 36 .jzzf_form .jzzf_element_h { 37 font-weight: bold; 38 } 39 40 .jzzf_form .jzzf_element_h.jzzf_ahead_c, .jzzf_form .jzzf_element_h.jzzf_ahead_m, .jzzf_form .jzzf_element_h.jzzf_ahead_t { 41 padding-bottom: inherit; 30 42 } 31 43 -
jazzy-forms/trunk/front/tmpl-list.php
r502411 r508925 23 23 24 24 function css($css) { ?> 25 <style type="text/css" >25 <style type="text/css" scoped="scoped"> 26 26 <?php print $css; ?> 27 27 … … 36 36 jzzf_dependencies_<?php echo $form->id ?> = <?php echo json_encode($dependencies) ?>; 37 37 jzzf_formulas_<?php echo $form->id ?> = <?php echo json_encode($formulas) ?>; 38 jazzy_forms(jQuery, <?php echo $form->id ?>, jzzf_data_<?php echo $form->id ?>, jzzf_types_<?php echo $form->id ?>, jzzf_dependencies_<?php echo $form->id ?>, jzzf_formulas_<?php echo $form->id ?>); 38 jzzf_form_<?php echo $form->id ?> = <?php echo json_encode($form) ?>; 39 jazzy_forms(jQuery, <?php echo $form->id ?>, jzzf_data_<?php echo $form->id ?>, jzzf_types_<?php echo $form->id ?>, jzzf_dependencies_<?php echo $form->id ?>, jzzf_formulas_<?php echo $form->id ?>, jzzf_form_<?php echo $form->id ?>); 39 40 </script> 40 41 <?php … … 47 48 } 48 49 49 function before($element ) { ?>50 <li class="jzzf_element ">50 function before($element, $ahead) { ?> 51 <li class="jzzf_element jzzf_element_<?php echo $element->type ?> jzzf_ahead_<?php echo $ahead ? $ahead->type : "end" ?>"> 51 52 <?php 52 53 } … … 58 59 59 60 function number($element) { ?> 60 <label class="jzzf_number_label jzzf_element_label" for=" jzzf_<?php esc_attr_e($element->name) ?>"><?php esc_html_e($element->title) ?></label>61 <label class="jzzf_number_label jzzf_element_label" for="<?php $this->id($element) ?>"><?php esc_html_e($element->title) ?></label> 61 62 <input type="text" id="<?php $this->id($element) ?>" value="<?php esc_attr_e($element->default) ?>"> 62 63 <?php … … 108 109 } 109 110 111 function heading($element) { ?> 112 <?php esc_html_e($element->title) ?> 113 <?php 114 } 115 116 function text($element) { ?> 117 <?php esc_html_e($element->title) ?> 118 <?php 119 } 120 121 function html($element) { ?> 122 <?php echo $element->title ?> 123 <?php 124 } 125 126 110 127 function foot($form) { ?> 111 128 </ul> -
jazzy-forms/trunk/generated/Basic_Model.php
r491567 r508925 8 8 $obj->id = intval($obj->id); 9 9 $obj->theme = intval($obj->theme); 10 $obj->realtime = (bool) ($obj->realtime); 10 11 $obj->elements = jzzf_list_element($obj->id); 11 12 } … … 21 22 $obj->id = intval($obj->id); 22 23 $obj->theme = intval($obj->theme); 24 $obj->realtime = (bool) ($obj->realtime); 23 25 $obj->elements = jzzf_list_element($obj->id); 24 26 } … … 33 35 $obj->id = intval($obj->id); 34 36 $obj->theme = intval($obj->theme); 37 $obj->realtime = (bool) ($obj->realtime); 35 38 $obj->elements = jzzf_list_element($obj->id); 36 39 } … … 41 44 global $wpdb; 42 45 if($obj->id) { 43 $query = "UPDATE {$wpdb->prefix}jzzf_form SET `title`=%s,`name`=%s,`theme`=%d,`css`=%s WHERE id=%d";44 $sql = $wpdb->prepare($query, $obj->title,$obj->name,$obj->theme,$obj->css, $obj->id);46 $query = "UPDATE {$wpdb->prefix}jzzf_form SET `title`=%s,`name`=%s,`theme`=%d,`css`=%s,`realtime`=%d WHERE id=%d"; 47 $sql = $wpdb->prepare($query, $obj->title,$obj->name,$obj->theme,$obj->css,$obj->realtime, $obj->id); 45 48 $result = $wpdb->query($sql); 46 49 $id = $obj->id; 47 50 } else { 48 $query = "INSERT INTO {$wpdb->prefix}jzzf_form (`title`,`name`,`theme`,`css` ) VALUES (%s,%s,%d,%s)";49 $sql = $wpdb->prepare($query, $obj->title,$obj->name,$obj->theme,$obj->css );51 $query = "INSERT INTO {$wpdb->prefix}jzzf_form (`title`,`name`,`theme`,`css`,`realtime`) VALUES (%s,%s,%d,%s,%d)"; 52 $sql = $wpdb->prepare($query, $obj->title,$obj->name,$obj->theme,$obj->css,$obj->realtime); 50 53 $result = $wpdb->query($sql); 51 54 $id = $wpdb->insert_id; … … 74 77 } 75 78 } 76 } 77 return $result!==false; 79 return $id; 80 } 81 return false; 78 82 } 79 83 function jzzf_delete_form($id) { … … 130 134 global $wpdb; 131 135 if($obj->id) { 132 $query = "UPDATE {$wpdb->prefix}jzzf_element SET `form`=%d,`order`=%d,`type`=%s,`title`=%s,`name`=%s,`formula`=%s,`value`=%s,`value2`=%s,`default`=%s,`external`=% s,`params`=%s WHERE id=%d";136 $query = "UPDATE {$wpdb->prefix}jzzf_element SET `form`=%d,`order`=%d,`type`=%s,`title`=%s,`name`=%s,`formula`=%s,`value`=%s,`value2`=%s,`default`=%s,`external`=%d,`params`=%s WHERE id=%d"; 133 137 $sql = $wpdb->prepare($query, $obj->form,$obj->order,$obj->type,$obj->title,$obj->name,$obj->formula,$obj->value,$obj->value2,$obj->default,$obj->external,$obj->params, $obj->id); 134 138 $result = $wpdb->query($sql); 135 139 $id = $obj->id; 136 140 } else { 137 $query = "INSERT INTO {$wpdb->prefix}jzzf_element (`form`,`order`,`type`,`title`,`name`,`formula`,`value`,`value2`,`default`,`external`,`params`) VALUES (%d,%d,%s,%s,%s,%s,%s,%s,%s,% s,%s)";141 $query = "INSERT INTO {$wpdb->prefix}jzzf_element (`form`,`order`,`type`,`title`,`name`,`formula`,`value`,`value2`,`default`,`external`,`params`) VALUES (%d,%d,%s,%s,%s,%s,%s,%s,%s,%d,%s)"; 138 142 $sql = $wpdb->prepare($query, $obj->form,$obj->order,$obj->type,$obj->title,$obj->name,$obj->formula,$obj->value,$obj->value2,$obj->default,$obj->external,$obj->params); 139 143 $result = $wpdb->query($sql); … … 163 167 } 164 168 } 165 } 166 return $result!==false; 169 return $id; 170 } 171 return false; 167 172 } 168 173 function jzzf_delete_element($id) { … … 204 209 global $wpdb; 205 210 if($obj->id) { 206 $query = "UPDATE {$wpdb->prefix}jzzf_option SET `order`=%d,`element`=%d,`default`=% s,`title`=%s,`name`=%s,`value`=%s WHERE id=%d";211 $query = "UPDATE {$wpdb->prefix}jzzf_option SET `order`=%d,`element`=%d,`default`=%d,`title`=%s,`name`=%s,`value`=%s WHERE id=%d"; 207 212 $sql = $wpdb->prepare($query, $obj->order,$obj->element,$obj->default,$obj->title,$obj->name,$obj->value, $obj->id); 208 213 $result = $wpdb->query($sql); 209 214 $id = $obj->id; 210 215 } else { 211 $query = "INSERT INTO {$wpdb->prefix}jzzf_option (`order`,`element`,`default`,`title`,`name`,`value`) VALUES (%d,%d,% s,%s,%s,%s)";216 $query = "INSERT INTO {$wpdb->prefix}jzzf_option (`order`,`element`,`default`,`title`,`name`,`value`) VALUES (%d,%d,%d,%s,%s,%s)"; 212 217 $sql = $wpdb->prepare($query, $obj->order,$obj->element,$obj->default,$obj->title,$obj->name,$obj->value); 213 218 $result = $wpdb->query($sql); 214 219 $id = $wpdb->insert_id; 215 220 } 216 return $result!==false;221 return false; 217 222 } 218 223 function jzzf_delete_option($id) { -
jazzy-forms/trunk/generated/schema.sql
r495032 r508925 1 CREATE TABLE IF NOT EXISTS {{prefix}}jzzf_form ( id bigint(20) AUTO_INCREMENT, `title` varchar(1024) NOT NULL, `name` varchar(1024) NOT NULL,`theme` int(12) NOT NULL,`css` varchar(1024) NOT NULL,PRIMARY KEY (id) ) {{charset_collate}};2 CREATE TABLE IF NOT EXISTS {{prefix}}jzzf_element ( id bigint(20) AUTO_INCREMENT, `form` bigint(20) NOT NULL, `order` int(12) NOT NULL,`type` varchar(1024) NOT NULL,`title` varchar(1024) NOT NULL,`name` varchar(1024) NOT NULL,`formula` varchar(1024) NOT NULL,`value` varchar(1024) NOT NULL,`value2` varchar(1024) NOT NULL,`default` varchar(1024) NOT NULL,`external` int(1) NOT NULL,`params` varchar(2048) NOT NULL,PRIMARY KEY (id) ) {{charset_collate}};3 CREATE TABLE IF NOT EXISTS {{prefix}}jzzf_option ( id bigint(20) AUTO_INCREMENT, `order` int(12) NOT NULL, `element` bigint(20) NOT NULL,`default` int(1) NOT NULL,`title` varchar(1024) NOT NULL,`name` varchar(1024) NOT NULL,`value` varchar(1024) NOT NULL,PRIMARY KEY (id) ) {{charset_collate}};1 CREATE TABLE IF NOT EXISTS {{prefix}}jzzf_form ( id bigint(20) AUTO_INCREMENT, `title` varchar(1024) NOT NULL, `name` varchar(1024) NOT NULL, `theme` int(12) NOT NULL, `css` varchar(1024) NOT NULL, `realtime` int(1) NOT NULL DEFAULT 1, PRIMARY KEY (id) ) {{charset_collate}}; 2 CREATE TABLE IF NOT EXISTS {{prefix}}jzzf_element ( id bigint(20) AUTO_INCREMENT, `form` bigint(20) NOT NULL, `order` int(12) NOT NULL, `type` varchar(1024) NOT NULL, `title` varchar(1024) NOT NULL, `name` varchar(1024) NOT NULL, `formula` varchar(1024) NOT NULL, `value` varchar(1024) NOT NULL, `value2` varchar(1024) NOT NULL, `default` varchar(1024) NOT NULL, `external` int(1) NOT NULL, `params` varchar(2048) NOT NULL, PRIMARY KEY (id) ) {{charset_collate}}; 3 CREATE TABLE IF NOT EXISTS {{prefix}}jzzf_option ( id bigint(20) AUTO_INCREMENT, `order` int(12) NOT NULL, `element` bigint(20) NOT NULL, `default` int(1) NOT NULL, `title` varchar(1024) NOT NULL, `name` varchar(1024) NOT NULL, `value` varchar(1024) NOT NULL, PRIMARY KEY (id) ) {{charset_collate}}; -
jazzy-forms/trunk/jazzy-forms.php
r502411 r508925 4 4 Plugin URI: http://www.jazzyforms.com/ 5 5 Description: Online form builder 6 Version: 0.9. 36 Version: 0.9.4 7 7 Author: Igor Prochazka 8 8 Author URI: http://www.l90r.com/ … … 27 27 --------------------------------------------------------------------- 28 28 */ 29 30 define(JZZF_VERSION, 0.0904); 29 31 30 32 define(JZZF_ROOT, WP_PLUGIN_DIR . '/jazzy-forms/'); … … 67 69 function jzzf_activate() { 68 70 global $wpdb; 69 $schema = file( dirname(__FILE__) . '/generated/schema.sql' );70 71 71 72 if(!empty($wpdb->charset)) { … … 76 77 $charset_collate .= " COLLATE $wpdb->collate"; 77 78 } 78 79 foreach($schema as $line) { 79 80 jzzf_create_tables($charset_collate); 81 jzzf_update($charset_collate); 82 } 83 84 function jzzf_create_tables($charset_collate) { 85 jzzf_execute_sql('schema.sql', $charset_collate); 86 } 87 88 function jzzf_execute_sql($filename, $charset_collate) { 89 global $wpdb; 90 91 $file = file( dirname(__FILE__) . '/generated/' . $filename ); 92 foreach($file as $line) { 80 93 $sql = trim($line); 81 94 if($sql && $sql[0] != '#') { … … 85 98 } 86 99 } 100 } 101 102 function jzzf_update($charset_collate) { 103 $previous = get_option('jzzf_version', 0.0); 104 update_option('jzzf_version', JZZF_VERSION); 105 106 jzzf_execute_sql('update.sql', $charset_collate); 87 107 } 88 108 -
jazzy-forms/trunk/readme.txt
r502411 r508925 5 5 Requires at least: 3.2.1 6 6 Tested up to: 3.3.1 7 Stable tag: 0.9. 37 Stable tag: 0.9.4 8 8 9 9 Jazzy Forms is an online form generator that performs instant calculations. It's ideal for inter-active price calculators. … … 27 27 * Output 28 28 * Update button 29 * Text/Heading/HTML 29 30 30 31 This is an early release. Features like input validation, data collection or Email are still being worked on. … … 48 49 Simply insert the following shortcode in the post or page you want the form to appear in: 49 50 50 [jazzy form="FORM_ID"] 51 `[jazzy form="FORM_ID"]` 51 52 52 53 Replace FORM_ID with the ID of the form you want to add. The complete shortcode for your form is also displayed on its administration screen in the "General" tab. Copy and paste it from there. … … 85 86 86 87 where "base_price", "price", "quantity" and "tax" are IDs of other existing form elements. 88 While the author is still working on a proper documentation, you can preview a list of available functions at https://gist.github.com/1779127 87 89 88 90 = Do you accept donations? = … … 103 105 104 106 == Changelog == 107 108 = 0.9.4 = 109 * Some GUI polishing 110 * Treat quotes correctly on the back-end 111 * Avoid crashes/freeze on formulas with unbalanced paranthesis 112 * Add extra elements for text, heading and raw HTML 113 * Make real-time updating optional 114 * Generate valid HTML5 code 105 115 106 116 = 0.9.3 =
Note: See TracChangeset
for help on using the changeset viewer.