Example #1
0
 /**
  * Create a 4x<td> row with tooltip, empty td, title & input field
  *
  * @param $title string title
  * @param $name string field name
  * @param $value string field value
  * @param $maxlength integer max input length
  * @param $attributes string additional input attributes
  * @param $tooltip string tooltip
  * @param $id string
  *
  */
 function createInputTD($title, $name, $value = '', $null = '', $attributes = array(), $tooltip = '', $id = false)
 {
     $return = ChronoContactHelperPlugin::createTitleTD($title, $tooltip);
     $return .= ChronoContactHelperPlugin::createInput($name, $value, $attributes, $id);
     return $return;
 }
Example #2
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);
    }