From 916a8c9875e15b7d698fdd759b6986d91891aeb2 Mon Sep 17 00:00:00 2001 From: Franck VILLAUME Date: Thu, 4 Aug 2011 20:55:18 +0000 Subject: [PATCH] continue projects_hierarchy integration --- .gitattributes | 1 - src/common/docman/Document.class.php | 137 +++++++++++++++ src/common/docman/DocumentFactory.class.php | 2 - src/common/docman/DocumentGroup.class.php | 8 +- src/common/docman/DocumentManager.class.php | 14 +- src/common/docman/actions/lockfile.php | 4 + src/common/docman/views/editfile.php | 182 -------------------- src/common/docman/views/listfile.php | 43 ++++- src/common/docman/views/listtrashfile.php | 9 +- src/common/docman/views/pendingfiles.php | 5 +- src/www/docman/scripts/DocManController.js | 10 +- src/www/themes/funky/css/theme-pages.css | 4 + src/www/themes/gforge/css/theme-pages.css | 32 ++-- 13 files changed, 228 insertions(+), 223 deletions(-) delete mode 100644 src/common/docman/views/editfile.php diff --git a/.gitattributes b/.gitattributes index 12610911b5..36a971306d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -426,7 +426,6 @@ src/common/docman/views/additem.php -text src/common/docman/views/addsubdocgroup.php -text src/common/docman/views/admin.php -text src/common/docman/views/editdocgroup.php -text -src/common/docman/views/editfile.php -text src/common/docman/views/help.php -text src/common/docman/views/listfile.php -text src/common/docman/views/listtrashfile.php -text diff --git a/src/common/docman/Document.class.php b/src/common/docman/Document.class.php index 1c325e87b3..002815bf4e 100644 --- a/src/common/docman/Document.class.php +++ b/src/common/docman/Document.class.php @@ -997,6 +997,143 @@ class Document extends Error { function deleteVersion() { } + + function editFile() { + $editfileaction = '?action=editfile&fromview=listfile&dirid='.$this->getDocGroupID(); + if (isset($GLOBALS['childgroup_id']) && $GLOBALS['childgroup_id']) { + $editfileaction .= '&childgroup_id='.$GLOBALS['childgroup_id']; + } + $editfileaction .= '&group_id='.$GLOBALS['group_id']; +?> + +

+
+

+ + +

+

+ + +

+Group->useDocmanSearch()) + echo '

'. _('Both fields are used by document search engine.'). '

'; +?> + +
+ + + + + + + + + + + + + + +isURL()) && ($this->isText()) && $this->getStateID() != '2') { + if ($this->Group->useCreateOnline()) { + echo ' + + '; + } + } +?> + + + + + + + + + +
+
+ +
+
+ +
+
+ isURL()) { + echo '['. _('View File URL') .']'; + } else { ?> + getFileName(); ?> + +
'; + echo _('Edit the contents to your desire or leave them as they are to remain unmodified.'); + switch ($this->getFileType()) { + case "text/html": { + $GLOBALS['editor_was_set_up']=false; + $params = array() ; + /* name must be != data then nothing is displayed */ + $params['name'] = 'details'.$this->getID(); + $params['height'] = "300"; + $params['group'] = $group_id; + $params['body'] = $this->getFileData(); + plugin_hook("text_editor",$params); + if (!$GLOBALS['editor_was_set_up']) { + echo '
'; + } + unset($GLOBALS['editor_was_set_up']); + echo ''; + break; + } + default: { + echo '
'; + echo ''; + } + } + echo '
+
+ Group); + $newdgh = new DocumentGroupHTML($this->Group); + if ($this->getStateID() == 2) { + $newdgh->showSelectNestedGroups($newdgf->getNested(), 'doc_group', false, false); + } else { + $newdgh->showSelectNestedGroups($newdgf->getNested(), 'doc_group', false, $this->getDocGroupID()); + } + ?>
+ :
+ getStateID() == 2) { + doc_get_state_box('xzxz', $this->getStateID()); + } else { + doc_get_state_box('xzxz'); + } + ?> +
+ getStateID() != '2') { + if ($this->isURL()) { ?> + :
+ + +
+ + +
+ + +
+getStateID() != 1) { $valid = false; - echo 'LA'; } if ($perm->isEditor()) { $valid = true; - echo 'ICI'; } } } else { diff --git a/src/common/docman/DocumentGroup.class.php b/src/common/docman/DocumentGroup.class.php index 0ff3a76263..95957a3220 100644 --- a/src/common/docman/DocumentGroup.class.php +++ b/src/common/docman/DocumentGroup.class.php @@ -474,6 +474,7 @@ class DocumentGroup extends Error { * @access public */ function getPath($url = false, $includename = true) { + $returnPath = ''; if ($this->getParentID()) { $parentDg = new DocumentGroup($this->Group, $this->getParentID()); @@ -481,7 +482,12 @@ class DocumentGroup extends Error { } if ($includename) { if ($url) { - $returnPath .= '/'.util_make_link('/docman/?group_id='.$this->Group->getID().'&view=listfile&dirid='.$this->getID(),$this->getName(), array('title' => _('Browse this folder'), 'class' => 'tabtitle')); + $browselink = '/docman/?view=listfile&dirid='.$this->getID(); + if (isset($GLOBALS['childgroup_id']) && $GLOBALS['childgroup_id']) { + $browselink .= '&childgroup_id='.$GLOBALS['childgroup_id']; + } + $browselink .= '&group_id='.$GLOBALS['group_id']; + $returnPath .= '/'.util_make_link($browselink, $this->getName(), array('title' => _('Browse this folder'), 'class' => 'tabtitle')); } else { $returnPath .= '/'.$this->getName(); } diff --git a/src/common/docman/DocumentManager.class.php b/src/common/docman/DocumentManager.class.php index 5c2e86cb4c..3722d5d5d1 100644 --- a/src/common/docman/DocumentManager.class.php +++ b/src/common/docman/DocumentManager.class.php @@ -159,13 +159,17 @@ class DocumentManager extends Error { } $nbDocsLabel = ''; $nbDocs = $localDg->getNumberOfDocuments($stateId); - if ($stateId == 1 && forge_check_perm('docman', $this->Group->getID(), 'approve')) + if ($stateId == 1 && forge_check_perm('docman', $this->Group->getID(), 'approve')) { $nbDocsPending = $localDg->getNumberOfDocuments(3); + $nbDocsHidden = $localDg->getNumberOfDocuments(4); + $nbDocsPrivate = $localDg->getNumberOfDocuments(5); + } - if ($nbDocs && (!isset($nbDocsPending) || $nbDocsPending == 0)) { - $nbDocsLabel = '('.$nbDocs.')'; - } elseif (isset($nbDocsPending) && $nbDocsPending) { - $nbDocsLabel = '('.$nbDocs.'/'.$nbDocsPending.')'; + if ($nbDocs && (!isset($nbDocsPending) || $nbDocsPending == 0) && (!isset($nbDocsHidden) || $nbDocsHidden == 0) && (!isset($nbDocsPrivate) || $nbDocsPrivate)) { + $nbDocsLabel = '('.$nbDocs.')'; + } + if (isset($nbDocsPending) && isset($nbDocsHidden) && isset($nbDocsPrivate)) { + $nbDocsLabel = '('.$nbDocs.'/'.$nbDocsPending.'/'.$nbDocsHidden.'/'.$nbDocsPrivate.')'; } echo '
  • '.util_make_link($link, $localDg->getName()).$nbDocsLabel.'
  • '; $this->getTree($selecteddir, $linkmenu, $subGroupIdValue); diff --git a/src/common/docman/actions/lockfile.php b/src/common/docman/actions/lockfile.php index 3c3502503e..24304d13c6 100644 --- a/src/common/docman/actions/lockfile.php +++ b/src/common/docman/actions/lockfile.php @@ -34,6 +34,10 @@ if (!forge_check_perm('docman', $group_id, 'approve')) { $fileid = getIntFromRequest('fileid'); $lock = getIntFromRequest('lock'); +$childgroup_id = getIntFromRequest('childgroup_id'); +if ($childgroup_id) { + $g = group_get_object($childgroup_id); +} $d = new Document($g, $fileid); if ($d->isError()) diff --git a/src/common/docman/views/editfile.php b/src/common/docman/views/editfile.php deleted file mode 100644 index 13ed38900c..0000000000 --- a/src/common/docman/views/editfile.php +++ /dev/null @@ -1,182 +0,0 @@ - - - - diff --git a/src/common/docman/views/listfile.php b/src/common/docman/views/listfile.php index 134a39174f..74ed6bac52 100644 --- a/src/common/docman/views/listfile.php +++ b/src/common/docman/views/listfile.php @@ -73,11 +73,27 @@ if ($dgh->isError()) $df->setDocGroupID($dirid); -/** - * var must be named d_arr & nested_groups - * because used by tree.php - */ -$d_arr =& $df->getDocuments(); +$df->setStateID('1'); +$d_arr_active =& $df->getDocuments(); +if ($d_arr_active != NULL) + $d_arr = $d_arr_active; + +$df->setStateID('4'); +$d_arr_hidden =& $df->getDocuments(); +if ($d_arr != NULL && $d_arr_hidden != NULL) { + $d_arr = array_merge($d_arr, $d_arr_hidden); +} else if ($d_arr_hidden != NULL) { + $d_arr = $d_arr_hidden; +} + +$df->setStateID('5'); +$d_arr_private =& $df->getDocuments(); +if ($d_arr != NULL && $d_arr_private != NULL) { + $d_arr = array_merge($d_arr, $d_arr_private); +} else if ($d_arr_private != NULL) { + $d_arr = $d_arr_private; +} + $nested_groups = $dgf->getNested(); $nested_docs = array(); @@ -107,7 +123,6 @@ if ($d_arr != NULL ) { } $df->setStateID('3'); - $d_pending_arr =& $df->getDocuments(); $nested_pending_groups =& $dgf->getNested(); @@ -138,6 +153,7 @@ jQuery(document).ready(function() { divLeft: jQuery('#left'), divHandle: jQuery('#handle'), divRight: jQuery('#right'), + childGroupId: }); }); @@ -147,7 +163,12 @@ jQuery(document).ready(function() { echo '
    '; echo ''; echo '
    '; diff --git a/src/common/docman/views/listtrashfile.php b/src/common/docman/views/listtrashfile.php index 4fb552347d..dea7ca625b 100644 --- a/src/common/docman/views/listtrashfile.php +++ b/src/common/docman/views/listtrashfile.php @@ -65,7 +65,7 @@ $nested_docs = array(); $DocGroupName = 0; if ($dirid) { - $ndg = new DocumentGroup($g,$dirid); + $ndg = new DocumentGroup($g, $dirid); $DocGroupName = $ndg->getName(); if (!$DocGroupName) { session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage())); @@ -76,7 +76,6 @@ if ($dirid) { } } - if ($d_arr != NULL ) { if (!$d_arr || count($d_arr) > 0) { // Get the document groups info @@ -194,8 +193,11 @@ jQuery(document).ready(function() { echo ''.html_image('docman/delete-directory.png',22,22,array('alt'=>_('Delete permanently this document.'))). ''; echo ''.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). ''; echo ''; + echo ''."\n"; + echo ''; + $d->editFile(); + echo ''; } - echo ''; echo $HTML->listTableBottom(); echo '

    '; echo ''; @@ -206,7 +208,6 @@ jQuery(document).ready(function() { echo '' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'Download as Zip')). ''; echo ''; echo '

    '; - include ($gfcommon.'docman/views/editfile.php'); echo '
    '; } else { if ($dirid) { diff --git a/src/common/docman/views/pendingfiles.php b/src/common/docman/views/pendingfiles.php index 953df205d6..43f871cfb1 100644 --- a/src/common/docman/views/pendingfiles.php +++ b/src/common/docman/views/pendingfiles.php @@ -112,8 +112,11 @@ jQuery(document).ready(function() { echo ''; echo ''.html_image('docman/edit-file.png', 22, 22, array('alt'=>_('Edit this document'))). ''; echo ''; + echo ''; + echo ''; + $d->editFile(); + echo ''; } - echo ''; echo $HTML->listTableBottom(); echo '

    '; echo ''; diff --git a/src/www/docman/scripts/DocManController.js b/src/www/docman/scripts/DocManController.js index daf71df7d8..da2cc80edb 100755 --- a/src/www/docman/scripts/DocManController.js +++ b/src/www/docman/scripts/DocManController.js @@ -135,7 +135,7 @@ DocManListFileController.prototype = * @param string id of the div */ toggleEditFileView: function(id) { - var divid = '#editfile'+id, + var divid = '#docid'+id, el = jQuery(divid); if (!el.is(":visible")) { @@ -145,17 +145,19 @@ DocManListFileController.prototype = group_id: this.params.groupId, action: 'lockfile', lock: 1, - fileid: id + fileid: id, + childgroup_id: this.params.childGroupId }); - this.lockInterval[id] = setInterval("jQuery.get('" + this.params.docManURL + "', {group_id:"+this.params.groupId+",action:'lockfile',lock:1,fileid:"+id+"})",this.params.lockIntervalDelay); + this.lockInterval[id] = setInterval("jQuery.get('" + this.params.docManURL + "', {group_id:"+this.params.groupId+",action:'lockfile',lock:1,fileid:"+id+",childgroup_id:"+this.params.childGroupId+"})",this.params.lockIntervalDelay); } else { el.hide(); jQuery.get(this.params.docManURL, { group_id: this.params.groupId, action: 'lockfile', lock: 0, - fileid: id + fileid: id, + childgroup_id: this.params.childGroupId }); clearInterval(this.lockInterval[id]); diff --git a/src/www/themes/funky/css/theme-pages.css b/src/www/themes/funky/css/theme-pages.css index b74914b2bc..5a4d3ef6f8 100644 --- a/src/www/themes/funky/css/theme-pages.css +++ b/src/www/themes/funky/css/theme-pages.css @@ -237,6 +237,10 @@ margin: 2px; } +.docman_editfile_nodisplay { + display: none; +} + /* tracker */ diff --git a/src/www/themes/gforge/css/theme-pages.css b/src/www/themes/gforge/css/theme-pages.css index 457a1a50e3..7c9276fa34 100644 --- a/src/www/themes/gforge/css/theme-pages.css +++ b/src/www/themes/gforge/css/theme-pages.css @@ -1,4 +1,4 @@ -/* +/* * Stylesheet for FusionForge default theme. * * Copyright 2009 Matthieu FAURE // Open-S: global clean-up @@ -19,15 +19,15 @@ * You should have received a copy of the GNU General Public License along * with FusionForge; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * + * * CONTENT: all page-related styles * ======================================================== */ -/* +/* * PAGE: home page * ======================================================== - */ + */ /* =bd (main body) ----------------------------------------------- */ @@ -45,17 +45,17 @@ } #title-home-page { - text-align: center; + text-align: center; } #Latest_News h3 { margin-top: 0px; margin-bottom: 0px; - font-weight: bold; + font-weight: bold; } #Latest_News em { - padding-left: 1em; + padding-left: 1em; } /* remove inherited background-image */ @@ -72,11 +72,11 @@ } #Associated_Forges td { - padding-right: 1em; + padding-right: 1em; } #Associated_Forges .align-right { - text-align: right; + text-align: right; } #Recently_Registered_Projects td { @@ -94,10 +94,10 @@ padding-left: 5px; } -/* +/* * PAGE: project home * ======================================================== - */ + */ #project-summary-and-devs { margin-top: 0.5em; } @@ -110,7 +110,7 @@ margin: 1em 0.5em; } -/* +/* * PAGE: frs * ======================================================== */ @@ -165,12 +165,12 @@ width: 12%; } -/* +/* * PAGE: user_home (eg: http://fusionforge/user/) * ======================================================== */ #user-profile-homepage { - + } /* @@ -223,3 +223,7 @@ border-collapse: collapse; padding: 3px; } + +.docman_editfile_nodisplay { + display: none; +} -- 2.30.2