dolibarr  16.0.5
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 require '../../../../main.inc.php';
25 
26 $langs->load("ecm");
27 
28 ?>
29 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
30 <!--
31  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
32  * Copyright (C) 2003-2010 Frederico Caldeira Knabben
33  *
34  * == BEGIN LICENSE ==
35  *
36  * Licensed under the terms of any of the following licenses at your
37  * choice:
38  *
39  * - GNU General Public License Version 2 or later (the "GPL")
40  * https://www.gnu.org/licenses/gpl.html
41  *
42  * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
43  * https://www.gnu.org/licenses/lgpl.html
44  *
45  * - Mozilla Public License Version 1.1 or later (the "MPL")
46  * http://www.mozilla.org/MPL/MPL-1.1.html
47  *
48  * == END LICENSE ==
49  *
50  * Page used to create new folders in the current folder.
51 -->
52 <html>
53  <head>
54  <title>Create Folder</title>
55  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
56 <?php
57 print '<!-- Includes CSS for Dolibarr theme -->'."\n";
58 // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
59 $themepath = dol_buildpath($conf->css, 1);
60 $themesubdir = '';
61 if (!empty($conf->modules_parts['theme'])) { // This slow down
62  foreach ($conf->modules_parts['theme'] as $reldir) {
63  if (file_exists(dol_buildpath($reldir.$conf->css, 0))) {
64  $themepath = dol_buildpath($reldir.$conf->css, 1);
65  $themesubdir = $reldir;
66  break;
67  }
68  }
69 }
70 
71 //print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
72 print '<link rel="stylesheet" type="text/css" href="'.$themepath.'">'."\n";
73 ?>
74  <link href="browser.css" type="text/css" rel="stylesheet">
75  <script type="text/javascript" src="js/common.js"></script>
76  <script type="text/javascript">
77 
78 function SetCurrentFolder( resourceType, folderPath )
79 {
80  oConnector.ResourceType = resourceType ;
81  oConnector.CurrentFolder = folderPath ;
82 }
83 
84 function CreateFolder()
85 {
86  var sFolderName ;
87 
88  while ( true )
89  {
90  sFolderName = prompt( 'Type the name of the new folder:', '' );
91 
92  if ( sFolderName == null )
93  return ;
94  else if ( sFolderName.length == 0 )
95  alert( 'Please type the folder name' );
96  else
97  break ;
98  }
99 
100  oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + encodeURIComponent( sFolderName) , CreateFolderCallBack );
101 }
102 
103 function CreateFolderCallBack( fckXml )
104 {
105  if ( oConnector.CheckError( fckXml ) == 0 )
106  window.parent.frames['frmResourcesList'].Refresh();
107 
108  /*
109  // Get the current folder path.
110  var oNode = fckXml.SelectSingleNode( 'Connector/Error' );
111  var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value );
112 
113  switch ( iErrorNumber )
114  {
115  case 0:
116  window.parent.frames['frmResourcesList'].Refresh();
117  break;
118  case 101:
119  alert( 'Folder already exists' );
120  break;
121  case 102:
122  alert( 'Invalid folder name' );
123  break;
124  case 103:
125  alert( 'You have no permissions to create the folder' );
126  break;
127  case 110:
128  alert( 'Unknown error creating folder' );
129  break;
130  default:
131  alert( 'Error creating folder. Error number: ' + iErrorNumber );
132  break;
133  }
134  */
135 }
136 
137 window.onload = function()
138 {
139  window.top.IsLoadedCreateFolder = true ;
140 }
141  </script>
142  </head>
143  <body>
144  <table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0">
145  <tr>
146  <td>
147  <button type="button" class="butAction" onclick="CreateFolder();"><?php echo $langs->trans("ECMNewSection"); ?></button>
148  </td>
149  </tr>
150  </table>
151  </body>
152 </html>
dol_buildpath
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Definition: functions.lib.php:1062
type
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119