diff --git a/framework/base/helper.class.php b/framework/base/helper.class.php index a9490316bf..c787cc08fe 100644 --- a/framework/base/helper.class.php +++ b/framework/base/helper.class.php @@ -164,7 +164,7 @@ class baseHelper $sign = strpos($link, '?') === false ? "?" : "&"; $appendString = ''; if($onlyBody or self::inOnlyBodyMode()) $appendString = $sign . "onlybody=yes"; - if(self::isWithTID()) $appendString .= empty($appendString) ? "{$sign}tid={$_GET['tid']}" : "&tid={$_GET['tid']}"; + if(self::isWithTID() and strpos($link, 'tid=') === false) $appendString .= empty($appendString) ? "{$sign}tid={$_GET['tid']}" : "&tid={$_GET['tid']}"; return $link . $appendString; } diff --git a/module/doc/config.php b/module/doc/config.php index 61c0bc9719..dd5ec6214c 100644 --- a/module/doc/config.php +++ b/module/doc/config.php @@ -15,6 +15,7 @@ $config->doc->edit->requiredFields = 'title'; $config->doc->customObjectLibs = 'files,customFiles'; $config->doc->notArticleType = ''; $config->doc->officeTypes = 'word,ppt,excel'; +$config->doc->textTypes = 'html,markdown,text'; $config->doc->custom = new stdclass(); $config->doc->custom->objectLibs = $config->doc->customObjectLibs; diff --git a/module/doc/control.php b/module/doc/control.php index 1f767ce221..43dfae32a8 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -286,15 +286,16 @@ class doc extends control /** * Create a doc. * - * @param string $objectType - * @param int $objectID - * @param int|string $libID - * @param int $moduleID - * @param string $docType + * @param string $objectType + * @param int $objectID + * @param int|string $libID + * @param int $moduleID + * @param string $docType + * @param bool $fromGlobal * @access public * @return void */ - public function create($objectType, $objectID, $libID, $moduleID = 0, $docType = '') + public function create($objectType, $objectID, $libID, $moduleID = 0, $docType = '', $fromGlobal = false) { if(!empty($_POST)) { @@ -318,7 +319,20 @@ class doc extends control $objectID = zget($lib, $lib->type, ''); $params = "type={$lib->type}&objectID=$objectID&libID={$lib->id}&docID=" . $docResult['id']; $link = isonlybody() ? 'parent' : $this->createLink('doc', 'objectLibs', $params, 'html') . '#app=' . $this->app->tab; - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link)); + $response = array('result' => 'success', 'message' => $this->lang->saveSuccess); + + if(isonlybody() and $docResult['docType'] == 'text') + { + $link = helper::createLink('doc', 'edit', "docID=$docID&comment=false&objectType=$objectType&objectID=$objectID&libID={$docResult['libID']}"); + + $response['callback'] = "redirect2Edit($docID, \"$objectType\", $objectID, {$docResult['libID']})"; + } + else + { + $response['locate'] = "$link"; + } + + return $this->send($response); } unset($_GET['onlybody']); @@ -347,7 +361,7 @@ class doc extends control if($this->config->systemMode == 'new') unset($this->lang->doc->menu->project['subMenu']); } - $this->config->showMainMenu = strpos(',html,markdown,text,', ",$docType,") === false; + $this->config->showMainMenu = strpos($this->config->doc->textTypes, $docType) === false; /* Get libs and the default lib id. */ $gobackLink = ($objectID == 0 and $libID == 0) ? $this->createLink('doc', 'tableContents', "type=$objectType") : ''; @@ -362,7 +376,7 @@ class doc extends control $this->view->title = $libName . $this->lang->doc->create; $this->view->objectType = $objectType; - $this->view->objectID = $objectID; + $this->view->objectID = zget($lib, $lib->type, ''); $this->view->libID = $libID; $this->view->lib = $lib; $this->view->libs = $libs; @@ -373,6 +387,7 @@ class doc extends control $this->view->docType = $docType; $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('nocode|noclosed|nodeleted'); + $this->view->fromGlobal = $fromGlobal; $this->display(); } @@ -380,15 +395,16 @@ class doc extends control /** * Edit a doc. * - * @param int $docID - * @param bool $comment - * @param string $objectType - * @param int $objectID - * @param int $libID + * @param int $docID + * @param bool $comment + * @param string $objectType + * @param int $objectID + * @param int $libID + * @param string $from * @access public * @return void */ - public function edit($docID, $comment = false, $objectType = '', $objectID = 0, $libID = 0) + public function edit($docID, $comment = false, $objectType = '', $objectID = 0, $libID = 0, $from = 'edit') { if(!empty($_POST)) { @@ -490,6 +506,9 @@ class doc extends control $this->view->lib = $lib; $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted', $doc->users); + $this->view->from = $from; + $this->view->files = $this->loadModel('file')->getByObject('doc', $docID); + $this->view->objectID = zget($lib, $type, ''); $this->display(); } diff --git a/module/doc/js/create.js b/module/doc/js/create.js index d3e25d9fd5..8547c1beeb 100644 --- a/module/doc/js/create.js +++ b/module/doc/js/create.js @@ -87,7 +87,7 @@ function initPage(type) { $('#contentBox .contentmarkdown').removeClass('hidden'); $('#contentBox .contenthtml').addClass('hidden'); - $('#contentBox #contentType').val(type); + $('#contentType').val(type); } } else if(type == 'url') @@ -150,3 +150,17 @@ function loadWhitelist(libID) } }); } + +/** + * Redirect to edit page when create the doc of text type. + * + * @param int docID + * @param string objectType + * @param int objectID + * @param int libID + * @return void + */ +function redirect2Edit(docID, objectType, objectID, libID) +{ + parent.location.href = createLink('doc', 'edit', 'docID=' + docID + '&comment=false&objectType=' + objectType + '&objectID=' + objectID + '&libID=' + libID + '&from=create'); +} diff --git a/module/doc/js/selectlibtype.js b/module/doc/js/selectlibtype.js index b3711fee8e..02393b4e56 100644 --- a/module/doc/js/selectlibtype.js +++ b/module/doc/js/selectlibtype.js @@ -16,7 +16,7 @@ function redirectParentWindow(objectType, libID, docType) } else { - var link = createLink('doc', 'create', 'objectType=' + objectType + '&objectID=0&libID=' + libID + '&moduleID=0&docType=' + docType) + '#app=doc'; + var link = createLink('doc', 'create', 'objectType=' + objectType + '&objectID=0&libID=' + libID + '&moduleID=0&docType=' + docType + '&fromGlobal=true') + '#app=doc'; } window.parent.$.apps.open(link); } diff --git a/module/doc/model.php b/module/doc/model.php index 142f262d78..07fed51fb8 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -782,7 +782,7 @@ class docModel extends model $docContent->files = join(',', array_keys($files)); $this->dao->insert(TABLE_DOCCONTENT)->data($docContent)->exec(); $this->loadModel('score')->create('doc', 'create', $docID); - return array('status' => 'new', 'id' => $docID, 'files' => $files); + return array('status' => 'new', 'id' => $docID, 'files' => $files, 'docType' => $doc->type, 'libID' => $doc->lib); } return false; } @@ -2126,11 +2126,11 @@ class docModel extends model { foreach($this->lang->doc->typeList as $typeKey => $typeName) { - $class = strpos($this->config->doc->officeTypes, $typeKey) !== false ? 'iframe' : ''; + $class = (strpos($this->config->doc->officeTypes, $typeKey) !== false or strpos($this->config->doc->textTypes, $typeKey) !== false) ? 'iframe' : ''; $icon = zget($this->config->doc->iconList, $typeKey); - $html .= "
  • "; - $html .= html::a(helper::createLink('doc', 'create', "objectType=$objectType&objectID=$objectID&libID=$libID&moduleID=0&type=$typeKey", '', $class ? true : false), " " . $typeName, '', "class='$class' data-app='{$this->app->tab}'"); - $html .= "
  • "; + $html .= "
  • "; + $html .= html::a(helper::createLink('doc', 'create', "objectType=$objectType&objectID=$objectID&libID=$libID&moduleID=0&type=$typeKey", '', $class ? true : false), " " . $typeName, '', "class='$class' data-app='{$this->app->tab}'"); + $html .= "
  • "; if($typeKey == 'url') $html .= '
  • '; } } diff --git a/module/doc/view/create.html.php b/module/doc/view/create.html.php index 76ebc29f2e..e13e5d1500 100644 --- a/module/doc/view/create.html.php +++ b/module/doc/view/create.html.php @@ -10,8 +10,142 @@ * @link http://www.zentao.net */ ?> - + - +doc->officeTypes, $docType) !== false):?> + +
    +
    +
    +

    doc->create;?>

    +
    + config->edition != 'open'):?> +
    + doc->notSetOffice, zget($lang->doc->typeList, $docType), common::hasPriv('custom', 'libreoffice') ? $this->createLink('custom', 'libreoffice', '', '', true) : '###');?> +
    + +
    doc->cannotCreateOffice, zget($lang->doc->typeList, $docType));?>
    + +
    +
    + + + + + + + +doc->placeholder);?> + +
    +
    +
    +

    doc->create;?>

    +
    + + ' . $lang->doc->createLib, '', 'class="iframe hidden createCustomLib"');?> + +
    + + + + + + + + + + + + + + + + + + + config->doc->textTypes, $docType) !== false ? 'hidden' : '';?> + + + + + + + doc->types as $typeKey => $typeName) $typeKeyList[$typeKey] = $typeKey; + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +
    doc->lib;?>
    doc->module;?> + +
    doc->title;?>
    doc->keywords;?>doc->keywordsTips}'");?>
    doc->content;?> +
    + +
    doc->files;?>fetch('file', 'buildform');?>
    doc->mailto;?> +
    + fetch('my', 'buildContactLists'); + ?> +
    +
    doclib->control;?> + acl == 'default' ? 'open' : $lib->acl;?> + type == 'project' and $acl == 'private') ? 'open' : $acl;?> + doc->aclList, $acl, "onchange='toggleAcl(this.value, \"doc\")'");?> + doc->noticeAcl['doc'][$acl];?> +
    + + + doc->textTypes, $docType) === false):?> + goback, "data-app='{$app->tab}'");?> + goback, '', "class='btn btn-back btn-wide'");?> + +
    +
    +
    +
    + +doc->noticeAcl['doc']);?> + + diff --git a/module/doc/view/createothertype.html.php b/module/doc/view/createothertype.html.php deleted file mode 100644 index 06cb9cc168..0000000000 --- a/module/doc/view/createothertype.html.php +++ /dev/null @@ -1,137 +0,0 @@ - - * @package doc - * @version $Id: create.html.php 975 2010-07-29 03:30:25Z jajacn@126.com $ - * @link http://www.zentao.net - */ -?> -doc->officeTypes, $docType) !== false):?> - -
    -
    -
    -

    doc->create;?>

    -
    - config->edition != 'open'):?> -
    - doc->notSetOffice, zget($lang->doc->typeList, $docType), common::hasPriv('custom', 'libreoffice') ? $this->createLink('custom', 'libreoffice', '', '', true) : '###');?> -
    - -
    doc->cannotCreateOffice, zget($lang->doc->typeList, $docType));?>
    - -
    -
    - - - - - - - -doc->placeholder);?> - -
    -
    -
    -

    doc->create;?>

    -
    - - ' . $lang->doc->createLib, '', 'class="iframe hidden createCustomLib"');?> - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    doc->lib;?>
    doc->module;?> - -
    doc->title;?>
    doc->keywords;?>doc->keywordsTips}'");?>
    doc->content;?> -
    - - - -
    doc->files;?>fetch('file', 'buildform');?>
    doc->mailto;?> -
    - fetch('my', 'buildContactLists'); - ?> -
    -
    doclib->control;?> - acl == 'default' ? 'open' : $lib->acl;?> - type == 'project' and $acl == 'private') ? 'open' : $acl;?> - doc->aclList, $acl, "onchange='toggleAcl(this.value, \"doc\")'");?> - doc->noticeAcl['doc'][$acl];?> -
    - - goback, "data-app='{$app->tab}'");?> - goback, '', "class='btn btn-back btn-wide'");?> -
    -
    -
    -
    - -doc->noticeAcl['doc']);?> - - diff --git a/module/doc/view/createtexttype.html.php b/module/doc/view/createtexttype.html.php index 4192310850..0f0c667773 100644 --- a/module/doc/view/createtexttype.html.php +++ b/module/doc/view/createtexttype.html.php @@ -19,55 +19,64 @@ #main {padding: 0;} .container {padding: 0 !important;} #mainContent {padding: 0 !important;} -#dataform {overflow: hidden} .doc-title input {border: unset; font-size: 18px; font-weight: bold; color: #3c4353; padding-left: 16px;} .doc-title .form-control:focus {border: unset; box-shadow: unset;} .doc-title input::-webkit-input-placeholder {color: #D8DBDE;} .doc-title.required:after {top: 4px; right: 0; left: 12px; display: inline-table;} -#submit {margin-right: 12px;} +#submit {margin-right: 16px;} #headerBox {border-bottom: 1px solid #e3e3e3;} +#headerBox td:last-child {padding-right: 24px;} #editorContent {padding: 0;} #contentBox {padding: 0; width: 100%;} .ke-container {overflow: visible;} -.ke-container, .contentmarkdown {border: unset; background: #efefef;} +.ke-container, .contenthtml {border: unset; background: #efefef;} .ke-container.focus {box-shadow: unset; border-color: unset;} -.ke-toolbar {padding-left: 20px; width: 150%; height: 30px; border-bottom: unset;} +.ke-toolbar {padding-left: 20px; width: 100%; height: 30px;} .ke-edit {border-top: 1px solid rgb(220, 220, 220)} -.ke-edit, .CodeMirror {margin-left: 20px; background: #fff;} +.ke-edit, .CodeMirror {margin: 8px 200px 0 200px; background: #fff;} .kindeditor-ph {padding-left: 20px !important;} .editor-toolbar {background: #fff; padding-left: 20px; border-right: unset; border-top: unset; height: 30px;} .hide-sidebar .ke-edit {padding-right: 20px;} .hide-sidebar .CodeMirror {padding-right: 50px;} .CodeMirror.CodeMirror-wrap {border-left: 0; border-right: 0; border-bottom: 0;} .ke-statusbar {display: none;} +.contentmarkdown {background: #efefef;} -#sidebar {top: 30px;} -#sidebar .sidebar-toggle {right: 0; left: 0px; background: #efefef; border-radius: 0px; width: 20px; border-top: 1px solid rgb(220, 220, 220);} -#sidebar > .sidebar-toggle:hover {background: #efefef;} -#sidebar {width: 500px;} -#sidebar table {margin-top: 5px;} -#sidebar table th {font-weight: 400 !important;} -.hide-sidebar #sidebar > .sidebar-toggle > .icon:before {content: "\e314";} -.hide-sidebar #sidebar > .sidebar-toggle {left: -20px; z-index: 9;} -#sidebar .cell {border-top: 1px solid rgb(220, 220, 220); border-radius: 0px; height: 100%;} -#sidebar > .sidebar-toggle > .icon.icon-angle-right {left: 4px;} -.file-title {max-width: 130px !important;} +.article-content {padding: 8px 20px;} -.th-control {vertical-align: top !important;} +#noticeAcl {margin-left: 10px; vertical-align: middle;} -#noticeAcl {margin: 0;} +#moreList {display: inline-block; padding: 7px;} +#moreList .icon-more-circle {font-size: 20px;} +#moreList ul.dropdown-menu {left: -77px;} + +#backBtn {border: unset;} +#backBtn i {font-size: 20px;} + +.modal-title {font-size: 14px !important; font-weight: 700 !important;} +#modalBasicInfo .modal-dialog {width: 720px;} ' . $lang->doc->createLib, '', 'class="iframe hidden createCustomLib"');?> +createLink('doc', 'tableContents', "type=$objectType&objectID=$objectID&libID=$libID");?>
    - - + + +
    doc->titlePlaceholder}' class='form-control' required");?>", $backLink, 'self', "id='backBtn'");?>doc->titlePlaceholder}' class='form-control' required");?> + + +
    @@ -78,90 +87,107 @@ -
    + +
    diff --git a/module/doc/view/edittexttype.html.php b/module/doc/view/edittexttype.html.php index 1a9b167c60..ded396749b 100644 --- a/module/doc/view/edittexttype.html.php +++ b/module/doc/view/edittexttype.html.php @@ -23,22 +23,22 @@ #main {padding: 0;} .container {padding: 0 !important;} #mainContent {padding: 0 !important;} -#dataform {overflow: hidden} .doc-title input {border: unset; font-size: 18px; font-weight: bold; color: #3c4353; padding-left: 16px;} .doc-title .form-control:focus {border: unset; box-shadow: unset;} .doc-title input::-webkit-input-placeholder {color: #D8DBDE;} .doc-title.required:after {top: 4px; right: 0; left: 12px; display: inline-table;} -#submit {margin-right: 12px;} +#submit {margin-right: 16px;} #headerBox {border-bottom: 1px solid #e3e3e3;} +#headerBox td:last-child {padding-right: 24px;} #editorContent {padding: 0;} #contentBox {padding: 0; width: 100%;} .ke-container {overflow: visible;} .ke-container, .contenthtml {border: unset; background: #efefef;} .ke-container.focus {box-shadow: unset; border-color: unset;} -.ke-toolbar {padding-left: 20px; width: 150%; height: 30px; border-bottom: unset;} +.ke-toolbar {padding-left: 20px; width: 100%; height: 30px;} .ke-edit {border-top: 1px solid rgb(220, 220, 220)} -.ke-edit, .CodeMirror {margin-left: 20px; background: #fff;} +.ke-edit, .CodeMirror {margin: 8px 200px 0 200px; background: #fff;} .kindeditor-ph {padding-left: 20px !important;} .editor-toolbar {background: #fff; padding-left: 20px; border-right: unset; border-top: unset; height: 30px;} .hide-sidebar .ke-edit {padding-right: 20px;} @@ -46,29 +46,41 @@ .CodeMirror.CodeMirror-wrap {border-left: 0; border-right: 0; border-bottom: 0;} .ke-statusbar {display: none;} -#sidebar {top: 30px;} -#sidebar .sidebar-toggle {right: 0; left: 0px; background: #efefef; border-radius: 0px; width: 20px; border-top: 1px solid rgb(220, 220, 220);} -#sidebar > .sidebar-toggle:hover {background: #efefef;} -#sidebar {width: 500px;} -#sidebar table {margin-top: 5px;} -#sidebar table th {font-weight: 400 !important;} -.hide-sidebar #sidebar > .sidebar-toggle > .icon:before {content: "\e314";} -.hide-sidebar #sidebar > .sidebar-toggle {left: -20px; z-index: 9;} -#sidebar .cell {border-top: 1px solid rgb(220, 220, 220); border-radius: 0px; height: 100%;} -#sidebar > .sidebar-toggle > .icon.icon-angle-right {left: 4px;} -.file-title {max-width: 130px !important;} +.article-content {padding: 8px 20px;} -.th-control {vertical-align: top !important;} +#noticeAcl {margin-left: 10px; vertical-align: middle;} -#noticeAcl {margin: 0;} +#moreList {display: inline-block; padding: 7px;} +#moreList .icon-more-circle {font-size: 20px;} +#moreList ul.dropdown-menu {left: -77px;} + +#backBtn {border: unset;} +#backBtn i {font-size: 20px;} + +.modal-title {font-size: 14px !important; font-weight: 700 !important;} +#modalBasicInfo .modal-dialog {width: 720px;} +createLink('doc', 'objectlibs', "type=$type&objectID=$objectID&libID={$lib->id}&docID={$doc->id}");?>
    - - + + + + + + +
    title, "placeholder='{$lang->doc->titlePlaceholder}' class='form-control' required");?>", $backLink, 'self', "id='backBtn'");?>", "id='backBtn'", '');?>title, "placeholder='{$lang->doc->titlePlaceholder}' class='form-control' required");?> + + +
    @@ -79,89 +91,104 @@ editedDate);?> -
    + +
    doc->noticeAcl['doc']);?> diff --git a/module/doc/view/selectlibtype.html.php b/module/doc/view/selectlibtype.html.php index aa1057648c..4f831ee8af 100644 --- a/module/doc/view/selectlibtype.html.php +++ b/module/doc/view/selectlibtype.html.php @@ -14,7 +14,7 @@
    -

    ' . $lang->doc->selectLibType . '';?>

    +

    ' . $lang->doc->create . '';?>