48 protected $disallowed_objects = [];
49 protected $objects_to_fix = [];
50 protected $clean_objects = [];
51 protected $require_update = FALSE;
75 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn,
'add_to_queue');
77 if (!in_array($action, [
'cut',
'copy'])) {
78 trigger_error(sprintf(
'Specified action "%s" does not exists for copy & paste.', $action));
84 $tmp[
'method'] = $action;
88 $infos = objects::infos($type);
89 $tmp[
'aclCategory'] = $infos[
'aclCategory'];
90 $tmp[
'mainTab'] = $infos[
'mainTab'];
91 $tmp[
'parent'] = NULL;
93 $this->queue[] = $tmp;
94 if ($action ==
'copy') {
95 $this->objectList[] = $tmp;
97 $this->require_update = TRUE;
110 $this->current = FALSE;
111 $this->require_update = TRUE;
113 $this->objectList = [];
121 $this->current = FALSE;
122 $this->require_update = TRUE;
131 return ((count($this->queue) > 0) || ($this->current !== FALSE));
139 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $entry[
'dn'],
'load_entry_from_ldap');
140 if (!isset($entry[
'tab_class']) && !isset($entry[
'type'])) {
144 $entry[
'object'] =
objects::open($entry[
'dn'], $entry[
'type']);
146 if ($entry[
'parent'] !== NULL) {
147 $entry[
'object']->parent = $entry[
'parent'];
150 if ($entry[
'method'] ==
'copy') {
151 $entry[
'object']->resetCopyInfos();
154 logging::log(
'copy', $entry[
'method'], $entry[
'dn'], [],
'');
156 $entry[
'object']->resetBase();
168 if ($this->require_update) {
169 $this->clean_objects = [];
170 $this->objects_to_fix = [];
171 $this->disallowed_objects = [];
174 foreach ($this->queue as $key => $entry) {
177 if (!isset($entry[
'object'])) {
179 $this->queue[$key] = $entry;
183 $copy_acl = $ui->is_copyable($entry[
'dn'], $entry[
'aclCategory']);
184 $cut_acl = $ui->is_cutable($entry[
'dn'], $entry[
'aclCategory'], $entry[
'mainTab']);
187 if ((($entry[
'method'] ==
'copy') && !$copy_acl)
188 || (($entry[
'method'] ==
'cut') && !$cut_acl)) {
189 $this->disallowed_objects[$key] = $entry;
191 $this->clean_objects[$key] = $entry;
194 if (count($this->disallowed_objects)) {
196 foreach ($this->disallowed_objects as $entry) {
197 $dns[] = $entry[
'dn'];
202 $this->require_update = FALSE;
206 if (count($this->clean_objects)) {
207 foreach ($this->clean_objects as $key => $entry) {
208 $this->current = $entry;
209 $errors = $this->current[
'object']->save();
211 if (empty($errors)) {
212 $this->current_saved();
214 unset($this->queue[$key]);
216 $this->objects_to_fix[$key] = $entry;
218 unset($this->clean_objects[$key]);
220 $this->current = FALSE;
224 if (isset($this->current[
'object'])) {
225 $dialogWasOpened = $this->current[
'object']->dialogOpened();
226 $this->current[
'object']->readPost();
227 $this->current[
'object']->update();
229 if (!$dialogWasOpened && !$this->current[
'object']->dialogOpened() && isset($_POST[
'edit_finish'])) {
230 $errors = $this->current[
'object']->save();
232 if (empty($errors)) {
233 $this->current_saved();
235 msg_dialog::displayChecks($errors);
250 if ($this->current || count($this->objects_to_fix)) {
251 if (!$this->current) {
252 $key = key($this->objects_to_fix);
254 $this->current = $this->objects_to_fix[$key];
255 unset($this->objects_to_fix[$key]);
256 unset($this->queue[$key]);
259 if ($this->current) {
260 $display = $this->current[
'object']->render();
261 if (!$this->current[
'object']->dialogOpened()) {
263 $display .=
'<p class="plugbottom">'.
"\n";
264 $display .=
'<input type="submit" name="edit_finish" style="width:80px" value="'.msgPool::okButton().
'"/>'.
"\n";
265 $display .=
" \n";
266 $display .=
'<input type="submit" formnovalidate="formnovalidate" name="abort_current_cut-copy_operation" value="'.msgPool::cancelButton().
'"/>'.
"\n";
267 $display .=
'<input type="submit" formnovalidate="formnovalidate" name="abort_all_cut-copy_operations" value="'._(
'Cancel all').
'"/>'.
"\n";
276 private function current_saved ()
278 $this->lastdn = $this->current[
'object']->dn;
280 $this->handleReferences();
281 $this->current = FALSE;
299 if (isset($_POST[
'abort_current_cut-copy_operation'])) {
300 $this->current = FALSE;
303 if (isset($_POST[
'abort_all_cut-copy_operations'])) {
305 $this->current = FALSE;
309 function handleReferences ()
311 $dst_dn = $this->current[
'object']->dn;
312 $src_dn = $this->current[
'dn'];
314 $this->current[
'object']->getBaseObject()->handleForeignKeys(
317 ($this->current[
'method'] ==
'cut' ?
'move' :
'copy')
328 $Copy_Paste =
" <img class='center' src='images/lists/seperator.png' alt='' height='16' width='1'> ";
330 $Copy_Paste .=
"<input type='image' name='editPaste' class='center' 331 src='geticon.php?context=actions&icon=edit-paste&size=16' alt='"._(
"Paste").
"'> ";
333 $Copy_Paste .=
"<img class='center' src='geticon.php?context=actions&icon=edit-paste&size=16&disabled=1' alt=\""._(
"Cannot paste").
"\"> ";
add_to_queue($dn, $action, $type)
Entry entry to Copy & Paste queue. A Queue entry is represented as follows. array['method'] - 'copy' or '...
cleanup_queue()
This removes all objects from queue. Remove hdd dumps of current entries too. Remove entries older th...
entries_queued()
Check if there are still entries the object queue.
update()
Update state and return FALSE if the dialog was closed.
generatePasteIcon()
Generate the paste icon for headpages.
This interface should be implemented by all dialog classes in FusionDirectory.
$objectList
This array contains all dns of the currently copied objects.
resetPaste()
This resets the queue to allow pasting again.
load_entry_from_ldap($entry)
Paste one entry from LDAP.
& get_userinfo()
Return the current userinfo object.
This class contains all function to copy and paste.
__construct()
Create CP handler.
static log(string $action, string $objecttype, string $object, array $changes=[], string $result='')
logging method
last_entry()
Get the last endited entry.
static permCreate($name='')
Display that we have no permission to create an object.
readPost()
Save new values posted by copy & paste dialog.
$lastdn
The dn of the last edited object.
static open(string $dn, string $type)
Create the tab object for the given dn.
static debug(int $level, int $line, string $function, string $file, $data, string $info='')
Debug output method.
render()
Displays a dialog which allows the user to fix all dependencies of this object. Create unique names...
$queue
This array contains all remaining objects to paste.