Exemplo n.º 1
0
 function ManualRegionPositionForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $regionid = Kit::GetParam('regionid', _GET, _STRING);
     $layoutid = Kit::GetParam('layoutid', _GET, _INT);
     $top = Kit::GetParam('top', _GET, _DOUBLE);
     $left = Kit::GetParam('left', _GET, _DOUBLE);
     $width = Kit::GetParam('width', _GET, _DOUBLE);
     $height = Kit::GetParam('height', _GET, _DOUBLE);
     $layoutWidth = Kit::GetParam('layoutWidth', _GET, _INT);
     $layoutHeight = Kit::GetParam('layoutHeight', _GET, _INT);
     $scale = Kit::GetParam('scale', _GET, _DOUBLE);
     Kit::ClassLoader('region');
     $region = new region($db);
     $ownerId = $region->GetOwnerId($layoutid, $regionid);
     $regionName = $region->GetRegionName($layoutid, $regionid);
     $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutid, $regionid, true);
     if (!$regionAuth->edit) {
         trigger_error(__('You do not have permissions to edit this region'), E_USER_ERROR);
     }
     // Scale the layout width/height
     $layoutWidth = round($layoutWidth * $scale, 0);
     $layoutHeight = round($layoutHeight * $scale, 0);
     // Set some information about the form
     Theme::Set('form_id', 'RegionProperties');
     Theme::Set('form_action', 'index.php?p=timeline&q=ManualRegionPosition');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '"><input type="hidden" name="regionid" value="' . $regionid . '"><input id="layoutWidth" type="hidden" name="layoutWidth" value="' . $layoutWidth . '"><input id="layoutHeight" type="hidden" name="layoutHeight" value="' . $layoutHeight . '"><input type="hidden" name="scale" value="' . $scale . '">');
     // Theme Variables
     Theme::Set('regionName', $regionName);
     Theme::Set('width', round($width * $scale, 0));
     Theme::Set('height', round($height * $scale, 0));
     Theme::Set('top', round($top * $scale, 0));
     Theme::Set('left', round($left * $scale, 0));
     Theme::Set('transition', $region->GetOption($layoutid, $regionid, 'transOut', ''));
     Theme::Set('duration', $region->GetOption($layoutid, $regionid, 'transOutDuration', 0));
     Theme::Set('direction', $region->GetOption($layoutid, $regionid, 'transOutDirection', ''));
     // Add none to the list
     $transitions = $this->user->TransitionAuth('out');
     $transitions[] = array('code' => '', 'transition' => 'None', 'class' => '');
     Theme::Set('transition_field_list', $transitions);
     // Compass points for direction
     $compassPoints = array(array('id' => 'N', 'name' => __('North')), array('id' => 'NE', 'name' => __('North East')), array('id' => 'E', 'name' => __('East')), array('id' => 'SE', 'name' => __('South East')), array('id' => 'S', 'name' => __('South')), array('id' => 'SW', 'name' => __('South West')), array('id' => 'W', 'name' => __('West')), array('id' => 'NW', 'name' => __('North West')));
     Theme::Set('direction_field_list', $compassPoints);
     if (count($this->user->TransitionAuth('out')) > 0) {
         $form = Theme::RenderReturn('region_form_options');
     } else {
         $form = Theme::RenderReturn('region_form_options_no_transition');
     }
     $response->SetFormRequestResponse($form, __('Region Options'), '350px', '275px', 'transitionFormLoad');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#RegionProperties").submit()');
     $response->AddButton(__('Set Full Screen'), 'setFullScreenLayout()');
     $response->Respond();
 }
Exemplo n.º 2
0
 function ManualRegionPositionForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $regionid = Kit::GetParam('regionid', _GET, _STRING);
     $layoutid = Kit::GetParam('layoutid', _GET, _INT);
     $scale = Kit::GetParam('scale', _GET, _DOUBLE);
     $zoom = Kit::GetParam('zoom', _GET, _DOUBLE);
     // Load the region and get the dimensions, applying the scale factor if necessary (only v1 layouts will have a scale factor != 1)
     $region = new region($db);
     $regionNode = $region->getRegion($layoutid, $regionid);
     $top = round($regionNode->getAttribute('top') * $scale, 0);
     $left = round($regionNode->getAttribute('left') * $scale, 0);
     $width = round($regionNode->getAttribute('width') * $scale, 0);
     $height = round($regionNode->getAttribute('height') * $scale, 0);
     $zindex = $regionNode->getAttribute('zindex');
     $ownerId = $region->GetOwnerId($layoutid, $regionid);
     $regionName = $regionNode->getAttribute('name');
     $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutid, $regionid, true);
     if (!$regionAuth->edit) {
         trigger_error(__('You do not have permissions to edit this region'), E_USER_ERROR);
     }
     // Set some information about the form
     Theme::Set('form_id', 'RegionProperties');
     Theme::Set('form_action', 'index.php?p=timeline&q=ManualRegionPosition');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '"><input type="hidden" name="regionid" value="' . $regionid . '"><input type="hidden" name="scale" value="' . $scale . '"><input type="hidden" name="zoom" value="' . $zoom . '">');
     $formFields = array();
     $formFields[] = FormManager::AddText('name', __('Name'), $regionName, __('Name of the Region'), 'n', 'maxlength="50"');
     $formFields[] = FormManager::AddNumber('top', __('Top'), $top, __('Offset from the Top Corner'), 't');
     $formFields[] = FormManager::AddNumber('left', __('Left'), $left, __('Offset from the Left Corner'), 'l');
     $formFields[] = FormManager::AddNumber('width', __('Width'), $width, __('Width of the Region'), 'w');
     $formFields[] = FormManager::AddNumber('height', __('Height'), $height, __('Height of the Region'), 'h');
     // Transitions
     if (count($this->user->TransitionAuth('out')) > 0) {
         // Add none to the list
         $transitions = $this->user->TransitionAuth('out');
         $transitions[] = array('code' => '', 'transition' => 'None', 'class' => '');
         $formFields[] = FormManager::AddCombo('transitionType', __('Exit Transition'), $region->GetOption($layoutid, $regionid, 'transOut', ''), $transitions, 'code', 'transition', __('What transition should be applied when this region is finished?'), 't');
         $formFields[] = FormManager::AddNumber('transitionDuration', __('Duration'), $region->GetOption($layoutid, $regionid, 'transOutDuration', 0), __('The duration for this transition, in milliseconds.'), 'l', '', 'transition-group');
         // Compass points for direction
         $compassPoints = array(array('id' => 'N', 'name' => __('North')), array('id' => 'NE', 'name' => __('North East')), array('id' => 'E', 'name' => __('East')), array('id' => 'SE', 'name' => __('South East')), array('id' => 'S', 'name' => __('South')), array('id' => 'SW', 'name' => __('South West')), array('id' => 'W', 'name' => __('West')), array('id' => 'NW', 'name' => __('North West')));
         $formFields[] = FormManager::AddCombo('transitionDirection', __('Direction'), $region->GetOption($layoutid, $regionid, 'transOutDirection', ''), $compassPoints, 'id', 'name', __('The direction for this transition. Only appropriate for transitions that move, such as Fly.'), 'd', 'transition-group transition-direction');
         // Add some dependencies
         $response->AddFieldAction('transitionType', 'init', '', array('.transition-group' => array('display' => 'none')));
         $response->AddFieldAction('transitionType', 'init', '', array('.transition-group' => array('display' => 'block')), 'not');
         $response->AddFieldAction('transitionType', 'change', '', array('.transition-group' => array('display' => 'none')));
         $response->AddFieldAction('transitionType', 'change', '', array('.transition-group' => array('display' => 'block')), 'not');
     }
     $formFields[] = FormManager::AddCheckbox('loop', __('Loop?'), $region->GetOption($layoutid, $regionid, 'loop', 0), __('If there is only one item in this region should it loop? Not currently available for Windows Players.'), 'l');
     $formFields[] = FormManager::AddNumber('zindex', __('Layer'), $zindex == 0 ? NULL : $zindex, __('The layering order of this region (z-index). Advanced use only. '), 'z');
     Theme::Set('form_fields', $formFields);
     // Add some information about the whole layout to this request.
     $layout = new Layout();
     $layoutInformation = $layout->LayoutInformation($layoutid);
     $response->extra['layoutInformation'] = array('width' => $layoutInformation['width'], 'height' => $layoutInformation['height']);
     $response->SetFormRequestResponse(NULL, __('Region Options'), '350px', '275px');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#RegionProperties").submit()');
     $response->AddButton(__('Set Full Screen'), 'setFullScreenLayout()');
     $response->Respond();
 }