dolibarr  18.0.0
frmcreatefolder.php
1 <?php
2 /* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2003-2010 Frederico Caldeira Knabben
4  *
5  * Source modified from part of fckeditor (http://www.fckeditor.net)
6  * retrieved as GPL v2 or later
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 define('NOTOKENRENEWAL', 1); // Disables token renewal
23 
24 // Load Dolibarr environment
25 require '../../../../main.inc.php';
26 
27 $langs->load("ecm");
28 
29 top_httphead();
30 
31 ?>
32 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
33 <!--
34  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
35  * Copyright (C) 2003-2010 Frederico Caldeira Knabben
36  *
37  * == BEGIN LICENSE ==
38  *
39  * Licensed under the terms of any of the following licenses at your
40  * choice:
41  *
42  * - GNU General Public License Version 2 or later (the "GPL")
43  * https://www.gnu.org/licenses/gpl.html
44  *
45  * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
46  * https://www.gnu.org/licenses/lgpl.html
47  *
48  * - Mozilla Public License Version 1.1 or later (the "MPL")
49  * http://www.mozilla.org/MPL/MPL-1.1.html
50  *
51  * == END LICENSE ==
52  *
53  * Page used to create new folders in the current folder.
54 -->
55 <html>
56  <head>
57  <title>Create Folder</title>
58  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
59 <?php
60 print '<!-- Includes CSS for Dolibarr theme -->'."\n";
61 // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
62 $themepath = dol_buildpath($conf->css, 1);
63 $themesubdir = '';
64 if (!empty($conf->modules_parts['theme'])) { // This slow down
65  foreach ($conf->modules_parts['theme'] as $reldir) {
66  if (file_exists(dol_buildpath($reldir.$conf->css, 0))) {
67  $themepath = dol_buildpath($reldir.$conf->css, 1);
68  $themesubdir = $reldir;
69  break;
70  }
71  }
72 }
73 
74 //print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
75 print '<link rel="stylesheet" type="text/css" href="'.$themepath.'">'."\n";
76 ?>
77  <link href="browser.css" type="text/css" rel="stylesheet">
78  <script type="text/javascript" src="js/common.js"></script>
79  <script type="text/javascript">
80 
81 function SetCurrentFolder( resourceType, folderPath )
82 {
83  oConnector.ResourceType = resourceType ;
84  oConnector.CurrentFolder = folderPath ;
85 }
86 
87 function CreateFolder()
88 {
89  var sFolderName ;
90 
91  while ( true )
92  {
93  sFolderName = prompt( 'Type the name of the new folder:', '' );
94 
95  if ( sFolderName == null )
96  return ;
97  else if ( sFolderName.length == 0 )
98  alert( 'Please type the folder name' );
99  else
100  break ;
101  }
102 
103  oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + encodeURIComponent( sFolderName) , CreateFolderCallBack );
104 }
105 
106 function CreateFolderCallBack( fckXml )
107 {
108  if ( oConnector.CheckError( fckXml ) == 0 )
109  window.parent.frames['frmResourcesList'].Refresh();
110 
111  /*
112  // Get the current folder path.
113  var oNode = fckXml.SelectSingleNode( 'Connector/Error' );
114  var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value );
115 
116  switch ( iErrorNumber )
117  {
118  case 0:
119  window.parent.frames['frmResourcesList'].Refresh();
120  break;
121  case 101:
122  alert( 'Folder already exists' );
123  break;
124  case 102:
125  alert( 'Invalid folder name' );
126  break;
127  case 103:
128  alert( 'You have no permissions to create the folder' );
129  break;
130  case 110:
131  alert( 'Unknown error creating folder' );
132  break;
133  default:
134  alert( 'Error creating folder. Error number: ' + iErrorNumber );
135  break;
136  }
137  */
138 }
139 
140 window.onload = function()
141 {
142  window.top.IsLoadedCreateFolder = true ;
143 }
144  </script>
145  </head>
146  <body>
147  <table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0">
148  <tr>
149  <td>
150  <button type="button" class="butAction" onclick="CreateFolder();"><?php echo $langs->trans("ECMNewSection"); ?></button>
151  </td>
152  </tr>
153  </table>
154  </body>
155 </html>
top_httphead
if(!defined('NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1494
dol_buildpath
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Definition: functions.lib.php:1158
button
table tableforfield button
Definition: style.css.php:848
type
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:120