Changeset 767


Ignore:
Timestamp:
01/20/13 00:23:08 (22 months ago)
Author:
ofer
Message:

Fixed for widgets that allow easier inclusion with their appropriate shortcodes.

Location:
trunk/WordPress/plugin/transposh
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/transposh.php

    r764 r767  
    12131213        if (isset($atts['widget'])) { 
    12141214            ob_start(); 
    1215             $this->widget->widget(array('before_widget' => '', 'before_title' => '', 'after_widget' => '', 'after_title' => ''), array('title' => '', 'widget_file' => $atts['widget'])); 
     1215            $this->widget->widget(array('before_widget' => '', 'before_title' => '', 'after_widget' => '', 'after_title' => ''), array('title' => '', 'widget_file' => $atts['widget']), true); 
    12161216            $widgetcontent = ob_get_contents(); 
    12171217            ob_end_clean(); 
  • trunk/WordPress/plugin/transposh/widgets/default/tpw_default.php

    r691 r767  
    3939        echo '<span class="' . NO_TRANSLATE_CLASS . '">'; // wrapping in no_translate to avoid translation of this list 
    4040 
    41         echo '<select name="lang" id="lang" onchange="document.location.href=this.options[this.selectedIndex].value;">'; // this is a select box which posts on change 
     41        echo '<select name="lang" onchange="document.location.href=this.options[this.selectedIndex].value;">'; // this is a select box which posts on change 
    4242        foreach ($args as $langrecord) { 
    4343            $is_selected = $langrecord['active'] ? " selected=\"selected\"" : ""; 
  • trunk/WordPress/plugin/transposh/widgets/dropdown/tpw_image_dropdown.css

    r757 r767  
    44/* Code adapted from: http://www.jankoatwarpspeed.com/post/2009/07/28/reinventing-drop-down-with-css-jquery.aspx */ 
    55 
    6 .dropdown, .dropdown dd, .dropdown dt, .dropdown ul { margin:0px; padding:0px; } 
     6.dropdown, .dropdown dd, .dropdown dt, .dropdown ul, .dropdown li { margin:0px !important; padding:0px !important; } 
    77.dropdown dd { position:relative; z-index:9999;} 
    88.dropdown a, .dropdown a:visited { color:#816c5b; text-decoration:none; outline:none;} 
  • trunk/WordPress/plugin/transposh/widgets/dropdown/tpw_image_dropdown.js

    r739 r767  
    55    $(function() { 
    66        $(".dropdown dt a").click(function() { 
    7             $(".dropdown dd ul").toggle(); 
     7            $(this).parents(".dropdown").find("dd ul").toggle(); 
    88            return false; 
    99        }); 
     
    1111        $(".dropdown dd ul li a").click(function() { 
    1212            var text = $(this).html(); 
    13             $(".dropdown dt a span").html(text); 
    14             $(".dropdown dd ul").hide(); 
     13            $(this).parents(".dropdown").find("dt a span").html(text); 
     14            $(this).parents(".dropdown").find("dd ul").hide(); 
    1515 
    16             document.location.href=getSelectedValue("tp_dropdown"); 
     16            document.location.href=$(this).parents(".dropdown").find("dt a span.value").html(); 
    1717            return false; 
    1818        }); 
    19  
    20         function getSelectedValue(id) { 
    21             return $("#" + id).find("dt a span.value").html(); 
    22         } 
    2319 
    2420        $(document).bind('click', function(e) { 
  • trunk/WordPress/plugin/transposh/widgets/dropdown/tpw_image_dropdown.php

    r757 r767  
    4141        $plugpath = parse_url($my_transposh_plugin->transposh_plugin_url, PHP_URL_PATH); 
    4242 
    43         echo '<dl id="tp_dropdown" class="dropdown">'; 
     43        echo '<dl class="tp_dropdown dropdown">'; 
    4444        /* TRANSLATORS: this is what appears in the select box in dropdown subwidget */ 
    4545        echo '<dt><a href="#"><span>' . __('Select language', TRANSPOSH_TEXT_DOMAIN) . '</span></a></dt><dd><ul class="' . NO_TRANSLATE_CLASS . '">'; 
     
    4848            echo '<li><a href="#"><img class="flag" src="' . "$plugpath/img/flags/{$langrecord['flag']}" . '.png" alt="' . $langrecord['langorig'] . '"/> ' . $langrecord['langorig'] . '<span class="value">' . $langrecord['url'] . '</span></a></li>'; 
    4949        } 
    50  
    5150        echo '</ul></dd></dl>'; 
    5251    } 
  • trunk/WordPress/plugin/transposh/widgets/select2/tpw_select2.php

    r735 r767  
    3737        echo '<span class="' . NO_TRANSLATE_CLASS . '">';  
    3838 
    39         echo '<select style="width:100%" name="lang" class="tp_lang2" id="tp_lang2" onchange="document.location.href=this.options[this.selectedIndex].value;">';  
     39        echo '<select style="width:100%" name="lang" class="tp_lang2" onchange="document.location.href=this.options[this.selectedIndex].value;">';  
    4040        foreach ($args as $langrecord) { 
    4141            $is_selected = $langrecord['active'] ? " selected=\"selected\"" : ""; 
  • trunk/WordPress/plugin/transposh/wp/transposh_widget.php

    r761 r767  
    246246     * @param array $args Contains such as $before_widget, $after_widget, $before_title, $after_title, etc 
    247247     */ 
    248     function widget($args, $instance) { 
     248    function widget($args, $instance, $extcall = false) { 
    249249        // extract args given by wordpress 
    250250        extract($args); 
     
    280280        $tmpclass = new $class; 
    281281        $tmpclass->tp_widget_do($widget_args); 
     282        if ($extcall) { 
     283            $tmpclass->tp_widget_css($instance['widget_file'],$this->transposh->transposh_plugin_dir, $this->transposh->transposh_plugin_url); 
     284            $tmpclass->tp_widget_js($instance['widget_file'],$this->transposh->transposh_plugin_dir, $this->transposh->transposh_plugin_url); 
     285            // don't display edit and other things for shortcode embedding 
     286            if (isset($after_widget)) echo $after_widget; 
     287            // increase the number of calls for unique IDs 
     288            self::$draw_calls++; 
     289            return; 
     290        } 
    282291        //} 
    283292        //at least one language showing - add the edit box if applicable 
Note: See TracChangeset for help on using the changeset viewer.