Development

Changeset 5322

You must first sign up to be able to contribute.

Changeset 5322

Show
Ignore:
Timestamp:
10/01/07 04:01:56 (6 years ago)
Author:
dwhittle
Message:

dwhittle: updated sfPrototypeWindowPlugin, released 1.0.4

  • updated prototype window class to 1.3
  • added example module
  • updated config + helper to use sf_prototype_window_web_dir
  • tweaked config loading
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfPrototypeWindowPlugin/README

    r3977 r5322  
    1616 
    1717Please see the wiki (http://www.symfony-project.com/trac/wiki/sfPrototypeWindowPlugin) or the modules/sfPrototypeWindowPlugin source for code examples. 
    18  
  • plugins/sfPrototypeWindowPlugin/config/config.php

    r3977 r5322  
    11<?php 
    22 
    3 sfConfig::set('sf_prototype_window_js_dir',  '/sfPrototypeWindowPlugin/js'); 
    4 sfConfig::set('sf_prototype_window_themes_dir', '/sfPrototypeWindowPlugin/themes'); 
     3if(!sfConfig::get('sf_prototype_window_web_dir', false)) 
     4
     5  sfConfig::set('sf_prototype_window_web_dir',  '/sfPrototypeWindowPlugin'); 
     6
  • plugins/sfPrototypeWindowPlugin/lib/helper/WindowHelper.php

    r4741 r5322  
    1313/** 
    1414 * @package    symfony.runtime.addon 
     15 * @subpackage helper 
    1516 * @author     Dustin Whittle <dustin.whittle@symfony-project.com> 
    1617 * @version    SVN: $Id$ 
    1718 */ 
    1819 
     20/** 
     21 * link_to_prototype_dialog creates a dialog box using prototype. 
     22 * 
     23 * 
     24 * Example: 
     25 * <code> 
     26 *   <?php use_helper('Window'); ?> 
     27 *   <?php if(sfConfig::get('sf_debug')) { echo link_to_function('open debug window', 'showDebug()'); } ?> 
     28 *   <?php echo link_to_prototype_dialog('hello', 'hello world', 'alert', array('className' => 'alphacube')); ?> 
     29 * </code> 
     30 * 
     31 * @link http://prototype-window.xilinus.com/documentation.html#initialize 
     32 * 
     33 * @param string $name 
     34 * @param string $content 
     35 * @param string $dialog_type 'alert' (default), 'confirm' or 'info' (info dialogs should be destroyed with a javascript function call 'win.destroy') 
     36 * @param array $options for this helper depending the dialog_kind: http://prototype-window.xilinus.com/documentation.html#alert (#confirm or #info) 
     37 * @param array $options_html 
     38 * @return string 
     39 */ 
     40function link_to_prototype_dialog($name, $content, $dialog_type = 'alert', $options = array(), $options_html = array()) 
     41{ 
     42 /** 
     43  * @todo to get from config default options 
     44  * $window_options = array_merge(array('title' => 'New Dialog', 'className' => 'dialog', 'width' => '200', 'height' => '100', 'zIndex' => '100', 'draggable' => 'true', 'resizable' => 'true', 'opacity' => 1, 'showEffect' => 'Effect.BlindDown', 'hideEffect' => 'Effect.SwitchOff'), _parse_attributes($window_options)); 
     45  */ 
     46 
     47  _addPrototypeWindowResources($options); 
     48 
     49  $options = _parse_attributes($options); 
     50 
     51  // Convert string options 
     52  $stringOptions = array('title', 'className', 'okLabel', 'buttonClass', 'id'); 
     53  $options = _convertStringOptions($options, $stringOptions); 
     54 
     55  // Add debug 
     56  $options = _addDebug($options); 
     57 
     58  $js_code = 'Dialog.'. $dialog_type. '(\''. escape_javascript($content). '\', '. _options_for_javascript($options). ');'; 
     59 
     60  $options_html = _parse_attributes($options_html); 
     61  $options_html['href'] = isset($options_html['href']) ? $options_html['href'] : '#'; 
     62  $options_html['onclick'] = isset($options_html['onclick']) ? $options_html['onclick'] . $js_code : $js_code; 
     63 
     64  return content_tag('a', $name, $options_html); 
     65} 
     66 
     67/** 
     68 * link_to_prototype_window creates a window using prototype. 
     69 * 
     70 * Example: 
     71 * <code> 
     72 *   <?php use_helper('Window'); ?> 
     73 *   <?php if(sfConfig::get('sf_debug')) { echo link_to_function('open debug window', 'showDebug()'); } ?> 
     74 *   <?php echo link_to_prototype_window('Google', 'google', array('title' => 'Google', 'url' => 'http://google.com', 'width' => '520', 'height' => '350', 'center' => 'true', 'className' => 'alphacube'), array('absolute' => true)); ?> 
     75 *   <?php echo link_to_prototype_window('DW', 'dw', array('title' => 'DW', 'url' => '@homepage', 'width' => '520', 'height' => '350', 'center' => 'true', 'className' => 'alphacube')); ?> 
     76 * </code> 
     77 * 
     78 * @link http://prototype-window.xilinus.com/documentation.html#initialize 
     79 * 
     80 * @param string $name 
     81 * @param string $window_id must be unique and it's destroyed on window close. 
     82 * @param array $options options for this helper: http://prototype-window.xilinus.com/documentation.html#initialize 
     83 * @param array $options_html 
     84 * @return string 
     85 */ 
     86function link_to_prototype_window($name, $window_id, $options, $options_html = array()) 
     87{ 
    1988  /** 
    20    * link_to_prototype_dialog creates a dialog box using prototype. 
    21    * 
    22    * 
    23    * Example: 
    24    * <code> 
    25    *   <?php use_helper('Window'); ?> 
    26    *   <?php if(sfConfig::get('sf_debug')) { echo link_to_function('open debug window', 'showDebug()'); } ?> 
    27    *   <?php echo link_to_prototype_dialog('hello', 'hello world', 'alert', array('className' => 'alphacube')); ?> 
    28    * </code> 
    29    * 
    30    * @link http://prototype-window.xilinus.com/documentation.html#initialize 
    31    * 
    32    * @param string $name 
    33    * @param string $content 
    34    * @param string $dialog_type 'alert' (default), 'confirm' or 'info' (info dialogs should be destroyed with a javascript function call 'win.destroy') 
    35    * @param array $options for this helper depending the dialog_kind: http://prototype-window.xilinus.com/documentation.html#alert (#confirm or #info) 
    36    * @param array $options_html 
    37    * @return string 
    38    */ 
    39   function link_to_prototype_dialog($name, $content, $dialog_type = 'alert', $options = array(), $options_html = array()) 
    40   { 
    41     /** 
    42     * @todo to get from config default options 
    43     * $window_options = array_merge(array('title' => 'New Dialog', 'className' => 'dialog', 'width' => '200', 'height' => '100', 'zIndex' => '100', 'draggable' => 'true', 'resizable' => 'true', 'opacity' => 1, 'showEffect' => 'Effect.BlindDown', 'hideEffect' => 'Effect.SwitchOff'), _parse_attributes($window_options)); 
    44     */ 
    45  
    46     _addSfPrototypeWindowResources($options); 
    47  
    48     $options = _parse_attributes($options); 
    49  
    50     // Convert string options 
    51     $stringOptions = array('title', 'className', 'okLabel', 'buttonClass', 'id'); 
    52     $options = _convertStringOptions($options, $stringOptions); 
    53  
    54     // Add debug 
    55     $options = _addDebug($options); 
    56  
    57     $js_code = 'Dialog.'. $dialog_type. '(\''. escape_javascript($content). '\', '. _options_for_javascript($options). ');'; 
    58  
    59     $options_html = _parse_attributes($options_html); 
    60     $options_html['href'] = isset($options_html['href']) ? $options_html['href'] : '#'; 
    61     $options_html['onclick'] = isset($options_html['onclick']) ? $options_html['onclick'] . $js_code : $js_code; 
    62  
    63     return content_tag('a', $name, $options_html); 
    64   } 
    65  
    66   /** 
    67    * link_to_prototype_window creates a window using prototype. 
    68    * 
    69    * Example: 
    70    * <code> 
    71    *   <?php use_helper('Window'); ?> 
    72    *   <?php if(sfConfig::get('sf_debug')) { echo link_to_function('open debug window', 'showDebug()'); } ?> 
    73    *   <?php echo link_to_prototype_window('Google', 'google', array('title' => 'Google', 'url' => 'http://google.com', 'width' => '520', 'height' => '350', 'center' => 'true', 'className' => 'alphacube'), array('absolute' => true)); ?> 
    74    *   <?php echo link_to_prototype_window('DW', 'dw', array('title' => 'DW', 'url' => '@homepage', 'width' => '520', 'height' => '350', 'center' => 'true', 'className' => 'alphacube')); ?> 
    75    * </code> 
    76    * 
    77    * @link http://prototype-window.xilinus.com/documentation.html#initialize 
    78    * 
    79    * @param string $name 
    80    * @param string $window_id must be unique and it's destroyed on window close. 
    81    * @param array $options options for this helper: http://prototype-window.xilinus.com/documentation.html#initialize 
    82    * @param array $options_html 
    83    * @return string 
    84    */ 
    85   function link_to_prototype_window($name, $window_id, $options, $options_html = array()) 
    86   { 
    87     /** 
    88     * @todo to get from config default options 
    89     * $options = array_merge(array('title' => 'New Window', 'className' => 'dialog', 'width' => '600', 'height' => '450', 'zIndex' => '100', 'draggable' => 'true', 'resizable' => 'true', 'opacity' => 1, 'showEffect' => 'Effect.BlindDown', 'hideEffect' => 'Effect.SwitchOff'), _parse_attributes($options)); 
    90     */ 
    91  
    92     _addSfPrototypeWindowResources($options); 
    93  
    94     // Convert string options 
    95     $stringOptions = array('title', 'className'); 
    96     $options = _convertStringOptions($options, $stringOptions); 
    97  
    98     if (isset($options['url'])) 
    99     { 
    100       $options['url'] = _method_option_to_s(url_for($options['url'], isset($options_html['absolute']) ? true : false)); 
    101     } 
    102     unset($options_html['absolute']); 
    103  
    104     $front = isset($options['front']) ? $window_id.'.toFront();' : ''; 
    105     unset($options['front']); 
    106  
    107     $status = isset($options['status']) ? $window_id.'.setStatusBar(\''.$options['status'].'\');' : ''; 
    108     unset($options['status']); 
    109  
    110     $show = isset($options['center']) ? $window_id.'.showCenter();' : $window_id.'.show();'; 
    111     unset($options['center']); 
    112  
    113     $destroy = $window_id. '.setDestroyOnClose();'; 
    114     $options = _options_for_javascript($options); 
    115     $options_html = _parse_attributes($options_html); 
    116  
    117     $js_code = 'var ' . $window_id . ' = new Window('. $options.');'. $front. $status. $show. $destroy; 
    118     $js_code = 'var ' . $window_id . ' = new Window('. $options.');'.$front. $status. $show. $destroy.' return false;'; 
    119  
    120     $options_html['href'] = isset($options_html['href']) ? $options_html['href'] : '#'; 
    121     $options_html['onclick'] = isset($options_html['onclick']) ? $options_html['onclick'] . $js_code : $js_code; 
    122  
    123     return content_tag('a', $name, $options_html); 
    124   } 
    125  
    126   /** 
    127    * link_to_prototype_window creates a window from content from the page using 
    128    * prototype. 
    129    * 
    130    * @link http://prototype-window.xilinus.com/documentation.html#initialize 
    131    * 
    132    * @param string $name 
    133    * @param string $window_id must be unique and it's destroyed on window close. 
    134    * @param 
    135    * @param array $options options for this helper: http://prototype-window.xilinus.com/documentation.html#initialize 
    136    * @param array $options_html 
    137    * @return string 
    138    */ 
    139   function link_to_prototype_window_from_content($name, $window_id, $content_id, $options, $options_html = array()) 
    140   { 
    141     _addSfPrototypeWindowResources($options); 
    142  
    143     // Convert string options 
    144     $stringOptions = array('title', 'className'); 
    145     $options = _convertStringOptions($options, $stringOptions); 
    146  
    147     $set_content = $window_id. '.setContent(\''. $content_id. '\', true, true);'; 
    148     $show = $window_id. '.show();'; 
    149     $destroy = $window_id. '.setDestroyOnClose();'; 
    150  
    151     $options = _options_for_javascript($options); 
    152     $options_html = _parse_attributes($options_html); 
    153  
    154     $js_code = 'var '. $window_id. ' = new Window('. $options.');'. $set_content. $show. $destroy; 
    155  
    156     $options_html['href'] = isset($options_html['href']) ? $options_html['href'] : '#'; 
    157     $options_html['onclick'] = isset($options_html['onclick']) ? $options_html['onclick'] . $js_code : $js_code; 
    158  
    159     return content_tag('a', $name, $options_html); 
    160   } 
    161  
    162   /** 
    163    * Return a link to a debug prototype window 
    164    * 
    165    * @author COil 
    166    */ 
    167    function link_to_prototype_debug($name) 
    168    { 
    169      if(sfConfig::get('sf_debug')) 
    170      { 
    171        return link_to_function($name, 'showDebug()'); 
    172      } 
    173    } 
    174  
    175   /** 
    176    * Add plugin specific resources 
    177    * 
    178    * @author COil 
    179    */ 
    180   function _addSfPrototypeWindowResources($options) 
    181   { 
    182     $default_classname_style = array('dialog'); 
    183  
    184     $request = sfContext::getInstance()->getResponse(); 
    185  
    186     // proto 
    187     $request->addJavascript(sfConfig::get('sf_prototype_web_dir'). '/js/prototype'); 
    188     $request->addJavascript(sfConfig::get('sf_prototype_web_dir'). '/js/effects'); 
    189  
    190     // window 
    191     $request->addJavascript(sfConfig::get('sf_prototype_window_js_dir').'/window'); 
    192     $request->addJavascript(sfConfig::get('sf_prototype_window_js_dir').'/window_ext'); 
    193  
    194     if(isset($options['className']) && (!in_array($options['className'], $default_classname_style))) 
     89   * @todo to get from config default options 
     90   * $options = array_merge(array('title' => 'New Window', 'className' => 'dialog', 'width' => '600', 'height' => '450', 'zIndex' => '100', 'draggable' => 'true', 'resizable' => 'true', 'opacity' => 1, 'showEffect' => 'Effect.BlindDown', 'hideEffect' => 'Effect.SwitchOff'), _parse_attributes($options)); 
     91   */ 
     92 
     93  _addPrototypeWindowResources($options); 
     94 
     95  // Convert string options 
     96  $stringOptions = array('title', 'className'); 
     97  $options = _convertStringOptions($options, $stringOptions); 
     98 
     99  if (isset($options['url'])) 
     100  { 
     101    $options['url'] = _method_option_to_s(url_for($options['url'], isset($options_html['absolute']) ? true : false)); 
     102  } 
     103  unset($options_html['absolute']); 
     104 
     105  $front = isset($options['front']) ? $window_id.'.toFront();' : ''; 
     106  unset($options['front']); 
     107 
     108  $status = isset($options['status']) ? $window_id.'.setStatusBar(\''.$options['status'].'\');' : ''; 
     109  unset($options['status']); 
     110 
     111  $show = isset($options['center']) ? $window_id.'.showCenter();' : $window_id.'.show();'; 
     112  unset($options['center']); 
     113 
     114  $destroy = $window_id. '.setDestroyOnClose();'; 
     115  $options = _options_for_javascript($options); 
     116  $options_html = _parse_attributes($options_html); 
     117 
     118  $js_code = 'var ' . $window_id . ' = new Window('. $options.');'. $front. $status. $show. $destroy; 
     119  $js_code = 'var ' . $window_id . ' = new Window('. $options.');'.$front. $status. $show. $destroy.' return false;'; 
     120 
     121  $options_html['href'] = isset($options_html['href']) ? $options_html['href'] : '#'; 
     122  $options_html['onclick'] = isset($options_html['onclick']) ? $options_html['onclick'] . $js_code : $js_code; 
     123 
     124  return content_tag('a', $name, $options_html); 
     125
     126 
     127/** 
     128 * link_to_prototype_window creates a window from content from the page using 
     129 * prototype. 
     130 * 
     131 * @link http://prototype-window.xilinus.com/documentation.html#initialize 
     132 * 
     133 * @param string $name 
     134 * @param string $window_id must be unique and it's destroyed on window close. 
     135 * @param 
     136 * @param array $options options for this helper: http://prototype-window.xilinus.com/documentation.html#initialize 
     137 * @param array $options_html 
     138 * @return string 
     139 */ 
     140function link_to_prototype_window_from_content($name, $window_id, $content_id, $options, $options_html = array()) 
     141
     142  _addPrototypeWindowResources($options); 
     143 
     144  // convert string options 
     145  $stringOptions = array('title', 'className'); 
     146  $options = _convertStringOptions($options, $stringOptions); 
     147 
     148  $set_content = $window_id. '.setContent(\''. $content_id. '\', true, true);'; 
     149  $show = $window_id. '.show();'; 
     150  $destroy = $window_id. '.setDestroyOnClose();'; 
     151 
     152  $options = _options_for_javascript($options); 
     153  $options_html = _parse_attributes($options_html); 
     154 
     155  $js_code = 'var '. $window_id. ' = new Window('. $options.');'. $set_content. $show. $destroy; 
     156 
     157  $options_html['href'] = isset($options_html['href']) ? $options_html['href'] : '#'; 
     158  $options_html['onclick'] = isset($options_html['onclick']) ? $options_html['onclick'] . $js_code : $js_code; 
     159 
     160  return content_tag('a', $name, $options_html); 
     161
     162 
     163/** 
     164 * Return a link to a debug prototype window 
     165 * 
     166 * @author COil 
     167 */ 
     168function link_to_prototype_debug($name) 
     169
     170  if(sfConfig::get('sf_debug')) 
     171  { 
     172    return link_to_function($name, 'showDebug()'); 
     173  } 
     174
     175 
     176/** 
     177 * Add plugin specific resources 
     178 * 
     179 * @author COil 
     180 */ 
     181function _addPrototypeWindowResources($options) 
     182
     183  $default_classname_style = array('dialog'); 
     184 
     185  $request = sfContext::getInstance()->getResponse(); 
     186 
     187  $sf_prototype_web_dir = sfConfig::get('sf_prototype_web_dir'); 
     188  $sf_prototype_window_web_dir = sfConfig::get('sf_prototype_window_web_dir', '/sfPrototypeWindowPlugin'); 
     189 
     190  // prototype 
     191  $request->addJavascript($sf_prototype_web_dir. '/js/prototype'); 
     192  $request->addJavascript($sf_prototype_web_dir. '/js/effects'); 
     193 
     194  // window 
     195  $request->addJavascript($sf_prototype_window_web_dir.'/js/window'); 
     196  $request->addJavascript($sf_prototype_window_web_dir.'/js/window_ext'); 
     197 
     198  if(isset($options['className']) && (!in_array($options['className'], $default_classname_style))) 
     199  { 
     200    $request->addStylesheet($sf_prototype_window_web_dir. '/themes/'. $options['className'].'.css'); 
     201  } 
     202  else 
     203  { 
     204    $request->addStylesheet($sf_prototype_window_web_dir.'/themes/default.css'); 
     205  } 
     206 
     207  if(sfConfig::get('sf_debug')) 
     208  { 
     209    $request->addJavascript($sf_prototype_window_web_dir. '/js/debug'); 
     210    $request->addJavascript($sf_prototype_window_web_dir. '/js/extended_debug'); 
     211  } 
     212 
     213
     214 
     215/** 
     216 * Convert all options that need to be quoted 
     217 * 
     218 * @author COil 
     219 * 
     220 * @param array $options Options to check 
     221 * @param array $stringOptions Keys of options array that need to be qupted 
     222 */ 
     223function _convertStringOptions($options, $stringOptions) 
     224
     225  if ($stringOptions) 
     226  { 
     227    foreach ($stringOptions as $option) 
    195228    { 
    196       $request->addStylesheet(sfConfig::get('sf_prototype_window_themes_dir'). '/'. $options['className'].'.css'); 
     229      if (isset($options[$option])) 
     230      { 
     231        $options[$option] = _method_option_to_s($options[$option]); 
     232      } 
    197233    } 
    198     else 
    199     { 
    200       $request->addStylesheet(sfConfig::get('sf_prototype_window_themes_dir').'/default.css'); 
    201     } 
    202  
    203     if(sfConfig::get('sf_debug')) 
    204     { 
    205       $request->addJavascript(sfConfig::get('sf_prototype_window_js_dir'). '/debug'); 
    206       $request->addJavascript(sfConfig::get('sf_prototype_window_js_dir'). '/extended_debug'); 
    207     } 
    208  
    209   } 
    210  
    211   /** 
    212    * Convert all options that need to be quoted 
    213    * 
    214    * @author COil 
    215    * 
    216    * @param array $options Options to check 
    217    * @param array $stringOptions Keys of options array that need to be qupted 
    218    */ 
    219   function _convertStringOptions($options, $stringOptions) 
    220   { 
    221     if ($stringOptions) 
    222     { 
    223         foreach ($stringOptions as $option) 
    224         { 
    225             if (isset($options[$option])) 
    226             { 
    227               $options[$option] = _method_option_to_s($options[$option]); 
    228             } 
    229         } 
    230     } 
    231     return $options; 
    232   } 
    233  
    234   /** 
    235    * Add debug informations 
    236    * 
    237    * @todo : Debug should be be mapped on the ok function, to check 
    238    * 
    239    * @author COil 
    240    */ 
    241   function _addDebug($options) 
    242   { 
    243     if (isset($options['debug'])) 
    244     { 
    245         $options['ok'] = isset($options['debug']) ? 'function(win) { debug(\''. $options['debug']. '\'); return true; }' : ''; 
    246         unset($options['debug']); 
    247     } 
    248  
    249     return $options; 
    250   } 
    251  
     234  } 
     235  return $options; 
     236
     237 
     238/** 
     239 * Add debug informations 
     240 * 
     241 * @todo : Debug should be be mapped on the ok function, to check 
     242 * 
     243 * @author COil 
     244 */ 
     245function _addDebug($options) 
     246
     247  if (isset($options['debug'])) 
     248  { 
     249    $options['ok'] = isset($options['debug']) ? 'function(win) { debug(\''. $options['debug']. '\'); return true; }' : ''; 
     250    unset($options['debug']); 
     251  } 
     252 
     253  return $options; 
     254
     255 
  • plugins/sfPrototypeWindowPlugin/package.xml

    r3977 r5322  
    1111  <active>yes</active> 
    1212 </lead> 
    13  <date>2007-04-09</date> 
     13 <date>2007-09-30</date> 
    1414 <version> 
    15    <release>1.0.3</release> 
    16    <api>1.0.3</api> 
     15   <release>1.0.4</release> 
     16   <api>1.0.4</api> 
    1717 </version> 
    1818 <stability> 
     
    3939     <dir name="modules"> 
    4040       <dir name="sfPrototypeWindowPlugin"> 
    41         <dir name="actions"> 
    42          <file role="data" name="actions.class.php" /> 
    43         </dir> 
    44         <dir name="templates"> 
    45          <file role="data" name="contentSuccess.php" /> 
    46          <file role="data" name="example1ContentSuccess.php" /> 
    47          <file role="data" name="testSuccess.php" /> 
    48         </dir> 
     41        <dir name="actions"> 
     42        <file role="data" name="actions.class.php" /> 
     43        </dir> 
     44        <dir name="templates"> 
     45        <file role="data" name="contentSuccess.php" /> 
     46        <file role="data" name="example1ContentSuccess.php" /> 
     47        <file role="data" name="testSuccess.php" /> 
     48        </dir> 
    4949       </dir> 
    5050     </dir> 
  • plugins/sfPrototypeWindowPlugin/web/js/window.js

    r3977 r5322  
    1 // Copyright (c) 2006 S??bastien Gruhier (http://xilinus.com, http://itseb.com) 
     1// Copyright (c) 2006 Sébastien Gruhier (http://xilinus.com, http://itseb.com) 
    22//  
    33// Permission is hereby granted, free of charge, to any person obtaining 
     
    2020// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
    2121// 
    22 // VERSION 1.2 
     22// VERSION 1.3 
    2323 
    2424var Window = Class.create(); 
    2525 
    2626Window.keepMultiModalWindow = false; 
    27 Window.hasEffectLib = String.prototype.parseColor != null
     27Window.hasEffectLib = (typeof Effect != 'undefined')
    2828Window.resizeEffectDuration = 0.4; 
    2929 
    3030Window.prototype = { 
    3131  // Constructor 
    32   // Available parameters : className, title, minWidth, minHeight, maxWidth, maxHeight, width, height, top, left, bottom, right, resizable, zIndex, opacity, recenterAuto, wiredDrag 
     32  // Available parameters : className, blurClassName, title, minWidth, minHeight, maxWidth, maxHeight, width, height, top, left, bottom, right, resizable, zIndex, opacity, recenterAuto, wiredDrag 
    3333  //                        hideEffect, showEffect, showEffectOptions, hideEffectOptions, effectOptions, url, draggable, closable, minimizable, maximizable, parent, onload 
    3434  //                        add all callbacks (if you do not use an observer) 
    35   //                        onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onBeforeShow onShow onHide onMinimize onMaximize onClose 
     35  //                        onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onBlur onBeforeShow onShow onHide onMinimize onMaximize onClose 
    3636   
    3737  initialize: function() { 
     
    5757    this.options = Object.extend({ 
    5858      className:         "dialog", 
     59      blurClassName:     null, 
    5960      minWidth:          100,  
    6061      minHeight:         20, 
     
    8283      destroyOnClose:    false, 
    8384      gridX:             1,  
    84       gridY:             1 
     85      gridY:             1       
    8586    }, arguments[optionIndex] || {}); 
    86      
     87    if (this.options.blurClassName) 
     88      this.options.focusClassName = this.options.className; 
     89       
    8790    if (typeof this.options.top == "undefined" &&  typeof this.options.bottom ==  "undefined")  
    8891      this.options.top = this._round(Math.random()*500, this.options.gridY); 
     
    109112      this.options.parent = $(this.options.parent); 
    110113       
    111     this.element = this._createWindow(id); 
     114    this.element = this._createWindow(id);        
     115    this.element.win = this; 
    112116     
    113117    // Bind event listener 
     
    129133    Event.observe(window, "resize", this.eventResize); 
    130134    Event.observe(window, "scroll", this.eventResize); 
     135    Event.observe(this.options.parent, "scroll", this.eventResize); 
    131136     
    132137    if (this.options.draggable)  { 
     
    389394      return; 
    390395       
    391     if (window.ie && this.heightN == 0) 
     396    if (Prototype.Browser.IE && this.heightN == 0) 
    392397      this._getWindowBorderSize(); 
    393398     
     
    596601    var maxDiv = this.options.maximizable ? "<div class='"+ className + "_maximize' id='"+ id +"_maximize' onclick='Windows.maximize(\""+ id +"\", event)'> </div>" : ""; 
    597602    var seAttributes = this.options.resizable ? "class='" + className + "_sizer' id='" + id + "_sizer'" : "class='"  + className + "_se'"; 
    598     var blank = "/sfPrototypeWindowPlugin/themes/default/blank.gif"; 
     603    var blank = "../themes/default/blank.gif"; 
    599604     
    600605    win.innerHTML = closeDiv + minDiv + maxDiv + "\ 
     
    628633   
    629634   
    630   changeClassName: function(newClassName) { 
     635  changeClassName: function(newClassName) {     
    631636    var className = this.options.className; 
    632637    var id = this.getId(); 
    633     var win = this
    634     $A(["_close","_minimize","_maximize","_sizer", "_content"]).each(function(value) { win._toggleClassName($(id + value), className + value, newClassName + value) }); 
    635     $$("#" + id + " td").each(function(td) {td.className = td.className.sub(className,newClassName) }); 
     638    $A(["_close", "_minimize", "_maximize", "_sizer", "_content"]).each(function(value) { this._toggleClassName($(id + value), className + value, newClassName + value) }.bind(this))
     639    this._toggleClassName($(id + "_top"), className + "_title", newClassName + "_title"); 
     640    $$("#" + id + " td").each(function(td) {td.className = td.className.sub(className,newClassName); }); 
    636641    this.options.className = newClassName; 
    637642  }, 
    638643   
    639   _toggleClassName: function(element, oldClassName, newClassName) { 
     644  _toggleClassName: function(element, oldClassName, newClassName) {  
    640645    if (element) { 
    641646      element.removeClassName(oldClassName); 
     
    726731    if (this.element.style.zIndex < Windows.maxZIndex)   
    727732      this.setZIndex(Windows.maxZIndex + 1); 
    728     this._notify("onFocus"); 
    729733    if (this.iefix)  
    730734      this._fixIEOverlapping();  
    731735  }, 
    732    
    733   // Displays window modal state or not 
    734   show: function(modal) { 
    735     if (modal) { 
    736       // Hack for Safar!! 
    737       if (typeof this.overlayOpacity == "undefined") { 
    738         var that= this; 
    739         setTimeout(function() {that.show(modal)}, 10); 
    740         return; 
    741       } 
    742       Windows.addModalWindow(this); 
    743        
    744       this.modal = true;       
    745       this.setZIndex(Windows.maxZIndex + 1); 
    746       Windows.unsetOverflow(this); 
    747     } 
    748     else 
    749       if (!this.element.style.zIndex)  
    750         this.setZIndex(Windows.maxZIndex++ + 1);         
    751        
    752     // To restore overflow if need be 
    753     if (this.oldStyle) 
    754       this.getContent().setStyle({overflow: this.oldStyle}); 
    755        
    756     if (! this.width || !this.height) { 
     736    
     737  getBounds: function(insideOnly) { 
     738    if (! this.width || !this.height || !this.visible)   
     739      this.computeBounds(); 
     740    var w = this.width; 
     741    var h = this.height; 
     742 
     743    if (!insideOnly) { 
     744      w += this.widthW + this.widthE; 
     745      h += this.heightN + this.heightS; 
     746    } 
     747    var bounds = Object.extend(this.getLocation(), {width: w + "px", height: h + "px"}); 
     748    return bounds; 
     749  }, 
     750       
     751  computeBounds: function() { 
     752     if (! this.width || !this.height) { 
    757753      var size = WindowUtilities._computeSize(this.content.innerHTML, this.content.id, this.width, this.height, 0, this.options.className) 
    758754      if (this.height) 
     
    765761    if (this.centered) 
    766762      this._center(this.centerTop, this.centerLeft);     
     763  }, 
     764   
     765  // Displays window modal state or not 
     766  show: function(modal) { 
     767    this.visible = true; 
     768    if (modal) { 
     769      // Hack for Safari !! 
     770      if (typeof this.overlayOpacity == "undefined") { 
     771        var that = this; 
     772        setTimeout(function() {that.show(modal)}, 10); 
     773        return; 
     774      } 
     775      Windows.addModalWindow(this); 
     776       
     777      this.modal = true;       
     778      this.setZIndex(Windows.maxZIndex + 1); 
     779      Windows.unsetOverflow(this); 
     780    } 
     781    else     
     782      if (!this.element.style.zIndex)  
     783        this.setZIndex(Windows.maxZIndex + 1);         
     784       
     785    // To restore overflow if need be 
     786    if (this.oldStyle) 
     787      this.getContent().setStyle({overflow: this.oldStyle}); 
     788       
     789    this.computeBounds(); 
    767790     
    768791    this._notify("onBeforeShow");    
     
    773796       
    774797    this._checkIEOverlapping(); 
    775     this.visible = true; 
    776798    WindowUtilities.focusedWindow = this 
    777799    this._notify("onShow");    
     
    791813  }, 
    792814   
    793   _center: function(top, left) { 
    794     var windowScroll = WindowUtilities.getWindowScroll();     
    795     var pageSize = WindowUtilities.getPageSize();     
    796  
     815  _center: function(top, left) {     
     816    var windowScroll = WindowUtilities.getWindowScroll(this.options.parent);     
     817    var pageSize = WindowUtilities.getPageSize(this.options.parent);     
    797818    if (typeof top == "undefined") 
    798819      top = (pageSize.windowHeight - (this.height + this.heightN + this.heightS))/2; 
     
    801822    if (typeof left == "undefined") 
    802823      left = (pageSize.windowWidth - (this.width + this.widthW + this.widthE))/2; 
    803     left += windowScroll.left  
    804      
     824    left += windowScroll.left       
    805825    this.setLocation(top, left); 
    806826    this.toFront(); 
    807827  }, 
    808828   
    809   _recenter: function(event) { 
     829  _recenter: function(event) {      
    810830    if (this.centered) { 
    811       var pageSize = WindowUtilities.getPageSize(); 
     831      var pageSize = WindowUtilities.getPageSize(this.options.parent); 
     832      var windowScroll = WindowUtilities.getWindowScroll(this.options.parent);     
    812833 
    813834      // Check for this stupid IE that sends dumb events 
    814       if (this.pageSize && this.pageSize.windowWidth == pageSize.windowWidth && this.pageSize.windowHeight == pageSize.windowHeight)  
     835      if (this.pageSize && this.pageSize.windowWidth == pageSize.windowWidth && this.pageSize.windowHeight == pageSize.windowHeight &&  
     836          this.windowScroll.left == windowScroll.left && this.windowScroll.top == windowScroll.top)  
    815837        return; 
    816838      this.pageSize = pageSize; 
    817  
     839      this.windowScroll = windowScroll; 
    818840      // set height of Overlay to take up whole page and show 
    819841      if ($('overlay_modal'))  
     
    925947      return; 
    926948   
    927     if (window.ie && this.heightN == 0) 
     949    if (Prototype.Browser.IE && this.heightN == 0) 
    928950      this._getWindowBorderSize(); 
    929951       
     
    937959      Windows.unsetOverflow(this); 
    938960       
    939       var windowScroll = WindowUtilities.getWindowScroll(); 
    940       var pageSize = WindowUtilities.getPageSize();     
     961      var windowScroll = WindowUtilities.getWindowScroll(this.options.parent); 
     962      var pageSize = WindowUtilities.getPageSize(this.options.parent);     
    941963      var left = windowScroll.left; 
    942964      var top = windowScroll.top; 
     
    10041026    Element.update(this.element.id + '_top', newTitle); 
    10051027  }, 
    1006  
     1028    
     1029  getTitle: function() { 
     1030    return $(this.element.id + '_top').innerHTML; 
     1031  }, 
     1032   
    10071033  setStatusBar: function(element) { 
    10081034    var statusBar = $(this.getId() + "_bottom"); 
     
    10611087     
    10621088    // Workaround for IE!! 
    1063     if (window.ie) { 
     1089    if (Prototype.Browser.IE) { 
    10641090      this.heightS = $(this.getId() +"_row3").getDimensions().height; 
    10651091      this.heightN = $(this.getId() +"_row1").getDimensions().height; 
     
    10671093 
    10681094    // Safari size fix 
    1069     if (window.khtml && !window.webkit
     1095    if (Prototype.Browser.WebKit && Prototype.Browser.WebKitVersion < 420
    10701096      this.setSize(this.width, this.height); 
    10711097    if (this.doMaximize) 
     
    11391165  _createWiredElement: function() { 
    11401166    if (! this.wiredElement) { 
    1141       if (window.ie
     1167      if (Prototype.Browser.IE
    11421168        this._getWindowBorderSize(); 
    11431169      var div = document.createElement("div"); 
     
    12151241  }, 
    12161242   
    1217   // onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onBeforeShow onShow onHide onMinimize onMaximize onClose 
     1243  // onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onBlur onBeforeShow onShow onHide onMinimize onMaximize onClose 
    12181244  notify: function(eventName, win) {   
    12191245    this.observers.each( function(o) {if(o[eventName]) o[eventName](eventName, win);}); 
     
    12421268  addModalWindow: function(win) { 
    12431269    // Disable screen if first modal window 
    1244     if (this.modalWindows.length == 0) 
    1245       WindowUtilities.disableScreen(win.options.className, 'overlay_modal', win.overlayOpacity, win.getId()); 
     1270    if (this.modalWindows.length == 0) { 
     1271      WindowUtilities.disableScreen(win.options.className, 'overlay_modal', win.overlayOpacity, win.getId(), win.options.parent); 
     1272    } 
    12461273    else { 
    12471274      // Move overlay over all windows 
     
    13211348  }, 
    13221349   
     1350  blur: function(id) { 
     1351    var win = this.getWindow(id);   
     1352    if (!win) 
     1353      return; 
     1354    if (win.options.blurClassName) 
     1355      win.changeClassName(win.options.blurClassName); 
     1356    if (this.focusedWindow == win)   
     1357      this.focusedWindow = null; 
     1358    win._notify("onBlur");   
     1359  }, 
     1360   
     1361  focus: function(id) { 
     1362    var win = this.getWindow(id);   
     1363    if (!win) 
     1364      return;        
     1365    if (this.focusedWindow) 
     1366      this.blur(this.focusedWindow.getId()) 
     1367 
     1368    if (win.options.focusClassName) 
     1369      win.changeClassName(win.options.focusClassName);   
     1370    this.focusedWindow = win; 
     1371    win._notify("onFocus"); 
     1372  }, 
     1373   
    13231374  unsetOverflow: function(except) {     
    13241375    this.windows.each(function(d) { d.oldOverflow = d.getContent().getStyle("overflow") || "auto" ; d.getContent().setStyle({overflow: "hidden"}) }); 
     
    13311382  }, 
    13321383 
    1333   updateZindex: function(zindex, win) { 
    1334     if (zindex > this.maxZIndex) 
    1335       this.maxZIndex = zindex; 
     1384  updateZindex: function(zindex, win) {  
     1385    if (zindex > this.maxZIndex) {    
     1386      this.maxZIndex = zindex;     
     1387      if (this.focusedWindow)  
     1388        this.blur(this.focusedWindow.getId()) 
     1389    } 
    13361390    this.focusedWindow = win; 
     1391    if (this.focusedWindow)  
     1392      this.focus(this.focusedWindow.getId()) 
    13371393  } 
    13381394}; 
     
    13961452        <div class='" + parameters.className + "_buttons'>\ 
    13971453          <input type='button' value='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "/>\ 
    1398         </div>"; 
     1454        </div>";                   
    13991455    return this._openDialog(content, parameters) 
    14001456  }, 
     
    14371493     
    14381494    if (! parameters.height && ! parameters.width) { 
    1439       parameters.width = WindowUtilities.getPageSize().pageWidth / 2; 
     1495      parameters.width = WindowUtilities.getPageSize(parameters.options.parent || document.body).pageWidth / 2; 
    14401496    } 
    14411497    if (parameters.id) 
     
    14551511        parameters.height = size + 5 
    14561512    } 
    1457     parameters.resizable = parameters.resizable || false; 
    14581513    parameters.effectOptions = parameters.effectOptions ; 
    1459     parameters.minimizable = false; 
    1460     parameters.maximizable = false; 
    1461     parameters.draggable = false; 
    1462     parameters.closable = false; 
     1514    parameters.resizable   = parameters.resizable || false; 
     1515    parameters.minimizable = parameters.minimizable || false; 
     1516    parameters.maximizable = parameters.maximizable ||  false; 
     1517    parameters.draggable   = parameters.draggable || false; 
     1518    parameters.closable    = parameters.closable || false; 
    14631519     
    14641520    var win = new Window(parameters); 
     
    15181574*/ 
    15191575 
    1520 // From mootools.net 
    1521 // window.ie - will be set to true if the current browser is internet explorer (any). 
    1522 // window.ie6 - will be set to true if the current browser is internet explorer 6. 
    1523 // window.ie7 - will be set to true if the current browser is internet explorer 7. 
    1524 // window.khtml - will be set to true if the current browser is Safari/Konqueror. 
    1525 // window.webkit - will be set to true if the current browser is Safari-WebKit (Safari3) 
    1526 // window.gecko - will be set to true if the current browser is Mozilla/Gecko. 
    1527 if (window.ActiveXObject) window.ie = window[window.XMLHttpRequest ? 'ie7' : 'ie6'] = true; 
    1528 else if (document.childNodes && !document.all && !navigator.taintEnabled) window.khtml = true; 
    1529 else if (document.getBoxObjectFor != null) window.gecko = true; 
    1530 
     1576if (Prototype.Browser.WebKit) { 
    15311577  var array = navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/)); 
    1532   window.webkit =  array && array.length == 2 ? parseFloat(array[1]) >= 420 : false
     1578  Prototype.Browser.WebKitVersion = parseFloat(array[1])
    15331579} 
    15341580 
    1535  
    15361581var WindowUtilities = {   
    1537   getWindowScroll: function() { 
    1538     var w = window; 
    1539       var T, L, W, H; 
    1540       L = window.pageXOffset || document.documentElement.scrollLeft; 
    1541       T = window.pageYOffset || document.documentElement.scrollTop; 
    1542  
    1543       if (window.ie)  
    1544         W = Math.max(document.documentElement.offsetWidth, document.documentElement.scrollWidth); 
    1545       else if (window.khtml)  
    1546         W = document.body.scrollWidth; 
    1547       else  
    1548         W = document.documentElement.scrollWidth; 
    1549          
    1550       if (window.ie)  
    1551         H = Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight); 
    1552       else if (window.khtml)  
    1553         H = document.body.scrollHeight; 
    1554       else 
    1555         H = document.documentElement.scrollHeight; 
    1556        
    1557       return { top: T, left: L, width: W, height: H }; 
     1582  // From dragdrop.js 
     1583  getWindowScroll: function(parent) { 
     1584    var T, L, W, H; 
     1585    parent = parent || document.body;               
     1586    if (parent != document.body) { 
     1587      T = parent.scrollTop; 
     1588      L = parent.scrollLeft; 
     1589      W = parent.scrollWidth; 
     1590      H = parent.scrollHeight; 
     1591    }  
     1592    else { 
     1593      var w = window; 
     1594      with (w.document) { 
     1595        if (w.document.documentElement && documentElement.scrollTop) { 
     1596          T = documentElement.scrollTop; 
     1597          L = documentElement.scrollLeft; 
     1598        } else if (w.document.body) { 
     1599          T = body.scrollTop; 
     1600          L = body.scrollLeft; 
     1601        } 
     1602        if (w.innerWidth) { 
     1603          W = w.innerWidth; 
     1604          H = w.innerHeight; 
     1605        } else if (w.document.documentElement && documentElement.clientWidth) { 
     1606          W = documentElement.clientWidth; 
     1607          H = documentElement.clientHeight; 
     1608        } else { 
     1609          W = body.offsetWidth; 
     1610          H = body.offsetHeight 
     1611        } 
     1612      } 
     1613    } 
     1614    return { top: T, left: L, width: W, height: H }; 
    15581615  },  
    15591616  // 
     
    15631620  // Edit for Firefox by pHaez 
    15641621  // 
    1565   getPageSize: function(){ 
    1566     var xScroll, yScroll; 
    1567  
    1568     if (window.innerHeight && window.scrollMaxY) {   
    1569       xScroll = document.body.scrollWidth; 
    1570       yScroll = window.innerHeight + window.scrollMaxY; 
    1571     } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac 
    1572       xScroll = document.body.scrollWidth; 
    1573       yScroll = document.body.scrollHeight; 
    1574     } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari 
    1575       xScroll = document.body.offsetWidth; 
    1576       yScroll = document.body.offsetHeight; 
    1577     } 
    1578  
     1622  getPageSize: function(parent){ 
     1623    parent = parent || document.body;               
    15791624    var windowWidth, windowHeight; 
    1580  
    1581     if (self.innerHeight) {  // all except Explorer 
    1582       windowWidth = self.innerWidth; 
    1583       windowHeight = self.innerHeight; 
    1584     } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode 
    1585       windowWidth = document.documentElement.clientWidth; 
    1586       windowHeight = document.documentElement.clientHeight; 
    1587     } else if (document.body) { // other Explorers 
    1588       windowWidth = document.body.clientWidth; 
    1589       windowHeight = document.body.clientHeight; 
    1590     }   
    15911625    var pageHeight, pageWidth; 
    1592  
    1593     // for small pages with total height less then height of the viewport 
    1594     if(yScroll < windowHeight){ 
    1595       pageHeight = windowHeight; 
    1596     } else {  
    1597       pageHeight = yScroll; 
    1598     } 
    1599  
    1600     // for small pages with total width less then width of the viewport 
    1601     if(xScroll < windowWidth){   
    1602       pageWidth = windowWidth; 
    1603     } else { 
    1604       pageWidth = xScroll; 
    1605     } 
    1606  
     1626    if (parent != document.body) { 
     1627      windowWidth = parent.getWidth(); 
     1628      windowHeight = parent.getHeight();                                 
     1629      pageWidth = parent.scrollWidth; 
     1630      pageHeight = parent.scrollHeight;                                 
     1631    }  
     1632    else { 
     1633      var xScroll, yScroll; 
     1634 
     1635      if (window.innerHeight && window.scrollMaxY) {   
     1636        xScroll = document.body.scrollWidth; 
     1637        yScroll = window.innerHeight + window.scrollMaxY; 
     1638      } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac 
     1639        xScroll = document.body.scrollWidth; 
     1640        yScroll = document.body.scrollHeight; 
     1641      } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari 
     1642        xScroll = document.body.offsetWidth; 
     1643        yScroll = document.body.offsetHeight; 
     1644      } 
     1645 
     1646 
     1647      if (self.innerHeight) {  // all except Explorer 
     1648        windowWidth = self.innerWidth; 
     1649        windowHeight = self.innerHeight; 
     1650      } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode 
     1651        windowWidth = document.documentElement.clientWidth; 
     1652        windowHeight = document.documentElement.clientHeight; 
     1653      } else if (document.body) { // other Explorers 
     1654        windowWidth = document.body.clientWidth; 
     1655        windowHeight = document.body.clientHeight; 
     1656      }   
     1657 
     1658      // for small pages with total height less then height of the viewport 
     1659      if(yScroll < windowHeight){ 
     1660        pageHeight = windowHeight; 
     1661      } else {  
     1662        pageHeight = yScroll; 
     1663      } 
     1664 
     1665      // for small pages with total width less then width of the viewport 
     1666      if(xScroll < windowWidth){   
     1667        pageWidth = windowWidth; 
     1668      } else { 
     1669        pageWidth = xScroll; 
     1670      } 
     1671    }              
    16071672    return {pageWidth: pageWidth ,pageHeight: pageHeight , windowWidth: windowWidth, windowHeight: windowHeight}; 
    16081673  }, 
    16091674 
    1610   disableScreen: function(className, overlayId, overlayOpacity, contentId) { 
    1611     var that = this; 
    1612     WindowUtilities.initLightbox(overlayId, className, function() {that._disableScreen(className, overlayId, overlayOpacity, contentId)}); 
     1675  disableScreen: function(className, overlayId, overlayOpacity, contentId, parent) { 
     1676    WindowUtilities.initLightbox(overlayId, className, function() {this._disableScreen(className, overlayId, overlayOpacity, contentId)}.bind(this), parent || document.body); 
    16131677  }, 
    16141678 
    16151679  _disableScreen: function(className, overlayId, overlayOpacity, contentId) { 
    1616     var objBody = document.body; 
    1617  
    16181680    // prep objects 
    16191681    var objOverlay = $(overlayId); 
    16201682 
    1621     var pageSize = WindowUtilities.getPageSize(); 
     1683    var pageSize = WindowUtilities.getPageSize(objOverlay.parentNode); 
    16221684 
    16231685    // Hide select boxes as they will 'peek' through the image in IE, store old value 
    1624     if (contentId && window.ie) { 
     1686    if (contentId && Prototype.Browser.IE) { 
    16251687      WindowUtilities._hideSelect(); 
    16261688      WindowUtilities._showSelect(contentId); 
     
    16571719 
    16581720  _hideSelect: function(id) { 
    1659     if (window.ie) { 
     1721    if (Prototype.Browser.IE) { 
    16601722      id = id ==  null ? "" : "#" + id + " "; 
    16611723      $$(id + 'select').each(function(element) { 
     
    16691731   
    16701732  _showSelect: function(id) { 
    1671     if (window.ie) { 
     1733    if (Prototype.Browser.IE) { 
    16721734      id = id ==  null ? "" : "#" + id + " "; 
    16731735      $$(id + 'select').each(function(element) { 
     
    16981760  // The function also inserts html markup at the top of the page which will be used as a 
    16991761  // container for the overlay pattern and the inline image. 
    1700   initLightbox: function(id, className, doneHandler) { 
     1762  initLightbox: function(id, className, doneHandler, parent) { 
    17011763    // Already done, just update zIndex 
    17021764    if ($(id)) { 
     
    17071769    // create overlay div and hardcode some functional styles (aesthetic styles are in CSS file) 
    17081770    else { 
    1709       var objBody = document.body; 
    17101771      var objOverlay = document.createElement("div"); 
    17111772      objOverlay.setAttribute('id', id); 
     
    17181779      Windows.maxZIndex++; 
    17191780      objOverlay.style.width = '100%'; 
    1720       objBody.insertBefore(objOverlay, objBody.firstChild); 
    1721       if (window.khtml && id == "overlay_modal") { 
     1781      parent.insertBefore(objOverlay, parent.firstChild); 
     1782      if (Prototype.Browser.WebKit && id == "overlay_modal") { 
    17221783        setTimeout(function() {doneHandler()}, 10); 
    17231784      } 
     
    17701831    tmpObj.innerHTML = content; 
    17711832    objBody.insertBefore(tmpObj, objBody.firstChild); 
    1772      
     1833 
    17731834    var size; 
    17741835    if (height) 
    1775       size = $(id).getDimensions().width + margin; 
     1836      size = $(tmpObj).getDimensions().width + margin; 
    17761837    else 
    1777       size = $(id).getDimensions().height + margin; 
     1838      size = $(tmpObj).getDimensions().height + margin; 
    17781839    objBody.removeChild(tmpObj); 
    17791840    return size; 
  • plugins/sfPrototypeWindowPlugin/web/js/window_ext.js

    r3977 r5322  
    9393  init: function(keyCode) { 
    9494    if (keyCode) 
    95       WindowCloseKey.keyCode = keyCode; 
    96     Event.observe(document, 'keydown', this._closeCurrentWindow.bindAsEventListener(this)); 
     95      WindowCloseKey.keyCode = keyCode;       
     96       
     97    Event.observe(document, 'keydown', this._closeCurrentWindow.bindAsEventListener(this));    
    9798  }, 
    9899   
     
    100101    var e = event || window.event 
    101102    var characterCode = e.which || e.keyCode; 
    102     var win = Windows.focusedWindow; 
     103     
     104    // Check if there is a top window (it means it's an URL content) 
     105    var win = top.Windows.focusedWindow; 
    103106    if (characterCode == WindowCloseKey.keyCode && win) { 
    104107      if (win.cancelCallback)  
    105         Dialog.cancelCallback();       
     108        top.Dialog.cancelCallback();       
    106109      else if (win.okCallback)  
    107         Dialog.okCallback(); 
     110        top.Dialog.okCallback(); 
    108111      else 
    109         Windows.close(Windows.focusedWindow.getId()); 
     112        top.Windows.close(top.Windows.focusedWindow.getId()); 
    110113    } 
    111114  } 
  • plugins/sfPrototypeWindowPlugin/web/themes/alert.css

    r3977 r5322  
    99  width: 5px; 
    1010  height: 5px; 
    11   background: transparent url(/sfPrototypeWindowPlugin/themes/top_left.gif) no-repeat bottom left;       
     11  background: transparent url(alert/top_left.gif) no-repeat bottom left;       
    1212} 
    1313 
    1414.alert_n { 
    1515  height: 5px; 
    16   background: transparent url(/sfPrototypeWindowPlugin/themes/top.gif) repeat-x bottom left;       
     16  background: transparent url(alert/top.gif) repeat-x bottom left;       
    1717} 
    1818 
     
    2020  width: 5px; 
    2121  height: 5px; 
    22   background: transparent url(/sfPrototypeWindowPlugin/themes/top_right.gif) no-repeat bottom left       
     22  background: transparent url(alert/top_right.gif) no-repeat bottom left       
    2323} 
    2424 
    2525.alert_e { 
    2626  width: 5px; 
    27   background: transparent url(/sfPrototypeWindowPlugin/themes/right.gif) repeat-y 0 0;       
     27  background: transparent url(alert/right.gif) repeat-y 0 0;       
    2828} 
    2929 
    3030.alert_w { 
    3131  width: 5px; 
    32   background: transparent url(/sfPrototypeWindowPlugin/themes/left.gif) repeat-y 0 0;      
     32  background: transparent url(alert/left.gif) repeat-y 0 0;      
    3333} 
    3434 
     
    3636  width: 5px; 
    3737  height: 5px; 
    38   background: transparent url(/sfPrototypeWindowPlugin/themes/bottom_left.gif) no-repeat 0 0;      
     38  background: transparent url(alert/bottom_left.gif) no-repeat 0 0;      
    3939} 
    4040 
    4141.alert_s { 
    4242  height: 5px; 
    43   background: transparent url(/sfPrototypeWindowPlugin/themes/bottom.gif) repeat-x 0 0;      
     43  background: transparent url(alert/bottom.gif) repeat-x 0 0;      
    4444} 
    4545 
     
    4747  width: 5px; 
    4848  height: 5px; 
    49   background: transparent url(/sfPrototypeWindowPlugin/themes/bottom_right.gif) no-repeat 0 0;       
     49  background: transparent url(alert/bottom_right.gif) no-repeat 0 0;       
    5050} 
    5151 
     
    8282} 
    8383 
    84 /* For alert dialog */ 
     84/* For alert/confirm dialog */ 
    8585.alert_window { 
    8686  background: #FFF; 
     
    114114  width:100%; 
    115115  height:16px; 
    116   background: #FFF url('/sfPrototypeWindowPlugin/themes/progress.gif') no-repeat center center 
     116  background: #FFF url('alert/progress.gif') no-repeat center center 
    117117} 
    118118 
  • plugins/sfPrototypeWindowPlugin/web/themes/alert_lite.css

    r3977 r5322  
    7979  width:100%; 
    8080  height:16px; 
    81   background: #FFF url('/sfPrototypeWindowPlugin/themes/progress.gif') no-repeat center center 
     81  background: #FFF url('alert/progress.gif') no-repeat center center 
    8282} 
    8383 
  • plugins/sfPrototypeWindowPlugin/web/themes/default.css

    r3977 r5322  
    1616  width: 9px; 
    1717  height: 23px; 
    18   background: transparent url(/sfPrototypeWindowPlugin/themes/default/top_left.gif) no-repeat 0 0;     
     18  background: transparent url(default/top_left.gif) no-repeat 0 0;     
    1919} 
    2020 
    2121.dialog_n { 
    22   background: transparent url(/sfPrototypeWindowPlugin/themes/default/top_mid.gif) repeat-x 0 0;   
     22  background: transparent url(default/top_mid.gif) repeat-x 0 0;   
    2323  height: 23px; 
    2424} 
     
    2727  width: 9px; 
    2828  height: 23px; 
    29   background: transparent url(/sfPrototypeWindowPlugin/themes/default/top_right.gif) no-repeat 0 0;    
     29  background: transparent url(default/top_right.gif) no-repeat 0 0;    
    3030} 
    3131 
    3232.dialog_e { 
    3333  width: 2px; 
    34   background: transparent url(/sfPrototypeWindowPlugin/themes/default/center_right.gif) repeat-y 0 0;  
     34  background: transparent url(default/center_right.gif) repeat-y 0 0;  
    3535} 
    3636 
    3737.dialog_w { 
    3838  width: 2px; 
    39   background: transparent url(/sfPrototypeWindowPlugin/themes/default/center_left.gif) repeat-y 0 0;     
     39  background: transparent url(default/center_left.gif) repeat-y 0 0;     
    4040} 
    4141 
     
    4343  width: 9px; 
    4444  height: 19px; 
    45   background: transparent url(/sfPrototypeWindowPlugin/themes/default/bottom_left.gif) no-repeat 0 0;      
     45  background: transparent url(default/bottom_left.gif) no-repeat 0 0;      
    4646} 
    4747 
    4848.dialog_s { 
    49   background: transparent url(/sfPrototypeWindowPlugin/themes/default/bottom_mid.gif) repeat-x 0 0;    
     49  background: transparent url(default/bottom_mid.gif) repeat-x 0 0;    
    5050  height: 19px; 
    5151} 
     
    5454  width: 9px; 
    5555  height: 19px; 
    56   background: transparent url(/sfPrototypeWindowPlugin/themes/default/bottom_right.gif) no-repeat 0 0;       
     56  background: transparent url(default/bottom_right.gif) no-repeat 0 0;       
    5757} 
    5858 
     
    6060  width: 9px; 
    6161  height: 19px; 
    62   background: transparent url(/sfPrototypeWindowPlugin/themes/default/sizer.gif) no-repeat 0 0;  
     62  background: transparent url(default/sizer.gif) no-repeat 0 0;  
    6363  cursor:se-resize;  
    6464} 
     
    6767  width: 14px; 
    6868  height: 14px; 
    69   background: transparent url(/sfPrototypeWindowPlugin/themes/default/close.gif) no-repeat 0 0;      
     69  background: transparent url(default/close.gif) no-repeat 0 0;      
    7070  position:absolute; 
    7171  top:5px; 
     
    7878  width: 14px; 
    7979  height: 15px; 
    80   background: transparent url(/sfPrototypeWindowPlugin/themes/default/minimize.gif) no-repeat 0 0;       
     80  background: transparent url(default/minimize.gif) no-repeat 0 0;       
    8181  position:absolute; 
    8282  top:5px; 
     
    8989  width: 14px; 
    9090  height: 15px; 
    91   background: transparent url(/sfPrototypeWindowPlugin/themes/default/maximize.gif) no-repeat 0 0;       
     91  background: transparent url(default/maximize.gif) no-repeat 0 0;       
    9292  position:absolute; 
    9393  top:5px; 
     
    152152.dialog .title_window { 
    153153  -moz-user-select:none; 
    154 
     154}                                                     
     155 
  • plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x.css

    r3977 r5322  
     1/* Focused windows */ 
    12.overlay_mac_os_x { 
    23  background-color: #85BBEF; 
     
    164165} 
    165166 
     167 
     168/* Focused windows */ 
     169.overlay_blur_os_x { 
     170  background-color: #85BBEF; 
     171  filter:alpha(opacity=60); 
     172  -moz-opacity: 0.6; 
     173  opacity: 0.6; 
     174} 
     175 
     176.blur_os_x_nw { 
     177  background: transparent url(mac_os_x/TL.png) no-repeat 0 0;      
     178  width:24px; 
     179  height:30px; 
     180} 
     181 
     182.blur_os_x_n { 
     183  background: transparent url(mac_os_x/T.png) repeat-x 0 0;      
     184  height:30px; 
     185} 
     186 
     187.blur_os_x_ne { 
     188  background: transparent url(mac_os_x/TR.png) no-repeat 0 0;      
     189  width:31px;    
     190  height:30px; 
     191} 
     192 
     193.blur_os_x_w { 
     194  background: transparent url(mac_os_x/L.png) repeat-y top left;       
     195  width:16px; 
     196} 
     197 
     198.blur_os_x_e { 
     199  background: transparent url(mac_os_x/R.png) repeat-y top right;      
     200  width:16px;    
     201} 
     202 
     203.blur_os_x_sw { 
     204  background: transparent url(mac_os_x/BL.png) no-repeat 0 0;      
     205  width:31px; 
     206  height:40px; 
     207} 
     208 
     209.blur_os_x_s { 
     210  background: transparent url(mac_os_x/B.png) repeat-x 0 0;      
     211  height:40px; 
     212} 
     213 
     214.blur_os_x_se, .blur_os_x_sizer { 
     215  background: transparent url(mac_os_x/BR.png) no-repeat 0 0;      
     216  width:31px; 
     217  height:40px; 
     218} 
     219 
     220.blur_os_x_sizer { 
     221  cursor:se-resize;  
     222} 
     223 
     224.blur_os_x_close { 
     225  width: 19px; 
     226  height: 19px; 
     227  background: transparent url(mac_os_x/close.gif) no-repeat 0 0;       
     228  position:absolute; 
     229  top:12px; 
     230  left:25px; 
     231  cursor:pointer; 
     232  z-index:1000; 
     233} 
     234 
     235.blur_os_x_minimize { 
     236  width: 19px; 
     237  height: 19px; 
     238  background: transparent url(mac_os_x/minimize.gif) no-repeat 0 0;      
     239  position:absolute; 
     240  top:12px; 
     241  left:45px; 
     242  cursor:pointer; 
     243  z-index:1000; 
     244} 
     245 
     246.blur_os_x_maximize { 
     247  width: 19px; 
     248  height: 19px; 
     249  background: transparent url(mac_os_x/maximize.gif) no-repeat 0 0;      
     250  position:absolute; 
     251  top:12px; 
     252  left:65px; 
     253  cursor:pointer; 
     254  z-index:1000; 
     255} 
     256 
     257.blur_os_x_title { 
     258  float:left; 
     259  height:14px; 
     260  font-family: Tahoma, Arial, sans-serif; 
     261  font-size:12px; 
     262  text-align:center; 
     263  margin-top:8px; 
     264  width:100%; 
     265  color:#000; 
     266} 
     267 
     268.blur_os_x_content { 
     269  overflow:auto; 
     270  color: #222; 
     271  font-family: Tahoma, Arial, sans-serif; 
     272  font-size: 10px; 
     273  background:#FFF; 
     274} 
     275.blur_os_x_s .status_bar { 
     276  padding-bottom:24px; 
     277} 
     278 
     279/* FOR IE */ 
     280* html .blur_os_x_nw { 
     281  background-color: transparent; 
     282  background-image: none; 
     283  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/TL.png", sizingMethod="crop"); 
     284} 
     285 
     286* html .blur_os_x_n { 
     287  background-color: transparent; 
     288  background-image: none; 
     289  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/T.png", sizingMethod="scale"); 
     290} 
     291 
     292* html .blur_os_x_ne { 
     293  background-color: transparent; 
     294  background-image: none; 
     295  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/TR.png", sizingMethod="crop"); 
     296} 
     297 
     298* html .blur_os_x_w { 
     299  background-color: transparent; 
     300  background-image: none; 
     301  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/L.png", sizingMethod="scale"); 
     302} 
     303 
     304* html .blur_os_x_e { 
     305  background-color: transparent; 
     306  background-image: none; 
     307  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/R.png", sizingMethod="scale"); 
     308} 
     309 
     310* html .blur_os_x_sw { 
     311  background-color: transparent; 
     312  background-image: none; 
     313  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BL.png", sizingMethod="crop"); 
     314} 
     315 
     316* html .blur_os_x_s { 
     317  background-color: transparent; 
     318  background-image: none; 
     319  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/B.png", sizingMethod="scale"); 
     320} 
     321 
     322* html .blur_os_x_se { 
     323  background-color: transparent; 
     324  background-image: none; 
     325  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BR.png", sizingMethod="crop"); 
     326} 
     327 
     328* html .blur_os_x_sizer { 
     329  background-color: transparent; 
     330  background-image: none; 
     331  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BR.png", sizingMethod="crop"); 
     332} 
     333 
  • plugins/sfPrototypeWindowPlugin/web/themes/spread.css

    r3977 r5322  
    77 
    88.spread_nw { 
    9   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/left-top.gif) no-repeat 0 0;      
     9  background: transparent url(spread/left-top.gif) no-repeat 0 0;      
    1010  width:10px; 
    1111  height:25px; 
     
    1313 
    1414.spread_n { 
    15   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/top-middle.gif) repeat-x 0 0;       
     15  background: transparent url(spread/top-middle.gif) repeat-x 0 0;       
    1616  height:25px; 
    1717} 
    1818 
    1919.spread_ne { 
    20   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/right-top.gif) no-repeat 0 0;       
     20  background: transparent url(spread/right-top.gif) no-repeat 0 0;       
    2121  width:10px;    
    2222  height:25px; 
     
    2424 
    2525.spread_w { 
    26   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/frame-left.gif) repeat-y top left;      
     26  background: transparent url(spread/frame-left.gif) repeat-y top left;      
    2727  width:7px; 
    2828} 
    2929 
    3030.spread_e { 
    31   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/frame-right.gif) repeat-y top right;      
     31  background: transparent url(spread/frame-right.gif) repeat-y top right;      
    3232  width:7px;     
    3333} 
    3434 
    3535.spread_sw { 
    36   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/bottom-left-c.gif) no-repeat 0 0;       
     36  background: transparent url(spread/bottom-left-c.gif) no-repeat 0 0;       
    3737  width:7px; 
    3838  height:7px; 
     
    4040 
    4141.spread_s  { 
    42   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/bottom-middle.gif) repeat-x 0 0;      
     42  background: transparent url(spread/bottom-middle.gif) repeat-x 0 0;      
    4343  height:7px; 
    4444} 
    4545 
    4646.spread_se, .spread_sizer { 
    47   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/bottom-right-c.gif) no-repeat 0 0;      
     47  background: transparent url(spread/bottom-right-c.gif) no-repeat 0 0;      
    4848  width:7px; 
    4949  height:7px; 
     
    5757  width: 23px; 
    5858  height: 23px; 
    59   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/button-close-focus.gif) no-repeat 0 0;      
     59  background: transparent url(spread/button-close-focus.gif) no-repeat 0 0;      
    6060  position:absolute; 
    6161  top:0px; 
     
    6868  width: 23px; 
    6969  height: 23px; 
    70   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/button-min-focus.gif) no-repeat 0 0;      
     70  background: transparent url(spread/button-min-focus.gif) no-repeat 0 0;      
    7171  position:absolute; 
    7272  top:0px; 
     
    7979  width: 23px; 
    8080  height: 23px; 
    81   background: transparent url(/sfPrototypeWindowPlugin/themes/spread/button-max-focus.gif) no-repeat 0 0;      
     81  background: transparent url(spread/button-max-focus.gif) no-repeat 0 0;      
    8282  position:absolute; 
    8383  top:0px;