├── .gitignore ├── README.md ├── admin ├── add_form.php └── tab_publish.php ├── code ├── FormGenerator.class.php ├── Forms.class.php ├── General.class.php ├── Module.class.php ├── Placeholders.class.php ├── Resources.class.php ├── TemplateSets.class.php ├── Templates.class.php ├── actions.php └── index.html ├── css ├── builder.css ├── codemirror.css ├── edit_form.css ├── index.html └── styles.css ├── default_template_sets ├── conformist-1.2.json ├── default-1.2.json ├── illuminate-1.1.json ├── prosimple-1.3.json └── theme-default-1.1.json ├── form.php ├── form_resources ├── css.php ├── index.html └── js.php ├── help.php ├── images ├── builder_logo.png ├── dialog_header_bg.png ├── dialog_option.png ├── dialog_selected_option.png ├── icon16.png ├── icon24.png ├── icon26.png ├── icon_form_builder.png ├── loading.gif ├── sidebar_section_loading.gif └── tip.png ├── index.php ├── lang ├── en_us.php └── index.html ├── library.php ├── module_config.php ├── preview.php ├── preview_form.php ├── published └── index.html ├── schemas ├── README.md └── template_set-1.0.0.json ├── scripts ├── builder.js ├── index.html ├── manage_forms.js └── manage_template_sets.js ├── settings.php ├── share └── index.html ├── smarty_plugins ├── eval.tpl ├── function.captcha.php ├── function.code_block.php ├── function.continue_block.php ├── function.display_placeholder_field_type.php ├── function.display_template_set_name.php ├── function.display_template_set_placeholders.php ├── function.display_template_set_templates.php ├── function.display_template_set_type.php ├── function.display_template_set_usage.php ├── function.display_template_type.php ├── function.display_template_usage.php ├── function.error_message.php ├── function.footer.php ├── function.form_builder_edit_link.php ├── function.header.php ├── function.navigation.php ├── function.page.php ├── function.template_sets.php ├── function.template_type_dropdown.php ├── function.template_types.php ├── modifier.in.php ├── placeholders_html.tpl └── templates_html.tpl ├── tab_settings_form_offline.php ├── tab_settings_main.php ├── tab_settings_thanks.php ├── template_sets ├── index.php ├── tab_add_placeholder.php ├── tab_edit_placeholder.php ├── tab_edit_resource.php ├── tab_edit_template.php ├── tab_info.php ├── tab_placeholders.php ├── tab_resources.php └── tab_templates.php └── templates ├── admin ├── add_form.tpl └── tab_publish.tpl ├── help.tpl ├── index.html ├── index.tpl ├── preview.tpl ├── settings.tpl ├── tab_settings_form_offline.tpl ├── tab_settings_main.tpl ├── tab_settings_thanks.tpl └── template_sets ├── index.tpl ├── tab_add_placeholder.tpl ├── tab_edit_placeholder.tpl ├── tab_edit_resource.tpl ├── tab_edit_template.tpl ├── tab_info.tpl ├── tab_placeholders.tpl ├── tab_resources.tpl └── tab_templates.tpl /.gitignore: -------------------------------------------------------------------------------- 1 | .idea* 2 | .DS_Store 3 | published/* 4 | !published/index.html 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Form Builder module 2 | 3 | The Form Builder lets you create actual forms on your website. Check out the documentation for more information. 4 | 5 | 6 | ### Documentation 7 | 8 | - [https://docs.formtools.org/modules/form_builder/](https://docs.formtools.org/modules/form_builder/) 9 | 10 | 11 | ### Other Links 12 | 13 | - [Available Form Tools modules](https://modules.formtools.org/) 14 | - [About Form Tools modules](https://docs.formtools.org/userdoc/modules/) 15 | - [Installation instructions](https://docs.formtools.org/userdoc/modules/installing/) 16 | - [Upgrading](https://docs.formtools.org/userdoc/modules/upgrading/) 17 | -------------------------------------------------------------------------------- /admin/add_form.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 12 | $LANG = Core::$L; 13 | 14 | if (isset($request["add_form"])) { 15 | list($g_success, $g_message, $new_form_id) = General::createForm($request); 16 | if ($g_success) { 17 | header("location: ../../../admin/forms/edit/?form_id={$new_form_id}&message=notify_form_builder_form_created"); 18 | exit; 19 | } 20 | } 21 | 22 | $page_values = array( 23 | "page" => "add_form_internal", 24 | "page_url" => Pages::getPageUrl("add_form_internal"), 25 | "head_title" => "{$LANG['phrase_add_form']}", 26 | "L" => $L 27 | ); 28 | 29 | $page_vars["head_js"] =<<< END 30 | ft.click([ 31 | { el: "at1", targets: [{ el: "custom_clients", action: "hide" }] }, 32 | { el: "at2", targets: [{ el: "custom_clients", action: "hide" }] }, 33 | { el: "at3", targets: [{ el: "custom_clients", action: "show" }] } 34 | ]); 35 | 36 | $(function() { 37 | $("#form_name").focus(); 38 | $("#create_internal_form").bind("submit",function(e) { 39 | var rules = []; 40 | rules.push("required,form_name,{$LANG["validation_no_form_name"]}"); 41 | rules.push("required,num_fields,{$LANG["validation_no_num_form_fields"]}"); 42 | rules.push("digits_only,num_fields,{$LANG["validation_invalid_num_form_fields"]}"); 43 | rules.push("range<=1000,num_fields,{$LANG["validation_internal_form_too_many_fields"]}"); 44 | rules.push("required,access_type,{$LANG["validation_no_access_type"]}"); 45 | if (!rsv.validate(this, rules)) { 46 | e.preventDefault(); 47 | } 48 | ft.select_all("selected_client_ids[]"); 49 | }); 50 | }); 51 | END; 52 | 53 | $module->displayPage("../../modules/form_builder/templates/admin/add_form.tpl", $page_vars); 54 | -------------------------------------------------------------------------------- /admin/tab_publish.php: -------------------------------------------------------------------------------- 1 | fb_display_publish_tab(). 15 | */ 16 | 17 | $settings = Settings::get(); 18 | $module = Modules::getModuleInstance("form_builder"); 19 | $L = $module->getLangStrings(); 20 | $root_url = Core::getRootUrl(); 21 | 22 | $success = true; 23 | $message = ""; 24 | if (isset($_POST["set_as_form_builder"])) { 25 | list($success, $message) = Forms::convertFormToFormBuilderForm($form_id, $L); 26 | } else { 27 | if (isset($_GET["delete"])) { 28 | list($success, $message) = Forms::deleteFormConfiguration($form_id, $_GET["delete"], $L); 29 | } else { 30 | if (isset($_GET["delete_published_form"])) { 31 | $override = (isset($_GET["override"])) ? true : false; 32 | $published_form_id = $_GET["delete_published_form"]; 33 | list($success, $message) = $module->deletePublishedForm($form_id, $published_form_id, $_GET["delete_form_config"], $L, $override); 34 | } else { 35 | if (isset($_POST["update_order"])) { 36 | list($success, $message) = Forms::updatePublishedFormOrder($form_id, $L, $_POST); 37 | } 38 | } 39 | } 40 | } 41 | 42 | $form_info = CoreForms::getForm($form_id); 43 | 44 | $module_settings = $module->getSettings(); 45 | $width = $module_settings["form_builder_width"]; 46 | $height = $module_settings["form_builder_height"]; 47 | 48 | // compile the templates information 49 | $page_vars["g_success"] = $success; 50 | $page_vars["g_message"] = $message; 51 | $page_vars["page"] = "publish"; 52 | $page_vars["page_url"] = Pages::getPageUrl("edit_form_main", array("form_id" => $form_id)); 53 | $page_vars["head_title"] = "{$LANG["phrase_edit_form"]} - {$L["word_publish"]}"; 54 | $page_vars["form_info"] = $form_info; 55 | $page_vars["js_messages"] = array( 56 | "word_cancel", 57 | "phrase_please_confirm", 58 | "word_yes", 59 | "word_no", 60 | "phrase_show_form", 61 | "word_close", 62 | "phrase_open_form_in_new_tab_or_win" 63 | ); 64 | 65 | $page_vars["head_string"] = <<< END 66 | 67 | 68 | 69 | 70 | END; 71 | 72 | $default_timezone_offset = $settings["default_timezone_offset"]; 73 | $server_time = CoreGeneral::getDate($default_timezone_offset, CoreGeneral::getCurrentDatetime(), "M jS, Y G:i:s A"); 74 | 75 | $onload_js = ""; 76 | if (isset($_GET["action"]) && $_GET["action"] == "auto_open" && isset($_GET["published_form_id"])) { 77 | $published_form_id = $_GET["published_form_id"]; 78 | $onload_js = "dialog = window.open(\"$root_url/modules/form_builder/preview.php?form_id=$form_id&published_form_id=$published_form_id\", \"preview\", \"status=0,toolbar=0,location=0,menubar=0,height=$height,width=$width\");"; 79 | } 80 | 81 | $page_vars["head_js"] = <<< END 82 | $(function() { 83 | var dialog = null; 84 | $("#publish_new_form").bind("click", function() { 85 | if (dialog == null || dialog.closed) { 86 | var dialog = window.open("$root_url/modules/form_builder/preview.php?form_id=$form_id", "preview", "status=0,toolbar=0,location=0,menubar=0,height=$height,width=$width"); 87 | } else { 88 | dialog.focus(); 89 | } 90 | }); 91 | 92 | $("#form_builder_form_list .edit").bind("click", function() { 93 | if (dialog == null || dialog.closed) { 94 | var published_form_id = $(this).closest(".row_group").find(".sr_order").val(); 95 | dialog = window.open("$root_url/modules/form_builder/preview.php?form_id=$form_id&published_form_id=" + published_form_id, "preview", "status=0,toolbar=0,location=0,menubar=0,height=$height,width=$width"); 96 | } else { 97 | dialog.focus(); 98 | } 99 | }); 100 | 101 | ft.init_show_form_links(); 102 | $onload_js 103 | }); 104 | 105 | g.mod_messages = { 106 | confirm_delete_form_confirmation: "{$L["confirm_delete_form_confirmation"]}", 107 | phrase_form_offline_date: "{$L["phrase_form_offline_date"]}", 108 | notify_form_offline_message: "{$L["notify_form_offline_message"]}" 109 | } 110 | g.current_server_time = "$server_time"; 111 | 112 | END; 113 | 114 | // N.B. the actual tab_publish.tpl is loaded via a hook 115 | Themes::displayPage("admin/forms/edit/index.tpl", $page_vars); 116 | -------------------------------------------------------------------------------- /code/General.class.php: -------------------------------------------------------------------------------- 1 | setTemplateDir("$root_dir/themes/default"); 56 | $smarty->setCompileDir("$root_dir/themes/default/cache/"); 57 | $smarty->setUseSubDirs(Core::shouldUseSmartySubDirs()); 58 | $smarty->left_delimiter = $left_delimiter; 59 | $smarty->right_delimiter = $right_delimiter; 60 | $smarty->addPluginsDir(array( 61 | "$root_dir/global/smarty_plugins", 62 | "$root_dir/modules/form_builder/smarty_plugins" 63 | )); 64 | 65 | return $smarty; 66 | } 67 | 68 | 69 | /** 70 | * Helper function to return a list of View tabs. 71 | * 72 | * @param array $view_info 73 | */ 74 | public static function getViewTabsFromViewInfo($view_info) 75 | { 76 | $view_tabs = array(); 77 | 78 | foreach ($view_info["tabs"] as $tab_info) { 79 | $tab_label = trim($tab_info["tab_label"]); 80 | if (!empty($tab_label)) { 81 | $view_tabs[] = array("tab_label" => $tab_label); 82 | } 83 | } 84 | 85 | if (empty($view_tabs)) { 86 | $view_tabs[] = array("tab_label" => "Form"); 87 | } 88 | 89 | return $view_tabs; 90 | } 91 | 92 | 93 | /** 94 | * Creates a Form Builder form. Same as ft_create_internal_form(), except for the form type. 95 | * 96 | * @param $info array POST request containing the form name, number of fields and access type. 97 | */ 98 | public static function createForm($request) 99 | { 100 | $db = Core::$db; 101 | $LANG = Core::$L; 102 | 103 | $rules = array(); 104 | $rules[] = "required,form_name,{$LANG["validation_no_form_name"]}"; 105 | $rules[] = "required,num_fields,{$LANG["validation_no_num_form_fields"]}"; 106 | $rules[] = "digits_only,num_fields,{$LANG["validation_invalid_num_form_fields"]}"; 107 | $rules[] = "required,access_type,{$LANG["validation_no_access_type"]}"; 108 | 109 | $errors = validate_fields($request, $rules); 110 | if (!empty($errors)) { 111 | array_walk($errors, create_function('&$el','$el = "•  " . $el;')); 112 | $message = join("
", $errors); 113 | return array(false, $message); 114 | } 115 | 116 | $config = array( 117 | "form_type" => "form_builder", 118 | "form_name" => $request["form_name"], 119 | "access_type" => $request["access_type"], 120 | "submission_type" => "code" 121 | ); 122 | 123 | // set up the entry for the form 124 | list($success, $message, $new_form_id) = CoreForms::setupForm($config); 125 | 126 | $form_data = array( 127 | "form_tools_form_id" => $new_form_id, 128 | "form_tools_display_notification_page" => false 129 | ); 130 | 131 | for ($i=1; $i<=$request["num_fields"]; $i++) { 132 | $form_data["field{$i}"] = $i; 133 | } 134 | CoreForms::initializeForm($form_data); 135 | 136 | $form_fields = Fields::getFormFields($new_form_id); 137 | 138 | $order = 1; 139 | 140 | // if the user just added a form with a lot of fields (over 50), the database row size will be too 141 | // large. Varchar fields (which with utf-8 equates to 1220 bytes) in a table can have a combined row 142 | // size of 65,535 bytes, so 53 is the max. The client-side validation limits the number of fields to 143 | // 1000. Any more will throw an error. 144 | $field_size_clause = ($request["num_fields"] > 50) ? ", field_size = 'small'" : ""; 145 | 146 | foreach ($form_fields as $field_info) { 147 | if (preg_match("/field(\d+)/", $field_info["field_name"], $matches)) { 148 | $db->query(" 149 | UPDATE {PREFIX}form_fields 150 | SET field_title = :field_title, 151 | col_name = :col_name 152 | $field_size_clause 153 | WHERE field_id = :field_id 154 | "); 155 | $db->bindAll(array( 156 | "field_title" => "{$LANG["word_field"]} $order", 157 | "col_name" => "col_$order", 158 | "field_id" => $field_info["field_id"] 159 | )); 160 | $db->execute(); 161 | $order++; 162 | } 163 | } 164 | 165 | CoreForms::finalizeForm($new_form_id); 166 | 167 | // if the form has an access type of "private" add whatever client accounts the user selected 168 | if ($request["access_type"] == "private") { 169 | $selected_client_ids = $request["selected_client_ids"]; 170 | $queries = array(); 171 | 172 | foreach ($selected_client_ids as $client_id) { 173 | $queries[] = "($client_id, $new_form_id)"; 174 | } 175 | 176 | if (!empty($queries)) { 177 | $insert_values = implode(",", $queries); 178 | $db->query(" 179 | INSERT INTO {PREFIX}client_forms (account_id, form_id) 180 | VALUES $insert_values 181 | "); 182 | } 183 | } 184 | 185 | // now apply a few simple changes to the View we just created, to simplify things for the 186 | $views = Views::getFormViews($new_form_id); 187 | $view_id = $views[0]["view_id"]; 188 | 189 | // 1. Change the View name to "Form Builder View" 190 | $db->query("UPDATE {PREFIX}views SET view_name = 'Form Builder View' WHERE view_id = :view_id"); 191 | $db->bind("view_id", $view_id); 192 | $db->execute(); 193 | 194 | // 2. Change the View's first tab (the only one defined!) to be called "Page 1" 195 | $db->query("UPDATE {PREFIX}view_tabs SET tab_label = 'Page 1' WHERE view_id = :view_id AND tab_number = 1 LIMIT 1"); 196 | $db->bind("view_id", $view_id); 197 | $db->execute(); 198 | 199 | // 3. Change the View Field Group label to "Fields" instead of "DATA" 200 | $db->query("UPDATE {PREFIX}list_groups SET group_name = 'Fields' WHERE group_type = :group_type LIMIT 1"); 201 | $db->bind("group_type", "view_fields_{$view_id}"); 202 | $db->execute(); 203 | 204 | return array(true, $LANG["notify_internal_form_created"], $new_form_id); 205 | } 206 | 207 | 208 | /** 209 | * What a beautiful function name. This largely duplicates some Core JS code, but it's necessary + a good idea for later on when 210 | * we want to offer different ways to display validation errors. 211 | * 212 | * @return string 213 | */ 214 | public static function getFormValidationCustomErrorHandlerJs() 215 | { 216 | $LANG = Core::$L; 217 | 218 | $js =<<< END 219 | function fb_validate(f, error_info) { 220 | if (!error_info.length) { 221 | return true; 222 | } 223 | var first_el = null; 224 | var error_str = ""; 232 | 233 | ft.create_dialog({ 234 | title: "{$LANG["phrase_validation_error"]}", 235 | popup_type: "error", 236 | width: 450, 237 | content: error_str, 238 | buttons: [{ 239 | text: "{$LANG["word_close"]}", 240 | click: function() { 241 | $(this).dialog("close"); 242 | $(first_el).focus().select(); 243 | } 244 | }] 245 | }) 246 | 247 | return false; 248 | } 249 | END; 250 | 251 | return $js; 252 | } 253 | } 254 | -------------------------------------------------------------------------------- /code/Resources.class.php: -------------------------------------------------------------------------------- 1 | query(" 17 | INSERT INTO {PREFIX}module_form_builder_template_set_resources (resource_type, template_set_id, 18 | resource_name, placeholder, content, last_updated, list_order) 19 | VALUES (:resource_type, :set_id, :resource_name, :placeholder, :content, :last_updated, :list_order) 20 | "); 21 | $db->bindAll(array( 22 | "resource_type" => $resource_type, 23 | "set_id" => $set_id, 24 | "resource_name" => $resource_name, 25 | "placeholder" => $placeholder, 26 | "content" => $content, 27 | "last_updated" => $last_updated, 28 | "list_order" => $order 29 | )); 30 | $db->execute(); 31 | 32 | return $db->getInsertId(); 33 | } 34 | 35 | 36 | public static function addNewResource($set_id, $resource_name, $placeholder, $resource_type) 37 | { 38 | $list_order = self::getNextResourceListOrder($set_id); 39 | $now = CoreGeneral::getCurrentDatetime(); 40 | 41 | $id = self::addResource($set_id, $resource_type, $resource_name, $placeholder, '', $now, $list_order); 42 | 43 | return array( 44 | "success" => 1, 45 | "message" => $id 46 | ); 47 | } 48 | 49 | 50 | public static function getResources($set_id) 51 | { 52 | $db = Core::$db; 53 | 54 | $db->query(" 55 | SELECT * 56 | FROM {PREFIX}module_form_builder_template_set_resources 57 | WHERE template_set_id = :set_id 58 | ORDER BY list_order 59 | "); 60 | $db->bind("set_id", $set_id); 61 | $db->execute(); 62 | 63 | return $db->fetchAll(); 64 | } 65 | 66 | 67 | public static function getResource($resource_id) 68 | { 69 | $db = Core::$db; 70 | 71 | $db->query(" 72 | SELECT * 73 | FROM {PREFIX}module_form_builder_template_set_resources 74 | WHERE resource_id = :resource_id 75 | "); 76 | $db->bind("resource_id", $resource_id); 77 | $db->execute(); 78 | 79 | return $db->fetch(); 80 | } 81 | 82 | 83 | public static function updateResource($resource_id, $info, $L) 84 | { 85 | $db = Core::$db; 86 | 87 | try { 88 | $db->query(" 89 | UPDATE {PREFIX}module_form_builder_template_set_resources 90 | SET resource_name = :resource_name, 91 | resource_type = :resource_type, 92 | placeholder = :placeholder, 93 | content = :content, 94 | last_updated = :last_updated 95 | WHERE resource_id = :resource_id 96 | "); 97 | $db->bindAll(array( 98 | "resource_name" => $info["resource_name"], 99 | "resource_type" => $info["resource_type"], 100 | "placeholder" => $info["placeholder"], 101 | "content" => $info["resource_content"], 102 | "last_updated" => CoreGeneral::getCurrentDatetime(), 103 | "resource_id" => $resource_id 104 | )); 105 | $db->execute(); 106 | } catch (PDOException $e) { 107 | return array(true, $L["notify_resource_not_updated"] . $e->getMessage()); 108 | } 109 | 110 | return array(true, $L["notify_resource_updated"]); 111 | } 112 | 113 | 114 | public static function deleteResource($resource_id, $L) 115 | { 116 | $db = Core::$db; 117 | 118 | if (empty($resource_id) || !is_numeric($resource_id)) { 119 | return array(false, $L["notify_delete_invalid_resource_id"]); 120 | } 121 | 122 | $db->query(" 123 | DELETE FROM {PREFIX}module_form_builder_template_set_resources 124 | WHERE resource_id = :resource_id 125 | "); 126 | $db->bind("resource_id", $resource_id); 127 | $db->execute(); 128 | 129 | if ($db->numRows() > 0) { 130 | return array(true, $L["notify_resource_deleted"]); 131 | } else { 132 | return array(true, $L["notify_resource_not_deleted"]); 133 | } 134 | } 135 | 136 | 137 | /** 138 | * Figures out the next available list order for a new template set resource. 139 | * 140 | * @param integer $set_id 141 | */ 142 | public static function getNextResourceListOrder($set_id) 143 | { 144 | $db = Core::$db; 145 | 146 | $db->query(" 147 | SELECT list_order 148 | FROM {PREFIX}module_form_builder_template_set_resources 149 | WHERE template_set_id = :set_id 150 | ORDER BY list_order DESC 151 | LIMIT 1 152 | "); 153 | $db->bind("set_id", $set_id); 154 | $db->execute(); 155 | 156 | return $db->fetch(PDO::FETCH_COLUMN) + 1; 157 | } 158 | 159 | 160 | public static function updateResourceOrder($info, $L) 161 | { 162 | $db = Core::$db; 163 | 164 | $sortable_id = $info["sortable_id"]; 165 | 166 | $ordered_resource_ids = explode(",", $info["{$sortable_id}_sortable__rows"]); 167 | 168 | $order = 1; 169 | foreach ($ordered_resource_ids as $resource_id) { 170 | $db->query(" 171 | UPDATE {PREFIX}module_form_builder_template_set_resources 172 | SET list_order = $order 173 | WHERE resource_id = $resource_id 174 | "); 175 | $db->bindAll(array( 176 | "list_order" => $order, 177 | "resource_id" => $resource_id 178 | )); 179 | $db->execute(); 180 | $order++; 181 | } 182 | 183 | return array(true, $L["notify_resource_order_updated"]); 184 | } 185 | } 186 | 187 | -------------------------------------------------------------------------------- /code/actions.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 16 | 17 | 18 | // the action to take and the ID of the page where it will be displayed (allows for 19 | // multiple calls on same page to load content in unique areas) 20 | $action = $request["action"]; 21 | 22 | switch ($action) { 23 | case "create_new_template_set": 24 | $template_set_name = $request["template_set_name"]; 25 | $original_set_id = isset($request["original_set_id"]) ? $request["original_set_id"] : ""; 26 | $results = TemplateSets::createNewTemplateSet($template_set_name, $original_set_id); 27 | echo returnJSON($results); 28 | break; 29 | 30 | case "create_new_template": 31 | $results = Templates::createNewTemplate($request["set_id"], $request["template_name"], $request["template_type"], 32 | $request["new_template_source"], $request["source_template_id"]); 33 | echo returnJSON($results); 34 | break; 35 | 36 | case "add_resource": 37 | $set_id = $request["set_id"]; 38 | $resource_name = $request["resource_name"]; 39 | $placeholder = $request["placeholder"]; 40 | $resource_type = $request["resource_type"]; 41 | $result = Resources::addNewResource($set_id, $resource_name, $placeholder, $resource_type); 42 | echo returnJSON($result); 43 | break; 44 | 45 | case "save_builder_settings": 46 | $result = Forms::saveBuilderSettings($request); 47 | echo returnJSON($result); 48 | break; 49 | 50 | case "get_template_set_templates_html": 51 | $set_id = $request["set_id"]; 52 | echo Templates::generateTemplateSetTemplatesHtml($set_id, $L); 53 | break; 54 | 55 | case "get_template_set_placeholders_html": 56 | $set_id = $request["set_id"]; 57 | $placeholders = Placeholders::getPlaceholders($set_id); 58 | 59 | // set the default values 60 | $placeholder_hash = array(); 61 | foreach ($placeholders as $p_info) { 62 | $placeholder_hash[$p_info["placeholder_id"]] = $p_info["default_value"]; 63 | } 64 | echo Placeholders::generateTemplateSetPlaceholdersHtml($placeholders, $placeholder_hash, $L); 65 | break; 66 | 67 | case "publish_form": 68 | $module_settings = $module->getSettings(); 69 | if ($module_settings["demo_mode"] != "on") { 70 | $result = Forms::publishForm($request, $L); 71 | echo returnJSON($result); 72 | } 73 | break; 74 | 75 | case "update_publish_settings": 76 | $module_settings = $module->getSettings(); 77 | if ($module_settings["demo_mode"] != "on") { 78 | $result = Forms::updatePublishSettings($request, $L); 79 | echo returnJSON($result); 80 | } 81 | break; 82 | } 83 | 84 | function returnJSON($php) 85 | { 86 | header("Content-Type: application/json"); 87 | return json_encode($php); 88 | } 89 | -------------------------------------------------------------------------------- /code/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /css/codemirror.css: -------------------------------------------------------------------------------- 1 | body.editbox { 2 | font-size: 8pt; 3 | } -------------------------------------------------------------------------------- /css/edit_form.css: -------------------------------------------------------------------------------- 1 | .form_builder_form_list { 2 | width: 698px; 3 | } 4 | .form_builder_form_list .header_row .col2 { 5 | width: 150px; 6 | padding-left: 0px; 7 | } 8 | .form_builder_form_list .col2 { 9 | padding-left: 2px; 10 | width: 148px; 11 | } 12 | .form_builder_form_list .header_row .col3 { 13 | width: 130px; 14 | padding-left: 0px; 15 | } 16 | .form_builder_form_list .col3 { 17 | width: 128px; 18 | padding-left: 2px; 19 | } 20 | .form_builder_form_list .col4 { 21 | width: 70px; 22 | text-align: center; 23 | } 24 | .form_builder_form_list .col5 { 25 | width: 70px; 26 | text-align:center; 27 | } 28 | .form_builder_form_list .header_row .col6 { 29 | width: 182px; 30 | padding-left: 0; 31 | } 32 | .form_builder_form_list .col6 { 33 | width: 180px; 34 | padding-left: 2px; 35 | } 36 | .form_builder_form_list .col6 .empty { 37 | text-align: center; 38 | } 39 | div.published_form_url { 40 | width: 156px; 41 | overflow:hidden; 42 | text-overflow: ellipsis; 43 | white-space:nowrap; 44 | } 45 | .publish_tab_offline_date { 46 | background: transparent url(../../../global/images/clock.png) center center no-repeat; 47 | width: 16px; 48 | height: 20px; 49 | margin-left: 3px; 50 | display:inline-block; 51 | text-indent: -9999px; 52 | cursor: pointer; 53 | } 54 | -------------------------------------------------------------------------------- /css/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /css/styles.css: -------------------------------------------------------------------------------- 1 | .placeholder_option_list { 2 | width: 491px; 3 | } 4 | .placeholder_option_list .col2 { 5 | width: 418px; 6 | } 7 | .placeholder_option_list .col2 input{ 8 | width: 412px; 9 | } 10 | 11 | .placeholder_list .header_row .col2 { 12 | padding-left: 0px; 13 | width: 262px; 14 | } 15 | .placeholder_list .header_row .col3 { 16 | padding-left: 0px; 17 | width: 175px; 18 | } 19 | .placeholder_list .header_row .col4 { 20 | padding-left: 0px; 21 | width: 160px; 22 | } 23 | .placeholder_list .col2 { 24 | width: 259px; 25 | padding-left: 3px; 26 | } 27 | .placeholder_list .col3 { 28 | width: 172px; 29 | padding-left: 3px; 30 | } 31 | .placeholder_list .col4 { 32 | width: 157px; 33 | padding-left: 3px; 34 | } 35 | 36 | .template_list .header_row .col2 { 37 | padding-left: 0px; 38 | width: 192px; 39 | } 40 | .template_list .col2 { 41 | width: 189px; 42 | padding-left: 3px; 43 | } 44 | .template_list .header_row .col3 { 45 | padding-left: 0px; 46 | width: 206px; 47 | } 48 | .template_list .col3 { 49 | width: 203px; 50 | padding-left: 3px; 51 | } 52 | .template_list .col4 { 53 | width: 199px; 54 | } 55 | .template_list .col4 select { 56 | width: 196px; 57 | } 58 | 59 | .resources_list .header_row .col2 { 60 | padding-left: 0px; 61 | width: 262px; 62 | } 63 | .resources_list .header_row .col3 { 64 | padding-left: 0px; 65 | width: 175px; 66 | } 67 | .resources_list .header_row .col4 { 68 | padding-left: 0px; 69 | width: 160px; 70 | } 71 | .resources_list .col2 { 72 | width: 259px; 73 | padding-left: 3px; 74 | } 75 | .resources_list .col3 { 76 | width: 172px; 77 | padding-left: 3px; 78 | } 79 | .resources_list .col4 { 80 | width: 157px; 81 | padding-left: 3px; 82 | } 83 | 84 | .set_type_header { 85 | color: #334499; 86 | } 87 | .set_type_footer { 88 | color: green; 89 | } 90 | .set_type_navigation { 91 | color: purple; 92 | } 93 | .set_type_continue_block { 94 | color: orange; 95 | } 96 | .set_type_form_page { 97 | color: #cc0000; 98 | } 99 | .set_type_form_offline_page { 100 | color: #73c5ff; 101 | } 102 | .set_type_review_page { 103 | color: #770000; 104 | } 105 | .set_type_thankyou_page { 106 | color: #995500; 107 | } 108 | .set_type_error_message { 109 | color: #6b26df; 110 | } 111 | 112 | .template_sets .header_row .col2 { 113 | width: 172px; 114 | padding-left: 0px; 115 | } 116 | .template_sets .col2 { 117 | width: 170px; 118 | padding-left: 2px; 119 | } 120 | .template_sets .col3 { 121 | width: 140px; 122 | } 123 | .template_sets .col3 select { 124 | width: 137px; 125 | } 126 | .template_sets .col4 { 127 | width: 80px; 128 | text-align: center; 129 | } 130 | .template_sets .col5, .template_sets .col6, .template_sets .col7 { 131 | width: 80px; 132 | text-align: center; 133 | } 134 | .template_sets .check_area a { 135 | display: block; 136 | } 137 | .template_sets .check_area a:hover { 138 | color: orange; 139 | text-decoration: none; 140 | } 141 | 142 | .template_type_placeholders h2 { 143 | margin: 0px; 144 | padding: 0px 0px 4px 0px; 145 | color: #444444; 146 | } 147 | .template_type_placeholders td { 148 | border-bottom: 1px solid #dddddd; 149 | } 150 | .template_type_placeholders td.rowN { 151 | border-bottom: none; 152 | } 153 | 154 | .placeholder_group { 155 | border: 1px solid #cccccc; 156 | padding: 5px; 157 | background-color: #efefef; 158 | } 159 | 160 | .template_set_table .check_area a { 161 | display: block; 162 | } 163 | .template_set_table .check_area a:hover { 164 | color: orange; 165 | text-decoration: none; 166 | } 167 | 168 | .template_set_marker { 169 | color: white; 170 | -webkit-border-radius: 2px; 171 | -moz-border-radius: 2px; 172 | border-radius: 2px; 173 | font-size: 7pt; 174 | padding: 1px 8px; 175 | cursor: pointer; 176 | } 177 | .template_sets .template_set_marker { 178 | cursor: default; 179 | } 180 | .template_set_complete { 181 | background-color: green; 182 | } 183 | .template_set_incomplete { 184 | background-color: #ce0000; 185 | } 186 | 187 | .sortable .rows .info { 188 | background: transparent url(../../../../global/images/info_small.png) no-repeat center 2px; 189 | cursor: pointer; 190 | width: 18px; 191 | } 192 | -------------------------------------------------------------------------------- /default_template_sets/theme-default-1.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema_version": "1.0.0", 3 | "template_set_name": "Theme - Default", 4 | "template_set_version": "1.1", 5 | "description": "A form template set based on the same styles as the default Form Tools user interface. Complete with choice of swatches!", 6 | "last_updated": "2012-02-03 17:47:10", 7 | "templates": { 8 | "page_layout": [ 9 | { 10 | "template_name": "Page Layout", 11 | "content": "{{header}}\n{{page}}\n{{footer}}" 12 | } 13 | ], 14 | "header": [ 15 | { 16 | "template_name": "Header", 17 | "content": "\n\n\n {{$form_name}}\n \n {{$required_resources}}\n {{$R.styles}}\n \n \n \n\n\n
\n
\n {{form_builder_edit_link}}\n

{{$form_name|upper}}

\n
\n\n" 18 | }, 19 | { 20 | "template_name": "No Header", 21 | "content": "\n\n\n {{$form_name}}\n \n {{$required_resources}}\n {{$R.styles}}\n \n \n \n \n\n\n
\n {{form_builder_edit_link}}\n" 22 | } 23 | ], 24 | "footer": [ 25 | { 26 | "template_name": "Footer", 27 | "content": "
\n \n \n \n\n
\n\n\n" 28 | } 29 | ], 30 | "form_page": [ 31 | { 32 | "template_name": "Form Page", 33 | "content": "
\n \n \n \n \n \n
\n
\n {{navigation}}\n
\n
\n
\n
{{$page_name}}
\n\n {{error_message}}\n\n
\n \n {{foreach from=$grouped_fields key=k item=curr_group name=row}}\n {{assign var=group value=$curr_group.group}}\n {{assign var=fields value=$curr_group.fields}}\n\n \n {{if $group.group_name}}\n
{{$group.group_name|upper}}
\n {{/if}}\n\n {{if $fields|@count > 0}}\n \n {{/if}}\n \n {{foreach from=$fields item=curr_field name=i}}\n {{assign var=field_id value=$curr_field.field_id}}\n \n \n \n \n {{/foreach}}\n\n {{if $fields|@count > 0}}\n
\n {{$curr_field.field_title}}\n {{if $curr_field.is_required}}*{{/if}}\n \n {{edit_custom_field form_id=$form_id field_info=$curr_field field_types=$field_types\n settings=$settings submission_id=$submission_id}}\n
\n {{/if}}\n\n {{/foreach}}\n\n {{continue_block}}\n\n
\n\n
\n
\n
\n" 34 | } 35 | ], 36 | "review_page": [ 37 | { 38 | "template_name": "Review Page", 39 | "content": "
\n \n \n \n \n \n
\n
\n {{navigation}}\n
\n
\n
\n
{{$review_page_title}}
\n\n
\n {{foreach from=$grouped_fields item=curr_group}}\n {{assign var=group value=$curr_group.group}}\n {{assign var=fields value=$curr_group.fields}}\n\n {{if $fields|@count > 0}}\n
\n {{$group.group_name|upper|default:\" \"}}\n \n EDIT\n \n
\n\n \n {{/if}}\n\n {{foreach from=$fields item=curr_field name=i}}\n {{assign var=field_id value=$curr_field.field_id}}\n \n \n \n \n {{/foreach}}\n\n {{if $fields|@count > 0}}\n
{{$curr_field.field_title}}\n {{edit_custom_field form_id=$form_id submission_id=$submission_id\n field_info=$curr_field field_types=$field_types settings=$settings}}\n
\n {{/if}}\n \n {{/foreach}}\n\n {{continue_block}}\n\n
\n\n
\n
\n
\n" 40 | } 41 | ], 42 | "thankyou_page": [ 43 | { 44 | "template_name": "Thankyou Page", 45 | "content": "
\n \n \n \n \n \n
\n
\n {{navigation}}\n
\n
\n
\n {{$thankyou_page_content}} \n
\n
\n
\n\n" 46 | } 47 | ], 48 | "form_offline_page": [ 49 | { 50 | "template_name": "Form Offline Page", 51 | "content": "
\n {{$form_offline_page_content}}\n
" 52 | } 53 | ], 54 | "continue_block": [ 55 | { 56 | "template_name": "Continue - Button Only", 57 | "content": "
\n \n
" 58 | } 59 | ], 60 | "navigation": [ 61 | { 62 | "template_name": "Navigation", 63 | "content": "" 64 | }, 65 | { 66 | "template_name": "Navigation - Numbered", 67 | "content": "" 68 | } 69 | ], 70 | "error_message": [ 71 | { 72 | "template_name": "Error Message", 73 | "content": "{{if $validation_error}}\n
\n
\n {{$validation_error}}\n
\n
\n{{/if}}\n\n" 74 | } 75 | ] 76 | }, 77 | "resources": { 78 | "css": [ 79 | { 80 | "resource_name": "Additional Styles", 81 | "placeholder": "styles", 82 | "content": "/**\n * The majority of styles for this Template Set are pulled directly from the Core's default theme.\n * This supplements them for a few things that aren't covered.\n */\nh1 {\n margin: 0px;\n padding: 28px 0px 0px 21px;\n float: left;\n font-family: 'Lato', Arial;\n color: white;\n font-size: 20px;\n font-weight: normal;\n}\n#ts_css_nav {\n list-style:none;\n margin: 0px;\n padding: 0px;\n}\n#ts_css_nav li {\n height: 27px;\n}\n#ts_css_nav li a, #ts_css_nav li div {\n padding: 2px 0px 2px 4px;\n width: 150px;\n}\n#ts_css_nav li.completed_page a:link, #ts_css_nav li.completed_page a:visited {\n display: block;\n text-underline: none;\n}\n#ts_css_nav li.css_nav_current_page div {\n font-weight: bold;\n}\n.edit_link {\n float: right;\n}\n.edit_link a:link, .edit_link a:visited {\n padding: 0px 7px;\n background-color: #aaaaaa;\n color: white;\n border-radius: 3px;\n letter-spacing: 0px;\n}\n.edit_link a:hover {\n background-color: #222222;\n text-decoration: none;\n}\n#form_builder__edit_link {\n background-color: #444444;\n border-radius: 3px 3px 3px 3px;\n color: white;\n float: right;\n margin: 25px;\n padding: 0 8px;\n}\n#form_builder__edit_link:hover {\n background-color: #000000;\n text-decoration: none;\n}\n.ts_heading {\n font: 17.6px/20px Verdana,sans-serif;\n padding-bottom: 5px;\n margin: 0px;\n}" 83 | } 84 | ] 85 | }, 86 | "placeholders": [ 87 | { 88 | "placeholder_label": "Swatch", 89 | "placeholder": "swatch", 90 | "field_type": "select", 91 | "field_orientation": "na", 92 | "default_value": "Orange", 93 | "options": [ 94 | { 95 | "option_text": "Aquamarine" 96 | }, 97 | { 98 | "option_text": "Blue" 99 | }, 100 | { 101 | "option_text": "Dark Blue" 102 | }, 103 | { 104 | "option_text": "Green" 105 | }, 106 | { 107 | "option_text": "Grey" 108 | }, 109 | { 110 | "option_text": "Light Brown" 111 | }, 112 | { 113 | "option_text": "Orange" 114 | }, 115 | { 116 | "option_text": "Purple" 117 | }, 118 | { 119 | "option_text": "Red" 120 | }, 121 | { 122 | "option_text": "Yellow" 123 | } 124 | ] 125 | } 126 | ] 127 | } 128 | -------------------------------------------------------------------------------- /form.php: -------------------------------------------------------------------------------- 1 | false)); 14 | } 15 | 16 | /** 17 | * If the user uninstalls the Form Builder or disables it, any public forms will stop working. This is called at the 18 | * top of the forms to output a simple "Offline" message. It's really just to prevent an ugly error. 19 | * 20 | * Note: this is DIFFERENT from the form offline message which is configured per form. 21 | */ 22 | if (!Modules::checkModuleUsable("form_builder")) { 23 | echo <<< END 24 | 25 | 26 | 27 | 28 |

29 | This form is unavailable. 30 |

31 | 32 | 33 | END; 34 | exit; 35 | } 36 | 37 | $module = Modules::getModuleInstance("form_builder"); 38 | $namespace = "form_builder_{$published_form_id}"; 39 | 40 | // find out about the page: form / review / thanks. That determines what values we pass to processFormBuilderPage 41 | $config = Forms::getFormConfiguration($published_form_id); 42 | 43 | $form_id = $config["form_id"]; 44 | $view_id = $config["view_id"]; 45 | 46 | FormGenerator::deleteUnfinalizedSubmissions($form_id); 47 | 48 | // check that we have all the info we need (configured form, View etc) 49 | $error_code = FormGenerator::checkLiveFormConditions($config); 50 | if (!empty($error_code)) { 51 | $config["error_code"] = $error_code; 52 | FormGenerator::generateFormPage($config); 53 | exit; 54 | } 55 | 56 | if (isset($_GET["clear"])) { 57 | FormGenerator::clearFormBuilderFormSessions($namespace); 58 | header("location: $filename"); 59 | } 60 | 61 | // check the form shouldn't be taken offline. This does some special logic to override the is_online == "no" 62 | // for cases where submissions have been started but the form is now offline 63 | $is_online = FormGenerator::checkFormOffline($config, $namespace); 64 | $config["is_online"] = ($is_online) ? "yes" : "no"; 65 | 66 | // set up sessions and retrieve the field data already submitted 67 | list($new_session, $fields) = FormGenerator::initFormBuilderPage($form_id, $view_id, $namespace); 68 | 69 | // get the current submission ID 70 | $submission_id = isset($_SESSION[$namespace]["form_tools_submission_id"]) ? $_SESSION[$namespace]["form_tools_submission_id"] : ""; 71 | 72 | // get an ordered list of the pages in this published form 73 | $page_params = array( 74 | "view_tabs" => ViewTabs::getViewTabs($view_id, true), 75 | "include_review_page" => ($config["include_review_page"] == "yes") ? true : false, 76 | "include_thanks_page_in_nav" => ($config["include_thanks_page_in_nav"] == "yes") ? true : false, 77 | "review_page_title" => $config["review_page_title"], 78 | "thankyou_page_title" => $config["thankyou_page_title"] 79 | ); 80 | 81 | $all_pages = Forms::getAllFormPages($page_params); 82 | $page = CoreGeneral::loadField("page", "{$namespace}_form_page", 1, $namespace); // TODO... 83 | 84 | // one additional check: make sure the page they're attempting to look at is permitted. They have to pass 85 | // through each page in order to prevent people bypassing any field validation 86 | $page = FormGenerator::verifyPageNumber($page, $all_pages, $namespace); 87 | 88 | $next_page = $page + 1; 89 | $page_info = $all_pages[$page - 1]; 90 | $page_type = $page_info["page_type"]; 91 | 92 | 93 | $post_values = array(); 94 | $params = array(); 95 | if ($page_type == "thanks") { 96 | FormGenerator::clearFormBuilderFormSessions($namespace); 97 | } else { 98 | $params = array( 99 | "namespace" => $namespace, 100 | "published_form_id" => $published_form_id, 101 | "submission_id" => $submission_id, 102 | "config" => $config, 103 | "page" => $page, 104 | "page_type" => $page_type, 105 | "form_id" => $form_id, 106 | "view_id" => $view_id, 107 | "submit_button" => "form_tools_continue", 108 | "next_page" => "$filename?page=$next_page", 109 | "form_data" => $_POST, 110 | "file_data" => $_FILES, 111 | "no_sessions_url" => "$filename?page=1" 112 | ); 113 | 114 | // we need to finalize the submission on the penultimate page. This can mean either the Review page or 115 | // the final form page if there's no Review page 116 | $num_pages = count($all_pages); 117 | if ($page_type == "review" || ($page >= $num_pages - 1)) { 118 | $params["finalize"] = true; 119 | } 120 | 121 | // just in case 122 | if ($page == $num_pages && isset($params["form_data"]["form_tools_continue"])) { 123 | $params["next_page"] = ""; 124 | } 125 | 126 | list($g_success, $g_message) = FormGenerator::processFormBuilderPage($params); 127 | 128 | // if there were any validation errors, pass the error along to the page. It'll use it to know not to 129 | // redirecting and to show the error message 130 | if (!$g_success) { 131 | $config["validation_error"] = $g_message; 132 | } 133 | } 134 | 135 | // now generate and display the form 136 | FormGenerator::generateFormPage($config, $page, $submission_id); 137 | -------------------------------------------------------------------------------- /form_resources/css.php: -------------------------------------------------------------------------------- 1 | false)); 21 | Modules::includeModule("form_builder"); 22 | 23 | $resource_id = $_GET["resource_id"]; 24 | $source = (isset($_GET["source"]) && $_GET["source"] == "sessions") ? "sessions" : "database"; 25 | 26 | $resource_info = Resources::getResource($resource_id); 27 | $set_id = $resource_info["template_set_id"]; 28 | $css = $resource_info["content"]; 29 | 30 | $placeholders = Placeholders::getPlaceholders($set_id); 31 | $placeholder_hash = array(); 32 | foreach ($placeholders as $placeholder_info) { 33 | $placeholder_hash[$placeholder_info["placeholder_id"]] = $placeholder_info["placeholder"]; 34 | } 35 | 36 | $config = array(); 37 | $smarty = General::createNewSmartyInstance(); 38 | 39 | $P = array(); 40 | if ($source == "sessions") { 41 | if (Core::getSessionType() == "database") { 42 | $sess = new DatabaseSessions(Core::$db, Core::getSessionSavePath()); 43 | } 44 | if (!empty($g_session_save_path)) { 45 | session_save_path($g_session_save_path); 46 | } 47 | 48 | session_start(); 49 | header("Cache-control: private"); 50 | header("Content-Type: text/html; charset=utf-8"); 51 | 52 | $placeholder_id_to_values = $_SESSION["ft"]["form_builder"]["placeholders"]; 53 | 54 | foreach ($placeholder_id_to_values as $placeholder_id => $value) { 55 | if (!isset($placeholder_hash[$placeholder_id])) { 56 | continue; 57 | } 58 | $placeholder = $placeholder_hash[$placeholder_id]; 59 | 60 | // TODO multi-select + checkboxes... 61 | $P[$placeholder] = $value; 62 | } 63 | } else { 64 | $config = Forms::getFormConfiguration($_GET["published_form_id"]); 65 | foreach ($config["placeholders"] as $placeholder_info) { 66 | $curr_placeholder_id = $placeholder_info["placeholder_id"]; 67 | $val = $placeholder_info["placeholder_value"]; 68 | 69 | if (!isset($placeholder_hash[$curr_placeholder_id])) { 70 | continue; 71 | } 72 | 73 | $placeholder = $placeholder_hash[$curr_placeholder_id]; 74 | $P[$placeholder] = $val; 75 | } 76 | } 77 | 78 | $smarty->assign("P", $P); 79 | $smarty->assign("eval_str", $css); 80 | 81 | header("Content-Type: text/css"); 82 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 83 | 84 | echo $smarty->fetch("../../modules/form_builder/smarty_plugins/eval.tpl"); 85 | -------------------------------------------------------------------------------- /form_resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /form_resources/js.php: -------------------------------------------------------------------------------- 1 | false)); 20 | Modules::includeModule("form_builder"); 21 | 22 | $resource_id = $_GET["resource_id"]; 23 | $source = (isset($_GET["source"]) && $_GET["source"] == "sessions") ? "sessions" : "database"; 24 | 25 | $resource_info = Resources::getResource($resource_id); 26 | $set_id = $resource_info["template_set_id"]; 27 | $css = $resource_info["content"]; 28 | 29 | $placeholders = Placeholders::getPlaceholders($set_id); 30 | $placeholder_hash = array(); 31 | foreach ($placeholders as $placeholder_info) { 32 | $placeholder_hash[$placeholder_info["placeholder_id"]] = $placeholder_info["placeholder"]; 33 | } 34 | 35 | $config = array(); 36 | $smarty = General::createNewSmartyInstance(); 37 | 38 | $P = array(); 39 | if ($source == "sessions") { 40 | if (Core::getSessionType() == "database") { 41 | $sess = new DatabaseSessions(Core::$db, Core::getSessionSavePath()); 42 | } 43 | if (!empty($g_session_save_path)) { 44 | session_save_path($g_session_save_path); 45 | } 46 | 47 | session_start(); 48 | header("Cache-control: private"); 49 | header("Content-Type: text/html; charset=utf-8"); 50 | 51 | $placeholder_id_to_values = $_SESSION["ft"]["form_builder"]["placeholders"]; 52 | 53 | foreach ($placeholder_id_to_values as $placeholder_id => $value) { 54 | if (!isset($placeholder_hash[$placeholder_id])) { 55 | continue; 56 | } 57 | $placeholder = $placeholder_hash[$placeholder_id]; 58 | 59 | // TODO multi-select + checkboxes... 60 | $P[$placeholder] = $value; 61 | } 62 | } else { 63 | $config = Forms::getFormConfiguration($_GET["published_form_id"]); 64 | foreach ($config["placeholders"] as $placeholder_info) { 65 | $curr_placeholder_id = $placeholder_info["placeholder_id"]; 66 | $val = $placeholder_info["placeholder_value"]; 67 | 68 | if (!isset($placeholder_hash[$curr_placeholder_id])) { 69 | continue; 70 | } 71 | 72 | $placeholder = $placeholder_hash[$curr_placeholder_id]; 73 | $P[$placeholder] = $val; 74 | } 75 | } 76 | 77 | $smarty->assign("P", $P); 78 | $smarty->assign("eval_str", $css); 79 | 80 | header("Content-Type: text/javascript"); 81 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 82 | 83 | echo $smarty->fetch("../../modules/form_builder/smarty_plugins/eval.tpl"); 84 | -------------------------------------------------------------------------------- /help.php: -------------------------------------------------------------------------------- 1 | displayPage("templates/help.tpl"); 8 | -------------------------------------------------------------------------------- /images/builder_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/builder_logo.png -------------------------------------------------------------------------------- /images/dialog_header_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/dialog_header_bg.png -------------------------------------------------------------------------------- /images/dialog_option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/dialog_option.png -------------------------------------------------------------------------------- /images/dialog_selected_option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/dialog_selected_option.png -------------------------------------------------------------------------------- /images/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/icon16.png -------------------------------------------------------------------------------- /images/icon24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/icon24.png -------------------------------------------------------------------------------- /images/icon26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/icon26.png -------------------------------------------------------------------------------- /images/icon_form_builder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/icon_form_builder.png -------------------------------------------------------------------------------- /images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/loading.gif -------------------------------------------------------------------------------- /images/sidebar_section_loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/sidebar_section_loading.gif -------------------------------------------------------------------------------- /images/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formtools/module-form_builder/df2a9a70a7af6057783d2e3b748017fe5a48c84d/images/tip.png -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 11 | $LANG = Core::$L; 12 | $root_url = Core::getRootUrl(); 13 | 14 | $sortable_id = "template_set_table"; 15 | 16 | // hidden feature, used for development only 17 | if (isset($_GET["generate"])) { 18 | echo TemplateSets::createDefaultTemplateSetFile(); 19 | exit; 20 | } 21 | 22 | if (isset($_GET["export"]) && is_numeric($_GET["export"])) { 23 | echo TemplateSets::generateTemplateSetExportFile($_GET["export"]); 24 | exit; 25 | } 26 | 27 | $success = true; 28 | $message = ""; 29 | if (isset($_GET["import"])) { 30 | list($success, $message) = TemplateSets::importTemplateSet($_GET["import"], $L); 31 | } 32 | if (isset($_GET["delete"])) { 33 | list($success, $message) = TemplateSets::deleteTemplateSet($_GET["delete"], $L); 34 | } 35 | if (isset($request["update_order"])) { 36 | $request["sortable_id"] = $sortable_id; 37 | list($success, $message) = TemplateSets::updateTemplateSetOrder($request, $L); 38 | } 39 | 40 | $template_sets = TemplateSets::getTemplateSets(false); 41 | 42 | // shame, but needed for the markup 43 | $updated_template_sets = array(); 44 | foreach ($template_sets as $template_set_info) { 45 | $set_id = $template_set_info["set_id"]; 46 | $template_set_info["usage"] = TemplateSets::getTemplateSetUsage($set_id); 47 | $updated_template_sets[] = $template_set_info; 48 | } 49 | 50 | $module_settings = $module->getSettings(); 51 | 52 | $page_vars = array( 53 | "g_success" => $success, 54 | "g_message" => $message, 55 | "sortable_id" => $sortable_id, 56 | "template_sets" => $updated_template_sets, 57 | "module_settings" => $module_settings, 58 | "js_messages" => array( 59 | "word_close", "word_yes", "word_no", "phrase_please_confirm" 60 | ), 61 | "module_js_messages" => array( 62 | "phrase_create_new_template_set", "validation_no_template_set_name", 63 | "confirm_delete_template_set", "confirm_delete_template_set" 64 | ) 65 | ); 66 | 67 | $page_vars["head_js"] =<<< END 68 | $(function() { 69 | fb_ns.init_create_new_template_set_dialog(); 70 | $(".info").bind("click", function() { 71 | ft.create_dialog({ 72 | title: "{$L["phrase_delete_template_set"]}", 73 | content: "{$L["text_delete_template_in_use"]}", 74 | popup_type: "info", 75 | width: 460, 76 | buttons: [{ 77 | text: "{$LANG["word_close"]}", 78 | click: function() { 79 | $(this).dialog("close"); 80 | } 81 | }] 82 | }); 83 | }); 84 | }); 85 | END; 86 | 87 | $module->displayPage("templates/index.tpl", $page_vars); 88 | -------------------------------------------------------------------------------- /lang/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /library.php: -------------------------------------------------------------------------------- 1 | getSettings(); 25 | 26 | $selected_templates = array(); 27 | $config_info = array(); 28 | $include_review_page = "yes"; 29 | $include_thanks_page_in_nav = "yes"; 30 | $is_online = "yes"; 31 | $is_published = "no"; 32 | $view_id = ""; 33 | $thankyou_page_content = $module_settings["default_thankyou_page_content"]; 34 | $form_offline_page_content = $module_settings["default_form_offline_page_content"]; 35 | $published_filename = ""; 36 | $published_folder_url = $module_settings["default_published_folder_url"]; 37 | $published_folder_path = $module_settings["default_published_folder_path"]; 38 | $review_page_title = $module_settings["review_page_title"]; 39 | $thankyou_page_title = $module_settings["thankyou_page_title"]; 40 | $offline_date = ""; 41 | 42 | // if we're editing an existing configuration, override all the defaults with whatever's been saved 43 | if (!empty($published_form_id)) { 44 | $config_info = Forms::getFormConfiguration($published_form_id); 45 | $is_published = $config_info["is_published"]; 46 | $is_online = $config_info["is_online"]; 47 | $set_id = $config_info["set_id"]; 48 | $view_id = $config_info["view_id"]; 49 | $include_review_page = $config_info["include_review_page"]; 50 | $include_thanks_page_in_nav = $config_info["include_thanks_page_in_nav"]; 51 | $thankyou_page_content = $config_info["thankyou_page_content"]; 52 | $form_offline_page_content = $config_info["form_offline_page_content"]; 53 | 54 | foreach ($config_info["templates"] as $template_info) { 55 | $selected_templates[$template_info["template_type"]] = $template_info["template_id"]; 56 | } 57 | $published_filename = preg_replace("/\.php$/", "", $config_info["filename"]); 58 | $published_folder_url = $config_info["folder_url"]; 59 | $published_folder_path = $config_info["folder_path"]; 60 | 61 | if (!is_null($config_info["offline_date"])) { 62 | // convert the datetime to a friendlier format 63 | list($date, $time) = explode(" ", $config_info["offline_date"]); 64 | list($year, $month, $day) = explode("-", $date); 65 | list($hours, $mins, $seconds) = explode(":", $time); 66 | $offline_date = "{$month}/{$day}/{$year} $hours:$mins"; 67 | } 68 | 69 | $review_page_title = $config_info["review_page_title"]; 70 | $thankyou_page_title = $config_info["thankyou_page_title"]; 71 | } else { 72 | // here, the admin is publishing a new form. There are no templates or other settings specified yet, so 73 | // we just pick the first set ID 74 | $set_id = TemplateSets::getFirstTemplateSetId(); 75 | if (empty($set_id)) { 76 | $major_error = $L["notify_no_complete_template"]; 77 | } 78 | 79 | $views = Views::getFormViews($form_id); 80 | if (!empty($views)) { 81 | $view_id = $views[0]["view_id"]; 82 | } 83 | } 84 | 85 | if (!Views::checkViewExists($view_id)) { 86 | $major_error = "Sorry, the View that was assigned to this form no longer exists. You will need to delete this form configuration and publish a new form."; 87 | } 88 | 89 | // calculate the page element heights and widths 90 | $default_width = $module_settings["form_builder_width"]; 91 | $default_height = $module_settings["form_builder_height"]; 92 | $sidebar_width = 260; 93 | $header_height = 34; 94 | $footer_height = 30; 95 | $iframe_header_height = 30; 96 | $iframe_width = $default_width - $sidebar_width; 97 | $content_height = $default_height - ($header_height + $footer_height); 98 | 99 | $page_vars = array(); 100 | $page_vars["allow_url_fopen"] = (ini_get("allow_url_fopen") == "1"); 101 | $page_vars["major_error"] = $major_error; 102 | $page_vars["published_form_id"] = $published_form_id; // 103 | $page_vars["include_review_page"] = $include_review_page; 104 | $page_vars["include_thanks_page_in_nav"] = $include_thanks_page_in_nav; 105 | $page_vars["is_published"] = $is_published; 106 | $page_vars["is_online"] = $is_online; 107 | $page_vars["thankyou_page_content"] = $thankyou_page_content; 108 | $page_vars["form_offline_page_content"] = $form_offline_page_content; 109 | $page_vars["module_settings"] = $module_settings; 110 | $page_vars["header_height"] = $header_height; 111 | $page_vars["footer_height"] = $footer_height; 112 | $page_vars["content_height"] = $content_height; 113 | $page_vars["sidebar_width"] = $sidebar_width; 114 | $page_vars["iframe_width"] = $iframe_width; 115 | $page_vars["iframe_header_height"] = $iframe_header_height; 116 | $page_vars["published_filename"] = $published_filename; 117 | $page_vars["published_folder_url"] = $published_folder_url; 118 | $page_vars["published_folder_path"] = $published_folder_path; 119 | $page_vars["offline_date"] = $offline_date; 120 | $page_vars["review_page_title"] = $review_page_title; 121 | $page_vars["thankyou_page_title"] = $thankyou_page_title; 122 | 123 | if (empty($major_error)) { 124 | $placeholders = Placeholders::getPlaceholders($set_id); 125 | $page_vars["form_id"] = $form_id; 126 | $page_vars["view_id"] = $view_id; 127 | $page_vars["set_id"] = $set_id; 128 | $page_vars["selected_templates"] = $selected_templates; 129 | $page_vars["placeholders"] = $placeholders; 130 | $page_vars["js"] = "g.view_tabs = [" . General::getNumViewTabsJs($form_id) . "];"; 131 | 132 | $placeholder_hash = array(); 133 | if (empty($config_info)) { 134 | foreach ($placeholders as $placeholder_info) { 135 | $placeholder_hash[$placeholder_info["placeholder_id"]] = $placeholder_info["default_value"]; 136 | } 137 | } else { 138 | foreach ($config_info["placeholders"] as $placeholder_info) { 139 | $placeholder_hash[$placeholder_info["placeholder_id"]] = $placeholder_info["placeholder_value"]; 140 | } 141 | } 142 | 143 | $page_vars["placeholder_hash"] = $placeholder_hash; 144 | } 145 | 146 | $module->displayPage("templates/preview.tpl", $page_vars); 147 | -------------------------------------------------------------------------------- /preview_form.php: -------------------------------------------------------------------------------- 1 | false)); 20 | } 21 | 22 | // convert the placeholder info in the request into a simple hash of placeholder_id => value 23 | $placeholders = array(); 24 | $placeholder_ids = isset($request["placeholder_ids"]) ? $request["placeholder_ids"] : array(); 25 | foreach ($placeholder_ids as $placeholder_id) { 26 | // note: this will either store a string or an array (checkboxes / multi-select) 27 | $placeholders[$placeholder_id] = (isset($request["placeholder_{$placeholder_id}"])) ? $request["placeholder_{$placeholder_id}"] : ""; 28 | } 29 | 30 | // we store the placeholders in sessions so that any resources (CSS/JS) in Smarty format can access the info. Normally it's just 31 | // pulled from the database 32 | $_SESSION["ft"]["form_builder"]["placeholders"] = $placeholders; 33 | 34 | // creating a new array here isn't strictly needed, since we COULD just tweak and pass along the POST request, 35 | // but it helps to see precisely what info is being sent 36 | $settings = array( 37 | 38 | // used by the generate function for things like overriding the default form submit, and 39 | // other functionality when in preview mode 40 | "mode" => "preview", // "preview" / "live" 41 | 42 | // main info 43 | "form_id" => $request["form_id"], 44 | "view_id" => $request["view_id"], 45 | "submission_id" => "", // N/A during the form building process 46 | "template_set_id" => $request["template_set_id"], 47 | "page" => $request["page"], 48 | "include_review_page" => isset($request["include_review_page"]) ? true : false, 49 | "include_thanks_page_in_nav" => isset($request["include_thanks_page_in_nav"]) ? true : false, 50 | "is_online" => isset($request["is_online"]) ? true : false, 51 | 52 | // the thankyou and form offline page content 53 | "thankyou_page_content" => $request["thankyou_page_content"], 54 | "form_offline_page_content" => $request["form_offline_page_content"], 55 | 56 | // other 57 | "offline_date" => $request["offline_date"], 58 | "review_page_title" => $request["review_page_title"], 59 | "thankyou_page_title" => $request["thankyou_page_title"], 60 | 61 | // templates 62 | "page_layout_template_id" => $request["page_layout_template_id"], 63 | "header_template_id" => $request["header_template_id"], 64 | "footer_template_id" => $request["footer_template_id"], 65 | "navigation_template_id" => $request["navigation_template_id"], 66 | "continue_block_template_id" => $request["continue_block_template_id"], 67 | "error_message_template_id" => $request["error_message_template_id"], 68 | "form_page_template_id" => $request["form_page_template_id"], 69 | "form_offline_page_template_id" => $request["form_offline_page_template_id"], 70 | "review_page_template_id" => $request["review_page_template_id"], 71 | "thankyou_page_template_id" => $request["thankyou_page_template_id"], 72 | 73 | // placeholders 74 | "placeholders" => $placeholders, 75 | ); 76 | 77 | echo FormGenerator::generateForm($settings); 78 | 79 | -------------------------------------------------------------------------------- /published/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /schemas/README.md: -------------------------------------------------------------------------------- 1 | ## Template Set Schema 2 | 3 | As of Form Builder 2.0.0, the source data for the Template Sets have been moved to standalone JSON files, found in the 4 | `[FT Root]/modules/form_builder/default_template_sets/` folder. The structure of these files is now determined by the 5 | `schema.json` file found in this folder. It's a standardized format, defined by [json-schema.org](http://json-schema.org/). 6 | 7 | These files each contain a single, complete Template Set (i.e. the contents of a Form Builder template, allowing you to 8 | generate forms out of it that use its styles and appearance). 9 | 10 | ### Purpose of Schema Files 11 | 12 | The long term goal of Form Tools is to be able to share _configurations_ of all forms, Option Lists, View configurations, 13 | user configs, email templates - _everything and anything_. This will allow users to install not just Form Tools and the 14 | modules but any pre-existing data configuration, significantly cutting down on configuration time and promoting sharing 15 | of great-looking forms. 16 | 17 | In order to do that all data has to be well defined in known structures so validation may be performed to confirm 18 | data integrity. That's the purpose of these schema files. 19 | 20 | 21 | ### Example Template Set Schema 22 | 23 | N.B. I've annotated this to explain each property. Note that valid JSON cannot contain comments! 24 | 25 | ```javascript 26 | { 27 | // the schema version that this JSON file adheres to. If the format of the file fails to match the schema version 28 | // specified here, the Form Builder will complain when it attempts to import the Template Set. Over time, if we need 29 | // to add/remove content to Template Sets the structure of the document may change, and this value would need to be 30 | // updated to match the appropriate structure. 31 | "schema_version": "1.0.0", 32 | 33 | // whatever human-friendly name you want to give you Template Set 34 | "template_set_name": "Template set Name", 35 | 36 | // the Template Set version. Any changes to the content of the Template Set JSON file should always mean this 37 | // value gets incremented. Also rename the file to include the version there as well (it just removed any ambiguity) 38 | "template_set_version": "1.0.0", 39 | 40 | // a description of the template set to give users a rough idea of what to expect 41 | "description": "blurb here", 42 | 43 | // the time the file was last updated 44 | "last_updated": "2017-11-18 12:00:00", 45 | 46 | // this contains all the templates used in generating the template set. The property names are all required and must 47 | // contain at least one template in each. When a particular template type has > 1 option, the user is presented 48 | // with the option to choose what they want via the UI. Otherwise it's just prescribed for them. Note that the arrays 49 | // of each template type are ordered: the first item is the template type that will be selected by default when 50 | // creating new Form Builder forms. The structure of the content is the same for each section, so I've omitted 51 | // the details for brevity 52 | "templates": { 53 | "header": [ 54 | { 55 | "template_name": "Name of header template", 56 | "content": "smarty content here" 57 | }, 58 | { 59 | "template_name": "Name of second header template", 60 | "content": "smarty content here" 61 | } 62 | ], 63 | "footer": [ 64 | // ... 65 | ], 66 | "form_page": [ 67 | // ... 68 | ], 69 | "review_page": [ 70 | // ... 71 | ], 72 | "thankyou_page": [ 73 | // ... 74 | ], 75 | "form_offline_page": [ 76 | // ... 77 | ], 78 | "continue_block": [ 79 | // ... 80 | ], 81 | "navigation": [ 82 | // ... 83 | ], 84 | "error_message": [ 85 | // ... 86 | ] 87 | }, 88 | "resources": { 89 | "css": [ 90 | { 91 | "resource_name": "More styles", 92 | "placeholder": "styles", 93 | "content": "CSS here" 94 | } 95 | ], 96 | "js": [ 97 | { 98 | "resource_name": "Javascript", 99 | "placeholder": "js", 100 | "content": "JS here..." 101 | } 102 | ] 103 | }, 104 | "placeholders": [ 105 | { 106 | "placeholder_label": "Colour", 107 | "placeholder": "colour", 108 | "field_type": "select", 109 | "field_orientation": "na", 110 | "default_value": "Red", 111 | "options": [ 112 | { 113 | "option_text": "Red" 114 | }, 115 | { 116 | "option_text": "Blue" 117 | } 118 | ] 119 | } 120 | ] 121 | } 122 | ``` 123 | -------------------------------------------------------------------------------- /schemas/template_set-1.0.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Template Set Schemas", 3 | "schema_version": "1.0.0", 4 | "$schema": "http://json-schema.org/draft-04/schema#", 5 | "type": "object", 6 | "properties": { 7 | "schema_version": { 8 | "type": "string", 9 | "oneOf": [ 10 | { 11 | "type": "string", 12 | "enum": ["1.0.0"] 13 | } 14 | ] 15 | }, 16 | "template_set_name": { 17 | "type": "string" 18 | }, 19 | "template_set_version": { 20 | "type": "string" 21 | }, 22 | "description": { 23 | "type": "string" 24 | }, 25 | "last_updated": { 26 | "type": "string" 27 | }, 28 | "templates": { 29 | "type": "object", 30 | "properties": { 31 | "page_layout": { 32 | "type": "array", 33 | "items": { 34 | "$ref": "#/definitions/template" 35 | } 36 | }, 37 | "header": { 38 | "type": "array", 39 | "items": { 40 | "$ref": "#/definitions/template" 41 | } 42 | }, 43 | "footer": { 44 | "type": "array", 45 | "items": { 46 | "$ref": "#/definitions/template" 47 | } 48 | }, 49 | "form_page": { 50 | "type": "array", 51 | "items": { 52 | "$ref": "#/definitions/template" 53 | } 54 | }, 55 | "review_page": { 56 | "type": "array", 57 | "items": { 58 | "$ref": "#/definitions/template" 59 | } 60 | }, 61 | "thankyou_page": { 62 | "type": "array", 63 | "items": { 64 | "$ref": "#/definitions/template" 65 | } 66 | }, 67 | "form_offline_page": { 68 | "type": "array", 69 | "items": { 70 | "$ref": "#/definitions/template" 71 | } 72 | }, 73 | "continue_block": { 74 | "type": "array", 75 | "items": { 76 | "$ref": "#/definitions/template" 77 | } 78 | }, 79 | "navigation": { 80 | "type": "array", 81 | "items": { 82 | "$ref": "#/definitions/template" 83 | } 84 | }, 85 | "error_message": { 86 | "type": "array", 87 | "items": { 88 | "$ref": "#/definitions/template" 89 | } 90 | } 91 | }, 92 | "required": [ 93 | "page_layout", 94 | "header", 95 | "footer", 96 | "form_page", 97 | "review_page", 98 | "thankyou_page", 99 | "form_offline_page", 100 | "continue_block", 101 | "navigation", 102 | "error_message" 103 | ] 104 | }, 105 | 106 | "resources": { 107 | "type": "object", 108 | "properties": { 109 | "css": { 110 | "type": "array" 111 | }, 112 | "js": { 113 | "type": "array" 114 | } 115 | } 116 | }, 117 | "placeholders": { 118 | "type": "array", 119 | "items": { 120 | "type": "object", 121 | "properties": { 122 | "placeholder_label": { 123 | "type": "string" 124 | }, 125 | "placeholder": { 126 | "type": "string" 127 | }, 128 | "field_type": { 129 | "type": "string", 130 | "enum": ["textbox", "textarea", "radios", "checkboxes", "select", "multi-select"] 131 | }, 132 | "field_orientation": { 133 | "type": "string", 134 | "enum": ["na", "horizontal", "vertical"] 135 | }, 136 | "default_value": { 137 | "type": "string" 138 | }, 139 | "options": { 140 | "type": "array", 141 | "items": { 142 | "type": "object", 143 | "properties": { 144 | "option_text": { 145 | "type": "string" 146 | } 147 | } 148 | } 149 | } 150 | }, 151 | "required": [ 152 | "placeholder_label", 153 | "placeholder", 154 | "field_type", 155 | "field_orientation", 156 | "default_value" 157 | ] 158 | } 159 | } 160 | }, 161 | "definitions": { 162 | "template": { 163 | "type": "object", 164 | "properties": { 165 | "template_name": { 166 | "type": "string" 167 | }, 168 | "content": { 169 | "type": "string" 170 | } 171 | }, 172 | "required": [ 173 | "template_name", 174 | "content" 175 | ] 176 | } 177 | }, 178 | "required": [ 179 | "schema_version", 180 | "template_set_name", 181 | "template_set_version", 182 | "description", 183 | "last_updated", 184 | "templates" 185 | ] 186 | } 187 | -------------------------------------------------------------------------------- /scripts/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/manage_forms.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $(".publish_tab_offline_date").bind("click", function() { 3 | var content = g.mod_messages.notify_form_offline_message.replace(/%offline_time%/, this.innerHTML); 4 | content = content.replace(/%current_time%/, g.current_server_time); 5 | 6 | ft.create_dialog({ 7 | title: g.mod_messages.phrase_form_offline_date, 8 | content: content, 9 | width: 460, 10 | buttons: [{ 11 | text: g.messages["word_close"], 12 | click: function() { $(this).dialog("close"); } 13 | }] 14 | }); 15 | }); 16 | }); 17 | 18 | var fb_ns = {}; 19 | fb_ns.delete_form_configuration_dialog = $("
"); 20 | 21 | 22 | /** 23 | * Called when the user selects a form from one of the dropdowns in the first column. It shows 24 | * the appropriate View content in the second column. 25 | */ 26 | fb_ns.select_form = function(form_id) { 27 | if (form_id == "") { 28 | $("#view_id")[0].options.length = 0; 29 | $("#view_id")[0].options[0] = new Option(g.messages["phrase_please_select_form"], ""); 30 | $("#view_id").attr("disabled", "disabled"); 31 | return false; 32 | } else { 33 | $("#view_id").attr("disabled", ""); 34 | fb_ns.populate_view_dropdown("view_id", form_id); 35 | } 36 | return false; 37 | } 38 | 39 | 40 | /** 41 | * Populates a dropdown element with a list of Views including a "Please Select" default 42 | * option. 43 | */ 44 | fb_ns.populate_view_dropdown = function(element_id, form_id) { 45 | var form_index = null; 46 | for (var i=0; igetLangStrings(); 11 | $LANG = Core::$L; 12 | 13 | $page = Modules::loadModuleField("form_builder", "page", "tab", "main"); 14 | $php_self = General::getCleanPhpSelf(); 15 | 16 | $tabs = array( 17 | "main" => array( 18 | "tab_label" => $LANG["word_main"], 19 | "tab_link" => "$php_self?page=main" 20 | ), 21 | "thanks" => array( 22 | "tab_label" => $L["phrase_thankyou_page"], 23 | "tab_link" => "$php_self?page=thanks" 24 | ), 25 | "form_offline" => array( 26 | "tab_label" => $L["phrase_offline_forms"], 27 | "tab_link" => "$php_self?page=form_offline" 28 | ) 29 | ); 30 | 31 | $page_vars = array( 32 | "page" => $page, 33 | "tabs" => $tabs, 34 | "allow_url_fopen" => ini_get("allow_url_fopen") == "1" 35 | ); 36 | 37 | // load the appropriate code pages 38 | switch ($page) { 39 | case "main": 40 | require("tab_settings_main.php"); 41 | break; 42 | case "thanks": 43 | require("tab_settings_thanks.php"); 44 | break; 45 | case "form_offline": 46 | require("tab_settings_form_offline.php"); 47 | break; 48 | default: 49 | require("tab_settings_main.php"); 50 | break; 51 | } 52 | -------------------------------------------------------------------------------- /share/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /smarty_plugins/eval.tpl: -------------------------------------------------------------------------------- 1 | {{eval var=$eval_str}} 2 | -------------------------------------------------------------------------------- /smarty_plugins/function.captcha.php: -------------------------------------------------------------------------------- 1 |
You need to install the Form Tools API to use the {{captcha}} tag.
"; 16 | return; 17 | } 18 | 19 | require_once(__DIR__ . "/../../../global/api/API.class.php"); 20 | 21 | $form_namespace = $smarty->getTemplateVars("namespace"); 22 | 23 | // if the user has already passed this CAPTCHA, add nothing to the page! 24 | if (isset($_SESSION[$form_namespace]["passed_captcha"])) { 25 | return; 26 | } 27 | 28 | $_SESSION[$form_namespace]["has_captcha"] = true; 29 | 30 | $api = $smarty->getTemplateVars("api"); 31 | $api->displayCaptcha(); 32 | } 33 | -------------------------------------------------------------------------------- /smarty_plugins/function.code_block.php: -------------------------------------------------------------------------------- 1 | assign("eval_str", $template_info["content"]); 25 | return $smarty->fetch("../../modules/form_builder/smarty/eval.tpl"); 26 | } 27 | -------------------------------------------------------------------------------- /smarty_plugins/function.continue_block.php: -------------------------------------------------------------------------------- 1 | getTemplateVars("templates"); 12 | $smarty->assign("eval_str", $template_info["continue_block"]["content"]); 13 | return $smarty->fetch("../../modules/form_builder/smarty_plugins/eval.tpl"); 14 | } 15 | -------------------------------------------------------------------------------- /smarty_plugins/function.display_placeholder_field_type.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 11 | echo Placeholders::generateTemplateSetPlaceholdersHtml($params["placeholders"], $params["placeholder_hash"], $L); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /smarty_plugins/function.display_template_set_templates.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 10 | echo Templates::generateTemplateSetTemplatesHtml($params["set_id"], $L, $params["selected_templates"]); 11 | } 12 | -------------------------------------------------------------------------------- /smarty_plugins/function.display_template_set_type.php: -------------------------------------------------------------------------------- 1 | $vals) { 14 | $found = false; 15 | foreach ($vals as $section_key => $section_name) { 16 | if ($section_key == $type) { 17 | echo "$section_name"; 18 | $found = true; 19 | break; 20 | } 21 | } 22 | if ($found) { 23 | break; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /smarty_plugins/function.display_template_set_usage.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 16 | 17 | $set_id = $params["set_id"]; 18 | 19 | $results = TemplateSets::getTemplateSetUsage($set_id); 20 | 21 | if (empty($results)) { 22 | echo "{$L["phrase_not_used"]}"; 23 | } else { 24 | echo ""; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /smarty_plugins/function.display_template_type.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 11 | $template_types = TemplateSets::getTemplateTypes(); 12 | 13 | $type = $params["type"]; 14 | 15 | foreach ($template_types as $group_name => $vals) { 16 | $found = false; 17 | foreach ($vals as $section_key => $section_name) { 18 | if ($section_key == $type) { 19 | $section_name = General::evalSmartyString("{\$" . $section_name . "}", $L); 20 | echo "$section_name"; 21 | $found = true; 22 | break; 23 | } 24 | } 25 | if ($found) { 26 | break; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smarty_plugins/function.display_template_usage.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 15 | 16 | $usage = $params["usage"]; 17 | 18 | if (empty($usage)) { 19 | echo "{$L["phrase_not_used"]}"; 20 | } else { 21 | echo ""; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /smarty_plugins/function.error_message.php: -------------------------------------------------------------------------------- 1 | getTemplateVars("templates"); 12 | $smarty->assign("eval_str", $template_info["error_message"]["content"]); 13 | return $smarty->fetch("../../modules/form_builder/smarty_plugins/eval.tpl"); 14 | } 15 | -------------------------------------------------------------------------------- /smarty_plugins/function.footer.php: -------------------------------------------------------------------------------- 1 | getTemplateVars("templates"); 12 | $smarty->assign("eval_str", $template_info["footer"]["content"]); 13 | return $smarty->fetch("../../modules/form_builder/smarty_plugins/eval.tpl"); 14 | } 15 | -------------------------------------------------------------------------------- /smarty_plugins/function.form_builder_edit_link.php: -------------------------------------------------------------------------------- 1 | Publish 9 | * tab within Form Tools and opens up the Form Builder window. 10 | * 11 | * Note: the link only ever shows up if the user is already logged in as an administrator. 12 | * 13 | * @param array $params 14 | * @param array $smarty 15 | */ 16 | function smarty_function_form_builder_edit_link($params, &$smarty) 17 | { 18 | if (!Core::$user->isAdmin()) { 19 | return; 20 | } 21 | 22 | if ($smarty->getTemplateVars("mode") != "live") { 23 | return; 24 | } 25 | $root_url = Core::getRootUrl(); 26 | 27 | $published_form_id = $smarty->getTemplateVars("published_form_id"); 28 | $form_id = $smarty->getTemplateVars("form_id"); 29 | 30 | $action = Modules::getModuleSettings("edit_form_builder_link_action", "form_builder"); 31 | $target = ($action == "new_window") ? "target=\"_blank\"" : ""; 32 | 33 | echo "EDIT IN FORM BUILDER"; 34 | } 35 | -------------------------------------------------------------------------------- /smarty_plugins/function.header.php: -------------------------------------------------------------------------------- 1 | getTemplateVars("templates"); 12 | $smarty->assign("eval_str", $template_info["header"]["content"]); 13 | return $smarty->fetch("../../modules/form_builder/smarty_plugins/eval.tpl"); 14 | } 15 | -------------------------------------------------------------------------------- /smarty_plugins/function.navigation.php: -------------------------------------------------------------------------------- 1 | getTemplateVars("templates"); 12 | 13 | if (empty($template_info["content"])) { 14 | $template_info["content"] = " "; 15 | } 16 | 17 | $smarty->assign("eval_str", $template_info["navigation"]["content"]); 18 | return $smarty->fetch("../../modules/form_builder/smarty_plugins/eval.tpl"); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /smarty_plugins/function.page.php: -------------------------------------------------------------------------------- 1 | getTemplateVars(); 21 | $form_id = $template_vars["form_id"]; 22 | $view_id = $template_vars["view_id"]; 23 | $current_page = $template_vars["current_page"]; 24 | 25 | // this is only set for when the form is actually in use 26 | $submission_id = isset($template_vars["submission_id"]) ? $template_vars["submission_id"] : ""; 27 | 28 | // a little odd, but we renamed "template_type" to "page_type" here, because it's a little clearer. 29 | // We already know we're dealing with a page 30 | $template_info = $template_vars["templates"]["page"]; 31 | $page_type = $template_info["template_type"]; 32 | 33 | // form and review pages are special: they get info about the view fields 34 | $get_view_field_info = false; 35 | $validation_js = ""; 36 | 37 | if ($page_type == "form_page") { 38 | // workaround for Views that didn't arrange their fields into tabs 39 | $tabs = ViewTabs::getViewTabs($view_id, true); 40 | if (empty($tabs)) { 41 | $current_page = ""; 42 | } 43 | 44 | $grouped_fields = ViewFields::getGroupedViewFields($view_id, $current_page, $form_id, $submission_id); 45 | 46 | // if the user just failed server-side validation, merge in whatever info was in the POST request with what's in $grouped_fields 47 | if (isset($template_vars["validation_error"]) && !empty($template_vars["validation_error"])) { 48 | $grouped_fields = FieldValidation::mergeFormSubmission($grouped_fields, $_POST); 49 | } 50 | 51 | // get whatever validation is needed for this page 52 | $validation_js = FieldValidation::generateSubmissionJsValidation($grouped_fields, array( 53 | "form_element_id" => "ts_form_element_id", 54 | "custom_error_handler" => "fb_validate" 55 | )); 56 | 57 | $get_view_field_info = true; 58 | } else { 59 | if ($page_type == "review_page") { 60 | $grouped_fields = ViewFields::getGroupedViewFields($view_id, "", $form_id, $submission_id); 61 | $get_view_field_info = true; 62 | } 63 | } 64 | 65 | if ($get_view_field_info) { 66 | // remove all system fields and fields marked as non-editable 67 | $updated_grouped_fields = array(); 68 | foreach ($grouped_fields as $field_info) { 69 | $group = $field_info["group"]; 70 | $fields = array(); 71 | foreach ($field_info["fields"] as $field_info) { 72 | if ($field_info["is_system_field"] == "yes" || $field_info["is_editable"] == "no") { 73 | continue; 74 | } 75 | 76 | // a hack for a complicated scenario. The {display_custom_field} template doesn't set the settings 77 | // param like with the main program, so we re-use the {edit_custom_field} template and just tell it 78 | // that nothing is editable 79 | if ($page_type == "review_page") { 80 | $field_info["is_editable"] = "no"; 81 | $field_info["submission_info"] = array(); 82 | $field_info["submission_info"]["value"] = isset($field_info["submission_value"]) ? $field_info["submission_value"] : ""; 83 | } 84 | 85 | $fields[] = $field_info; 86 | } 87 | 88 | if (!empty($fields)) { 89 | $updated_grouped_fields[] = array( 90 | "group" => $group, 91 | "fields" => $fields 92 | ); 93 | } 94 | } 95 | 96 | $field_types = FieldTypes::get(true); 97 | $settings = Settings::get(); 98 | 99 | $smarty->assign("grouped_fields", $updated_grouped_fields); 100 | $smarty->assign("field_types", $field_types); 101 | $smarty->assign("settings", $settings); 102 | } 103 | 104 | if (empty($template_info["content"])) { 105 | $template_info["content"] = " "; 106 | } 107 | 108 | $smarty->left_delimiter = '{{'; 109 | $smarty->right_delimiter = '}}'; 110 | 111 | $smarty->assign("eval_str", $template_info["content"]); 112 | $smarty->assign("page_name", $template_vars["nav_pages"][$current_page - 1]["page_name"]); 113 | $smarty->assign("page_type", $page_type); 114 | 115 | // used in the form action attribute. This'll cause nice "/" paths for index.php to get redirected to index.php on 116 | // the next redirect, which is a pity 117 | $smarty->assign("page_url", basename($_SERVER["SCRIPT_NAME"])); 118 | 119 | $page = $smarty->fetch("../../modules/form_builder/smarty_plugins/eval.tpl"); 120 | if (!empty($validation_js)) { 121 | $error_handler_js = General::getFormValidationCustomErrorHandlerJs(); 122 | $page = "" . $page; 123 | } 124 | 125 | return $page; 126 | } 127 | -------------------------------------------------------------------------------- /smarty_plugins/function.template_sets.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 12 | 13 | $name_id = $params["name_id"]; 14 | $class = isset($params["class"]) ? $params["class"] : ""; 15 | $default = isset($params["default"]) ? $params["default"] : ""; 16 | $only_show_complete = isset($params["only_return_complete"]) ? $params["only_return_complete"] : true; 17 | $is_base_on_dropdown = isset($params["is_base_on_dropdown"]) ? $params["is_base_on_dropdown"] : false; 18 | 19 | $template_sets = TemplateSets::getTemplateSets($only_show_complete); 20 | 21 | $lines = array(""; 40 | 41 | echo implode("\n", $lines); 42 | } 43 | -------------------------------------------------------------------------------- /smarty_plugins/function.template_type_dropdown.php: -------------------------------------------------------------------------------- 1 | {$headers[0]["template_name"]}"; 21 | } else { 22 | echo ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /smarty_plugins/function.template_types.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 16 | 17 | if (empty($params["name_id"])) { 18 | $smarty->trigger_error("assign: missing 'name_id' parameter. This is used to give the select field a name and id value."); 19 | return; 20 | } 21 | $name_id = $params["name_id"]; 22 | $class = isset($params["class"]) ? $params["class"] : ""; 23 | $default_value = (isset($params["default"])) ? $params["default"] : ""; 24 | 25 | $lines = array( 26 | ""; 42 | 43 | echo implode("\n", $lines); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /smarty_plugins/modifier.in.php: -------------------------------------------------------------------------------- 1 | {$L.notify_no_placeholders} 3 | {/if} 4 | 5 | {foreach from=$placeholders item=info} 6 | {assign var=pid value=$info.placeholder_id} 7 | 8 | 9 |
10 | 11 |
12 | {if $info.field_type == "textbox"} 13 | 14 | {elseif $info.field_type == "textarea"} 15 | 16 | {elseif $info.field_type == "password"} 17 | 18 | {elseif $info.field_type == "radios"} 19 | 20 | {foreach from=$info.options key=k2 item=option name=row} 21 | {assign var="count" value=$smarty.foreach.row.iteration} 22 | 24 | 25 | {if $info.field_orientation == "vertical"}
{/if} 26 | {/foreach} 27 | 28 | {elseif $info.field_type == "checkboxes"} 29 | 30 | {assign var=selected_els value="|"|explode:$placeholder_hash.$pid} 31 | {foreach from=$info.options key=k2 item=option name="row"} 32 | {assign var="count" value=$smarty.foreach.row.iteration} 33 | 35 | 36 | {if $info.field_orientation == "vertical"}
{/if} 37 | {/foreach} 38 | 39 | {elseif $info.field_type == "select"} 40 | 41 | 47 | {elseif $info.field_type == "multi-select"} 48 | {assign var=selected_els value="|"|explode:$placeholder_hash.$pid} 49 | 56 | {/if} 57 |
58 |
59 | {/foreach} 60 | 61 | 62 | -------------------------------------------------------------------------------- /smarty_plugins/templates_html.tpl: -------------------------------------------------------------------------------- 1 | {* 2 | This is called during the initial Form Builder page load, and any time the user changes the Template Set choice. 3 | It generates some HTML containing the list of templates available for the set. If there's only one, it hides the 4 | choice, but includes a hidden field containing the . 5 | *} 6 | 7 | {if $grouped_templates.page_layout|@count > 1} 8 |
9 | 10 |
11 | 17 |
18 |
19 | {else} 20 | 21 | {/if} 22 | 23 | {if $grouped_templates.header|@count > 1} 24 |
25 | 26 |
27 | 34 |
35 |
36 | {else} 37 | 38 | {/if} 39 | 40 | {if $grouped_templates.footer|@count > 1} 41 |
42 | 43 |
44 | 50 |
51 |
52 | {else} 53 | 54 | {/if} 55 | 56 | {if $grouped_templates.form_page|@count > 1} 57 |
58 | 59 |
60 | 66 |
67 |
68 | {else} 69 | 70 | {/if} 71 | 72 | {if $grouped_templates.review_page|@count > 1} 73 |
74 | 75 |
76 | 82 |
83 |
84 | {else} 85 | 86 | {/if} 87 | 88 | {if $grouped_templates.thankyou_page|@count > 1} 89 |
90 | 91 |
92 | 98 |
99 |
100 | {else} 101 | 102 | {/if} 103 | 104 | {if $grouped_templates.form_offline_page|@count > 1} 105 |
106 | 107 |
108 | 114 |
115 |
116 | {else} 117 | 119 | {/if} 120 | 121 | {if $grouped_templates.navigation|@count > 1} 122 |
123 | 124 |
125 | 131 |
132 |
133 | {else} 134 | 135 | {/if} 136 | 137 | {if $grouped_templates.continue_block|@count > 1} 138 |
139 | 140 |
141 | 147 |
148 |
149 | {else} 150 | 151 | {/if} 152 | 153 | {if $grouped_templates.error_message|@count > 1} 154 |
155 | 156 |
157 | 163 |
164 |
165 | {else} 166 | 167 | {/if} 168 | 169 | 170 | -------------------------------------------------------------------------------- /tab_settings_form_offline.php: -------------------------------------------------------------------------------- 1 | $request["default_form_offline_page_content"], 8 | "scheduled_offline_form_behaviour" => $request["scheduled_offline_form_behaviour"] 9 | ); 10 | $module->setSettings($settings); 11 | 12 | $success = true; 13 | $message = $L["notify_settings_updated"]; 14 | } 15 | 16 | $page_vars["g_success"] = $success; 17 | $page_vars["g_message"] = $message; 18 | $page_vars["module_settings"] = $module->getSettings(); 19 | 20 | $module->displayPage("templates/settings.tpl", $page_vars); 21 | -------------------------------------------------------------------------------- /tab_settings_main.php: -------------------------------------------------------------------------------- 1 | $request["default_published_folder_path"], 10 | "default_published_folder_url" => $request["default_published_folder_url"], 11 | "review_page_title" => $request["review_page_title"], 12 | "thankyou_page_title" => $request["thankyou_page_title"], 13 | "form_builder_width" => $request["form_builder_width"], 14 | "form_builder_height" => $request["form_builder_height"], 15 | "edit_form_builder_link_action" => $request["edit_form_builder_link_action"] 16 | ); 17 | Modules::setModuleSettings($settings); 18 | 19 | $success = true; 20 | $message = $L["notify_settings_updated"]; 21 | } 22 | 23 | $module_settings = $module->getSettings(); 24 | 25 | $page_vars["success"] = $success; 26 | $page_vars["message"] = $message; 27 | $page_vars["module_settings"] = $module_settings; 28 | 29 | $module->displayPage("templates/settings.tpl", $page_vars); 30 | -------------------------------------------------------------------------------- /tab_settings_thanks.php: -------------------------------------------------------------------------------- 1 | $request["default_thankyou_page_content"] 8 | ); 9 | $module->setSettings($settings); 10 | 11 | $success = true; 12 | $message = $L["notify_settings_updated"]; 13 | } 14 | 15 | $page_vars["g_success"] = $success; 16 | $page_vars["g_message"] = $message; 17 | $page_vars["module_settings"] = $module->getSettings(); 18 | 19 | $module->displayPage("templates/settings.tpl", $page_vars); 20 | -------------------------------------------------------------------------------- /template_sets/index.php: -------------------------------------------------------------------------------- 1 | getLangStrings(); 12 | $LANG = Core::$L; 13 | 14 | $set_id = Modules::loadModuleField("form_builder", "set_id", "set_id"); 15 | $page = Modules::loadModuleField("form_builder", "page", "edit_template_set", "templates"); 16 | 17 | $same_page = General::getCleanPhpSelf(); 18 | $tabs = array( 19 | "info" => array( 20 | "tab_label" => $L["word_info"], 21 | "tab_link" => "{$same_page}?page=info&set_id={$set_id}", 22 | "pages" => array("info") 23 | ), 24 | "templates" => array( 25 | "tab_label" => $L["word_templates"], 26 | "tab_link" => "{$same_page}?page=templates&set_id={$set_id}", 27 | "pages" => array("templates", "edit_template") 28 | ), 29 | "resources" => array( 30 | "tab_label" => $L["word_resources"], 31 | "tab_link" => "{$same_page}?page=resources&set_id={$set_id}", 32 | "pages" => array("resources", "edit_resource") 33 | ), 34 | "placeholders" => array( 35 | "tab_label" => $L["word_placeholders"], 36 | "tab_link" => "{$same_page}?page=placeholders&set_id={$set_id}", 37 | "pages" => array("placeholders", "add_placeholder", "edit_placeholder") 38 | ) 39 | ); 40 | 41 | 42 | $links = TemplateSets::getTemplateSetPrevNextLinks($set_id); 43 | $prev_tabset_link = (!empty($links["prev_set_id"])) ? "index.php?page=$page&set_id={$links["prev_set_id"]}" : ""; 44 | $next_tabset_link = (!empty($links["next_set_id"])) ? "index.php?page=$page&set_id={$links["next_set_id"]}" : ""; 45 | 46 | // start compiling the page vars here (save duplicate code!) 47 | $page_vars = array( 48 | "set_id" => $set_id, 49 | "page" => $page, 50 | "tabs" => $tabs, 51 | "show_tabset_nav_links" => true, 52 | "prev_tabset_link" => $prev_tabset_link, 53 | "next_tabset_link" => $next_tabset_link, 54 | "prev_tabset_link_label" => $L["phrase_prev_template_set"], 55 | "next_tabset_link_label" => $L["phrase_next_template_set"] 56 | ); 57 | 58 | switch ($page) { 59 | case "info": 60 | include("tab_info.php"); 61 | break; 62 | case "templates": 63 | include("tab_templates.php"); 64 | break; 65 | case "edit_template": 66 | include("tab_edit_template.php"); 67 | break; 68 | case "resources": 69 | include("tab_resources.php"); 70 | break; 71 | case "edit_resource": 72 | include("tab_edit_resource.php"); 73 | break; 74 | case "placeholders": 75 | include("tab_placeholders.php"); 76 | break; 77 | case "add_placeholder": 78 | include("tab_add_placeholder.php"); 79 | break; 80 | case "edit_placeholder": 81 | include("tab_edit_placeholder.php"); 82 | break; 83 | 84 | default: 85 | include("tab_info.php"); 86 | break; 87 | } 88 | -------------------------------------------------------------------------------- /template_sets/tab_add_placeholder.php: -------------------------------------------------------------------------------- 1 | displayPage("templates/template_sets/index.tpl", $page_vars); 52 | -------------------------------------------------------------------------------- /template_sets/tab_edit_placeholder.php: -------------------------------------------------------------------------------- 1 | "{{\$P." . $placeholder_info["placeholder"] . "}}")); 23 | 24 | // override the form nav links so that it always links to the Views page 25 | $page_vars["prev_tabset_link"] = (!empty($links["prev_set_id"])) ? "index.php?page=placeholders&set_id={$links["prev_set_id"]}" : ""; 26 | $page_vars["next_tabset_link"] = (!empty($links["next_set_id"])) ? "index.php?page=placeholders&set_id={$links["next_set_id"]}" : ""; 27 | 28 | $page_vars["g_success"] = $success; 29 | $page_vars["g_message"] = $message; 30 | $page_vars["placeholder_id"] = $placeholder_id; 31 | $page_vars["text_placeholder_hint"] = $text_placeholder_hint; 32 | $page_vars["head_title"] = $L["phrase_edit_placeholder"]; 33 | $page_vars["sortable_id"] = $sortable_id; 34 | $page_vars["template_set_info"] = $template_set_info; 35 | $page_vars["placeholder_info"] = $placeholder_info; 36 | $page_vars["js_messages"] = array("word_delete", "word_close"); 37 | $page_vars["module_js_messages"] = array( 38 | "text_template_set_complete", 39 | "phrase_template_set_status", 40 | "text_template_set_incomplete" 41 | ); 42 | $page_vars["head_js"] =<<< END 43 | var rules = []; 44 | $(function() { 45 | $("#field_type").bind("change keyup", function() { 46 | fb_ns.change_field_type(this.value); 47 | }); 48 | 49 | // if there are no placeholder option rows, add a default one 50 | //fb_ns.add_placeholder_row(); TODO 51 | fb_ns.init_template_status_dialog(); 52 | }); 53 | END; 54 | 55 | $module->displayPage("templates/template_sets/index.tpl", $page_vars); 56 | -------------------------------------------------------------------------------- /template_sets/tab_edit_resource.php: -------------------------------------------------------------------------------- 1 | "{{\$R." . $resource_info["placeholder"] . "}}")); 21 | 22 | // override the form nav links so that it always links to the Views page 23 | $page_vars["prev_tabset_link"] = (!empty($links["prev_set_id"])) ? "index.php?page=resources&set_id={$links["prev_set_id"]}" : ""; 24 | $page_vars["next_tabset_link"] = (!empty($links["next_set_id"])) ? "index.php?page=resources&set_id={$links["next_set_id"]}" : ""; 25 | 26 | $page_vars["g_success"] = $success; 27 | $page_vars["g_message"] = $message; 28 | $page_vars["resource_id"] = $resource_id; 29 | $page_vars["text_resource_placeholder_hint"] = $text_resource_placeholder_hint; 30 | $page_vars["head_title"] = $L["phrase_edit_resource"]; 31 | $page_vars["template_set_info"] = $template_set_info; 32 | $page_vars["resource_info"] = $resource_info; 33 | $page_vars["js_messages"] = array("word_delete", "word_close"); 34 | $page_vars["module_js_messages"] = array( 35 | "text_template_set_complete", 36 | "phrase_template_set_status", 37 | "text_template_set_incomplete" 38 | ); 39 | $page_vars["head_js"] = <<< END 40 | var rules = []; 41 | $(function() { 42 | fb_ns.init_template_status_dialog(); 43 | }); 44 | END; 45 | 46 | $module->displayPage("templates/template_sets/index.tpl", $page_vars); 47 | -------------------------------------------------------------------------------- /template_sets/tab_edit_template.php: -------------------------------------------------------------------------------- 1 | {$LANG["word_previous_leftarrow"]}"; 23 | $next_template_link = "{$LANG["word_next_rightarrow"]}"; 24 | $num_templates = count($ordered_template_ids); 25 | 26 | $same_page = CoreGeneral::getCleanPhpSelf(); 27 | for ($i = 0; $i < $num_templates; $i++) { 28 | $curr_template_id = $ordered_template_ids[$i]; 29 | if ($curr_template_id == $template_id) { 30 | if ($i != 0) { 31 | $previous_template_id = $ordered_template_ids[$i - 1]; 32 | $previous_template_link = "{$LANG["word_previous_leftarrow"]}"; 33 | } 34 | if ($i != $num_templates - 1) { 35 | $next_template_id = $ordered_template_ids[$i + 1]; 36 | $next_template_link = "{$LANG["word_next_rightarrow"]}"; 37 | } 38 | } 39 | } 40 | 41 | // override the form nav links so that it always links to the Views page 42 | $page_vars["prev_tabset_link"] = (!empty($links["prev_set_id"])) ? "index.php?page=templates&set_id={$links["prev_set_id"]}" : ""; 43 | $page_vars["next_tabset_link"] = (!empty($links["next_set_id"])) ? "index.php?page=templates&set_id={$links["next_set_id"]}" : ""; 44 | $page_vars["previous_template_link"] = $previous_template_link; 45 | $page_vars["next_template_link"] = $next_template_link; 46 | $page_vars["template_info"] = $template_info; 47 | $page_vars["template_set_info"] = $template_set_info; 48 | $page_vars["js_messages"] = array("word_close", "word_yes", "word_no"); 49 | $page_vars["module_js_messages"] = array( 50 | "text_template_set_complete", 51 | "phrase_template_set_status", 52 | "text_template_set_incomplete" 53 | ); 54 | $page_vars["resources"] = Resources::getResources($set_id); 55 | $page_vars["placeholders"] = Placeholders::getPlaceholders($set_id); 56 | $page_vars["head_js"] = <<< END 57 | $(function() { 58 | $("#toggle_placeholders_link").bind("click", function() { 59 | if ($("#placeholders_section").css("display") != "block") { 60 | $("#placeholders_section").show("blind"); 61 | } else { 62 | $("#placeholders_section").hide("blind"); 63 | } 64 | return false; 65 | }); 66 | fb_ns.init_template_status_dialog(); 67 | }); 68 | END; 69 | 70 | $module->displayPage("templates/template_sets/index.tpl", $page_vars); 71 | -------------------------------------------------------------------------------- /template_sets/tab_info.php: -------------------------------------------------------------------------------- 1 | displayPage("templates/template_sets/index.tpl", $page_vars); 44 | -------------------------------------------------------------------------------- /template_sets/tab_placeholders.php: -------------------------------------------------------------------------------- 1 | displayPage("templates/template_sets/index.tpl", $page_vars); 45 | -------------------------------------------------------------------------------- /template_sets/tab_resources.php: -------------------------------------------------------------------------------- 1 | displayPage("templates/template_sets/index.tpl", $page_vars); 39 | -------------------------------------------------------------------------------- /template_sets/tab_templates.php: -------------------------------------------------------------------------------- 1 | true)); 20 | 21 | $missing_templates = TemplateSets::getMissingTemplateSetTemplates($set_id); 22 | $missing_template_strs = array(); 23 | foreach ($missing_templates as $template_type) { 24 | $missing_template_strs[] = TemplateSets::getTemplateTypeName($template_type, $L); 25 | } 26 | $missing_templates_str = implode(", ", $missing_template_strs); 27 | 28 | $page_vars["g_success"] = $success; 29 | $page_vars["g_message"] = $message; 30 | $page_vars["sortable_id"] = $sortable_id; 31 | $page_vars["template_set_info"] = $template_set_info; 32 | $page_vars["missing_templates_str"] = $missing_templates_str; 33 | 34 | $page_vars["js_messages"] = array( 35 | "word_close", "word_yes", "word_no", "phrase_please_confirm" 36 | ); 37 | $page_vars["module_js_messages"] = array( 38 | "confirm_delete_template", 39 | "phrase_create_new_template", 40 | "validation_no_template_name", 41 | "validation_no_source_template", 42 | "text_template_set_complete", 43 | "phrase_template_set_status", 44 | "text_template_set_incomplete" 45 | ); 46 | $page_vars["head_js"] = <<< END 47 | $(function() { 48 | fb_ns.init_create_new_template_dialog(); 49 | fb_ns.init_template_status_dialog(); 50 | 51 | $(".info").bind("click", function() { 52 | ft.create_dialog({ 53 | title: "{$L["phrase_delete_template_set"]}", 54 | content: "{$L["notify_delete_template_in_use"]}", 55 | popup_type: "info", 56 | width: 460, 57 | buttons: [{ 58 | text: "{$LANG["word_close"]}", 59 | click: function() { 60 | $(this).dialog("close"); 61 | } 62 | }] 63 | }); 64 | }); 65 | }); 66 | END; 67 | 68 | $module->displayPage("templates/template_sets/index.tpl", $page_vars); 69 | -------------------------------------------------------------------------------- /templates/admin/add_form.tpl: -------------------------------------------------------------------------------- 1 | {ft_include file='header.tpl'} 2 | 3 | 4 | 5 | 7 | 12 | 13 |
6 | 8 | {$LANG.word_forms} » 9 | {$LANG.phrase_add_form} » 10 | {$L.module_name} 11 |
14 | 15 | {ft_include file="messages.tpl"} 16 | 17 |
18 | {$L.text_add_form_intro} 19 |
20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 100 | 101 |
*{$LANG.phrase_form_name} 28 | 29 |
*{$LANG.phrase_num_fields} 35 | 36 |
37 | {$L.text_add_form_num_fields_hint} 38 |
39 |
*{$LANG.word_access} 45 | 46 | 47 | 48 | 52 | 53 | 54 | 59 | 60 | 61 | 66 | 67 |
49 | 50 | 51 |
55 | 56 | 58 |
62 | 63 | 65 |
68 | 69 | 94 | 95 |
96 | {$L.text_add_form_access_hint} 97 |
98 | 99 |
102 | 103 |

104 | 105 |

106 |
107 | 108 | {ft_include file='footer.tpl'} 109 | -------------------------------------------------------------------------------- /templates/admin/tab_publish.tpl: -------------------------------------------------------------------------------- 1 |
{$L.phrase_published_forms|upper}
2 | 3 | {ft_include file="messages.tpl"} 4 | 5 |
6 | {$L.text_publish_tab_intro} 7 |
8 | 9 | {if $demo_mode == "on"} 10 |
11 |
12 | {$L.notify_form_builder_demo_mode} 13 |
14 |
15 | {/if} 16 | 17 | {* used by the Form Builder to let it know whether or not the parent page is still on the Publish tab *} 18 | 19 | 20 | {if $form_info.form_type != "form_builder"} 21 | 22 |
23 |
24 |
25 |
26 | {$text_non_form_builder_form} 27 |
28 | 29 |
30 |
31 |
32 | 33 | {else} 34 | 35 | {if $published_forms.results|@count == 0} 36 | 37 |
38 | 39 |
40 | 41 | {else} 42 | 43 |
44 |
45 | 46 |
    47 |
  • {$LANG.word_order}
  • 48 |
  • {$LANG.word_view}
  • 49 |
  • {$L.phrase_template_set}
  • 50 |
  • {$L.word_published}
  • 51 |
  • {$L.word_online}
  • 52 |
  • {$L.phrase_form_location}
  • 53 |
  • 54 |
  • 55 |
56 |
57 |
    58 | {foreach from=$published_forms.results item=info name=row} 59 | {assign var=i value=$smarty.foreach.row.iteration} 60 |
  • 61 |
    62 |
    63 | 64 | 65 |
      66 |
    • {$i}
    • 67 |
    • {display_view_name view_id=$info.view_id}
    • 68 |
    • {display_template_set_name set_id=$info.set_id}
    • 69 |
    • 70 | {if $info.is_published == "yes"} 71 | {$LANG.word_yes} 72 | {else} 73 | {$LANG.word_no} 74 | {/if} 75 |
    • 76 |
    • 77 | {if $info.is_published == "no"} 78 | 79 | {elseif $info.is_online == "yes"} 80 | {$LANG.word_yes} 81 | {if !is_null($info.offline_date)} 82 | {assign var=d value=$info.offline_date|replace:':':''} 83 | {assign var=d value=$d|replace:' ':''} 84 | {assign var=d value=$d|replace:'-':''} 85 | {$d|date_format:"%b %e, %Y %l:%M:%S %p"} 86 | {/if} 87 | {else} 88 | {$LANG.word_no} 89 | {/if} 90 |
    • 91 |
    • 92 | {if $info.is_published == "no"} 93 |
      — 94 | {else} 95 | 96 |
      {$info.filename}
      97 | {/if} 98 |
    • 99 |
    • 100 |
    • 101 |
    102 |
    103 |
    104 |
    105 |
    106 |
  • 107 | {/foreach} 108 |
109 |
110 |
111 | 112 |
113 | {if $published_forms.results|@count > 1} 114 | 115 | {/if} 116 | 117 |
118 | 119 | 120 | 121 | 129 |
130 | 131 | {/if} 132 | 133 | {/if} 134 | -------------------------------------------------------------------------------- /templates/help.tpl: -------------------------------------------------------------------------------- 1 | {ft_include file='modules_header.tpl'} 2 | 3 | 4 | 5 | 6 | 13 | 14 |
7 | {$LANG.word_modules} 8 | » 9 | {$L.module_name} 10 | » 11 | {$LANG.word_help} 12 |
15 | 16 |

17 | {$L.text_help} 18 |

19 | 20 | {ft_include file='modules_footer.tpl'} 21 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /templates/index.tpl: -------------------------------------------------------------------------------- 1 | {ft_include file='modules_header.tpl'} 2 | 3 | 4 | 5 | 7 | 12 | 13 |
8 | {$LANG.word_modules} 9 | » 10 | {$L.module_name} 11 |
14 | 15 | {ft_include file='messages.tpl'} 16 | 17 |
18 | {$L.text_template_set_intro} 19 |
20 | 21 | {if $module_settings.demo_mode == "on"} 22 |
23 |
24 | {$L.notify_form_builder_demo_mode} 25 |
26 |
27 | {/if} 28 | 29 |
30 | 31 | {if $template_sets|@count == 0} 32 |
33 |
34 | {$L.notify_no_template_sets_defined} 35 |
36 |
37 | {else} 38 |
39 | 40 |
    41 |
  • {$LANG.word_order}
  • 42 |
  • {$L.phrase_template_set}
  • 43 |
  • {$L.phrase_where_used}
  • 44 |
  • {$L.phrase_is_complete}
  • 45 |
  • {$L.word_templates}
  • 46 |
  • {$L.word_resources}
  • 47 |
  • {$L.word_placeholders}
  • 48 |
  • 49 |
  • 50 |
51 |
52 |
    53 | {foreach from=$template_sets item=template_set name=row} 54 | {assign var=i value=$smarty.foreach.row.iteration} 55 | {assign var=set_id value=$template_set.set_id} 56 |
  • 57 |
    58 |
    59 | 60 | 89 |
    90 |
    91 |
    92 |
  • 93 | {/foreach} 94 |
95 |
96 |
97 | {/if} 98 | 99 |

100 | {if $template_sets|@count > 1} 101 | 102 | {/if} 103 | 104 |

105 | 106 |
107 | 108 | 125 | 126 | 127 | {ft_include file='modules_footer.tpl'} 128 | -------------------------------------------------------------------------------- /templates/settings.tpl: -------------------------------------------------------------------------------- 1 | {ft_include file='modules_header.tpl'} 2 | 3 | 4 | 5 | 6 | 13 | 14 |
7 | {$LANG.word_modules} 8 | » 9 | {$L.module_name} 10 | » 11 | {$LANG.word_settings} 12 |
15 | 16 | {ft_include file='tabset_open.tpl'} 17 | 18 | {if $page == "main"} 19 | {include file='./tab_settings_main.tpl'} 20 | {elseif $page == "thanks"} 21 | {include file='./tab_settings_thanks.tpl'} 22 | {elseif $page == "form_offline"} 23 | {include file='./tab_settings_form_offline.tpl'} 24 | {else} 25 | {include file='./tab_settings_main.tpl'} 26 | {/if} 27 | 28 | {ft_include file='tabset_close.tpl'} 29 | 30 | {ft_include file='modules_footer.tpl'} 31 | -------------------------------------------------------------------------------- /templates/tab_settings_form_offline.tpl: -------------------------------------------------------------------------------- 1 |
{$L.phrase_form_offline_settings|upper}
2 | 3 | {ft_include file="messages.tpl"} 4 | 5 |
6 | 7 | 8 | 9 | 10 | 22 | 23 |
{$L.phrase_offline_form_behaviour} 11 | 13 |
14 | 16 | 17 | 18 |
19 | {$L.text_scheduled_offline_form_desc} 20 |
21 |
24 | 25 |
{$L.phrase_default_offline_page_content}
26 | 27 |
28 | 30 |
31 | 38 |

39 | 40 |

41 |
42 | -------------------------------------------------------------------------------- /templates/tab_settings_main.tpl: -------------------------------------------------------------------------------- 1 |
{$L.phrase_default_publish_folder|upper}
2 | 3 | {ft_include file="messages.tpl"} 4 | 5 |
6 | 7 | 8 | 9 | 25 | 26 | 27 | 28 | 44 | 45 |
{$L.phrase_default_form_folder} 10 | 11 | 12 | 15 | 20 | 21 |
14 | 16 | 19 |
22 |
{$L.text_default_form_folder_desc}
23 |
24 |
{$L.phrase_default_form_url} 29 | 30 | 31 | 34 | {if $allow_url_fopen} 35 | 38 | {/if} 39 | 40 |
33 |
41 |
42 |
{$L.text_default_form_url_desc}
43 |
46 | 47 | 48 |
{$L.phrase_labels_other|upper}
49 | 50 | 51 | 52 | 53 | 58 | 59 | 60 | 61 | 66 | 67 | 68 | 69 | 85 | 86 | 87 | 88 | 97 | 98 |
{$L.phrase_default_review_page_title} 54 | 56 |
{$L.text_default_review_page_title_desc}
57 |
{$L.phrase_default_thankyou_nav_title} 62 | 64 |
{$L.text_default_thankyou_page_title_desc}
65 |
{$L.phrase_default_visual_editor_window_size} 70 | 71 | 72 | 73 | 76 | 77 | 78 | 79 | 82 | 83 |
px 75 |
px 81 |
84 |
{$L.phrase_edit_in_form_builder_link_action} 89 | 91 | 92 | 94 | 95 |
{$L.text_edit_form_builder_link_action_desc}
96 |
99 | 100 |

101 | 102 |

103 |
104 | -------------------------------------------------------------------------------- /templates/tab_settings_thanks.tpl: -------------------------------------------------------------------------------- 1 |
{$L.phrase_thankyou_page|upper}
2 | 3 | {ft_include file="messages.tpl"} 4 | 5 |
6 | {$L.text_default_thankyou_page_desc} 7 |
8 | 9 |
10 |
11 | 13 |
14 | 21 |

22 | 23 |

24 |
25 | -------------------------------------------------------------------------------- /templates/template_sets/index.tpl: -------------------------------------------------------------------------------- 1 | {ft_include file='modules_header.tpl'} 2 | 3 |
4 | {if $template_set_info.is_complete == "yes"} 5 | {$LANG.word_complete|upper} 6 | {else} 7 | {$LANG.word_incomplete|upper} 8 | {/if} 9 |
10 | 11 | 12 | 13 | 14 | 21 | 22 |
15 | {$LANG.word_modules} 16 | » 17 | {$L.module_name} 18 | » 19 | {$template_set_info.set_name} 20 |
23 | 24 | {ft_include file='tabset_open.tpl'} 25 | 26 | {if $page == "info"} 27 | {ft_include file='../../modules/form_builder/templates/template_sets/tab_info.tpl'} 28 | {elseif $page == "templates"} 29 | {ft_include file='../../modules/form_builder/templates/template_sets/tab_templates.tpl'} 30 | {elseif $page == "edit_template"} 31 | {ft_include file='../../modules/form_builder/templates/template_sets/tab_edit_template.tpl'} 32 | {elseif $page == "resources"} 33 | {ft_include file='../../modules/form_builder/templates/template_sets/tab_resources.tpl'} 34 | {elseif $page == "edit_resource"} 35 | {ft_include file='../../modules/form_builder/templates/template_sets/tab_edit_resource.tpl'} 36 | {elseif $page == "placeholders"} 37 | {ft_include file='../../modules/form_builder/templates/template_sets/tab_placeholders.tpl'} 38 | {elseif $page == "add_placeholder"} 39 | {ft_include file='../../modules/form_builder/templates/template_sets/tab_add_placeholder.tpl'} 40 | {elseif $page == "edit_placeholder"} 41 | {ft_include file='../../modules/form_builder/templates/template_sets/tab_edit_placeholder.tpl'} 42 | {else} 43 | {ft_include file='../../modules/form_builder/templates/template_sets/tab_info.tpl'} 44 | {/if} 45 | 46 | {ft_include file='tabset_close.tpl'} 47 | 48 | {ft_include file='modules_footer.tpl'} 49 | -------------------------------------------------------------------------------- /templates/template_sets/tab_add_placeholder.tpl: -------------------------------------------------------------------------------- 1 |
2 | {$L.word_placeholders|upper} » {$L.phrase_add_placeholder|upper} 3 |
4 | 5 | {ft_include file='messages.tpl'} 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 35 | 36 | 37 | 38 | 39 | 40 |
{$L.phrase_placeholder_label}
{$L.word_placeholder} 18 | 19 |
{$L.text_placeholder_hint}
20 |
{$L.phrase_field_type} 25 | 34 |
{$L.phrase_default_value}
41 | 42 | 77 | 78 |

79 | 80 |

81 | 82 |
83 | -------------------------------------------------------------------------------- /templates/template_sets/tab_edit_placeholder.tpl: -------------------------------------------------------------------------------- 1 |
2 | {$L.word_placeholders|upper} » {$L.phrase_edit_placeholder|upper} 3 |
4 | 5 | {ft_include file='messages.tpl'} 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 35 | 36 | 37 | 38 | 39 | 40 |
{$L.phrase_placeholder_label}
{$L.word_placeholder} 18 | 19 |
{$text_placeholder_hint}
20 |
{$L.phrase_field_type} 25 | 34 |
{$L.phrase_default_value}
41 | 42 |
43 |
{$LANG.phrase_field_options|upper}
44 | 45 | 46 | 47 | 61 | 62 | 63 | 64 | 96 | 97 |
{$L.word_orientation} 48 | 51 | 52 | 55 | 56 | 59 | 60 |
{$LANG.word_options} 65 |
66 |
    67 |
  • {$LANG.word_order}
  • 68 |
  • {$LANG.word_option}
  • 69 |
  • 70 |
71 |
72 |
    73 | {foreach from=$placeholder_info.options item=option_info} 74 |
  • 75 |
    76 |
    77 |
      78 |
    • {$option_info.field_order}
    • 79 |
    • 80 | 81 |
    • 82 |
    • 83 |
    84 |
    85 |
    86 |
    87 |
  • 88 | {/foreach} 89 |
90 |
91 |
92 | 95 |
98 |
99 | 100 |

101 | 102 |

103 | 104 |
105 | -------------------------------------------------------------------------------- /templates/template_sets/tab_edit_resource.tpl: -------------------------------------------------------------------------------- 1 |
2 | {$L.word_resources|upper} » {$L.phrase_edit_resource|upper} 3 |
4 | 5 | {ft_include file='messages.tpl'} 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 23 | 24 | 25 | 26 | 34 | 35 |
Resource Name
{$L.word_placeholder} 19 | 21 |
{$text_resource_placeholder_hint}
22 |
{$L.phrase_resource_type} 27 | 29 | 30 | 32 | 33 |
36 | 37 |
38 | 39 |
40 | 41 | 46 | 47 |

48 | 49 |

50 | 51 |
52 | -------------------------------------------------------------------------------- /templates/template_sets/tab_edit_template.tpl: -------------------------------------------------------------------------------- 1 |
2 |
{$previous_template_link} 3 |   {$next_template_link}
4 |
5 | {$L.word_templates|upper} » {$L.phrase_edit_template|upper} 6 |
7 |
8 | 9 | {ft_include file='messages.tpl'} 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 27 | 28 | {if $template_info.template_type == "code_block"} 29 | 30 | 31 | 34 | 35 | {/if} 36 |
{$L.phrase_template_name} 18 | 20 |
{$L.phrase_template_type} 25 | {display_template_type type=$template_info.template_type} 26 |
{$L.word_placeholder} 32 | {literal}{{code_block template_id={/literal}{$template_info.template_id}{literal}}}{/literal} 33 |
37 | 38 |
39 | 40 |
41 | 55 | 56 |
57 |
Hide / show available templates and placeholders
58 | 233 |
234 | 235 |

236 | 237 |

238 | 239 |
240 | -------------------------------------------------------------------------------- /templates/template_sets/tab_info.tpl: -------------------------------------------------------------------------------- 1 |
{$L.phrase_template_set_info|upper}
2 | 3 | {ft_include file="messages.tpl"} 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 37 | 38 |
{$L.phrase_is_complete} 12 | {if $template_set_info.is_complete == "yes"} 13 | {$LANG.word_yes|upper} 14 | {else} 15 | {$LANG.word_no|upper} {$L.phrase_missing_templates_c} 16 | {$missing_templates_str} 17 | {/if} 18 |
{$L.phrase_template_set_name} 23 | 24 |
{$LANG.word_version} 29 | 30 |
{$L.word_description} 35 | 36 |
39 | 40 |
41 | 42 |
43 |
44 | 45 |
46 | 47 |
{$L.word_usage|upper}
48 | 49 | {if $usage|@count == 0} 50 | {$L.text_template_set_not_used} 51 | {else} 52 |
53 | {$L.text_template_set_usage_intro} 54 |
55 | 56 | 57 | 58 | 59 | 60 | 61 | {foreach from=$usage key=form_id item=data} 62 | {foreach from=$data.usage item=i} 63 | 64 | 65 | 66 | 70 | 71 | {/foreach} 72 | {/foreach} 73 |
{$LANG.word_form}{$LANG.word_view}{$L.phrase_form_location}
{$data.form_name}{$i.view_name} 67 | 68 |
{$i.filename}
69 |
74 | {/if} 75 | -------------------------------------------------------------------------------- /templates/template_sets/tab_placeholders.tpl: -------------------------------------------------------------------------------- 1 |
{$L.word_placeholders|upper}
2 | 3 | {ft_include file="messages.tpl"} 4 | 5 |
6 | {$L.text_placeholders_intro} 7 |
8 | 9 |
10 | 11 | {if $placeholders|@count == 0} 12 | 13 |
14 |
15 | {$L.notify_no_template_set_placeholders} 16 |
17 |
18 | 19 | {else} 20 | 21 |
22 | 23 |
    24 |
  • {$LANG.word_order}
  • 25 |
  • {$L.phrase_placeholder_label}
  • 26 |
  • {$L.word_placeholder}
  • 27 |
  • {$LANG.phrase_field_type}
  • 28 |
  • 29 |
  • 30 |
31 |
32 |
    33 | {foreach from=$placeholders item=info name=row} 34 | {assign var=placeholder_id value=$info.placeholder_id} 35 |
  • 36 |
    37 |
    38 | 39 |
      40 |
    • {$info.field_order}
    • 41 |
    • {$info.placeholder_label}
    • 42 |
    • {literal}{{{/literal}$P.{$info.placeholder}{literal}}}{/literal}
    • 43 |
    • {display_placeholder_field_type type=$info.field_type}
    • 44 |
    • 45 |
    • 46 |
    47 |
    48 |
    49 |
    50 |
  • 51 | {/foreach} 52 |
53 |
54 | 55 |
56 | 57 | {/if} 58 | 59 |

60 | {if $placeholders|@count > 1} 61 | 62 | {/if} 63 | 64 |

65 |
66 | -------------------------------------------------------------------------------- /templates/template_sets/tab_resources.tpl: -------------------------------------------------------------------------------- 1 |
{$L.word_resources|upper}
2 | 3 | {ft_include file="messages.tpl"} 4 | 5 |
{$L.text_resources_tab_intro}
6 | 7 |
8 | 9 | 10 | {if $resources|@count == 0} 11 |
12 |
13 | {$L.notify_no_template_set_resources} 14 |
15 |
16 | {else} 17 |
18 | 19 |
    20 |
  • {$LANG.word_order}
  • 21 |
  • {$L.phrase_resource_name}
  • 22 |
  • {$L.word_placeholder}
  • 23 |
  • {$L.phrase_resource_type}
  • 24 |
  • 25 |
  • 26 |
27 |
28 |
    29 | {foreach from=$resources item=info name=row} 30 | {assign var=resource_id value=$info.resource_id} 31 |
  • 32 |
    33 |
    34 | 35 |
      36 |
    • {$smarty.foreach.row.iteration}
    • 37 |
    • {$info.resource_name}
    • 38 |
    • {literal}{{{/literal}$R.{$info.placeholder}{literal}}}{/literal}
    • 39 |
    • {$info.resource_type|upper}
    • 40 |
    • 41 |
    • 42 |
    43 |
    44 |
    45 |
    46 |
  • 47 | {/foreach} 48 |
49 |
50 |
51 | {/if} 52 | 53 |
54 | {if $resources|@count > 1} 55 | 56 | {/if} 57 | 58 |
59 |
60 | 61 | 89 | 90 | -------------------------------------------------------------------------------- /templates/template_sets/tab_templates.tpl: -------------------------------------------------------------------------------- 1 |
{$L.word_templates|upper}
2 | 3 | {ft_include file='messages.tpl'} 4 | 5 |
6 | {$L.text_template_list_desc} 7 |
8 | 9 |
10 | 11 | {if $template_set_info.templates|@count == 0} 12 |
13 |
14 | {$L.notify_no_template_set_defined_click_button} 15 |
16 |
17 | {else} 18 | 19 | {if $missing_templates_str != ""} 20 |
21 |
22 | {$L.phrase_templates_missing_str_c} 23 | {$missing_templates_str} 24 |
25 |
26 | {/if} 27 | 28 |
29 | 30 |
    31 |
  • {$LANG.word_order}
  • 32 |
  • {$L.phrase_template_name}
  • 33 |
  • {$L.phrase_template_type}
  • 34 |
  • {$L.phrase_where_used}
  • 35 |
  • 36 |
  • 37 |
38 |
39 |
    40 | {foreach from=$template_set_info.templates item=template name=row} 41 | {assign var=i value=$smarty.foreach.row.iteration} 42 | {assign var=template_id value=$template.template_id} 43 |
  • 44 |
    45 |
    46 | 47 |
      48 |
    • {$i}
    • 49 |
    • {$template.template_name}
    • 50 |
    • {display_template_type type=$template.template_type}
    • 51 |
    • 52 | {if $template.template_type == "code_block"} 53 | 54 | {else} 55 | {display_template_usage usage=$template.usage} 56 | {/if} 57 |
    • 58 |
    • 59 |
    • 60 |
    61 |
    62 |
    63 |
    64 |
  • 65 | {/foreach} 66 |
67 |
68 | 69 |
70 | 71 | {/if} 72 | 73 |

74 | 75 | {if $template_set_info.templates|@count > 1} 76 | 77 | {/if} 78 | 79 |

80 | 81 |
82 | 83 | 121 | 122 | --------------------------------------------------------------------------------