Changeset 3955

Show
Ignore:
Timestamp:
Thu Oct 6 21:09:13 2005
Author:
paul
Message:

Converted all files in /priv/issues directory to PHP. Updated Issue class to handle all the functionality. Renamed setShortName() to setUrlName() in Issue, Section, and Article.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/campsite/implementation/management/priv/sections/edit.php

    r3903 r3955  
    81 81     <TD ALIGN="RIGHT" ><?php  putGS("URL Name"); ?>:</TD>  
    82 82     <TD>  
    83       <INPUT TYPE="TEXT" class="input_text" NAME="cShortName" SIZE="32" MAXLENGTH="32" value="<?php  p(htmlspecialchars($sectionObj->getShortName())); ?>">  
      83     <INPUT TYPE="TEXT" class="input_text" NAME="cShortName" SIZE="32" MAXLENGTH="32" value="<?php  p(htmlspecialchars($sectionObj->getUrlName())); ?>">  
    83 83     </TD>  
    84 84 </TR>  
  • trunk/campsite/implementation/management/priv/sections/index.php

    r3941 r3955  
    74 74          
    75 75         <TD >  
    76               <?php p(htmlspecialchars($section->getShortName())); ?>  
      76             <?php p(htmlspecialchars($section->getUrlName())); ?>  
    76 76         </TD>  
    77 77          
  • trunk/campsite/implementation/management/priv/sections/add.php

    r3903 r3955  
    31 31  
    32 32 $topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj);  
    33   camp_html_content_top(getGS('Add new section'), $topArray);  
      33 camp_html_content_top(getGS('Add new section'), $topArray, true, false, array(getGS("Sections") => "/$ADMIN/sections/?Pub=$Pub&Issue=$Issue&Language=$Language"));  
    33 33  
    34 34 ?>  
  • trunk/campsite/implementation/management/priv/camp_html.php

    r3938 r3955  
    245 245                 ."&sLanguage=".$sectionObj->getLanguageId());  
    246 246     }  
      247     if (is_array($p_extraBreadcrumbs)) {  
      248         //print_r($p_extraBreadcrumbs);  
      249         foreach ($p_extraBreadcrumbs as $text => $link) {  
      250             $breadcrumbs[] = array($text, $link);  
      251         }  
      252     }  
    247 253     $breadcrumbs[] = array($p_title, "");  
    248   //  if (is_array($p_extraBreadcrumbs)) {  
    249   //      //print_r($p_extraBreadcrumbs);  
    250   //      foreach ($p_extraBreadcrumbs as $text => $link) {  
    251   //          $breadcrumbs[] = array($text => $link);  
    252   //      }  
    253   //  }  
    254       echo "<pre>";  
      254     //echo "<pre>";  
    255 255     //print_r($breadcrumbs);  
    256       echo "</pre>";  
      256     //echo "</pre>";  
    256 256     ?>  
    257 257 <HEAD>  
  • trunk/campsite/implementation/management/priv/articles/index.php

    r3947 r3955  
    124 124     <TD ALIGN="LEFT" VALIGN="TOP"><?php  putGS("Name <SMALL>(click to edit)</SMALL>"); ?></TD>  
    125 125     <TD ALIGN="center" VALIGN="TOP"><?php  putGS("Type"); ?></TD>  
    126       <!--<TD ALIGN="center" VALIGN="TOP"><?php  putGS("Language"); ?></TD>-->  
    127 126     <TD ALIGN="center" VALIGN="TOP"><?php  putGS("Status"); ?></TD>  
    128 127     <?php if ($User->hasPermission('Publish')) { ?>  
    194 193         </TD>  
    195 194  
    196           <!--<TD>  
    197               <?php  
    198               p(htmlspecialchars($articleObj->getLanguageName()));  
    199               ?>  
    200           </TD>-->  
    201 195         <TD ALIGN="CENTER">  
    202 196             <?php  
  • trunk/campsite/implementation/management/priv/articles/preview.php

    r3903 r3955  
    50 50         . "&NrArticle=$Article";  
    51 51 } else {  
    52       $url = "/" . $languageObj->getCode() . "/" . $issueObj->getShortName()  
    53           . "/" . $sectionObj->getShortName() . "/" . $articleObj->getShortName();  
      52     $url = "/" . $languageObj->getCode() . "/" . $issueObj->getUrlName()  
      53         . "/" . $sectionObj->getUrlName() . "/" . $articleObj->getUrlName();  
    54 54 }  
    55 55  
  • trunk/campsite/implementation/management/priv/articles/add.php

    r3903 r3955  
    42 42 $topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj,  
    43 43                   'Section' => $sectionObj);  
    44   camp_html_content_top(getGS('Add new article'), $topArray, true, true);  
      44 camp_html_content_top(getGS('Add new article'), $topArray, true, true, array(getGS("Articles") => "/$ADMIN/articles/?Pub=$Pub&Issue=$Issue&Section=$Section&Language=$Language"));  
    44 44  
    45 45 ?>  
  • trunk/campsite/implementation/management/priv/issues/autopublish_do_add.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT']."/classes/common.php");  
    3   load_common_include_files("issues");  
    4   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    5   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    6 3 require_once($_SERVER['DOCUMENT_ROOT'].'/classes/IssuePublish.php');  
    7 4  
  • trunk/campsite/implementation/management/priv/issues/add_article.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/db_connect.php');  
    3   require_once($Campsite['HTML_DIR']."/$ADMIN_DIR/lib_campsite.php");  
    4   $globalfile=selectLanguageFile('globals');  
    5   $localfile=selectLanguageFile("issues");  
    6   @include_once($globalfile);  
    7   @include_once($localfile);  
    8   require_once($Campsite['HTML_DIR'] . "/$ADMIN_DIR/languages.php");  
    9   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    10   ?>  
    11   <?php  
    12   require_once($_SERVER['DOCUMENT_ROOT']."/db_connect.php");  
    13   ?>  
    14    
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    15 3  
    16   <?php  
    17       todefnum('TOL_UserId');  
    18       todefnum('TOL_UserKey');  
    19       query ("SELECT * FROM Users WHERE Id=$TOL_UserId AND KeyId=$TOL_UserKey", 'Usr');  
    20       $access=($NUM_ROWS != 0);  
    21       if ($NUM_ROWS) {  
    22       fetchRow($Usr);  
    23       query ("SELECT * FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'XPerm');  
    24        if ($NUM_ROWS){  
    25           fetchRow($XPerm);  
    26        }  
    27        else $access = 0;                      //added lately; a non-admin can enter the administration area; he exists but doesn't have ANY rights  
    28        $xpermrows= $NUM_ROWS;  
    29       }  
    30       else {  
    31       query ("SELECT * FROM UserPerm WHERE 1=0", 'XPerm');  
    32       }  
    33   ?>  
    34        
      4 // Check permissions  
      5 list($access, $User) = check_basic_access($_REQUEST);  
      6 if (!$access) {  
      7     header("Location: /$ADMIN/logout.php");  
      8     exit;  
      9 }  
    35 10  
      11 if (!$User->hasPermission('AddArticle')) {  
      12     camp_html_display_error(getGS('You do not have the right to add articles.'));  
      13     exit;  
      14 }  
    36 15  
    37       <?php  if ($access) {  
    38       query ("SELECT AddArticle FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'Perm');  
    39        if ($NUM_ROWS) {  
    40           fetchRow($Perm);  
    41           $access = (getVar($Perm,'AddArticle') == "Y");  
    42       }  
    43       else $access = 0;  
    44       } ?>  
    45        
    46      
    47    
    48   <HEAD>  
    49       <LINK rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?>/css/admin_stylesheet.css">  
    50    
    51       <TITLE><?php  putGS("Add new article"); ?></TITLE>  
    52   <?php  if ($access == 0) { ?>   <META HTTP-EQUIV="Refresh" CONTENT="0; URL=/admin/ad.php?ADReason=<?php  print encURL(getGS("You do not have the right to add articles." )); ?>">  
    53   <?php  }  
    54        
    55       query ("SELECT * FROM Issues WHERE 1=0", 'q_iss');  
    56   ?></HEAD>  
    57    
    58   <?php  if ($access) { ?>  
    59      
    60    
    61   <BODY >  
    62    
    63   <?php  todefnum('Pub'); ?><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" WIDTH="100%" class="page_title_container">  
    64       <TR>  
    65           <TD class="page_title">  
    66               <?php  putGS("Add new article"); ?>  
    67           </TD>  
      16 $Pub = Input::Get('Pub', 'int');  
      17 $IssOffs = Input::Get('IssOffs', 'int', 0, true);  
      18 if ($IssOffs < 0) {  
      19     $IssOffs = 0;  
      20 }  
      21 $ItemsPerPage = 10;  
    68 22  
    69       <TD ALIGN=RIGHT><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="0"><TR><TD><A HREF="/admin/pub/add_article.php" class="breadcrumb" ><?php  putGS("Publications");  ?></A></TD>  
    70   </TR></TABLE></TD></TR>  
    71   </TABLE>  
      23 if (!Input::IsValid()) {  
      24     camp_html_display_error(getGS('Invalid Input: $1', Input::GetErrorString()));     
      25     exit;  
      26 }  
      27 $publicationObj =& new Publication($Pub);  
    72 28  
    73   <?php  
    74       query ("SELECT Name FROM Publications WHERE Id=$Pub", 'q_pub');  
    75       if ($NUM_ROWS) {  
    76       fetchRow($q_pub);  
    77   ?><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="1" WIDTH="100%" class="current_location_table"><TR>  
    78   <TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title"> <?php  putGS("Publication"); ?>:</TD><TD VALIGN="TOP" class="current_location_content"><?php  pgetHVar($q_pub,'Name'); ?></TD>  
      29 $issues = Issue::GetIssues($Pub, null, null, null, array('ORDER BY' => array('Number' => 'DESC'), 'LIMIT' => array('START' => $IssOffs, 'MAX_ROWS' => ($ItemsPerPage+1))));  
    79 30  
    80   </TR></TABLE>  
      31 camp_html_content_top(getGS('Add new article'), array('Pub' => $publicationObj));  
    80 31  
      32 ?>  
    81 33 <P>  
    82   <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1"><TR><TD><IMG SRC="/admin/img/tol.gif" BORDER="0"></TD><TD><?php  putGS("Select the issue"); ?></TD></TR></TABLE>  
      34 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">  
      35 <TR>  
      36     <TD><IMG SRC="<?php echo $Campsite['ADMIN_IMAGE_BASE_URL']; ?>/tol.gif" BORDER="0"></TD>  
      37     <TD><?php  putGS("Select the issue"); ?></TD>  
      38 </TR>  
      39 </TABLE>  
    83 40  
    84   <?php  $IssNr= "xxxxxxxxx"; ?><P><?php  
    85       todefnum('IssOffs');  
    86       if ($IssOffs < 0)  
    87       $IssOffs= 0;  
    88           $lpp=10;  
    89        
    90       query ("SELECT Name, IdLanguage, Number, Name, if(Published='Y', PublicationDate, 'No') as Pub FROM Issues  WHERE IdPublication=$Pub ORDER BY Number DESC LIMIT $IssOffs, ".($lpp+1), 'q_iss');  
    91       if ($NUM_ROWS) {  
    92       $nr= $NUM_ROWS;  
    93       $i= $lpp;  
    94                           if($nr < $lpp) $i = $nr;  
    95       $color= 0;  
    96   ?><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="3" class="table_list">  
    97       <TR class="table_list_header">  
    98           <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Nr"); ?></B></TD>  
    99           <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Name"); ?></B></TD>  
    100           <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Language"); ?></B></TD>  
    101           <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Published<BR><SMALL>(yyyy-mm-dd)</SMALL>"); ?></B></TD>  
    102       </TR>  
      41 <P>  
      42 <?php  
      43 if (count($issues) > 0) {  
      44 ?>  
      45 <TABLE BORDER="0" CELLSPACING="1" CELLPADDING="3" class="table_list">  
      46 <TR class="table_list_header">  
      47     <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Nr"); ?></B></TD>  
      48     <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Name"); ?></B></TD>  
      49     <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Published<BR><SMALL>(yyyy-mm-dd)</SMALL>"); ?></B></TD>  
      50 </TR>  
    103 51  
    104 52 <?php  
    105       for($loop=0;$loop<$i;$loop++) {  
    106       fetchRow($q_iss); ?>    <TR <?php  if ($color) { $color=0; ?>class="list_row_even"<?php  } else { $color=1; ?>class="list_row_odd"<?php  } ?>>  
    107           <TD ALIGN="RIGHT">  
    108    <?php  if ($IssNr != getVar($q_iss,'Number')) {  
    109           pgetHVar($q_iss,'Number');  
    110           }  
    111           else {  
    112           p(' ');  
    113           }  
    114       ?>      </TD>  
    115           <TD >  
    116               <A HREF="/admin/sections/add_article.php?Pub=<?php  p($Pub); ?>&Issue=<?php  pgetUVar($q_iss,'Number'); ?>&Language=<?php  pgetUVar($q_iss,'IdLanguage'); ?>"><?php  pgetHVar($q_iss,'Name'); ?></A>  
      53 $color= 0;  
      54 $previousIssueId = -1;  
      55 foreach ($issues as $issue) {  
      56     ?>   
      57     <TR <?php if ($color) { $color=0; ?>class="list_row_even"<?php  } else { $color=1; ?>class="list_row_odd"<?php  } ?>>  
      58         <TD ALIGN="RIGHT" >  
      59             <?php p($issue->getIssueId()); ?>  
      60         </TD>  
      61          
      62         <TD <?php if ($previousIssueId == $issue->getIssueId()) { ?> style="padding-left: 20px;" <?php } ?>>  
      63             <A HREF="/<?php echo $ADMIN; ?>/sections/add_article.php?Pub=<?php  p($Pub); ?>&Issue=<?php  p($issue->getIssueId()); ?>&Language=<?php p($issue->getLanguageId()); ?>"><?php p(htmlspecialchars($issue->getName())); ?></A> (<?php p(htmlspecialchars($issue->getLanguageName())); ?>)  
    117 64         </TD>  
    118           <TD >  
    119    <?php  
    120           query ("SELECT Name FROM Languages WHERE Id=".getSVar($q_iss,'IdLanguage'), 'language');  
    121           $nr2=$NUM_ROWS;  
    122           for($loop2=0;$loop2<$nr2;$loop2++) {  
    123           fetchRow($language);  
    124           pgetHVar($language,'Name');  
    125           }  
    126           ?>      </TD>  
    127           <TD ALIGN="CENTER">  
    128               <?php  pgetHVar($q_iss,'Pub'); ?>  
      65          
      66         <TD ALIGN="CENTER">  
      67             <?php  
      68             if ($issue->getPublished() == 'Y') {  
      69                 p($issue->getPublicationDate());  
      70             }  
      71             else {  
      72                 p('No');  
      73             }  
      74             ?>  
    129 75         </TD>  
    130 76     </TR>  
    131   <?php  
    132       $IssNr=getVar($q_iss,'Number');  
      77     <?php  
      78     $previousIssueId = $issue->getIssueId();  
    133 79 }  
    134   ?>  <TR><TD COLSPAN="2" NOWRAP>  
    135   <?php  if ($IssOffs <= 0) { ?>      << <?php  putGS('Previous'); ?>  
    136   <?php  } else { ?>      <B><A HREF="add_article.php?Pub=<?php  p($Pub); ?>&IssOffs=<?php  p($IssOffs - $lpp); ?>"><< <?php  putGS('Previous'); ?></A></B>  
    137   <?php  }  
    138    
    139       if ($nr < $lpp+1) { ?>       | <?php  putGS('Next'); ?> >>  
    140   <?php  } else { ?>       | <B><A HREF="add_article.php?Pub=<?php  p($Pub); ?>&IssOffs=<?php  p($IssOffs + $lpp); ?>"><?php  putGS('Next'); ?> >></A></B>  
    141   <?php  } ?> </TD></TR>  
      80 ?>   
      81 <TR>  
      82     <TD COLSPAN="2" NOWRAP>  
      83         <?php if ($IssOffs > 0) { ?>  
      84             <B><A HREF="add_article.php?Pub=<?php p($Pub); ?>&IssOffs=<?php  p($IssOffs - $ItemsPerPage); ?>"><< <?php  putGS('Previous'); ?></A></B>  
      85         <?php  }  
      86  
      87         if ($nr >= $ItemsPerPage+1) { ?>  
      88              | <B><A HREF="add_article.php?Pub=<?php  p($Pub); ?>&IssOffs=<?php p($IssOffs + $ItemsPerPage); ?>"><?php  putGS('Next'); ?> >></A></B>  
      89         <?php  } ?>  
      90     </TD>  
      91 </TR>  
    142 92 </TABLE>  
    143 93 <?php  } else { ?><BLOCKQUOTE>  
    146 96 </BLOCKQUOTE>  
    147 97 <?php  } ?>  
    148   <?php  } else { ?><BLOCKQUOTE>  
    149       <LI><?php  putGS('Publication does not exist.'); ?></LI>  
    150   </BLOCKQUOTE>  
    151   <?php  } ?>  
    152   <?php camp_html_copyright_notice(); ?>  
    153   </BODY>  
    154   <?php  } ?>  
    155    
    156   </HTML>  
      98 <?php camp_html_copyright_notice(); ?>  
  • trunk/campsite/implementation/management/priv/issues/translate.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/common.php');  
    3   load_common_include_files("issues");  
    4   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    5   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
    6   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Publication.php');  
    7   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Issue.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    8 3  
    9 4 // Check permissions  
    71 66     <TD ALIGN="RIGHT" ><?php  putGS("URL Name"); ?>:</TD>  
    72 67     <TD>  
    73       <INPUT TYPE="TEXT" class="input_text" NAME="cShortName" size="32" maxlength="64" value="<?php echo htmlspecialchars($issueObj->getShortName()); ?>">  
      68     <INPUT TYPE="TEXT" class="input_text" NAME="cShortName" size="32" maxlength="64" value="<?php echo htmlspecialchars($issueObj->getUrlName()); ?>">  
    73 68     </TD>  
    74 69 </TR>  
  • trunk/campsite/implementation/management/priv/issues/autopublish.php

    r3953 r3955  
    1 1 <?php  
    2    
    3   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/common.php');  
    4   load_common_include_files("issues");  
    5   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    6   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
    7   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Publication.php');  
    8   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Issue.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    9 3 require_once($_SERVER['DOCUMENT_ROOT'].'/classes/IssuePublish.php');  
    10 4  
  • trunk/campsite/implementation/management/priv/issues/add_new.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/db_connect.php');  
    3   require_once($Campsite['HTML_DIR']."/$ADMIN_DIR/lib_campsite.php");  
    4   $globalfile=selectLanguageFile('globals');  
    5   $localfile=selectLanguageFile("issues");  
    6   @include_once($globalfile);  
    7   @include_once($localfile);  
    8   require_once($Campsite['HTML_DIR'] . "/$ADMIN_DIR/languages.php");  
    9   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    10   ?>  
    11   <?php  
    12   require_once($_SERVER['DOCUMENT_ROOT']."/db_connect.php");  
    13   ?>  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    14 3  
      4 // Check permissions  
      5 list($access, $User) = check_basic_access($_REQUEST);  
      6 if (!$access) {  
      7     header("Location: /$ADMIN/logout.php");  
      8     exit;  
      9 }  
      10  
      11 if (!$User->hasPermission('ManageIssue')) {  
      12     camp_html_display_error(getGS('You do not have the right to add issues.'));  
      13     exit;  
      14 }  
      15  
      16 $Pub = Input::Get('Pub', 'int');  
      17 if (!Input::IsValid()) {  
      18     camp_html_display_error(getGS('Invalid Input: $1', Input::GetErrorString()));     
      19     exit;  
      20 }  
      21 $publicationObj =& new Publication($Pub);  
      22 $allLanguages =& Language::GetAllLanguages();  
      23 $newIssueId = Issue::GetUnusedIssueId($Pub);  
    15 24  
    16   <?php  
    17       todefnum('TOL_UserId');  
    18       todefnum('TOL_UserKey');  
    19       query ("SELECT * FROM Users WHERE Id=$TOL_UserId AND KeyId=$TOL_UserKey", 'Usr');  
    20       $access=($NUM_ROWS != 0);  
    21       if ($NUM_ROWS) {  
    22       fetchRow($Usr);  
    23       query ("SELECT * FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'XPerm');  
    24        if ($NUM_ROWS){  
    25           fetchRow($XPerm);  
    26        }  
    27        else $access = 0;                      //added lately; a non-admin can enter the administration area; he exists but doesn't have ANY rights  
    28        $xpermrows= $NUM_ROWS;  
    29       }  
    30       else {  
    31       query ("SELECT * FROM UserPerm WHERE 1=0", 'XPerm');  
    32       }  
      25 camp_html_content_top(getGS('Add new issue'), array('Pub' => $publicationObj), true, false, array(getGS("Issues") => "/$ADMIN/issues/?Pub=$Pub"));  
    33 26 ?>  
    34        
    35    
    36    
    37       <?php  if ($access) {  
    38       query ("SELECT ManageIssue FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'Perm');  
    39        if ($NUM_ROWS) {  
    40           fetchRow($Perm);  
    41           $access = (getVar($Perm,'ManageIssue') == "Y");  
    42       }  
    43       else $access = 0;  
    44       } ?>  
    45        
    46      
    47    
    48   <HEAD>  
    49       <LINK rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?>/css/admin_stylesheet.css">  
    50    
    51       <TITLE><?php  putGS("Add new issue"); ?></TITLE>  
    52   <?php  if ($access == 0) { ?>   <META HTTP-EQUIV="Refresh" CONTENT="0; URL=/admin/ad.php?ADReason=<?php  print encURL(getGS("You do not have the right to add issues." )); ?>">  
    53   <?php  } ?></HEAD>  
    54    
    55   <?php  if ($access) { ?>  
    56      
    57    
    58   <BODY >  
    59    
    60   <?php  todefnum('Pub'); ?><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" WIDTH="100%" class="page_title_container">  
    61       <TR>  
    62           <TD class="page_title">  
    63               <?php  putGS("Add new issue"); ?>  
    64           </TD>  
    65    
    66       <TD ALIGN=RIGHT><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="0"><TR><TD><A HREF="/admin/issues/?Pub=<?php  pencURL($Pub); ?>" class="breadcrumb" ><?php  putGS("Issues");  ?></A></TD>  
    67   <td class="breadcrumb_separator"> </td>  
    68   <TD><A HREF="/admin/pub/" class="breadcrumb" ><?php  putGS("Publications");  ?></A></TD>  
    69   </TR></TABLE></TD></TR>  
    70   </TABLE>  
    71 27  
    72   <?php  
    73       query ("SELECT Name FROM Publications WHERE Id=$Pub", 'publ');  
    74       if ($NUM_ROWS) {  
    75       fetchRow($publ);  
    76   ?><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="1" WIDTH="100%" class="current_location_table"><TR>  
    77   <TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title"> <?php  putGS("Publication"); ?>:</TD><TD VALIGN="TOP" class="current_location_content"><?php  pgetHVar($publ,'Name'); ?></TD>  
    78    
    79   </TR></TABLE>  
    80    
    81   <?php  
    82       query("SELECT IdDefaultLanguage as IdLang FROM Publications WHERE Id=$Pub", 'q_lang');  
    83       fetchRow($q_lang);  
    84       $IdLang = getVar($q_lang,'IdLang');  
    85    
    86       query ("SELECT Id, OrigName FROM Languages ORDER BY Name", 'q_lang');  
    87       $rownr=$NUM_ROWS;  
    88       query ("SELECT MAX(Number) + 1 FROM Issues WHERE IdPublication=$Pub", 'q_nr');  
    89       fetchRowNum($q_nr);  
    90       if (getNumVar($q_nr,0) == "")  
    91           $nr= 1;  
    92       else  
    93           $nr=getNumVar($q_nr,0);  
    94   ?><P>  
    95   <FORM NAME="dialog" METHOD="POST" ACTION="do_add_new.php"  >  
      28 <P>  
      29 <FORM NAME="dialog" METHOD="POST" ACTION="do_add_new.php">  
    96 30 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" CLASS="table_input">  
    97       <TR>  
    98           <TD COLSPAN="2">  
    99               <B><?php  putGS("Add new issue"); ?></B>  
    100               <HR NOSHADE SIZE="1" COLOR="BLACK">  
    101           </TD>  
    102       </TR>  
    103       <TR>  
    104           <TD ALIGN="RIGHT" ><?php  putGS("Name"); ?>:</TD>  
    105           <TD>  
    106           <INPUT TYPE="TEXT" class="input_text" NAME="cName" SIZE="32" MAXLENGTH="64">  
    107           </TD>  
    108       </TR>  
    109       <TR>  
    110           <TD ALIGN="RIGHT" ><?php  putGS("Language"); ?>:</TD>  
    111           <TD>  
    112           <SELECT NAME="cLang" class="input_select"><?php  
    113       for($loop=0;$loop<$rownr;$loop++) {  
    114       fetchRow($q_lang);  
    115       pcomboVar(getHVar($q_lang,'Id'), $IdLang, getHVar($q_lang,'OrigName'));  
    116       }  
    117   ?>  
    118           </SELECT>  
    119           </TD>  
    120       </TR>  
    121       <TR>  
    122           <TD ALIGN="RIGHT" ><?php  putGS("Number"); ?>:</TD>  
    123           <TD>  
    124           <INPUT TYPE="TEXT" class="input_text" NAME="cNumber" VALUE="<?php  pencHTML($nr); ?>" SIZE="5" MAXLENGTH="5">  
    125           </TD>  
    126       </TR>  
    127       <TR>  
    128           <TD ALIGN="RIGHT" ><?php  putGS("URL Name"); ?>:</TD>  
    129           <TD>  
    130           <INPUT TYPE="TEXT" class="input_text" NAME="cShortName" SIZE="32" MAXLENGTH="32" value="<?php  pgetHVar($publ,'ShortName'); ?>">  
    131           </TD>  
    132       </TR>  
    133       <TR>  
    134           <TD COLSPAN="2">  
    135           <DIV ALIGN="CENTER">  
    136           <INPUT TYPE="HIDDEN" NAME="cPub" VALUE="<?php  pencHTML($Pub); ?>">  
    137           <INPUT TYPE="submit" class="button" NAME="Save" VALUE="<?php  putGS('Save changes'); ?>">  
    138           <INPUT TYPE="button" class="button" NAME="Cancel" VALUE="<?php  putGS('Cancel'); ?>" ONCLICK="location.href='/admin/issues/?Pub=<?php  pencURL($Pub); ?>'">  
    139           </DIV>  
    140           </TD>  
    141       </TR>  
    142   </TABLE></CENTER>  
      31 <TR>  
      32     <TD COLSPAN="2">  
      33         <B><?php  putGS("Add new issue"); ?></B>  
      34         <HR NOSHADE SIZE="1" COLOR="BLACK">  
      35     </TD>  
      36 </TR>  
      37 <TR>  
      38     <TD ALIGN="RIGHT" ><?php  putGS("Name"); ?>:</TD>  
      39     <TD>  
      40     <INPUT TYPE="TEXT" class="input_text" NAME="cName" SIZE="32" MAXLENGTH="64">  
      41     </TD>  
      42 </TR>  
      43 <TR>  
      44     <TD ALIGN="RIGHT" ><?php  putGS("Language"); ?>:</TD>  
      45     <TD>  
      46     <SELECT NAME="cLang" class="input_select">  
      47        <?php  
      48             foreach ($allLanguages as $language) {  
      49                 pcomboVar($language->getLanguageId(), $publicationObj->getLanguageId(), $language->getNativeName());  
      50             }  
      51         ?>  
      52     </SELECT>  
      53     </TD>  
      54 </TR>  
      55 <TR>  
      56     <TD ALIGN="RIGHT" ><?php  putGS("Number"); ?>:</TD>  
      57     <TD>  
      58     <INPUT TYPE="TEXT" class="input_text" NAME="cNumber" VALUE="<?php p($newIssueId); ?>" SIZE="5" MAXLENGTH="5">  
      59     </TD>  
      60 </TR>  
      61 <TR>  
      62     <TD ALIGN="RIGHT" ><?php  putGS("URL Name"); ?>:</TD>  
      63     <TD>  
      64     <INPUT TYPE="TEXT" class="input_text" NAME="cShortName" SIZE="32" MAXLENGTH="32" value="">  
      65     </TD>  
      66 </TR>  
      67 <TR>  
      68     <TD COLSPAN="2">  
      69     <DIV ALIGN="CENTER">  
      70     <INPUT TYPE="HIDDEN" NAME="Pub" VALUE="<?php p($Pub); ?>">  
      71     <INPUT TYPE="submit" class="button" NAME="Save" VALUE="<?php  putGS('Save changes'); ?>">  
      72     <INPUT TYPE="button" class="button" NAME="Cancel" VALUE="<?php  putGS('Cancel'); ?>" ONCLICK="location.href='/<?php p($ADMIN); ?>/issues/?Pub=<?php p($Pub); ?>'">  
      73     </DIV>  
      74     </TD>  
      75 </TR>  
      76 </TABLE>  
    143 77 </FORM>  
    144 78 <P>  
    145 79  
    146   <?php  } else { ?><BLOCKQUOTE>  
    147       <LI><?php  putGS('Publication does not exist.'); ?></LI>  
    148   </BLOCKQUOTE>  
    149   <?php  } ?>  
    150   <?php camp_html_copyright_notice(); ?>  
    151   </BODY>  
    152   <?php  } ?>  
    153    
    154   </HTML>  
      80 <?php camp_html_copyright_notice(); ?>  
  • trunk/campsite/implementation/management/priv/issues/do_status.php

    r3953 r3955  
    1 1 <?php  
    2    
    3   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/common.php');  
    4   load_common_include_files("issues");  
    5   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    6   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
    7   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Log.php');  
    8   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Publication.php');  
    9   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Issue.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    10 3  
    11 4 // Check permissions  
    49 42 header("Location: /$ADMIN/issues/?Pub=" . $publicationObj->getPublicationId());  
    50 43  
    51   ?> ?>  
      44 ?> ?>  
  • trunk/campsite/implementation/management/priv/issues/do_add_prev.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/db_connect.php');  
    3   require_once($Campsite['HTML_DIR']."/$ADMIN_DIR/lib_campsite.php");  
    4   $globalfile=selectLanguageFile('globals');  
    5   $localfile=selectLanguageFile("issues");  
    6   @include_once($globalfile);  
    7   @include_once($localfile);  
    8   require_once($Campsite['HTML_DIR'] . "/$ADMIN_DIR/languages.php");  
    9   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    10   ?>  
    11   <?php  
    12   require_once($_SERVER['DOCUMENT_ROOT']."/db_connect.php");  
    13   ?>  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    14 3  
      4 // Check permissions  
      5 list($access, $User) = check_basic_access($_REQUEST);  
      6 if (!$access) {  
      7     header("Location: /$ADMIN/logout.php");  
      8     exit;  
      9 }  
    15 10  
    16   <?php  
    17       todefnum('TOL_UserId');  
    18       todefnum('TOL_UserKey');  
    19       query ("SELECT * FROM Users WHERE Id=$TOL_UserId AND KeyId=$TOL_UserKey", 'Usr');  
    20       $access=($NUM_ROWS != 0);  
    21       if ($NUM_ROWS) {  
    22       fetchRow($Usr);  
    23       query ("SELECT * FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'XPerm');  
    24        if ($NUM_ROWS){  
    25           fetchRow($XPerm);  
    26        }  
    27        else $access = 0;                      //added lately; a non-admin can enter the administration area; he exists but doesn't have ANY rights  
    28        $xpermrows= $NUM_ROWS;  
    29       }  
    30       else {  
    31       query ("SELECT * FROM UserPerm WHERE 1=0", 'XPerm');  
    32       }  
    33   ?>  
    34        
      11 if (!$User->hasPermission('ManageIssue')) {  
      12     camp_html_display_error(getGS('You do not have the right to add issues.'));  
      13     exit;  
      14 }  
    35 15  
      16 $Pub = Input::Get('Pub', 'int');  
      17 $cNumber = trim(Input::Get('cNumber', 'int'));  
    36 18  
    37       <?php  if ($access) {  
    38       query ("SELECT ManageIssue FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'Perm');  
    39        if ($NUM_ROWS) {  
    40           fetchRow($Perm);  
    41           $access = (getVar($Perm,'ManageIssue') == "Y");  
    42       }  
    43       else $access = 0;  
    44       } ?>  
    45        
    46      
    47    
    48   <HEAD>  
    49       <LINK rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?>/css/admin_stylesheet.css">  
    50    
    51       <TITLE><?php  putGS("Copying previous issue"); ?></TITLE>  
    52   <?php  if ($access == 0) { ?>   <META HTTP-EQUIV="Refresh" CONTENT="0; URL=/admin/ad.php?ADReason=<?php  print encURL(getGS("You do not have the right to add issues." )); ?>">  
    53   <?php  }  
    54       query ("SELECT * FROM Issues WHERE 1=0", 'q_iss');  
    55       query ("SELECT * FROM Sections WHERE 1=0", 'q_sect');  
    56   ?></HEAD>  
    57    
    58   <?php  if ($access) { ?>  
    59      
    60    
    61   <BODY >  
    62    
    63   <?php  
    64       todefnum('cOldNumber');  
    65       todefnum('cNumber');  
    66       todefnum('cPub');  
    67   ?><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" WIDTH="100%" class="page_title_container">  
    68       <TR>  
    69           <TD class="page_title">  
    70               <?php  putGS("Copying previous issue"); ?>  
    71           </TD>  
    72    
    73       <TD ALIGN=RIGHT><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="0"><TR><TD><A HREF="/admin/issues/?Pub=<?php  pencURL($cPub); ?>" class="breadcrumb" ><?php  putGS("Issues");  ?></A></TD>  
    74   <td class="breadcrumb_separator"> </td>  
    75   <TD><A HREF="/admin/pub/" class="breadcrumb" ><?php  putGS("Publications");  ?></A></TD>  
    76   </TR></TABLE></TD></TR>  
    77   </TABLE>  
      19 $correct = true;  
      20 $created = false;  
      21 $errorMsgs = array();  
      22 if ($cNumber == "") {  
      23     $correct = false;  
      24     $errorMsgs[] = getGS('You must complete the $1 field.','<B>'.getGS('Number').'</B>');  
      25 }  
    78 26  
    79   <?php  
    80       query ("SELECT Name FROM Publications WHERE Id=$cPub", 'publ');  
    81       if ($NUM_ROWS) {  
    82       fetchRow($publ);  
    83   ?><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="1" WIDTH="100%" class="current_location_table"><TR>  
    84   <TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title"> <?php  putGS("Publication"); ?>:</TD><TD VALIGN="TOP" class="current_location_content"><?php  pgetHVar($publ,'Name'); ?></TD>  
      27 if (!Input::IsValid()) {  
      28     $correct = false;  
      29     $errorMsgs[] = getGS('Invalid Input: $1', Input::GetErrorString());  
      30 }  
    85 31  
    86   </TR></TABLE>  
      32 $publicationObj =& new Publication($Pub);  
    86 32  
    87   <P>  
    88   <CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box" ALIGN="CENTER">  
    89       <TR>  
    90           <TD COLSPAN="2">  
    91               <B> <?php  putGS("Copying previous issue"); ?> </B>  
    92               <HR NOSHADE SIZE="1" COLOR="BLACK">  
    93           </TD>  
    94       </TR>  
    95       <TR>  
    96           <TD COLSPAN="2"><BLOCKQUOTE>  
    97   <?php  
    98   query ("SELECT * FROM Issues WHERE IdPublication=$cPub AND Number=$cOldNumber", 'q_iss');  
    99   //copy the whole structure; translated issues may exists  
    100   $nr=$NUM_ROWS;  
    101   for($loop=0;$loop<$nr;$loop++) {  
    102       fetchRow($q_iss);  
    103       $idlang=getVar($q_iss,'IdLanguage');  
    104    
    105       $sql = "INSERT INTO Issues SET IdPublication=$cPub, Number=$cNumber, IdLanguage=$idlang, Name='" . getSVar($q_iss,'Name') . "', ShortName = '" . $cNumber . "'";  
    106       $issueTplId = getSVar($q_iss,'IssueTplId');  
    107       if ($issueTplId > 0)  
    108           $sql .= ", IssueTplId=$issueTplId";  
    109       $sectionTplId = getSVar($q_iss,'SectionTplId');  
    110       if ($sectionTplId > 0)  
    111           $sql .= ", SectionTplId=$sectionTplId";  
    112       $articleTplId = getSVar($q_iss,'ArticleTplId');  
    113       if ($articleTplId > 0)  
    114           $sql .= ", ArticleTplId=$articleTplId";  
    115       query($sql);  
    116       query ("SELECT * FROM Sections WHERE IdPublication=$cPub AND NrIssue=$cOldNumber AND IdLanguage=$idlang", 'q_sect');  
    117       $nr2=$NUM_ROWS;  
    118       for($loop2=0;$loop2<$nr2;$loop2++) {  
    119           fetchRow($q_sect);  
    120           $sql = "INSERT INTO Sections SET IdPublication=$cPub, NrIssue=$cNumber, IdLanguage=$idlang, Number=".getSVar($q_sect,'Number').", Name='".getSVar($q_sect,'Name')."', ShortName='".getSVar($q_sect,'Number') . "'";  
    121           $sectionTplId = getSVar($q_sect,'SectionTplId');  
    122           if ($sectionTplId > 0)  
    123               $sql .= ", SectionTplId=$sectionTplId";  
    124           $articleTplId = getSVar($q_sect,'ArticleTplId');  
    125           if ($articleTplId > 0)  
    126               $sql .= ", ArticleTplId=$articleTplId";  
    127           query($sql);  
    128       }  
      33 if ($correct) {  
      34     $lastIssue =& Issue::GetLastCreatedIssue($Pub);  
      35     $lastIssue->copy(null, $cNumber);  
      36     $logtext = getGS('New issue $1 from $2 in publication $3', $cNumber, $lastIssue->getIssueId(), $publicationObj->getName());  
      37     Log::Message($logtext, $User->getUserName(), 11);  
      38     header("Location: /$ADMIN/issues/?Pub=$Pub");  
      39     exit;  
    129 40 }  
    130   ?>  <?php  $logtext = getGS('New issue $1 from $2 in publication $3', $cNumber, $cOldNumber, getSVar($publ,'Name')); query ("INSERT INTO Log SET TStamp=NOW(), IdEvent=11, User='".getVar($Usr,'UName')."', Text='$logtext'"); ?>  
    131       <LI><?php  putGS('Copying done.'); ?></LI>  
    132       </BLOCKQUOTE></TD>  
    133       </TR>  
    134       <TR>  
    135           <TD COLSPAN="2">  
    136           <DIV ALIGN="CENTER">  
    137           <INPUT TYPE="button" class="button" NAME="Done" VALUE="<?php  putGS('Done'); ?>" ONCLICK="location.href='/admin/issues/?Pub=<?php  pencURL($cPub); ?>'">  
    138           </DIV>  
    139           </TD>  
    140       </TR>  
    141   </TABLE></CENTER>  
    142   <P>  
    143   <?php  } else { ?><BLOCKQUOTE>  
    144       <LI><?php  putGS('Publication does not exist.'); ?></LI>  
    145   </BLOCKQUOTE>  
    146   <?php  } ?>  
    147   <?php camp_html_copyright_notice(); ?>  
    148   </BODY>  
    149   <?php  } ?>  
    150 41  
    151   </HTML>  
      42 camp_html_content_top(getGS('Copying previous issue'), array('Pub' => $publicationObj), true, false, array(getGS("Issues") => "/$ADMIN/issues/?Pub=$Pub"));  
      43  
      44 ?>  
      45  
      46 <P>  
      47 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">  
      48 <TR>  
      49     <TD COLSPAN="2">  
      50         <B> <?php  putGS("Copying previous issue"); ?> </B>  
      51         <HR NOSHADE SIZE="1" COLOR="BLACK">  
      52     </TD>  
      53 </TR>  
      54 <TR>  
      55     <TD COLSPAN="2">  
      56         <BLOCKQUOTE>  
      57         <?php  
      58         foreach ($errorMsgs as $errorMsg) { ?>  
      59            <LI><?php echo $errorMsg; ?></LI>  
      60            <?PHP  
      61         }  
      62         ?>  
      63         </BLOCKQUOTE>  
      64     </TD>  
      65 </TR>  
      66 <TR>  
      67     <TD COLSPAN="2">  
      68     <DIV ALIGN="CENTER">  
      69     <INPUT TYPE="button" class="button" NAME="Ok" VALUE="<?php  putGS('Ok'); ?>" ONCLICK="location.href='/<?php p($ADMIN); ?>/issues/?Pub=<?php  p($Pub); ?>'">  
      70     </DIV>  
      71     </TD>  
      72 </TR>  
      73 </TABLE>  
      74 <P>  
      75 <?php camp_html_copyright_notice(); ?>  
  • trunk/campsite/implementation/management/priv/issues/index.php

    r3953 r3955  
    1 1 <?php  
    2    
    3   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/common.php');  
    4   load_common_include_files("issues");  
    5   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    6   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
    7   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Publication.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    8 3 require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Issue.php');  
    9 4  
     
    38 33         <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">  
    39 34         <TR>  
    40               <TD><A HREF="add_new.php?Pub=<?php pencURL($Pub); ?>" ><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/add.png" BORDER="0"></A></TD>  
    41               <TD><A HREF="add_new.php?Pub=<?php  pencURL($Pub); ?>" ><B><?php  putGS("Add new issue"); ?></B></A></TD>  
      35             <TD><A HREF="add_new.php?Pub=<?php p($Pub); ?>"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/add.png" BORDER="0"></A></TD>  
      36             <TD><A HREF="add_new.php?Pub=<?php p($Pub); ?>"><B><?php  putGS("Add new issue"); ?></B></A></TD>  
    42 37         </TR>  
    43 38         </TABLE>  
     
    46 41         <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">  
    47 42         <TR>  
    48               <TD><A HREF="qadd.php?Pub=<?php  pencURL($Pub); ?>" ><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/add.png" BORDER="0"></A></TD>  
    49               <TD><A HREF="qadd.php?Pub=<?php  pencURL($Pub); ?>" ><B><?php  putGS("Add new issue"); ?></B></A></TD>  
      43             <TD><A HREF="qadd.php?Pub=<?php p($Pub); ?>"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/add.png" BORDER="0"></A></TD>  
      44             <TD><A HREF="qadd.php?Pub=<?php p($Pub); ?>"><B><?php  putGS("Add new issue"); ?></B></A></TD>  
    50 45         </TR>  
    51 46         </TABLE>  
     
    63 58         <TD ALIGN="LEFT" VALIGN="TOP"  ><B><?php  putGS("Name<BR><SMALL>(click to see sections)</SMALL>"); ?></B></TD>  
    64 59         <TD ALIGN="LEFT" VALIGN="TOP"  ><B><?php  putGS("URL Name"); ?></B></TD>  
    65           <!--<TD ALIGN="LEFT" VALIGN="TOP"  ><B><?php  putGS("Language"); ?></B></TD>-->  
    66 60         <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Published<BR><SMALL>(yyyy-mm-dd)</SMALL>"); ?></B></TD>  
    67 61     <?php if ($User->hasPermission('Publish')) { ?>  
     
    74 68         <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Nr"); ?></B></TD>  
    75 69         <TD ALIGN="LEFT" VALIGN="TOP"  ><B><?php  putGS("Name<BR><SMALL>(click to see sections)</SMALL>"); ?></B></TD>  
    76           <!--<TD ALIGN="LEFT" VALIGN="TOP"  ><B><?php  putGS("Language"); ?></B></TD>-->  
    77 70         <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Published<BR><SMALL>(yyyy-mm-dd)</SMALL>"); ?></B></TD>  
    78 71         <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Preview"); ?></B></TD>  
     
    92 85     <?php  if ($User->hasPermission('ManageIssue')) { ?>  
    93 86     <TD ALIGN="RIGHT">  
    94           <?php   
    95           if ($currentIssue != $issue->getIssueId()) {  
    96                p($issue->getIssueId());  
    97           }  
    98           else {  
    99               print ' ';       
    100           }  
    101           ?>  
      87         <?php p($issue->getIssueId()); ?>  
    102 88     </TD>  
    103 89      
    107 93      
    108 94     <TD>  
    109           <?php p(htmlspecialchars($issue->getShortName())); ?>  
      95         <?php p(htmlspecialchars($issue->getUrlName())); ?>  
    109 95     </TD>  
    110 96      
    111   <!--    <TD >  
    112           <?php p(htmlspecialchars($issue->getLanguageName())); ?>  
    113       </TD>  
    114   --> <TD ALIGN="CENTER">  
      97     <TD ALIGN="CENTER">  
    115 98         <A HREF="/<?php echo $ADMIN; ?>/issues/status.php?Pub=<?php p($Pub); ?>&Issue=<?php  p($issue->getIssueId()); ?>&Language=<?php p($issue->getLanguageId()); ?>"><?php  if ($issue->getPublished() == 'Y') { p(htmlspecialchars($issue->getPublicationDate())); } else { print putGS("Publish"); } ?></A>  
    116 99     </TD>  
  • trunk/campsite/implementation/management/priv/issues/do_edit.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/common.php');  
    3   load_common_include_files("issues");  
    4   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    5   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    6 3 require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Template.php');  
    7   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Log.php');  
    8   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Publication.php');  
    9   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Issue.php');  
    10 4  
    11 5 // Check permissions  
  • trunk/campsite/implementation/management/priv/issues/qadd.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/db_connect.php');  
    3   require_once($Campsite['HTML_DIR']."/$ADMIN_DIR/lib_campsite.php");  
    4   $globalfile=selectLanguageFile('globals');  
    5   $localfile=selectLanguageFile("issues");  
    6   @include_once($globalfile);  
    7   @include_once($localfile);  
    8   require_once($Campsite['HTML_DIR'] . "/$ADMIN_DIR/languages.php");  
    9   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    10   ?>  
    11   <?php  
    12   require_once($_SERVER['DOCUMENT_ROOT']."/db_connect.php");  
    13   ?>  
    14    
    15    
    16   <?php  
    17       todefnum('TOL_UserId');  
    18       todefnum('TOL_UserKey');  
    19       query ("SELECT * FROM Users WHERE Id=$TOL_UserId AND KeyId=$TOL_UserKey", 'Usr');  
    20       $access=($NUM_ROWS != 0);  
    21       if ($NUM_ROWS) {  
    22       fetchRow($Usr);  
    23       query ("SELECT * FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'XPerm');  
    24        if ($NUM_ROWS){  
    25           fetchRow($XPerm);  
    26        }  
    27        else $access = 0;                      //added lately; a non-admin can enter the administration area; he exists but doesn't have ANY rights  
    28        $xpermrows= $NUM_ROWS;  
    29       }  
    30       else {  
    31       query ("SELECT * FROM UserPerm WHERE 1=0", 'XPerm');  
    32       }  
    33   ?>  
    34        
    35    
    36    
    37       <?php  if ($access) {  
    38       query ("SELECT ManageIssue FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'Perm');  
    39        if ($NUM_ROWS) {  
    40           fetchRow($Perm);  
    41           $access = (getVar($Perm,'ManageIssue') == "Y");  
    42       }  
    43       else $access = 0;  
    44       } ?>  
    45        
    46      
    47    
    48   <HEAD>  
    49       <LINK rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?>/css/admin_stylesheet.css">  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    50 3  
    51       <TITLE><?php  putGS("Add new issue"); ?></TITLE>  
    52   <?php  if ($access == 0) { ?>   <META HTTP-EQUIV="Refresh" CONTENT="0; URL=/admin/ad.php?ADReason=<?php  print encURL(getGS("You do not have the right to add issues." )); ?>">  
    53   <?php  } ?></HEAD>  
      4 // Check permissions  
      5 list($access, $User) = check_basic_access($_REQUEST);  
      6 if (!$access) {  
      7     header("Location: /$ADMIN/logout.php");  
      8     exit;  
      9 }  
      10  
      11 if (!$User->hasPermission('ManageIssue')) {  
      12     camp_html_display_error(getGS('You do not have the right to add issues.'));  
      13     exit;  
      14 }  
      15  
      16 $Pub = Input::Get('Pub', 'int');  
      17 if (!Input::IsValid()) {  
      18     camp_html_display_error(getGS('Invalid Input: $1', Input::GetErrorString()));     
      19     exit;  
      20 }  
      21 $publicationObj =& new Publication($Pub);  
      22 $allLanguages =& Language::GetAllLanguages();  
      23 $newIssueId = Issue::GetUnusedIssueId($Pub);  
    54 24  
    55   <?php  if ($access) { ?>  
    56      
    57    
    58   <BODY >  
    59    
    60   <?php  
    61       todefnum('Pub');  
    62   ?><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" WIDTH="100%" class="page_title_container">  
    63       <TR>  
    64           <TD class="page_title">  
    65               <?php  putGS("Add new issue"); ?>  
    66           </TD>  
    67    
    68       <TD ALIGN=RIGHT><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="0"><TR><TD><A HREF="/admin/issues/?Pub=<?php  pencURL($Pub); ?>" class="breadcrumb" ><?php  putGS("Issues");  ?></A></TD>  
    69   <td class="breadcrumb_separator"> </td>  
    70   <TD><A HREF="/admin/pub/" class="breadcrumb" ><?php  putGS("Publications");  ?></A></TD>  
    71   </TR></TABLE></TD></TR>  
    72   </TABLE>  
    73    
    74   <?php  
    75       query ("SELECT Name FROM Publications WHERE Id=$Pub", 'publ');  
    76       if ($NUM_ROWS) {  
    77       fetchRow($publ);  
    78   ?><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="1" WIDTH="100%" class="current_location_table"><TR>  
    79   <TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title"> <?php  putGS("Publication"); ?>:</TD><TD VALIGN="TOP" class="current_location_content"><?php  getHVar($publ,'Name'); ?></TD>  
    80    
    81   </TR></TABLE>  
      25 camp_html_content_top(getGS('Add new issue'), array('Pub' => $publicationObj), true, false, array(getGS("Issues") => "/$ADMIN/issues/?Pub=$Pub"));  
    82 26  
      27 ?>  
    83 28 <P>  
    84 29 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="2" ALIGN="CENTER" class="table_input">  
    85       <TR>  
    86           <TD WIDTH="1%" VALIGN="TOP"><A HREF="add_prev.php?Pub=<?php  pencURL($Pub); ?>"><IMG SRC="/admin/img/tol.gif" BORDER="0"></A></TD><TD WIDTH="99%"><B><A HREF="add_prev.php?Pub=<?php  pencURL($Pub); ?>"><?php  putGS('Use the structure of the previous issue'); ?></A></B></TD>  
    87       </TR>  
    88       <TR>  
    89           <TD></TD><TD VALIGN="TOP">  
    90               <LI><?php  putGS('Copy the entire structure in all languages from the previous issue except for content.'); ?><LI><?php  putGS('You may modify it later if you wish.'); ?></LI>  
    91           </TD>  
    92       <TR>  
    93       <TR>  
    94           <TD WIDTH="1%" VALIGN="TOP"><A HREF="add_new.php?Pub=<?php  pencURL($Pub); ?>"><IMG SRC="/admin/img/tol.gif" BORDER="0"></A></TD><TD WIDTH="99%"><B><A HREF="add_new.php?Pub=<?php  pencURL($Pub); ?>"><?php  putGS('Create a new structure'); ?></A></B></TD>  
    95       </TR>  
    96       <TR>  
    97           <TD></TD><TD VALIGN="TOP">  
    98               <LI><?php  putGS('Create a complete new structure.'); ?><LI><?php  putGS('You must define an issue type for each language and then sections for them.'); ?></LI>  
    99           </TD>  
    100       <TR>  
      30 <TR>  
      31     <TD VALIGN="TOP"><A HREF="add_prev.php?Pub=<?php p($Pub); ?>"><IMG SRC="<?php echo $Campsite['ADMIN_IMAGE_BASE_URL']; ?>/tol.gif" BORDER="0"></A></TD>  
      32     <TD><B><A HREF="add_prev.php?Pub=<?php p($Pub); ?>"><?php  putGS('Use the structure of the previous issue'); ?></A></B></TD>  
      33 </TR>  
      34 <TR>  
      35     <TD></TD>  
      36     <TD VALIGN="TOP">  
      37         <LI><?php  putGS('Copy the entire structure in all languages from the previous issue except for content.'); ?><LI><?php  putGS('You may modify it later if you wish.'); ?></LI>  
      38     </TD>  
      39 <TR>  
      40 <TR>  
      41     <TD VALIGN="TOP"><A HREF="add_new.php?Pub=<?php  pencURL($Pub); ?>"><IMG SRC="<?php echo $Campsite['ADMIN_IMAGE_BASE_URL']; ?>/tol.gif" BORDER="0"></A></TD>  
      42     <TD><B><A HREF="add_new.php?Pub=<?php  pencURL($Pub); ?>"><?php  putGS('Create a new structure'); ?></A></B></TD>  
      43 </TR>  
      44 <TR>  
      45     <TD></TD>  
      46     <TD VALIGN="TOP">  
      47         <LI><?php  putGS('Create a complete new structure.'); ?><LI><?php  putGS('You must define an issue type for each language and then sections for them.'); ?></LI>  
      48     </TD>  
      49 <TR>  
    101 50 </TABLE>  
    102 51 <P>  
    103   <?php  } else { ?><BLOCKQUOTE>  
    104       <LI><?php  putGS('Publication does not exist.'); ?></LI>  
    105   </BLOCKQUOTE>  
    106   <?php  } ?>  
    107   <?php camp_html_copyright_notice(); ?>  
    108   </BODY>  
    109   <?php  } ?>  
    110    
    111   </HTML>  
      52 <?php camp_html_copyright_notice(); ?>  
  • trunk/campsite/implementation/management/priv/issues/do_translate.php

    r3953 r3955  
    52 52  
    53 53 if ($correct) {  
    54       $issueObj->createTranslation($cLang, $cName, $cShortName);  
      54     $newIssue =& $issueObj->copy(null, $issueObj->getIssueId(), $cLang);  
      55     $newIssue->setName($cName);  
      56     $newIssue->setUrlName($cShortName);  
    55 57     $logtext = getGS('Issue $1 added', $cName);  
    56 58     Log::Message($logtext, $User->getUserName(), 11);  
    57       $created = true;  
      59     header("Location: /$ADMIN/issues/?Pub=$Pub");  
      60     exit;  
      61     //$created = true;  
    58 62 }  
    59 63  
  • trunk/campsite/implementation/management/priv/issues/preview.php

    r3953 r3955  
    1 1 <?php  
    2    
    3   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/common.php');  
    4   load_common_include_files("issues");  
    5   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    6   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
    7   require_once($_SERVER['DOCUMENT_ROOT']."/db_connect.php");  
    8   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Publication.php');  
    9   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Issue.php');  
    10   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Language.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    11 3 require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Template.php');  
    12 4  
    57 49         . "?IdLanguage=$Language&IdPublication=$Pub&NrIssue=$Issue";  
    58 50 } else {  
    59       $url = "/" . $languageObj->getCode() . "/" . $issueObj->getShortName();  
      51     $url = "/" . $languageObj->getCode() . "/" . $issueObj->getUrlName();  
    59 51 }  
    60 52  
  • trunk/campsite/implementation/management/priv/issues/do_add_new.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/db_connect.php');  
    3   require_once($Campsite['HTML_DIR']."/$ADMIN_DIR/lib_campsite.php");  
    4   $globalfile=selectLanguageFile('globals');  
    5   $localfile=selectLanguageFile("issues");  
    6   @include_once($globalfile);  
    7   @include_once($localfile);  
    8   require_once($Campsite['HTML_DIR'] . "/$ADMIN_DIR/languages.php");  
    9   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    10   ?>  
    11   <?php  
    12   require_once($_SERVER['DOCUMENT_ROOT']."/db_connect.php");  
    13   ?>  
    14    
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    15 3  
    16   <?php  
    17       todefnum('TOL_UserId');  
    18       todefnum('TOL_UserKey');  
    19       query ("SELECT * FROM Users WHERE Id=$TOL_UserId AND KeyId=$TOL_UserKey", 'Usr');  
    20       $access=($NUM_ROWS != 0);  
    21       if ($NUM_ROWS) {  
    22       fetchRow($Usr);  
    23       query ("SELECT * FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'XPerm');  
    24        if ($NUM_ROWS){  
    25           fetchRow($XPerm);  
    26        }  
    27        else $access = 0;                      //added lately; a non-admin can enter the administration area; he exists but doesn't have ANY rights  
    28        $xpermrows= $NUM_ROWS;  
      4 // Check permissions  
      5 list($access, $User) = check_basic_access($_REQUEST);  
      6 if (!$access) {  
      7     header("Location: /$ADMIN/logout.php");  
      8     exit;  
      9 }  
      10  
      11 if (!$User->hasPermission('ManageIssue')) {  
      12     camp_html_display_error(getGS('You do not have the right to add issues.'));  
      13     exit;  
      14 }  
      15  
      16 $Pub = Input::Get('Pub', 'int');  
      17 $cName = trim(Input::Get('cName', 'string', ''));  
      18 $cNumber = trim(Input::Get('cNumber', 'int'));  
      19 $cLang = Input::Get('cLang', 'int', 0);  
      20 $cShortName = Input::Get('cShortName');  
      21  
      22 $correct = true;  
      23 $created = false;  
      24 $errorMsgs = array();  
      25 if ($cLang == 0) {  
      26     $correct = false;  
      27     $errorMsgs[] = getGS('You must select a language.');  
      28 }  
      29 if ($cName == "") {  
      30     $correct = false;  
      31     $errorMsgs[] = getGS('You must complete the $1 field.','<B>'.getGS('Name').'</B>');  
      32 }  
      33 if ($cShortName == "") {  
      34     $correct = false;  
      35     $errorMsgs[] = getGS('You must complete the $1 field.','<B>'.getGS('URL Name').'</B>');  
      36 }  
      37 if (!camp_is_valid_url_name($cShortName)) {  
      38     $correct = false;  
      39     $errorMsgs[] = getGS('The $1 field may only contain letters, digits and underscore (_) character.', '</B>' . getGS('URL Name') . '</B>');  
      40 }  
      41 if ($cNumber == "") {  
      42     $correct = false;  
      43     $errorMsgs[] = getGS('You must complete the $1 field.','<B>'.getGS('Number').'</B>');  
      44 }  
      45  
      46 if (!Input::IsValid()) {  
      47     $correct = false;  
      48     $errorMsgs[] = getGS('Invalid Input: $1', Input::GetErrorString());  
      49 }  
      50  
      51 $publicationObj =& new Publication($Pub);  
      52  
      53 if ($correct) {  
      54     $newIssueObj =& new Issue($Pub, $cLang, $cNumber);  
      55     $created = $newIssueObj->create($cShortName, array('Name' => $cName));  
      56     if ($created) {  
      57         $logtext = getGS('Issue $1 added in publication $2', $cName, $publicationObj->getName());  
      58         Log::Message($logtext, $User->getUserName(), 11);  
      59         header("Location: /$ADMIN/issues/?Pub=$Pub");  
      60         exit;  
    29 61     }  
    30       else {  
    31       query ("SELECT * FROM UserPerm WHERE 1=0", 'XPerm');  
    32       }  
    33   ?>  
    34        
    35    
    36    
    37       <?php  if ($access) {  
    38       query ("SELECT ManageIssue FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'Perm');  
    39        if ($NUM_ROWS) {  
    40           fetchRow($Perm);  
    41           $access = (getVar($Perm,'ManageIssue') == "Y");  
    42       }  
    43       else $access = 0;  
    44       } ?>  
    45        
    46      
    47    
    48   <HEAD>  
    49       <LINK rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?>/css/admin_stylesheet.css">  
    50    
    51       <TITLE><?php  putGS("Adding new issue"); ?></TITLE>  
    52   <?php  if ($access == 0) { ?>   <META HTTP-EQUIV="Refresh" CONTENT="0; URL=/admin/ad.php?ADReason=<?php  print encURL(getGS("You do not have the right to add issues." )); ?>">  
    53   <?php  } ?></HEAD>  
    54    
    55   <?php  if ($access) { ?>  
    56      
    57    
    58   <BODY >  
    59    
    60   <?php  
    61       todef('cName');  
    62       todefnum('cNumber');  
    63       todefnum('cLang');  
    64       todefnum('cPub');  
    65       todef('cShortName');  
    66   ?><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" WIDTH="100%" class="page_title_container">  
    67       <TR>  
    68           <TD class="page_title">  
    69               <?php  putGS("Adding new issue"); ?>  
    70           </TD>  
    71    
    72       <TD ALIGN=RIGHT><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="0"><TR><TD><A HREF="/admin/issues/?Pub=<?php  pencURL($cPub); ?>" class="breadcrumb" ><?php  putGS("Issues");  ?></A></TD>  
    73   <td class="breadcrumb_separator"> </td>  
    74   <TD><A HREF="/admin/pub/" class="breadcrumb" ><?php  putGS("Publications");  ?></A></TD>  
    75   </TR></TABLE></TD></TR>  
    76   </TABLE>  
    77    
    78   <?php  
    79       query ("SELECT Name FROM Publications WHERE Id=$cPub", 'publ');  
    80       if ($NUM_ROWS) {  
    81       fetchRow($publ);  
    82   ?><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="1" WIDTH="100%" class="current_location_table"><TR>  
    83   <TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title"> <?php  putGS("Publication"); ?>:</TD><TD VALIGN="TOP" class="current_location_content"><?php  pgetHVar($publ,'Name'); ?></TD>  
    84    
    85   </TR></TABLE>  
      62 }  
    86 63  
      64 camp_html_content_top(getGS('Adding new issue'), array('Pub' => $publicationObj), true, false, array(getGS("Issues") => "/$ADMIN/issues/?Pub=$Pub"));  
      65 ?>  
    87 66 <P>  
    88   <CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box" ALIGN="CENTER">  
    89       <TR>  
    90           <TD COLSPAN="2">  
    91               <B> <?php  putGS("Adding new issue"); ?> </B>  
    92               <HR NOSHADE SIZE="1" COLOR="BLACK">  
    93           </TD>  
    94       </TR>  
    95       <TR>  
    96           <TD COLSPAN="2"><BLOCKQUOTE>  
    97   <?php  
    98       $correct = 1;  
    99       $created = 0;  
    100       $cName = trim($cName);  
    101       $cNumber = trim($cNumber);  
    102       if ($cLang == 0) {  
    103           $correct = 0;  
    104           echo "<LI>" . getGS('You must select a language.') . "</LI>\n";  
    105       }  
    106       if ($cName == "" || $cName == " ") {  
    107           $correct = 0;  
    108           echo "<LI>" . getGS('You must complete the $1 field.','<B>'.getGS('Name').'</B>') . "</LI>\n";  
    109       }  
    110       if ($cShortName == "" || $cShortName == " ") {  
    111           $correct = 0;  
    112           echo "<LI>" . getGS('You must complete the $1 field.','<B>'.getGS('URL Name').'</B>') . "</LI>\n";  
    113       }  
    114       $ok = camp_is_valid_url_name($cShortName);  
    115       if ($ok == 0) {  
    116           $correct = 0;  
    117           echo "<LI>" . getGS('The $1 field may only contain letters, digits and underscore (_) character.', '</B>' . getGS('URL Name') . '</B>') . "</LI>\n";  
    118       }  
    119       if ($cNumber == "" || $cNumber == " ") {  
    120           $correct = 0; ?>        <LI><?php  putGS('You must complete the $1 field.','<B>'.getGS('Number').'</B>'); ?></LI>  
    121   <?php  
    122       }  
    123       if ($correct) {  
    124           $sql = "INSERT INTO Issues SET Name='$cName', IdPublication=$cPub, IdLanguage=$cLang, Number=$cNumber, ShortName='".$cShortName."'";  
    125           query($sql);  
    126           $created = ($AFFECTED_ROWS > 0);  
    127       }  
    128       if ($created) {  
    129   ?>      <LI><?php  putGS('The issue $1 has been successfuly added.','<B>'.encHTML(decS($cName)).'</B>'); ?></LI>  
    130           <?php  $logtext = getGS('Issue $1 added in publication $2',$cName,getVar($publ,'Name')); query ("INSERT INTO Log SET TStamp=NOW(), IdEvent=11, User='".getVar($Usr,'UName')."', Text='$logtext'"); ?>  
    131   <?php  } else {  
    132           if ($correct) { ?>          <LI><?php  putGS('The issue could not be added.'); ?></LI><LI><?php  putGS('Please check if another issue with the same number/language does not already exist.'); ?></LI>  
    133   <?php  }  
    134       }  
    135   ?>      </BLOCKQUOTE></TD>  
    136       </TR>  
    137   <?php  if ($correct && $created) { ?>   <TR>  
    138           <TD COLSPAN="2">  
    139           <DIV ALIGN="CENTER">  
    140           <INPUT TYPE="button" class="button" NAME="Another" VALUE="<?php  putGS('Add another'); ?>" ONCLICK="location.href='/admin/issues/add_new.php?Pub=<?php  pencURL($cPub); ?>'">  
    141           <INPUT TYPE="button" class="button" NAME="Done" VALUE="<?php  putGS('Done'); ?>" ONCLICK="location.href='/admin/issues/?Pub=<?php  pencURL($cPub); ?>'">  
    142           </DIV>  
    143           </TD>  
    144       </TR>  
    145   <?php  } else { ?>  <TR>  
    146           <TD COLSPAN="2">  
    147           <DIV ALIGN="CENTER">  
    148           <INPUT TYPE="button" class="button" NAME="OK" VALUE="<?php  putGS('OK'); ?>" ONCLICK="location.href='/admin/issues/add_new.php?Pub=<?php  pencURL($cPub); ?>'">  
    149           </DIV>  
    150           </TD>  
    151       </TR>  
    152   <?php  } ?></TABLE></CENTER>  
      67 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">  
      68 <TR>  
      69     <TD COLSPAN="2">  
      70         <B> <?php  putGS("Adding new issue"); ?> </B>  
      71         <HR NOSHADE SIZE="1" COLOR="BLACK">  
      72     </TD>  
      73 </TR>  
      74 <TR>  
      75     <TD COLSPAN="2">  
      76         <BLOCKQUOTE>  
      77         <?php  
      78         if (!$correct) {  
      79             foreach ($errorMsgs as $errorMsg) {  
      80                 ?>  
      81                 <li><?php echo $errorMsg; ?></li>  
      82                 <?php  
      83             }  
      84         }  
      85         else {  
      86             if (!$created) { ?>  
      87                 <LI><?php  putGS('The issue could not be added.'); ?></LI>  
      88                 <LI><?php  putGS('Please check if another issue with the same number/language does not already exist.'); ?></LI>  
      89                 <?php   
      90             }  
      91         }  
      92         ?>  
      93         </BLOCKQUOTE>  
      94     </TD>  
      95 </TR>  
      96  
      97 <TR>  
      98     <TD COLSPAN="2">  
      99     <DIV ALIGN="CENTER">  
      100     <INPUT TYPE="button" class="button" NAME="Another" VALUE="<?php  putGS('Add another'); ?>" ONCLICK="location.href='/<?php p($ADMIN); ?>/issues/add_new.php?Pub=<?php p($Pub); ?>'">  
      101     <INPUT TYPE="button" class="button" NAME="Done" VALUE="<?php  putGS('Done'); ?>" ONCLICK="location.href='/<?php p($ADMIN); ?>/issues/?Pub=<?php p($Pub); ?>'">  
      102     </DIV>  
      103     </TD>  
      104 </TR>  
      105 </TABLE>  
    153 106 <P>  
    154 107  
    155   <?php  } else { ?><BLOCKQUOTE>  
    156       <LI><?php  putGS('Publication does not exist.'); ?></LI>  
    157   </BLOCKQUOTE>  
    158   <?php  } ?>  
    159 108 <?php camp_html_copyright_notice(); ?>  
    160   </BODY>  
    161   <?php  } ?>  
    162    
    163   </HTML>  
  • trunk/campsite/implementation/management/priv/issues/autopublish_del.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT']."/classes/common.php");  
    3   load_common_include_files("issues");  
    4   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    5   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    6 3 require_once($_SERVER['DOCUMENT_ROOT'].'/classes/IssuePublish.php');  
    7 4  
  • trunk/campsite/implementation/management/priv/issues/status.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/common.php');  
    3   load_common_include_files("issues");  
    4   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    5   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
    6   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Publication.php');  
    7   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Issue.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    8 3  
    9 4 // Check permissions  
  • trunk/campsite/implementation/management/priv/issues/add_prev.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/db_connect.php');  
    3   require_once($Campsite['HTML_DIR']."/$ADMIN_DIR/lib_campsite.php");  
    4   $globalfile=selectLanguageFile('globals');  
    5   $localfile=selectLanguageFile("issues");  
    6   @include_once($globalfile);  
    7   @include_once($localfile);  
    8   require_once($Campsite['HTML_DIR'] . "/$ADMIN_DIR/languages.php");  
    9   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    10   ?>  
    11   <?php  
    12   require_once($_SERVER['DOCUMENT_ROOT']."/db_connect.php");  
    13   ?>  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    14 3  
      4 // Check permissions  
      5 list($access, $User) = check_basic_access($_REQUEST);  
      6 if (!$access) {  
      7     header("Location: /$ADMIN/logout.php");  
      8     exit;  
      9 }  
      10  
      11 if (!$User->hasPermission('ManageIssue')) {  
      12     camp_html_display_error(getGS('You do not have the right to add issues.'));  
      13     exit;  
      14 }  
      15  
      16 $Pub = Input::Get('Pub', 'int');  
      17 if (!Input::IsValid()) {  
      18     camp_html_display_error(getGS('Invalid Input: $1', Input::GetErrorString()));     
      19     exit;  
      20 }  
      21 $publicationObj =& new Publication($Pub);  
      22 $allLanguages =& Language::GetAllLanguages();  
      23 $newIssueId = Issue::GetUnusedIssueId($Pub);  
      24 $lastCreatedIssue = Issue::GetLastCreatedIssue($Pub);  
      25  
      26 camp_html_content_top(getGS('Copy previous issue'), array('Pub' => $publicationObj), true, false, array(getGS("Issues") => "/$ADMIN/issues/?Pub=$Pub"));  
    15 27  
    16   <?php  
    17       todefnum('TOL_UserId');  
    18       todefnum('TOL_UserKey');  
    19       query ("SELECT * FROM Users WHERE Id=$TOL_UserId AND KeyId=$TOL_UserKey", 'Usr');  
    20       $access=($NUM_ROWS != 0);  
    21       if ($NUM_ROWS) {  
    22       fetchRow($Usr);  
    23       query ("SELECT * FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'XPerm');  
    24        if ($NUM_ROWS){  
    25           fetchRow($XPerm);  
    26        }  
    27        else $access = 0;                      //added lately; a non-admin can enter the administration area; he exists but doesn't have ANY rights  
    28        $xpermrows= $NUM_ROWS;  
    29       }  
    30       else {  
    31       query ("SELECT * FROM UserPerm WHERE 1=0", 'XPerm');  
    32       }  
    33   ?>  
    34        
    35    
    36    
    37       <?php  if ($access) {  
    38       query ("SELECT ManageIssue FROM UserPerm WHERE IdUser=".getVar($Usr,'Id'), 'Perm');  
    39        if ($NUM_ROWS) {  
    40           fetchRow($Perm);  
    41           $access = (getVar($Perm,'ManageIssue') == "Y");  
    42       }  
    43       else $access = 0;  
    44       } ?>  
    45        
    46      
    47    
    48   <HEAD>  
    49       <LINK rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?>/css/admin_stylesheet.css">  
    50    
    51       <TITLE><?php  putGS("Copy previous issue"); ?></TITLE>  
    52   <?php  if ($access == 0) { ?>   <META HTTP-EQUIV="Refresh" CONTENT="0; URL=/admin/ad.php?ADReason=<?php  print encURL(getGS("You do not have the right to add issues." )); ?>">  
    53   <?php  } ?></HEAD>  
    54    
    55   <?php  if ($access) { ?>  
    56      
    57    
    58   <BODY >  
    59    
    60   <?php  todefnum('Pub'); ?><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" WIDTH="100%" class="page_title_container">  
    61       <TR>  
    62           <TD class="page_title">  
    63               <?php  putGS("Copy previous issue"); ?>  
    64           </TD>  
    65    
    66       <TD ALIGN=RIGHT><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="0"><TR><TD><A HREF="/admin/issues/?Pub=<?php  pencURL($Pub); ?>" class="breadcrumb" ><?php  putGS("Issues");  ?></A></TD>  
    67   <td class="breadcrumb_separator"> </td>  
    68   <TD><A HREF="/admin/pub/" class="breadcrumb" ><?php  putGS("Publications");  ?></A></TD>  
    69   </TR></TABLE></TD></TR>  
    70   </TABLE>  
    71 28  
    72   <?php  
    73       query ("SELECT Name FROM Publications WHERE Id=$Pub", 'publ');  
    74       if ($NUM_ROWS) {  
    75       fetchRow($publ);  
    76   ?><TABLE BORDER="0" CELLSPACING="1" CELLPADDING="1" WIDTH="100%" class="current_location_table"><TR>  
    77   <TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title"> <?php  putGS("Publication"); ?>:</TD><TD VALIGN="TOP" class="current_location_content"><?php  pgetHVar($publ,'Name'); ?></TD>  
    78    
    79   </TR></TABLE>  
    80    
    81   <?php  
    82       query ("SELECT MAX(Number) FROM Issues WHERE IdPublication=$Pub", 'q_nr');  
    83       fetchRowNum($q_nr);  
    84       if (getNumVar($q_nr,0) == "") { ?><BLOCKQUOTE>  
      29 if (is_null($lastCreatedIssue)) { ?>  
      30     <BLOCKQUOTE>  
    85 31     <LI><?php  putGS('No previous issue.'); ?></LI>  
    86   </BLOCKQUOTE>  
    87   <?php  } else { ?><P>  
      32     </BLOCKQUOTE>  
      33     <?php   
      34 } else { ?>  
      35  
      36 <P>  
    88 37 <FORM NAME="dialog" METHOD="POST" ACTION="do_add_prev.php"  >  
    89   <CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" CLASS="table_input" ALIGN="CENTER">  
    90       <TR>  
    91           <TD COLSPAN="2">  
    92               <B><?php  putGS("Copy previous issue"); ?></B>  
    93               <HR NOSHADE SIZE="1" COLOR="BLACK">  
    94           </TD>  
    95       </TR>  
    96       <TR>  
    97           <TD COLSPAN="2"><?php  putGS('Copy structure from issue nr $1','<B>'.getNumVar($q_nr,0).'</B>'); ?></TD>  
    98       </TR>  
    99       <TR>  
    100           <TD ALIGN="RIGHT" ><?php  putGS("Number"); ?>:</TD>  
    101           <TD>  
    102           <INPUT TYPE="TEXT" class="input_text" NAME="cNumber" VALUE="<?php  print (getNumVar($q_nr,0) + 1); ?>" SIZE="5" MAXLENGTH="5">  
    103           </TD>  
    104       </TR>  
    105       <TR>  
    106           <TD COLSPAN="2">  
    107           <DIV ALIGN="CENTER">  
    108           <INPUT TYPE="HIDDEN" NAME="cOldNumber" VALUE="<?php  pgetNumVar($q_nr,0); ?>">  
    109           <INPUT TYPE="HIDDEN" NAME="cPub" VALUE="<?php  pencHTML($Pub); ?>">  
    110           <INPUT TYPE="submit" class="button" NAME="Save" VALUE="<?php  putGS('Save changes'); ?>">  
    111           <INPUT TYPE="button" class="button" NAME="Cancel" VALUE="<?php  putGS('Cancel'); ?>" ONCLICK="location.href='/admin/issues/?Pub=<?php  pencURL($Pub); ?>'">  
    112           </DIV>  
    113           </TD>  
    114       </TR>  
    115   </TABLE></CENTER>  
      38 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" CLASS="table_input">  
      39 <TR>  
      40     <TD COLSPAN="2">  
      41         <B><?php  putGS("Copy previous issue"); ?></B>  
      42         <HR NOSHADE SIZE="1" COLOR="BLACK">  
      43     </TD>  
      44 </TR>  
      45 <TR>  
      46     <TD COLSPAN="2"><?php  putGS('Copy structure from issue nr $1','<B>'. $lastCreatedIssue->getIssueId().'</B>'); ?></TD>  
      47 </TR>  
      48 <TR>  
      49     <TD ALIGN="RIGHT" ><?php  putGS("Issue Number"); ?>:</TD>  
      50     <TD>  
      51     <INPUT TYPE="TEXT" class="input_text" NAME="cNumber" VALUE="<?php  print ($lastCreatedIssue->getIssueId() + 1); ?>" SIZE="5" MAXLENGTH="5">  
      52     </TD>  
      53 </TR>  
      54 <TR>  
      55     <TD COLSPAN="2">  
      56     <DIV ALIGN="CENTER">  
      57     <INPUT TYPE="HIDDEN" NAME="Pub" VALUE="<?php p($Pub); ?>">  
      58     <INPUT TYPE="submit" class="button" NAME="Save" VALUE="<?php  putGS('Save changes'); ?>">  
      59     <INPUT TYPE="button" class="button" NAME="Cancel" VALUE="<?php  putGS('Cancel'); ?>" ONCLICK="location.href='/<?php p($ADMIN); ?>/issues/?Pub=<?php  p($Pub); ?>'">  
      60     </DIV>  
      61     </TD>  
      62 </TR>  
      63 </TABLE>  
    116 64 </FORM>  
    117 65 <P>  
    118 66 <?php  } ?>  
    119   <?php  } else { ?><BLOCKQUOTE>  
    120       <LI><?php  putGS('Publication does not exist.'); ?></LI>  
    121   </BLOCKQUOTE>  
    122   <?php  } ?>  
    123 67 <?php camp_html_copyright_notice(); ?>  
    124   </BODY>  
    125   <?php  } ?>  
    126    
    127   </HTML>  
  • trunk/campsite/implementation/management/priv/issues/edit.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/common.php');  
    3   load_common_include_files("issues");  
    4   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    5   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    6 3 require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Template.php');  
    7   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Publication.php');  
    8   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Issue.php');  
    9 4  
    10 5 // Check permissions  
    123 118     <TD ALIGN="RIGHT" ><?php  putGS("URL Name"); ?>:</TD>  
    124 119     <TD>  
    125       <INPUT TYPE="TEXT" class="input_text" NAME="cShortName" SIZE="32" MAXLENGTH="32" value="<?php  p(htmlspecialchars($issueObj->getShortName())); ?>">  
      120     <INPUT TYPE="TEXT" class="input_text" NAME="cShortName" SIZE="32" MAXLENGTH="32" value="<?php  p(htmlspecialchars($issueObj->getUrlName())); ?>">  
    125 120     </TD>  
    126 121 </TR>  
  • trunk/campsite/implementation/management/priv/issues/do_del.php

    r3953 r3955  
    1 1 <?php  
    2   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/common.php');  
    3   load_common_include_files("issues");  
    4   require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    5   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Input.php');  
    6   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Publication.php');  
    7   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Issue.php');  
      2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/issues/issue_common.php");  
    8 3 require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Article.php');  
    9   require_once($_SERVER['DOCUMENT_ROOT'].'/classes/Log.php');  
    10 4  
    11 5 // Check permissions  
  • trunk/campsite/implementation/management/priv/home.php

    r3953 r3955  
    59 59     require_once($_SERVER['DOCUMENT_ROOT']."/parser_utils.php");  
    60 60     if (stop_parser()) {  
    61           $resMsg = getGS("The template engine was (re)started.");  
      61         $resetMsg = getGS("The template engine was (re)started.");  
    61 61         $res = "OK";  
    62 62     } else {  
    63           $resMsg = getGS("The template engine could not be restarted! Please verify if the template engine was started by other user than $1.", $Campsite['APACHE_USER']);  
      63         $resetMsg = getGS("The template engine could not be restarted! Please verify if the template engine was started by other user than $1.", $Campsite['APACHE_USER']);  
    63 63         $res = "ERROR";  
    64 64     }  
     
    68 68 }  
    69 69 ?>  
    70   <?php if ($resMsg != '') { ?>  
      70 <?php if (!empty($resetMsg)) { ?>  
    70 70 <table border="0" cellpadding="0" cellspacing="0" align="center">  
    71 71 <tr>  
    76 76     <td class="error_message" align="center">  
    77 77 <?php } ?>  
    78           <?php echo $resMsg; ?>  
      78         <?php echo $resetMsg; ?>  
    78 78     </td>  
    79 79 </tr>  
  • trunk/campsite/implementation/management/classes/Section.php

    r3941 r3955  
    131 131      * @return string  
    132 132      */  
    133       function getShortName()  
      133     function getUrlName()  
    133 133     {  
    134 134         return $this->getProperty('ShortName');  
    135       } // fn getShortName  
      135     } // fn getUrlName  
    135 135      
    136 136      
    223 223             $sectionName = $this->getName() . " (duplicate)";  
    224 224         } else {  
    225               $shortName = $this->getShortName();  
      225             $shortName = $this->getUrlName();  
    225 225             $sectionName = $this->getName();  
    226 226         }  
  • trunk/campsite/implementation/management/classes/Article.php

    r3940 r3955  
    965 965      * @return string  
    966 966      */  
    967       function getShortName()  
      967     function getUrlName()  
    967 967     {  
    968 968         return $this->getProperty('ShortName');  
    969       } // fn getShortName  
      969     } // fn getUrlName  
    969 969      
    970 970      
  • trunk/campsite/implementation/management/classes/Issue.php

    r3941 r3955  
    39 39      
    40 40     /**  
    41        *  
      41      * A publication has Issues, Issues have Sections and Articles.  
    41 41      * @param int $p_publicationId  
    42 42      * @param int $p_languageId  
     
    59 59      * Create an issue.  
    60 60      * @param string $p_shortName  
      61      * @param array $p_values  
      62      * @return boolean  
    61 63      */  
    62       function create($p_shortName)  
      64     function create($p_shortName, $p_values = null)  
    62 64     {  
    63           return parent::create(array('ShortName' => $p_shortName));  
      65         $tmpValues = array('ShortName' => $p_shortName);  
      66         if (!is_null($p_values)) {  
      67            $tmpValues = array_merge($p_values, $tmpValues);  
      68         }  
      69         return parent::create($tmpValues);  
    64 70     } // fn create  
    65 71      
     
    86 92      
    87 93     /**  
    88        * Create a translation of the issue.  This will copy all of the  
    89        * sections as well, but not the articles.  
    90        *  
    91        *  
      94      * Copy this issue and all sections.  
      95      * @param int $p_destPublicationId  
      96      * @param int $p_destIssueId  
      97      * @param int $p_destLanguageId  
      98      * @return Issue  
      99      */  
      100     function __copy($p_destPublicationId, $p_destIssueId, $p_destLanguageId)  
      101     {  
      102         // Copy the issue  
      103         $newIssue =& new Issue($p_destPublicationId, $p_destLanguageId, $p_destIssueId);  
      104         $columns = array();  
      105         $columns['Name'] = mysql_real_escape_string($this->getName());  
      106         $columns['IssueTplId'] = $this->m_data['IssueTplId'];  
      107         $columns['SectionTplId'] = $this->m_data['SectionTplId'];  
      108         $columns['ArticleTplId'] = $this->m_data['ArticleTplId'];  
      109         $created = $newIssue->create($p_destIssueId, $columns);  
      110         if ($created) {  
      111             // Copy the sections in the issue  
      112             $sections =& Section::GetSections($this->m_data['IdPublication'],  
      113                 $this->m_data['Number'], $this->m_data['IdLanguage']);  
      114             foreach ($sections as $section) {  
      115                 $section->copy($p_destPublicationId, $p_destIssueId, $p_destLanguageId, null, false);  
      116             }  
      117             return $newIssue;     
      118         }     
      119         else {  
      120             return null;  
      121         }  
      122     } // fn __copy  
      123      
      124      
      125     /**  
      126      * Create a copy of this issue.  You can use this to:  
      127      * 1) Translate an issue.  In this case do:  
      128      *    $issue->copy(null, $issue->getIssueId(), $destinationLanguage);  
      129      * 2) Duplicate all translations of an issue within a publication:  
      130      *    $issue->copy();  
      131      * 3) Copy an issue to another publication:  
      132      *    $issue->copy($destinationPublication);  
      133      * Note: All sections will be copied, but not the articles.  
      134      *  
      135      * @param int $p_destPublicationId  
      136      *     (optional) Specify the destination publication.   
      137      *     Default is this issue's publication ID.  
      138      * @param int $p_destIssueId  
      139      *     (optional) Specify the destination issue ID.   
      140      *     If not specified, a new one will be generated.  
      141      * @param int $p_destLanguageId  
      142      *     (optional) Use this if you want the copy to be a translation of the current issue.  
      143      *     Default is to copy all translations of this issue.  
      144      * @return void  
    92 145      */  
    93       function createTranslation($p_languageId, $p_name, $p_urlName = null)  
      146     function copy($p_destPublicationId = null, $p_destIssueId = null, $p_destLanguageId = null)  
    93 146     {  
    94 147         global $Campsite;  
    95           if (is_null($p_urlName)) {  
    96               $p_urlName = $this->m_data['Number'];  
      148         if (is_null($p_destPublicationId)) {  
      149             $p_destPublicationId = $this->m_data['IdPublication'];  
    97 150         }  
    98           // Create a new issue  
    99           $queryStr = "INSERT IGNORE INTO Issues "  
    100                       ." SET Name='$p_name'"  
    101                       .", ShortName = '$p_urlName'"  
    102                       .", IdLanguage=$p_languageId"  
    103                       .", IdPublication=".$this->m_data['IdPublication']  
    104                       .", Number=".$this->m_data['Number'];  
    105           $Campsite['db']->Execute($queryStr);  
    106            
    107           // Copy the sections  
    108           $sections =& Section::GetSections($this->m_data['IdPublication'],  
    109               $this->m_data['Number'], $this->m_data['IdLanguage']);  
    110           foreach ($sections as $section) {  
    111               $section->copy($this->m_data['IdPublication'],  
    112                   $this->m_data['Number'], $p_languageId, null, false);  
    113           }  
    114       } // fn createTranslation  
      151         if (is_null($p_destIssueId)) {  
      152             $p_destIssueId = Issue::GetUnusedIssueId($this->m_data['IdPublication']);  
      153         }  
      154         if (is_null($p_destLanguageId)) {  
      155             $queryStr = 'SELECT * FROM Issues '  
      156                         .' WHERE IdPublication='.$this->m_data['IdPublication']  
      157                         .' AND Number='.$this->m_data['Number'];  
      158             $srcIssues =& DbObjectArray::Create('Issue', $queryStr);  
      159  
      160             // Copy all translations of this issue.  
      161             $newIssues = array();  
      162             foreach ($srcIssues as $issue) {  
      163                 $newIssues[] = $issue->__copy($p_destPublicationId, $p_destIssueId, $issue->getLanguageId());  
      164             }  
      165             return $newIssues;  
      166         } else {  
      167             // Translate the issue.  
      168             return $this->__copy($p_destPublicationId, $p_destIssueId, $p_destLanguageId);  
      169         }  
      170     } // fn copy  
    115 171      
    116 172      
    117 173     /**  
      174      * Return the publication ID of the publication that contains this issue.  
    118 175      * @return int  
    119 176      */  
     
    126 183      
    127 184     /**  
      185      * Return the language ID of the issue.  
    128 186      * @return int  
    129 187      */  
     
    138 196      * written in.  The value is cached in case there are multiple  
    139 197      * calls to this function.  
      198      *  
      199      * @return string  
    140 200      */  
    141 201     function getLanguageName()  
     
    159 219      
    160 220     /**  
      221      * Get the name of the issue.  
    161 222      * @return string  
    162 223      */  
     
    168 229      
    169 230     /**  
      231      * Set the name of the issue.  
      232      * @param string  
      233      * @return boolean  
      234      */  
      235     function setName($p_value)  
      236     {  
      237         return $this->setProperty('Name', $p_value);  
      238     } // fn setName  
      239      
      240      
      241     /**  
      242      * Get the string used for the URL to this issue.  
    170 243      * @return string  
    171 244      */  
    172       function getShortName()  
      245     function getUrlName()  
    172 245     {  
    173 246         return $this->getProperty('ShortName');  
    174       } // fn getShortName  
      247     } // fn getUrlName  
      248      
      249      
      250     /**  
      251      * Set the string used in the URL to access this Issue.  
      252      *  
      253      * @return boolean  
      254      */  
      255     function setUrlName($p_value)  
      256     {  
      257         return $this->setProperty('ShortName', $p_value);  
      258     } // fn setUrlName  
    175 259      
    176 260      
    177 261     /**  
      262      * Get the default template ID used for articles in this issue.  
    178 263      * @return int  
    179 264      */  
     
    186 271      
    187 272     /**  
      273      * Get the default template ID used for sections in this issue.  
    188 274      * @return int  
    189 275      */  
     
    195 281      
    196 282     /**  
      283      * Get the template ID used for this issue.  
    197 284      * @return int  
    198 285      */  
     
    203 290      
    204 291      
      292     /**  
      293      * Return 'Y' if the issue is published, 'N' if it is not published.  
      294      * @return string  
      295      */  
    205 296     function getPublished()  
    206 297     {  
     
    213 304      *  
    214 305      * @param string $p_value  
    215        *      Can be NULL, 'Y', 'N', TRUE, FALSE.  
      306      *      Can be NULL, 'Y', 'N', TRUE, or FALSE.  
    215 306      *      If set to NULL, the current value will be reversed.  
    216 307      *  
    363 454         return $total;               
    364 455     } // fn GetNumIssues  
      456  
      457      
      458     /**  
      459      * Return an issue number that is not in use.  
      460      * @param int $p_publicationId  
      461      * @return int  
      462      */  
      463     function GetUnusedIssueId($p_publicationId)  
      464     {  
      465         global $Campsite;  
      466         $queryStr = "SELECT MAX(Number) + 1 FROM Issues "  
      467                     ." WHERE IdPublication=$p_publicationId";  
      468         $number = $Campsite['db']->GetOne($queryStr);  
      469         return $number;  
      470     } // fn GetUnusedIssueId  
      471  
      472      
      473     /**  
      474      * Return the last Issue created in this publication or NULL if there  
      475      * are no previous issues.  
      476      *  
      477      * @param int $p_publicationId  
      478      * @return Issue  
      479      */  
      480     function GetLastCreatedIssue($p_publicationId)  
      481     {  
      482        global $Campsite;  
      483        $queryStr = "SELECT MAX(Number) FROM Issues WHERE IdPublication=$p_publicationId";  
      484        $maxIssueNumber = $Campsite['db']->GetOne($queryStr);  
      485        if (empty($maxIssueNumber)) {  
      486            return null;  
      487        }  
      488        $queryStr = "SELECT IdLanguage FROM Issues WHERE IdPublication=$p_publicationId AND Number=$maxIssueNumber";  
      489        $idLanguage = $Campsite['db']->GetOne($queryStr);  
      490        $issue =& new Issue($p_publicationId, $idLanguage, $maxIssueNumber);  
      491        return $issue;  
      492     } // fn GetLastCreatedIssue  
    365 493      
    366 494 } // class Issue