Plugin Directory

Changeset 538753


Ignore:
Timestamp:
05/02/2012 01:31:18 AM (14 years ago)
Author:
bholub
Message:

adding auto resize option

Location:
wodtogether-whiteboards/trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • wodtogether-whiteboards/trunk/wodtogether-whiteboards.php

    r537787 r538753  
    4444    add_settings_field('wodtogether_required_category', 'Required Category', 'wodtogether_setting_required_category', 'wodtogether', 'wodtogether_main');
    4545    add_settings_field('wodtogether_iframe_height', 'iFrame Height (in pixels)', 'wodtogether_setting_iframe_height', 'wodtogether', 'wodtogether_main');
     46    add_settings_field('wodtogether_auto_resize', 'Attempt Auto-Resize', 'wodtogether_setting_auto_resize', 'wodtogether', 'wodtogether_main');
    4647    add_settings_field('wodtogether_show_wods', 'Show WOD Details by Default', 'wodtogether_setting_show_wods', 'wodtogether', 'wodtogether_main');
    4748}
     
    8384    echo "<input id='wodtogether_iframe_height' name='wodtogether_options[iframe_height]' size='20' type='text' value='{$options['iframe_height']}' />";
    8485}
     86function wodtogether_setting_auto_resize() {
     87    $options = get_option('wodtogether_options');
     88   
     89    $checked = (isset($options['auto_resize']) && $options['auto_resize']) ? ' checked' : '';
     90    echo "<input id='wodtogether_auto_resize' name='wodtogether_options[auto_resize]' {$checked} type='checkbox' value='1' />
     91    <p><strong>Recommended!</strong> This will attempt to automatically resize the whiteboard iframe so there are no scrollbars.</p>";
     92}
    8593function wodtogether_setting_show_wods() {
    8694    $options = get_option('wodtogether_options');
     
    115123 * END WODTogether Settings
    116124 */
    117 
     125 
    118126// count how many whiteboards have been loaded for this page
    119127$whiteboarded = 0;
     128$wodtogetherSettings = get_option('wodtogether_options');
     129
     130if ($wodtogetherSettings['auto_resize']) {
     131    wp_enqueue_script('wodtogether-whiteboards',
     132        WP_PLUGIN_URL . '/wodtogether-whiteboards/wodtogether-whiteboards.js',
     133        array('jquery')
     134    );
     135}
    120136
    121137/**
     
    126142{
    127143    global $whiteboarded;
    128    
    129     $wodtogetherSettings = get_option('wodtogether_options');
     144    global $wodtogetherSettings;
    130145   
    131146    if (isset($wodtogetherSettings['required_category']) && $wodtogetherSettings['required_category']) {
     
    155170    if ($whiteboarded >= 5) {
    156171        return $input . "<br /><a href=\"http://wodtogether.com/whiteboard/view/date/{$date}/gym/{$gym_id}/embed/remote{$show_wods}\">View Whitebaord</a>";
    157     }
     172    } 
    158173    $whiteboarded++;
    159     $whiteboardIframeHtml = "<br /> <iframe width=\"98%\" height=\"{$height}\" src=\"http://wodtogether.com/whiteboard/view/date/{$date}/gym/{$gym_id}/embed/remote{$show_wods}\"></iframe>";
    160    
    161    
     174    $whiteboardIframeHtml = "<br /> <iframe width=\"98%\" height=\"{$height}\" src=\"http://wodtogether.com/whiteboard/view/date/{$date}/gym/{$gym_id}/embed/remote{$show_wods}\" id=\"wb_{$date}_{$gym_id}\"></iframe>";   
    162175
    163176    return $input . $whiteboardIframeHtml;
Note: See TracChangeset for help on using the changeset viewer.