Changeset 4418

Show
Ignore:
Timestamp:
Wed Feb 1 19:07:28 2006
Author:
paul
Message:

Implemented feature #1616 – Ability to submit a story without assigning a publication/issue/section

Files:

Legend:

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

       281286301
    r4283 r4418  
    16 16  * @param string $p_selectedValue  
    17 17  * @param string $p_printValue  
    18    * @return void  
      18  * @return boolean  
      19  *      Return TRUE if the option is selected, FALSE if not.  
    19 20  */  
    20 21 function camp_html_select_option($p_value, $p_selectedValue, $p_printValue)  
    21 22 {  
    23     $selected = false;  
    22 24     $str = ‘<OPTION VALUE="’.htmlspecialchars($p_value, ENT_QUOTES).’"’;  
    23 25     if (!strcmp($p_value, $p_selectedValue)) {  
    24 26         $str .= ‘ SELECTED’;  
    27         $selected = true;  
    25 28     }  
    26 29     $str .= ‘>’.htmlspecialchars($p_printValue)."</OPTION>n";  
    27 30     echo $str;  
    31     return $selected;  
    28 32 } // fn camp_html_select_option  
    29 33    
     
    279 283 {  
    280 284     $lastCrumb = array_pop($p_crumbs);  
      //    $secondToLastCrumb = array_pop($p_crumbs);  
    282 285     $str = ‘<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="0" bgcolor="#D5E2EE" width="100%">’;  
    283 286     if (count($p_crumbs) > 0) {  
    284 287         $str .= ‘<TR><TD align="left" style="border-top: 1px solid #8BAED1; padding-left: 1.25em; padding-top: 3px;">’;  
    285           //$str .= "<span style=’font-weight: bold; color: #2F2F2F;’></span>";  
              //$str .= "</TD><TD style=’padding-bottom: 2px; padding-top: 2px; padding-left: 0.5em;’>";  
    287 288         $tmpCrumbs = array();  
    288 289         foreach ($p_crumbs as $crumb) {  
    294 295             }  
    295 296         }  
    296   //      if (count($secondToLastCrumb) == 2) {  
    297   //          $str .= camp_html_breadcrumb($secondToLastCrumb[0], $secondToLastCrumb[1], false, false);  
    298   //      }  
    299   //      else {  
    300   //          $str .= camp_html_breadcrumb($secondToLastCrumb[0], $secondToLastCrumb[1], $secondToLastCrumb[2], false);  
      //      }  
    302 297         $str .= ‘</TD></TR>’;  
    303 298     }  
  • trunk/campsite/implementation/management/priv/menu.php

    666
    r4261 r4418  
    2 2 require_once($_SERVER[‘DOCUMENT_ROOT’]."/db_connect.php");  
    3 3 require_once($_SERVER[‘DOCUMENT_ROOT’]."/classes/common.php");  
    4   require_once($_SERVER[‘DOCUMENT_ROOT’]."/classes/Publication.php");  
    5   require_once($_SERVER[‘DOCUMENT_ROOT’]."/classes/Issue.php");  
      require_once($_SERVER[‘DOCUMENT_ROOT’]."/classes/Section.php");  
    7 4 require_once($_SERVER[‘DOCUMENT_ROOT’]."/classes/DynMenuItem.php");  
    8 5 load_common_include_files("home");  
     
    51 48 $menu_content->addSplit();  
    52 49    
    53   $publications = Publication::GetPublications();  
    54   $issues = array();  
    55   $sections = array();  
    56   foreach ($publications as $publication) {  
    57       $issues[$publication->getPublicationId()] =  
    58           Issue::GetIssues($publication->getPublicationId(), null, null, $publication->getLanguageId(),  
    59               array(‘ORDER BY’=>array(‘Number’=>’DESC’), ‘LIMIT’ => ‘5’));  
    60       foreach ($issues[$publication->getPublicationId()] as $issue) {  
    61           $sections[$issue->getPublicationId()][$issue->getIssueNumber()][$issue->getLanguageId()] =  
    62               Section::GetSections($issue->getPublicationId(),  
    63                   $issue->getIssueNumber(), $issue->getLanguageId());  
    64       }  
    65   }  
       
    67 50 $icon_bullet = ‘<img src="’.$Campsite["ADMIN_IMAGE_BASE_URL"].’/tol.gif" align="middle" style="padding-bottom: 3px;" width="16" height="16" />’;  
    68   foreach ($publications as $publication) {  
      51 foreach ($Campsite["publications"] as $publication) {  
    68 51     $pubId = $publication->getPublicationId();  
    69 52     $menu_item_pub =& DynMenuItem::Create(camp_javascriptspecialchars($publication->getName()),  
     
    72 55                                           array("icon" => $icon_bullet));  
    73 56     $menu_content->addItem($menu_item_pub);  
    74       if (isset($issues[$pubId])) {  
    75           foreach ($issues[$pubId] as $issue) {  
      57     if (isset($Campsite["issues"][$pubId])) {  
      58         foreach ($Campsite["issues"][$pubId] as $issue) {  
    76 59             $issueId = $issue->getIssueNumber();  
    77 60             $languageId = $issue->getLanguageId();  
     
    81 64                  array("icon" => $icon_bullet));  
    82 65             $menu_item_pub->addItem($menu_item_issue);  
    83               if (isset($sections[$pubId][$issueId][$languageId])) {  
    84                   foreach ($sections[$pubId][$issueId][$languageId] as $section) {  
      66             if (isset($Campsite["sections"][$pubId][$issueId][$languageId])) {  
      67                 foreach ($Campsite["sections"][$pubId][$issueId][$languageId] as $section) {  
    85 68                     $sectionId = $section->getSectionNumber();  
    86 69                     $menu_item_section =& DynMenuItem::Create(  
     
    94 77                     $menu_item_issue->addItem($menu_item_section);  
    95 78                 }  
    96                   if (count($sections[$pubId][$issueId][$languageId]) > 0) {  
      79                 if (count($Campsite["sections"][$pubId][$issueId][$languageId]) > 0) {  
    96 79                     $menu_item_issue->addSplit();  
    97 80                     $menu_item =& DynMenuItem::Create(getGS("More…"), $issueIndexLink,  
     
    102 85             }  
    103 86         }  
    104           if (count($issues[$pubId]) > 0) {  
      87         if (count($Campsite["issues"][$pubId]) > 0) {  
    104 87             $menu_item_pub->addSplit();  
    105 88             $menu_item =& DynMenuItem::Create(getGS("More…"),  
    117 100    
    118 101 if ($User->hasPermission("AddArticle")) {  
    119       $menu_item =& DynMenuItem::Create(getGS(‘Add new article’), "/$ADMIN/pub/add_article.php",  
      102     $menu_item =& DynMenuItem::Create(getGS(‘Add new article’), "/$ADMIN/articles/add.php",  
    119 102         array("icon" => sprintf($iconTemplateStr, "add_article.png")));  
    120 103     $menu_actions->addItem($menu_item);  
  • trunk/campsite/implementation/management/priv/ad_popup.php

    r4077 r4418  
    9 9 <HEAD>  
    10 10     <LINK rel="stylesheet" type="text/css" href="<?php echo $Campsite[‘WEBSITE_URL’]; ?>/css/admin_stylesheet.css">  
    11       <TITLE><?php  putGS("Preview issue"); ?></TITLE>  
      11     <TITLE><?php putGS("Access denied"); ?></TITLE>  
    11 11 </HEAD>  
    12 12 <p>  
    13 13 <CENTER>  
    14   <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box" ALIGN="CENTER" style="margin-top: 50px; margin-bottom: 50px;">  
      14 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box" ALIGN="CENTER" style="margin-top: 20px; margin-bottom: 20px; margin-right: 10px;">  
    14 14 <TR>  
    15 15     <TD COLSPAN="2">  
    21 21 </TR>  
    22 22 <TR>  
    23       <TD COLSPAN="2">  
    24           <BLOCKQUOTE>  
    25           <font color="red">  
    26           <li><?php  print htmlspecialchars($ADReason); ?></li>  
    27           </font>  
    28           </BLOCKQUOTE>  
      23     <TD COLSPAN="2" align="center" style="padding-left: 15px; padding-right: 15px;">  
      24         <?php  print htmlspecialchars($ADReason); ?>  
    29 25     </TD>  
    30 26 </TR>  
  • trunk/campsite/implementation/management/priv/users/info.php

    r4116 r4418  
    73 73 }  
    74 74 ?>  
    75   <table border="0" cellspacing="0" align="center" class="table_input">  
      75 <table border="0" cellspacing="0" align="left" class="table_input" width="600px">  
    75 75 <tr>  
    76       <td>  
    77           <table border="0" cellspacing="0" cellpadding="3" align="center" width="100%">  
      76     <td align="left">  
      77         <table border="0" cellspacing="0" cellpadding="3" align="left">  
    78 78             <tr>  
    79 79                 <td align="right" nowrap><?php putGS("Account name"); ?>:</td>  
  • trunk/campsite/implementation/management/priv/users/permission_list.php

      
    r4145 r4418  
    12 12         ‘AddArticle’=>getGS(‘User may add articles’),  
    13 13         ‘ChangeArticle’=>getGS(‘User may change articles’),  
      14         ‘MoveArticle’=>getGS(‘User may move articles’),  
      15         ‘TranslateArticle’=>getGS(‘User may translate articles’),  
      16         ‘AttachImageToArticle’=>getGS(‘User may attach images to articles’),  
    17         ‘AttachTopicToArticle’=>getGS(‘User may attach topics to articles’),  
    14 18         ‘Publish’=>getGS(‘User may publish articles’),  
    15 19         ‘DeleteArticle’=>getGS(‘User may delete articles’),  
    61 65         ‘EditorCopyCutPaste’=>getGS(‘User may copy, cut, and paste’),  
    62 66         ‘EditorUndoRedo’=>getGS(‘User may undo/redo’),  
      67         ‘EditorFindReplace’=>getGS(‘User may find and replace’),  
    68         ‘EditorCharacterMap’=>getGS(‘User may add special characters’),  
    63 69         ‘EditorTextDirection’=>getGS(‘User may change text direction’),  
    64 70         ‘EditorIndent’=>getGS(‘User may set indents’),  
  • trunk/campsite/implementation/management/priv/articles/do_article_list_action.php

    136148
    r4370 r4418  
    111 111     unset($args["f_article_code"]);  
    112 112     $argsStr = camp_implode_keys_and_values($args, "=", "&");  
    113       $argsStr .= "&f_mode=multi";  
      113     $argsStr .= "&f_mode=multi&f_action=duplicate";  
      114     foreach ($_REQUEST["f_article_code"] as $code) {  
      115         $argsStr .= "&f_article_code[]=$code";  
      116     }  
      117     $url = "Location: /$ADMIN/articles/duplicate.php?".$argsStr;  
      118     header($url);  
      119     exit;  
      120 case "move":  
      121     $args = $_REQUEST;  
      122     unset($args["f_article_code"]);  
      123     $argsStr = camp_implode_keys_and_values($args, "=", "&");  
      124     $argsStr .= "&f_mode=multi&f_action=move";  
    114 125     foreach ($_REQUEST["f_article_code"] as $code) {  
    115 126         $argsStr .= "&f_article_code[]=$code";  
     
    134 145     }  
    135 146     $url = "Location: /$ADMIN/articles/multi_autopublish.php?".$argsStr;  
          //echo $url;  
    137 147     header($url);  
    138 148     exit;  
    146 156     }  
    147 157     $url = "Location: /$ADMIN/articles/translate.php?".$argsStr;  
          //echo $url;  
    149 158     header($url);  
    150 159     exit;  
  • trunk/campsite/implementation/management/priv/articles/translate.php

    1540  
    r4314 r4418  
    9 9 }  
    10 10    
    11   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    12   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    13   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
      11 // Optional input parameters  
      12 $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0, true);  
      13 $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0, true);  
      14 $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0, true);  
      15 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0, true);  
      16  
    14 17 $f_article_code = Input::Get(‘f_article_code’, ‘string’, 0);  
      $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
    16 18 $BackLink = Input::Get(‘Back’, ‘string’, "/$ADMIN/articles/", true);  
    17 19    
     
    22 24     exit;     
    23 25 }  
    24   $publicationObj =& new Publication($f_publication_id);  
    25   if (!$publicationObj->exists()) {  
    26       camp_html_display_error(getGS(‘Publication does not exist.’), $BackLink);  
    27       exit;     
    28   }  
    29    
    30   $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
    31   if (!$issueObj->exists()) {  
    32       camp_html_display_error(getGS(‘No such issue.’), $BackLink);  
    33       exit;     
    34   }  
    35    
    36   $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
    37   if (!$sectionObj->exists()) {  
    38       camp_html_display_error(getGS(‘No such section.’), $BackLink);  
    39       exit;         
      }  
    41 26    
    42 27 $articleObj =& new Article($languageId, $articleNumber);  
     
    46 31 }  
    47 32    
    48   if (!$User->hasPermission("AddArticle")) {  
    49       $errorStr = getGS(‘You do not have the right to change this article.  You may only edit your own articles and once submitted an article can only be changed by authorized users.’);  
      33 $f_publication_id = ($f_publication_id > 0) ? $f_publication_id : $articleObj->getPublicationId();  
      34 $f_issue_number = ($f_issue_number > 0) ? $f_issue_number : $articleObj->getIssueNumber();  
      35 $f_section_number = ($f_section_number > 0) ? $f_section_number : $articleObj->getSectionNumber();  
      36  
      37 if ($f_publication_id > 0) {  
      38     $publicationObj =& new Publication($f_publication_id);  
      39     if (!$publicationObj->exists()) {  
      40         camp_html_display_error(getGS(‘Publication does not exist.’), $BackLink);  
      41         exit;     
      42     }  
      43      
      44     $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
      45     if (!$issueObj->exists()) {  
      46         camp_html_display_error(getGS(‘No such issue.’), $BackLink);  
      47         exit;     
      48     }  
      49      
      50     $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
      51     if (!$sectionObj->exists()) {  
      52         camp_html_display_error(getGS(‘No such section.’), $BackLink);  
      53         exit;         
      54     }  
      55 }  
      56  
      57 if (!$User->hasPermission("TranslateArticle")) {  
      58     $errorStr = getGS(‘You do not have the right to translate articles.’);  
    50 59     camp_html_display_error($errorStr, $BackLink);  
    51 60     exit;     
     
    58 67 $f_language_selected = Input::Get(‘f_translation_language’, ‘int’, 0, true);  
    59 68 $f_translation_language = Input::Get(‘f_translation_language’, ‘int’, 0, true);  
    60   $f_translation_issue_name = Input::Get(‘f_issue_name’, ‘string’, $issueObj->getName(), true);  
    61   $f_translation_issue_urlname = Input::Get(‘f_issue_urlname’, ‘string’, $issueObj->getUrlName(), true);  
    62   $f_translation_section_name = Input::Get(‘f_section_name’, ‘string’, $sectionObj->getName(), true);  
    63   $f_translation_section_urlname = Input::Get(‘f_section_urlname’, ‘string’, $sectionObj->getUrlName(), true);  
      69  
      70 if ($f_publication_id > 0) {  
      71     $f_translation_issue_name = Input::Get(‘f_issue_name’, ‘string’, $issueObj->getName(), true);  
      72     $f_translation_issue_urlname = Input::Get(‘f_issue_urlname’, ‘string’, $issueObj->getUrlName(), true);  
      73     $f_translation_section_name = Input::Get(‘f_section_name’, ‘string’, $sectionObj->getName(), true);  
      74     $f_translation_section_urlname = Input::Get(‘f_section_urlname’, ‘string’, $sectionObj->getUrlName(), true);  
      75 }  
    64 76    
    65 77 $allLanguages = Language::GetLanguages();  
     
    67 79 $articleLanguages = DbObjectArray::GetColumn($articleLanguages, "Id");  
    68 80    
    69   $topArray = array(‘Pub’ => $publicationObj, ‘Issue’ => $issueObj,  
    70                     ‘Section’ => $sectionObj, ‘Article’=>$articleObj);  
    71   camp_html_content_top(getGS(‘Translate article’), $topArray, true, true);  
      81 if ($f_publication_id > 0) {  
      82     $topArray = array(‘Pub’ => $publicationObj, ‘Issue’ => $issueObj,  
      83                       ‘Section’ => $sectionObj, ‘Article’=>$articleObj);  
      84     camp_html_content_top(getGS(‘Translate article’), $topArray, true, true);  
      85 } else {  
      86     $crumbs = array();  
      87     $crumbs[] = array(getGS("Actions"), "");  
      88     $crumbs[] = array(getGS(‘Translate article’), "");  
      89     echo camp_html_breadcrumbs($crumbs);         
      90 }  
    72 91 ?>  
    73 92 <P>  
    74 93 <FORM NAME="dialog" METHOD="POST" ACTION="do_translate.php" onsubmit="return validateForm(this, 0, 1, 0, 1, 8);">  
    75 94 <INPUT TYPE="HIDDEN" NAME="f_article_code" VALUE="<?php  p($f_article_code); ?>">  
    95 <?php if ($f_publication_id > 0) { ?>  
    76 96 <INPUT TYPE="HIDDEN" NAME="f_language_id" VALUE="<?php  p($f_language_id); ?>">  
    77 97 <input type=’hidden’ name=’f_publication_id’ value="<?php p($f_publication_id); ?>">  
    78 98 <input type=’hidden’ name=’f_issue_number’ value="<?php p($f_issue_number); ?>">  
    79 99 <input type=’hidden’ name=’f_section_number’ value="<?php p($f_section_number); ?>">  
      100 <?php } ?>  
    101  
    80 102 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" class="table_input" width="600px">  
    81 103 <TR>  
    118 140 <?php  
    119 141     $canCreate = true;  
    120       if ($f_language_selected > 0) {  
      142     if ( ($f_language_selected > 0) && ($f_issue_number > 0) ) {  
    120 142         $translationIssueObj =& new Issue($f_publication_id, $f_language_selected, $f_issue_number);  
    121 143         if (!$translationIssueObj->exists()) {  
  • trunk/campsite/implementation/management/priv/articles/do_article_action.php

    r4228 r4418  
    7 7     exit;  
    8 8 }  
    9   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    10   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    11   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
    12   $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
      9 $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0, true);  
      10 $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0, true);  
      11 $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0, true);  
      12 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0, true);  
      13  
    13 14 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
    14 15 $f_article_number = Input::Get(‘f_article_number’, ‘int’, 0);  
     
    49 50         }  
    50 51         $articleObj->delete();  
    51           $url = "/$ADMIN/articles/index.php"  
    52                   ."?f_publication_id=$f_publication_id"  
    53                   ."&f_issue_number=$f_issue_number"  
    54                   ."&f_section_number=$f_section_number"  
    55                   ."&f_language_id=$f_language_id";  
      52         if ($f_publication_id > 0) {  
      53             $url = "/$ADMIN/articles/index.php"  
      54                     ."?f_publication_id=$f_publication_id"  
      55                     ."&f_issue_number=$f_issue_number"  
      56                     ."&f_section_number=$f_section_number"  
      57                     ."&f_language_id=$f_language_id";  
      58         } else {  
      59             $url = "/$ADMIN/home.php";  
      60         }  
    56 61         header("Location: $url");  
    57 62         exit;  
    67 72         $argsStr = camp_implode_keys_and_values($_REQUEST, "=", "&");  
    68 73         $argsStr .= "&f_article_code[]=".$f_article_number."_".$f_language_selected;  
    69           $argsStr .= "&f_mode=single";  
      74         $argsStr .= "&f_mode=single&f_action=duplicate";  
      75         $url = "Location: /$ADMIN/articles/duplicate.php?".$argsStr;  
      76         header($url);  
      77         exit;  
      78     case "move":  
      79         $args = $_REQUEST;  
      80         $argsStr = camp_implode_keys_and_values($_REQUEST, "=", "&");  
      81         $argsStr .= "&f_article_code[]=".$f_article_number."_".$f_language_selected;  
      82         $argsStr .= "&f_mode=single&f_action=move";  
    70 83         $url = "Location: /$ADMIN/articles/duplicate.php?".$argsStr;  
    71 84         header($url);  
  • trunk/campsite/implementation/management/priv/articles/do_edit.php

    r4228 r4418  
    153 153     exit;  
    154 154 }  
    155   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    156   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    157   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
    158   $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
      155 $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0, true);  
      156 $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0, true);  
      157 $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0, true);  
      158 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0, true);  
      159  
    159 160 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
    160 161 $f_article_number = Input::Get(‘f_article_number’, ‘int’, 0);  
  • trunk/campsite/implementation/management/priv/articles/index.php

     
    r4356 r4418  
    311 311                 <?php } ?>  
    312 312                  
      313                 <?php if ($User->hasPermission("MoveArticle")) { ?>  
      314                 <option value="move"><?php putGS("Move"); ?></OPTION>  
    315                 <?php } ?>  
    313 316                 </SELECT>  
    314 317             </TD>  
     
    426 429                         <td width="18px">  
    427 430                             <?php if (($f_article_offset > 0) || ($uniqueArticleCounter != 1)) { ?>  
    428                                   <A HREF="/<?php echo $ADMIN; ?>/articles/do_move.php?f_publication_id=<?php p($f_publication_id); ?>&f_issue_number=<?php p($f_issue_number); ?>&f_section_number=<?php p($f_section_number); ?>&f_article_number=<?php p($articleObj->getArticleNumber()); ?>&f_article_language=<?php p($articleObj->getLanguageId());?>&f_language_id=<?php p($f_language_id); ?>&f_language_selected=<?php p($f_language_selected); ?>&f_move=up_rel&f_position=1"><img src="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/up-16×16.png" width="16" height="16" border="0"></A>  
      431                                 <A HREF="/<?php echo $ADMIN; ?>/articles/do_position.php?f_publication_id=<?php p($f_publication_id); ?>&f_issue_number=<?php p($f_issue_number); ?>&f_section_number=<?php p($f_section_number); ?>&f_article_number=<?php p($articleObj->getArticleNumber()); ?>&f_article_language=<?php p($articleObj->getLanguageId());?>&f_language_id=<?php p($f_language_id); ?>&f_language_selected=<?php p($f_language_selected); ?>&f_move=up_rel&f_position=1"><img src="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/up-16×16.png" width="16" height="16" border="0"></A>  
    428 431                             <?php } ?>  
    429 432                         </td>  
    430 433                         <td width="20px">  
    431 434                             <?php if (($uniqueArticleCounter + $f_article_offset) < $numUniqueArticles) { ?>  
    432                                   <A HREF="/<?php echo $ADMIN; ?>/articles/do_move.php?f_publication_id=<?php p($f_publication_id); ?>&f_issue_number=<?php p($f_issue_number); ?>&f_section_number=<?php p($f_section_number); ?>&f_article_number=<?php p($articleObj->getArticleNumber()); ?>&f_article_language=<?php p($articleObj->getLanguageId());?>&f_language_id=<?php p($f_language_id); ?>&f_language_selected=<?php p($f_language_selected); ?>&f_move=down_rel&f_position=1"><img src="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/down-16×16.png" width="16" height="16" border="0" style="padding-left: 3px; padding-right: 3px;"></A>  
      435                                 <A HREF="/<?php echo $ADMIN; ?>/articles/do_position.php?f_publication_id=<?php p($f_publication_id); ?>&f_issue_number=<?php p($f_issue_number); ?>&f_section_number=<?php p($f_section_number); ?>&f_article_number=<?php p($articleObj->getArticleNumber()); ?>&f_article_language=<?php p($articleObj->getLanguageId());?>&f_language_id=<?php p($f_language_id); ?>&f_language_selected=<?php p($f_language_selected); ?>&f_move=down_rel&f_position=1"><img src="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/down-16×16.png" width="16" height="16" border="0" style="padding-left: 3px; padding-right: 3px;"></A>  
    432 435                             <?php } ?>  
    433 436                         </td>  
    434 437                          
    435 438                         <td>  
    436                               <select name="f_position_<?php p($counter);?>" onChange="positionValue = document.forms.article_list.f_position_<?php p($counter); ?>.options[document.forms.article_list.f_position_<?php p($counter); ?>.selectedIndex].value; url = ‘/<?php p($ADMIN);?>/articles/do_move.php?f_publication_id=<?php p($f_publication_id); ?>&f_issue_number=<?php p($f_issue_number); ?>&f_section_number=<?php p($f_section_number); ?>&f_language_id=<?php p($f_language_id); ?>&f_language_selected=<?php p($f_language_selected);?>&f_article_language=<?php p($articleObj->getLanguageId()); ?>&f_article_number=<?php p($articleObj->getArticleNumber());?>&f_move=abs&f_position=’+positionValue; " class="input_select" style="font-size: smaller;">  
      439                             <select name="f_position_<?php p($counter);?>" onChange="positionValue = document.forms.article_list.f_position_<?php p($counter); ?>.options[document.forms.article_list.f_position_<?php p($counter); ?>.selectedIndex].value; url = ‘/<?php p($ADMIN);?>/articles/do_position.php?f_publication_id=<?php p($f_publication_id); ?>&f_issue_number=<?php p($f_issue_number); ?>&f_section_number=<?php p($f_section_number); ?>&f_language_id=<?php p($f_language_id); ?>&f_language_selected=<?php p($f_language_selected);?>&f_article_language=<?php p($articleObj->getLanguageId()); ?>&f_article_number=<?php p($articleObj->getArticleNumber());?>&f_move=abs&f_position=’+positionValue; " class="input_select" style="font-size: smaller;">  
    436 439                             <?php  
    437 440                             for ($j = 1; $j <= $numUniqueArticles; $j++) {  
    505 508         </TD>         
    506 509          
    507           <?php  if ($User->hasPermission(‘AddArticle’)) { ?>  
      510         <?php  if ($User->hasPermission(‘TranslateArticle’)) { ?>  
    507 510         <TD ALIGN="CENTER">  
    508 511             <A HREF="/<?php echo $ADMIN; ?>/articles/translate.php?f_publication_id=<?php p($f_publication_id); ?>&f_issue_number=<?php p($f_issue_number); ?>&f_section_number=<?php p($f_section_number); ?>&f_article_code=<?php p($articleObj->getArticleNumber()); ?>_<?php p($articleObj->getLanguageId()); ?>&f_language_id=<?php p($f_language_id); ?>"><img src="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/translate-16×16.png" alt="<?php  putGS("Translate"); ?>" title="<?php  putGS("Translate"); ?>" border="0" width="16" height="16"></A>  
  • trunk/campsite/implementation/management/priv/articles/duplicate.php

      132    
    r4228 r4418  
    12 12 }  
    13 13    
    14   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    15   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    16   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
    17   $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
      14 // Optional input, for articles that are inside of sections.  
      15 $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0, true);  
      16 $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0, true);  
      17 $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0, true);  
      18 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0, true);  
      19  
      20  
    18 21 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
    19 22 $f_article_code = Input::Get(‘f_article_code’, ‘array’, 0);  
    20 23 $f_destination_publication_id = Input::Get(‘f_destination_publication_id’, ‘int’, 0, true);  
    21   $f_destination_issue_id = Input::Get(‘f_destination_issue_id’, ‘int’, 0, true);  
    22   $f_destination_section_id = Input::Get(‘f_destination_section_id’, ‘int’, 0, true);  
      24 $f_destination_issue_number = Input::Get(‘f_destination_issue_number’, ‘int’, 0, true);  
      25 $f_destination_section_number = Input::Get(‘f_destination_section_number’, ‘int’, 0, true);  
      26  
      27 // $f_mode can be "single" or "multi".  This governs  
      28 // the behavior of where the user goes after they perform the action.  
    23 29 $f_mode = Input::Get(‘f_mode’, ‘string’, ‘single’, true);  
    24 30    
      31 // $f_action can be "duplicate" or "move".  
      32 $f_action = Input::Get(‘f_action’);  
    33  
    25 34 // Article names can change from page request to page request.  
    26   // We create a 2-dimensional array of article names indexed by article ID, language ID.  
      35 // We create $articleNames, a 2-dimensional array of article names indexed by article ID, language ID.  
    26 35 //  
    27   // The user can choose whether to duplicate articles from page request to page request.  
    28   // We create a 2-dimensional array of boolean values indexed by article ID, language ID.  
      36 // The user can choose whether to perform an action on articles from page request to page request.  
      37 // We create $doAction, a 2-dimensional array of boolean values indexed by article ID, language ID.  
    29 38 $articleNames = array();  
    30   $doCopy = array();  
      39 $doAction = array();  
    30 39 foreach ($_REQUEST as $key => $value) {  
    31 40     if (!strncmp($key, "f_article_name_", strlen("f_article_name_"))) {  
     
    39 48         $tmpCodeStr = str_replace("f_do_copy_", "", $key);  
    40 49         list($articleId, $languageId) = split("_", $tmpCodeStr);  
    41           $doCopy[$articleId][$languageId] = Input::Get($key, ‘string’, ”, true);  
      50         $doAction[$articleId][$languageId] = Input::Get($key, ‘string’, ”, true);  
    41 50     }  
    42 51 }  
    43 52    
    44 53    
    45   // Get all the articles we are copying.  
      54 // $articles array:  
      55 // The articles that were initially selected to perform the move or duplicate upon.  
    46 56 $articles = array();  
    47 57 foreach ($f_article_code as $code) {  
     
    52 62      
    53 63     // Initialize the article names on initial page request.  
    54       // Initialize the $doCopy array on initial page request.  
      64     // Initialize the $doAction array on initial page request.  
    54 64     if (!isset($articleNames[$articleNumber][$languageId])) {  
    55 65         $articleNames[$articleNumber][$languageId] = $tmpArticle->getTitle();  
    56           $doCopy[$articleNumber][$languageId] = $languageId;  
      66         $doAction[$articleNumber][$languageId] = $languageId;  
    56 66     }  
    57 67 }  
     
    67 77     $translations = $tmpArticle->getTranslations();  
    68 78     foreach ($translations as $article) {  
    69           if (!isset($articleNames[$article->getArticleNumber()][$article->getLanguageId()])) {  
    70               $articleNames[$article->getArticleNumber()][$article->getLanguageId()] = $article->getTitle();  
      79         $articleNumber = $article->getArticleNumber();  
      80         $articleLanguage = $article->getLanguageId();  
      81         if (!isset($articleNames[$articleNumber][$articleLanguage])) {  
      82             $articleNames[$articleNumber][$articleLanguage] = $article->getTitle();  
      83         }  
      84         if (!isset($articles[$articleNumber][$articleLanguage])) {  
      85             $articles[$articleNumber][$articleLanguage] = $article;  
    71 86         }  
    72 87     }  
     
    78 93 }  
    79 94    
    80   $publicationObj =& new Publication($f_publication_id);  
    81   if (!$publicationObj->exists()) {  
    82       camp_html_display_error(getGS(‘Publication does not exist.’));  
    83       exit;     
      95 if ($f_publication_id > 0) {  
      96     $publicationObj =& new Publication($f_publication_id);  
      97     if (!$publicationObj->exists()) {  
      98         camp_html_display_error(getGS(‘Publication does not exist.’));  
      99         exit;     
      100     }  
      101      
      102     $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
      103     if (!$issueObj->exists()) {  
      104         camp_html_display_error(getGS(‘Issue does not exist.’));  
      105         exit;     
      106     }  
      107      
      108     $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
      109     if (!$sectionObj->exists()) {  
      110         camp_html_display_error(getGS(‘Section does not exist.’));  
      111         exit;     
      112     }  
    84 113 }  
    85 114    
    86   $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
    87   if (!$issueObj->exists()) {  
    88       camp_html_display_error(getGS(‘Issue does not exist.’));  
    89       exit;     
      115 // Get all the publications  
      116 $allPublications = Publication::GetPublications();  
      117 // Automatically select the publication if there is only one.  
      118 if (count($allPublications) == 1) {  
      119     $tmpPublication = camp_array_peek($allPublications);  
      120     $f_destination_publication_id = $tmpPublication->getPublicationId();  
    90 121 }  
    91 122    
    92   $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
    93   if (!$sectionObj->exists()) {  
    94       camp_html_display_error(getGS(‘Section does not exist.’));  
    95       exit;     
      123 // Get the most recent issues.  
      124 $allIssues = array();  
      125 if ($f_destination_publication_id > 0) {  
      126     $allIssues = Issue::GetIssues($f_destination_publication_id, null, null, null, array("LIMIT" => 50, "ORDER BY" => array("Number" => "DESC")));  
      127     // Automatically select the issue if there is only one.  
      128     if (count($allIssues) == 1) {  
      129         $tmpIssue = camp_array_peek($allIssues);  
      130         $f_destination_issue_number = $tmpIssue->getIssueNumber();  
      131     }  
      132 }  
      133  
      134 // Get all the sections.  
      135 $allSections = array();  
      136 if ($f_destination_issue_number > 0) {  
      137     $allSections = Section::GetSections($f_destination_publication_id, $f_destination_issue_number);  
      138     // Automatically select the section if there is only one.  
      139     if (count($allSections) == 1) {  
      140         $tmpSection = camp_array_peek($allSections);  
      141         $f_destination_section_number = $tmpSection->getSectionNumber();  
      142     }  
      143 }  
      144  
      145  
      146 // Special case:  
      147 // You cannot copy the articles if there is no cooresponding translated issue/section  
      148 // in the destination issue.  For example, you cannot copy a french article to an  
      149 // issue that has ONLY an english translation.  
      150 $issueLanguages = array();  
      151 if ($f_destination_issue_number > 0) {  
      152     $issueTranslations = Issue::GetIssues($f_destination_publication_id, null, $f_destination_issue_number);  
      153     $issueLanguages = DbObjectArray::GetColumn($issueTranslations, "IdLanguage");  
      154 }  
      155 // $actionDenied is TRUE if any articles cannot be moved/duped.  
      156 $actionDenied = false;  
      157 foreach ($articles as $articleNumber => $languageArray) {  
      158     foreach ($languageArray as $languageId => $article) {  
      159         $tmpActionDenied = (count($issueLanguages) > 0) && !in_array($languageId, $issueLanguages);  
      160         $actionDenied |= $tmpActionDenied;  
      161          
      162         // Uncheck any articles that cannot be moved/duped.  
      163         if ($tmpActionDenied) {  
      164             unset($doAction[$articleNumber][$languageId]);  
      165             if (count($doAction[$articleNumber]) == 0) {  
      166                 unset($doAction[$articleNumber]);  
      167             }  
      168         }  
      169     }  
    96 170 }  
    97 171    
    172  
    98 173 //  
    99 174 // This section is executed when the user finally hits the "duplicate" button.  
    100 175 //  
    101   if (isset($_REQUEST["duplicate_button"])) {  
    102       foreach ($doCopy as $articleNumber => $languageArray) {  
    103           $languageArray = array_keys($languageArray);  
    104           //echo "<pre>"; print_r($languageArray); echo "</pre>";  
    105            
    106           $tmpLanguageId = camp_array_peek($languageArray);  
    107            
    108           // Error checking  
    109           if (!isset($articles[$articleNumber][$tmpLanguageId])) {  
    110               //echo "error $articleNumber:$tmpLanguageId<br>";  
    111               continue;  
      176 if (isset($_REQUEST["action_button"])) {  
      177     if ($f_action == "duplicate") {  
      178         foreach ($doAction as $articleNumber => $languageArray) {  
      179             $languageArray = array_keys($languageArray);  
      180             //echo "<pre>"; print_r($languageArray); echo "</pre>";  
      181              
      182             $tmpLanguageId = camp_array_peek($languageArray);  
      183              
      184             // Error checking  
      185             if (!isset($articles[$articleNumber][$tmpLanguageId])) {  
      186                 //echo "error $articleNumber:$tmpLanguageId<br>";  
      187                 continue;  
      188             }  
      189              
      190             //echo "copying $articleNumber:$tmpLanguageId<br>";  
      191             // Grab the first article – it doesnt matter which one.  
      192             $tmpArticle = $articles[$articleNumber][$tmpLanguageId];  
      193              
      194             // Copy all the translations requested.  
      195             $newArticles = $tmpArticle->copy($f_destination_publication_id,  
      196                                              $f_destination_issue_number,  
      197                                              $f_destination_section_number,  
      198                                              $User->getUserId(),  
      199                                              $languageArray);  
      200              
      201             // Set the names of the new copies  
      202             foreach ($newArticles as $newArticle) {  
      203                 $newArticle->setTitle($articleNames[$articleNumber][$newArticle->getLanguageId()]);  
      204             }  
    112 205         }  
    113            
    114           //echo "copying $articleNumber:$tmpLanguageId<br>";  
    115           // Grab the first article – it doesnt matter which one.  
    116           $tmpArticle = $articles[$articleNumber][$tmpLanguageId];  
    117            
    118           // Copy all the translations requested.  
    119           $newArticles = $tmpArticle->copy($f_destination_publication_id,  
    120                                            $f_destination_issue_id,  
    121                                            $f_destination_section_id,  
    122                                            $User->getUserId(),  
    123                                            $languageArray);  
    124            
    125           // Set the names of the new copies  
    126           foreach ($newArticles as $newArticle) {  
    127               $newArticle->setTitle($articleNames[$articleNumber][$newArticle->getLanguageId()]);  
      206         if ($f_mode == "single") {  
      207             $tmpArticle = camp_array_peek($newArticles);  
      208             $url = camp_html_article_url($tmpArticle, $f_language_id, "edit.php");  
      209         } else {  
      210             $tmpArticle = camp_array_peek(camp_array_peek($articles));  
      211             $url = camp_html_article_url($tmpArticle, 0, "index.php");  
    128 212         }  
    129       }  
    130       if ($f_mode == "single") {  
    131           $tmpArticle = camp_array_peek($newArticles);  
              $url = camp_html_article_url($tmpArticle, $f_language_id, "edit.php");  
    133 213         header("Location: $url");  
    134       } else {  
    135           $tmpArticle = camp_array_peek(camp_array_peek($articles));  
    136           $url = camp_html_article_url($tmpArticle, $f_language_id, "index.php");  
      214         exit;  
      215          
      216     } elseif ($f_action == "move") {  
      217  
      218         // Move all the translations requested.  
      219         $tmpArticles = array();  
      220         foreach ($doAction as $articleNumber => $languageArray) {  
      221             foreach ($languageArray as $languageId => $action) {  
      222                 //echo "copying $articleNumber:$tmpLanguageId<br>";  
      223                 $tmpArticle =& new Article($languageId, $articleNumber);  
      224                  
      225                 $tmpArticle->move($f_destination_publication_id,  
      226                                   $f_destination_issue_number,  
      227                                   $f_destination_section_number);  
      228                  
      229                 $tmpArticle->setTitle($articleNames[$articleNumber][$languageId]);  
      230                 $tmpArticles[] = $tmpArticle;  
      231             }  
      232         }  
      233         $tmpArticle = camp_array_peek($tmpArticles);  
      234         if ($f_mode == "single") {  
      235             $url = camp_html_article_url($tmpArticle, $f_language_id, "edit.php");  
      236         } else {  
      237             $url = camp_html_article_url($tmpArticle, $f_language_id, "index.php");  
      238         }  
    137 239         header("Location: $url");  
    240         exit;         
    138 241     }  
    139       exit;  
    140   }  
      242 } // END perform the action  
    141 243    
    142   $allPublications = Publication::GetPublications();  
    143   $allIssues = array();  
    144   if ($f_destination_publication_id > 0) {  
    145       $allIssues = Issue::GetIssues($f_destination_publication_id, $f_language_id);  
    146   }  
    147   $allSections = array();  
    148   if ($f_destination_issue_id > 0) {  
    149       $allSections = Section::GetSections($f_destination_publication_id, $f_destination_issue_id, $f_language_id);  
      244  
      245 $title = "";  
      246 if (count($doAction) > 1) {  
      247     if ($f_action == "duplicate") {  
      248         $title = getGS("Duplicate articles");  
      249     } elseif ($f_action == "move") {  
      250         $title = getGS("Move articles");  
      251     }  
      252 } else {  
      253     if ($f_action == "duplicate") {  
      254         $title = getGS("Duplicate article");  
      255     } elseif ($f_action == "move") {  
      256         $title = getGS("Move article");  
      257     }  
    150 258 }  
    151 259    
    152   $topArray = array(‘Pub’ => $publicationObj, ‘Issue’ => $issueObj,  
    153                     ‘Section’ => $sectionObj);  
    154   if (count($articles) > 1) {  
    155       $crumbs = array(getGS("Articles") => "/$ADMIN/articles/index.php?f_publication_id=$f_publication_id&f_issue_number=$f_issue_number&f_section_number=$f_section_number&f_language_id=$f_language_id&f_language_selected=$f_language_selected");  
    156       camp_html_content_top(getGS("Duplicate articles"), $topArray, true, false, $crumbs);  
    157   }  
    158   else {  
    159       $topArray[‘Article’] = camp_array_peek(camp_array_peek($articles));  
    160       camp_html_content_top(getGS("Duplicate article"), $topArray);  
      260 if ($f_publication_id > 0) {  
      261     $topArray = array(‘Pub’ => $publicationObj, ‘Issue’ => $issueObj,  
      262                       ‘Section’ => $sectionObj);  
      263     if (count($articles) > 1) {  
      264         $crumbs = array(getGS("Articles") => "/$ADMIN/articles/index.php?f_publication_id=$f_publication_id&f_issue_number=$f_issue_number&f_section_number=$f_section_number&f_language_id=$f_language_id&f_language_selected=$f_language_selected");  
      265         camp_html_content_top($title, $topArray, true, false, $crumbs);  
      266     } else {  
      267         $topArray[‘Article’] = camp_array_peek(camp_array_peek($articles));  
      268         camp_html_content_top($title, $topArray);  
      269     }  
      270 } else {  
      271     $crumbs = array();  
      272     $crumbs[] = array(getGS("Actions"), "");  
      273     $crumbs[] = array($title, "");  
      274     echo camp_html_breadcrumbs($crumbs);     
    161 275 }  
    162 276 ?>  
     
    164 278 <P>  
    165 279 <div class="page_title">  
    166   <?php putGS("Duplicate articles"); ?>:  
      280 <?php p($title); ?>:  
    166 280 </div>  
    167 281    
    168 282 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" style="margin-left: 5px;">  
    169   <FORM NAME="duplicate" METHOD="POST">  
      283 <FORM NAME="move_duplicate" METHOD="POST">  
      284 <?php if ($f_publication_id > 0) { ?>  
    170 285 <input type="hidden" name="f_publication_id" value="<?php p($f_publication_id); ?>">  
    171 286 <input type="hidden" name="f_issue_number" value="<?php p($f_issue_number); ?>">  
    172 287 <input type="hidden" name="f_section_number" value="<?php p($f_section_number); ?>">  
    173 288 <input type="hidden" name="f_language_id" value="<?php p($f_language_id); ?>">  
    289 <?php } ?>  
    174 290 <input type="hidden" name="f_mode" value="<?php p($f_mode); ?>">  
    291 <input type="hidden" name="f_action" value="<?php p($f_action); ?>">  
    175 292 <?php  
    176 293 foreach ($articles as $languageArray) {  
     
    187 304         <TABLE cellpadding="3">  
    188 305         <TR class="table_list_header">  
    189               <TD valign="top"><?php putGS("Duplicate?"); ?></TD>  
      306             <TD valign="top"><?php ($f_action == "duplicate") ? putGS("Duplicate?") : putGS("Move?"); ?></TD>  
    189 306             <TD valign="top"><?php putGS("Name"); ?></TD>  
    190 307             <TD valign="top"><?php putGS("Language"); ?></TD>  
     
    197 314         foreach ($articles as $languageArray) {  
    198 315             $count = 0;  
    199               $tmpArticle = camp_array_peek($languageArray);  
    200               $translations = $tmpArticle->getTranslations();  
    201               foreach ($translations as $article) {  
      316             foreach ($languageArray as $languageId => $article) {  
      317                 $bad = (count($issueLanguages) > 0) && !in_array($languageId, $issueLanguages);  
      318                 $articleNumber = $article->getArticleNumber();  
    202 319             ?>  
    203           <TR class="<?php if ($color) { ?>list_row_even<?php } else { ?>list_row_odd<?php } $color = !$color; ?>">  
    204               <TD>  
    205                   <input type="checkbox" name="f_do_copy_<?php p($article->getArticleNumber()."_".$article->getLanguageId()); ?>" value="" <?php if (isset($doCopy[$article->getArticleNumber()][$article->getLanguageId()])) { ?>CHECKED<?php } ?>>  
      320         <TR class="<?php if ($color) { ?>list_row_even<?php } else { ?>list_row_odd<?php } $color = !$color; ?>" >  
      321             <TD <?php if ($bad) { ?>style="border-left: 3px solid #AF2041; background-color: #FFD4E4;"<?php } ?>>  
      322                 <input type="checkbox" name="f_do_copy_<?php p($articleNumber."_".$languageId); ?>" value="" <?php if ($bad) { echo "disabled"; } elseif (isset($doAction[$articleNumber][$languageId])) { echo "CHECKED"; } ?>>  
    206 323             </TD>  
    207               <TD <?php if ($count++ > 0) { ?>class="translation_indent"<?php } ?>>  
    208                   <INPUT TYPE="TEXT" NAME="f_article_name_<?php p($article->getArticleNumber()."_".$article->getLanguageId()); ?>" SIZE="50" MAXLENGTH="256" VALUE="<?php  p(htmlspecialchars($articleNames[$article->getArticleNumber()][$article->getLanguageId()])); ?>" class="input_text">  
      324             <TD <?php if ($count++ > 0) { ?>class="translation_indent"<?php } ?> <?php if ($bad) { ?>style="background-color: #FFD4E4;"<?php } ?>>  
      325                 <INPUT TYPE="TEXT" NAME="f_article_name_<?php p($articleNumber."_".$languageId); ?>" SIZE="50" MAXLENGTH="256" VALUE="<?php  p(htmlspecialchars($articleNames[$articleNumber][$languageId])); ?>" class="input_text">  
    209 326             </TD>  
    210 327              
    211               <TD>  
      328             <TD <?php if ($bad) { ?>style="background-color: #FFD4E4"<?php } ?>>  
    211 328                 <B><?php p(htmlspecialchars($article->getLanguageName())); ?></B>  
    212 329             </TD>  
    213 330              
    214               <TD>  
      331             <TD <?php if ($bad) { ?>style="background-color: #FFD4E4; border-right: 3px solid #AF2041;"<?php } ?>>  
    214 331                 <B><?php p(htmlspecialchars($article->getType())); ?></B>  
    215 332             </TD>  
     
    226 343 </TR>  
    227 344 </TABLE>  
      345  
      346 <?php if ($actionDenied) { ?>  
      347 <table width="565px">  
      348 <tr>  
      349     <td colspan="2" style="padding-left: 17px; padding-bottom: 8px;" align="center">  
      350         <div style="border: 1px solid #AF2041; background-color: #FFD4E4; font-size: 12pt; padding: 5px; font-weight: bold; color: #AF2041;">  
      351         <?php  
      352             putGS("You cannot $1 the articles marked in red because the destination issue has not been translated into the appropriate language.", ($f_action == "move") ? getGS("move") : getGS("duplicate"));  
      353         ?>  
      354         </div>  
      355     </td>  
      356 </tr>  
      357 </table>  
      358 <?php } ?>       
    359  
    228 360 <p>  
    229 361 <div class="page_title">  
     
    231 363 </div>  
    232 364 <p>  
    233   <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" class="table_input">  
      365 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" class="table_input" width="400px">  
    233 365 <TR>  
    234       <TD>  
    235           <TABLE>  
      366     <TD align="left">  
      367         <TABLE align="left" border="0">  
    236 368         <TR>  
    237 369             <td colspan="2" style="padding-left: 20px; padding-bottom: 5px;font-size: 12pt; font-weight: bold;"><?php  putGS("Select destination"); ?></TD>  
    238 370         </TR>  
    239 371         <TR>  
    240               <TD VALIGN="middle" ALIGN="RIGHT" style="padding-left: 20px;"><?php  putGS(‘Publication’); ?>: </TD>  
    241               <TD valign="middle" ALIGN="LEFT">  
    242                   <?php if (count($allPublications) > 0) { ?>  
    243                   <SELECT NAME="f_destination_publication_id" class="input_select" ONCHANGE="if ((this.selectedIndex != 0) && (this.options[this.selectedIndex].value != <?php p($f_destination_publication_id); ?>)) {this.form.submit();}">  
    244                   <OPTION VALUE="0"><?php  putGS(‘—Select publication—‘); ?></option>  
    245                   <?php  
    246                   foreach ($allPublications as $tmpPublication) {  
    247                       camp_html_select_option($tmpPublication->getPublicationId(), $f_destination_publication_id, $tmpPublication->getName());  
    248                   }  
    249                   ?>  
    250                   </SELECT>  
    251                   <?php  
    252                   }  
    253                   else {  
    254                       ?>  
    255                       <SELECT class="input_select" DISABLED><OPTION><?php  putGS(‘No publications’); ?></option></SELECT>  
    256                       <?php  
    257                   }  
    258                   ?>  
    259               </td>  
    260           </tr>  
    261            
    262           <tr>  
    263               <TD VALIGN="middle" ALIGN="RIGHT" style="padding-left: 20px;"><?php  putGS(‘Issue’); ?>: </TD>  
    264               <TD valign="middle" ALIGN="LEFT">  
    265                   <?php if (($f_destination_publication_id > 0) && (count($allIssues) > 0)) { ?>  
    266                   <SELECT NAME="f_destination_issue_id" class="input_select" ONCHANGE="if ((this.selectedIndex != 0) && (this.options[this.selectedIndex].value != <?php p($f_destination_issue_id); ?>)) { this.form.submit(); }">  
    267                   <OPTION VALUE="0"><?php  putGS(‘—Select issue—‘); ?></option>  
    268                   <?php  
    269                   foreach ($allIssues as $tmpIssue) {  
    270                       camp_html_select_option($tmpIssue->getIssueNumber(), $f_destination_issue_id, $tmpIssue->getName());  
    271                   }  
    272                   ?>  
    273                   </SELECT>  
    274                   <?php   
    275                   }  
    276                   else {  
    277                       ?><SELECT class="input_select" DISABLED><OPTION><?php  putGS(‘No issues’); ?></SELECT>  
    278                       <?php   
    279                   }  
    280                   ?>  
    281               </td>  
    282           </tr>  
    283            
    284           <tr>     
    285               <TD VALIGN="middle" ALIGN="RIGHT" style="padding-left: 20px;"><?php  putGS(‘Section’); ?>: </TD>  
    286               <TD valign="middle" ALIGN="LEFT">  
    287                   <?php if (($f_destination_issue_id > 0) && (count($allSections) > 0)) { ?>  
    288                   <SELECT NAME="f_destination_section_id" class="input_select" ONCHANGE="if ((this.selectedIndex != 0) && (this.options[this.selectedIndex].value != <?php p($f_destination_section_id); ?>)) { this.form.submit(); }">  
    289                   <OPTION VALUE="0"><?php  putGS(‘—Select section—‘); ?>  
    290                   <?php  
    291                   foreach ($allSections as $tmpSection) {  
    292                       camp_html_select_option($tmpSection->getSectionNumber(), $f_destination_section_id, $tmpSection->getName());  
    293                   }  
    294                   ?>  
    295                   </SELECT>  
    296                   <?php   
    297                   }  
    298                   else {  
    299                       ?><SELECT class="input_select" DISABLED><OPTION><?php  putGS(‘No sections’); ?></SELECT>  
    300                       <?php   
    301                   }  
    302                   ?>  
    303                   </TD>  
      372             <td>  
      373                 <!– BEGIN table for pub/issue/section selection –>  
      374                 <table>  
      375                 <tr>  
      376                     <TD VALIGN="middle" ALIGN="RIGHT" style="padding-left: 20px;"><?php  putGS(‘Publication’); ?>: </TD>  
      377                     <TD valign="middle" ALIGN="LEFT">  
      378                         <?php if (count($allPublications) > 1) { ?>  
      379                         <SELECT NAME="f_destination_publication_id" class="input_select" ONCHANGE="if (this.options[this.selectedIndex].value != <?php p($f_destination_publication_id); ?>) {this.form.submit();}">  
      380                         <OPTION VALUE="0"><?php  putGS(‘—Select publication—‘); ?></option>  
      381                         <?php  
      382                         foreach ($allPublications as $tmpPublication) {  
      383                             camp_html_select_option($tmpPublication->getPublicationId(), $f_destination_publication_id, $tmpPublication->getName());  
      384                         }  
      385                         ?>  
      386                         </SELECT>  
      387                         <?php } elseif (count($allPublications) == 1) {  
      388                             $tmpPublication = camp_array_peek($allPublications);  
      389                             p(htmlspecialchars($tmpPublication->getName()));  
      390                             ?>  
      391                             <input type="hidden" name="f_destination_publication_id" value="<?php p($tmpPublication->getPublicationId()); ?>">  
      392                              
      393                         <?php } else { ?>  
      394                             <SELECT class="input_select" DISABLED><OPTION><?php  putGS(‘No publications’); ?></option></SELECT>  
      395                         <?php } ?>  
      396                     </td>  
      397                 </tr>  
      398                  
      399                 <tr>  
      400                     <TD VALIGN="middle" ALIGN="RIGHT" style="padding-left: 20px;"><?php  putGS(‘Issue’); ?>: </TD>  
      401                     <TD valign="middle" ALIGN="LEFT">  
      402                         <?php if (($f_destination_publication_id > 0) && (count($allIssues) > 1)) { ?>  
      403                         <SELECT NAME="f_destination_issue_number" class="input_select" ONCHANGE="if (this.options[this.selectedIndex].value != <?php p($f_destination_issue_number); ?>) { this.form.submit(); }">  
      404                         <OPTION VALUE="0"><?php  putGS(‘—Select issue—‘); ?></option>  
      405                         <?php  
      406                         foreach ($allIssues as $tmpIssue) {  
      407                             camp_html_select_option($tmpIssue->getIssueNumber(), $f_destination_issue_number, $tmpIssue->getIssueNumber().". ".$tmpIssue->getName()." (".$tmpIssue->getLanguageName().")");  
      408                         }  
      409                         ?>  
      410                         </SELECT>  
      411                         <?php } elseif (($f_destination_publication_id > 0) && (count($allIssues) == 1)) {  
      412                             $tmpIssue = camp_array_peek($allIssues);  
      413                             p(htmlspecialchars($tmpIssue->getName()));  
      414                             ?>  
      415                             <input type="hidden" name="f_destination_issue_number" value="<?php p($tmpIssue->getIssueNumber()); ?>">  
      416                         <?php } else { ?>  
      417                             <SELECT class="input_select" DISABLED><OPTION><?php  putGS(‘No issues’); ?></SELECT>  
      418                         <?php } ?>  
      419                     </td>  
      420                 </tr>  
      421                  
      422                 <tr>     
      423                     <TD VALIGN="middle" ALIGN="RIGHT" style="padding-left: 20px;"><?php  putGS(‘Section’); ?>: </TD>  
      424                     <TD valign="middle" ALIGN="LEFT">  
      425                         <?php if (($f_destination_issue_number > 0) && (count($allSections) > 1)) { ?>  
      426                         <SELECT NAME="f_destination_section_number" class="input_select" ONCHANGE="if (this.options[this.selectedIndex].value != <?php p($f_destination_section_number); ?>) { this.form.submit(); }">  
      427                         <OPTION VALUE="0"><?php  putGS(‘—Select section—‘); ?>  
      428                         <?php  
      429                         foreach ($allSections as $tmpSection) {  
      430                             camp_html_select_option($tmpSection->getSectionNumber(), $f_destination_section_number, $tmpSection->getName()." (".$tmpSection->getLanguageName().")");  
      431                         }  
      432                         ?>  
      433                         </SELECT>  
      434                         <?php } elseif (($f_destination_issue_number > 0) && (count($allSections) == 1)) {  
      435                             $tmpSection = camp_array_peek($allSections);  
      436                             p(htmlspecialchars($tmpSection->getName()));  
      437                             ?>  
      438                             <input type="hidden" name="f_destination_section_number" value="<?php p($tmpSection->getSectionNumber()); ?>">  
      439                         <?php } else { ?>  
      440                             <SELECT class="input_select" DISABLED><OPTION><?php  putGS(‘No sections’); ?></SELECT>  
      441                         <?php } ?>  
      442                     </td>  
      443                 </tr>  
      444                 </table>  
      445                 <!– END table for pub/issue/section selection –>  
      446             </TD>  
    304 447         </tr>  
    305 448          
    306 449         <tr>  
    307 450             <td colspan="2"><?php  
    308                   if ( ($f_publication_id == $f_destination_publication_id) && ($f_issue_number == $f_destination_issue_id) && ($f_section_number == $f_destination_section_id)) {  
      451                 if ( ($f_publication_id == $f_destination_publication_id) && ($f_issue_number == $f_destination_issue_number) && ($f_section_number == $f_destination_section_number)) {  
    308 451                     putGS("The destination section is the same as the source section."); echo "<BR>n";  
    309 452                 }  
    315 458         <tr>  
    316 459             <td align="center" colspan="2">  
    317                   <INPUT TYPE="submit" Name="duplicate_button" Value="<?php putGS("Duplicate article"); ?>" <?php if (($f_destination_publication_id <= 0) || ($f_destination_issue_id <=0) || ($f_destination_section_id <= 0)) { echo ‘class="button_disabled"’; } else { echo "class="button""; }?> >  
      460                 <INPUT TYPE="submit" Name="action_button" Value="<?php p($title); ?>" <?php if ( (count($doAction) <= 0) || ($f_destination_publication_id <= 0) || ($f_destination_issue_number <= 0) || ($f_destination_section_number <= 0)) { echo ‘class="button_disabled"’; } else { echo "class="button""; }?> >  
    317 460             </td>  
    318 461         </tr>  
  • trunk/campsite/implementation/management/priv/articles/do_add.php

     
    r4192 r4418  
    15 15    
    16 16 // Get input  
    17   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    18   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    19   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
    20   $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
      17 $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0, true);  
      18 $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0, true);  
      19 $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0, true);  
      20 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0, true);  
      21  
      22 // For choosing the article location.  
      23 $f_destination_publication_id = Input::Get(‘f_destination_publication_id’, ‘int’, 0, true);  
      24 $f_destination_issue_number = Input::Get(‘f_destination_issue_number’, ‘int’, 0, true);  
      25 $f_destination_section_number = Input::Get(‘f_destination_section_number’, ‘int’, 0, true);  
      26  
    21 27 $f_article_name = trim(Input::Get(‘f_article_name’, ‘string’, ”));  
    22 28 $f_article_type = trim(Input::Get(‘f_article_type’, ‘string’, ”));  
    23 29 $f_article_language = trim(Input::Get(‘f_article_language’, ‘int’, 0));  
    24 30    
      31 $f_language_id = ($f_language_id > 0) ? $f_language_id : $f_article_language;  
    32  
    25 33 // Check input  
    26 34 if (empty($f_article_name)) {  
     
    44 52 }  
    45 53    
    46   $publicationObj =& new Publication($f_publication_id);  
    47   if (!$publicationObj->exists()) {  
    48       camp_html_display_error(getGS(‘Publication does not exist.’));  
    49       exit;     
    50   }  
    51    
    52   $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
    53   if (!$issueObj->exists()) {  
    54       camp_html_display_error(getGS(‘Issue does not exist.’));  
    55       exit;     
    56   }  
      54 $publication_id = ($f_destination_publication_id > 0) ? $f_destination_publication_id : $f_publication_id;  
      55 $issue_number = ($f_destination_issue_number > 0) ? $f_destination_issue_number : $f_issue_number;  
      56 $section_number = ($f_destination_section_number > 0) ? $f_destination_section_number : $f_section_number;  
      57  
      58 if ($publication_id > 0) {  
      59     $publicationObj =& new Publication($publication_id);  
      60     if (!$publicationObj->exists()) {  
      61         camp_html_display_error(getGS(‘Publication does not exist.’));  
      62         exit;     
      63     }  
    57 64    
    58   $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
    59   if (!$sectionObj->exists()) {  
    60       camp_html_display_error(getGS(‘Section does not exist.’));  
    61       exit;     
      65     if ($issue_number > 0) {  
      66         $issueObj =& new Issue($publication_id, $f_article_language, $issue_number);  
      67         if (!$issueObj->exists()) {  
      68             camp_html_display_error(getGS(‘Issue does not exist.’));  
      69             exit;     
      70         }  
      71  
      72         if ($section_number > 0) {  
      73             $sectionObj =& new Section($publication_id, $issue_number, $f_article_language, $section_number);  
      74             if (!$sectionObj->exists()) {  
      75                 camp_html_display_error(getGS(‘Section does not exist.’));  
      76                 exit;     
      77             }  
      78         }  
      79     }  
    62 80 }  
    63 81    
    66 84 $articleObj->create($f_article_type, $f_article_name);  
    67 85 if ($articleObj->exists()) {  
    68       $articleObj->setPublicationId($f_publication_id);  
    69       $articleObj->setIssueNumber($f_issue_number);  
    70       $articleObj->setSectionNumber($f_section_number);  
      86     if ($publication_id > 0) {  
      87         $articleObj->setPublicationId($publication_id);  
      88     }  
      89     if ($issue_number > 0) {  
      90         $articleObj->setIssueNumber($issue_number);  
      91     }  
      92     if ($section_number > 0) {  
      93         $articleObj->setSectionNumber($section_number);  
      94     }  
      95      
    71 96     $articleObj->setUserId($User->getUserId());  
    72 97     $articleObj->setIsPublic(true);  
  • trunk/campsite/implementation/management/priv/articles/topics/do_add.php

    r4298 r4418  
    23 23     $articleObj =& new Article($f_language_selected, $f_article_number);  
    24 24     if (!$articleObj->exists()) {  
    25           camp_html_display_error(getGS(‘Article does not exist.’));  
      25         camp_html_display_error(getGS(‘Article does not exist.’), null, true);  
    25 25         exit;         
    26 26     }  
    27 27      
    28       if (!$articleObj->userCanModify($User)) {  
    29           camp_html_display_error(getGS("You do not have the right to add topics to article."));  
      28     if (!$User->hasPermission(‘AttachTopicToArticle’)) {  
      29         camp_html_display_error(getGS("You do not have the right to attach topics to articles."), null, true);  
    30 30         exit;     
    31 31     }  
  • trunk/campsite/implementation/management/priv/articles/topics/popup.php

     
    r4194 r4418  
    12 12 }  
    13 13    
      14 if (!$User->hasPermission("AttachTopicToArticle")) {  
      15     $errorStr = getGS(‘You do not have the right to attach topics to articles.’);  
      16     camp_html_display_error($errorStr, null, true);  
      17     exit;     
      18 }  
    19  
    14 20 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
    15 21 $f_article_number = Input::Get(‘f_article_number’, ‘int’, 0);  
    16 22    
    17 23 if (!Input::IsValid()) {  
    18       camp_html_display_error(getGS(‘Invalid input: $1’, Input::GetErrorString()), $_SERVER[‘REQUEST_URI’]);  
      24     camp_html_display_error(getGS(‘Invalid input: $1’, Input::GetErrorString()), $_SERVER[‘REQUEST_URI’], true);  
    18 24     exit;     
    19 25 }  
  • trunk/campsite/implementation/management/priv/articles/topics/do_del.php

    r4260 r4418  
    33 33 }  
    34 34    
    35   if (!$articleObj->userCanModify($User)) {  
    36       camp_html_display_error(getGS("You do not have the right to add topics to article."));  
      35 if (!$User->hasPermission(‘AttachTopicToArticle’)) {  
      36     camp_html_display_error(getGS("You do not have the right to attach topics to articles."));  
    37 37     exit;     
    38 38 }  
  • trunk/campsite/implementation/management/priv/articles/editor_load_xinha.php

      
    r4395 r4418  
    168 168     ‘FullScreen’,  
    169 169     <?php } ?>  
    170       ‘WordPaste’,  
      170     <?php if ($p_user->hasPermission(‘EditorCharacterMap’)) { ?>  
    170 170     ‘CharacterMap’,  
      171     <?php } ?>  
    172     <?php if ($p_user->hasPermission(‘EditorFindReplace’)) { ?>  
    171 173     ‘FindReplace’,  
    172       //’RemoveParagraphs’  
      174     <?php } ?>  
      175     ‘WordPaste’  
    173 176   ];  
    174 177     // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  🙂  
    218 221    // Change the removeformat button to work in text mode.  
    219 222    xinha_config.btnList["removeformat"] = [ "Remove formatting", ["ed_buttons_main.gif",4,4], true, function(e) {e.execCommand("removeformat");} ],  
      223      
    224    <?php if ($p_user->hasPermission(‘EditorFindReplace’)) { ?>  
    220 225    // Put the "find-replace" plugin in a better location  
    221 226    xinha_config.addToolbarElement([], ["FR-findreplace"], 0);  
    222    
      227    <?php } ?>  
      228      
    223 229    // Add in our style sheet for the "subheads".  
    224 230    xinha_config.pageStyle = "<?php echo str_replace("n", "", file_get_contents($stylesheetFile)); ?>";  
  • trunk/campsite/implementation/management/priv/articles/files/do_add.php

    23
    r4298 r4418  
    19 19 }  
    20 20    
    21   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    22   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
      $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
    24 21 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
    25 22 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
  • trunk/campsite/implementation/management/priv/articles/files/popup.php

    2682
    r4129 r4418  
    22 22 }  
    23 23    
    24   $publicationObj =& new Publication($f_publication_id);  
    25   $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
      $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
    27 24 $articleObj =& new Article($f_language_selected, $f_article_number);  
    28 25 ?>  
    78 75     <TD COLSPAN="2">  
    79 76     <DIV ALIGN="CENTER">  
    80       <INPUT TYPE="HIDDEN" NAME="f_publication_id" VALUE="<?php  p($f_publication_id); ?>">  
    81       <INPUT TYPE="HIDDEN" NAME="f_issue_number" VALUE="<?php  p($f_issue_number); ?>">  
          <INPUT TYPE="HIDDEN" NAME="f_section_number" VALUE="<?php  p($f_section_number); ?>">  
    83 77     <INPUT TYPE="HIDDEN" NAME="f_article_number" VALUE="<?php  p($f_article_number); ?>">  
    84 78     <INPUT TYPE="HIDDEN" NAME="f_language_id" VALUE="<?php  p($f_language_id); ?>">  
  • trunk/campsite/implementation/management/priv/articles/files/do_del.php

    25
    r4145 r4418  
    21 21 }  
    22 22    
    23   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    24   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
      $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
    26 23 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
    27 24 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
    42 39 }  
    43 40    
    44   // This file can only be accessed if the user has the right to change articles  
    45   // or the user created this article and it hasnt been published yet.  
    46   if (!$articleObj->userCanModify($User)) {  
    47       camp_html_display_error(getGS("You do not have the right to change this article.  You may only edit your own articles and once submitted an article can only be changed by authorized users."));  
      41 if (!$User->hasPermission("DeleteFile")) {  
      42     camp_html_display_error(getGS("You do not have the right to delete file attachments."));  
    48 43     exit;         
    49 44 }  
  • trunk/campsite/implementation/management/priv/articles/do_translate.php

    r4314 r4418  
    9 9 }  
    10 10    
    11   $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
    12   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    13   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    14   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
      11 // Optional input.  
      12 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0, true);  
      13 $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0, true);  
      14 $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0, true);  
      15 $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0, true);  
      16  
      17 // Required input.  
    15 18 $f_article_code = Input::Get(‘f_article_code’, ‘string’, 0);  
    16 19 $f_translation_title = trim(Input::Get(‘f_translation_title’));  
    45 48 }  
    46 49    
    47   $f_publication_id = $articleObj->getProperty(‘IdPublication’);  
    48   $publicationObj =& new Publication($f_publication_id);  
    49   if (!$publicationObj->exists()) {  
    50       camp_html_display_error(getGS(‘Publication does not exist.’), $BackLink);  
    51       exit;     
    52   }  
    53    
    54   $f_issue_number = $articleObj->getProperty(‘NrIssue’);  
    55   $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
    56   if (!$issueObj->exists()) {  
    57       camp_html_display_error(getGS(‘No such issue.’), $BackLink);  
    58       exit;     
    59   }  
      50 $f_publication_id = $articleObj->getPublicationId();  
    60 51    
    61   $translationIssueObj =& new Issue($f_publication_id, $f_translation_language, $f_issue_number);  
    62   if (!$translationIssueObj->exists()) {  
    63       if (!$User->hasPermission("ManageIssue")) {  
    64           camp_html_display_error(getGS(‘An issue must be created for the selected language but you do not have the right to create an issue.’), $BackLink);  
    65           exit;  
    66       }  
    67       foreach ($issueObj->getData() as $field=>$fieldValue) {  
    68           if ($field != ‘IdLanguage’) {  
    69               $translationIssueObj->setProperty($field, $fieldValue, false);  
    70           }  
      52 // Only create the translated issue and section if the article has been  
      53 // categorized.  
      54 if ($f_publication_id > 0) {  
      55     $publicationObj =& new Publication($f_publication_id);  
      56     if (!$publicationObj->exists()) {  
      57         camp_html_display_error(getGS(‘Publication does not exist.’), $BackLink);  
      58         exit;     
      59     }  
      60      
      61     $f_issue_number = $articleObj->getIssueNumber();  
      62     $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
      63     if (!$issueObj->exists()) {  
      64         camp_html_display_error(getGS(‘No such issue.’), $BackLink);  
      65         exit;     
    71 66     }  
    72       $f_issue_name = Input::Get(‘f_issue_name’, ‘string’, ”);  
    73       if ($f_issue_name != ”) {  
    74           $translationIssueObj->setName($f_issue_name);  
    75       }  
    76       $f_issue_urlname = Input::Get(‘f_issue_urlname’, ‘string’, $issueObj->getUrlName());  
    77       if ($f_issue_urlname == "") {  
    78           camp_html_display_error(getGS(‘You must complete the $1 field.’,’"’.getGS(‘New issue URL name’).’"’), $BackLink);  
    79           exit;  
    80       }  
    81       if (!camp_is_valid_url_name($f_issue_urlname)) {  
    82           camp_html_display_error(getGS(‘The $1 field may only contain letters, digits and underscore (_) character.’, ‘"’ . getGS(‘New issue URL name’) . ‘"’), $BackLink);  
    83           exit;  
    84       }  
    85       $translationIssueObj->create($f_issue_urlname);  
      67      
      68     $translationIssueObj =& new Issue($f_publication_id, $f_translation_language, $f_issue_number);  
    86 69     if (!$translationIssueObj->exists()) {  
    87           camp_html_display_error(getGS(‘Unable to create the issue for translation $1.’, $translationLanguageObj->getName()), $BackLink);  
    88           exit;  
    89       }  
    90   }  
    91    
    92   $f_section_number = $articleObj->getProperty(‘NrSection’);  
    93   $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
    94   if (!$sectionObj->exists()) {  
    95       camp_html_display_error(getGS(‘No such section.’), $BackLink);  
    96       exit;         
    97   }  
    98    
    99   $translationSectionObj =& new Section($f_publication_id, $f_issue_number, $f_translation_language,  
    100                                         $f_section_number);  
    101   if (!$translationSectionObj->exists()) {  
    102       if (!$User->hasPermission("ManageSection")) {  
    103           camp_html_display_error(getGS(‘A section must be created for the selected language but you do not have the right to create a section.’), $BackLink);  
    104           exit;  
    105       }  
    106       foreach ($sectionObj->getData() as $field=>$fieldValue) {  
    107           if ($field != ‘IdLanguage’) {  
    108               $translationSectionObj->setProperty($field, $fieldValue, false);  
      70         if (!$User->hasPermission("ManageIssue")) {  
      71             camp_html_display_error(getGS(‘An issue must be created for the selected language but you do not have the right to create an issue.’), $BackLink);  
      72             exit;  
      73         }  
      74         foreach ($issueObj->getData() as $field=>$fieldValue) {  
      75             if ($field != ‘IdLanguage’) {  
      76                 $translationIssueObj->setProperty($field, $fieldValue, false);  
      77             }  
      78         }  
      79         $f_issue_name = Input::Get(‘f_issue_name’, ‘string’, ”);  
      80         if ($f_issue_name != ”) {  
      81             $translationIssueObj->setName($f_issue_name);  
      82         }  
      83         $f_issue_urlname = Input::Get(‘f_issue_urlname’, ‘string’, $issueObj->getUrlName());  
      84         if ($f_issue_urlname == "") {  
      85             camp_html_display_error(getGS(‘You must complete the $1 field.’,’"’.getGS(‘New issue URL name’).’"’), $BackLink);  
      86             exit;  
      87         }  
      88         if (!camp_is_valid_url_name($f_issue_urlname)) {  
      89             camp_html_display_error(getGS(‘The $1 field may only contain letters, digits and underscore (_) character.’, ‘"’ . getGS(‘New issue URL name’) . ‘"’), $BackLink);  
      90             exit;  
      91         }  
      92         $translationIssueObj->create($f_issue_urlname);  
      93         if (!$translationIssueObj->exists()) {  
      94             camp_html_display_error(getGS(‘Unable to create the issue for translation $1.’, $translationLanguageObj->getName()), $BackLink);  
      95             exit;  
    109 96         }  
    110 97     }  
    111       $f_section_name = Input::Get(‘f_section_name’, ‘string’, $sectionObj->getName());  
    112       $f_section_urlname = Input::Get(‘f_section_urlname’, ‘string’, $sectionObj->getUrlName());  
    113       if ($f_section_urlname == "") {  
    114           camp_html_display_error(getGS(‘You must complete the $1 field.’,’"’.getGS(‘New section URL name’).’"’), $BackLink);  
    115           exit;  
    116       }  
    117       if (!camp_is_valid_url_name($f_section_urlname)) {  
    118           camp_html_display_error(getGS(‘The $1 field may only contain letters, digits and underscore (_) character.’, ‘"’ . getGS(‘New section URL name’) . ‘"’), $BackLink);  
    119           exit;  
    120       }  
    121       $translationSectionObj->create($f_section_name, $f_section_urlname);  
      98      
      99     $f_section_number = $articleObj->getSectionNumber();  
      100     $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
      101     if (!$sectionObj->exists()) {  
      102         camp_html_display_error(getGS(‘No such section.’), $BackLink);  
      103         exit;         
      104     }  
      105      
      106     $translationSectionObj =& new Section($f_publication_id, $f_issue_number, $f_translation_language,  
      107                                           $f_section_number);  
    122 108     if (!$translationSectionObj->exists()) {  
    123           camp_html_display_error(getGS(‘Unable to create the section for translation $1.’, $translationLanguageObj->getName()), $BackLink);  
    124           exit;  
      109         if (!$User->hasPermission("ManageSection")) {  
      110             camp_html_display_error(getGS(‘A section must be created for the selected language but you do not have the right to create a section.’), $BackLink);  
      111             exit;  
      112         }  
      113         foreach ($sectionObj->getData() as $field=>$fieldValue) {  
      114             if ($field != ‘IdLanguage’) {  
      115                 $translationSectionObj->setProperty($field, $fieldValue, false);  
      116             }  
      117         }  
      118         $f_section_name = Input::Get(‘f_section_name’, ‘string’, $sectionObj->getName());  
      119         $f_section_urlname = Input::Get(‘f_section_urlname’, ‘string’, $sectionObj->getUrlName());  
      120         if ($f_section_urlname == "") {  
      121             camp_html_display_error(getGS(‘You must complete the $1 field.’,’"’.getGS(‘New section URL name’).’"’), $BackLink);  
      122             exit;  
      123         }  
      124         if (!camp_is_valid_url_name($f_section_urlname)) {  
      125             camp_html_display_error(getGS(‘The $1 field may only contain letters, digits and underscore (_) character.’, ‘"’ . getGS(‘New section URL name’) . ‘"’), $BackLink);  
      126             exit;  
      127         }  
      128         $translationSectionObj->create($f_section_name, $f_section_urlname);  
      129         if (!$translationSectionObj->exists()) {  
      130             camp_html_display_error(getGS(‘Unable to create the section for translation $1.’, $translationLanguageObj->getName()), $BackLink);  
      131             exit;  
      132         }  
    125 133     }  
    126 134 }  
  • trunk/campsite/implementation/management/priv/articles/images/do_add.php

    27
    r4298 r4418  
    23 23 }  
    24 24    
    25   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    26   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
      $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
    28 25 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
    29 26 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
  • trunk/campsite/implementation/management/priv/articles/images/do_link.php

    20
    r4298 r4418  
    15 15 }  
    16 16    
    17   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    18   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    19   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
      $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
    21 17 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
    22 18 $f_article_number = Input::Get(‘f_article_number’, ‘int’, 0);  
     
    24 20    
    25 21 if (!Input::IsValid()) {  
    26       camp_html_display_error(getGS(‘Invalid input: $1’, Input::GetErrorString()));  
      22     camp_html_display_error(getGS(‘Invalid input: $1’, Input::GetErrorString()), null, true);  
    26 22     exit;  
    27 23 }  
     
    30 26 $articleObj =& new Article($f_language_selected, $f_article_number);  
    31 27 if (!$articleObj->exists()) {  
    32       camp_html_display_error(getGS(‘Article does not exist.’));  
      28     camp_html_display_error(getGS(‘Article does not exist.’), null, true);  
    32 28     exit;         
    33 29 }  
     
    36 32 $imageObj =& new Image($f_image_id);  
    37 33 if (!$imageObj->exists()) {  
    38       camp_html_display_error(getGS(‘Image does not exist.’));  
      34     camp_html_display_error(getGS(‘Image does not exist.’), null, true);  
    38 34     exit;     
    39 35 }  
    42 38 // This file can only be accessed if the user has the right to change articles  
    43 39 // or the user created this article and it hasnt been published yet.  
    44   if (!$articleObj->userCanModify($User)) {  
    45       camp_html_display_error(getGS("You do not have the right to change this article.  You may only edit your own articles and once submitted an article can only be changed by authorized users."));  
      40 if (!$User->hasPermission(‘AttachImageToArticle’)) {  
      41     camp_html_display_error(getGS("You do not have the right to attach images to articles."), null, true);  
    46 42     exit;         
    47 43 }  
  • trunk/campsite/implementation/management/priv/articles/images/do_unlink.php

    19
    r4145 r4418  
    15 15 }  
    16 16    
    17   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    18   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
      $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
    20 17 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
    21 18 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
     
    26 23 // Check input  
    27 24 if (!Input::IsValid()) {  
    28       camp_html_display_error(getGS(‘Invalid input: $1’, Input::GetErrorString()));  
      25     camp_html_display_error(getGS(‘Invalid input: $1’, Input::GetErrorString()), null, true);  
    28 25     exit;  
    29 26 }  
    34 31 // This file can only be accessed if the user has the right to change articles  
    35 32 // or the user created this article and it hasnt been published yet.  
    36   if (!$articleObj->userCanModify($User)) {  
    37       camp_html_display_error(getGS("You do not have the right to change this article.  You may only edit your own articles and once submitted an article can only be changed by authorized users."));  
      33 if (!$User->hasPermission(‘AttachImageToArticle’)) {  
      34     camp_html_display_error(getGS("You do not have the right to attach images to articles."), null, true);  
    38 35     exit;         
    39 36 }  
  • trunk/campsite/implementation/management/priv/articles/images/popup.php

    30
    r4269 r4418  
    13 13 }  
    14 14    
    15   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    16   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    17   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
      15 if (!$User->hasPermission("AttachImageToArticle")) {  
      16     $errorStr = getGS(‘You do not have the right to attach images to articles.’);  
      17     camp_html_display_error($errorStr, null, true);  
      18     exit;     
      19 }  
      20  
    18 21 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
    19 22 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
     
    26 29 }  
    27 30    
    28   $publicationObj =& new Publication($f_publication_id);  
    29   $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
      $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
    31 31 $articleObj =& new Article($f_language_selected, $f_article_number);  
    32 32 ?>  
    41 41 <table style="margin-top: 10px; margin-left: 5px;" cellpadding="0" cellspacing="0">  
    42 42 <tr>  
    43       <td style="padding: 3px; background-color: #EEE; border-top: 1px solid #8baed1; border-right: 1px solid #8baed1; border-left: 1px solid #8baed1; <?php if ($f_image_attach_mode != "new") { ?>border-bottom: 1px solid #8baed1;<?php } ?>"><a href="<?php echo camp_html_article_url($articleObj, $f_language_id, "images/popup.php", "", "&f_image_attach_mode=new"); ?>"><img src="<?php p($Campsite[‘ADMIN_IMAGE_BASE_URL’]); ?>/add.png" border="0"><b><?php putGS("Attach New Image"); ?></b></a></td>  
    44       <td style="padding: 3px; background-color: #EEE; border-top: 1px solid #8baed1; border-right: 1px solid #8baed1; <?php if ($f_image_attach_mode != "existing") { ?>border-bottom: 1px solid #8baed1;<?php } ?>"><a href="<?php echo camp_html_article_url($articleObj, $f_language_id, "images/popup.php", "", "&f_image_attach_mode=existing"); ?>"><img src="<?php p($Campsite[‘ADMIN_IMAGE_BASE_URL’]); ?>/add.png" border="0"><b><?php putGS("Attach Existing Image"); ?></b></a></td>  
      43     <?php if ($User->hasPermission(‘AddImage’)) { ?>  
      44     <td style="padding: 3px; background-color: #EEE; border-top: 1px solid #8baed1; border-left: 1px solid #8baed1; <?php if ($f_image_attach_mode != "new") { ?>border-bottom: 1px solid #8baed1;<?php } ?>"><a href="<?php echo camp_html_article_url($articleObj, $f_language_id, "images/popup.php", "", "&f_image_attach_mode=new"); ?>"><img src="<?php p($Campsite[‘ADMIN_IMAGE_BASE_URL’]); ?>/add.png" border="0"><b><?php putGS("Attach New Image"); ?></b></a></td>  
      45     <?php } ?>  
      46      
      47     <td style="padding: 3px; background-color: #EEE; border-top: 1px solid #8baed1; border-right: 1px solid #8baed1; border-left: 1px solid #8baed1; <?php if ($f_image_attach_mode != "existing") { ?>border-bottom: 1px solid #8baed1;<?php } ?>"><a href="<?php echo camp_html_article_url($articleObj, $f_language_id, "images/popup.php", "", "&f_image_attach_mode=existing"); ?>"><img src="<?php p($Campsite[‘ADMIN_IMAGE_BASE_URL’]); ?>/add.png" border="0"><b><?php putGS("Attach Existing Image"); ?></b></a></td>  
    45 48 </tr>  
    46 49 <tr>  
  • trunk/campsite/implementation/management/priv/articles/images/edit.php

    3335
    r4145 r4418  
    31 31 $imageObj =& new Image($f_image_id);  
    32 32    
      $isDisabled = ”;  
    34 33 if (!$User->hasPermission(‘ChangeImage’)) {  
          $isDisabled = ‘readonly’;  
    36 34     $title = getGS(‘Image information’);  
    37 35 } else {  
     
    61 59     <TD ALIGN="RIGHT" ><?php  putGS(‘Number’); ?>:</TD>  
    62 60     <TD>  
    63       <INPUT TYPE="TEXT" NAME="f_image_template_id" VALUE="<?php echo $f_image_template_id; ?>" class="input_text" SIZE="32" MAXLENGTH="10" <?php p($isDisabled); ?>>  
      61         <?php if ($User->hasPermission(‘AttachImageToArticle’)) { ?>  
      62         <INPUT TYPE="TEXT" NAME="f_image_template_id" VALUE="<?php echo $f_image_template_id; ?>" class="input_text" SIZE="32" MAXLENGTH="10">  
      63         <?php } else {  
      64             echo $f_image_template_id;  
      65         } ?>  
    64 66     </TD>  
    65 67 </TR>  
     
    67 69     <TD ALIGN="RIGHT" ><?php  putGS(‘Description’); ?>:</TD>  
    68 70     <TD>  
    69       <INPUT TYPE="TEXT" NAME="f_image_description" VALUE="<?php echo htmlspecialchars($imageObj->getDescription()); ?>" class="input_text" SIZE="32" MAXLENGTH="128"  <?php p($isDisabled); ?>>  
      71         <?php if ($User->hasPermission(‘ChangeImage’)) { ?>  
      72         <INPUT TYPE="TEXT" NAME="f_image_description" VALUE="<?php echo htmlspecialchars($imageObj->getDescription()); ?>" class="input_text" SIZE="32" MAXLENGTH="128">  
      73         <?php } else {  
      74             echo htmlspecialchars($imageObj->getDescription());  
      75         } ?>  
    70 76     </TD>  
    71 77 </TR>  
     
    73 79     <TD ALIGN="RIGHT" ><?php  putGS(‘Photographer’); ?>:</TD>  
    74 80     <TD>  
    75       <INPUT TYPE="TEXT" NAME="f_image_photographer" VALUE="<?php echo htmlspecialchars($imageObj->getPhotographer());?>" class="input_text" SIZE="32" MAXLENGTH="64" <?php p($isDisabled); ?>>  
      81         <?php if ($User->hasPermission(‘ChangeImage’)) { ?>  
      82         <INPUT TYPE="TEXT" NAME="f_image_photographer" VALUE="<?php echo htmlspecialchars($imageObj->getPhotographer());?>" class="input_text" SIZE="32" MAXLENGTH="64">  
      83         <?php } else {  
      84             echo htmlspecialchars($imageObj->getPhotographer());  
      85         } ?>  
    76 86     </TD>  
    77 87 </TR>  
     
    79 89     <TD ALIGN="RIGHT" ><?php  putGS(‘Place’); ?>:</TD>  
    80 90     <TD>  
    81       <INPUT TYPE="TEXT" NAME="f_image_place" VALUE="<?php echo htmlspecialchars($imageObj->getPlace()); ?>" class="input_text" SIZE="32" MAXLENGTH="64" <?php p($isDisabled); ?>>  
      91         <?php if ($User->hasPermission(‘ChangeImage’)) { ?>  
      92         <INPUT TYPE="TEXT" NAME="f_image_place" VALUE="<?php echo htmlspecialchars($imageObj->getPlace()); ?>" class="input_text" SIZE="32" MAXLENGTH="64">  
      93         <?php } else {  
      94             echo htmlspecialchars($imageObj->getPlace());  
      95         } ?>  
    82 96     </TD>  
    83 97 </TR>  
    85 99     <TD ALIGN="RIGHT" ><?php  putGS(‘Date’); ?>:</TD>  
    86 100     <TD>  
    87       <INPUT TYPE="TEXT" NAME="f_image_date" VALUE="<?php echo htmlspecialchars($imageObj->getDate()); ?>" class="input_text" SIZE="11" MAXLENGTH="10" <?php p($isDisabled); ?>> <?php putGS(‘YYYY-MM-DD’); ?>  
      101         <?php if ($User->hasPermission(‘ChangeImage’)) { ?>  
      102         <INPUT TYPE="TEXT" NAME="f_image_date" VALUE="<?php echo htmlspecialchars($imageObj->getDate()); ?>" class="input_text" SIZE="11" MAXLENGTH="10">  
      103         <?php } else {  
      104             echo htmlspecialchars($imageObj->getDate());  
      105         } ?>  
      106         <?php putGS(‘YYYY-MM-DD’); ?>  
    88 107     </TD>  
    89 108 </TR>  
    90   <?php if ($User->hasPermission(‘ChangeImage’)) { ?>  
      109 <?php if ($User->hasPermission(‘ChangeImage’) || $User->hasPermission(‘AttachImageToArticle’)) { ?>  
    90 109 <TR>  
    91 110     <TD COLSPAN="2">  
  • trunk/campsite/implementation/management/priv/articles/images/do_edit.php

    245063
    r4228 r4418  
    19 19 }  
    20 20    
    21   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    22   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    23   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
      $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
    25 21 $f_language_selected = Input::Get(‘f_language_selected’, ‘int’, 0);  
    26 22 $f_article_number = Input::Get(‘f_article_number’, ‘int’, 0);  
    27 23 $f_image_id = Input::Get(‘f_image_id’, ‘int’, 0);  
    28   $f_image_template_id = Input::Get(‘f_image_template_id’, ‘int’, 0, true);  
    29   $f_image_description = trim(Input::Get(‘f_image_description’, ‘string’, ”, true));  
    30   $f_image_photographer = trim(Input::Get(‘f_image_photographer’, ‘string’, ”, true));  
    31   $f_image_place = trim(Input::Get(‘f_image_place’, ‘string’, ”, true));  
    32   $f_image_date = Input::Get(‘f_image_date’, ‘string’, ”, true);  
      24  
      25 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0, true);  
      26 $f_image_template_id = Input::Get(‘f_image_template_id’, ‘int’, null, true);  
      27 $f_image_description = trim(Input::Get(‘f_image_description’, ‘string’, null, true));  
      28 $f_image_photographer = trim(Input::Get(‘f_image_photographer’, ‘string’, null, true));  
      29 $f_image_place = trim(Input::Get(‘f_image_place’, ‘string’, null, true));  
      30 $f_image_date = Input::Get(‘f_image_date’, ‘string’, null, true);  
    33 31    
    34 32 if (!Input::IsValid()) {  
     
    38 36    
    39 37 $articleObj =& new Article($f_language_selected, $f_article_number);  
    40   $publicationObj =& new Publication($f_publication_id);  
    41   $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
    42   $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
      38  
      39 if (!$User->hasPermission(‘ChangeImage’) && !$User->hasPermission(‘AttachImageToArticle’)) {  
      40     $ref = camp_html_article_url($articleObj, $f_language_id, ‘edit.php’);   
      41     header("Location: $ref");  
      42 }  
      43  
    43 44    
    44 45 $imageObj =& new Image($f_image_id);  
    45   $attributes = array();  
    46   $attributes[‘Description’] = $f_image_description;  
    47   $attributes[‘Photographer’] = $f_image_photographer;  
    48   $attributes[‘Place’] = $f_image_place;  
    49   $attributes[‘Date’] = $f_image_date;  
      $view = Input::Get(‘view’, ‘string’, ‘thumbnail’, true);  
    51 46    
    52   if ($User->hasPermission(‘ChangeImage’)) {  
    53       $imageObj->update($attributes);  
      47 if (!is_null($f_image_description) && $User->hasPermission(‘ChangeImage’)) {  
      48     $attributes = array();  
      49     $attributes[‘Description’] = $f_image_description;  
      50     $attributes[‘Photographer’] = $f_image_photographer;  
      51     $attributes[‘Place’] = $f_image_place;  
      52     $attributes[‘Date’] = $f_image_date;     
      53     if ($User->hasPermission(‘ChangeImage’)) {  
      54         $imageObj->update($attributes);  
      55     }  
    54 56 }  
    55   if ($articleObj->userCanModify($User)) {     
      57  
      58 if ($User->hasPermission(‘AttachImageToArticle’)) {  
    56 59     if (is_numeric($f_image_template_id) && ($f_image_template_id > 0)) {  
    57 60         ArticleImage::SetTemplateId($f_article_number, $f_image_id, $f_image_template_id);  
    60 63    
    61 64 $ref = camp_html_article_url($articleObj, $f_language_id, ‘edit.php’);  
    62    
      // Go back to article image list.  
    64 65 header("Location: $ref");  
    65 66    
  • trunk/campsite/implementation/management/priv/articles/edit.php

    45 95  
    r4354 r4418  
    11 11 }  
    12 12    
    13   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    14   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    15   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
    16   $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
      13 // These are optional, depending on whether you are in a section  
      14 // or whether editing an article that doesnt have a location.  
      15 $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0, true);  
      16 $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0, true);  
      17 $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0, true);  
      18 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0, true);  
      19  
    17 20 $f_article_number = Input::Get(‘f_article_number’, ‘int’, 0);  
    18 21 $f_unlock = Input::Get(‘f_unlock’, ‘string’, false, true);  
     
    41 44 $lockUserObj =& new User($articleObj->getLockedByUser());  
    42 45 $articleCreator =& new User($articleObj->getCreatorId());  
    43   $publicationObj =& new Publication($f_publication_id);  
    44   $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
      $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
    46 46 $articleEvents = ArticlePublish::GetArticleEvents($f_article_number, $f_language_selected, true);  
    47 47 $articleTopics = ArticleTopic::GetArticleTopics($f_article_number, $f_language_selected);  
    48 48 $articleFiles = ArticleAttachment::GetAttachmentsByArticleNumber($f_article_number, $f_language_selected);  
    49 49    
      50 if ($f_publication_id > 0) {  
      51     $publicationObj =& new Publication($f_publication_id);  
      52     $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
      53     $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
      54 }  
    55  
    50 56 // Automatically switch to "view" mode if user doesnt have permissions.  
    51 57 if (!$articleObj->userCanModify($User)) {  
     
    92 98 // Begin Display of page  
    93 99 //  
    94   $topArray = array(‘Pub’ => $publicationObj, ‘Issue’ => $issueObj,  
                        ‘Section’ => $sectionObj, ‘Article’=>$articleObj);  
    96 100 if ($f_edit_mode == "edit") {  
    97 101     $title = getGS("Edit article");  
     
    99 103 else {  
    100 104     $title = getGS("View article");  
    101   }       
    102   camp_html_content_top($title, $topArray);  
      105 }  
      106  
      107 if ($f_publication_id > 0) {  
      108     $topArray = array(‘Pub’ => $publicationObj, ‘Issue’ => $issueObj,  
      109                       ‘Section’ => $sectionObj, ‘Article’=>$articleObj);  
      110     camp_html_content_top($title, $topArray);  
      111 } else {  
      112     $crumbs = array();  
      113     $crumbs[] = array(getGS("Actions"), "");  
      114     $crumbs[] = array($title, "");  
      115     echo camp_html_breadcrumbs($crumbs);     
      116 }  
    103 117    
    104 118 $hasArticleBodyField = false;  
     
    239 253                         <?php  if ($User->hasPermission(‘AddArticle’)) { ?>  
    240 254                         <OPTION value="copy"><?php putGS("Duplicate"); ?></OPTION>  
      255                         <?php } ?>  
      256                          
    257                         <?php if ($User->hasPermission(‘TranslateArticle’)) { ?>  
    241 258                         <OPTION value="translate"><?php putGS("Translate"); ?></OPTION>  
    242                           <?php } ?>               
      259                         <?php } ?>  
      260                          
      261                         <?php if ($User->hasPermission(‘MoveArticle’)) { ?>  
      262                         <OPTION value="move"><?php putGS("Move"); ?></OPTION>  
      263                         <?php } ?>  
    243 264                         </SELECT>  
    244 265                     </TD>  
      266                      
    267                     <?php if ($f_publication_id > 0) { ?>  
    245 268                     <TD>  
    246 269                         <!– Preview Link –>  
    247 270                         <A HREF="" ONCLICK="window.open(‘/<?php echo $ADMIN; ?>/articles/preview.php?f_publication_id=<?php  p($f_publication_id); ?>&f_issue_number=<?php  p($f_issue_number); ?>&f_section_number=<?php  p($f_section_number); ?>&f_article_number=<?php  p($f_article_number); ?>&f_language_id=<?php  p($f_language_id); ?>&f_language_selected=<?php  p($f_language_selected); ?>’, ‘fpreview’, ‘resizable=yes, menubar=no, toolbar=no, width=680, height=560’); return false"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/preview.png" BORDER="0" alt="<?php putGS("Preview"); ?>" title="<?php putGS("Preview"); ?>"></A>  
    248 271                     </TD>  
    249            
      272                     <?php } ?>  
      273                      
    250 274                     <!– BEGIN Workflow –>  
    251 275                     <TD style="padding-left: 1em;">  
     
    659 683                         <b><?php putGS("Images"); ?></b>  
    660 684                         </td>  
    661                           <?php if (($f_edit_mode == "edit") && $User->hasPermission(‘AddImage’)) {  ?>  
      685                         <?php if (($f_edit_mode == "edit") && $User->hasPermission(‘AttachImageToArticle’)) {  ?>  
    661 685                         <td align="right">  
    662 686                             <img src="<?php p($Campsite["ADMIN_IMAGE_BASE_URL"]);?>/add.png" border="0">  
     
    686 710                             <?php if ($f_edit_mode == "edit") { ?><a href="<?php p($imageEditUrl); ?>"><?php } ?><img src="<?php p($image->getThumbnailUrl()); ?>" border="0"><?php if ($f_edit_mode == "edit") { ?></a><?php } ?>  
    687 711                         </td>  
    688                           <?php if ($f_edit_mode == "edit") { ?>  
      712                         <?php if (($f_edit_mode == "edit") && $User->hasPermission(‘AttachImageToArticle’)) { ?>  
    688 712                         <td>  
    689 713                             <a href="<?php p($detachUrl); ?>" onclick="return confirm(‘<?php putGS("Are you sure you want to remove the image \’$1\’ from the article?", camp_javascriptspecialchars($image->getDescription())); ?>’);"><img src="<?php p($Campsite["ADMIN_IMAGE_BASE_URL"]);?>/unlink.png" border="0"></a>  
     
    768 792                         <b><?php putGS("Topics"); ?></b>  
    769 793                         </td>  
    770                           <?php if ($f_edit_mode == "edit") {  ?>  
      794                         <?php if (($f_edit_mode == "edit") && $User->hasPermission(‘AttachTopicToArticle’)) {  ?>  
    770 794                         <td align="right">  
    771 795                             <img src="<?php p($Campsite["ADMIN_IMAGE_BASE_URL"]);?>/add.png" border="0">  
    796 820                             <?php p(wordwrap($pathStr, 25, "<br>  ", true)); ?>  
    797 821                         </td>  
    798                           <?php if ($f_edit_mode == "edit") { ?>  
      822                         <?php if (($f_edit_mode == "edit") && $User->hasPermission(‘AttachTopicToArticle’)) { ?>  
    798 822                         <td>  
    799 823                             <a href="<?php p($detachUrl); ?>" onclick="return confirm(‘<?php putGS("Are you sure you want to remove the topic \’$1\’ from the article?", camp_javascriptspecialchars($tmpArticleTopic->getName())); ?>’);"><img src="<?php p($Campsite["ADMIN_IMAGE_BASE_URL"]);?>/unlink.png" border="0"></a>  
  • trunk/campsite/implementation/management/priv/articles/do_move.php

    r4238 r4418  
    57 57 switch ($f_move) {  
    58 58 case ‘up_rel’:  
    59       $articleObj->moveRelative(‘up’, 1);  
      59     $articleObj->positionRelative(‘up’, 1);  
    59 59     break;  
    60 60 case ‘down_rel’:  
    61       $articleObj->moveRelative(‘down’, 1);  
      61     $articleObj->positionRelative(‘down’, 1);  
    61 61     break;  
    62 62 case ‘abs’:  
    63       $articleObj->moveAbsolute($f_position);  
      63     $articleObj->positionAbsolute($f_position);  
    63 63     break;  
    64 64 default: ;  
  • trunk/campsite/implementation/management/priv/articles/add.php

          
    r4386 r4418  
    3 3 require_once($_SERVER[‘DOCUMENT_ROOT’]. "/classes/ArticleType.php");  
    4 4    
      5 global $Campsite;  
    6  
    5 7 list($access, $User) = check_basic_access($_REQUEST);  
    6 8 if (!$access) {  
     
    13 15 }  
    14 16    
    15   $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0);  
    16   $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0);  
    17   $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0);  
    18   $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0);  
      17 // Only for use when in the article screens.  
      18 $f_publication_id = Input::Get(‘f_publication_id’, ‘int’, 0, true);  
      19 $f_issue_number = Input::Get(‘f_issue_number’, ‘int’, 0, true);  
      20 $f_section_number = Input::Get(‘f_section_number’, ‘int’, 0, true);  
      21 $f_language_id = Input::Get(‘f_language_id’, ‘int’, 0, true);  
      22  
      23 // The article location dropdowns cause this page to reload,  
      24 // so we need to preserve the state with each refresh.  
      25 $f_article_name = Input::Get(‘f_article_name’, ‘string’, ”, true);  
      26 $f_article_type = Input::Get(‘f_article_type’, ‘string’, ”, true);  
      27 $f_article_language = Input::Get(‘f_article_language’, ‘int’, $f_language_id, true);  
      28  
      29 // For choosing the article location.  
      30 $f_destination_publication_id = Input::Get(‘f_destination_publication_id’, ‘int’, 0, true);  
      31 $f_destination_issue_number = Input::Get(‘f_destination_issue_number’, ‘int’, 0, true);  
      32 $f_destination_section_number = Input::Get(‘f_destination_section_number’, ‘int’, 0, true);  
    19 33    
    20 34 if (!Input::IsValid()) {  
     
    23 37 }  
    24 38    
    25   $publicationObj =& new Publication($f_publication_id);  
    26   $issueObj =& new Issue($f_publication_id, $f_language_id, $f_issue_number);  
    27   $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);  
      39 // Only for the article screens.  
      40 $publicationObj = null;  
      41 $issueObj = null;  
      42 $sectionObj = null;  
      43 if ($f_publication_id > 0) {  
      44     $publicationObj =& new Publication($f_publication_id);  
      45     if (($f_issue_number > 0) && ($f_article_language > 0)) {  
      46         $issueObj =& new Issue($f_publication_id, $f_article_language, $f_issue_number);  
      47         if ($f_section_number > 0) {  
      48             $sectionObj =& new Section($f_publication_id, $f_issue_number, $f_article_language, $f_section_number);  
      49         }  
      50     }  
      51 }  
    28 52    
    29 53 $allArticleTypes = ArticleType::GetArticleTypes();  
    30 54 $allLanguages = Language::GetLanguages();  
    31 55    
    32   ## added by sebastian  
      56 // added by sebastian  
    32 56 if (function_exists ("incModFile")) {  
    33 57     incModFile ();  
    34 58 }  
    35 59    
    36   $topArray = array(‘Pub’ => $publicationObj, ‘Issue’ => $issueObj,  
    37                     ‘Section’ => $sectionObj);  
    38   camp_html_content_top(getGS(‘Add new article’), $topArray, true, true, array(getGS("Articles") => "/$ADMIN/articles/?f_publication_id=$f_publication_id&f_issue_number=$f_issue_number&f_section_number=$f_section_number&f_language_id=$f_language_id"));  
      60 if ($f_publication_id > 0) {  
      61     $topArray = array(‘Pub’ => $publicationObj, ‘Issue’ => $issueObj,  
      62                       ‘Section’ => $sectionObj);  
      63     camp_html_content_top(getGS(‘Add new article’), $topArray, true, false, array(getGS("Articles") => "/$ADMIN/articles/?f_publication_id=$f_publication_id&f_issue_number=$f_issue_number&f_section_number=$f_section_number&f_language_id=$f_language_id"));  
      64 } else {  
      65     $crumbs = array();  
      66     $crumbs[] = array(getGS("Actions"), "");  
      67     $crumbs[] = array(getGS("Add new article"), "");  
      68     echo camp_html_breadcrumbs($crumbs);  
      69 }  
    39 70    
    40 71 ?>  
     
    44 75 if (sizeof($allArticleTypes) == 0) {  
    45 76 ?>  
    46   <p><table border="0" cellspacing="0" cellpadding="6" align="center" class="table_input">  
    47       <tr>  
    48           <td align="center">  
    49           <font color="red">  
    50           <?php putGS("No article types were defined. You must create an article type first."); ?>  
    51           </font>  
    52           <p><b><a href="/<?php echo $ADMIN; ?>/article_types/"><?php putGS("Edit article types"); ?></a></b></p>  
    53           </td>  
    54       </tr>  
    55   </table></p>  
      77 <p>  
      78 <table border="0" cellspacing="0" cellpadding="6" align="center" class="table_input">  
      79 <tr>  
      80     <td align="center">  
      81     <font color="red">  
      82     <?php putGS("No article types were defined. You must create an article type first."); ?>  
      83     </font>  
      84     <p><b><a href="/<?php echo $ADMIN; ?>/article_types/"><?php putGS("Edit article types"); ?></a></b></p>  
      85     </td>  
      86 </tr>  
      87 </table>  
      88 </p>  
    56 89 <?php  
    57 90 } else {  
    58 91 ?>  
    59 92    
      93 <script type="text/javascript" src="<?php echo $Campsite[‘WEBSITE_URL’]; ?>/javascript/fValidate/fValidate.config.js"></script>  
      94 <script type="text/javascript" src="<?php echo $Campsite[‘WEBSITE_URL’]; ?>/javascript/fValidate/fValidate.core.js"></script>  
      95 <script type="text/javascript" src="<?php echo $Campsite[‘WEBSITE_URL’]; ?>/javascript/fValidate/fValidate.lang-enUS.js"></script>  
      96 <script type="text/javascript" src="<?php echo $Campsite[‘WEBSITE_URL’]; ?>/javascript/fValidate/fValidate.validators.js"></script>  
    97  
    60 98 <P>  
    61   <FORM NAME="dialog" METHOD="POST" ACTION="do_add.php" onsubmit="return validateForm(this, 0, 1, 0, 1, 8);">  
      99 <FORM NAME="add_article" METHOD="GET" ACTION="add.php" onsubmit="return validateForm(this, 0, 1, 0, 1, 8);">  
      100 <?php if ($f_publication_id > 0) { ?>  
    62 101 <INPUT TYPE="HIDDEN" NAME="f_publication_id" VALUE="<?php p($f_publication_id); ?>">  
      102 <?php } ?>  
    103 <?php if ($f_issue_number > 0) { ?>  
    63 104 <INPUT TYPE="HIDDEN" NAME="f_issue_number" VALUE="<?php p($f_issue_number); ?>">  
      105 <?php } ?>  
    106 <?php if ($f_section_number > 0) { ?>  
    64 107 <INPUT TYPE="HIDDEN" NAME="f_section_number" VALUE="<?php p($f_section_number); ?>">  
      108 <?php } ?>  
    109 <?php if ($f_language_id > 0) { ?>  
    65 110 <INPUT TYPE="HIDDEN" NAME="f_language_id" VALUE="<?php  p($f_language_id); ?>">  
    111 <?php } ?>  
    66 112 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" class="table_input">  
    67 113 <TR>  
    72 118 </TR>  
    73 119 <TR>  
    74       <TD ALIGN="RIGHT" ><?php  putGS("Name"); ?>:</TD>  
    75       <TD>  
    76       <INPUT TYPE="TEXT" NAME="f_article_name" SIZE="64" MAXLENGTH="140" class="input_text" alt="blank" emsg="<?php putGS(‘You must complete the $1 field.’, getGS(‘Name’)); ?>">  
    77       </TD>  
    78   </TR>  
    79   <TR>  
    80       <TD ALIGN="RIGHT" ><?php  putGS("Type"); ?>:</TD>  
    81       <TD>  
    82           <SELECT NAME="f_article_type" class="input_select" alt="select" emsg="<?php putGS(‘You must complete the $1 field.’, getGS(‘Article Type’)); ?>">  
    83           <option></option>  
    84           <?php  
    85           foreach ($allArticleTypes as $tmpType) {  
    86               echo ‘<OPTION>’.htmlspecialchars($tmpType).'</option>’;  
    87           }  
    88           ?>  
    89           </SELECT>  
    90       </TD>  
    91   </TR>  
      120     <td valign="top">  
      121         <table>  
      122         <tr>  
      123             <TD ALIGN="RIGHT" ><?php  putGS("Name"); ?>:</TD>  
      124             <TD>  
      125             <INPUT TYPE="TEXT" NAME="f_article_name" SIZE="40" MAXLENGTH="255" class="input_text" alt="blank" emsg="<?php putGS(‘You must complete the $1 field.’, getGS(‘Name’)); ?>" value="<?php echo htmlspecialchars($f_article_name); ?>">  
      126             </TD>  
      127         </TR>  
      128         <TR>  
      129             <TD ALIGN="RIGHT" ><?php  putGS("Type"); ?>:</TD>  
      130             <TD>  
      131                 <SELECT NAME="f_article_type" class="input_select" alt="select" emsg="<?php putGS(‘You must complete the $1 field.’, getGS(‘Article Type’)); ?>">  
      132                 <option></option>  
      133                 <?php  
      134                 foreach ($allArticleTypes as $tmpType) {  
      135                     camp_html_select_option($tmpType, $f_article_type, $tmpType);  
      136                 }  
      137                 ?>  
      138                 </SELECT>  
      139             </TD>  
      140         </TR>  
      141         <TR>  
      142             <TD ALIGN="RIGHT" ><?php  putGS("Language"); ?>:</TD>  
      143             <TD>  
      144                 <SELECT NAME="f_article_language" class="input_select" <?php if ($f_publication_id <= 0) { ?>onchange="this.form.submit();"<?php } ?>>  
      145                 <option value="0"><?php putGS("—Select language—"); ?></option>  
      146                 <?php  
      147                 foreach ($allLanguages as $tmpLanguage) {  
      148                     camp_html_select_option($tmpLanguage->getLanguageId(),  
      149                                             $f_article_language,  
      150                                             $tmpLanguage->getNativeName());  
      151                 }  
      152                 ?>           
      153                 </SELECT>  
      154             </TD>  
      155         </TR>  
      156         </table>  
      157     </td>  
      158      
      159     <?php if (($f_publication_id <= 0) && $User->hasPermission("MoveArticle")) { ?>  
      160     <td style="border-left: 1px solid black;">  
      161         <TABLE>  
      162         <TR>  
      163             <td colspan="2" style="padding-left: 20px; padding-bottom: 5px;font-size: 10pt; font-weight: bold;"><?php  putGS("Select location (optional):"); ?></TD>  
      164         </TR>  
      165         <TR>  
      166             <TD VALIGN="middle" ALIGN="RIGHT" style="padding-left: 20px;"><?php  putGS(‘Publication’); ?>: </TD>  
      167             <TD valign="middle" ALIGN="LEFT">  
      168                 <?php if ( ($f_article_language > 0) && count($Campsite["publications"]) > 0) { ?>  
      169                 <SELECT NAME="f_destination_publication_id" class="input_select" ONCHANGE="if (this.options[this.selectedIndex].value != <?php p($f_destination_publication_id); ?>) {this.form.submit();}">  
      170                 <OPTION VALUE="0"><?php  putGS(‘—Select publication—‘); ?></option>  
      171                 <?php  
      172                 foreach ($Campsite["publications"] as $tmpPublication) {  
      173                     camp_html_select_option($tmpPublication->getPublicationId(), $f_destination_publication_id, $tmpPublication->getName());  
      174                 }  
      175                 ?>  
      176                 </SELECT>  
      177                 <?php  
      178                 }  
      179                 else {  
      180                     ?>  
      181                     <SELECT class="input_select" DISABLED><OPTION><?php  putGS(‘No publications’); ?></option></SELECT>  
      182                     <?php  
      183                 }  
      184                 ?>  
      185             </td>  
      186         </tr>  
      187          
      188         <tr>  
      189             <TD VALIGN="middle" ALIGN="RIGHT" style="padding-left: 20px;"><?php  putGS(‘Issue’); ?>: </TD>  
      190             <TD valign="middle" ALIGN="LEFT">  
      191                 <?php  
      192                 $tmpIssues = array();  
      193                 if ($f_destination_publication_id > 0) {  
      194                     // Only get Issues with given language.  
      195                     foreach ($Campsite["issues"][$f_destination_publication_id] as $tmpIssue) {  
      196                         if ($tmpIssue->getLanguageId() == $f_article_language) {  
      197                             $tmpIssues[] = $tmpIssue;  
      198                         }  
      199                     }                     
      200                 }  
      201                 if (($f_destination_publication_id > 0) && (count($tmpIssues) > 0)) {  
      202                     ?>  
      203                     <SELECT NAME="f_destination_issue_number" class="input_select" ONCHANGE="if (this.options[this.selectedIndex].value != <?php p($f_destination_issue_number); ?>) { this.form.submit(); }">  
      204                     <OPTION VALUE="0"><?php  putGS(‘—Select issue—‘); ?></option>  
      205                     <?php  
      206                     foreach ($tmpIssues as $tmpIssue) {  
      207                         camp_html_select_option($tmpIssue->getIssueNumber(), $f_destination_issue_number, $tmpIssue->getName());  
      208                     }  
      209                     ?>  
      210                     </SELECT>  
      211                     <?php   
      212                 }  
      213                 else {  
      214                     ?><SELECT class="input_select" DISABLED><OPTION><?php  putGS(‘No issues’); ?></SELECT>  
      215                     <?php   
      216                 }  
      217                 ?>  
      218             </td>  
      219         </tr>  
      220          
      221         <tr>     
      222             <TD VALIGN="middle" ALIGN="RIGHT" style="padding-left: 20px;"><?php  putGS(‘Section’); ?>: </TD>  
      223             <TD valign="middle" ALIGN="LEFT">  
      224                 <?php if (($f_destination_publication_id > 0)  
      225                           && (count($tmpIssues) > 0)  
      226                           && ($f_destination_issue_number > 0)  
      227                           && (count($Campsite["sections"]) > 0)) { ?>  
      228                 <SELECT NAME="f_destination_section_number" class="input_select" onchange="if (this.selectedIndex != 0) { document.forms.add_article.save.className=’button’; document.forms.add_article.save.disabled = false; } else { document.forms.add_article.save.className=’button_disabled’; document.forms.add_article.save.disabled = true;}">  
      229                 <OPTION VALUE="0"><?php  putGS(‘—Select section—‘); ?>  
      230                 <?php  
      231                 $issueLanguageId = $Campsite["issues"][$f_destination_publication_id][0]->getLanguageId();  
      232                 $sections = $Campsite["sections"][$f_destination_publication_id][$f_destination_issue_number][$issueLanguageId];  
      233                 foreach ($sections as $tmpSection) {  
      234                     camp_html_select_option($tmpSection->getSectionNumber(), $f_destination_section_number, $tmpSection->getName());  
      235                 }  
      236                 ?>  
      237                 </SELECT>  
      238                 <?php   
      239                 }  
      240                 else {  
      241                     ?><SELECT class="input_select" DISABLED><OPTION><?php  putGS(‘No sections’); ?></SELECT>  
      242                     <?php   
      243                 }  
      244                 ?>  
      245                 </TD>  
      246         </tr>  
      247         </TABLE>  
      248     </td>  
      249     <?php } ?>  
      250 </tr>  
    92 251 <TR>  
    93       <TD ALIGN="RIGHT" ><?php  putGS("Language"); ?>:</TD>  
    94       <TD>  
    95           <SELECT NAME="f_article_language" class="input_select">  
    96           <?php  
    97           foreach ($allLanguages as $tmpLanguage) {  
    98               echo ‘<option value="’.$tmpLanguage->getLanguageId().’"’;  
    99               if ($tmpLanguage->getLanguageId() == $f_language_id) {  
    100                   echo "selected";  
    101               }  
    102               echo ‘>’.$tmpLanguage->getNativeName().'</option>’;  
    103           }  
    104           ?>           
    105           </SELECT>  
    106       </TD>  
    107   </TR>  
    108   <TR>  
    109       <TD COLSPAN="2">  
    110           <DIV ALIGN="CENTER">  
    111           <INPUT TYPE="submit" NAME="Save" VALUE="<?php  putGS(‘Save’); ?>" class="button">  
    112           </DIV>  
      252     <TD COLSPAN="2" align="center">  
      253         <HR NOSHADE SIZE="1" COLOR="BLACK">  
      254         <INPUT TYPE="submit" NAME="save" VALUE="<?php  putGS(‘Save’); ?>" <?php if (($f_destination_publication_id > 0) && (($f_destination_issue_number <= 0) || (count($tmpIssues) <= 0) || ($f_destination_section_number <= 0) || (count($Campsite["sections"]) <= 0))) { echo ‘class="button_disabled" disabled’; } else { echo "class="button""; }?> onclick="document.forms.add_article.action=’do_add.php’;">  
    113 255     </TD>  
    114 256 </TR>  
  • trunk/campsite/implementation/management/classes/DatabaseObject.php

     
    r4379 r4418  
    457 457      * Set the given column name to the given value.  
    458 458      * The object’s internal variable will also be updated.  
      459      * If the value hasnt changed, the database will not be updated.  
      460      * Note: You cannot set $p_commit to FALSE and $p_isSql to TRUE  
    461      * at the same time.  
    459 462      *  
    460 463      * @param string $p_dbColumnName  
  • trunk/campsite/implementation/management/classes/Section.php

      
    r4213 r4418  
    36 36         ‘SectionTplId’,  
    37 37         ‘ArticleTplId’);  
      38  
    39     var $m_languageName = null;  
    38 40      
    39 41     /**  
    208 210      
    209 211     /**  
      212      * A simple way to get the name of the language the article is  
      213      * written in.  The value is cached in case there are multiple  
      214      * calls to this function.  
      215      *  
      216      * @return string  
      217      */  
      218     function getLanguageName()  
      219     {  
      220         if (is_null($this->m_languageName)) {  
      221             $language =& new Language($this->m_data[‘IdLanguage’]);  
      222             $this->m_languageName = $language->getNativeName();  
      223         }  
      224         return $this->m_languageName;         
      225     } // fn getLanguageName  
      226      
      227      
    228     /**  
    210 229      * @return int  
    211 230      */  
  • trunk/campsite/implementation/management/classes/User.php

      
    r4313 r4418  
    75 75         ‘AddArticle’=>’N’,  
    76 76         ‘ChangeArticle’=>’N’,  
      77         ‘MoveArticle’=>’N’,  
    78         ‘TranslateArticle’=>’N’,  
    77 79         ‘DeleteArticle’=>’N’,  
      80         ‘AttachImageToArticle’=>’N’,  
    81         ‘AttachTopicToArticle’=>’N’,  
    78 82         ‘AddImage’=>’N’,  
    79 83         ‘ChangeImage’=>’N’,  
    102 106         ‘EditorUnderline’=>’N’,  
    103 107         ‘EditorUndoRedo’=>’N’,  
    104           ‘EditorCopyCutPaste’=>’N’,  
      108         ‘EditorCopyCutPaste’=>’N’,  
      109         ‘EditorFindReplace’=>’N’,  
      110         ‘EditorCharacterMap’=>’N’,  
    105 111         ‘EditorImage’=>’N’,  
    106 112         ‘EditorTextAlignment’=>’N’,  
  • trunk/campsite/implementation/management/classes/Article.php

      
    r4270 r4418  
    193 193      * @param int $p_destPublicationId –  
    194 194      *      The destination publication ID.  
    195        * @param int $p_destIssueId –  
    196        *      The destination issue ID.  
    197        * @param int $p_destSectionId –  
    198        *      The destination section ID.  
      195      * @param int $p_destIssueNumber –  
      196      *      The destination issue number.  
      197      * @param int $p_destSectionNumber –  
      198      *      The destination section number.  
    199 199      * @param int $p_userId –  
    200 200      *      The user creating the copy.  If null, keep the same user ID as the original.  
     
    209 209      *     If $p_copyTranslations is FALSE, return the new Article.  
    210 210      */  
    211       function copy($p_destPublicationId, $p_destIssueId, $p_destSectionId,  
      211     function copy($p_destPublicationId = 0, $p_destIssueNumber = 0, $p_destSectionNumber = 0,  
    211 211                   $p_userId = null, $p_copyTranslations = false)  
    212 212     {  
     
    236 236         $newArticleNumber = $this->__generateArticleNumber();  
    237 237    
    238         // Load translation file for log message.  
    238 239         if (function_exists("camp_load_language")) { camp_load_language("api"); }  
    239 240         $logtext = ”;  
     
    243 244             $articleCopy =& new Article();  
    244 245             $articleCopy->m_data[‘IdPublication’] = $p_destPublicationId;  
    245               $articleCopy->m_data[‘NrIssue’] = $p_destIssueId;  
    246               $articleCopy->m_data[‘NrSection’] = $p_destSectionId;  
      246             $articleCopy->m_data[‘NrIssue’] = $p_destIssueNumber;  
      247             $articleCopy->m_data[‘NrSection’] = $p_destSectionNumber;  
    247 248             $articleCopy->m_data[‘IdLanguage’] = $copyMe->m_data[‘IdLanguage’];  
    248 249             $articleCopy->m_data[‘Number’] = $newArticleNumber;  
     
    289 290              
    290 291             // Position the new article at the beginning of the section  
    291               $articleCopy->moveAbsolute(1);  
      292             $articleCopy->positionAbsolute(1);  
    291 292              
    292 293             $newArticles[] = $articleCopy;  
     
    307 308      
    308 309     /**  
      310      * This is a convenience function to move an article from  
      311      * one section to another.  
      312      *  
      313      * @param int $p_destPublicationId –  
      314      *      The destination publication ID.  
      315      * @param int $p_destIssueNumber –  
      316      *      The destination issue number.  
      317      * @param int $p_destSectionNumber –  
      318      *      The destination section number.  
      319      *  
      320      * @return void  
      321      */  
      322     function move($p_destPublicationId = 0, $p_destIssueNumber = 0, $p_destSectionNumber = 0)  
      323     {  
      324         $columns = array();  
      325         if ($this->m_data["IdPublication"] != $p_destPublicationId) {  
      326             $columns["IdPublication"] = $p_destPublicationId;  
      327         }  
      328         if ($this->m_data["NrIssue"] != $p_destIssueNumber) {  
      329             $columns["NrIssue"] = $p_destIssueNumber;  
      330         }  
      331         if ($this->m_data["NrSection"] != $p_destSectionNumber) {  
      332             $columns["NrSection"] = $p_destSectionNumber;  
      333         }  
      334         if (count($columns) > 0) {  
      335             $this->update($columns);  
      336         }  
      337     } // fn move  
      338      
      339      
    340     /**  
    309 341      * Return a unique name based on this article’s name.  
    310 342      * The name returned will have the form "original_article_name (duplicate #)"  
     
    588 620      * @return boolean  
    589 621      */  
    590       function moveRelative($p_direction, $p_spacesToMove = 1)  
      622     function positionRelative($p_direction, $p_spacesToMove = 1)  
    590 622     {  
    591 623         global $Campsite;  
     
    631 663         $this->fetch();  
    632 664         return true;  
    633       } // fn moveRelative  
      665     } // fn positionRelative  
    633 665      
    634 666      
     
    639 671      * @return boolean  
    640 672      */  
    641       function moveAbsolute($p_moveToPosition = 1)  
      673     function positionAbsolute($p_moveToPosition = 1)  
    641 673     {  
    642 674         global $Campsite;  
     
    684 716         $this->fetch();  
    685 717         return true;  
    686       } // fn moveAbsolute  
      718     } // fn positionAbsolute  
    686 718      
    687 719    
    1251 1283     {  
    1252 1284         global $Campsite;  
    1253           $queryStr = ‘SELECT * FROM Articles’  
      1285         $tmpArticle =& new Article();  
      1286         $columnNames = $tmpArticle->getColumnNames(true);  
      1287         $queryStr = ‘SELECT ‘.implode(", ", $columnNames)  
      1288                     .’ FROM Articles ‘  
    1254 1289                     ." WHERE Published = ‘S’ "  
    1255 1290                     .’ ORDER BY Number DESC, IdLanguage ‘  
  • trunk/campsite/implementation/management/admin.php

    r4145 r4418  
    98 98     unset($no_menu_scripts);  
    99 99     unset($request_uri);  
    100        
      100  
      101     require_once($Campsite[‘HTML_DIR’] . "/$ADMIN_DIR/init_content.php");  
      102  
    101 103     // Get the main content  
    102 104     ob_start();