Example #1
0
        		}
        	} ?>
        	</UL>
        	</TD>

        </TR>
        <TR>
        	<TD COLSPAN="2">
        	<B><?php putGS("Preview a sample of the merge configuration."); ?></B> <SMALL><?php putGS("Cycle through your articles to verify that the merge configuration is correct."); ?></SMALL>
        	</TD>
        </TR>

        <TR>
        	<TD COLSPAN="2">
            <?php if ($f_prev_action == 'Orig') { ?>
                <B><?php putGS("View of original ($1) $2", htmlspecialchars($curPreview->getType()), $curPreview->getTitle()); ?>
                (<A HREF="/<?php print $ADMIN; ?>/article_types/merge3.php?<?php print $getString; ?>">
                <?php putGS("To return to the preview click here"); ?></a>)</B>
            <?php } else { ?>
            	<B><?php putGS("Preview of $1", wordwrap(htmlspecialchars($curPreview->getTitle()), 60, '<BR>')); ?>
            	   (<A HREF="/<?php print $ADMIN; ?>/article_types/merge3.php?f_action=Orig&<?php print $getString; ?>"><?php putGS("View the source ($1) version of $2", $src->getDisplayName(), wordwrap(htmlspecialchars($curPreview->getTitle()), 60, '<BR>')); ?></A>)
            	<?php putGS("$1 of $2", $curPos + 1, count($articlesArray)); ?>.
                <?php
                if (isset($articlesArray[$curPos - 1])) {
                    $prevArticle = $articlesArray[$curPos - 1];
                ?>
                	<A HREF="/<?php print $ADMIN; ?>/article_types/merge3.php?<?php print $getString; ?>&f_cur_preview=<?php print $prevArticle; ?>"><IMG BORDER="0" SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/previous.png" BORDER="0"></a>&nbsp;
                <?php
                }
                if (isset($articlesArray[$curPos + 1])) {
                    $nextArticle = $articlesArray[$curPos + 1];
Example #2
0
 /**
  * Process item
  * @param  Article $article
  * @return array
  */
 public function processItem(Article $article)
 {
     global $g_user, $Campsite;
     $translator = \Zend_Registry::get('container')->getService('translator');
     return array($article->getArticleNumber(), $article->getLanguageId(), sprintf('
             <div class="context-item" langid="%s">
                 <div class="context-drag-topics"><a href="#" title="drag to sort"></a></div>
                 <div class="context-item-header">
                     <div class="context-item-date">%s (%s) (%s)</div>
                     <a href="#" class="view-article" onClick="viewArticle($(this).parent(\'div\').parent(\'div\').parent(\'td\').parent(\'tr\').attr(\'id\'), $(this).parents(\'.context-item:eq(0)\').attr(\'langid\'));">%s</a>
                 </div>
                 <a href="javascript:void(0)" class="corner-button" style="display: none" onClick="removeFromContext($(this).parent(\'div\').parent(\'td\').parent(\'tr\').attr(\'id\'));removeFromContext($(this).parents(\'.item:eq(0)\').attr(\'id\'));toggleDragZonePlaceHolder();"><span class="ui-icon ui-icon-closethick"></span></a>
                 <div class="context-item-summary">%s</div>
                 </div>
         ', $article->getLanguageId(), $article->getLastModified(), $article->getWorkflowDisplayString(), $article->getType(), $translator->trans('View article', array(), 'library'), $article->getName()));
 }
Example #3
0
        putGS("Preview a sample of the merge configuration.");
        ?>
</B> <SMALL><?php 
        putGS("Cycle through your articles to verify that the merge configuration is correct.");
        ?>
</SMALL>
        	</TD>
        </TR>

        <TR>
        	<TD COLSPAN="2">
            <?php 
        if ($f_prev_action == 'Orig') {
            ?>
                <B><?php 
            putGS("View of original (\$1) \$2", htmlspecialchars($curPreview->getType()), $curPreview->getTitle());
            ?>
                (<A HREF="/<?php 
            print $ADMIN;
            ?>
/article_types/merge3.php?<?php 
            print $getString;
            ?>
">
                <?php 
            putGS("To return to the preview click here");
            ?>
</a>)</B>
            <?php 
        } else {
            ?>
Example #4
0
$f_issue_number = Input::Get('f_issue_number', 'int', 0);
$f_section_number = Input::Get('f_section_number', 'int', 0);
$f_language_id = Input::Get('f_language_id', 'int', 1);
$articleId = Input::Get('f_article_number', 'int', 1);
if (isset($_SESSION['f_language_selected'])) {
    $f_old_language_selected = (int) $_SESSION['f_language_selected'];
} else {
    $f_old_language_selected = 0;
}
$f_language_selected = (int) camp_session_get('f_language_selected', 0);
$article_language_use = $f_language_selected;
if (empty($article_language_use)) {
    $article_language_use = $f_language_id;
}
$article = new Article($article_language_use, $articleId);
$article_type_name = $article->getType();
$article_type = new ArticleType($article_type_name);
$article_type_columns = $article_type->getUserDefinedColumns();
//var_dump($article_type_columns);
?>
<script src="<?php 
echo $Campsite['WEBSITE_URL'];
?>
/js/jquery/calendar/fullcalendar.min.js" type="text/javascript"></script>
<script type="text/javascript">

$.fn.serializeObject = function()
{
    var o = {};
    var a = this.serializeArray();
    $.each(a, function() {
Example #5
0
}
// detect if blogger can edit
$userIsBlogger = false;
$blogService = \Zend_Registry::get('container')->getService('blog');
if ($blogService->isBlogger($g_user)) {
    $userIsBlogger = true;
    $userSection = $blogService->getSection($g_user);
    if (empty($userSection) || $userSection->getSectionId() != $articleObj->getSection()->getSectionId()) {
        camp_html_display_error(getGS("You're not allowed to edit article."));
        exit;
    }
}
$articleData = $articleObj->getArticleData();
// Get article type fields.
$dbColumns = $articleData->getUserDefinedColumns(FALSE, TRUE);
$articleType = new ArticleType($articleObj->getType());
$articleImages = ArticleImage::GetImagesByArticleNumber($f_article_number);
$lockUserObj = new User($articleObj->getLockedByUser());
$articleCreator = new User($articleObj->getCreatorId());
$articleEvents = ArticlePublish::GetArticleEvents($f_article_number, $f_language_selected, TRUE);
$articleTopics = ArticleTopic::GetArticleTopics($f_article_number);
$articleFiles = ArticleAttachment::GetAttachmentsByArticleNumber($f_article_number, $f_language_selected);
$articleLanguages = $articleObj->getLanguages();
// Create displayable "last modified" time.
$lastModified = strtotime($articleObj->getLastModified());
$today = getdate();
$savedOn = getdate($lastModified);
$savedToday = true;
if ($today['year'] != $savedOn['year'] || $today['mon'] != $savedOn['mon'] || $today['mday'] != $savedOn['mday']) {
    $savedToday = FALSE;
}
 public function getdatesAction()
 {
     require_once $GLOBALS['g_campsiteDir'] . '/classes/Article.php';
     require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleTypeField.php';
     $field_ranks = array();
     $field_infos = array();
     $dark_blues = array('#4040ff', '#8040ff');
     $yellow = '#ffff40';
     $articleId = $this->_request->getParam('articleId');
     $languageId = $this->_request->getParam('languageId');
     $article_obj = new \Article($languageId, $articleId);
     $article_type = $article_obj->getType();
     $repo = $this->_helper->entity->getRepository('Newscoop\\Entity\\ArticleDatetime');
     $return = array();
     $dates = $repo->findDates((object) array('articleId' => "{$articleId}"));
     foreach ($dates as $date) {
         $recurring = $date->getRecurring();
         $event_comment = $date->getEventComment();
         $itemField = $date->getFieldName();
         $itemColor = '#';
         $itemRank = 0;
         $itemHidden = false;
         if (array_key_exists($itemField, $field_ranks)) {
             $itemRank = $field_ranks[$itemField];
         } else {
             $field_obj = new \ArticleTypeField($article_type, $itemField);
             $allItemRanks = $field_obj->getOrders();
             foreach ($allItemRanks as $one_weight => $one_field) {
                 $field_ranks[$one_field] = $one_weight;
                 if ($one_field == $itemField) {
                     $itemRank = $one_weight;
                 }
             }
         }
         if (array_key_exists($itemField, $field_infos)) {
             $itemColor = $field_infos[$itemField]['background_color'];
             $itemHidden = $field_infos[$itemField]['hidden_status'];
         } else {
             $field_obj = new \ArticleTypeField($article_type, $itemField);
             $itemColor = $field_obj->getColor();
             $itemHidden = $field_obj->isHidden();
             $field_infos[$itemField] = array('background_color' => $itemColor, 'hidden_status' => $itemHidden);
         }
         if ($itemHidden) {
             continue;
         }
         if (strlen($recurring) > 1) {
             //daterange
             $start = strtotime($this->getDate($date->getStartDate()->getTimestamp()) . ' ' . $this->getTime(is_null($date->getStartTime()) ? $this->tz : $date->getStartTime()->getTimestamp()) . ' UTC');
             $end = strtotime($this->getDate(is_null($date->getEndDate()) ? $this->distant : $date->getEndDate()->getTimestamp()) . ' ' . $this->getTime(is_null($date->getEndTime()) ? $this->tz + 86399 : $date->getEndTime()->getTimestamp()) . ' UTC');
             $itemStart = $start;
             $itemEnd = strtotime($this->getDate($date->getStartDate()->getTimestamp()) . ' ' . $this->getTime(is_null($date->getEndTime()) ? $this->tz + 86399 : $date->getEndTime()->getTimestamp()) . ' UTC');
             $step = "+1 day";
             switch ($recurring) {
                 case 'weekly':
                     $step = "+1 week";
                     break;
                 case 'monthly':
                     $step = "+1 month";
                     break;
             }
             while ($itemStart <= $end) {
                 $calDate = array();
                 $calDate['id'] = $date->id;
                 $calDate['title'] = $itemField;
                 $calDate['start_utc'] = $itemStart;
                 $calDate['start'] = gmdate('Y-m-d\\TH:i:s\\Z', $itemStart);
                 $calDate['start_day'] = gmdate('m-d', $itemStart);
                 $calDate['end_utc'] = $itemEnd;
                 $calDate['end'] = gmdate('Y-m-d\\TH:i:s\\Z', $itemEnd);
                 $calDate['allDay'] = $this->isAllDay($date);
                 $calDate['field_name'] = $itemField;
                 $calDate['backgroundColor'] = $itemColor;
                 $calDate['textColor'] = '#000000';
                 $calDate['event_comment'] = $event_comment;
                 $calDate['weight'] = $itemRank;
                 $return[] = $calDate;
                 if ('+1 month' == $step) {
                     $curr_start_year = date('Y', $itemStart);
                     $curr_start_month = date('n', $itemStart);
                     $curr_start_day = date('j', $itemStart);
                     while (true) {
                         $curr_start_month += 1;
                         if (13 == $curr_start_month) {
                             $curr_start_month = 1;
                             $curr_start_year += 1;
                         }
                         if (checkdate($curr_start_month, $curr_start_day, $curr_start_year)) {
                             $itemStart = mktime(date('G', $itemStart), 0 + ltrim(date('i', $itemStart), '0'), 0, $curr_start_month, $curr_start_day, $curr_start_year);
                             $itemEnd = mktime(date('G', $itemEnd), 0 + ltrim(date('i', $itemEnd), '0'), 0, $curr_start_month, $curr_start_day, $curr_start_year);
                             break;
                         }
                     }
                 } else {
                     $itemStart = strtotime($step, $itemStart);
                     $itemEnd = strtotime($step, $itemEnd);
                 }
             }
         } else {
             //specific
             $calDate = array();
             $calDate['id'] = $date->id;
             $calDate['title'] = $itemField;
             $itemStart = strtotime($this->getDate($date->getStartDate()->getTimestamp()) . ' ' . $this->getTime(is_null($date->getStartTime()) ? $this->tz : $date->getStartTime()->getTimestamp()) . ' UTC');
             $calDate['start_utc'] = $itemStart;
             $calDate['start'] = gmdate('Y-m-d\\TH:i:s\\Z', $itemStart);
             $calDate['start_day'] = gmdate('m-d', $itemStart);
             $endDate = $date->getEndDate();
             // TODO: at this moment, specific dates without end dates are taken as single-date dates, even though they should be taken as never-ending continuous events
             $itemEnd = 0;
             if (empty($endDate)) {
                 $itemEnd = strtotime($this->getDate($date->getStartDate()->getTimestamp()) . ' ' . $this->getTime(is_null($date->getEndTime()) ? $this->tz + 86399 : $date->getEndTime()->getTimestamp()) . ' UTC');
             } else {
                 $itemEnd = strtotime($this->getDate($date->getEndDate()->getTimestamp()) . ' ' . $this->getTime(is_null($date->getEndTime()) ? $this->tz + 86399 : $date->getEndTime()->getTimestamp()) . ' UTC');
             }
             $calDate['end_utc'] = $itemEnd;
             $calDate['end'] = gmdate('Y-m-d\\TH:i:s\\Z', $itemEnd);
             $calDate['allDay'] = $this->isAllDay($date);
             $calDate['restOfDay'] = false;
             if (!$calDate['allDay']) {
                 if (is_null($date->getEndTime())) {
                     $calDate['restOfDay'] = true;
                 }
             }
             $calDate['field_name'] = $itemField;
             $calDate['backgroundColor'] = $itemColor;
             $calDate['textColor'] = '#000000';
             if (in_array($itemColor, $dark_blues)) {
                 $calDate['textColor'] = $yellow;
             }
             $calDate['event_comment'] = $event_comment;
             $calDate['weight'] = $itemRank;
             $return[] = $calDate;
         }
     }
     $res = usort($return, 'self::EventOrder');
     echo json_encode($return);
     die;
 }
Example #7
0
 /**
  * Process item
  * @param Article $article
  * @return array
  */
 public function processItem(Article $article)
 {
     global $g_user, $Campsite;
     $articleLinkParams = '?f_publication_id=' . $article->getPublicationId() . '&amp;f_issue_number=' . $article->getIssueNumber() . '&amp;f_section_number=' . $article->getSectionNumber() . '&amp;f_article_number=' . $article->getArticleNumber() . '&amp;f_language_id=' . $article->getLanguageId() . '&amp;f_language_selected=' . $article->getLanguageId();
     $articleLinkParamsTranslate = $articleLinkParams . '&amp;f_action=translate&amp;f_action_workflow=' . $article->getWorkflowStatus() . '&amp;f_article_code=' . $article->getArticleNumber() . '_' . $article->getLanguageId();
     $articleLink = $Campsite['WEBSITE_URL'] . '/admin/articles/edit.php' . $articleLinkParams;
     $previewLink = $Campsite['WEBSITE_URL'] . '/admin/articles/preview.php' . $articleLinkParams;
     $htmlPreviewLink = '<a href="' . $previewLink . '" target="_blank" title="' . getGS('Preview') . '">' . getGS('Preview') . '</a>';
     $translateLink = $Campsite['WEBSITE_URL'] . '/admin/articles/translate.php' . $articleLinkParamsTranslate;
     $htmlTranslateLink = '<a href="' . $translateLink . '" target="_blank" title="' . getGS('Translate') . '">' . getGS('Translate') . '</a>';
     $lockInfo = '';
     $lockHighlight = false;
     $timeDiff = camp_time_diff_str($article->getLockTime());
     if ($article->isLocked() && $timeDiff['days'] <= 0) {
         $lockUser = new User($article->getLockedByUser());
         if ($timeDiff['hours'] > 0) {
             $lockInfo = getGS('The article has been locked by $1 ($2) $3 hour(s) and $4 minute(s) ago.', htmlspecialchars($lockUser->getRealName()), htmlspecialchars($lockUser->getUserName()), $timeDiff['hours'], $timeDiff['minutes']);
         } else {
             $lockInfo = getGS('The article has been locked by $1 ($2) $3 minute(s) ago.', htmlspecialchars($lockUser->getRealName()), htmlspecialchars($lockUser->getUserName()), $timeDiff['minutes']);
         }
         if ($article->getLockedByUser() != $g_user->getUserId()) {
             $lockHighlight = true;
         }
     }
     $tmpUser = new User($article->getCreatorId());
     $tmpArticleType = new ArticleType($article->getType());
     $tmpAuthor = new Author();
     $articleAuthors = ArticleAuthor::GetAuthorsByArticle($article->getArticleNumber(), $article->getLanguageId());
     foreach ((array) $articleAuthors as $author) {
         if (strtolower($author->getAuthorType()->getName()) == 'author') {
             $tmpAuthor = $author;
             break;
         }
     }
     if (!$tmpAuthor->exists() && isset($articleAuthors[0])) {
         $tmpAuthor = $articleAuthors[0];
     }
     $onFrontPage = $article->onFrontPage() ? getGS('Yes') : getGS('No');
     $onSectionPage = $article->onSectionPage() ? getGS('Yes') : getGS('No');
     $imagesNo = (int) ArticleImage::GetImagesByArticleNumber($article->getArticleNumber(), true);
     $topicsNo = (int) ArticleTopic::GetArticleTopics($article->getArticleNumber(), true);
     $commentsNo = '';
     if ($article->commentsEnabled()) {
         global $controller;
         $repositoryComments = $controller->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment');
         $filter = array('thread' => $article->getArticleNumber(), 'language' => $article->getLanguageId());
         $params = array('sFilter' => $filter);
         $commentsNo = $repositoryComments->getCount($params);
     } else {
         $commentsNo = 'No';
     }
     // get language code
     $language = new Language($article->getLanguageId());
     return array($article->getArticleNumber(), $article->getLanguageId(), $article->getOrder(), sprintf('%s <a href="%s" title="%s %s">%s</a>', $article->isLocked() ? '<span class="ui-icon ui-icon-locked' . (!$lockHighlight ? ' current-user' : '') . '" title="' . $lockInfo . '"></span>' : '', $articleLink, getGS('Edit'), htmlspecialchars($article->getName() . " ({$article->getLanguageName()})"), htmlspecialchars($article->getName() . (empty($_REQUEST['language']) ? " ({$language->getCode()})" : ''))), htmlspecialchars($article->getSection()->getName()), $article->getWebcode(), htmlspecialchars($tmpArticleType->getDisplayName()), htmlspecialchars($tmpUser->getRealName()), htmlspecialchars($tmpAuthor->getName()), $article->getWorkflowStatus(), $onFrontPage, $onSectionPage, $imagesNo, $topicsNo, $commentsNo, (int) $article->getReads(), Geo_Map::GetArticleMapId($article) != NULL ? getGS('Yes') : getGS('No'), (int) sizeof(Geo_Map::GetLocationsByArticle($article)), $article->getCreationDate(), $article->getPublishDate(), $article->getLastModified(), $htmlPreviewLink, $htmlTranslateLink);
 }
Example #8
0
        echo $translator->trans("Preview a sample of the merge configuration.", array(), 'article_types');
        ?>
</B> <SMALL><?php 
        echo $translator->trans("Cycle through your articles to verify that the merge configuration is correct.", array(), 'article_types');
        ?>
</SMALL>
        	</TD>
        </TR>

        <TR>
        	<TD COLSPAN="2">
            <?php 
        if ($f_prev_action == 'Orig') {
            ?>
                <B><?php 
            echo $translator->trans("View of original (\$1) \$2", array('$1' => htmlspecialchars($curPreview->getType()), '$2' => $curPreview->getTitle()), 'article_types');
            ?>
                (<A HREF="/<?php 
            print $ADMIN;
            ?>
/article_types/merge3.php?<?php 
            print $getString;
            ?>
">
                <?php 
            echo $translator->trans("To return to the preview click here", array(), 'article_types');
            ?>
</a>)</B>
            <?php 
        } else {
            ?>