sTEFANs Subversion Web Contol (SWC)
Inc
[ class tree: Swc ] [ index: Swc ] [ all elements ]

Source for file swc_control_content.inc.php

Documentation is available at swc_control_content.inc.php

  1. <?php
  2. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. SVN Web Control
  4. Copyright ©2006 by sTEFANs
  5. Created on 20.02.2006
  6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place - Suite 330,
  20. Boston, MA 02111-1307, USA.
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. */
  23.  
  24. /**
  25.  * Implementation of SWC control bar.
  26.  * 
  27.  * @package Swc
  28.  * @subpackage Inc
  29.  * @author Stefan Schraml
  30.  * @copyright Copyright ©2006 by sTEFANs
  31.  * @license http://opensource.org/licenses/lgpl-license.php GNU General Public License
  32.  * @version v1.1.0
  33.  * @since v1.0.0
  34.  */
  35.  
  36. /** Project configuration interface */
  37. require_once('inc/config.inc.php');
  38. /** SVN execution library */
  39. require_once('inc/svn_lib.inc.php');
  40. /** HTML generation library */
  41. require_once('inc/page.inc.php');
  42. /** Common utility functions */
  43. require_once('inc/utils.inc.php');
  44.     
  45.     /**
  46.      * Prints control frame for selected config
  47.      * 
  48.       * @since v1.0.0
  49.      */    
  50.     function SvnCpPrintPageContent(){
  51.         $config = GetSelectedConfig();
  52.         $config_list = GetAllConfigs();
  53.         
  54.         OpenTable(0, 0, 0);
  55.         if ($config == NULL){
  56.             if (count($config_list) > 0){
  57.                 PrintTableCell(T(TK_INDEX_PAGE_TITLE), 'title');
  58.                 PrintTableCell(T(TK_CTRL_TITLE_SELECT_PROJECT), 'text_low_bold');
  59.                 SvnCpPrintProjectSelectionCell($config, $config_list);
  60.             } else {
  61.                 $project_name = NULL;                
  62.                 if (isset($_SESSION[IDX_SEL_PROJECT])){
  63.                     $project_name = $_SESSION[IDX_SEL_PROJECT];
  64.                 }
  65.                 SvnCpPrintDefaultRows($project_name);
  66.                 SvnCpPrintHelpButtonCell(NULL);
  67.             }
  68.         } else {
  69.             $sel_frame = (isset($_SESSION[IDX_MAIN_FRAME_SRC]) ? $_SESSION[IDX_MAIN_FRAME_SRC] : '');
  70.             $sel_act = (isset($_SESSION[IDX_ACTION]) ? $_SESSION[IDX_ACTION] : '');
  71.             $settings = SwcUserSettings::GetInstance();
  72.             $checked_out = IsWebspaceCheckedOut();
  73.             
  74.             if ($settings->IsMinimizeControlBar() && $checked_out){
  75.                 SvnCpPrintProjectNameCells($config, true);
  76.                 SvnCpPrintCompactInfoCells($config, true);
  77.                 SvnCpPrintWebspaceUpdateCells($config, $sel_frame, $sel_act, true);
  78.                 SvnCpPrintProjectPageActionCell($config, $sel_frame);
  79.                 SvnCpPrintCompactCell();
  80.                 if (count($config_list) > 1){
  81.                     SvnCpPrintProjectSelectionCell($config, $config_list);
  82.                 }
  83.                 SvnCpPrintHelpButtonCell(NULL);
  84.             } else {
  85.                 $sel_frame = (isset($_SESSION[IDX_MAIN_FRAME_SRC]) ? $_SESSION[IDX_MAIN_FRAME_SRC] : '');
  86.                 $sel_act = (isset($_SESSION[IDX_ACTION]) ? $_SESSION[IDX_ACTION] : '');
  87.                 
  88.                 SvnCpPrintProjectNameCells($config);
  89.                 SvnCpPrintRepositoryInfoCells($config, $sel_frame, $sel_act);
  90.                 
  91.                 if (!$checked_out){
  92.                         SvnCpPrintWebspaceCheckoutCell($config, $sel_frame, $sel_act);
  93.                         SvnCpPrintHelpButtonCell($sel_frame);
  94.                     if (count($config_list) > 1){
  95.                         SvnCpPrintProjectSelectionCell($config, $config_list);
  96.                     }
  97.                     NewTableRow();                
  98.                         PrintTableCell(T(TK_CTRL_ERROR_NO_WEBSPACE), 'text_low_bold_red', 6);
  99.                 } else {
  100.                     SvnCpPrintCompactCell();
  101.                     SvnCpPrintHelpButtonCell($sel_frame);
  102.                     NewTableRow();
  103.                         SvnCpPrintWebspaceInfoCells($config);
  104.                         SvnCpPrintWebspaceUpdateCells($config, $sel_frame, $sel_act);
  105.                     NewTableRow();
  106.                         SvnCpPrintActionsCell($config, $sel_frame, $sel_act, 7);
  107.                     NewTableRow();
  108.                     if ($config->IsSvnCommandBarEnabled() && $settings->IsSvnCommandBarVisible()){
  109.                         SvnCpPrintCommandCell($config, $sel_frame, $sel_act, 7);
  110.                     NewTableRow();
  111.                     }
  112.                     if ($settings->IsSvnSwitchBarVisible()){
  113.                         SvnCpPrintSwitchPathsCell($config, $config, $config_list, 7);
  114.                     NewTableRow();
  115.                     }
  116.                         SvnCpPrintUserSettingsCell($config, 7);
  117.                 }
  118.             }
  119.         }
  120.         CloseTable();
  121.     }
  122.     
  123.     /** 
  124.      * Prints two default table rows for an unconfigured project.
  125.      * @param string $project_name Name of the project or NULL if no project name is provided.
  126.      * 
  127.       * @since v1.0.0
  128.      */
  129.     function SvnCpPrintDefaultRows($project_name){
  130.         PrintTableCell(T(TK_CTRL_ERROR_CONFIG_NOT_FOUND), 'title');
  131.         NewTableRow();
  132.         $content = T(TK_CTRL_GENERAL_ERROR);
  133.         if ($project_name != NULL){
  134.             $content = T(TK_CTRL_ERROR_NO_CONFIG__PROJECTNAME, $project_name);
  135.         }
  136.         PrintTableCell($content, 'text_low_bold_red');
  137.     }
  138.     
  139.     /** 
  140.      * Prints two table cells vertically with project name.
  141.      * @param <b>SwcConfig</b> $config Active project configuration.
  142.      * @param boolean $compact If true, only project name is
  143.      *  displayed within a single row.
  144.      * @see SwcConfig
  145.      * 
  146.       * @since v1.0.0
  147.      */
  148.     function SvnCpPrintProjectNameCells($config, $compact = false){
  149.         if (!$compact) {
  150.             OpenTableCell(NULL, 0, 2);
  151.                 OpenTable();
  152.         }
  153.         $content = $config->GetProjectName();
  154.         PrintTableCell($content, 'title');
  155.         if (!$compact) {
  156.             $svn_version = GetSvnVersion();
  157.                 NewTableRow();
  158.                     PrintTableCell(T(TK_CTRL_BY_SVN__VERSION, $svn_version), 'text_low_highlight');
  159.                 CloseTable();
  160.             CloseTableCell();
  161.         }
  162.     }
  163.     
  164.     /** 
  165.      * Prints four table cells for Repository info for a configured project.
  166.      * This function prints the same number of cells as function
  167.      * <b>SvnCpPrintWebspaceInfoRow()</b>.
  168.      * @param <b>SwcConfig</b> $config Active project configuration.
  169.      * @param string $sel_frame Selected main frame.
  170.      * @param string $sel_action Selected action.
  171.      * @see SwcConfig
  172.      * @see SvnCpPrintWebspaceInfoRow
  173.      * 
  174.       * @since v1.0.0
  175.      */    
  176.     function SvnCpPrintRepositoryInfoCells($config, $sel_frame, $sel_action){
  177.         if ($config == NULL){
  178.             PrintTableCell(T(TK_CTRL_ERROR_NO_CONFIG), 'text_low_bold_red');
  179.         } else {
  180.             $rev_webspace = intval(GetWebspaceRevision($config));
  181.             $rev_head = intval(GetHeadRevision($config));
  182.             PrintTableCell(T(TK_CTRL_TITLE_HEAD), 'text_low_bold');            
  183.             PrintTableCell('', 'text_low');
  184.             $content = T(TK_CTRL_TITLE_REVISION).' '.$rev_head;
  185.             PrintTableCell($content, 'text_low');
  186.             $content = GetHeadDate($config);
  187.             PrintTableCell($content, 'text_low');
  188.         }
  189.     }
  190.     
  191.     /** 
  192.      * Prints four table row cells for Webspace info for a configured project.
  193.      * This function prints the same number of cells as function
  194.      * <b>SvnCpPrintRepositoryInfoRow()</b>.
  195.      * @param <b>SwcConfig</b> $config Active project configuration.
  196.      * @see SwcConfig
  197.      * @see SvnCpPrintRepositoryInfoRow
  198.      * 
  199.       * @since v1.0.0
  200.      */
  201.     function SvnCpPrintWebspaceInfoCells($config){
  202.         if ($config == NULL){
  203.             PrintTableCell(T(TK_CTRL_ERROR_NO_CONFIG), 'text_low_bold_red');
  204.         } else {
  205.             $rev_webspace = intval(GetWebspaceRevision($config));
  206.             $rev_webspace_source = trim(GetWebspaceSourcePath($config));
  207.             $rev_head = intval(GetHeadRevision($config));
  208.             PrintTableCell(T(TK_CTRL_TITLE_WS), 'text_low_bold');            
  209.             PrintTableCell($rev_webspace_source, 'text_low');
  210.             $content = T(TK_CTRL_TITLE_REVISION).' '.$rev_webspace;
  211.             PrintTableCell($content, 'text_low');
  212.             $content = GetWebspaceRevisionDate($config);
  213.             PrintTableCell($content, 'text_low');
  214.         }
  215.     }
  216.     
  217.     /** 
  218.      * Prints five table row cells for minimal webspace and repository
  219.      * info for a configured project.
  220.      * @param <b>SwcConfig</b> $config Active project configuration.
  221.      * @see SwcConfig
  222.      * 
  223.       * @since v1.0.0
  224.      */
  225.     function SvnCpPrintCompactInfoCells($config){
  226.         if ($config == NULL){
  227.             PrintTableCell(T(TK_CTRL_ERROR_NO_CONFIG), 'text_low_bold_red');
  228.         } else {
  229.             $rev_webspace = intval(GetWebspaceRevision($config));
  230.             $rev_head = intval(GetHeadRevision($config));
  231.             $rev_webspace_source = trim(GetWebspaceSourcePath($config));
  232.             $ws_deprecated = ($rev_webspace < $rev_head);
  233.             
  234.             PrintTableCell(T(TK_CTRL_TITLE_HEAD_SHORT), 'text_low_bold');
  235.             $content = T(TK_CTRL_TITLE_REVISION_SHORT).' '.$rev_head;
  236.             PrintTableCell($content, 'text_low');                    
  237.             $style = ($ws_deprecated ? 'text_low_bold_red' : 'text_low_bold');    
  238.             PrintTableCell(T(TK_CTRL_TITLE_WS_SHORT), $style);    
  239.             $content = T(TK_CTRL_TITLE_REVISION_SHORT).' '.$rev_webspace;    
  240.             $style = ($ws_deprecated ? 'text_low_bold_red' : 'text_low');    
  241.             PrintTableCell($content, $style);        
  242.             PrintTableCell($rev_webspace_source, 'text_low');
  243.         }
  244.     }
  245.     
  246.     /** 
  247.      * Prints two table cells for updating the Webspace.
  248.      * @param <b>SwcConfig</b> $config Active project configuration.
  249.      * @param string $sel_frame Selected main frame.
  250.      * @param string $sel_action Selected action.
  251.      * @see SwcConfig
  252.      * 
  253.       * @since v1.0.0
  254.      */    
  255.     function SvnCpPrintWebspaceUpdateCells($config, $sel_frame, $sel_action, $compact = false){
  256.         $rev_webspace = intval(GetWebspaceRevision($config));
  257.         $rev_head = intval(GetHeadRevision($config));
  258.         $ws_deprecated = ($rev_webspace < $rev_head);
  259.         
  260.         if ($ws_deprecated && !$compact){
  261.             PrintTableCell(T(TK_CTRL_WARN_WS_OUTDATED), 'text_low_bold_red');
  262.         }
  263.         
  264.         $actions = array(
  265.             array(IDX_MAIN_FRAME_SRC, STD_DETAILS_CONTENT), 
  266.             array(IDX_ACTION, ACTION_UPDATE));
  267.         $sel = strcmp($sel_frame, STD_DETAILS_CONTENT) == 0 && strcmp($sel_action, ACTION_UPDATE) == 0;
  268.         PrintTableButtonCell(T(TK_CTRL_ACTION_UPDATE), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel, $ws_deprecated);
  269.         
  270.         if (!$ws_deprecated && !$compact){
  271.             PrintEmptyTableCell();
  272.         }
  273.     }
  274.     
  275.     /** 
  276.      * Prints one table cell for checking out the project into the Webspace.
  277.      * @param <b>SwcConfig</b> $config Active project configuration.
  278.      * @param string $sel_frame Selected main frame.
  279.      * @param string $sel_action Selected action.
  280.      * @see SwcConfig
  281.      * 
  282.       * @since v1.0.0
  283.      */    
  284.     function SvnCpPrintWebspaceCheckoutCell($config, $sel_frame, $sel_action){        
  285.         $actions = array(
  286.             array(IDX_MAIN_FRAME_SRC, STD_DETAILS_CONTENT), 
  287.             array(IDX_ACTION, ACTION_CHECKOUT));
  288.         $sel = strcmp($sel_frame, STD_DETAILS_CONTENT) == 0 && strcmp($sel_action, ACTION_CHECKOUT) == 0;
  289.         PrintTableButtonCell(T(TK_CTRL_ACTION_CHECKOUT), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel);
  290.         
  291.     }
  292.     
  293.     /** 
  294.      * Prints two table cells for changing the project.
  295.      * @param array $configs  Array of <b>SwcConfig</b>s which appears in selection list.
  296.      * @param <b>SwcConfig</b> $active_config Active config.
  297.      * @see SwcConfig
  298.      * 
  299.       * @since v1.0.0
  300.      */    
  301.     function SvnCpPrintProjectSelectionCell($active_config, $configs){
  302.         $list = array();
  303.         $sel = NULL;
  304.         if ($active_config != NULL) {
  305.             $sel = $active_config->GetProjectName();
  306.         } else {
  307.             $no_project = T(TK_CTRL_ACTION_NO_PROJECT);
  308.             $list[] = array(IDX_VALUE => $no_project, IDX_NAME => $no_project);
  309.             $sel = $no_project;
  310.         }
  311.         
  312.         foreach ($configs as $config){
  313.             $list[] = array(IDX_VALUE => $config->GetProjectName(), IDX_NAME => $config->GetProjectName());
  314.         }
  315.                                                                             $sel, $list, IDX_SEL_PROJECT, 1, 'text_low_bold', NULL, 2);
  316.     }
  317.     
  318.     /** 
  319.      * Prints a single cell containing containing a button to switch to the configured project.
  320.      * @param <b>SwcConfig</b> $config Active project configuration.
  321.      * @param string $sel_frame Selected main frame.
  322.      * @see SwcConfig
  323.      * 
  324.       * @since v1.0.0
  325.      */
  326.     function SvnCpPrintProjectPageActionCell($config, $sel_frame){
  327.         $main_frame = $config->GetMainFrame();
  328.         $actions = array(IDX_MAIN_FRAME_SRC, $main_frame);
  329.         $sel = strcmp($sel_frame, $main_frame) == 0;
  330.         PrintTableButtonCell(T(TK_CTRL_ACTION_SHOW_PROJECTPAGE), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel);
  331.     }
  332.     
  333.     /** 
  334.      * Prints a single cell containing a table with some actions for a configured project.
  335.      * This function prints the cells within an separate table.
  336.      * @param <b>SwcConfig</b> $config Active project configuration.
  337.      * @param string $sel_frame Selected main frame.
  338.      * @param string $sel_action Selected action.
  339.      * @param int $colspan Number of columns the inner table should use in outer table.
  340.      * @see SwcConfig
  341.      * 
  342.       * @since v1.0.0
  343.      */    
  344.     function SvnCpPrintActionsCell($config, $sel_frame, $sel_action, $colspan){
  345.         if ($config == NULL){
  346.             PrintTableCell(T(TK_CTRL_ERROR_NO_CONFIG), 'text_low_bold_red');
  347.         } else {
  348.             OpenTableCell(NULL, $colspan);
  349.                 OpenTable();
  350.                     $actions = array(IDX_REUSE_SESSION, '1');
  351.                     PrintTableButtonCell(T(TK_CTRL_ACTION_REFRESH), $_SESSION[IDX_ROOT_URL], $actions, 'text_low');
  352.                     
  353.                     SvnCpPrintProjectPageActionCell($config, $sel_frame);
  354.                     
  355.                     $main_frame = $config->GetRepositoryRoot();
  356.                     $action = NULL;
  357.                     if (strpos($main_frame, 'http') === 0){
  358.                         $actions = array(IDX_MAIN_FRAME_SRC, $main_frame);
  359.                     } else {
  360.                         $actions = array(
  361.                             array(IDX_MAIN_FRAME_SRC, STD_DETAILS_CONTENT), 
  362.                             array(IDX_ACTION, ACTION_LIST_REPOSITORY));
  363.                     }
  364.                     $sel = (strcmp($sel_frame, STD_DETAILS_CONTENT) == 0 && strcmp($sel_action, ACTION_LIST_REPOSITORY) == 0) || (strcmp($sel_frame, $main_frame) == 0);
  365.                     PrintTableButtonCell(T(TK_CTRL_ACTION_SHOW_REPOSITORY), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel);
  366.                     
  367.                     $main_frame = $config->GetWebSvnUrl();
  368.                     if ($main_frame != NULL){
  369.                         $actions = NULL;
  370.                         $sel = false;
  371.                         $actions = array(IDX_MAIN_FRAME_SRC, $main_frame);
  372.                         $sel = strcmp($sel_frame, $main_frame) == 0;
  373.                         PrintTableButtonCell(T(TK_CTRL_ACTION_SHOW_WEBSVN), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel);
  374.                     }
  375.                     
  376.                     $actions = array(
  377.                         array(IDX_MAIN_FRAME_SRC, STD_DETAILS_CONTENT), 
  378.                         array(IDX_ACTION, ACTION_INFO));
  379.                     $sel = strcmp($sel_frame, STD_DETAILS_CONTENT) == 0 && strcmp($sel_action, ACTION_INFO) == 0;
  380.                     PrintTableButtonCell(T(TK_CTRL_ACTION_SHOW_WS_INFO), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel);
  381.                     
  382.                     $actions = array(
  383.                         array(IDX_MAIN_FRAME_SRC, STD_DETAILS_CONTENT), 
  384.                         array(IDX_ACTION, ACTION_STATUS));
  385.                     $sel = strcmp($sel_frame, STD_DETAILS_CONTENT) == 0 && strcmp($sel_action, ACTION_STATUS) == 0;
  386.                     PrintTableButtonCell(T(TK_CTRL_ACTION_SHOW_WS_STATUS), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel);
  387.                     
  388.                     $actions = array(
  389.                         array(IDX_MAIN_FRAME_SRC, STD_DETAILS_CONTENT), 
  390.                         array(IDX_ACTION, ACTION_LOG));
  391.                     $sel = strcmp($sel_frame, STD_DETAILS_CONTENT) == 0 && strcmp($sel_action, ACTION_LOG) == 0;
  392.                     PrintTableButtonCell(T(TK_CTRL_ACTION_SHOW_WS_LOG), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel);
  393.                     
  394.                     $actions = array(
  395.                         array(IDX_MAIN_FRAME_SRC, STD_DETAILS_CONTENT), 
  396.                         array(IDX_ACTION, ACTION_CLEANUP));
  397.                     $sel = strcmp($sel_frame, STD_DETAILS_CONTENT) == 0 && strcmp($sel_action, ACTION_CLEANUP) == 0;                    
  398.                     PrintTableButtonCell(T(TK_CTRL_ACTION_SHOW_WS_CLEANUP), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel);
  399.                     
  400.                     $actions = array(
  401.                         array(IDX_MAIN_FRAME_SRC, STD_ARCHIVE_CONTENT), 
  402.                         array(IDX_ACTION, ACTION_ARCHIVE));
  403.                     $sel = strcmp($sel_frame, STD_ARCHIVE_CONTENT) == 0 && strcmp($sel_action, ACTION_ARCHIVE) == 0;                    
  404.                     PrintTableButtonCell(T(TK_CTRL_ACTION_SHOW_ARCHIVE_PAGE), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel);
  405.                 CloseTable();
  406.             CloseTableCell();
  407.         }
  408.     }
  409.     
  410.     /** 
  411.      * Prints a single cell containing a table allows to initiate an SVN command.
  412.      * This function prints the cells within an separate table.
  413.      * @param <b>SwcConfig</b> $config Active project configuration.
  414.      * @param string $sel_frame Selected main frame.
  415.      * @param string $sel_action Selected action.
  416.      * @param int $colspan Number of columns the inner table should use in outer table.
  417.      * @see SwcConfig
  418.      * 
  419.       * @since v1.0.0
  420.      */    
  421.     function SvnCpPrintCommandCell($config, $sel_frame, $sel_action, $colspan){
  422.         if ($config == NULL){
  423.             PrintTableCell(T(TK_CTRL_ERROR_NO_CONFIG), 'text_low_bold_red');
  424.         } else {
  425.             OpenTableCell(NULL, $colspan);
  426.                 OpenTable();
  427.                     OpenFormCell($_SESSION[IDX_ROOT_URL]);
  428.                         OpenTable();
  429.                             OpenTableCell('text_low_bold');
  430.                                 $actions = array(
  431.                                     array(IDX_MAIN_FRAME_SRC, STD_DETAILS_CONTENT), 
  432.                                     array(IDX_ACTION, ACTION_SVN_CMD));
  433.                                 $sel = strcmp($sel_frame, STD_DETAILS_CONTENT) == 0 && strcmp($sel_action, ACTION_SVN_CMD) == 0;
  434.                                 $text = '';
  435.                                 if(isset($_SESSION[IDX_ACTION_COMMAND])){
  436.                                     $text = $_SESSION[IDX_ACTION_COMMAND];
  437.                                 }
  438.                                 PrintFormTextField(T(TK_CTRL_LABEL_SVN_CMD), IDX_ACTION_COMMAND, 85, $text);
  439.                             CloseTableCell();
  440.                             OpenTableCell();
  441.                                 PrintFormButton(T(TK_CTRL_ACTION_SVN_CMD), $actions, $sel);
  442.                             CloseTableCell();
  443.                         CloseTable();
  444.                     CloseFormCell();
  445.                     $actions = array(
  446.                         array(IDX_MAIN_FRAME_SRC, STD_DETAILS_CONTENT), 
  447.                         array(IDX_ACTION, ACTION_SVN_HELP));
  448.                     $sel = strcmp($sel_frame, STD_DETAILS_CONTENT) == 0 && strcmp($sel_action, ACTION_SVN_HELP) == 0;
  449.                     PrintTableButtonCell(T(TK_CTRL_ACTION_SVN_HELP), $_SESSION[IDX_ROOT_URL], $actions, 'text_low', $sel);
  450.                 CloseTable();
  451.             CloseTableCell();
  452.         }
  453.     }
  454.         
  455.     /** 
  456.      * Prints a single cell containing a table with actions to switch to a dedicated
  457.      * repository path for a configured project.
  458.      * This function prints the cells within an separate table.
  459.      * @param <b>SwcConfig</b> $config Active project configuration.
  460.      * @param string $sel_frame Selected main frame.
  461.      * @param string $sel_action Selected action.
  462.      * @param int $colspan Number of columns the inner table should use in outer table.
  463.      * @see SwcConfig
  464.      * 
  465.       * @since v1.0.0
  466.      */    
  467.     function SvnCpPrintSwitchPathsCell($config, $active_config, $configs, $colspan){
  468.         if ($config == NULL){
  469.             PrintTableCell(T(TK_CTRL_ERROR_NO_CONFIG), 'text_low_bold_red');
  470.         } else {
  471.             OpenTableCell(NULL, $colspan);
  472.                 OpenTable();
  473.                     if (count($configs) > 1){
  474.                         SvnCpPrintProjectSelectionCell($active_config, $configs);
  475.                     }                                                                                    
  476.                                                                                         
  477.                     $act = ACTION_SWITCH;
  478.                     $actions = array(
  479.                         array(IDX_MAIN_FRAME_SRC, STD_DETAILS_CONTENT), 
  480.                         array(IDX_ACTION, $act));
  481.                     PrintTableButtonCell(T(TK_CTRL_ACTION_SWITCH_TO_HEAD), $_SESSION[IDX_ROOT_URL], $actions, 'text_low_bold');
  482.                     
  483.                     $tags = GetTags($config);
  484.                     $select = array();
  485.                     foreach($tags as $tag){
  486.                         $select[] = array($tag, $tag);
  487.                     }
  488.                     PrintTableButtonSelectionCells(T(TK_CTRL_LABEL_SWITCH_TO_TAG), T(TK_CTRL_ACTION_SWITCH), $_SESSION[IDX_ROOT_URL], $select, $actions, $act, 1, 'text_low_bold');                
  489.                     $branches = GetBranches($config);
  490.                     $select = array();
  491.                     foreach($branches as $branch){
  492.                         $select[] = array($branch, $branch);
  493.                     }
  494.                     PrintTableButtonSelectionCells(T(TK_CTRL_LABEL_SWITCH_TO_BRANCH), T(TK_CTRL_ACTION_SWITCH), $_SESSION[IDX_ROOT_URL], $select, $actions, $act, 1, 'text_low_bold');
  495.                 CloseTable();
  496.             CloseTableCell();
  497.         }
  498.     }
  499.         
  500.     /** 
  501.      * Prints a single cell containing a table for user settings.
  502.      * This function prints the cells within an separate table.
  503.      * @param int $colspan Number of columns the inner table should use in outer table.
  504.      * @see SwcConfig
  505.      * 
  506.       * @since v1.0.0
  507.      */    
  508.     function SvnCpPrintUserSettingsCell($config, $colspan){
  509.         $settings = SwcUserSettings::GetInstance();
  510.         $hints = array(IDX_REUSE_SESSION, '1');
  511.         OpenTableCell('text_low', $colspan);
  512.             OpenTable();
  513.                 if ($config != NULL){
  514.                     PrintTableLinkCell($config->GetMainFrame(), T(TK_CTRL_ACTION_OPEN_PROJECTPAGE), 'tabbed', 'text_low_link');
  515.                 }
  516.                                                                 $_SESSION[IDX_ROOT_URL], $hints, 'text_low', 
  517.                                                                 'text_low', $settings->IsPinProjectPage());
  518.  
  519.                                                                 $_SESSION[IDX_ROOT_URL], $hints, 'text_low', 
  520.                                                                 'text_low', $settings->IsSeparateResultWindow());
  521.                                                                 
  522.                                                                 $_SESSION[IDX_ROOT_URL], $hints, 'text_low', 
  523.                                                                 'text_low', $settings->IsSvnSwitchBarVisible());
  524.                                                             
  525.                 if ($config != NULL && $config->IsSvnCommandBarEnabled()){    
  526.                     PrintTableCheckboxCells(T(TK_CTRL_LABEL_SHOW_CMDBAR), OPT_SHOW_SVN_CMD_BAR,
  527.                                                                 $_SESSION[IDX_ROOT_URL], $hints, 'text_low', 
  528.                                                                 'text_low', $settings->IsSvnCommandBarVisible());
  529.                 }
  530.  
  531.                 OpenFormCell($_SESSION[IDX_ROOT_URL], 'text_low');
  532.                     OpenTable();
  533.                         PrintTableCell(T(TK_CTRL_LABEL_FRAME_SIZE), 'text_low_bold', 3);
  534.                     NewTableRow();
  535.                         OpenTableCell('text_low');
  536.                             PrintFormTextField(T(TK_CTRL_LABEL_FRAME_WIDTH), OPT_FRAME_WIDTH, 4, 
  537.                                                                     $settings->GetProjectFrameWidth(), 4, 'right');
  538.                         CloseTableCell();
  539.                         OpenTableCell('text_low');
  540.                             PrintFormTextField(T(TK_CTRL_LABEL_FRAME_HEIGHT), OPT_FRAME_HEIGHT, 4, 
  541.                                                                     $settings->GetProjectFrameHeight(), 4, 'right');
  542.                         CloseTableCell();
  543.                         OpenTableCell('text_low');
  544.                             PrintFormButton(T(TK_CTRL_ACTION_SET_FRAME_SIZE));
  545.                         CloseTableCell();
  546.                     CloseTable();
  547.                 CloseFormCell();                                            
  548.             CloseTable();
  549.         CloseTableCell();
  550.     }
  551.         
  552.     /** 
  553.      * Prints a single cell with a checkbox which allows to minimize the control bar.
  554.      * @param int $colspan Number of columns the cell should span.
  555.      * @see SwcConfig
  556.      * 
  557.       * @since v1.0.0
  558.      */    
  559.     function SvnCpPrintCompactCell($colspan = 0){
  560.         $settings = SwcUserSettings::GetInstance();
  561.         $hints = array(IDX_REUSE_SESSION, '1');
  562.                                                         $_SESSION[IDX_ROOT_URL], $hints, 'text_low_bold', 
  563.                                                         'text_low', $settings->IsMinimizeControlBar());
  564.     }
  565.         
  566.     /** 
  567.      * Prints a single cell with a button
  568.      * to display the help page.
  569.      * @param int $colspan Number of columns the cell should span.
  570.      * @see SwcConfig
  571.      * 
  572.       * @since v1.0.0
  573.      */    
  574.     function SvnCpPrintHelpButtonCell($sel_frame){
  575.         $main_frame = STD_HELP_PAGE;
  576.         $actions = array(IDX_MAIN_FRAME_SRC, $main_frame);
  577.         $sel = strcmp($sel_frame, $main_frame) == 0;
  578.         PrintTableButtonCell(T(TK_CTRL_ACTION_SWC_HELP), $_SESSION[IDX_ROOT_URL], $actions, 'text_low_bold', $sel);
  579.     }
  580.     
  581.     /** 
  582.      * Main function for printing SVN Web Control page.
  583.      * 
  584.       * @since v1.0.0
  585.      */
  586.     function SvnCpPrintPage(){
  587.         PrintPageHeader(T(TK_CTRL_PAGE_TITLE), 'control');
  588.         SvnCpPrintPageContent();
  589.         PrintPageFooter();
  590.     }
  591.     
  592. ?>

Documentation generated on Fri, 03 Nov 2006 18:45:04 +0100 by phpDocumentor 1.3.0RC6
for sTEFANs POWERED BY eBC.bz