From 7eeef6c0cbc6c9910d07d562c4caaffba39662d3 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 31 Mar 2010 09:47:54 +0000 Subject: [PATCH] Updated mimetypes -They are now listable again git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17429 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/mimetypes/class_filterMIMETYPES.inc | 19 + .../mimetypes/class_mimetypeManagement.inc | 89 +++- gosa-plugins/goto/admin/mimetypes/generic.tpl | 405 +++++++++--------- .../mimetypes/mimetype-filter-release.tpl | 60 ++- .../mimetypes/mimetype-filter-release.xml | 44 +- .../goto/admin/mimetypes/mimetype-filter.xml | 4 +- .../admin/mimetypes/mimetype-list-release.tpl | 49 ++- .../admin/mimetypes/mimetype-list-release.xml | 4 +- .../goto/admin/mimetypes/mimetype-list.tpl | 56 ++- .../goto/admin/mimetypes/paste_generic.tpl | 59 ++- .../goto/admin/mimetypes/release_select.tpl | 14 +- 11 files changed, 435 insertions(+), 368 deletions(-) create mode 100644 gosa-plugins/goto/admin/mimetypes/class_filterMIMETYPES.inc diff --git a/gosa-plugins/goto/admin/mimetypes/class_filterMIMETYPES.inc b/gosa-plugins/goto/admin/mimetypes/class_filterMIMETYPES.inc new file mode 100644 index 000000000..eec5c293c --- /dev/null +++ b/gosa-plugins/goto/admin/mimetypes/class_filterMIMETYPES.inc @@ -0,0 +1,19 @@ + $entry){ + if(isset($entry['FAIstate']) && preg_match("/freeze/i", $entry['FAIstate'][0])){ + $res[$id]['objectClass'][] = 'FAKE_OC_freeze'; + }else{ + $res[$id]['objectClass'][] = 'FAKE_OC_branch'; + } + } + return($res); + } +} +?> diff --git a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc index 4b2c0b572..6d6a2d9bf 100644 --- a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc +++ b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc @@ -27,6 +27,7 @@ class mimetypeManagement extends management var $plIcon = "plugins/goto/images/mimetypes.png"; var $mime_release = ""; // The currently selected release while in release management mode! + var $mime_base = ""; // The currently selected release while in release management mode! // Tab definition protected $tabClass = "mimetabs"; @@ -35,16 +36,21 @@ class mimetypeManagement extends management protected $aclPlugin = "mimetype"; protected $objectName = "mimetype"; + var $releaseSelector = NULL; + function __construct($config,$ui) { $this->config = $config; $this->ui = $ui; + $this->mime_base = get_ou('mimetypeRDN').$this->config->current['BASE']; + $this->mime_release = get_ou('mimetypeRDN').$this->config->current['BASE']; if($this->IsReleaseManagementActivated()){ - $this->mime_release = get_ou('mimetypeRDN').$this->config->current['BASE']; $filter_xml = "mimetype-filter-release.xml"; - $list_xml = "mimetype-list-release.xml"; + $list_xml = "mimetype-list-release.xml"; $this->storagePoints= array(""); + $releases = faiManagement::getReleaseStates($this->config,$this->mime_base); + $this->releaseSelector = new releaseSelector($releases, $this->mime_release, $this->mime_release); }else{ $filter_xml = "mimetype-filter.xml"; $list_xml = "mimetype-list.xml"; @@ -52,7 +58,7 @@ class mimetypeManagement extends management } // Build filter - if (session::global_is_set(get_class($this)."_filter")){ + if (0 && session::global_is_set(get_class($this)."_filter")){ $filter= session::global_get(get_class($this)."_filter"); } else { $filter = new filter(get_template_path($filter_xml, true)); @@ -74,41 +80,84 @@ class mimetypeManagement extends management parent::__construct($config, $ui, "mimetypes", $headpage); } + + /*! \brief Overridden render method of class mangement. + * this allows us to add a release selection box. + */ function renderList() { + $smarty = get_smarty(); $filter = $this->getFilter(); $headpage = $this->getHeadpage(); - if($this->IsReleaseManagementActivated()){ - $filter->setComboBoxOptions("RELEASE",$this->getReleaseList()); - if(isset($_POST['RELEASE'])){ - $this->mime_release = get_post('RELEASE'); - } + // Display release selector + if($this->IsReleaseManagementActivated()){ + $this->releaseSelector->update(); + $this->mime_release = $this->releaseSelector->getBase(); $headpage->setBase($this->mime_release); + $smarty->assign("RELEASE", $this->releaseSelector->render()); } $headpage->update(); $display = $headpage->render(); return($this->getHeader().$display); } + - function getReleaseList($base = "", $prefix ="") + /*! \brief This method opens an existing object or a list of existing objects to be edited. + * + * + * @param String 'action' The name of the action which was the used as trigger. + * @param Array 'target' A list of object dns, which should be affected by this method. + * @param Array 'all' A combination of both 'action' and 'target'. + */ + function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") { - $list = array(); - if(empty($base)){ - $base = get_ou('mimetypeRDN').$this->config->current['BASE']; - $list[$base] = "/"; + management::editEntry($action,$target,$all,$altTabClass,$altTabType,$altAclCategory); + if($this->tabObject){ + if(isset($this->tabObject->by_object['mimetype']->attrs['FAIstate'][0])){ + $state = $this->tabObject->by_object['mimetype']->attrs['FAIstate'][0]; + $this->tabObject->setReadOnly(preg_match("/freeze/i", $state)); + } } + } + + + /*! \brief Someone wants to remove some object(s) + * ask for a confirmation now. + */ + function removeEntryRequested($action="",$target=array(),$all=array(), + $altTabClass ="", $altTabType = "", $altAclCategory="") + { + // Close dialogs and remove locks for currently handled dns + $this->cancelEdit(); - $ldap = $this->config->get_ldap_link(); - $ldap->ls("(objectClass=FAIbranch)",$base,array("ou","FAIstate")); - while($release = $ldap->fetch()){ - $list[$release['dn']] = $prefix.$release['ou'][0]; - $list = array_merge($list,$this->getReleaseList($release['dn'],$prefix."  ")); + // Do not allow to remove objects with state freeezed + $errors = $disallowed = array(); + $headpage = $this->getHeadpage(); + foreach($target as $dn){ + + $obj = $headpage->getEntry($dn); + $acl = $this->ui->get_permissions($obj['dn'],"mimetypes/mimetype"); + if(!preg_match("/d/",$acl)){ + $disallowed[] = $obj['dn']; + }elseif(isset($obj['FAIstate']) && preg_match('/freeze/i', $obj['FAIstate'][0])){ + $errors[] = $obj['dn']; + }else{ + $this->dns[] = $obj['dn']; + } + } + if(count($errors)){ + msg_dialog::display(_("Branch locked"), + sprintf(_("The following entries are locked, you can't remove them %s."), + msgPool::buildList($errors)),INFO_DIALOG); } - return($list); + if(count($disallowed)){ + msg_dialog::display(_("Permission error"), msgPool::permDelete($disallowed), ERROR_DIALOG); + } + return(management::removeEntryRequested($action, $this->dns)); } - + function IsReleaseManagementActivated() { diff --git a/gosa-plugins/goto/admin/mimetypes/generic.tpl b/gosa-plugins/goto/admin/mimetypes/generic.tpl index ebbaf6e3a..24a3be19c 100644 --- a/gosa-plugins/goto/admin/mimetypes/generic.tpl +++ b/gosa-plugins/goto/admin/mimetypes/generic.tpl @@ -1,215 +1,194 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
-

{t}Generic{/t}

-
- - - - - - - - - - - - - - -{if !$isReleaseMimeType} - - - - - -{/if} -
- {t}Mime type{/t}{$must} - -{render acl=$cnACL} - -{/render} -
- {t}Mime group{/t} - -{render acl=$gotoMimeGroupACL} - -{/render} -
- {t}Description{/t} - -{render acl=$descriptionACL} - -{/render} -
- {render acl=$baseACL} - - {/render} - {if !$isReleaseMimeType} - {render acl=$baseACL disable_picture='images/lists/folder_grey.png'} - {image path="images/lists/folder.png" action="chooseBase" title="{t}Select a base{/t}"} - - {/render} - {/if} -
- -
- - - - - - -
-
-{if $IconReadable} - {image path="{$gotoMimeIcon}"} - style="width:48px; height:48; background-color:white; vertical-align:bottom;"> -{else} - {image path="images/empty.png"} - style="width:48px; height:48; background-color:white; vertical-align:bottom;"> -{/if} -
- -  
- -{render acl=$gotoMimeIconACL} - -{/render} -{render acl=$gotoMimeIconACL} - - title="{t}Update mime type icon{/t}"> -{/render} -
-
-
-
-

{t}Left click{/t}

-
- - {t}File patterns{/t}{$must} -{render acl=$gotoMimeFilePatternACL} - {$gotoMimeFilePatterns} -{/render} - -{render acl=$gotoMimeFilePatternACL} - -{/render} -{render acl=$gotoMimeFilePatternACL} - - -{/render} - - {t}Applications{/t} -{render acl=$gotoMimeApplicationACL} - {$gotoMimeApplications} -{/render} - -{render acl=$gotoMimeApplicationACL} - -{/render} -{render acl=$gotoMimeApplicationACL} - -{/render} -{render acl=$gotoMimeApplicationACL} - - -{/render} -
-
-
-

{t}Embedding{/t}

-
- - - - - - -
- -{render acl=$gotoMimeLeftClickActionACL} - -{/render} - {t}Show file in embedded viewer{/t} -
- -{render acl=$gotoMimeLeftClickActionACL} - -{/render} - {t}Show file in external viewer{/t} -
- -{render acl=$gotoMimeLeftClickActionACL} - -{/render} - {t}Ask whether to save to local disk{/t} -
- -
- - {t}Applications{/t} -{render acl=$gotoMimeEmbeddedApplicationACL} - {$gotoMimeEmbeddedApplications} -{/render} -{render acl=$gotoMimeEmbeddedApplicationACL} - -{/render} -{render acl=$gotoMimeEmbeddedApplicationACL} - -{/render} -{render acl=$gotoMimeEmbeddedApplicationACL} - - title='{t}Add application{/t}'> -{/render} -
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+

{t}Generic{/t} +

+
+ + + + + + + + + + + + + + + {if !$isReleaseMimeType} + + + + + + {/if} +
{t}Mime type{/t} + {$must} + + {render acl=$cnACL} + + {/render} +
{t}Mime group{/t} + + {render acl=$gotoMimeGroupACL} + + {/render} +
{t}Description{/t} + + {render acl=$descriptionACL} + + {/render} +
+ + {render acl=$baseACL} + + {/render} + + {if !$isReleaseMimeType} + {render acl=$baseACL disable_picture='images/lists/folder_grey.png'} + {image path="images/lists/folder.png" action="chooseBase" title="{t}Select a base{/t}"} + {/render} + + {/if} +
+
+ + + + + +
+
+ + {if $IconReadable} + {t}Mime icon{/t} + {else} + {image path="images/empty.png"} + + {/if} +
  +
+ + {render acl=$gotoMimeIconACL} + + {/render} + {render acl=$gotoMimeIconACL} + + {/render} +
+
+
+
+

{t}Left click{/t} +

+
{t}File patterns{/t} + {$must} + {render acl=$gotoMimeFilePatternACL} + {$gotoMimeFilePatterns} + {/render} + {render acl=$gotoMimeFilePatternACL} + + {/render} + {render acl=$gotoMimeFilePatternACL} + + {/render} + {t}Applications{/t} + {render acl=$gotoMimeApplicationACL} + {$gotoMimeApplications} + {/render} + {render acl=$gotoMimeApplicationACL} + + {/render} + {render acl=$gotoMimeApplicationACL} + + {/render} + {render acl=$gotoMimeApplicationACL} + + {/render} +
+
+
+

{t}Embedding{/t} +

+
+ + + + +
+ {render acl=$gotoMimeLeftClickActionACL} + + + + {/render}{t}Show file in embedded viewer{/t} +
+ {render acl=$gotoMimeLeftClickActionACL} + + + + {/render}{t}Show file in external viewer{/t} +
+ {render acl=$gotoMimeLeftClickActionACL} + + + + {/render}{t}Ask whether to save to local disk{/t} +
+
{t}Applications{/t} + {render acl=$gotoMimeEmbeddedApplicationACL} + {$gotoMimeEmbeddedApplications} + {/render} + {render acl=$gotoMimeEmbeddedApplicationACL} + + {/render} + {render acl=$gotoMimeEmbeddedApplicationACL} + + {/render} + {render acl=$gotoMimeEmbeddedApplicationACL} + title='{t}Add application{/t}'> + {/render} +
- - - + + \ No newline at end of file diff --git a/gosa-plugins/goto/admin/mimetypes/mimetype-filter-release.tpl b/gosa-plugins/goto/admin/mimetypes/mimetype-filter-release.tpl index 5bd374563..7c12895c5 100644 --- a/gosa-plugins/goto/admin/mimetypes/mimetype-filter-release.tpl +++ b/gosa-plugins/goto/admin/mimetypes/mimetype-filter-release.tpl @@ -1,25 +1,41 @@ +
-
-

{$HEADLINE} {$SIZELIMIT}

-
- - - - - - - - - - -
{$ROOT}{$BACK}{$HOME}{$RELOAD}{t}Base{/t} {$BASE}{$ACTIONS}{$FILTER}
-
+
+

+ {$HEADLINE}  + {$SIZELIMIT} +

+
+ + + + + + + + + + + +
+ {$ROOT} + + {$BACK} + + {$HOME} + + {$RELOAD} + {t}Base{/t} + {$BASE} + + {$ACTIONS} + + {$FILTER} +
- - {$LIST} +
+ {$LIST}
- -
- - - +
+
+ \ No newline at end of file diff --git a/gosa-plugins/goto/admin/mimetypes/mimetype-filter-release.xml b/gosa-plugins/goto/admin/mimetypes/mimetype-filter-release.xml index 222500930..0e8b0629e 100644 --- a/gosa-plugins/goto/admin/mimetypes/mimetype-filter-release.xml +++ b/gosa-plugins/goto/admin/mimetypes/mimetype-filter-release.xml @@ -2,47 +2,29 @@ - mimetype - + mimetypes true + dn + objectClass + cn + description + FAIstate + default + one + default + - LDAP - (&(objectClass=gotoMimeType)$NAME) - dn - objectClass - cn - description + MIMETYPES + (&(objectClass=gotoMimeType)(cn=$)) - one - - - - RELEASE - combobox - Loading. - Loading.. - Loading... - - - - textfield - NAME - 20 - 60 - - - (|(cn=*$*)(description=*$*)) - true - LDAP - (&(objectClass=gotoMimeType)(|(cn=*$NAME*)(description=*$NAME*))) cn 0.5 3 - + diff --git a/gosa-plugins/goto/admin/mimetypes/mimetype-filter.xml b/gosa-plugins/goto/admin/mimetypes/mimetype-filter.xml index 918e9c522..922bbc39c 100644 --- a/gosa-plugins/goto/admin/mimetypes/mimetype-filter.xml +++ b/gosa-plugins/goto/admin/mimetypes/mimetype-filter.xml @@ -5,7 +5,7 @@ mimetypes true default - one + auto dn objectClass cn @@ -16,7 +16,7 @@ default - LDAP + MIMETYPES (&(objectClass=gotoMimeType)(cn=$)) diff --git a/gosa-plugins/goto/admin/mimetypes/mimetype-list-release.tpl b/gosa-plugins/goto/admin/mimetypes/mimetype-list-release.tpl index 0833cbacc..7fcb0c755 100644 --- a/gosa-plugins/goto/admin/mimetypes/mimetype-list-release.tpl +++ b/gosa-plugins/goto/admin/mimetypes/mimetype-list-release.tpl @@ -1,25 +1,32 @@
- -
-

{$HEADLINE} {$SIZELIMIT}

-
- - - - - - - - - - -
{$ROOT}{$BACK}{$HOME}{$RELOAD}{t}Base{/t} {$BASE}{$ACTIONS}{$FILTER}
-
+
+

+ {$HEADLINE}  + {$SIZELIMIT} +

+
+ + + + + + + + +
+ {$RELOAD} + {t}Release{/t} + {$RELEASE} + + {$ACTIONS} + + {$FILTER} +
- {$LIST} +
+ {$LIST}
- -
- - +
+
+ \ No newline at end of file diff --git a/gosa-plugins/goto/admin/mimetypes/mimetype-list-release.xml b/gosa-plugins/goto/admin/mimetypes/mimetype-list-release.xml index a8baa1cc7..ab893e588 100644 --- a/gosa-plugins/goto/admin/mimetypes/mimetype-list-release.xml +++ b/gosa-plugins/goto/admin/mimetypes/mimetype-list-release.xml @@ -64,13 +64,13 @@ sub - images/lists/new.png + images/lists/element.png[new] new entry - images/lists/new.png + plugins/goto/images/select_mimetype.png[new] diff --git a/gosa-plugins/goto/admin/mimetypes/mimetype-list.tpl b/gosa-plugins/goto/admin/mimetypes/mimetype-list.tpl index 69a2cb39f..815e541c1 100644 --- a/gosa-plugins/goto/admin/mimetypes/mimetype-list.tpl +++ b/gosa-plugins/goto/admin/mimetypes/mimetype-list.tpl @@ -1,23 +1,39 @@ -
-
-

{$HEADLINE} {$SIZELIMIT}

-
- - - - - - - - - - -
{$ROOT}{$BACK}{$HOME}{$RELOAD}{t}Base{/t} {$BASE}{$ACTIONS}{$FILTER}
-
+
+
+

+ {$HEADLINE}  + {$SIZELIMIT} +

+
+ + + + + + + + + + + +
+ {$ROOT} + + {$BACK} + + {$HOME} + + {$RELOAD} + {t}Base{/t} + {$BASE} + + {$ACTIONS} + + {$FILTER} +
- - {$LIST} +
+ {$LIST}
- - + \ No newline at end of file diff --git a/gosa-plugins/goto/admin/mimetypes/paste_generic.tpl b/gosa-plugins/goto/admin/mimetypes/paste_generic.tpl index 100fac343..00371a98e 100644 --- a/gosa-plugins/goto/admin/mimetypes/paste_generic.tpl +++ b/gosa-plugins/goto/admin/mimetypes/paste_generic.tpl @@ -1,32 +1,29 @@ - - - - - - - -
-

{t}Generic{/t}

-
- - - - - - - - - - -
- {t}Mime type{/t} - - -
- {t}Description{/t} - - -
- -
+ + + + + + + +
+

{t}Generic{/t} +

+
+ + + + + + + + + +
{t}Mime type{/t} + + +
{t}Description{/t} + + +
+
\ No newline at end of file diff --git a/gosa-plugins/goto/admin/mimetypes/release_select.tpl b/gosa-plugins/goto/admin/mimetypes/release_select.tpl index f11b391ad..43ff5367b 100644 --- a/gosa-plugins/goto/admin/mimetypes/release_select.tpl +++ b/gosa-plugins/goto/admin/mimetypes/release_select.tpl @@ -1,17 +1,19 @@ +
-

{image path="{$branchimage}" align="right"}{t}Branches{/t} -

+

+ {image path=" + {$branchimage}" align="right"}{t}Branches{/t} +

-
- {t}Current release{/t}  + {t}Current release{/t} 
-
+
\ No newline at end of file -- 2.30.2