| 633 | | // check to see if the currently selected goto matches one these destinations |
|---|
| 634 | | if ($dest['destination'] == $goto) |
|---|
| 635 | | $checked = true; //there is a match, so we select the radio for this group |
|---|
| 636 | | |
|---|
| 637 | | // create an select option for each destination |
|---|
| 638 | | $options .= '<option value="'.$dest['destination'].'" '.(strpos($goto,$dest['destination']) === false ? '' : 'SELECTED').'>'.($dest['description'] ? $dest['description'] : $dest['destination']); |
|---|
| 639 | | } |
|---|
| 640 | | |
|---|
| 641 | | // make a unique id to be used for the HTML id |
|---|
| 642 | | // This allows us to have multiple drawselect() sets on the page without |
|---|
| 643 | | // conflicting with each other |
|---|
| 644 | | $radioid = uniqid("drawselect"); |
|---|
| 645 | | |
|---|
| 646 | | $selectHtml .= '<input type="radio" id="'.$radioid.'" name="goto_indicate'.$i.'" value="'.$mod.'" '. |
|---|
| 647 | | 'onclick="javascript:this.form.goto'.$i.'.value=\''.$mod.'\';" '. |
|---|
| 648 | | 'onkeypress="javascript:if (event.keyCode == 0 || (document.all && event.keyCode == 13)) this.form.goto'.$i.'.value=\''.$mod.'\';" '. |
|---|
| 649 | | ($checked? 'CHECKED=CHECKED' : '').' /> '; |
|---|
| 650 | | $selectHtml .= '<label for="'.$radioid.'">'._($displayname['displayname']).':</label> '; |
|---|
| 651 | | if ($checked) { $gotomod = $mod; } |
|---|
| 652 | | $selectHtml .= '<select name="'.$mod.$i.'" onfocus="document.getElementById(\''.$radioid.'\').checked = true; this.form.goto'.$i.'.value=\''.$mod.'\';">'; |
|---|
| 653 | | $selectHtml .= $options; |
|---|
| 654 | | $selectHtml .= "</select><br>\n"; |
|---|
| 655 | | } |
|---|
| 656 | | |
|---|
| 657 | | } |
|---|
| | 630 | $cat = (isset($dest['category']) ? $dest['category'] : $module['displayname']); |
|---|
| | 631 | $all_destinations[$cat][] = $dest; |
|---|
| | 632 | } |
|---|
| | 633 | } |
|---|
| | 634 | } |
|---|
| | 635 | } |
|---|
| | 636 | // var_dump($all_destinations); |
|---|
| | 637 | // var_dump($goto); |
|---|
| | 638 | |
|---|
| | 639 | $foundone = false; |
|---|
| | 640 | foreach ($all_destinations as $cat=>$destination) { |
|---|
| | 641 | // create a select option for each destination |
|---|
| | 642 | $options = ""; |
|---|
| | 643 | $checked = false; |
|---|
| | 644 | foreach ($destination as $dest) { |
|---|
| | 645 | $options .= '<option value="'.$dest['destination'].'" '.(strpos($goto,$dest['destination']) === false ? '' : 'SELECTED').'>'.($dest['description'] ? $dest['description'] : $dest['destination']); |
|---|
| | 646 | |
|---|
| | 647 | // check to see if the currently selected goto matches one these destinations |
|---|
| | 648 | if($dest['destination'] == $goto) $checked = true; |
|---|
| | 649 | } |
|---|
| | 650 | |
|---|
| | 651 | // make a unique id to be used for the HTML id |
|---|
| | 652 | // This allows us to have multiple drawselect() sets on the page without |
|---|
| | 653 | // conflicting with each other |
|---|
| | 654 | $radioid = uniqid("drawselect"); |
|---|
| | 655 | // |
|---|
| | 656 | $cat_identifier = preg_replace('/[^a-zA-Z0-9]/','_', $cat); |
|---|
| | 657 | |
|---|
| | 658 | $selectHtml .= '<input type="radio" id="'.$radioid.'" name="goto'.$i.'" value="'.$cat_identifier.'" '. |
|---|
| | 659 | //'onclick="javascript:this.form.goto'.$i.'.value=\''.$cat.'\';" '. |
|---|
| | 660 | //'onkeypress="javascript:if (event.keyCode == 0 || (document.all && event.keyCode == 13)) this.form.goto'.$i.'.value=\''.$cat.'\';" '. |
|---|
| | 661 | ($checked? 'CHECKED=CHECKED' : '').' /> '; |
|---|
| | 662 | $selectHtml .= '<label for="'.$radioid.'">'._($cat).':</label> '; |
|---|
| | 663 | |
|---|
| | 664 | // set the |
|---|
| | 665 | // if ($checked) { $gotomod = $cat; } |
|---|
| | 666 | |
|---|
| | 667 | $selectHtml .= '<select name="'.$cat_identifier.$i.'" onfocus="document.getElementById(\''.$radioid.'\').checked = true; this.form.goto'.$i.'.value=\''.$cat.'\';">'; |
|---|
| | 668 | $selectHtml .= $options; |
|---|
| | 669 | $selectHtml .= "</select><br>\n"; |
|---|
| | 670 | |
|---|
| | 671 | if ($checked) $foundone = true; |
|---|
| 663 | | $selectHtml .= '<input type="radio" id="'.$radioid.'" name="goto_indicate'.$i.'" value="custom" onclick="javascript:this.form.goto'.$i.'.value=\'custom\';" onkeypress="javascript:if (event.keyCode == 0 || (document.all && event.keyCode == 13)) this.form.goto'.$i.'.value=\'custom\';" '.(strpos($goto,'custom') === false ? '' : 'CHECKED=CHECKED').' />'; |
|---|
| 664 | | $selectHtml .= '<a href="#" class="info"> '._("Custom App<span><br>ADVANCED USERS ONLY<br><br>Uses Goto() to send caller to a custom context.<br><br>The context name <b>MUST</b> contain the word 'custom' and should be in the format custom-context , extension , priority. Example entry:<br><br><b>custom-myapp,s,1</b><br><br>The <b>[custom-myapp]</b> context would need to be created and included in extensions_custom.conf</span>").'</a>:'; |
|---|
| 665 | | $selectHtml .= '<input type="text" size="15" name="custom'.$i.'" value="'.(strpos($goto,'custom') === false ? '' : $goto).'" onfocus="document.getElementById(\''.$radioid.'\').checked = true;" />'; |
|---|
| 666 | | $gotomod = isset($gotomod)?$gotomod:'custom'; |
|---|
| 667 | | $selectHtml .= "\n<input type='hidden' name='goto$i' value='$gotomod'>"; |
|---|
| | 681 | $selectHtml .= '<input type="radio" id="'.$radioid.'" name="goto'.$i.'" value="custom" '. |
|---|
| | 682 | //'onclick="javascript:this.form.goto'.$i.'.value=\'custom\';" '. |
|---|
| | 683 | //'onkeypress="javascript:if (event.keyCode == 0 || (document.all && event.keyCode == 13)) this.form.goto'.$i.'.value=\'custom\';" '. |
|---|
| | 684 | ($custom_selected ? 'CHECKED=CHECKED' : '').' />'; |
|---|
| | 685 | $selectHtml .= '<a href="#" class="info"> '._("Custom App<span><br>ADVANCED USERS ONLY<br><br>Uses Goto() to send caller to a custom context.<br><br>The context name should start with \"custom-\", and be in the format custom-context,extension,priority. Example entry:<br><br><b>custom-myapp,s,1</b><br><br>The <b>[custom-myapp]</b> context would need to be created and included in extensions_custom.conf</span>").'</a>:'; |
|---|
| | 686 | $selectHtml .= '<input type="text" size="15" name="custom'.$i.'" value="'.($custom_selected ? $goto : '').'" onfocus="document.getElementById(\''.$radioid.'\').checked = true;" />'; |
|---|