Sha256: f408dcd86db3a7e931c8bde137a86514e6c86be235d653cffed94ce854c3f77f

Contents?: true

Size: 1.75 KB

Versions: 96

Compression:

Stored size: 1.75 KB

Contents

##   RSence
 #   Copyright 2010 Riassence Inc.
 #   http://riassence.com/
 #
 #   You should have received a copy of the GNU General Public License along
 #   with this software package. If not, contact licensing@riassence.com
 ##


# RSence 'Welcome' plugin.
# An instance of a class extended from GUIPlugin includes basic functionality
# to initialize their user interface from YAML files without extra code.
class WelcomePlugin < GUIPlugin
  
  def gui_params( msg )
    params = super
    params[:text] = {
      :welcome => file_read('text/welcome.html')
    }
    return params
  end
  
  # Responder for the value defined as `:close` in values.yaml
  # A responder is called whenever its value is changed on the client.
  def close_button( msg, value )
    
    # Gets the value of the checkbox
    dont_show_again = get_ses(msg)[:dont_show_again]
    
    # If both the checkbox is checked (true) and the button clicked,
    # calls the disable_self method defined below.
    if (value.data == 1) and (dont_show_again.data == true)
      disable_self
    end
    
    # For most uses of HClickButton combined with a value, resetting the data
    # to 0 (to make the button clickable again) is done like this:
    # value.set( msg, 0 )
    
    # Responders should always return true, until more specific return
    # values are defined in a future version of RSence.
    # Returning false causes the responder to be called on every request
    # the client makes until the responder returns true.
    return true
  end
  
  # Called by close_button, when the checkbox is checked (true) and the Close-button is clicked (1).
  def disable_self
    file_write( 'disabled', 'This plugin is disabled. Remove this file to re-enable.' )
    @plugins.unload_bundle( @name )
  end
  
end

Version data entries

96 entries across 96 versions & 2 rubygems

Version Path
rsence-pre-2.3.0.15 setup/welcome/welcome.rb
rsence-pre-2.3.0.14 setup/welcome/welcome.rb
rsence-pre-2.3.0.13 setup/welcome/welcome.rb
rsence-pre-2.3.0.12 setup/welcome/welcome.rb
rsence-pre-2.3.0.11 setup/welcome/welcome.rb
rsence-pre-2.3.0.10 setup/welcome/welcome.rb
rsence-pre-2.3.0.9 setup/welcome/welcome.rb
rsence-pre-2.3.0.8 setup/welcome/welcome.rb
rsence-pre-2.3.0.7 setup/welcome/welcome.rb
rsence-pre-2.3.0.6 setup/welcome/welcome.rb
rsence-pre-2.3.0.5 setup/welcome/welcome.rb
rsence-pre-2.3.0.4 setup/welcome/welcome.rb
rsence-pre-2.3.0.3 setup/welcome/welcome.rb
rsence-pre-2.3.0.2 setup/welcome/welcome.rb
rsence-pre-2.3.0.1 setup/welcome/welcome.rb
rsence-pre-2.3.0.0 setup/welcome/welcome.rb
rsence-2.2.5 setup/welcome/welcome.rb
rsence-2.2.4 setup/welcome/welcome.rb
rsence-2.2.3 setup/welcome/welcome.rb
rsence-2.2.2 setup/welcome/welcome.rb