Changeset 5322
- Timestamp:
- 10/01/07 04:01:56 (6 years ago)
- Files:
-
- plugins/sfPrototypeWindowPlugin/README (modified) (1 diff)
- plugins/sfPrototypeWindowPlugin/config/config.php (modified) (1 diff)
- plugins/sfPrototypeWindowPlugin/lib/helper/WindowHelper.php (modified) (1 diff)
- plugins/sfPrototypeWindowPlugin/modules (added)
- plugins/sfPrototypeWindowPlugin/modules/sfPrototypeWindowPlugin (added)
- plugins/sfPrototypeWindowPlugin/modules/sfPrototypeWindowPlugin/actions (added)
- plugins/sfPrototypeWindowPlugin/modules/sfPrototypeWindowPlugin/actions/actions.class.php (added)
- plugins/sfPrototypeWindowPlugin/modules/sfPrototypeWindowPlugin/templates (added)
- plugins/sfPrototypeWindowPlugin/modules/sfPrototypeWindowPlugin/templates/contentSuccess.php (added)
- plugins/sfPrototypeWindowPlugin/modules/sfPrototypeWindowPlugin/templates/example1ContentSuccess.php (added)
- plugins/sfPrototypeWindowPlugin/modules/sfPrototypeWindowPlugin/templates/testSuccess.php (added)
- plugins/sfPrototypeWindowPlugin/package.xml (modified) (2 diffs)
- plugins/sfPrototypeWindowPlugin/web/js/effects.js (added)
- plugins/sfPrototypeWindowPlugin/web/js/prototype.js (added)
- plugins/sfPrototypeWindowPlugin/web/js/tooltip.js (added)
- plugins/sfPrototypeWindowPlugin/web/js/window.js (modified) (35 diffs)
- plugins/sfPrototypeWindowPlugin/web/js/window_effects.js (added)
- plugins/sfPrototypeWindowPlugin/web/js/window_ext.js (modified) (2 diffs)
- plugins/sfPrototypeWindowPlugin/web/themes/alert.css (modified) (6 diffs)
- plugins/sfPrototypeWindowPlugin/web/themes/alert_lite.css (modified) (1 diff)
- plugins/sfPrototypeWindowPlugin/web/themes/behavior.htc (added)
- plugins/sfPrototypeWindowPlugin/web/themes/default.css (modified) (9 diffs)
- plugins/sfPrototypeWindowPlugin/web/themes/iefix (added)
- plugins/sfPrototypeWindowPlugin/web/themes/iefix/blank.gif (added)
- plugins/sfPrototypeWindowPlugin/web/themes/iefix/iepngfix.css (added)
- plugins/sfPrototypeWindowPlugin/web/themes/iefix/iepngfix.htc (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting.css (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/background_buttons.gif (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-left-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-left-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-left-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-left-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-middle-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-middle-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-middle-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-middle-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-right-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-right-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-right-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/bottom-right-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-close-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-close-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-close-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-close-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-maximize-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-maximize-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-maximize-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-maximize-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-minimize-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-minimize-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-minimize-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/button-minimize-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/left-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/left-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/left-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/left-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/pngbehavior.htc (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/right-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/right-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/right-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/right-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/spinner.gif (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-left-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-left-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-left-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-left-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-middle-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-middle-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-middle-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-middle-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-right-blue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-right-darkblue.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-right-green.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/lighting/top-right-grey.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x.css (modified) (2 diffs)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog.css (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/B.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/BL.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/BR.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/L.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/R.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/T.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/TL.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/TR.png (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/bg.gif (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/close.gif (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/maximize.gif (added)
- plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x_dialog/minimize.gif (added)
- plugins/sfPrototypeWindowPlugin/web/themes/spread.css (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPrototypeWindowPlugin/README
r3977 r5322 16 16 17 17 Please 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 1 1 <?php 2 2 3 sfConfig::set('sf_prototype_window_js_dir', '/sfPrototypeWindowPlugin/js'); 4 sfConfig::set('sf_prototype_window_themes_dir', '/sfPrototypeWindowPlugin/themes'); 3 if(!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 13 13 /** 14 14 * @package symfony.runtime.addon 15 * @subpackage helper 15 16 * @author Dustin Whittle <dustin.whittle@symfony-project.com> 16 17 * @version SVN: $Id$ 17 18 */ 18 19 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 */ 40 function 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 */ 86 function link_to_prototype_window($name, $window_id, $options, $options_html = array()) 87 { 19 88 /** 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 */ 140 function 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 */ 168 function 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 */ 181 function _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 */ 223 function _convertStringOptions($options, $stringOptions) 224 { 225 if ($stringOptions) 226 { 227 foreach ($stringOptions as $option) 195 228 { 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 } 197 233 } 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 */ 245 function _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 11 11 <active>yes</active> 12 12 </lead> 13 <date>2007-0 4-09</date>13 <date>2007-09-30</date> 14 14 <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> 17 17 </version> 18 18 <stability> … … 39 39 <dir name="modules"> 40 40 <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> 49 49 </dir> 50 50 </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) 2 2 // 3 3 // Permission is hereby granted, free of charge, to any person obtaining … … 20 20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 21 // 22 // VERSION 1. 222 // VERSION 1.3 23 23 24 24 var Window = Class.create(); 25 25 26 26 Window.keepMultiModalWindow = false; 27 Window.hasEffectLib = String.prototype.parseColor != null;27 Window.hasEffectLib = (typeof Effect != 'undefined'); 28 28 Window.resizeEffectDuration = 0.4; 29 29 30 30 Window.prototype = { 31 31 // Constructor 32 // Available parameters : className, title, minWidth, minHeight, maxWidth, maxHeight, width, height, top, left, bottom, right, resizable, zIndex, opacity, recenterAuto, wiredDrag32 // Available parameters : className, blurClassName, title, minWidth, minHeight, maxWidth, maxHeight, width, height, top, left, bottom, right, resizable, zIndex, opacity, recenterAuto, wiredDrag 33 33 // hideEffect, showEffect, showEffectOptions, hideEffectOptions, effectOptions, url, draggable, closable, minimizable, maximizable, parent, onload 34 34 // add all callbacks (if you do not use an observer) 35 // onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onB eforeShow onShow onHide onMinimize onMaximize onClose35 // onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onBlur onBeforeShow onShow onHide onMinimize onMaximize onClose 36 36 37 37 initialize: function() { … … 57 57 this.options = Object.extend({ 58 58 className: "dialog", 59 blurClassName: null, 59 60 minWidth: 100, 60 61 minHeight: 20, … … 82 83 destroyOnClose: false, 83 84 gridX: 1, 84 gridY: 1 85 gridY: 1 85 86 }, arguments[optionIndex] || {}); 86 87 if (this.options.blurClassName) 88 this.options.focusClassName = this.options.className; 89 87 90 if (typeof this.options.top == "undefined" && typeof this.options.bottom == "undefined") 88 91 this.options.top = this._round(Math.random()*500, this.options.gridY); … … 109 112 this.options.parent = $(this.options.parent); 110 113 111 this.element = this._createWindow(id); 114 this.element = this._createWindow(id); 115 this.element.win = this; 112 116 113 117 // Bind event listener … … 129 133 Event.observe(window, "resize", this.eventResize); 130 134 Event.observe(window, "scroll", this.eventResize); 135 Event.observe(this.options.parent, "scroll", this.eventResize); 131 136 132 137 if (this.options.draggable) { … … 389 394 return; 390 395 391 if ( window.ie&& this.heightN == 0)396 if (Prototype.Browser.IE && this.heightN == 0) 392 397 this._getWindowBorderSize(); 393 398 … … 596 601 var maxDiv = this.options.maximizable ? "<div class='"+ className + "_maximize' id='"+ id +"_maximize' onclick='Windows.maximize(\""+ id +"\", event)'> </div>" : ""; 597 602 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"; 599 604 600 605 win.innerHTML = closeDiv + minDiv + maxDiv + "\ … … 628 633 629 634 630 changeClassName: function(newClassName) { 635 changeClassName: function(newClassName) { 631 636 var className = this.options.className; 632 637 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); }); 636 641 this.options.className = newClassName; 637 642 }, 638 643 639 _toggleClassName: function(element, oldClassName, newClassName) { 644 _toggleClassName: function(element, oldClassName, newClassName) { 640 645 if (element) { 641 646 element.removeClassName(oldClassName); … … 726 731 if (this.element.style.zIndex < Windows.maxZIndex) 727 732 this.setZIndex(Windows.maxZIndex + 1); 728 this._notify("onFocus");729 733 if (this.iefix) 730 734 this._fixIEOverlapping(); 731 735 }, 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) { 757 753 var size = WindowUtilities._computeSize(this.content.innerHTML, this.content.id, this.width, this.height, 0, this.options.className) 758 754 if (this.height) … … 765 761 if (this.centered) 766 762 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(); 767 790 768 791 this._notify("onBeforeShow"); … … 773 796 774 797 this._checkIEOverlapping(); 775 this.visible = true;776 798 WindowUtilities.focusedWindow = this 777 799 this._notify("onShow"); … … 791 813 }, 792 814 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); 797 818 if (typeof top == "undefined") 798 819 top = (pageSize.windowHeight - (this.height + this.heightN + this.heightS))/2; … … 801 822 if (typeof left == "undefined") 802 823 left = (pageSize.windowWidth - (this.width + this.widthW + this.widthE))/2; 803 left += windowScroll.left 804 824 left += windowScroll.left 805 825 this.setLocation(top, left); 806 826 this.toFront(); 807 827 }, 808 828 809 _recenter: function(event) { 829 _recenter: function(event) { 810 830 if (this.centered) { 811 var pageSize = WindowUtilities.getPageSize(); 831 var pageSize = WindowUtilities.getPageSize(this.options.parent); 832 var windowScroll = WindowUtilities.getWindowScroll(this.options.parent); 812 833 813 834 // 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) 815 837 return; 816 838 this.pageSize = pageSize; 817 839 this.windowScroll = windowScroll; 818 840 // set height of Overlay to take up whole page and show 819 841 if ($('overlay_modal')) … … 925 947 return; 926 948 927 if ( window.ie&& this.heightN == 0)949 if (Prototype.Browser.IE && this.heightN == 0) 928 950 this._getWindowBorderSize(); 929 951 … … 937 959 Windows.unsetOverflow(this); 938 960 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); 941 963 var left = windowScroll.left; 942 964 var top = windowScroll.top; … … 1004 1026 Element.update(this.element.id + '_top', newTitle); 1005 1027 }, 1006 1028 1029 getTitle: function() { 1030 return $(this.element.id + '_top').innerHTML; 1031 }, 1032 1007 1033 setStatusBar: function(element) { 1008 1034 var statusBar = $(this.getId() + "_bottom"); … … 1061 1087 1062 1088 // Workaround for IE!! 1063 if ( window.ie) {1089 if (Prototype.Browser.IE) { 1064 1090 this.heightS = $(this.getId() +"_row3").getDimensions().height; 1065 1091 this.heightN = $(this.getId() +"_row1").getDimensions().height; … … 1067 1093 1068 1094 // Safari size fix 1069 if ( window.khtml && !window.webkit)1095 if (Prototype.Browser.WebKit && Prototype.Browser.WebKitVersion < 420) 1070 1096 this.setSize(this.width, this.height); 1071 1097 if (this.doMaximize) … … 1139 1165 _createWiredElement: function() { 1140 1166 if (! this.wiredElement) { 1141 if ( window.ie)1167 if (Prototype.Browser.IE) 1142 1168 this._getWindowBorderSize(); 1143 1169 var div = document.createElement("div"); … … 1215 1241 }, 1216 1242 1217 // onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocusonBeforeShow onShow onHide onMinimize onMaximize onClose1243 // onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onBlur onBeforeShow onShow onHide onMinimize onMaximize onClose 1218 1244 notify: function(eventName, win) { 1219 1245 this.observers.each( function(o) {if(o[eventName]) o[eventName](eventName, win);}); … … 1242 1268 addModalWindow: function(win) { 1243 1269 // 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 } 1246 1273 else { 1247 1274 // Move overlay over all windows … … 1321 1348 }, 1322 1349 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 1323 1374 unsetOverflow: function(except) { 1324 1375 this.windows.each(function(d) { d.oldOverflow = d.getContent().getStyle("overflow") || "auto" ; d.getContent().setStyle({overflow: "hidden"}) }); … … 1331 1382 }, 1332 1383 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 } 1336 1390 this.focusedWindow = win; 1391 if (this.focusedWindow) 1392 this.focus(this.focusedWindow.getId()) 1337 1393 } 1338 1394 }; … … 1396 1452 <div class='" + parameters.className + "_buttons'>\ 1397 1453 <input type='button' value='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "/>\ 1398 </div>"; 1454 </div>"; 1399 1455 return this._openDialog(content, parameters) 1400 1456 }, … … 1437 1493 1438 1494 if (! parameters.height && ! parameters.width) { 1439 parameters.width = WindowUtilities.getPageSize( ).pageWidth / 2;1495 parameters.width = WindowUtilities.getPageSize(parameters.options.parent || document.body).pageWidth / 2; 1440 1496 } 1441 1497 if (parameters.id) … … 1455 1511 parameters.height = size + 5 1456 1512 } 1457 parameters.resizable = parameters.resizable || false;1458 1513 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; 1463 1519 1464 1520 var win = new Window(parameters); … … 1518 1574 */ 1519 1575 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 { 1576 if (Prototype.Browser.WebKit) { 1531 1577 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]); 1533 1579 } 1534 1580 1535 1536 1581 var 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 }; 1558 1615 }, 1559 1616 // … … 1563 1620 // Edit for Firefox by pHaez 1564 1621 // 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; 1579 1624 var windowWidth, windowHeight; 1580 1581 if (self.innerHeight) { // all except Explorer1582 windowWidth = self.innerWidth;1583 windowHeight = self.innerHeight;1584 } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode1585 windowWidth = document.documentElement.clientWidth;1586 windowHeight = document.documentElement.clientHeight;1587 } else if (document.body) { // other Explorers1588 windowWidth = document.body.clientWidth;1589 windowHeight = document.body.clientHeight;1590 }1591 1625 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 } 1607 1672 return {pageWidth: pageWidth ,pageHeight: pageHeight , windowWidth: windowWidth, windowHeight: windowHeight}; 1608 1673 }, 1609 1674 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); 1613 1677 }, 1614 1678 1615 1679 _disableScreen: function(className, overlayId, overlayOpacity, contentId) { 1616 var objBody = document.body;1617 1618 1680 // prep objects 1619 1681 var objOverlay = $(overlayId); 1620 1682 1621 var pageSize = WindowUtilities.getPageSize( );1683 var pageSize = WindowUtilities.getPageSize(objOverlay.parentNode); 1622 1684 1623 1685 // 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) { 1625 1687 WindowUtilities._hideSelect(); 1626 1688 WindowUtilities._showSelect(contentId); … … 1657 1719 1658 1720 _hideSelect: function(id) { 1659 if ( window.ie) {1721 if (Prototype.Browser.IE) { 1660 1722 id = id == null ? "" : "#" + id + " "; 1661 1723 $$(id + 'select').each(function(element) { … … 1669 1731 1670 1732 _showSelect: function(id) { 1671 if ( window.ie) {1733 if (Prototype.Browser.IE) { 1672 1734 id = id == null ? "" : "#" + id + " "; 1673 1735 $$(id + 'select').each(function(element) { … … 1698 1760 // The function also inserts html markup at the top of the page which will be used as a 1699 1761 // container for the overlay pattern and the inline image. 1700 initLightbox: function(id, className, doneHandler ) {1762 initLightbox: function(id, className, doneHandler, parent) { 1701 1763 // Already done, just update zIndex 1702 1764 if ($(id)) { … … 1707 1769 // create overlay div and hardcode some functional styles (aesthetic styles are in CSS file) 1708 1770 else { 1709 var objBody = document.body;1710 1771 var objOverlay = document.createElement("div"); 1711 1772 objOverlay.setAttribute('id', id); … … 1718 1779 Windows.maxZIndex++; 1719 1780 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") { 1722 1783 setTimeout(function() {doneHandler()}, 10); 1723 1784 } … … 1770 1831 tmpObj.innerHTML = content; 1771 1832 objBody.insertBefore(tmpObj, objBody.firstChild); 1772 1833 1773 1834 var size; 1774 1835 if (height) 1775 size = $( id).getDimensions().width + margin;1836 size = $(tmpObj).getDimensions().width + margin; 1776 1837 else 1777 size = $( id).getDimensions().height + margin;1838 size = $(tmpObj).getDimensions().height + margin; 1778 1839 objBody.removeChild(tmpObj); 1779 1840 return size; plugins/sfPrototypeWindowPlugin/web/js/window_ext.js
r3977 r5322 93 93 init: function(keyCode) { 94 94 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)); 97 98 }, 98 99 … … 100 101 var e = event || window.event 101 102 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; 103 106 if (characterCode == WindowCloseKey.keyCode && win) { 104 107 if (win.cancelCallback) 105 Dialog.cancelCallback();108 top.Dialog.cancelCallback(); 106 109 else if (win.okCallback) 107 Dialog.okCallback();110 top.Dialog.okCallback(); 108 111 else 109 Windows.close(Windows.focusedWindow.getId());112 top.Windows.close(top.Windows.focusedWindow.getId()); 110 113 } 111 114 } plugins/sfPrototypeWindowPlugin/web/themes/alert.css
r3977 r5322 9 9 width: 5px; 10 10 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; 12 12 } 13 13 14 14 .alert_n { 15 15 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; 17 17 } 18 18 … … 20 20 width: 5px; 21 21 height: 5px; 22 background: transparent url( /sfPrototypeWindowPlugin/themes/top_right.gif) no-repeat bottom left22 background: transparent url(alert/top_right.gif) no-repeat bottom left 23 23 } 24 24 25 25 .alert_e { 26 26 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; 28 28 } 29 29 30 30 .alert_w { 31 31 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; 33 33 } 34 34 … … 36 36 width: 5px; 37 37 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; 39 39 } 40 40 41 41 .alert_s { 42 42 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; 44 44 } 45 45 … … 47 47 width: 5px; 48 48 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; 50 50 } 51 51 … … 82 82 } 83 83 84 /* For alert dialog */84 /* For alert/confirm dialog */ 85 85 .alert_window { 86 86 background: #FFF; … … 114 114 width:100%; 115 115 height:16px; 116 background: #FFF url(' /sfPrototypeWindowPlugin/themes/progress.gif') no-repeat center center116 background: #FFF url('alert/progress.gif') no-repeat center center 117 117 } 118 118 plugins/sfPrototypeWindowPlugin/web/themes/alert_lite.css
r3977 r5322 79 79 width:100%; 80 80 height:16px; 81 background: #FFF url(' /sfPrototypeWindowPlugin/themes/progress.gif') no-repeat center center81 background: #FFF url('alert/progress.gif') no-repeat center center 82 82 } 83 83 plugins/sfPrototypeWindowPlugin/web/themes/default.css
r3977 r5322 16 16 width: 9px; 17 17 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; 19 19 } 20 20 21 21 .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; 23 23 height: 23px; 24 24 } … … 27 27 width: 9px; 28 28 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; 30 30 } 31 31 32 32 .dialog_e { 33 33 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; 35 35 } 36 36 37 37 .dialog_w { 38 38 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; 40 40 } 41 41 … … 43 43 width: 9px; 44 44 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; 46 46 } 47 47 48 48 .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; 50 50 height: 19px; 51 51 } … … 54 54 width: 9px; 55 55 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; 57 57 } 58 58 … … 60 60 width: 9px; 61 61 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; 63 63 cursor:se-resize; 64 64 } … … 67 67 width: 14px; 68 68 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; 70 70 position:absolute; 71 71 top:5px; … … 78 78 width: 14px; 79 79 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; 81 81 position:absolute; 82 82 top:5px; … … 89 89 width: 14px; 90 90 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; 92 92 position:absolute; 93 93 top:5px; … … 152 152 .dialog .title_window { 153 153 -moz-user-select:none; 154 } 154 } 155 plugins/sfPrototypeWindowPlugin/web/themes/mac_os_x.css
r3977 r5322 1 /* Focused windows */ 1 2 .overlay_mac_os_x { 2 3 background-color: #85BBEF; … … 164 165 } 165 166 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 7 7 8 8 .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; 10 10 width:10px; 11 11 height:25px; … … 13 13 14 14 .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; 16 16 height:25px; 17 17 } 18 18 19 19 .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; 21 21 width:10px; 22 22 height:25px; … … 24 24 25 25 .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; 27 27 width:7px; 28 28 } 29 29 30 30 .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; 32 32 width:7px; 33 33 } 34 34 35 35 .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; 37 37 width:7px; 38 38 height:7px; … … 40 40 41 41 .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; 43 43 height:7px; 44 44 } 45 45 46 46 .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; 48 48 width:7px; 49 49 height:7px; … … 57 57 width: 23px; 58 58 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; 60 60 position:absolute; 61 61 top:0px; … … 68 68 width: 23px; 69 69 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; 71 71 position:absolute; 72 72 top:0px; … … 79 79 width: 23px; 80 80 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; 82 82 position:absolute; 83 83 top:0px;