frmcreatefolder.php 4.3 KB

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