1124 lines
43 KiB
PHP
1124 lines
43 KiB
PHP
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
|
|
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
|
|
<script type="text/javascript" src="/libraries/jquery/sortable/sortable.js"></script>
|
|
<?
|
|
;
|
|
global $db, $settings;
|
|
|
|
ob_start();
|
|
?>
|
|
<div id="settings-tabs">
|
|
<ul class="resp-tabs-list settings-tabs">
|
|
<li><i class="fa fa-file"></i>Treść</li>
|
|
<li><i class="fa fa-wrench"></i>Ustawienia</li>
|
|
<? if ( $settings['tags'] ):?>
|
|
<li><i class="fa fa-bars"></i>Tagi</li>
|
|
<? endif;?>
|
|
<li><i class="fa fa-globe"></i>SEO</li>
|
|
<li><i class="fa fa-share-alt"></i>Wyświetlanie</li>
|
|
<li><i class="fa fa-file-image-o"></i>Galeria</li>
|
|
<li><i class="fa fa-file-archive-o"></i>Załączniki</li>
|
|
<? if ( is_array( $this -> additional_params_lon ) and count( $this -> additional_params_lon ) or is_array( $this -> additional_params_loff ) and count( $this -> additional_params_loff ) ):?>
|
|
<li>
|
|
<i class="fa fa-keyboard-o"></i>Dodatkowe parametry
|
|
</li>
|
|
<? endif;?>
|
|
<li>
|
|
<i class="fa fa-bars"></i>Inne
|
|
</li>
|
|
</ul>
|
|
<div class="resp-tabs-container settings-tabs">
|
|
<div>
|
|
<div id="languages-main">
|
|
<ul class="resp-tabs-list languages-main">
|
|
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
|
<? if ( $lg['status'] ):?>
|
|
<li><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a></li>
|
|
<? endif;?>
|
|
<? endforeach; endif;?>
|
|
</ul>
|
|
<div class="resp-tabs-container languages-main">
|
|
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
|
<?
|
|
$languages = array();
|
|
|
|
$languages[''] = '---- wersja językowa ----';
|
|
if ( is_array( $this -> languages ) ) foreach ( $this -> languages as $lg_tmp )
|
|
{
|
|
if ( $lg_tmp['id'] != $lg['id'] )
|
|
$languages[ $lg_tmp['id'] ] = $lg_tmp['name'];
|
|
}
|
|
?>
|
|
<? if ( $lg['status'] ):?>
|
|
<div>
|
|
<?= \Html::select(
|
|
array(
|
|
'label' => 'Wyświetlaj treść z wersji',
|
|
'name' => 'copy_from',
|
|
'values' => $languages,
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['copy_from'],
|
|
)
|
|
);?>
|
|
<?= \Html::input(
|
|
array(
|
|
'label' => 'Tytuł',
|
|
'name' => 'title',
|
|
'id' => 'title_' . $lg['id'],
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['title'],
|
|
'inline' => true,
|
|
'js_key' => 'google_preview( "' . $lg['id'] . '" ); return false;'
|
|
)
|
|
);?>
|
|
<?= \Html::input_icon( [
|
|
'label' => 'Zdjęcie tytułowe',
|
|
'name' => 'main_image',
|
|
'id' => 'main_image_' . $lg['id'],
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['main_image'],
|
|
'icon_content' => 'przeglądaj',
|
|
'inline' => true,
|
|
'icon_js' => "window.open ( '/libraries/filemanager-9.14.1/dialog.php?type=1&popup=1&field_id=main_image_" . $lg['id'] . "&akey=c3cb2537d25c0efc9e573d059d79c3b8', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
|
|
] );
|
|
?>
|
|
<?= \Html::textarea(
|
|
array(
|
|
'label' => 'Wstęp',
|
|
'name' => 'entry',
|
|
'id' => 'entry_' . $lg['id'],
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['entry'],
|
|
'inline' => true
|
|
)
|
|
);?>
|
|
<?= \Html::textarea(
|
|
array(
|
|
'label' => 'Treść',
|
|
'name' => 'text',
|
|
'id' => 'text_' . $lg['id'],
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['text'],
|
|
'inline' => true
|
|
)
|
|
);?>
|
|
<?= \Html::textarea( [
|
|
'label' => 'Spis treści',
|
|
'name' => 'table_of_contents',
|
|
'id' => 'table_of_contents_' . $lg['id'],
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['table_of_contents'],
|
|
'inline' => true
|
|
] );?>
|
|
<script type="text/javascript">
|
|
$( function() {
|
|
$( '#text_<?= $lg['id'];?>, #entry_<?= $lg['id'];?>, #table_of_contents_<?= $lg['id'];?>' ).ckeditor( {
|
|
toolbar : 'MyToolbar',
|
|
height:'350'
|
|
});
|
|
});
|
|
</script>
|
|
</div>
|
|
<? endif;?>
|
|
<? endforeach; endif;?>
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<? if ( is_array( $this -> authors ) ): foreach ( $this -> authors as $author ): $authors[ $author['id'] ] = $author['author']; endforeach; endif;?>
|
|
<?= \Html::select( [
|
|
'label' => 'Autor',
|
|
'name' => "id_author",
|
|
'id' => 'id_author',
|
|
'values' => array_merge( [ '0' => '--- wybierz autora ---' ], $authors ),
|
|
'value' => $this -> article['id_author']
|
|
] );?>
|
|
<?= \Html::input_switch(
|
|
array(
|
|
'label' => 'Opublikowany',
|
|
'name' => 'status',
|
|
'checked' => $this -> article['status'] == 1 or !$this -> article['id'] ? true : false
|
|
)
|
|
);?>
|
|
<?= \Html::input_switch(
|
|
array(
|
|
'label' => 'Artykuł priorytetowy',
|
|
'name' => 'priority',
|
|
'checked' => $this -> article['priority'] == 1 ? true : false
|
|
)
|
|
);?>
|
|
<?= \Html::input_switch(
|
|
array(
|
|
'label' => 'Pokaż tytuł',
|
|
'name' => 'show_title',
|
|
'checked' => $this -> article['show_title'] == 1 ? true : false
|
|
)
|
|
);?>
|
|
<?= \Html::input_switch(
|
|
array(
|
|
'label' => 'Pokaż datę dodania',
|
|
'name' => 'show_date_add',
|
|
'checked' => $this -> article['show_date_add'] == 1 ? true : false
|
|
)
|
|
);?>
|
|
<?= \Html::input( [
|
|
'label' => 'Data dodania',
|
|
'class' => 'date-time',
|
|
'name' => 'date_add',
|
|
'id' => 'date_add',
|
|
'value' => $this -> article['date_add']
|
|
] );?>
|
|
<?= \Html::input_switch(
|
|
array(
|
|
'label' => 'Pokaż datę modyfikacji',
|
|
'name' => 'show_date_modify',
|
|
'checked' => $this -> article['show_date_modify'] == 1 ? true : false
|
|
)
|
|
);?>
|
|
<?= \Html::input_switch(
|
|
array(
|
|
'label' => 'Powtórz wprowadzenie',
|
|
'name' => 'repeat_entry',
|
|
'checked' => $this -> article['repeat_entry'] == 1 ? true : false
|
|
)
|
|
);?>
|
|
<?= \Html::input_switch(
|
|
array(
|
|
'label' => 'Linki do portali społecznościowych',
|
|
'name' => 'social_icons',
|
|
'checked' => $this -> article['social_icons'] == 1 ? true : false
|
|
)
|
|
); ?>
|
|
<?= \Html::input(
|
|
array(
|
|
'label' => 'Zabezpiecz hasłem',
|
|
'name' => 'password',
|
|
'id' => 'password',
|
|
'value' => $this -> article['password']
|
|
)
|
|
);?>
|
|
<?= \Html::select( [
|
|
'label' => 'Moduł Pixieset',
|
|
'name' => "pixieset",
|
|
'id' => 'pixieset',
|
|
'values' => [ 0 => 'wyłączony', 1 => 'pobieranie', 2 => 'pobieranie i wybieranie' ],
|
|
'value' => $this -> article['pixieset']
|
|
] );?>
|
|
<? if ( $settings['calendar'] ):?>
|
|
<?= \Html::input_icon(
|
|
array(
|
|
'label' => 'Data wydarzenia',
|
|
'class' => 'date-range',
|
|
'name' => 'event_date',
|
|
'id' => 'event_date',
|
|
'value' => ( $this -> article['date_start' ] and $this -> article['date_end'] ) ? $this -> article['date_start'] . ' - ' . $this -> article['date_end'] : '',
|
|
'icon_class' => 'date-range-icon',
|
|
'icon_content' => '<i class="fa fa-calendar"></i>'
|
|
)
|
|
);?>
|
|
<? endif;?>
|
|
</div>
|
|
<? if ( $settings['tags'] ):?>
|
|
<div>
|
|
<div class="form-group ">
|
|
<label class="col-lg-3 control-label">Tagi:</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" id="tags" class="form-control tm-input" name="tags" value="" placeholder="dodaj nowy tag...">
|
|
<div class="tag-container tags"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<? endif;?>
|
|
<div>
|
|
<div id="languages-seo">
|
|
<ul class="resp-tabs-list languages-seo">
|
|
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
|
<? if ( $lg['status'] ):?>
|
|
<li><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a></li>
|
|
<? endif;?>
|
|
<? endforeach; endif;?>
|
|
</ul>
|
|
<div class="resp-tabs-container languages-seo">
|
|
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
|
<? if ( $lg['status'] ):?>
|
|
<div>
|
|
<?= \Html::input_icon(
|
|
array(
|
|
'label' => 'Link SEO',
|
|
'name' => 'seo_link',
|
|
'id' => 'seo_link_' . $lg['id'],
|
|
'value' => $this -> article['languages' ][ $lg['id'] ]['seo_link'],
|
|
'icon_content' => 'generuj',
|
|
'icon_js' => 'generate_seo_links( "' . $lg['id'] . '", $( "#title_' . $lg['id'] . '" ).val(), ' . (int)$this -> article['id'] . ' );',
|
|
'js_key' => 'google_preview( "' . $lg['id'] . '" ); return false;'
|
|
)
|
|
);?>
|
|
<?= \Html::input(
|
|
array(
|
|
'label' => 'Meta title',
|
|
'name' => 'meta_title',
|
|
'id' => 'meta_title_' . $lg['id'],
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['meta_title'],
|
|
'js_key' => 'google_preview( "' . $lg['id'] . '" ); return false;'
|
|
)
|
|
);?>
|
|
<?= \Html::textarea(
|
|
array(
|
|
'label' => 'Meta description',
|
|
'name' => 'meta_description',
|
|
'id' => 'meta_description_' . $lg['id'],
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['meta_description'],
|
|
'js_key' => 'google_preview( "' . $lg['id'] . '" ); return false;'
|
|
)
|
|
);?>
|
|
<?= \Html::textarea(
|
|
array(
|
|
'label' => 'Meta keywords',
|
|
'name' => 'meta_keywords',
|
|
'id' => 'meta_keywords_' . $lg['id'],
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['meta_keywords']
|
|
)
|
|
);?>
|
|
<div class="form-group ">
|
|
<label class="col-lg-3 control-label">Podgląd google:</label>
|
|
<div class="col-lg-9">
|
|
<div id="google-preview-<?= $lg['id'];?>">
|
|
<div class="google-title"></div>
|
|
<div class="google-url"></div>
|
|
<div class="google-description"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?= \Html::select(
|
|
array(
|
|
'label' => 'Blokuj indeksację',
|
|
'name' => "noindex",
|
|
'id' => 'noindex_' . $lg['id'],
|
|
'values' => array(
|
|
0 => 'nie', 1 => 'tak'
|
|
),
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['noindex'] == 1 ? 1 : 0
|
|
)
|
|
);?>
|
|
<?= \Html::select(
|
|
array(
|
|
'label' => 'Blokuj bezpośredni dostęp',
|
|
'name' => "block_direct_access",
|
|
'id' => 'block_direct_access_' . $lg['id'],
|
|
'values' => array(
|
|
0 => 'nie', 1 => 'tak'
|
|
),
|
|
'value' => $this -> article['languages'][ $lg['id'] ]['block_direct_access'] == 1 ? 1 : 0
|
|
)
|
|
);?>
|
|
</div>
|
|
<? endif;?>
|
|
<? endforeach; endif;?>
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<?
|
|
$layouts[''] = '---- szablon domyślny ----';
|
|
if ( is_array( $this -> layouts ) ): foreach ( $this -> layouts as $layout ):
|
|
$layouts[ $layout['id'] ] = $layout['name'];
|
|
endforeach; endif;
|
|
?>
|
|
<?= \Html::select(
|
|
array(
|
|
'label' => 'Szablon',
|
|
'name' => 'layout_id',
|
|
'id' => 'layout_id',
|
|
'values' => $layouts,
|
|
'value' => $this -> article['layout_id']
|
|
)
|
|
);?>
|
|
<div class="form-group">
|
|
<label class="col-lg-3 control-label">Wyświetlaj na:</label>
|
|
<div class="col-lg-9">
|
|
<?
|
|
if ( is_array( $this -> menus ) ) foreach ( $this -> menus as $menu )
|
|
{
|
|
?>
|
|
<div class="menu_sortable">
|
|
<ol class="sortable" id="sortable_<?= $menu['id'];?>">
|
|
<li id="list_<?= $menu['id'];?>" class="menu_<?= $menu['id'];?>" menu="<?= $menu['id'];?>">
|
|
<div class="context_0 content content_menu" <? if ( !$menu['status'] ) echo 'style="color: #cc0000;"';?>>
|
|
<span class="disclose"><span></span></span>
|
|
Menu: <b><?= $menu['name'];?></b>
|
|
</div>
|
|
<?= \admin\view\Articles::subpages_list( \admin\factory\Pages::menu_pages( $menu['id'] ), $this -> article['pages'] );?>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<?
|
|
}
|
|
?>
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<ul id="images-list">
|
|
<?
|
|
$images_count = 0;
|
|
if ( is_array( $this -> article['images'] ) ): foreach ( $this -> article['images'] as $img ):
|
|
?>
|
|
<li id="image-<?= $img['id'];?>">
|
|
<img class="article-image lozad" data-src="/libraries/thumb.php?img=<?= $img['src'];?>&w=300&h=300">
|
|
<a href="#" class="input-group-addon btn btn-danger article_image_delete" image-id="<?= $img['id'];?>">
|
|
<i class="fa fa-trash"></i>
|
|
</a>
|
|
<input type="text" class="form-control image-alt" value="<?= $img['alt'];?>" image-id="<?= $img['id'];?>" placeholder="atrybut alt...">
|
|
</li>
|
|
<?
|
|
$images_count++;
|
|
endforeach; endif;
|
|
?>
|
|
</ul>
|
|
<div id="images-uploader">You browser doesn't have Flash installed.</div>
|
|
</div>
|
|
<div>
|
|
<ul id="files-list">
|
|
<?
|
|
$files_count = 0;
|
|
if ( is_array( $this -> article['files'] ) ): foreach ( $this -> article['files'] as $file ):
|
|
|
|
if ( $file['name'] )
|
|
$name = $file['name'];
|
|
else
|
|
{
|
|
$name = explode( '/', $file['src'] );
|
|
$name = $name[ count( $name ) - 1 ];
|
|
}
|
|
?>
|
|
<li id="file-<?= $file['id'];?>">
|
|
<div class="input-group">
|
|
<input type="text" class="article_file_edit form-control" file_id="<?= $file['id'];?>" value="<?= $name;?>" />
|
|
<a href="#" class="input-group-addon btn btn-danger article_file_delete" file_id="<?= $file['id'];?>">
|
|
<i class="fa fa-trash"></i>
|
|
</a>
|
|
</div>
|
|
</li>
|
|
<?
|
|
$files_count++;
|
|
endforeach; endif;
|
|
?>
|
|
</ul>
|
|
<div id="files-uploader">You browser doesn't have Flash installed.</div>
|
|
</div>
|
|
<? if ( is_array( $this -> additional_params_lon ) and count( $this -> additional_params_lon ) or is_array( $this -> additional_params_loff ) and count( $this -> additional_params_loff ) ):?>
|
|
<div>
|
|
<?
|
|
if ( is_array( $this -> article['params'] ) ) foreach ( $this -> article['params'] as $param )
|
|
$params[ $param['param_id'] . '_' . $param['language_id'] ] = $param['value'];
|
|
?>
|
|
<? if ( is_array( $this -> additional_params_loff ) and count( $this -> additional_params_loff ) ):?>
|
|
<? foreach ( $this -> additional_params_loff as $param ):?>
|
|
<? if ( $param['type'] == 'input-date' ):?>
|
|
<?= \Html::input(
|
|
array(
|
|
'label' => $param['display_name'],
|
|
'class' => 'date',
|
|
'name' => 'ap_' . $param['name'],
|
|
'id' => 'ap_' . $param['name'],
|
|
'value' => $params[ $param['id'] . '_' ]
|
|
)
|
|
);?>
|
|
<? endif;?>
|
|
<? if ( $param['type'] == 'switch' ):?>
|
|
<?= \Html::input_switch(
|
|
array(
|
|
'label' => $param['display_name'],
|
|
'name' => 'ap_' . $param['name'],
|
|
'id' => 'ap_' . $param['name'],
|
|
'checked' => $params[ $param['id'] . '_' ] == 'on' ? true : false
|
|
)
|
|
);?>
|
|
<? endif;?>
|
|
<? if ( $param['type'] == 'input-text' ):?>
|
|
<?= \Html::input(
|
|
array(
|
|
'label' => $param['display_name'],
|
|
'name' => 'ap_' . $param['name'],
|
|
'id' => 'ap_' . $param['name'],
|
|
'value' => $params[ $param['id'] . '_' ]
|
|
)
|
|
);?>
|
|
<? endif;?>
|
|
<? if ( $param['type'] == 'ckeditor' ):?>
|
|
<?= \Html::textarea(
|
|
array(
|
|
'label' => $param['display_name'],
|
|
'name' => 'ap_' . $param['name'],
|
|
'id' => 'ap_' . $param['name'],
|
|
'value' => $params[ $param['id'] . '_' ],
|
|
'inline' => true
|
|
)
|
|
);?>
|
|
<script type="text/javascript">
|
|
$( function() {
|
|
$( '#ap_<?= $param['name'];?>' ).ckeditor( {
|
|
toolbar : 'MyTool',
|
|
height:'350'
|
|
});
|
|
});
|
|
</script>
|
|
<? endif;?>
|
|
<? endforeach;?>
|
|
<? endif;?>
|
|
<? if ( is_array( $this -> additional_params_lon ) and count( $this -> additional_params_lon ) ):?>
|
|
<div id="languages-params">
|
|
<ul class="resp-tabs-list languages-params">
|
|
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
|
<? if ( $lg['status'] ):?>
|
|
<li><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a></li>
|
|
<? endif;?>
|
|
<? endforeach; endif;?>
|
|
</ul>
|
|
<div class="resp-tabs-container languages-params">
|
|
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
|
<? if ( $lg['status'] ):?>
|
|
<div>
|
|
<? foreach ( $this -> additional_params_lon as $param ):?>
|
|
<? if ( $param['type'] == 'input-text' ):?>
|
|
<?= \Html::input(
|
|
array(
|
|
'label' => $param['display_name'],
|
|
'name' => 'ap_' . $param['name'] . '_' . $lg['id'],
|
|
'id' => 'ap_' . $param['name'] . '_' . $lg['id'],
|
|
'value' => $params[ $param['id'] . '_' . $lg['id'] ]
|
|
)
|
|
);?>
|
|
<? endif;?>
|
|
<? if ( $param['type'] == 'ckeditor' ):?>
|
|
<?= \Html::textarea(
|
|
array(
|
|
'label' => $param['display_name'],
|
|
'name' => 'ap_' . $param['name'] . '_' . $lg['id'],
|
|
'id' => 'ap_' . $param['name'] . '_' . $lg['id'],
|
|
'value' => $params[ $param['id'] . '_' . $lg['id'] ],
|
|
'inline' => true
|
|
)
|
|
);?>
|
|
<script type="text/javascript">
|
|
$( function() {
|
|
$( '#ap_<?= $param['name'];?>_<?= $lg['id'];?>' ).ckeditor( {
|
|
toolbar : 'MyTool',
|
|
height:'350'
|
|
});
|
|
});
|
|
</script>
|
|
<? endif;?>
|
|
<? endforeach;?>
|
|
</div>
|
|
<? endif;?>
|
|
<? endforeach; endif;?>
|
|
</div>
|
|
</div>
|
|
<? endif;?>
|
|
</div>
|
|
<? endif;?>
|
|
<div>
|
|
<div class="title">Zdjęcia wybrane przez użytkownika (wymagany włączony <b>moduł Pixieset</b>)</div>
|
|
<? if ( is_array( $this -> article['images'] ) ):?>
|
|
<ul>
|
|
<? foreach ( $this -> article['images'] as $image ):?>
|
|
<? if ( $image['favorite'] ):?>
|
|
<li><?= basename( $image['src'] );?></li>
|
|
<? endif;?>
|
|
<? endforeach;?>
|
|
</ul>
|
|
<? endif;?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?
|
|
$out = ob_get_clean();
|
|
|
|
$grid = new \gridEdit;
|
|
$grid -> id = 'article-edit';
|
|
$grid -> gdb_opt = $gdb;
|
|
$grid -> include_plugins = true;
|
|
$grid -> title = 'Edycja artykułu';
|
|
$grid -> fields = [
|
|
[
|
|
'db' => 'id',
|
|
'type' => 'hidden',
|
|
'value' => $this -> article['id']
|
|
]
|
|
];
|
|
$grid -> actions = [
|
|
'save' => [ 'url' => '/admin/articles/article_save/', 'back_url' => '/admin/articles/view_list/' ],
|
|
'cancel' => [ 'url' => '/admin/articles/view_list/' ]
|
|
];
|
|
$grid -> external_code = $out;
|
|
$grid -> persist_edit = true;
|
|
$grid -> id_param = 'id';
|
|
|
|
echo $grid -> draw();
|
|
?>
|
|
|
|
<link type="text/css" rel="stylesheet" href="/libraries/plupload-3.1.2/jquery.plupload.queue/css/jquery.plupload.queue.css">
|
|
<script type="text/javascript" src="/libraries/plupload-3.1.2/plupload.full.min.js"></script>
|
|
<script type="text/javascript" src="/libraries/plupload-3.1.2/jquery.plupload.queue/jquery.plupload.queue.min.js"></script>
|
|
<script type="text/javascript" src="/libraries/plupload-3.1.2/i18n/pl.js"></script>
|
|
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
|
|
<script type="text/javascript" src="/libraries/jquery/lozad.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
var images_count = <?= $images_count;?>;
|
|
var files_count = <?= $files_count;?>;
|
|
|
|
function google_preview( lang_id )
|
|
{
|
|
var meta_title = $.trim( $( '#meta_title_' + lang_id ).val() );
|
|
var title = $( '#title_' + lang_id ).val();
|
|
var seo_link = $( '#seo_link_' + lang_id ).val();
|
|
var description = $( '#meta_description_' + lang_id ).val();
|
|
|
|
if ( typeof title !== "undefined" && title != '' || typeof meta_title !== "undefined" && meta_title != '' )
|
|
{
|
|
if ( meta_title != '' )
|
|
var title_tmp = meta_title
|
|
else
|
|
var title_tmp = title;
|
|
|
|
if ( title_tmp.length < 65 )
|
|
$( '#google-preview-' + lang_id + ' .google-title' ).html( title_tmp );
|
|
else if ( typeof description !== "undefined" )
|
|
{
|
|
var space = title_tmp.lastIndexOf( " ", 65 );
|
|
$( '#google-preview-' + lang_id + ' .google-title' ).html( title_tmp.substring( 0, space ).concat( '...' ) );
|
|
}
|
|
}
|
|
|
|
if ( typeof description !== "undefined" && description.length < 153 )
|
|
$( '#google-preview-' + lang_id + ' .google-description' ).html( description );
|
|
else if ( typeof description !== "undefined" )
|
|
{
|
|
var space = description.lastIndexOf( " ", 153 );
|
|
$( '#google-preview-' + lang_id + ' .google-description' ).html( description.substring( 0, space ).concat( '...' ) );
|
|
}
|
|
|
|
if ( seo_link )
|
|
$( '#google-preview-' + lang_id + ' .google-url' ).html( '<?= $_SERVER['SERVER_NAME'];?>/' + seo_link );
|
|
else
|
|
{
|
|
$.ajax(
|
|
{
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/admin/ajax.php',
|
|
data: {
|
|
a: 'google_url_preview_article',
|
|
title: title,
|
|
article_id: $( '#id' ).val()
|
|
},
|
|
success: function( data )
|
|
{
|
|
$( '#google-preview-' + lang_id + ' .google-url' ).html( data );
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
$( function()
|
|
{
|
|
const observer = lozad();
|
|
observer.observe();
|
|
|
|
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
|
google_preview( '<?= $lg['id'];?>' );
|
|
<? endforeach; endif;?>
|
|
|
|
disable_menu();
|
|
|
|
var el = document.getElementById( 'images-list' );
|
|
var sortable = Sortable.create(el, {
|
|
onEnd: function ( evt ) {
|
|
var order = '';
|
|
$( '#images-list li' ).each( function()
|
|
{
|
|
if ( order !== '' )
|
|
order += ';';
|
|
order += $( this ).children( 'a' ).attr( 'image-id' );
|
|
});
|
|
|
|
$.ajax(
|
|
{
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/admin/articles/gallery_order_save/',
|
|
data:
|
|
{
|
|
article_id: '<?= $this -> article['id'];?>',
|
|
order: order
|
|
},
|
|
beforeSend: function()
|
|
{
|
|
$( '#overlay' ).show();
|
|
},
|
|
success: function( data )
|
|
{
|
|
$( '#overlay' ).hide();
|
|
|
|
response = jQuery.parseJSON( data );
|
|
|
|
if ( response.status !== 'ok' )
|
|
create_error( response.msg );
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
$(".tm-input").tagsManager(
|
|
{
|
|
tagsContainer: '.tags',
|
|
prefilled: [ <?
|
|
if ( is_array( $this -> article['tags'] ) ): foreach ( $this -> article['tags'] as $tag ):
|
|
echo '"' . $tag . '"';
|
|
if ( end( $this -> article['tags'] ) != $tag )
|
|
echo ',';
|
|
endforeach; endif;
|
|
?>],
|
|
tagClass: 'tm-tag-info'
|
|
});
|
|
|
|
jQuery( 'body' ).on( 'click', '.fa-calendar', function()
|
|
{
|
|
$( this ).parents( '.input-group' ).children( 'input' ).trigger( 'click' );
|
|
});
|
|
|
|
$( "#images-uploader" ).pluploadQueue(
|
|
{
|
|
runtimes: 'html5,flash,html4',
|
|
init:
|
|
{
|
|
Refresh: function(up)
|
|
{
|
|
$( ".plupload_buttons" ).css( "display", "inline" );
|
|
$( ".plupload_upload_status" ).css( "display", "inline" );
|
|
$( ".plupload_start" ).addClass( "plupload_disabled" );
|
|
$( ".plupload_start" ).removeClass( "plupload_disabled" );
|
|
},
|
|
UploadComplete: function()
|
|
{
|
|
$( ".plupload_buttons" ).css( "display", "inline" );
|
|
$( ".plupload_upload_status" ).css( "display", "inline" );
|
|
$( ".plupload_start" ).addClass( "plupload_disabled" );
|
|
$( ".plupload_start" ).removeClass( "plupload_disabled" );
|
|
},
|
|
FileUploaded: function( up, file, response )
|
|
{
|
|
data = jQuery.parseJSON( response.response );
|
|
$( '#images-list' ).append(
|
|
'<li id="image-' + data.image_id + '">' +
|
|
'<img class="article-image lozad" data-src="/libraries/thumb.php?img=/' + data.data_link + '&w=300&h=300">' +
|
|
'<a href="#" class="input-group-addon btn btn-danger article_image_delete" image-id="' + data.image_id + '">' +
|
|
'<i class="fa fa-trash"></i>' +
|
|
'</a>' +
|
|
'<input type="text" class="form-control image-alt" value="" image-id="' + data.image_id + '" placeholder="atrybut alt...">' +
|
|
'</li>'
|
|
);
|
|
images_count++;
|
|
observer.observe();
|
|
$( 'html, body' ).animate({
|
|
scrollTop: $( "#images-uploader" ).offset().top
|
|
}, 1 );
|
|
}
|
|
},
|
|
url: '/libraries/plupload/upload-articles-images.php',
|
|
chunk_size: '1mb',
|
|
unique_names: false,
|
|
resize : {
|
|
width : <?= $this -> settings['image_px'] ? $this -> settings['image_px'] : '1920';?>,
|
|
height : <?= $this -> settings['image_px'] ? $this -> settings['image_px'] : '1920';?>,
|
|
quality : 95
|
|
},
|
|
filters: [
|
|
{ title: "Obrazki", extensions : "jpg, gif, png, bmp, jpeg" }
|
|
],
|
|
flash_swf_url: '/../libraries/plupload/plupload.flash.swf'
|
|
});
|
|
|
|
$( "#files-uploader" ).pluploadQueue(
|
|
{
|
|
runtimes: 'html5,flash,html4',
|
|
init:
|
|
{
|
|
Refresh: function( up )
|
|
{
|
|
$( ".plupload_buttons" ).css( "display", "inline" );
|
|
$( ".plupload_upload_status" ).css( "display", "inline" );
|
|
$( ".plupload_start" ).addClass( "plupload_disabled" );
|
|
$( ".plupload_start" ).removeClass( "plupload_disabled" );
|
|
},
|
|
UploadComplete: function()
|
|
{
|
|
$( ".plupload_buttons" ).css( "display", "inline" );
|
|
$( ".plupload_upload_status" ).css( "display", "inline" );
|
|
$( ".plupload_start" ).addClass( "plupload_disabled" );
|
|
$( ".plupload_start" ).removeClass( "plupload_disabled" );
|
|
},
|
|
FileUploaded: function( up, file, response )
|
|
{
|
|
data = jQuery.parseJSON( response.response );
|
|
$( '#files-list' ).append(
|
|
'<li id="file-' + data.file_id + '">' +
|
|
'<div class="input-group">' +
|
|
'<input type="text" class="form-control article_file_edit" file_id="' + data.file_id + '" value="' + data.file_name + '" />' +
|
|
'<a href="#" class="input-group-addon btn btn-info article_file_delete" file_id="' + data.file_id + '">' +
|
|
'<i class="fa fa-trash"></i>' +
|
|
'</a>' +
|
|
'</div>' +
|
|
'</li>'
|
|
);
|
|
files_count++;
|
|
$( 'html, body' ).animate({
|
|
scrollTop: $( "#files-uploader" ).offset().top
|
|
}, 1 );
|
|
}
|
|
},
|
|
url: '/libraries/plupload/upload-articles-files.php',
|
|
chunk_size: '1mb',
|
|
unique_names: false,
|
|
filters: [
|
|
{ title: "Wszystkie pliki", extensions: "*" }
|
|
],
|
|
flash_swf_url: '/../libraries/plupload/plupload.flash.swf'
|
|
});
|
|
|
|
$( '#settings-tabs' ).easyResponsiveTabs({
|
|
width: 'auto',
|
|
fit: true,
|
|
tabidentify: 'settings-tabs',
|
|
type: 'vertical'
|
|
});
|
|
|
|
$( '#languages-main' ).easyResponsiveTabs({
|
|
width: 'auto',
|
|
fit: true,
|
|
tabidentify: 'languages-main'
|
|
});
|
|
|
|
$( '#languages-seo' ).easyResponsiveTabs({
|
|
width: 'auto',
|
|
fit: true,
|
|
tabidentify: 'languages-seo'
|
|
});
|
|
|
|
$( '#languages-params' ).easyResponsiveTabs({
|
|
width: 'auto',
|
|
fit: true,
|
|
tabidentify: 'languages-params'
|
|
});
|
|
|
|
$('ol.sortable').nestedSortable({
|
|
forcePlaceholderSize: true,
|
|
handle: 'div',
|
|
helper: 'clone',
|
|
items: 'li',
|
|
opacity: .6,
|
|
placeholder: 'placeholder',
|
|
revert: 250,
|
|
tabSize: 25,
|
|
tolerance: 'pointer',
|
|
toleranceElement: '> div',
|
|
maxLevels: 3,
|
|
isTree: true,
|
|
expandOnHover: 700,
|
|
isAllowed: function()
|
|
{
|
|
return false;
|
|
}
|
|
});
|
|
|
|
$( '.disclose' ).on( 'click', function() {
|
|
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
|
|
});
|
|
|
|
$( '.disclose' ).mousedown( function(e) {
|
|
if ( e.which === 1 ) {
|
|
if ( $( this ).parent( 'div' ).hasClass( 'content_menu' ) )
|
|
{
|
|
var menu_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'menu' );
|
|
|
|
$.ajax(
|
|
{
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/admin/ajax.php',
|
|
data: {
|
|
a: 'cookie_menus',
|
|
menu_id: menu_id
|
|
}
|
|
});
|
|
}
|
|
else
|
|
{
|
|
var page_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
|
|
|
|
$.ajax(
|
|
{
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/admin/ajax.php',
|
|
data: {
|
|
a: 'cookie_pages',
|
|
page_id: page_id
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
<?php
|
|
$array = unserialize( $_COOKIE[ 'cookie_pages' ] );
|
|
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
|
|
if ( $val ):
|
|
?>$( '.<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
|
|
endif;
|
|
endforeach; endif;
|
|
|
|
$array = unserialize( $_COOKIE[ 'cookie_menus' ] );
|
|
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
|
|
if ( $val ):
|
|
?>$( '.menu_<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
|
|
endif;
|
|
endforeach; endif;
|
|
?>
|
|
|
|
$( 'body' ).on( 'change', '.image-alt', function()
|
|
{
|
|
var image_alt = $( this ).val();
|
|
var image_id = $( this ).attr( 'image-id' );
|
|
|
|
$.ajax(
|
|
{
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/admin/ajax.php',
|
|
data:
|
|
{
|
|
a: 'article_image_alt_change',
|
|
image_id: image_id,
|
|
image_alt: image_alt
|
|
},
|
|
beforeSend: function()
|
|
{
|
|
$( '#overlay' ).show();
|
|
},
|
|
success: function( data )
|
|
{
|
|
$( '#overlay' ).hide();
|
|
|
|
response = jQuery.parseJSON( data );
|
|
|
|
if ( response.status !== 'ok' )
|
|
create_error( response.msg );
|
|
}
|
|
});
|
|
});
|
|
|
|
$( 'body' ).on( 'change', '.article_file_edit', function()
|
|
{
|
|
var file_name = $( this ).val();
|
|
var file_id = $( this ).attr( 'file_id' );
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/admin/ajax.php',
|
|
data:
|
|
{
|
|
a: 'article_file_name_change',
|
|
file_id: file_id,
|
|
file_name: file_name
|
|
},
|
|
beforeSend: function()
|
|
{
|
|
$( '#overlay' ).show();
|
|
},
|
|
success: function( data )
|
|
{
|
|
$( '#overlay' ).hide();
|
|
|
|
response = jQuery.parseJSON( data );
|
|
|
|
if ( response.status !== 'ok' )
|
|
create_error( response.msg );
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
$( 'body' ).on( 'click', '.article_file_delete', function()
|
|
{
|
|
$( this ).blur();
|
|
var file_id = $( this ).attr( 'file_id' );
|
|
|
|
$.prompt( 'Na pewno chcesz usunąć wybrany plik?', {
|
|
title: 'Potwierdź?',
|
|
submit: function(e,v,m,f)
|
|
{
|
|
if ( v === true )
|
|
{
|
|
$.ajax({
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/admin/ajax.php',
|
|
data:
|
|
{
|
|
a: 'article_file_delete',
|
|
file_id: file_id
|
|
},
|
|
beforeSend: function()
|
|
{
|
|
$( '#file-' + file_id ).children( 'input' ).addClass( 'disabled' );
|
|
$( '#file-' + file_id ).children( 'a' ).addClass( 'disabled' );
|
|
},
|
|
success: function( data )
|
|
{
|
|
response = jQuery.parseJSON( data );
|
|
|
|
if ( response.status === 'ok' )
|
|
$( '#file-' + file_id ).remove();
|
|
else
|
|
create_error( msg );
|
|
}
|
|
});
|
|
}
|
|
},
|
|
buttons: {
|
|
'tak': true,
|
|
'nie': false
|
|
},
|
|
focus: 0
|
|
});
|
|
|
|
});
|
|
|
|
$( 'body' ).on( 'click', '.article_image_delete', function()
|
|
{
|
|
$( this ).blur();
|
|
var image_id = $( this ).attr( 'image-id' );
|
|
|
|
$.prompt( 'Na pewno chcesz usunąć wybrane zdjęcie?',
|
|
{
|
|
title: 'Potwierdź?',
|
|
submit: function(e,v,m,f)
|
|
{
|
|
if ( v === true )
|
|
{
|
|
$.ajax(
|
|
{
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/admin/ajax.php',
|
|
data:
|
|
{
|
|
a: 'article_image_delete',
|
|
image_id: image_id
|
|
},
|
|
beforeSend: function()
|
|
{
|
|
$( '#overlay' ).show();
|
|
},
|
|
success: function( data )
|
|
{
|
|
$( '#overlay' ).hide();
|
|
response = jQuery.parseJSON( data );
|
|
|
|
if ( response.status === 'ok' )
|
|
$( '#image-' + image_id ).remove();
|
|
else
|
|
create_error( msg );
|
|
}
|
|
});
|
|
}
|
|
},
|
|
buttons: {
|
|
'tak': true,
|
|
'nie': false
|
|
},
|
|
focus: 0
|
|
});
|
|
return false;
|
|
});
|
|
|
|
$( '#g-menu' ).attr( 'data-spy', 'affix' );
|
|
$( '#g-menu' ).attr( 'data-offset-top', '135' );
|
|
});
|
|
|
|
function generate_seo_links( lang, title, article_id )
|
|
{
|
|
if ( title === '' )
|
|
return false;
|
|
|
|
$.ajax(
|
|
{
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/admin/ajax.php',
|
|
data:
|
|
{
|
|
a: 'generate_seo_link',
|
|
title: title,
|
|
article_id: article_id
|
|
},
|
|
beforeSend: function()
|
|
{
|
|
$( '#seo_link_' + lang ).parents( '.g-form-data' ).find( 'input, a' ).each( function()
|
|
{
|
|
$( this ).prop( 'disabled', true ).addClass( 'disabled' );
|
|
});
|
|
},
|
|
success: function( data ) {
|
|
|
|
$( '#seo_link_' + lang ).parents( '.g-form-data' ).find( 'input, a' ).each( function() {
|
|
$( this ).prop( 'disabled', false ).removeClass( 'disabled' );
|
|
});
|
|
|
|
response = jQuery.parseJSON( data );
|
|
|
|
if ( response.status === 'ok' ){
|
|
$( '#seo_link_' + lang ).val( response.seo_link );
|
|
$( '#google-preview-' + lang + ' .google-url' ).html( '<?= $_SERVER['SERVER_NAME'];?>/' + response.seo_link );
|
|
|
|
}
|
|
else
|
|
create_error( response.msg );
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
<script type="text/javascript">
|
|
CKEDITOR.dtd.$removeEmpty['span'] = false;
|
|
CKEDITOR.on( 'instanceReady', function (ev) {
|
|
var editor = ev.editor,
|
|
dataProcessor = editor.dataProcessor,
|
|
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
|
|
htmlFilter.addRules( {
|
|
elements : {
|
|
img: function( el ) {
|
|
var style = el.attributes.style;
|
|
if ( style )
|
|
{
|
|
var match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec(style),
|
|
width = match && match[1];
|
|
|
|
match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec(style);
|
|
var height = match && match[1];
|
|
|
|
if ( height )
|
|
el.attributes.style = el.attributes.style.replace(/(?:^|\s)height\s*:\s*(\d+)px;?/i, '');
|
|
|
|
if ( width )
|
|
{
|
|
el.attributes.style = el.attributes.style.replace(/(?:^|\s)max-width\s*:\s*(\d+)px;?/i, '' );
|
|
el.attributes.style = el.attributes.style.replace(/(?:^|\s)width\s*:\s*(\d+)px;?/i, 'max-width: ' + width + 'px;' );
|
|
el.attributes.style = el.attributes.style + ' width: 100%;';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
});
|
|
</script>
|