Exemple #1
0
 public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
 {
     $languageObj = new Language($p_languageId);
     if (!$languageObj->exists()) {
         return new PEAR_Error(getGS('Language does not exist.'));
     }
     $uri = $GLOBALS['Campsite']['SUBDIR'] . '/' . $languageObj->getCode() . '/';
     if (!is_null($p_issueNo) && is_null($p_articleNo)) {
         $issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
         if (!$issueObj->exists()) {
             return new PEAR_Error(getGS('Issue does not exist.'));
         }
         $uri .= $issueObj->getUrlName() . '/';
     }
     if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
         $sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
         if (!$sectionObj->exists()) {
             return new PEAR_Error(getGS('Section does not exist.'));
         }
         $uri .= $sectionObj->getUrlName() . '/';
     }
     if (!is_null($p_articleNo)) {
         $articleObj = new Article($p_languageId, $p_articleNo);
         if (!$articleObj->exists()) {
             return new PEAR_Error(getGS('Article does not exist.'));
         }
         $issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
         $sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
         $uri .= $issueObj->getUrlName() . '/';
         $uri .= $sectionObj->getUrlName() . '/';
         $uri .= $articleObj->getUrlName() . '/';
     }
     return $uri;
 }
Exemple #2
0
 public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
 {
     $translator = \Zend_Registry::get('container')->getService('translator');
     $languageObj = new Language($p_languageId);
     if (!$languageObj->exists()) {
         return new PEAR_Error($translator->trans('Language does not exist.'));
     }
     $uri = '/' . $languageObj->getCode() . '/';
     if (!is_null($p_issueNo) && is_null($p_articleNo)) {
         $issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
         if (!$issueObj->exists()) {
             return new PEAR_Error($translator->trans('Issue does not exist.'));
         }
         $uri .= $issueObj->getUrlName() . '/';
     }
     if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
         $sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
         if (!$sectionObj->exists()) {
             return new PEAR_Error($translator->trans('Section does not exist.'));
         }
         $uri .= $sectionObj->getUrlName() . '/';
     }
     if (!is_null($p_articleNo)) {
         $articleObj = new Article($p_languageId, $p_articleNo);
         if (!$articleObj->exists()) {
             return new PEAR_Error($translator->trans('Article does not exist.'));
         }
         $issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
         $sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
         $uri .= $issueObj->getUrlName() . '/';
         $uri .= $sectionObj->getUrlName() . '/';
         $uri .= $articleObj->getUrlName() . '/';
     }
     return $uri;
 }
Exemple #3
0
	$_SERVER['SERVER_PORT'] = 80;
}
$scheme = $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
$siteAlias = new Alias($publicationObj->getDefaultAliasId());
$websiteURL = $scheme.$siteAlias->getName();

$accessParams = "LoginUserId=" . $g_user->getUserId() . "&LoginUserKey=" . $g_user->getKeyId()
				. "&AdminAccess=all";
$urlType = $publicationObj->getProperty('IdURLType');
if ($urlType == 1) {
	$templateObj = new Template($templateId);
	$url = "$websiteURL"  . $Campsite['SUBDIR'] . "/tpl/" . $templateObj->getName()
		. "?IdLanguage=$Language&IdPublication=$Pub&NrIssue=$Issue&$accessParams";
} else {
	$url = "$websiteURL" . $Campsite['SUBDIR'] . '/' . $languageObj->getCode()
		. "/" . $issueObj->getUrlName() . "?$accessParams";
}

$selectedLanguage = (int)CampRequest::GetVar('Language');
$url .= "&previewLang=$selectedLanguage";

if ($g_user->hasPermission("ManageTempl") || $g_user->hasPermission("DeleteTempl")) {
	// Show dual-pane view for those with template management priviledges
?>
<FRAMESET ROWS="60%,*" BORDER="1">
	<FRAME SRC="<?php echo "$url&preview=on"; ?>" NAME="body" FRAMEBORDER="1">
	<FRAME NAME="e" SRC="empty.php" FRAMEBORDER="1">
</FRAMESET>
<?php
} else {
	// Show single pane for everyone else.
Exemple #4
0
 }
 if (!$translationIssueObj->exists()) {
     if (!$g_user->hasPermission("ManageIssue")) {
         camp_html_add_msg(getGS('An issue must be created for the selected language but you do not have the right to create an issue.'));
         camp_html_goto_page($backLink);
     }
     foreach ($issueObj->getData() as $field => $fieldValue) {
         if ($field != 'IdLanguage') {
             $translationIssueObj->setProperty($field, $fieldValue, false);
         }
     }
     $f_issue_name = Input::Get('f_issue_name', 'string', '');
     if ($f_issue_name != '') {
         $translationIssueObj->setName($f_issue_name);
     }
     $f_issue_urlname = Input::Get('f_issue_urlname', 'string', $issueObj->getUrlName());
     if ($f_issue_urlname == "") {
         camp_html_add_msg(getGS('You must fill in the $1 field.', '"' . getGS('New issue URL name') . '"'));
         camp_html_goto_page($backLink);
     }
     if (!camp_is_valid_url_name($f_issue_urlname)) {
         camp_html_add_msg(getGS('The $1 field may only contain letters, digits and underscore (_) character.', '"' . getGS('New issue URL name') . '"'));
         camp_html_goto_page($backLink);
     }
     $translationIssueObj->create($f_issue_urlname);
     if (!$translationIssueObj->exists()) {
         camp_html_add_msg(getGS('Unable to create the issue for translation $1.', $translationLanguageObj->getName()));
         camp_html_goto_page($backLink);
     }
 } else {
     $f_issue_name = Input::Get('f_issue_name', 'string', $issueObj->getName());
Exemple #5
0
    }
}
if (!$g_user->hasPermission("TranslateArticle")) {
    $errorStr = getGS('You do not have the right to translate articles.');
    camp_html_display_error($errorStr, $BackLink);
    exit;
}
// When the user selects a language the form is submitted to the same page (translation.php).
// Read article translation form input values for the case when the page has been reloaded
// because of language select.
$f_translation_title = Input::Get('f_translation_title', 'string', '', true);
$f_language_selected = Input::Get('f_translation_language', 'int', 0, true);
$f_translation_language = Input::Get('f_translation_language', 'int', 0, true);
if ($f_publication_id > 0) {
    $f_translation_issue_name = Input::Get('f_issue_name', 'string', $issueObj->getName(), true);
    $f_translation_issue_urlname = Input::Get('f_issue_urlname', 'string', $issueObj->getUrlName(), true);
    $f_translation_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName(), true);
    $f_translation_section_urlname = Input::Get('f_section_urlname', 'string', $sectionObj->getUrlName(), true);
}
$allLanguages = Language::GetLanguages(null, null, null, array(), array(array('field' => 'byname', 'dir' => 'asc')), true);
$articleLanguages = $articleObj->getLanguages();
$articleLanguages = DbObjectArray::GetColumn($articleLanguages, "Id");
if ($f_language_selected > 0 && $f_issue_number > 0) {
    $translationIssueObj = new Issue($f_publication_id, $f_language_selected, $f_issue_number);
    $translationSectionObj = new Section($f_publication_id, $f_issue_number, $f_language_selected, $f_section_number);
}
if ($f_publication_id > 0) {
    $topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj, 'Article' => $articleObj);
    camp_html_content_top(getGS('Translate article'), $topArray, true, true);
} else {
    $crumbs = array();
Exemple #6
0
	<TD>
	<INPUT TYPE="TEXT" class="input_text" NAME="f_name" SIZE="32" alt="blank" emsg="<?php 
echo $translator->trans('You must fill in the $1 field.', array('$1' => $translator->trans('Name')));
?>
">
	</TD>
</TR>

<TR>
	<TD ALIGN="RIGHT" ><?php 
echo $translator->trans("URL Name");
?>
:</TD>
	<TD>
	<INPUT TYPE="TEXT" class="input_text" NAME="f_url_name" size="32" value="<?php 
echo htmlspecialchars($issueObj->getUrlName());
?>
" alt="blank" emsg="<?php 
echo $translator->trans('You must fill in the $1 field.', array('$1' => $translator->trans('URL Name')));
?>
">
	</TD>
</TR>

<TR>
	<TD ALIGN="RIGHT" ><?php 
echo $translator->trans("Language");
?>
:</TD>
	<TD>
		<SELECT NAME="f_new_language_id" class="input_select"><?php 
Exemple #7
0
if (!$templateId) {
    $errorStr = $translator->trans('This issue cannot be previewed. Please make sure it has the front template selected.', array(), 'issues');
    camp_html_display_error($errorStr, null, true);
}
if (!isset($_SERVER['SERVER_PORT'])) {
    $_SERVER['SERVER_PORT'] = 80;
}
$scheme = $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
$siteAlias = new Alias($publicationObj->getDefaultAliasId());
$websiteURL = $scheme . $siteAlias->getName();
$accessParams = "";
$urlType = $publicationObj->getProperty('IdURLType');
if ($urlType == 1) {
    $url = "{$websiteURL}" . "/tpl/" . $templateObj->getName() . "?IdLanguage={$Language}&IdPublication={$Pub}&NrIssue={$Issue}&{$accessParams}";
} else {
    $url = "{$websiteURL}" . '/' . $languageObj->getCode() . "/" . $issueObj->getUrlName() . "?{$accessParams}";
}
$selectedLanguage = (int) CampRequest::GetVar('Language');
$url .= "&previewLang={$selectedLanguage}";
if ($g_user->hasPermission("ManageTempl") || $g_user->hasPermission("DeleteTempl")) {
    // Show dual-pane view for those with template management priviledges
    ?>
<FRAMESET ROWS="60%,*" BORDER="1">
	<FRAME SRC="<?php 
    echo "{$url}&preview=on";
    ?>
" NAME="body"
		FRAMEBORDER="1">
	<FRAME NAME="e" SRC="empty.php" FRAMEBORDER="1">
</FRAMESET>
	<?php 
Exemple #8
0
			<TD>
				<?php  p($issueObj->getIssueNumber()); ?>
			</TD>
		</TR>

		<TR>
			<TD ALIGN="RIGHT" ><?php  putGS("Name"); ?>:</TD>
			<TD>
			<INPUT TYPE="TEXT" class="input_text" NAME="f_issue_name" SIZE="32" value="<?php  p(htmlspecialchars($issueObj->getName())); ?>" alt="blank" emsg="<?php putGS('You must fill in the $1 field.',"'".getGS('Name')."'"); ?>">
			</TD>
		</TR>

		<TR>
			<TD ALIGN="RIGHT"><?php  putGS("URL Name"); ?>:</TD>
			<TD>
			<INPUT TYPE="TEXT" class="input_text" NAME="f_url_name" SIZE="32" value="<?php  p(htmlspecialchars($issueObj->getUrlName())); ?>" alt="alnum|1|A|true|false|_" emsg="<?php putGS('The $1 field may only contain letters, digits and underscore (_) character.', "'" . getGS('URL Name') . "'"); ?>">
			</TD>
		</TR>

		<TR>
			<TD ALIGN="RIGHT" ><?php  putGS("Language"); ?>:</TD>
			<TD>
			    <SELECT NAME="f_new_language_id" class="input_select">
				<?php
				foreach ($allLanguages as $tmpLanguage) {
					$langId = $tmpLanguage->getLanguageId();
					if (($langId == $issueObj->getLanguageId()) || !in_array($langId, $excludeLanguageIds)) {
						camp_html_select_option($langId, $issueObj->getLanguageId(), $tmpLanguage->getNativeName());
					}
			    }
				?>
     if ($f_issue_urlname == "") {
         camp_html_add_msg($translator->trans('You must fill in the $1 field.', array('$1' => '"' . $translator->trans('New issue URL name', array(), 'articles') . '"')));
         camp_html_goto_page($backLink);
     }
     if (!camp_is_valid_url_name($f_issue_urlname)) {
         camp_html_add_msg($translator->trans('The $1 field may only contain letters, digits and underscore (_) character.', array('$1' => '"' . $translator->trans('New issue URL name', array(), 'articles') . '"')));
         camp_html_goto_page($backLink);
     }
     $translationIssueObj->create($f_issue_urlname);
     if (!$translationIssueObj->exists()) {
         camp_html_add_msg($translator->trans('Unable to create the issue for translation $1.', array('$1' => $translationLanguageObj->getName()), 'articles'));
         camp_html_goto_page($backLink);
     }
 } else {
     $f_issue_name = Input::Get('f_issue_name', 'string', $translationIssueObj->getName());
     $f_issue_urlname = Input::Get('f_issue_urlname', 'string', $translationIssueObj->getUrlName());
     $translationIssueObj->update(array('Name' => $f_issue_name, 'ShortName' => $f_issue_urlname));
 }
 $f_section_number = $articleObj->getSectionNumber();
 $sectionObj = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);
 if (!$sectionObj->exists()) {
     camp_html_display_error($translator->trans('No such section.', array(), 'articles'), $backLink);
     exit;
 }
 $translationSectionObj = new Section($f_publication_id, $f_issue_number, $f_translation_language, $f_section_number);
 if (!$translationSectionObj->exists()) {
     if (!$g_user->hasPermission("ManageSection")) {
         camp_html_add_msg($translator->trans('A section must be created for the selected language but you do not have the right to create a section.', array(), 'articles'));
         camp_html_goto_page($backLink);
     }
     foreach ($sectionObj->getData() as $field => $fieldValue) {
Exemple #10
0
		}
		?>
	</TD>
</TR>

<TR>
	<TD ALIGN="RIGHT" ><?php  putGS("Name"); ?>:</TD>
	<TD>
	<INPUT TYPE="TEXT" class="input_text" NAME="f_name" SIZE="32" alt="blank" emsg="<?php  putGS('You must fill in the $1 field.',getGS('Name')); ?>">
	</TD>
</TR>

<TR>
	<TD ALIGN="RIGHT" ><?php  putGS("URL Name"); ?>:</TD>
	<TD>
	<INPUT TYPE="TEXT" class="input_text" NAME="f_url_name" size="32" value="<?php echo htmlspecialchars($issueObj->getUrlName()); ?>" alt="blank" emsg="<?php  putGS('You must fill in the $1 field.',getGS('URL Name')); ?>">
	</TD>
</TR>

<TR>
	<TD ALIGN="RIGHT" ><?php  putGS("Language"); ?>:</TD>
	<TD>
		<SELECT NAME="f_new_language_id" class="input_select"><?php
		foreach ($unusedLanguages as $tmpLanguage) {
			camp_html_select_option($tmpLanguage->getLanguageId(),'',htmlspecialchars($tmpLanguage->getNativeName()));
        }
	    ?>
		</SELECT>
	</TD>
</TR>
<TR>