Index: branches/5.2.x/core/units/admin/admin_events_handler.php =================================================================== diff -u -N -r15261 -r15539 --- branches/5.2.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 15261) +++ branches/5.2.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 15539) @@ -1,6 +1,6 @@ Conn->Query('OPTIMIZE TABLE ' . $table_name); } } + + /** + * Returns popup size (by template), if not cached, then parse template to get value + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnGetPopupSize(kEvent $event) + { + $event->status = kEvent::erSTOP; + + if ( $this->Application->GetVar('ajax') != 'yes' ) { + return; + } + + $t = $this->Application->GetVar('template_name'); + + $sql = 'SELECT * + FROM ' . TABLE_PREFIX . 'PopupSizes + WHERE TemplateName = ' . $this->Conn->qstr($t); + $popup_info = $this->Conn->GetRow($sql); + + $this->Application->setContentType('text/plain'); + + if ( !$popup_info ) { + // dies when SetPopupSize tag found & in ajax request + $this->Application->InitParser(); + $this->Application->ParseBlock(Array ('name' => $t)); + + // tag SetPopupSize not found in template -> use default size + echo '750x400'; + } + else { + echo $popup_info['PopupWidth'] . 'x' . $popup_info['PopupHeight']; + } + } }