Changeset 4129
- Timestamp:
- Mon Dec 5 19:29:39 2005
- Files:
-
- trunk/campsite/implementation/management/priv/lib_campsite.php (modified) (diff)
- trunk/campsite/implementation/management/priv/articles/autopublish.php (modified) (diff)
- trunk/campsite/implementation/management/priv/articles/files (added)
- trunk/campsite/implementation/management/priv/articles/files/do_add.php (added)
- trunk/campsite/implementation/management/priv/articles/files/popup.php (added)
- trunk/campsite/implementation/management/priv/articles/files/edit.php (added)
- trunk/campsite/implementation/management/priv/articles/files/do_del.php (added)
- trunk/campsite/implementation/management/priv/articles/files/do_edit.php (added)
- trunk/campsite/implementation/management/priv/articles/images/do_add.php (modified) (diff)
- trunk/campsite/implementation/management/priv/articles/images/add.php (modified) (diff)
- trunk/campsite/implementation/management/priv/articles/edit.php (modified) (diff)
- trunk/campsite/implementation/management/classes/DatabaseObject.php (modified) (diff)
- trunk/campsite/implementation/management/classes/ArticleAttachment.php (added)
- trunk/campsite/implementation/management/classes/Attachment.php (added)
- trunk/campsite/implementation/management/classes/Translation.php (added)
- trunk/campsite/implementation/management/classes/ArticleImage.php (modified) (diff)
- trunk/campsite/implementation/management/configuration.php (modified) (diff)
- trunk/campsite/implementation/management/admin.php (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
trunk/campsite/implementation/management/priv/lib_campsite.php
r4116 r4129 128 128 129 129 /** 130 * Transform bytes into a human-readable string. 131 * 132 * @param int $p_bytes 133 * @return string 134 */ 135 function camp_format_bytes($p_bytes) 136 { 137 if ( ($p_bytes / 1073741824) > 1) { 138 return round($p_bytes/1073741824, 1).' '.getGS('GB'); 139 } else if ( ($p_bytes / 1048576) > 1) { 140 return round($p_bytes/1048576, 1).' '.getGS('MB'); 141 } else if ( ($p_bytes / 1024) > 1) { 142 return round($p_bytes/1024, 1).' '.getGS('KB'); 143 } else { 144 return round($p_bytes, 1).' '.getGS('bytes'); 145 } 146 } // fn camp_format_bytes 147 148 149 /** 130 150 * Load the global and local language files. 131 151 * @param string $p_name -
trunk/campsite/implementation/management/priv/articles/autopublish.php
r4121 r4129 55 55 $articleEvents = ArticlePublish::GetArticleEvents($f_article_number, $f_language_selected); 56 56 57 //$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj,58 // 'Section' => $sectionObj, 'Article'=>$articleObj);59 //camp_html_content_top(getGS("Scheduled Publishing"), $topArray);60 61 57 $publishTime = date("Y-m-d H:i"); 62 58 if ($articleObj->getPublished() != 'N') { 188 184 <TD COLSPAN="2" align="center"> 189 185 <INPUT TYPE="submit" NAME="Save" VALUE="<?php putGS('Save'); ?>" class="button"> 186 187 <INPUT TYPE="button" NAME="Cancel" VALUE="<?php putGS('Cancel'); ?>" class="button" onclick="window.close();"> 190 188 </TD> 191 189 </TR> -
trunk/campsite/implementation/management/priv/articles/images/do_add.php
r4122 r4129 68 68 // Check if image was added successfully 69 69 if (!is_object($image)) { 70 header('Location: '.camp_html_display_error($image, $BackLink));70 camp_html_display_error($image, $BackLink); 70 70 exit; 71 71 } 77 77 Log::Message($logtext, $User->getUserName(), 41); 78 78 79 // Go back to article image list.80 //$redirectLocation = camp_html_article_url($articleObj, $f_language_id, 'images/edit.php')81 // ."&ImageId=".$image->getImageId()."&ImageTemplateId=$ImageTemplateId";82 ////echo $redirectLocation;83 //header("Location: $redirectLocation");84 //exit;85 79 ?> 86 80 <script> -
trunk/campsite/implementation/management/priv/articles/images/add.php
r4122 r4129 37 37 $q_now = $Campsite['db']->GetOne("SELECT LEFT(NOW(), 10)"); 38 38 39 // Add extra breadcrumb for image list.40 //$extraCrumbs = array(getGS("Images")=>"/$ADMIN/articles/images/?Pub=$Pub&Issue=$Issue&Language=$Language&Section=$Section&Article=$Article&sLanguage=$sLanguage");41 //$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj,42 // 'Section' => $sectionObj, 'Article'=>$articleObj);43 //camp_html_content_top(getGS("Add New Image"), $topArray, true, true, $extraCrumbs);44 45 39 ?> 46 40 <script> 123 117 </TABLE> 124 118 </FORM> 125 <P>126 127 <?php //camp_html_copyright_notice(); ?>119 <P> -
trunk/campsite/implementation/management/priv/articles/edit.php
r4122 r4129 3 3 require_once($_SERVER['DOCUMENT_ROOT']. "/$ADMIN_DIR/articles/editor_load_xinha.php"); 4 4 require_once($_SERVER['DOCUMENT_ROOT'].'/classes/ArticlePublish.php'); 5 require_once($_SERVER['DOCUMENT_ROOT'].'/classes/ArticleAttachment.php'); 5 6 6 7 list($access, $User) = check_basic_access($_REQUEST); … … 45 46 $articleEvents = ArticlePublish::GetArticleEvents($f_article_number, $f_language_selected); 46 47 $articleTopics = ArticleTopic::GetArticleTopics($f_article_number, $f_language_selected); 48 $articleFiles = ArticleAttachment::GetAttachmentsByArticleNumber($f_article_number, $f_language_selected); 47 49 48 50 // Automatically switch to "view" mode if user doesnt have permissions. 683 685 <!-- END Images table --> 684 686 </TD></TR> 687 688 689 <TR><TD> 690 <!-- BEGIN Files table --> 691 <TABLE width="100%" style="border: 1px solid #EEEEEE;"> 692 <TR> 693 <TD> 694 <TABLE width="100%" bgcolor="#EEEEEE" cellpadding="3" cellspacing="0"> 695 <TR> 696 <TD align="left"> 697 <b><?php putGS("Files"); ?></b> 698 </td> 699 <?php if ($f_edit_mode == "edit") { ?> 700 <td align="right"> 701 <img src="<?php p($Campsite["ADMIN_IMAGE_BASE_URL"]);?>/add.png" border="0"> 702 <a href="javascript: void(0);" onclick="window.open('<?php echo camp_html_article_url($articleObj, $f_language_selected, "files/popup.php"); ?>', 'attach_file', 'scrollbars=yes, resizable=yes, menubar=no, toolbar=no, width=500, height=400, top=200, left=100');"><?php putGS("Attach"); ?></a> 703 </td> 704 <?php } ?> 705 </tr> 706 </table> 707 </td> 708 </tr> 709 <?PHP 710 foreach ($articleFiles as $file) { 711 $fileEditUrl = "/$ADMIN/articles/files/edit.php?f_publication_id=$f_publication_id&f_issue_number=$f_issue_number&f_section_number=$f_section_number&f_article_number=$f_article_number&f_attachment_id=".$file->getAttachmentId()."&f_language_id=$f_language_id&f_language_selected=$f_language_selected"; 712 $deleteUrl = "/$ADMIN/articles/files/do_del.php?f_publication_id=$f_publication_id&f_issue_number=$f_issue_number&f_section_number=$f_section_number&f_article_number=$f_article_number&f_attachment_id=".$file->getAttachmentId()."&f_language_selected=$f_language_selected&f_language_id=$f_language_id"; 713 ?> 714 <tr> 715 <td align="center" width="100%"> 716 <table> 717 <tr> 718 <td align="center" valign="middle"> 719 <?php if ($f_edit_mode == "edit") { ?><a href="<?php p($fileEditUrl); ?>"><?php } p(wordwrap($file->getFileName(), "25", "<br>", true)); ?><?php if ($f_edit_mode == "edit") { ?></a><?php } ?><br><?php p($file->getDescription($f_language_selected)); ?> 720 </td> 721 <?php if ($f_edit_mode == "edit") { ?> 722 <td> 723 <a href="<?php p($deleteUrl); ?>" onclick="return confirm('<?php putGS("Are you sure you want to remove the file \\'$1\\' from the article?", camp_javascriptspecialchars($file->getFileName())); ?>');"><img src="<?php p($Campsite["ADMIN_IMAGE_BASE_URL"]);?>/unlink.png" border="0"></a> 724 </td> 725 <?php } ?> 726 </tr> 727 <tr> 728 <td align="center"><?php p(camp_format_bytes($file->getSizeInBytes())); ?></td> 729 <td></td> 730 </tr> 731 </table> 732 </td> 733 </tr> 734 <?php } ?> 735 </TABLE> 736 <!-- END Files table --> 737 </TD></TR> 738 739 685 740 686 741 <TR><TD> -
trunk/campsite/implementation/management/classes/DatabaseObject.php
r4073 r4129 310 310 { 311 311 foreach ($this->m_keyColumnNames as $columnName) { 312 if (! $this->m_data[$columnName]) {312 if (!isset($this->m_data[$columnName]) || empty($this->m_data[$columnName])) { 312 312 return false; 313 313 } -
trunk/campsite/implementation/management/classes/ArticleImage.php
r4102 r4129 26 26 var $m_image = null; 27 27 28 function ArticleImage($p_articleId = null, $p_imageId = null, $p_templateId = null) 28 /** 29 * The ArticleImage table links together Articles with Images. 30 * 31 * @param int $p_articleNumber 32 * @param int $p_imageId 33 * @param int $p_templateId 34 * @return ArticleImage 35 */ 36 function ArticleImage($p_articleNumber = null, $p_imageId = null, $p_templateId = null) 29 37 { 30 if (!is_null($p_articleId) && !is_null($p_imageId)) { 31 $this->m_data['NrArticle'] = $p_articleId; 38 if (!is_null($p_articleNumber) && !is_null($p_imageId)) { 39 $this->m_data['NrArticle'] = $p_articleNumber; 32 40 $this->m_data['IdImage'] = $p_imageId; 33 41 $this->fetch(); 34 42 } 35 elseif (!is_null($p_articleId) && !is_null($p_templateId)) { 36 $this->m_data['NrArticle'] = $p_articleId; 43 elseif (!is_null($p_articleNumber) && !is_null($p_templateId)) { 44 $this->m_data['NrArticle'] = $p_articleNumber; 37 45 $this->m_data['Number'] = $p_templateId; 38 46 $this->m_keyColumnNames = array('NrArticle', 'Number'); … … 70 78 71 79 /** 72 * 80 * Return an Image object. 72 80 */ 73 81 function getImage() … … 80 88 /** 81 89 * Get a free Template ID. 82 * @param int $p_article Id90 * @param int $p_articleNumber 82 90 */ 83 function GetUnusedTemplateId($p_article Id)91 function GetUnusedTemplateId($p_articleNumber) 83 91 { 84 92 global $Campsite; 85 93 // Get the highest template ID and add one. 86 $queryStr = "SELECT MAX(Number)+1 FROM ArticleImages WHERE NrArticle=$p_article Id";94 $queryStr = "SELECT MAX(Number)+1 FROM ArticleImages WHERE NrArticle=$p_articleNumber"; 86 94 $templateId = $Campsite['db']->GetOne($queryStr); 87 95 if (!$templateId) { … … 98 106 * Return true if article already is using the given template ID, false otherwise. 99 107 * 100 * @param int $p_article Id108 * @param int $p_articleNumber 100 108 * @param int $p_templateId 101 109 * 102 110 * @return boolean 103 111 */ 104 function TemplateIdInUse($p_article Id, $p_templateId)112 function TemplateIdInUse($p_articleNumber, $p_templateId) 104 112 { 105 113 global $Campsite; 106 114 $queryStr = "SELECT Number FROM ArticleImages" 107 ." WHERE NrArticle=$p_article IdAND Number=$p_templateId";115 ." WHERE NrArticle=$p_articleNumber AND Number=$p_templateId"; 107 115 $value = $Campsite['db']->GetOne($queryStr); 108 116 if ($value !== false) { … … 120 128 /** 121 129 * Get all the images that belong to this article. 130 * @param int $p_articleNumber 122 131 * @return array 123 132 */ 124 function GetImagesByArticleNumber($p_article Id)133 function GetImagesByArticleNumber($p_articleNumber) 124 133 { 125 134 global $Campsite; … … 131 140 .', ArticleImages.Number, ArticleImages.NrArticle, ArticleImages.IdImage' 132 141 .' FROM Images, ArticleImages' 133 .' WHERE ArticleImages.NrArticle='.$p_article Id142 .' WHERE ArticleImages.NrArticle='.$p_articleNumber 133 142 .' AND ArticleImages.IdImage=Images.Id' 134 143 .' ORDER BY ArticleImages.Number'; … … 154 163 * 155 164 * @param int $p_imageId 156 * 157 * @param int $p_articleId 158 * 165 * @param int $p_articleNumber 159 166 * @param int $p_templateId 160 167 * Optional. If not specified, this will be the next highest number … … 163 170 * @return void 164 171 */ 165 function AddImageToArticle($p_imageId, $p_article Id, $p_templateId = null)172 function AddImageToArticle($p_imageId, $p_articleNumber, $p_templateId = null) 165 172 { 166 173 global $Campsite; 167 174 if (is_null($p_templateId)) { 168 $p_templateId = ArticleImage::GetUnusedTemplateId($p_article Id);175 $p_templateId = ArticleImage::GetUnusedTemplateId($p_articleNumber); 168 175 } 169 176 $queryStr = 'INSERT IGNORE INTO ArticleImages(NrArticle, IdImage, Number)' 170 .' VALUES('.$p_article Id.', '.$p_imageId.', '.$p_templateId.')';177 .' VALUES('.$p_articleNumber.', '.$p_imageId.', '.$p_templateId.')'; 170 177 $Campsite['db']->Execute($queryStr); 171 178 } // fn AddImageToArticle … … 178 185 * This call will only work for entries that already exist. 179 186 * 180 * @param int $p_article Id187 * @param int $p_articleNumber 180 187 * @param int $p_imageId 181 188 * @param int $p_templateId … … 184 191 * @return void 185 192 */ 186 function SetTemplateId($p_article Id, $p_imageId, $p_templateId)193 function SetTemplateId($p_articleNumber, $p_imageId, $p_templateId) 186 193 { 187 194 global $Campsite; 188 195 $queryStr = "UPDATE ArticleImages SET Number=$p_templateId" 189 ." WHERE NrArticle=$p_article IdAND IdImage=$p_imageId";196 ." WHERE NrArticle=$p_articleNumber AND IdImage=$p_imageId"; 189 196 $Campsite['db']->Execute($queryStr); 190 197 } // fn SetTemplateId … … 198 205 * 199 206 * @param int $p_imageId 200 * @param int $p_article Id207 * @param int $p_articleNumber 200 207 * @param int $p_templateId 201 208 * 202 209 * @return void 203 210 */ 204 function RemoveImageFromArticle($p_imageId, $p_article Id, $p_templateId)211 function RemoveImageFromArticle($p_imageId, $p_articleNumber, $p_templateId) 204 211 { 205 212 global $Campsite; 206 ArticleImage::RemoveImageTagsFromArticleText($p_article Id, $p_templateId);213 ArticleImage::RemoveImageTagsFromArticleText($p_articleNumber, $p_templateId); 206 213 $queryStr = 'DELETE FROM ArticleImages' 207 .' WHERE NrArticle='.$p_article Id214 .' WHERE NrArticle='.$p_articleNumber 207 214 .' AND IdImage='.$p_imageId 208 215 .' AND Number='.$p_templateId … … 220 227 * 221 228 * @param int $p_imageId 222 * @param int $p_article Id229 * @param int $p_articleNumber 222 229 * @param int $p_templateId 223 230 * @return void 224 231 */ 225 function RemoveImageTagsFromArticleText($p_article Id, $p_templateId)232 function RemoveImageTagsFromArticleText($p_articleNumber, $p_templateId) 225 232 { 226 233 // Get all the articles 227 $articles = Article::GetArticles(null, null, null, null, $p_article Id);234 $articles = Article::GetArticles(null, null, null, null, $p_articleNumber); 227 234 228 235 // The REGEX 275 282 /** 276 283 * Remove image pointers for the given article. 277 * @param int $p_article Id284 * @param int $p_articleNumber 277 284 * @return void 278 285 */ 279 function OnArticleDelete($p_article Id)286 function OnArticleDelete($p_articleNumber) 279 286 { 280 287 global $Campsite; 281 288 $queryStr = 'DELETE FROM ArticleImages' 282 ." WHERE NrArticle='".$p_article Id."'";289 ." WHERE NrArticle='".$p_articleNumber."'"; 282 289 $Campsite['db']->Execute($queryStr); 283 290 } // fn OnArticleDelete -
trunk/campsite/implementation/management/configuration.php
r4101 r4129 54 54 $Campsite['THUMBNAIL_BASE_URL'] = $Campsite['WEBSITE_URL'].'/images/thumbnails/'; 55 55 $Campsite['THUMBNAIL_PREFIX'] = 'cms-thumb-'; 56 $Campsite['FILE_DIRECTORY'] = $Campsite['HTML_DIR'].'/files'; 57 $Campsite['FILE_NUM_DIRS_LEVEL_1'] = "1000"; 58 $Campsite['FILE_NUM_DIRS_LEVEL_2'] = "1000"; 56 59 $Campsite['TMP_DIRECTORY'] = '/tmp/'; 57 60 $Campsite['HELP_URL'] = 'https://www.campware.org/manuals/campsite/2.3/'; -
trunk/campsite/implementation/management/admin.php
r4104 r4129 19 19 '/articles/images/view.php', 20 20 '/articles/topics/popup.php', 21 '/articles/files/popup.php', 21 22 '/articles/empty.php'); 22 23