Exemple #1
0
function actionOpen($menu_item)
{
    global $my_app;
    $explorerAPI = new phpos_explorerAPI();
    $explorerAPI->set_allowed_extensions($my_app->get_param('allowed_extensions'));
    $j = $explorerAPI->openfile_dialog();
    return $j;
}
 public function save_file_content($file_name, $content)
 {
     global $my_app;
     $explorerAPI = new phpos_explorerAPI();
     $explorerAPI->set_window_id($my_app->get_param('win_id'));
     $app_data = $explorerAPI->get_cached_app_data();
     $shortcut = new phpos_shortcuts();
     $app_params['content'] = 1;
     if (false !== ($record_id = $shortcut->add($file_name, 'app', $app_data['app_id'], $app_data['app_action'], null, $app_params, 'db', $my_app->get_param('dir_id'), $content))) {
         $file['id'] = $record_id;
         return $this->get_file_info($file);
     }
 }
    die;
}
cache_param('navigation_index');
cache_param('action_status');
cache_param('readonly');
cache_param('win_id');
cache_param('api_dialog');
cache_param('api_dialog_type');
cache_param('api_file_ext');
cache_param('explorer_save_as_filename');
cache_param('api_action');
if (!empty($_POST['explorer_save_as_filename'])) {
    $my_app->set_param('explorer_save_as_filename', filter::fname($_POST['explorer_save_as_filename']));
}
/*.............................................. */
$explorerAPI = new phpos_explorerAPI();
$explorerAPI->set_window_id($my_app->get_param('win_id'));
$my_app->set_param('api_action', $explorerAPI->get_action());
cache_param('api_action');
/*.............................................. */
if ($my_app->get_param('api_open_id') != null) {
    $my_app->set_param('opened_file_id', base64_decode($my_app->get_param('api_open_id')));
    cache_param('opened_file_id');
}
// api load file
if ($my_app->get_param('api_dialog') !== null && $my_app->get_param('opened_file_id') !== null) {
    $phposFS->set_api_file_id($my_app->get_param('opened_file_id'));
    $api_file_content = $phposFS->get_file_content();
    /*.............................................. */
    if (!is_array($_SESSION['phpos_files_handler'])) {
        $_SESSION['phpos_files_handler'] = array();
$my_app->set_param('id_file', null);
$my_app->set_param('notepad', null);
$my_app->set_param('file_info', null);
$my_app->set_param('action', null);
$my_app->set_param('content', null);
$my_app->set_param('allowed_extensions', null);
$my_app->using('params');
cache_param('id_file');
cache_param('notepad');
cache_param('file_info');
cache_param('action');
cache_param('content');
$allowed = array('notepad', 'txt', 'log', 'html', 'htm');
$my_app->set_param('allowed_extensions', $allowed);
cache_param('allowed_extensions');
$explorerAPI = new phpos_explorerAPI();
if ($my_app->get_param('loadAPI')) {
    $explorerAPI->openfile();
}
if ($my_app->get_param('action') == 'new_file') {
    $explorerAPI->clear_all_data();
    $my_app->set_param('notepad', null);
    $my_app->set_param('action', null);
    $my_app->set_param('file_info', null);
    $my_app->set_param('id_file', null);
    winreload();
    cache_param('id_file');
    cache_param('notepad');
    cache_param('action');
    cache_param('file_info');
    cache_param('action');
Exemple #5
0
?>

<?php 
echo $layout->set_style('padding:15px');
?>
	

<?php 
echo $layout->main();
?>
	



<?php 
$explorerAPI = new phpos_explorerAPI();
$explorerAPI->set_file_extension('txt');
$explorerAPI->set_allowed_extensions($my_app->get_param('allowed_extensions'));
//echo 'id file: '.$my_app->get_param('id_file').'<br>';
if ($my_app->get_param('file_info') !== null) {
    $file_info = $my_app->get_param('file_info');
    winset('title', $file_info['basename']);
    $explorerAPI->set_file_info($file_info);
    $str_file = '<span style="color:black; font-weight:bold;font-size:16px">' . $file_info['basename'] . ' </span>';
    $str_fileinfo = '<img src="' . MY_RESOURCES_URL . 'db_file.png" />' . $str_file . ' <b style="padding-left:30px;color:black">' . txt('last_mod') . ':</b> ' . date('Y.m.d. H:i', $file_info['modified_at']) . ', <b style="color:black">' . txt('filesystem') . ':</b> ' . txt('fs_' . $file_info['fs']);
    echo "<script>\$('#notepadform input[name=action]').val('save');</script>";
    //echo $layout->subtitle('<span style="color:black">'.$file_info['basename'].' </span>', MY_RESOURCES_URL.'db_file.png');
} else {
    $str_fileinfo = '<img src="' . MY_RESOURCES_URL . 'db_file.png" /><span style="color:black; font-weight:bold;font-size:16px">' . txt('app_notepad_new_unsaved') . '</span>';
}
$save_action = "\t\t\t\n\t\t\$('#notepadform input[name=action]').val('save');\n\t\t\$('#notepadform').submit(); \t\t\n\t\t";