Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

render_dash_tile_colour_chooser()

Description

Renders a new section to pick/ select a colour. User can either use the color
picker or select a colour from the ones already available (config option)

Parameters

ColumnTypeDefaultDescription
$tile_style string
$tile_colour string Hexadecimal code (without the # sign). Example: 0A8A0E

Return

void

Location

include/dash_functions.php lines 1608 to 1701

Definition

 
function render_dash_tile_colour_chooser($tile_style$tile_colour)
    {
    global 
$lang$baseurl;
    if(
'ftxt' == $tile_style)
        {
        
?>
        <div class="Question">
        
        
}
    else
        {
        
?>
        <span id="tile_style_colour_chooser" style="display: none;">
        
        
}
        
?>
        <label> echo escape($lang['colour']); ?></label>
   
        <script src=" echo $baseurl?>/lib/spectrum/spectrum.js"></script>
        <link rel="stylesheet" href=" echo $baseurl?>/lib/spectrum/spectrum.css" />
        <input id="tile_style_colour" name="tlstylecolour" type="text" onchange="update_tile_preview_colour(this.value);" value=" echo $tile_colour?>">
        <script>
            jQuery('#tile_style_colour').spectrum({
                showAlpha: true,
                showInput: true,
                clickoutFiresChange: true,
                preferredFormat: 'rgb'
            });
        </script>

    <!-- Show/ hide colour picker/ selector -->
    <script>
        function update_tile_preview_colour(colour)
            {
            jQuery('#previewdashtile').css('background-color', '#' + colour);
            }

    
    
if('ftxt' == $tile_style)
        {
        
?>
        jQuery(document).ready(function() {
            if(jQuery('#tile_style_colour').val() != '')
                {
                update_tile_preview_colour(' echo $tile_colour?>');
                }
        });
        
        
}
    else
        {
        
?>
        jQuery(document).ready(function() {
            if(jQuery('#tile_style_ echo $tile_style?>').prop('checked'))
                {
                jQuery('#tile_style_colour_chooser').show();
                update_tile_preview_colour(' echo $tile_colour?>');
                }
        });

        jQuery('input:radio[name="tlstyle"]').change(function() {
            if(jQuery(this).prop('checked') && jQuery(this).val() == ' echo $tile_style?>')
                {
                jQuery('#tile_style_colour_chooser').show();
                }
            else
                {
                jQuery('#tile_style_colour_chooser').hide();
                jQuery('#tile_style_colour').val('');
                jQuery('#tile_style_colour').removeAttr('style');
                jQuery('#previewdashtile').removeAttr('style');
                }
        });
        
        
}
        
?>
    </script>
    
    
if('ftxt' == $tile_style)
        {
        
?>
        </div>
        
        
}
    else
        {
        
?>
        </span>
        
        
}
        
?>
    <div class="clearerleft"></div>
    
    
}

This article was last updated 11th December 2024 19:35 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.