Exemplo n.º 1
0
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_chronocontact' . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        $query = "\n        \tSELECT *\n        \t\tFROM `#__chrono_contact`\n        \t\tWHERE id = " . $db->Quote($form_id);
        $db->setQuery($query);
        $form = $db->loadObject();
        $htmlstring = $form->html;
        preg_match_all('/name=("|\').*?("|\')/i', $htmlstring, $matches);
        $names = array();
        foreach ($matches[0] as $name) {
            $name = preg_replace('/name=("|\')/i', '', $name);
            $name = preg_replace('/("|\')/', '', $name);
            $name = preg_replace('/name=("|\')/', '', $name);
            if (strpos($name, '[]')) {
                $name = str_replace('[]', '', $name);
            }
            $names[] = trim($name);
        }
        $names = array_unique($names);
        // identify and initialise the parameters used in this plugin
        $params_array = array('debugging' => '0', 'target_url' => 'http://', 'onsubmit' => 'before_email');
        $params = $helper->loadParams($row, $params_array);
        $messages[] = '$params: ' . print_r($params, true);
        if ($params->get('debugging')) {
            $helper->showPluginDebugMessages($messages);
        }
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm" >
<?php 
        echo $pane->startPane("cf_redirect");
        echo $pane->startPanel('General', "general");
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Field names from your form', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        foreach ($names as $name) {
            $tooltip = "Enter the other site field name that matches '{$name}'";
            $input = $helper->createInputTD("'{$name}' field", "extra2[{$name}]", $extra2->get($name), '', $attribs['input'], $tooltip);
            echo $helper->wrapTR($input, array('class' => 'cf_config'));
        }
        $input = $helper->createHeaderTD('Extra field values to send', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "Extra Fields, enter data in this format : ship_to_name=field_name<br />Take care to add each entry to a new line";
        $input = $helper->createTextareaTD('Extra fields Data', 'extra1', $row->extra1, $attribs['textarea'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("URL parameters", 'url_params');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Plugin parameters', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "The target URL to redirect to";
        $input = $helper->createInputTD("Target URL", "params[target_url]", $params->get('target_url'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $option_array = array('before_email' => 'Before Email', 'after_email' => 'After Email');
        foreach ($option_array as $k => $v) {
            $option_array[$k] = JHTML::_('select.option', $k, JText::_($v));
        }
        $tooltip = "Run the plugin before or after the email.<br />\n        \tRunning it before the email may be necessary to include some data into the email";
        $input = $helper->createSelectTD("Flow control", "params[onsubmit]", $option_array, $params->get('onsubmit'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Show debug information on Submit?";
        $input = $helper->createYesNoTD("Debugging", "params[debugging]", '', $params->get('debugging'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Extra code", 'extracode');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Extra code', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "Execute some code just before the Redirect transaction is executed";
        $input = $helper->createTextareaTD('Extra before CURL code', 'extra4', $row->extra4, $attribs['textarea'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        /*$tooltip = "Execute some code just after the CURL transaction is executed";
          $input = $helper->createTextareaTD('Extra after CURL code', 'extra5',
              $row->extra5, $attribs['textarea'], $tooltip );
          echo $helper->wrapTR($input, array('class' => 'cf_config'));*/
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Help', 'help');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('How to configure the Redirect plugin', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        ?>
    <tr>
        <td colspan='4' style='border:1px solid silver; padding:6px;'>
        <div>The plugin allows you to use the Redirect URL to send data and the user from a ChronoForms Form to
        another site or to another application on your site. Use this when you need to redirect the user
        for example to PayPal to authorise a payment, if you just want to transfer data from the form and keep teh user on
        your site, then the CURL plugin is better.</div>
        <ul><li>First, open the URL params tab and put the url that you want to submit the information to
        in the Target URL box e.g. http://www.paypal.com/cgi-bin/webscr </li>
        <li>Next click the General Tab and you will see a list of the fields in your form.
        Put the corresponding names for the site you are sending to in the boxes along-side
        (often these will be the same as the field names in your form.)</li>
        <li>In the Extra Fields Data box you can enter values for fields that will be the same
        for each submission. These will often be client or transaction identifiers for the other site.
        (Note: Putting this information here means that it is never exposed in your form.)</li>
        <li>Lastly on the Redirect params tab, you can set the Redirect Plugin to run before or after Emails are sent.
        Use this if you need to fine-tune the process flow. Note that the Redirection will be done after any emails are
        sent and the data saved.</li>
        <li>The Extra Code tab allows you to add extra PHP to run before the Redirection Plugin
        (running code after redirection is not possible).
        Normally you will leave these boxes empty; use them if you need to alter the submitted data in some way.</li>
        </ul>
        </td>
    </tr>
    </table>
<?php 
        echo $pane->endPane();
        echo $pane->endPane();
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        $hidden_array['params[onsubmit]'] = 'before_email';
        echo $helper->createHiddenArray($hidden_array);
        ?>

</form>
<?php 
        if ($style) {
            $doc->addStyleDeclaration($style);
        }
        if ($script) {
            $doc->addScriptDeclaration($script);
        }
    }
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        // identify and initialise the parameters used in this plugin
        $params_array = array('debugging' => '0', 'name' => '', 'username' => '', 'email' => '', 'pass' => '', 'vpass' => '', 'emailuser' => 'Yes', 'emailadmins' => 'Yes', 'joomlastatus' => '1', 'showmessages' => '1', 'createpassword' => '0', 'onsubmit' => 'before_email', 'new_usertype' => 'Registered', 'autologin' => '0');
        $params = $helper->loadParams($row, $params_array);
        $messages[] = '$params: ' . print_r($params, true);
        if ($params->get('debugging')) {
            $helper->showPluginDebugMessages($messages);
        }
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<?php 
        echo $pane->startPane("joomlaregistration");
        echo $pane->startPanel('Field names', "general6");
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('User information field names', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Enter the name of the the 'User's name' field";
        $input = $helper->createInputTD("'Name' field name", "params[name]", $params->get('name'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the name of the the 'User's username' field";
        $input = $helper->createInputTD("'Username' field name", "params[username]", $params->get('username'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the name of the the 'User's email' field";
        $input = $helper->createInputTD("'Email' field name", "params[email]", $params->get('email'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the name of the the 'User's password' field";
        $input = $helper->createInputTD("'Password' field name", "params[pass]", $params->get('pass'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the name of the the 'Confirm password' field";
        $input = $helper->createInputTD("'Confirm password' field name", "params[vpass]", $params->get('vpass'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        echo "</table>";
        echo $pane->endPanel();
        echo $pane->startPanel('Configuration', "general6");
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Registration configuration', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $option_array = array('Yes' => 'Yes (Default Joomla Email)', 'No' => 'No');
        $query = "\n        \tSELECT *\n        \t\tFROM `#__chrono_contact_emails`\n        \t\tWHERE `formid` = '{$form_id}'\n        \t\tORDER BY emailid ;\n        \t";
        $db->setQuery($query);
        $emails = $db->loadObjectList();
        $emailcount = 1;
        foreach ($emails as $email) {
            $option_array['custom' . $emailcount] = "Yes (Custom Form Email {$emailcount})";
            $emailcount++;
        }
        foreach ($option_array as $k => $v) {
            $option_array[$k] = JHTML::_('select.option', $k, JText::_($v));
        }
        $tooltip = "Select an e-mail template to send to the User";
        $input = $helper->createSelectTD("E-mail the User?", "params[emailuser]", $option_array, $params->get('emailuser'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Select an e-mail template to send to the Admins";
        $input = $helper->createSelectTD("E-mail the Admins?", "params[emailadmins]", $option_array, $params->get('emailadmins'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Show Joomla status messages<br />\n        \te.g: Your account has been created . . .";
        $input = $helper->createYesNoTD("Show Joomla messages", "params[joomlastatus]", '', $params->get('joomlastatus'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Show messages using the Joomla message display.<br />\n        \tThese may not show if your template doesn't support system message display.";
        $input = $helper->createYesNoTD("Use Joomla message display", "params[showmessages]", '', $params->get('showmessages'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Automatically create a password for the user.<br />\n        \tNote: Any password fields on the form will be ignored.";
        $input = $helper->createYesNoTD("Create password", "params[createpassword]", '', $params->get('createpassword'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "you may want the plugin to advance with the registration even if Joomla global allow user registration is off";
        $input = $helper->createYesNoTD("Override Joomla's Allow User Registration", "params[overrideJallowUserRegistration]", '', $params->get('overrideJallowUserRegistration', '0'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Auto login after registration, will work only if user is activated";
        $input = $helper->createYesNoTD("Auto login", "params[autologin]", '', $params->get('autologin'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $option_array = array('before_email' => 'Before Email', 'after_email' => 'After Email');
        foreach ($option_array as $k => $v) {
            $option_array[$k] = JHTML::_('select.option', $k, JText::_($v));
        }
        $tooltip = "Run the plugin before or after the email.<br />\n        \tRunning it before the email may be necessary to include some data into the email";
        $input = $helper->createSelectTD("Flow control", "params[onsubmit]", $option_array, $params->get('onsubmit'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Show debug information on Submit?";
        $input = $helper->createYesNoTD("Debugging", "params[debugging]", '', $params->get('debugging'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $option_array = array('Registered' => 'Registered', 'Author' => 'Author', 'Editor' => 'Editor', 'Publisher' => 'Publisher', 'Manager' => 'Manager', 'Administrator' => 'Administrator', 'Super Administrator' => 'Super Administrator');
        foreach ($option_array as $k => $v) {
            $option_array[$k] = JHTML::_('select.option', $k, JText::_($v));
        }
        $tooltip = "Select to which users group the new user will be added";
        $input = $helper->createSelectTD("Target group", "params[new_usertype]", $option_array, $params->get('new_usertype', 'Registered'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Extra code", 'extracode');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Extra code', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "Execute some code just before the Registration transaction is executed";
        $input = $helper->createTextareaTD('Extra before Registration code', 'extra4', $row->extra4, $attribs['textarea'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Execute some code just after the Registration transaction is executed";
        $input = $helper->createTextareaTD('Extra after Registration code', 'extra5', $row->extra5, $attribs['textarea'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Help", 'Legend3');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('How to configure the Jooma Registration plugin', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        ?>
    <tr>
        <td colspan='4' style='border:1px solid silver; padding:6px;'>
        <div>The plugin allows you to use a ChronoForms Form to register users with your Joomla site.
        The form will be redisplayed if there is a registration error (the password confirmation does not match,
        the username or email are already in use, email is invalid, etc.). The password field values are not re-shown for security.</div>
        <ul><li>On the 'Field Names' tab enter the field names from your form that correspond
        to the standard Joomla Registration fields. If here are fields that you are not using leave them blank.</li>
        <li>On the Configuration tab you can choose the emails to send to the User or the Admins.
        If you have Custom Email Setups for this form they will also show in the lists.</li>
        <li>The Flow Control setting should normally be left as 'Before Email'
        (but note that emails must be enabled on your form General Tab or the plugin will not run).</li>
        <li>Debugging will show some extra messages that may be helpful in setting up the plugin.
        This should be set to 'No' on a production site.</li>
        <li>The Create Password option will use the standard Joomla function to create a random string password.
            This can simplify the registration process and remove a security risk if users tend to use weak passwords.
            If you select this option you do not need password fields in your form and any that you do have will be ignored.</li>
        <li>The Use Joomla Message Display options will show standard Joomla system messages if there is a registration error.
        If you do not use this option you will need to add code to add messages yourself.
        NB, not all templates show system messgaes correctly.</li>
        <li>If you wish to set up values for fields you can do this in the Extra Code boxes.
        For example you could create a user name from first and last name fields, or autogenerate a password.
        Use a hidden field with no value in the Form HTML, put the field name in the Field Names tab here,
        and set the field value in the Extra Code Before box.</li>
        <li>The Extra Code tab allows you to add extra PHP to run before and / or after the Registration.
        Normally you will leave these boxes empty; use them if you need to alter the submitted data in some way.</li>
        <li>The three variables below will contain the Registration results if you wish to do more processing.</li>
        </ul>
        </td>
    </tr>
<?php 
        $tooltip = "This object will have all the inserted user data";
        $input = $helper->createTextTD("User object", '$MyPlugins->cf_joomla_registration[\'user\']', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Any error messages returned by Joomla if the Registration fails!";
        $input = $helper->createTextTD("Registration messages", '$MyPlugins->cf_joomla_registration[\'errors\']', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Returns true or false based on the success of the Registration";
        $input = $helper->createTextTD("Registration result (true/false)", '$MyPlugins->cf_joomla_registration[\'complete\']', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->endPane();
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        echo $helper->createHiddenArray($hidden_array);
        ?>
</form>
<?php 
    }
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_chronocontact' . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        // identify and initialise the parameters used in this plugin
        $params_array = array('editor' => '1', 'buttons' => '0');
        $params = $helper->loadParams($row, $params_array);
        if ($params->get('editor') == 'No') {
            $params->set('editor', '0');
        } elseif ($params->get('editor') == 'Yes') {
            $params->set('editor', '1');
        }
        if ($params->get('buttons') == 'No') {
            $params->set('buttons', '0');
        } elseif ($params->get('buttons') == 'Yes') {
            $params->set('buttons', '1');
        }
        //echo '<div>$params: '.print_r($params, true).'</div>';
        $params = new JParameter($row->params);
        ?>

<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<?php 
        echo $pane->startPane("confirmationpage");
        echo $pane->startPanel('Configure Plugin', "configure");
        ?>

<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Configuration', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Disable the WYSIWYG Editor for creating the confirmation page?";
        $input = $helper->createYesNoTD("Disable WYSYWYG editor?", "params[editor]", '', $params->get('editor'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Show 'Submit' and 'Back' buttons in the confirmation page ?";
        $input = $helper->createYesNoTD("Show buttons?", "params[buttons]", '', $params->get('buttons'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the submit button value e.g:Submit, default is Submit if left empty!";
        $input = $helper->createInputTD("Submit button value", "params[submit_button_value]", $params->get('submit_button_value', 'Submit'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the back button value e.g:Back, default is Back if left empty!";
        $input = $helper->createInputTD("Back button value", "params[back_button_value]", $params->get('back_button_value', 'Back'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $input = $helper->createHeaderTD('Confirmation page code', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        if (!$params->get('editor', false)) {
            $editor =& JFactory::getEditor();
            $input = $editor->display('extra1', $row->extra1, '100%', '350', '75', '20', false);
            $input = $helper->wrapTD($input, array('colspan' => '4'));
        } else {
            $input = $helper->createTextarea('extra1', $row->extra1, array('cols' => '85', 'rows' => '20'), false, true, array('colspan' => '4'));
        }
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>

                </td>
    		</tr>
        </table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Help', 'help');
        ?>

<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('How to configure the Confirmation Page plugin', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        ?>

    <tr>
        <td colspan='4' style='border:1px solid silver; padding:6px;'>
        <div>The Confirmation page plugin shows a page of form results
        after the form is submitted but before emails are sent or data saved.
        This gives the user a final chance to review their input.</div>
        <ul><li>There is an WYSYWG editor configured by default, you can disable this
        on the Configuration tab if you prefer to use a plain text editor.</li>
        <li>The 'buttons' option will include 'Submit' and 'Back' buttons on the
        Confirmation page. If you prefer to add your own buttons then set this option to 'No'.</li>
        <li>In the Confirmation Page Code box you may enter HTML to display the
        submitted results. Use {field_name} to show the value of any field from the form.</li>
        <li>You can also include PHP in this box if you need to process the data for display.
        PHP must be enclosed in &lt;?php . . . ?&gt; tags.</li>
        <li>If you wish to use PHP or complex HTML, you may prefer to disable the WYSYWYG editor as
        it may change some code entries.</li>
        </ul>
        </td>
    </tr>
    </table>
<?php 
        echo $pane->endPanel();
        echo $pane->endPane();
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        $hidden_array['params[onsubmit]'] = 'before_email';
        echo $helper->createHiddenArray($hidden_array);
        ?>

</form>
<?php 
    }
Exemplo n.º 4
0
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        // identify and initialise the parameters used in this plugin
        $params_array = array('table_name' => '', 'field_name' => '', 'parameter' => '', 'editable' => '0', 'evaluate' => '0');
        $params = $helper->loadParams($row, $params_array);
        $tables = $db->getTableList();
        $script .= "\n        function loadfields2()\n        {\n        \tvar table = \$('table_name').value;\n        \tvar test = \$('field_name').getParent();\n        \tif (table == '' || table == '--?--' ) {\n        \t\ttest.setHTML('<div id=\\'field_name\\'>Please select table name first</div>')\n        \t\treturn false;\n        \t}\n        \tvar url = 'index3.php?option=com_chronocontact&task=ajax&plugin=cf_profile&method=ajaxFields&format=raw';\n        \tmyAjax = new Ajax(url, {\n        \t\tmethod: 'post',\n        \t\tpostBody: 'table='+table,\n        \t\tonRequest: function() {\n        \t\t\ttest.setHTML('<div id=\\'field_name\\'>Loading . . .</div>')\n    \t\t\t},\n        \t\tonSuccess: function(req) {\n        \t\t\ttest = \$('field_name').getParent();\n        \t\t\ttest.setHTML('<div id=\\'field_name\\'></div>');\n\t\t\t\t\ttest = \$('field_name').getParent();\n\t\t\t\t\ttest.setHTML(req);\n    \t\t\t}\n    \t\t}).request();\n        }\n        ";
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm"
    class="adminForm" >
<?php 
        echo $pane->startPane("cf_profile");
        echo $pane->startPanel('Configure', 'Configure');
        ?>

<?php 
        //$input = $helper->createHeaderTD('Configure Profile Table plugin', '', true, $attribs['header']);
        echo $helper->openTableLegend('Configure Profile Table plugin');
        $tooltip = "Choose the table to get the data from.";
        foreach ($tables as $k => $table) {
            $tables_array[$table] = JHTML::_('select.option', JText::_($table));
        }
        $input = $helper->createSelectTD('Table name', 'params[table_name]', $tables_array, $params->get('table_name'), array('onChange' => 'loadfields2()', 'class' => 'cf_select'), $tooltip, 'table_name');
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The table column name which to be matched by the parameter;\n        \tfor best results, this field must be UNIQUE";
        if ($id == 0) {
            $input = $helper->createTextTD('Target field name', '<div id="field_name">Select Table name first</div>', '', $tooltip);
        } else {
            $input = "<td></td>";
            $fields_array = array();
            $table_fields = $db->getTableFields($params->get('table_name'));
            foreach ($table_fields[$params->get('table_name')] as $k => $v) {
                $fields_array[$k] = JHTML::_('select.option', JText::_($k));
            }
            $input = $helper->createSelectTD('Target field name', 'params[field_name]', $fields_array, $params->get('field_name'), array('class' => 'cf_select'), $tooltip, 'field_name');
        }
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The name of the parameter provided in the page url e.g. userid=128.";
        $input = $helper->createInputTD("'Request' parameter name", 'params[parameter]', $params->get('parameter'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "This will be the default value of the requested parameter in case nothing was in the request!";
        $input = $helper->createInputTD("Default Request Parameter value", 'params[default_param_value]', $params->get('default_param_value'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The type of ordering for the records loaded, this will control if the first or last record is loaded in case the query meets more than 1 record";
        $input = $helper->createSelectTD("Oder type", 'params[ordertype]', array("ASC" => JHTML::_('select.option', JText::_("ASC")), "DESC" => JHTML::_('select.option', JText::_("DESC"))), $params->get('ordertype', 'ASC'), array('class' => 'cf_select'), $tooltip, 'ordertype');
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Will this profile page be editable by users?";
        $input = $helper->createYesNoTD("Editable", "params[editable]", '', $params->get('editable', '0'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Skip populating these fields";
        $input = $helper->createInputTD("Skipped fields list", 'params[skippedarray]', $params->get('skippedarray'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Will the profile page evaluate code before doing its routine?\n        \tThis may need to be enabled if you are generating some fields using PHP and want to load their data!?";
        $input = $helper->createYesNoTD("Evaluate code", "params[evaluate]", '', $params->get('evaluate', '0'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        echo $helper->closeTableLegend();
        ?>

<?php 
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        echo $helper->createHiddenArray($hidden_array);
        echo $pane->endPanel();
        echo $pane->startPanel('Help', "help");
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Help for Profile Table plugin', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        ?>
    <tr>
        <td colspan='4' style='border:1px solid silver; padding:6px;'>
        <div>The plugin allows you to read values from any table in the database
        and include them in your form.</div>
        <div>It was originally designed to allow access to the jos_users table to create member
        profiles but it is capable of much more.</div>
        <div>To use the plugin effectively you will need to call the form from a link on your site.
        This could be from - for example a list of users, or topics, or events where you have
        some related information in a database table.</div>
        <ul><li>Choose the table you want to use in the first drop-down
        e.g. jos_users to get a user's name and email.</li>
        <li>Select a field or column name from the table in the second drop down.
        This should be a field that will uniquely identify the record you want to use
        e.g. 'id' or 'username' for the jos_user table. NB This drop-down will not appear
        until you select a table in the first drop-down.</li>
        <li>In the Target field name box put the name of the field you will use to identify the
        record e.g. user_id. You will need to add this field to a url calling the form
        e.g. . . . &chronoformname=my_form&user_id=99 </li>
        <li>You can then use information from this record in your form by putting {column_name} where
        you want it to appear e.g. {name} for a users name from the jos_users table.</li>
        <li>Once this plugin is configured you must enable it in the Form 'Plugins'' tab.</li></ul>
        </td>
    </tr>
</table>

<?php 
        echo $pane->endPanel();
        echo $pane->endPane();
        ?>
</form>
<?php 
        if ($style) {
            $doc->addStyleDeclaration($style);
        }
        if ($script) {
            $doc->addScriptDeclaration($script);
        }
    }
Exemplo n.º 5
0
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_chronocontact' . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        // identify and initialise the parameters used in this plugin
        $params_array = array('photo' => 'file_0', 'delete_original' => '0', 'quality' => '90', 'big_directory' => '', 'big_image_prefix' => '', 'big_image_suffix' => '_big', 'big_image_height' => '300', 'big_image_width' => '400', 'big_image_r' => '255', 'big_image_g' => '255', 'big_image_b' => '255', 'big_image_method' => '0', 'med_directory' => '', 'med_image_use' => '0', 'med_image_prefix' => '', 'med_image_suffix' => '_med', 'med_image_height' => '300', 'med_image_width' => '400', 'med_image_r' => '255', 'med_image_g' => '255', 'med_image_b' => '255', 'med_image_method' => '0', 'small_image_use' => '0', 'small_directory' => '', 'small_image_prefix' => '', 'small_image_suffix' => '_small', 'small_image_height' => '300', 'small_image_width' => '400', 'small_image_r' => '255', 'small_image_g' => '255', 'small_image_b' => '255', 'small_image_method' => '0');
        $params = $helper->loadParams($row, $params_array);
        //echo '<div>$params: '.print_r($params, true).'</div>';
        $copyright = "<div style='margin-top:6px; border-top:solid 1px silver; padding:6px;'>\n    \tImage resizer plugin for chronoforms - &copy;2008 Emmanuel Danan\n    \t<a href='http://www.vistamedia.fr'\ntitle='Joomla! expert in Aix en Provence - France' target='_blank'>www.vistamedia.fr</a>\n: <a href='http://www.joomla.fr' title='Joomla! french support portal' target='_blank'>www.joomla.fr</a></div>";
        $copyright = $helper->wrapTD($copyright, array('colspan' => '4'));
        $copyright = $helper->wrapTR($copyright, array('class' => 'cf_config'));
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<?php 
        echo $pane->startPane("image_resize");
        echo $pane->startPanel('General', "configure");
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('General setup', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Photo Field: The name of the photo upload field in your form";
        $input = $helper->createInputTD('Photo Field', 'params[photo]', $params->get('photo'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Delete orginal image: Delete the original image from the upload directory";
        $input = $helper->createYesNoTD("Delete orginal image", 'params[delete_original]', '', $params->get('delete_original'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Image quality: set the quality of ouput jpg images.";
        $q_range = array();
        foreach (range(100, 5, -5) as $v) {
            $q_range[$v] = JHTML::_('select.option', $v, $v);
        }
        $input = $helper->createSelectTD('Image quality % (jpg only)', 'params[quality]', $q_range, $params->get('quality'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        echo $copyright;
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Large Image', 'large');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Settings for the large image', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Directory where the file will be stored. Don‘t forget the slash at the end ;-) e.g. images/stories/<br />\n        \tIf you leave this empty it will default to the Form file uploads folder.";
        $input = $helper->createInputTD('Directory', 'params[big_directory]', $params->get('big_directory'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The prefix for the created image name e.g. big_";
        $input = $helper->createInputTD('Image prefix', 'params[big_image_prefix]', $params->get('big_image_prefix'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The suffix for the created image name e.g. _big";
        $input = $helper->createInputTD('Image suffix', 'params[big_image_suffix]', $params->get('big_image_suffix'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Dimensions of the re-sized image in pixels";
        $input = 'Height: ';
        $input .= $helper->createInput('params[big_image_height]', $params->get('big_image_height'), array('maxlength' => '5', 'size' => '5', 'class' => 'text_area'), false, false);
        $input .= 'px&nbsp;&nbsp;&nbsp;Width: ';
        $input .= $helper->createInput('params[big_image_width]', $params->get('big_image_width'), array('maxlength' => '5', 'size' => '5', 'class' => 'text_area'), false, false);
        $input .= 'px';
        $input = $helper->createTextTD('Dimensions', $input, $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Alpha channel for png transparency. RGB color of the background ;-)";
        $input = 'R: ';
        $input .= $helper->createInput('params[big_image_r]', $params->get('big_image_r'), array('maxlength' => '3', 'size' => '3', 'class' => 'text_area'), false, false);
        $input .= '&nbsp;&nbsp;&nbsp;G: ';
        $input .= $helper->createInput('params[big_image_g]', $params->get('big_image_g'), array('maxlength' => '3', 'size' => '3', 'class' => 'text_area'), false, false);
        $input .= '&nbsp;&nbsp;&nbsp;B: ';
        $input .= $helper->createInput('params[big_image_b]', $params->get('big_image_b'), array('maxlength' => '3', 'size' => '3', 'class' => 'text_area'), false, false);
        $input .= ' 0-255';
        $input = $helper->createTextTD('Alpha channel', $input, $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The way your images will be generated (either scale or crop)";
        $input = $helper->createRadioTD('Processing method', 'params[big_image_method]', array('0' => 'Scale', '1' => 'Crop'), $params->get('big_image_method'), $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        echo $copyright;
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Medium Image', 'medium');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Settings for the medium image', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Create a medium sized image?.";
        $input = $helper->createYesNoTD("Create medium image?", 'params[med_image_use]', '', $params->get('med_image_use'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Directory where the file will be stored. Don‘t forget the slash at the end ;-) e.g. images/stories/<br />\n        \tIf you leave this empty it will default to the Form file uploads folder.";
        $input = $helper->createInputTD('Directory', 'params[med_directory]', $params->get('med_directory'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The prefix for the created image name e.g. med_";
        $input = $helper->createInputTD('Image prefix', 'params[med_image_prefix]', $params->get('med_image_prefix'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The suffix for the created image name e.g. _med";
        $input = $helper->createInputTD('Image suffix', 'params[med_image_suffix]', $params->get('med_image_suffix'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Dimensions of the re-sized image in pixels";
        $input = 'Height: ';
        $input .= $helper->createInput('params[med_image_height]', $params->get('med_image_height'), array('maxlength' => '5', 'size' => '5', 'class' => 'text_area'), false, false);
        $input .= 'px&nbsp;&nbsp;&nbsp;Width: ';
        $input .= $helper->createInput('params[med_image_width]', $params->get('med_image_width'), array('maxlength' => '5', 'size' => '5', 'class' => 'text_area'), false, false);
        $input .= 'px';
        $input = $helper->createTextTD('Dimensions', $input, $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Alpha channel for png transparency. RGB color of the background ;-)";
        $input = 'R: ';
        $input .= $helper->createInput('params[med_image_r]', $params->get('med_image_r'), array('maxlength' => '3', 'size' => '3', 'class' => 'text_area'), false, false);
        $input .= '&nbsp;&nbsp;&nbsp;G: ';
        $input .= $helper->createInput('params[med_image_g]', $params->get('med_image_g'), array('maxlength' => '3', 'size' => '3', 'class' => 'text_area'), false, false);
        $input .= '&nbsp;&nbsp;&nbsp;B: ';
        $input .= $helper->createInput('params[med_image_b]', $params->get('med_image_b'), array('maxlength' => '3', 'size' => '3', 'class' => 'text_area'), false, false);
        $input .= ' 0-255';
        $input = $helper->createTextTD('Alpha channel', $input, $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The way your images will be generated (either scale or crop)";
        $input = $helper->createRadioTD('Processing method', 'params[med_image_method]', array('0' => 'Scale', '1' => 'Crop'), $params->get('med_image_method'), $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        echo $copyright;
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Small Image', 'small');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Settings for the small image', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Create a small sized image?.";
        $input = $helper->createYesNoTD("Create small image?", 'params[small_image_use]', '', $params->get('small_image_use'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Directory where the file will be stored. Don‘t forget the slash at the end ;-) e.g. images/stories/<br />\n        \tIf you leave this empty it will default to the Form file uploads folder.";
        $input = $helper->createInputTD('Directory', 'params[small_directory]', $params->get('small_directory'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The prefix for the created image name e.g. small_";
        $input = $helper->createInputTD('Image prefix', 'params[small_image_prefix]', $params->get('small_image_prefix'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The suffix for the created image name e.g. _small";
        $input = $helper->createInputTD('Image suffix', 'params[small_image_suffix]', $params->get('small_image_suffix'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Dimensions of the re-sized image in pixels";
        $input = 'Height: ';
        $input .= $helper->createInput('params[small_image_height]', $params->get('small_image_height'), array('maxlength' => '5', 'size' => '5', 'class' => 'text_area'), false, false);
        $input .= 'px&nbsp;&nbsp;&nbsp;Width: ';
        $input .= $helper->createInput('params[small_image_width]', $params->get('small_image_width'), array('maxlength' => '5', 'size' => '5', 'class' => 'text_area'), false, false);
        $input .= 'px';
        $input = $helper->createTextTD('Dimensions', $input, $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Alpha channel for png transparency. RGB color of the background ;-)";
        $input = 'R: ';
        $input .= $helper->createInput('params[small_image_r]', $params->get('small_image_r'), array('maxlength' => '3', 'size' => '3', 'class' => 'text_area'), false, false);
        $input .= '&nbsp;&nbsp;&nbsp;G: ';
        $input .= $helper->createInput('params[small_image_g]', $params->get('small_image_g'), array('maxlength' => '3', 'size' => '3', 'class' => 'text_area'), false, false);
        $input .= '&nbsp;&nbsp;&nbsp;B: ';
        $input .= $helper->createInput('params[small_image_b]', $params->get('small_image_b'), array('maxlength' => '3', 'size' => '3', 'class' => 'text_area'), false, false);
        $input .= ' 0-255';
        $input = $helper->createTextTD('Alpha channel', $input, $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The way your images will be generated (either scale or crop)";
        $input = $helper->createRadioTD('Processing method', 'params[small_image_method]', array('0' => 'Scale', '1' => 'Crop'), $params->get('small_image_method'), $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        echo $copyright;
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Help', 'help');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('How to configure the Image-Re-sizer plugin', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        ?>
    <tr>
        <td colspan='4' style='border:1px solid silver; padding:6px;'>
        <div>The Image Re-sizer plugin will take a file (jpg, png, or gif) uploaded from your form and re-size it
        either by scaling or cropping. It will also optionally create medium and small versions of the image.
        You can specify the image sizes and the storage folder.</div>
        <ul><li>On the General tab you can identify the upload file name (only a single upload field is supported).
        You can also choose to delete the original file;
        and set the quality for jpg conversions (higher quality uses larger files).</li>
        <li>The Large, Medium & Small tabs are identical except
        that you can turn the Medium and Small copies on and off.</li>
        <li>For each size you can set an upload directory; an image prefix for the files and the
        size of the new image in pixels. The alpha channel sets the background color for png files only.
        The processing method allows to to decide if images should be scaled when as much of the image will be kept as possible,
        or cropped when the center area will be kept and the edges sliced off to reach the new size.</li>
        <li>Note that although the images are called 'Large, Medium and Small' you can choose any size in each tab.</li>
        </ul>
        </td>
    </tr>
<?php 
        echo $copyright;
        ?>
    </table>
<?php 
        echo $pane->endPanel();
        echo $pane->endPane();
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        $hidden_array['params[onsubmit]'] = 'before_email';
        echo $helper->createHiddenArray($hidden_array);
    }
Exemplo n.º 6
0
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        $doc->addScript(JURI::base() . 'components/com_chronocontact/assets/timespinner/timespinner.js');
        $doc->addStylesheet(JURI::base() . 'components/com_chronocontact/assets/timespinner/timespinner.css');
        // identify and initialise the parameters used in this plugin
        $params_array = array('redirect_url' => 'index.php', 'gid' => '29', 'redirect_message_users' => '', 'open' => '', 'redirect_message_open' => '', 'close' => '', 'redirect_message_close' => '', 'days' => '1|2|3|4|5|6|0', 'redirect_message_days' => '', 'open_time' => '', 'redirect_message_open_time' => '', 'close_time' => '', 'redirect_message_close_time' => '', 'debug' => '0');
        $params = $helper->loadParams($row, $params_array);
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<?php 
        echo $pane->startPane("cf_watchman");
        echo $pane->startPanel('General', 'general');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('General settings', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Enter the url for the page you want to redirect to if the form is not available.\n        \tDefault is `index.php`?";
        $input = $helper->createInputTD("Redirect url", 'params[redirect_url]', $params->get('redirect_url'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $input = $helper->createHeaderTD('Plugin debug', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "If you set debug to Yes the form will display debug messages instead of re-directing.";
        $input = $helper->createYesNoTD("PlugIn debug", 'params[debug]', '', $params->get('debug'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
    </table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Users', 'users');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Watch user groups', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $acl =& JFactory::getACL();
        $gtree = $acl->get_group_children_tree(null, 'USERS', false);
        $tooltip = "Select the groups who can access this form";
        $input = $helper->createSelectTD('Groups with access', 'params[gid][]', $gtree, $params->get('gid'), array('size' => '10', 'multiple' => 'multiple', 'class' => 'cf_select'), $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection. if you leave this blank, redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_users]', $params->get('redirect_message_users'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
    </table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Dates and Times', 'date_time');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >

<?php 
        $input = $helper->createHeaderTD('Watch opening and closing dates', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Select the date when the form opens. Leave blank for always open";
        $config = array('showsTime' => "true");
        $input = $helper->createDateTD('Open date and time', 'params[open]', $params->get('open'), $attribs['input'], $tooltip, '', $config);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection.\n        \tIf you leave this blank,  redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_open]', $params->get('redirect_message_open'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Select the date when the form closes. Leave blank for always open";
        $input = $helper->createDateTD('Close date and time', 'params[close]', $params->get('close'), $attribs['input'], $tooltip, '', $config);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection. if you leave this blank, redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_close]', $params->get('redirect_message_close'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $input = $helper->createHeaderTD('Watch days of the week', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Select the days of the week that you want the form open.";
        $days_array = array('1' => 'MONDAY', '2' => 'TUESDAY', '3' => 'WEDNESDAY', '4' => 'THURSDAY', '5' => 'FRIDAY', '6' => 'SATURDAY', '0' => 'SUNDAY');
        foreach ($days_array as $k => $day) {
            $days_array[$k] = JHTML::_('select.option', $k, JText::_($day));
        }
        $input = $helper->createSelectTD('Open days', 'params[days][]', $days_array, $params->get('days'), array('size' => '7', 'multiple' => 'multiple', 'class' => 'cf_select'), $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection. if you leave this blank, redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_days]', $params->get('redirect_message_days'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $input = $helper->createHeaderTD('Watch opening and closing times', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Select the time of day that you want the form to open.";
        $attribs_time = array_merge($attribs['input'], array('size' => '10'));
        $input = $helper->createTimeTD('Opening time', 'params[open_time]', $params->get('open_time'), $attribs_time, $tooltip, 'open_time');
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection. if you leave this blank, redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_open_time]', $params->get('redirect_message_open_time'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Select the time of day that you want the form to close.";
        $input = $helper->createTimeTD('Closing time', 'params[close_time]', $params->get('close_time'), $attribs_time, $tooltip, 'close_time');
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection. if you leave this blank, redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_close_time]', $params->get('redirect_message_close_time'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
    </table>
 <?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Help', 'help');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Configure Watchman Plugin', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        ?>
        <tr>
            <td colspan='4' style='border:1px solid silver; padding:6px;'>
            <div>The plugin will redirect users away form your form unless the
            conditions set here are met.</div>
            <ul><li>You can select user groups; opening and closing dates (and times); days of the week;
            and daily opening and closing times. So, for example, you could set the
            form to be visible to registered users only from 08:00 on 31 Mar 09 to 19:00 on 14 Apr 2009;
            or to be visible only on Tuesdays and Thursdays between 12:00 and 15:00.</li>
            <li>The tests run in the order they are here, and the user will be redirected
            on the first 'failure'.</li>
            <li>If you leave the Redirect url blank users will redirect to the site
            home page.</li>
            <li>If you enter a Redirect message this will be displayed as a system message
            after the redirection (please check that your template shows system messages).
            If you leave the Redirect message empty the redirection will be 'invisible' as though
            the form was not there.</li>
            <li>Once this plugin is configured you must enable it in the Form 'Plugins'' tab.</li>
            </ul>
            </td>
        </tr>
    </table>
<?php 
        echo $pane->endPanel();
        echo $pane->endPane();
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        echo $helper->createHiddenArray($hidden_array);
        ?>
</form>
<?php 
        if ($style) {
            $doc->addStyleDeclaration($style);
        }
        if ($script) {
            $doc->addScriptDeclaration($script);
        }
    }
Exemplo n.º 7
0
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_chronocontact' . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        // identify and initialise the parameters used in this plugin
        $params_array = array('public_key' => '6LfNoAUAAAAAAKi8QZmjv-QHOvlGtyh509SG3FzG', 'private_key' => '6LfNoAUAAAAAABX7Dfw_9Pp4K4KVtKNCUHsIWG7O', 'ssl_server' => '0', 'theme' => 'red', 'lang' => 'en', 'api_server' => 'http://api.recaptcha.net', 'api_secure_server' => 'https://api-secure.recaptcha.net', 'verify_server' => 'api-verify.recaptcha.net', 'onsubmit' => 'before_email');
        $params = $helper->loadParams($row, $params_array);
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<?php 
        echo $pane->startPane("cf_recaptcha");
        echo $pane->startPanel('Configure', 'Configure');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Your ReCaptcha keys', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "Your ReCaptcha public key.";
        $input = $helper->createInputTD("ReCaptcha public key", 'params[public_key]', $params->get('public_key'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Your ReCaptcha private key.";
        $input = $helper->createInputTD("ReCaptcha private key", 'params[private_key]', $params->get('private_key'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $input = $helper->createHeaderTD('Custom setup options', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "Check yes if you want to use the ReCaptcha SSL server.";
        $input = $helper->createYesNoTD('SSL server', 'params[ssl_server]', '', $params->get('ssl_server'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Select one of the ReCaptcha themes.";
        $option_array = array('clean' => 'clean', 'red' => 'red', 'white' => 'white', 'blackglass' => 'blackglass', 'custom' => 'custom');
        foreach ($option_array as $k => $v) {
            $option_array[$k] = JHTML::_('select.option', $k, JText::_($v));
        }
        $input = $helper->createSelectTD('Theme', 'params[theme]', $option_array, $params->get('theme'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Select one of the ReCaptcha supported languages.";
        $option_array = array('en' => 'English', 'nt' => 'Dutch', 'fr' => 'French', 'de' => 'German', 'pt' => 'Portuguese', 'ru' => 'Russian', 'es' => 'Spanish', 'tr' => 'Turkish');
        foreach ($option_array as $k => $v) {
            $option_array[$k] = JHTML::_('select.option', $k, JText::_($v));
        }
        $input = $helper->createSelectTD('Language', 'params[lang]', $option_array, $params->get('lang'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Advanced', 'advanced');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Advanced parameters - do not change', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "The full URL of the ReCaptcha standard api server.\n        NB You should not normally need to change this.";
        $input = $helper->createInputTD("ReCaptcha server", 'params[api_server]', $params->get('api_server'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The full URL of the ReCaptcha SSL api server.\n        NB You should not normally need to change this.";
        $input = $helper->createInputTD("ReCaptcha secure server", 'params[api_secure_server]', $params->get('api_secure_server'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "The full URL of the ReCaptcha verify server.\n        NB You should not normally need to change this.";
        $input = $helper->createInputTD("ReCaptcha verify server", 'params[verify_server]', $params->get('verify_server'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        $hidden_array['params[onsubmit]'] = 'before_email';
        echo $helper->createHiddenArray($hidden_array);
        echo $pane->endPanel();
        echo $pane->startPanel('Help', 'help');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
    <thead>
        <tr>
            <th colspan='4' class='cf_header' >Configure ReCaptcha plugin</th>
        </tr>
    </thead>
    <tr>
        <td colspan='4' style='border:1px solid silver; padding:6px;'>
        <div>The plugin allows you to use ReCaptcha form verification with your ChronoForms Form.</div>
        <div><a href="http://recaptcha.net/">ReCAPTCHA</a> is a completely independent verification system
        that is widely used on the Internet - see their site for more information.</div>
        <ul><li>The plugin comes with a pair of global ReCaptcha so that it will work immediately.
        For your own security we strongly recommend that you register at the
        <a href="http://recaptcha.net/">ReCaptcha site</a> and get your
        own keys limited to your site. Registration is simple, free and quick.
        When you have your keys copy and paste them over the keys here and re-save the plugin.
        You may use the same keys with any number of forms on your site.</li>
        <li>You will need to include the ReCaptcha box in your form HTML using <span style='color:blue;'>{ReCaptcha}</span>.
        You can do this using a 'Text' item from the Toolbox with a value of {ReCaptcha}.
        You may need to editt the styling a little to format the box correctly
        (try removing the 'form_element' class from the surrounding div).</li>
        <li>If your form is using SSL and the url has an 'https' prefix, set SSL Server
        to yes - otherwise leave it as No.</li>
        <li>The theme list are those provided as default by ReCaptcha, it is possible to
        develop a custom theme - please see the instructions on the ReCaptcha FAQs and Wiki.</li>
        <li>The languages listed are those provided as default by ReCaptcha, to change or add other
        languages please see the ReCaptcha site.</li>
        <li>You should not need to change the server settings unless ReCaptcha
        make a change in their service.</li>
        <li>Once this plugin is configured you must enable it in the Form 'Plugins'' tab.</li></ul>
        </td>
    </tr>
    </table>
<?php 
        echo $pane->endPane();
        echo $pane->endPanel();
        ?>
</form>
<?php 
        if ($style) {
            $doc->addStyleDeclaration($style);
        }
        if ($script) {
            $doc->addScriptDeclaration($script);
        }
    }
Exemplo n.º 8
0
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        // identify and initialise the parameters used in this plugin
        $params_array = array('debugging' => '0', 'onsubmit' => 'before_email', 'stepscount' => '', 'formsnames' => '', 'stepsnavigation' => '0');
        $params = $helper->loadParams($row, $params_array);
        $messages[] = '$params: ' . print_r($params, true);
        if ($params->get('debugging')) {
            $helper->showPluginDebugMessages($messages);
        }
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<?php 
        echo $pane->startPane("multipage");
        echo $pane->startPanel('Multi Page settings', "settings");
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Configure the plugin', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        foreach (range(1, 20) as $v) {
            $option_array[$v] = JHTML::_('select.option', $v, JText::_($v));
        }
        $tooltip = "Please select the number of separate form steps.<br />\n        \tDon't count the last thank your page, a confimation page, or the onsubmit routine.";
        $input = $helper->createSelectTD("Number of Steps", "params[stepscount]", $option_array, $params->get('stepscount'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the forms names for each step separated by a comma, with no spaces.<br />\n        \tThere must be the same number of forms as the Number of steps above";
        $input = $helper->createInputTD("Step form names", "params[formsnames]", $params->get('formsnames'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the name of the submit button which when clicked will terminate the navigation chain";
        $input = $helper->createInputTD("Finalize button name", "params[finalbuttonname]", $params->get('finalbuttonname'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enable navigating between step using urls with &cfformstep=n";
        $input = $helper->createYesNoTD("Enable Steps navigation", "params[stepsnavigation]", '', $params->get('stepsnavigation'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Show debug information on Submit?";
        $input = $helper->createYesNoTD("Debugging", "params[debugging]", '', $params->get('debugging'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Help", 'Legend3');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('How to use the Multi page plugin', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        ?>
    <tr>
        <td colspan='4' style='border:1px solid silver; padding:6px;'>
        <div>The plugin allows you to link several ChronoForms together into a sequence.</div>
        <ul><li>Decide on the number of steps you want in your form sequence and create a form for each step.</li>
        <li>Put the number of form steps in the Configuration tab</li>
        <li>List the names of the forms in the input box: form_1,form_2,. . .</li>
        <li>Select Steps Navigation if you want to be able to navigate directly to form steps using
        urls with the &cfformstep parameter
        e.g. <span style='color:blue;'>index.php?option=com_chronocontact&chronoformname=test_form_8&cfformstep=2</span></li>
        </ul>
        </td>
    </tr>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->endPane();
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        $hidden_array['params[onsubmit]'] = 'before_email';
        echo $helper->createHiddenArray($hidden_array);
        ?>
</form>
<?php 
    }