1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | <div class="panel_headline"><?php echo $headline?></div> <div class="subview_content"> <h3>Goal <?php $this->out($goal_number);?> Settings</h3> <form name="goal-entry" method="POST"> <table class="management" width="100%"> <thead> </thead> <tbody> <tr> <th valign="top">Name:</th> <td> <input name="<?php echo $this->getNs();?>goal[goal_name]" type="text" size="40" value="<?php $this->out($goal['goal_name']);?>"> </td> </tr> <tr> <th valign="top">Group: <p class="formInstructions"> The group that you want to assign this goal to. Goal groups are presented as a tab view on most reports. </p> </th> <td> <select name="<?php echo $this->getNs();?>goal[goal_group]"> <?php foreach ($goal_groups as $k => $group): ?> <option value="<?php $this->out($k, false);?>" <?php if ( isset( $goal['goal_group'] ) && $goal['goal_group'] == $k ) { echo 'SELECTED';}?>><?php if ( !empty( $group ) ) { $this->out($k." - $group"); } else { $this->out($k); } ?></option> <?php endforeach;?> </select> <BR><BR>Edit the group label: <input name="<?php echo $this->getNs();?>new_goal_group_name" type="text" size="20" value="<?php $this->out($goal_groups[$goal['goal_group']]);?>"> </td> </tr> <tr> <th valign="top">Status:</th> <td> <select name="<?php echo $this->getNs();?>goal[goal_status]"> <option value="active" <?php if (isset($goal['goal_status']) && $goal['goal_status'] != 'disabled'){echo 'SELECTED';}?>> Active </option> <option value="disabled" <?php if (isset($goal['goal_status']) && $goal['goal_status'] === 'disabled'){echo 'SELECTED';}?>> Disabled </option> </select> </td> </tr> <tr> <th valign="top"> Value: <p class="formInstructions"> The value associated with achieving this goal. </p> </th> <td> <input name="<?php echo $this->getNs();?>goal[goal_value]" type="text" size="20" value="<?php $this->out($goal['goal_value']);?>"> <span class="optional">Optional</span> </td> </tr> <tr> <th valign="top"> Type: <p class="formInstructions"> The type of goal. </p> </th> <td> <input type="radio" name="<?php echo $this->getNs();?>goal[goal_type]" value="url_destination" <?php if (isset($goal['goal_type']) && $goal['goal_type'] === 'url_destination'){echo 'CHECKED';}?> > URL Destination<BR> <input type="radio" name="<?php echo $this->getNs();?>goal[goal_type]" value="pages_per_visit" <?php if (isset($goal['goal_type']) && $goal['goal_type'] === 'pages_per_visit'){echo 'CHECKED';}?> > Pages / Visit<BR> <input type="radio" name="<?php echo $this->getNs();?>goal[goal_type]" value="visit_duration" <?php if (isset($goal['goal_type']) && $goal['goal_type'] === 'visit_duration'){echo 'CHECKED';}?> > Visit Duration <BR> </td> </tr> </tbody> </table> <!-- URL destination specific options --> <div id="url_destination_details" class="goal-detail"> <h3>Goal Details</h3> <table class="management"> <tr> <th>Match Type:</th> <td> <select name="<?php echo $this->getNs();?>goal[details][match_type]"> <option value="begins" <?php if (isset($goal['details']['match_type']) && $goal['details']['match_type'] === 'begins'){echo 'SELECTED';}?>> Begins With </option> <option value="exact" <?php if (isset($goal['details']['match_type']) && $goal['details']['match_type'] === 'exact'){echo 'SELECTED';}?>> Exact Match </option> <option value="regex" <?php if (isset($goal['details']['match_type']) && $goal['details']['match_type'] === 'regex'){echo 'SELECTED';}?>> Regular Expression </option> </select> </td> </tr> <tr> <th> Goal URL: <p class="formInstructions"> Example: /register.html </p> </th> <td> <input name="<?php echo $this->getNs();?>goal[details][goal_url]" value="<?php $this->out($goal['details']['goal_url']);?>" type="text" size="60" value="<?php $this->out($goal['url']);?>"> </td> </tr> </table> <h3>Funnel</h3> <table class="management" id="funnel-steps"> <TR> <th></th> <th>Step URL</th> <th>Name</th> <th>Is Required?</th> <th></th> </TR> </table> <BR> <a name="steps-end" href="# steps-end" id="addStep">Add New Funnel Step</a> </div> <!-- pages per visit goal type specific options --> <div id="pages_per_visit_details" class="goal-detail"> <h3>Goal Details</h3> Not implemented yet. </div> <!-- visit duration goal type specific options --> <div id="visit_duration_details" class="goal-detail"> <h3>Goal Details</h3> Not implemented yet. </div> <input type="hidden" name="<?php echo $this->getNs();?>goal[goal_number]" value="<?php $this->out($goal_number, false);?>"> <input type="hidden" name="<?php echo $this->getNs();?>siteId" value="<?php $this->out($siteId, false);?>"> <input type="hidden" name="<?php echo $this->getNs();?>action" value="base.optionsGoalEdit"> <?php echo $this->createNonceFormField('base.optionsGoalEdit');?> <BR> <input type="submit" value="Submit"> </form> </div> <script> OWA.setSetting('debug', true); jQuery(document).ready(function() { showGoalDetails(); // show hide the right goal type details jQuery("input[name='owa_goal[goal_type]']").change(function(e) { showGoalDetails(); }); jQuery('#addStep').click(function() { addNewStep(); }); if (OWA.util.countObjectProperties(steps) > 0) { populateGoalSteps(); } }); function showGoalDetails() { var val = jQuery("input[name='owa_goal[goal_type]']:checked").val(); OWA.debug(val); jQuery('.goal-detail').hide(); var selector = '#'+val+'_details'; OWA.debug(selector); jQuery(selector).show(); } function populateGoalSteps() { OWA.debug('pop'); for (step in steps) { renderStep(steps[step]); } } function addNewStep() { var count = OWA.util.countObjectProperties(steps); OWA.debug('count: '+count); var num; if (count === 0) { num = 1; } else { num = count + 1; } if (num < 11) { OWA.debug('num: '+num); var empty_step = {step_number: num, is_required: '', name: '', url: ''}; renderStep(empty_step); steps[num] = empty_step; } else { alert("Sorry but funnels can only have 10 steps."); } } function renderStep(step) { jQuery('#funnel-steps tr:last').after(jQuery('#funnel-step').jqote(step, '*')); } </script> <script type="text/x-jqote-template" id="funnel-step"> <![CDATA[ <tr> <th class="">Step <*= this.step_number *></th> <td class=""><input type="text" size="20" name="owa_goal[details][funnel_steps][<*= this.step_number *>][url]" value="<*= this.url *>"></td> <td class=""><input type="text" size="20" name="owa_goal[details][funnel_steps][<*= this.step_number *>][name]" value="<*= this.name *>"></td> <td class=""> <input type="checkbox" size="20" name="owa_goal[details][funnel_steps][<*= this.step_number *>][is_required]" value="true" <* if ( this.is_required ) { *> CHECKED <* } *> > </td> </tr> ]]> </script> <script> var steps = []; <?php if (array_key_exists('funnel_steps', $goal['details'])):?> <?php $this->out(sprintf("steps = %s;", json_encode($goal['details']['funnel_steps'])), false); ?> <?php endif;?> </script> |