Webpad 3.0 Personal > Dialogs / New.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Webpad 3.0 Personal

Download:
webpad-3.0-personal.zip

Category:
Content Management

Archive Content:

Webpad 3.0 Personal

Webpad 3.0 Personal > Admin

Webpad 3.0 Personal > Css

Webpad 3.0 Personal > Dialogs

Webpad 3.0 Personal > Docs

Webpad 3.0 Personal

Webpad 3.0 Personal > Images

Webpad 3.0 Personal

Webpad 3.0 Personal > Js

Webpad 3.0 Personal

Webpad 3.0 Personal > Locations

Webpad 3.0 Personal

Webpad 3.0 Personal > Plugins > Blogging

Webpad 3.0 Personal > Plugins > Blogger

Webpad 3.0 Personal > Plugins > Blosxom

Webpad 3.0 Personal > Plugins > Livejournal

Webpad 3.0 Personal > Plugins > Movabletype

Webpad 3.0 Personal > Plugins > Typepad

Webpad 3.0 Personal > Plugins > Wordpress

Webpad 3.0 Personal

Webpad 3.0 Personal > Templates

Webpad 3.0 Personal

New.php:


<?php
require_once('../admin/configuration.php');
require_once(
'../admin/authentication.php');
require_once(
'../locations/common.php');
?>
<html>
<head>
<title>Create New File</title>
<link rel="stylesheet" href="../css/dialog.css" type="text/css" />
<?php
if (isset($_POST['type'])) {
    echo 
'<script language="JavaScript" type="text/javascript" src="../js/tools.js"></script>';
    if (
$_POST['type'] == 'blank') {
        echo 
"<script language=\"JavaScript\" type=\"text/javascript\">\n";
        echo 
"<!--\n";
        echo 
"opener.parent.frames.wp_toolbar.file_new(true);\n";
        echo 
"window.close();\n";
        echo 
"// -->\n";
        echo 
"</script>\n";
    }
    else {
        
// If a template has been requested (New -> From Template),  then load it.
        
if ($_POST['template'] != '') {
            
$_SESSION['filename'] = '../templates/' $_POST['template'];
            
$_SESSION['display_filename'] = '';
            
$_SESSION['operation'] = 'open';
            
$_SESSION['open_type'] = 'template';
            
            
// Reload webpad with that template and close this window
            
reload_webpad_and_close();
        }
    }
}
?>
</head>

<body onload="this.focus(); document.dialog.newfile.focus();" onkeypress="if (event.keyCode==27) { window.close(); }">
<form name="dialog" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<h1>Create New File</h1>
<p><input type="radio" name="type" value="blank" id="new" checked="checked" />&nbsp;<label for="new">Blank File</label></p>
<?php
// Get a listing of templates in the template directory
if (is_dir('../templates/')) {
    
$templates read_dir_to_array('../templates/',  array('wpt'));
    
sort($templates);
}

// Now output options to select a templae if there are any
if (sizeof($templates) && $config['use_templates'] == true) {
    echo 
'<p><input type="radio" name="type" value="template" id="url" />&nbsp;<select name="template" onchange="document.dialog.type[1].checked = true;">';
    echo 
'<option value="" selected="true">Select Template</option>';
    foreach (
$templates as $template) {
        echo 
'<option value="' $template '">' str_replace(array('_',  '.wpt'),  array(' ',  ''),  $template) . '</option>';
    }
    echo 
'</select></p>';
}
else {
    echo 
"<script language=\"JavaScript\" type=\"text/javascript\">\n";
    echo 
"<!--\n";
    echo 
"document.dialog.submit();\n";
    echo 
"// --!>\n";
    echo 
"</script>\n";
}
?>

<div align="center">
<input type="submit" name="newfile" value="  New  " />
<input type="button" name="cancel" value="Cancel" onclick="window.close();" />
</div>

</form>

</body>
</html>


Other Content Management Scripts:

WebMaster Resources Home

©RingsWorld.com