/**
  * @Route("/admin/articles/{language}/{articleNumber}/images/{imageId}/edit", name="newscoop_newscoop_article_images_edit")
  * @Template()
  */
 public function editAction(Request $request, $language, $articleNumber, $imageId)
 {
     $em = $this->get('em');
     $imageService = $this->container->get('image');
     $articleImage = $imageService->getArticleImage($articleNumber, $imageId);
     $preferencesService = $this->container->get('preferences');
     $description = $articleImage->getImage()->getDescription();
     $caption = $articleImage->getCaption($language);
     $captions = $articleImage->getImage()->getCaptions();
     if ($preferencesService->MediaRichTextCaptions == 'N') {
         $description = strip_tags($description);
         $caption = strip_tags($caption);
         if (is_array($captions) && count($captions) > 0) {
             array_walk($captions, function (&$value) {
                 $value = strip_tags($value);
             });
         }
     }
     $form = $this->container->get('form.factory')->create(new ArticleImageType(), array('number' => $articleImage->getNumber(), 'caption' => $caption, 'language' => $language, 'status' => $articleImage->getImage()->getStatus(), 'description' => $description, 'photographer' => $articleImage->getImage()->getPhotographer(), 'photographer_url' => $articleImage->getImage()->getPhotographerUrl(), 'place' => $articleImage->getImage()->getPlace(), 'date' => $articleImage->getImage()->getDate()), array('action' => $this->generateUrl('newscoop_newscoop_article_images_edit', array('language' => $language, 'articleNumber' => $articleNumber, 'imageId' => $imageId)), 'method' => 'POST', 'rich_text_caption' => $preferencesService->MediaRichTextCaptions));
     if ($request->isMethod('POST')) {
         $form->bind($request);
         if ($form->isValid()) {
             $data = $form->getData();
             $data['user'] = $this->container->get('user')->getCurrentUser();
             $imageService->fillImage($articleImage->getImage(), $data);
             $imageService->saveArticleImage($articleImage, $data);
             return new RedirectResponse($this->generateUrl('newscoop_newscoop_article_images_edit', array('language' => $language, 'articleNumber' => $articleNumber, 'imageId' => $imageId)));
         }
     }
     $editor = '';
     if ($preferencesService->MediaRichTextCaptions == 'Y') {
         $editorLanguage = $request->getLocale();
         $editorOptions = array('max_chars' => $preferencesService->MediaCaptionLength, 'toolbar_length' => 11);
         $userService = $this->container->get('user');
         ob_start();
         require_once $GLOBALS['g_campsiteDir'] . "/admin-files/media-archive/editor_load_tinymce.php";
         editor_load_tinymce(array('article_image_caption', 'article_image_description'), $userService->getCurrentUser(), $editorLanguage, $editorOptions);
         $editor = ob_get_contents();
         ob_end_clean();
     }
     return array('form' => $form->createView(), 'imageService' => $imageService, 'articleImage' => $articleImage, 'image' => $articleImage->getImage(), 'caption' => $caption, 'captions' => $captions, 'editor' => $editor, 'rich_text_caption' => $preferencesService->MediaRichTextCaptions);
 }
Exemplo n.º 2
0
echo $translator->trans('Save');
?>
" class="save-button" />
</fieldset>

</form>

</div>

<?php 
// Load tinymce once for all textareas
if (count($loadAsRichtext) > 0) {
    $languageSelectedObj = new Language((int) camp_session_get('LoginLanguageId', 0));
    $editorLanguage = !empty($_COOKIE['TOL_Language']) ? $_COOKIE['TOL_Language'] : $languageSelectedObj->getCode();
    $editorOptions = array('max_chars' => $captionLimit, 'toolbar_length' => 15);
    editor_load_tinymce($loadAsRichtext, $g_user, $editorLanguage, $editorOptions);
}
?>

<script type="text/javascript">
/**
 * Copy field value to all fields of that name.
 *
 * @param string field
 * @param int imageId
 *
 * @return void
 */
function copyToAll(field, imageId)
{
    var value = $("input[name*=" + imageId + "][name*=" + field + "]").val();
Exemplo n.º 3
0
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI']);
    exit;
}
$publicationObj = new Publication($f_publication_id);
$issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
$newSectionNumber = Section::GetUnusedSectionNumber($f_publication_id, $f_issue_number);
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj);
camp_html_content_top($translator->trans('Add new section', array(), 'sections'), $topArray, true, true, array($translator->trans("Sections") => "/{$ADMIN}/sections/?Pub={$f_publication_id}&Issue={$f_issue_number}&Language={$f_language_id}"));
$controller->view->headTitle($translator->trans('Add new section', array(), 'sections') . ' - Newscoop Admin', 'SET');
$languageObj = new Language($f_language_id);
if (!is_object($languageObj)) {
    $languageObj = new Language(1);
}
$editorLanguage = camp_session_get('TOL_Language', $languageObj->getCode());
editor_load_tinymce('f_description', $g_user, 0, $editorLanguage, 'section');
?>
<p>
<form name="section_add" method="POST" action="/<?php 
echo $ADMIN;
?>
/sections/do_add.php" onsubmit="return <?php 
camp_html_fvalidate();
?>
;">
<?php 
echo SecurityToken::FormParameter();
?>
<table border="0" cellspacing="0" cellpadding="0" class="box_table">
<tr>
  <td colspan="2">
Exemplo n.º 4
0
    } else { ?>
        <li>
          <label><?php putGS('No records found'); ?></label>
        </li>
    <?php } ?>
      </ul>
    </fieldset>
  </div>
  <?php } ?>
  
  <fieldset class="frame" style="margin-bottom:0;">
    <ul>
      <li>
        <input type="submit" name="save" id="save" value="<?php putGS('Save All'); ?>" class="save-button right-floated" />
      </li>
    </ul>
  </fieldset>
</div>

<?php
require_once($GLOBALS['g_campsiteDir']. "/$ADMIN_DIR/articles/editor_load_tinymce.php");
$languageObj = new Language($Language);
if (!is_object($languageObj)) {
    $languageObj = new Language(1);
}

$editorLanguage = !empty($_COOKIE['TOL_Language']) ? $_COOKIE['TOL_Language'] : $languageObj->getCode();
editor_load_tinymce('txt_biography', $g_user, 0, $editorLanguage, 'authorbiography');
?>
</form>
Exemplo n.º 5
0
    return $text;
}
$hasMultiDates = false;
$multiDatesFields = array();
include_once 'edit_html.php';
// Display tinymce loading code if required
$hasArticleBodyField = FALSE;
foreach ($dbColumns as $dbColumn) {
    if ($dbColumn->getType() == ArticleTypeField::TYPE_BODY) {
        $hasArticleBodyField = TRUE;
    }
}
if ($inEditMode && $hasArticleBodyField) {
    $languageSelectedObj = new Language($f_language_selected);
    $editorLanguage = !empty($_COOKIE['TOL_Language']) ? $_COOKIE['TOL_Language'] : $languageSelectedObj->getCode();
    editor_load_tinymce($dbColumns, $g_user, $f_article_number, $editorLanguage);
}
foreach (array('fCustomFields', 'fCustomSwitches', 'fCustomTextares') as $var) {
    if (!isset(${$var})) {
        ${$var} = array();
    }
}
$jsArrayFieldsStr = '';
for ($i = 0; $i < sizeof($fCustomFields); $i++) {
    $jsArrayFieldsStr .= "'" . addslashes($fCustomFields[$i]) . "'";
    if ($i + 1 < sizeof($fCustomFields)) {
        $jsArrayFieldsStr .= ',';
    }
}
$jsArraySwitchesStr = '';
for ($i = 0; $i < sizeof($fCustomSwitches); $i++) {
Exemplo n.º 6
0
    echo $translator->trans("Change image information", array(), 'media_archive');
    ?>
</B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">
	</TD>
</TR>
<?php 
    $captionStatus = $preferencesService->MediaRichTextCaptions;
    $captionLimit = $preferencesService->MediaCaptionLength;
    if ($captionStatus == 'Y') {
        // CHeck if language is this is valid
        $languageSelectedObj = new Language((int) camp_session_get('LoginLanguageId', 0));
        $editorLanguage = !empty($_COOKIE['TOL_Language']) ? $_COOKIE['TOL_Language'] : $languageSelectedObj->getCode();
        $editorOptions = array('max_chars' => $captionLimit, 'toolbar_length' => 28);
        $iptcDescriptionCode = "tinyMCE.editors['f_image_description'].setContent('" . addcslashes($iptcDescription, "'") . "');";
        editor_load_tinymce('f_image_description', $g_user, $editorLanguage, $editorOptions);
        ?>
<TR>
    <TD ALIGN="RIGHT" style="width:115px;"><?php 
        echo $translator->trans('Description');
        if ($captionStatus == 'Y' && $captionLimit > 0) {
            echo $translator->trans(' (max. $1 characters)', array('$1' => $captionLimit), 'media_archive');
        }
        ?>
:</TD>
    <TD align="left" style="width:590px">
        <?php 
        if (!empty($iptcDescription)) {
            ?>
                <small><a style="float:right;" href="javascript:void(0);" onClick="<?php 
            echo $iptcDescriptionCode;
Exemplo n.º 7
0
    <input type="hidden" id="f_height" value="" />
    <input type="hidden" id="orginal_width" />
    <input type="hidden" id="orginal_height" />
    <tr>
      <td align="right"><label for="f_alt">{#campsiteimage_dlg.alt}</label></td>
      <td><input type="text" id="f_alt" class="largelWidth" value="" /></td>
    </tr>
    <tr>
      <td align="right"><label for="f_caption">{#campsiteimage_dlg.caption}</label></td>
      <td>
          <?php 
if ($richtextCaption == 'Y') {
    $user = \Zend_Registry::get('container')->getService('user');
    $languageSelectedObj = new Language((int) camp_session_get('LoginLanguageId', 0));
    $editorLanguage = !empty($_COOKIE['TOL_Language']) ? $_COOKIE['TOL_Language'] : $languageSelectedObj->getCode();
    editor_load_tinymce('f_caption', $user->getCurrentUser(), $editorLanguage, array('max_chars' => $captionLimit, 'toolbar_length' => 19));
    ?>
              <textarea name="f_caption" id="f_caption" rows="8" cols="70"></textarea>
          <?php 
} else {
    ?>
              <input type="text" id="f_caption" name="f_caption" class="largelWidth" value="" />
          <?php 
}
?>
      </td>
    </tr>
    <tr>
      <td align="right"><label for="f_align">{#campsiteimage_dlg.alignment}:</label></td>
      <td>
        <select size="1" id="f_align"  title="{#campsiteimage_dlg.positiontitle}">