mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-18 02:59:27 +00:00
allow inline editing on document details page
This commit is contained in:
parent
a75257c7c2
commit
c6d0a1d345
|
@ -3,6 +3,7 @@
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
- fix import of users
|
- fix import of users
|
||||||
- major rework of scripts in utils, unify reading of settings, use PHP_EOL
|
- major rework of scripts in utils, unify reading of settings, use PHP_EOL
|
||||||
|
- allow inline editing of document name
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Changes in version 5.1.19
|
Changes in version 5.1.19
|
||||||
|
|
|
@ -74,6 +74,8 @@ class Settings { /* {{{ */
|
||||||
var $_apiUserId = 0;
|
var $_apiUserId = 0;
|
||||||
// api allowed origins for restapi
|
// api allowed origins for restapi
|
||||||
var $_apiOrigin = '';
|
var $_apiOrigin = '';
|
||||||
|
// allow inline editing of document/folder names
|
||||||
|
var $_inlineEditing = false;
|
||||||
// Strict form checking
|
// Strict form checking
|
||||||
var $_strictFormCheck = false;
|
var $_strictFormCheck = false;
|
||||||
// list of form fields which are visible by default but can be explixitly
|
// list of form fields which are visible by default but can be explixitly
|
||||||
|
@ -472,6 +474,7 @@ class Settings { /* {{{ */
|
||||||
$node = $xml->xpath('/configuration/site/edition');
|
$node = $xml->xpath('/configuration/site/edition');
|
||||||
$tab = $node[0]->attributes();
|
$tab = $node[0]->attributes();
|
||||||
$this->_strictFormCheck = Settings::boolVal($tab["strictFormCheck"]);
|
$this->_strictFormCheck = Settings::boolVal($tab["strictFormCheck"]);
|
||||||
|
$this->_inlineEditing = Settings::boolVal($tab["inlineEditing"]);
|
||||||
if(trim(strval($tab["noDocumentFormFields"])))
|
if(trim(strval($tab["noDocumentFormFields"])))
|
||||||
$this->_noDocumentFormFields = explode(',',strval($tab["noDocumentFormFields"]));
|
$this->_noDocumentFormFields = explode(',',strval($tab["noDocumentFormFields"]));
|
||||||
$this->setViewOnlineFileTypesFromString(strval($tab["viewOnlineFileTypes"]));
|
$this->setViewOnlineFileTypesFromString(strval($tab["viewOnlineFileTypes"]));
|
||||||
|
@ -835,6 +838,7 @@ class Settings { /* {{{ */
|
||||||
// XML Path: /configuration/site/edition
|
// XML Path: /configuration/site/edition
|
||||||
$node = $this->getXMLNode($xml, '/configuration/site', 'edition');
|
$node = $this->getXMLNode($xml, '/configuration/site', 'edition');
|
||||||
$this->setXMLAttributValue($node, "strictFormCheck", $this->_strictFormCheck);
|
$this->setXMLAttributValue($node, "strictFormCheck", $this->_strictFormCheck);
|
||||||
|
$this->setXMLAttributValue($node, "inlineEditing", $this->_inlineEditing);
|
||||||
$this->setXMLAttributValue($node, "noDocumentFormFields", implode(',', $this->_noDocumentFormFields));
|
$this->setXMLAttributValue($node, "noDocumentFormFields", implode(',', $this->_noDocumentFormFields));
|
||||||
$this->setXMLAttributValue($node, "viewOnlineFileTypes", $this->getViewOnlineFileTypesToString());
|
$this->setXMLAttributValue($node, "viewOnlineFileTypes", $this->getViewOnlineFileTypesToString());
|
||||||
$this->setXMLAttributValue($node, "editOnlineFileTypes", $this->getEditOnlineFileTypesToString());
|
$this->setXMLAttributValue($node, "editOnlineFileTypes", $this->getEditOnlineFileTypesToString());
|
||||||
|
|
|
@ -600,6 +600,30 @@ switch($command) {
|
||||||
}
|
}
|
||||||
break; /* }}} */
|
break; /* }}} */
|
||||||
|
|
||||||
|
case 'setdocumentname': /* {{{ */
|
||||||
|
if(1||$user) {
|
||||||
|
$document = $dms->getDocument($_REQUEST['id']);
|
||||||
|
if($document) {
|
||||||
|
if ($document->getAccessMode($user) >= M_READWRITE) {
|
||||||
|
if (!$document->setName($_REQUEST['name'])) {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('success'=>false, 'message'=>'Error setting name', 'data'=>''));
|
||||||
|
} else {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_name_changed'), 'data'=>''));
|
||||||
|
add_log_line();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('success'=>false, 'message'=>getMLText('access_denied'), 'data'=>''));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_doc_id'), 'data'=>''));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break; /* }}} */
|
||||||
|
|
||||||
case 'submittranslation': /* {{{ */
|
case 'submittranslation': /* {{{ */
|
||||||
if($settings->_showMissingTranslations) {
|
if($settings->_showMissingTranslations) {
|
||||||
if($user && !empty($_POST['phrase'])) {
|
if($user && !empty($_POST['phrase'])) {
|
||||||
|
|
|
@ -76,6 +76,7 @@ if ($action == "saveSettings")
|
||||||
|
|
||||||
// SETTINGS - SITE - EDITION
|
// SETTINGS - SITE - EDITION
|
||||||
$settings->_strictFormCheck = getBoolValue("strictFormCheck");
|
$settings->_strictFormCheck = getBoolValue("strictFormCheck");
|
||||||
|
$settings->_inlineEditing = getBoolValue("inlineEditing");
|
||||||
if(empty($_POST["noDocumentFormFields"]))
|
if(empty($_POST["noDocumentFormFields"]))
|
||||||
$settings->_noDocumentFormFields = array();
|
$settings->_noDocumentFormFields = array();
|
||||||
else
|
else
|
||||||
|
|
|
@ -225,6 +225,11 @@ i.in-workflow {color: #11479e;}
|
||||||
i.workflow-action {color: #91479e;}
|
i.workflow-action {color: #91479e;}
|
||||||
i.selected {border: 1px solid #d4d4d4;padding:3px;border-radius:3px;background-color:#fafafa;background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);}
|
i.selected {border: 1px solid #d4d4d4;padding:3px;border-radius:3px;background-color:#fafafa;background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);}
|
||||||
|
|
||||||
|
span.editable:after {
|
||||||
|
font: normal normal normal 14px/1 FontAwesome;
|
||||||
|
content: " \f044";
|
||||||
|
}
|
||||||
|
|
||||||
span.openpopupbox {
|
span.openpopupbox {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -518,6 +518,30 @@ $(document).ready( function() {
|
||||||
$('button.history-back').on('click', function(event) { /* {{{ */
|
$('button.history-back').on('click', function(event) { /* {{{ */
|
||||||
window.history.back();
|
window.history.back();
|
||||||
}); /* }}} */
|
}); /* }}} */
|
||||||
|
|
||||||
|
$("body").on("blur", "span.editable", function(e) { /* {{{ */
|
||||||
|
console.log($(this).data('document'));
|
||||||
|
console.log('Hallo'+$(this).text());
|
||||||
|
e.preventDefault();
|
||||||
|
$.post( "../op/op.Ajax.php", { command: "setdocumentname", id: $(this).data('document'), name: $(this).text() })
|
||||||
|
.done(function( data ) {
|
||||||
|
noty({
|
||||||
|
text: data.message,
|
||||||
|
type: data.success ? 'success' : 'error',
|
||||||
|
dismissQueue: true,
|
||||||
|
layout: 'topRight',
|
||||||
|
theme: 'defaultTheme',
|
||||||
|
timeout: 1500,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}); /* }}} */
|
||||||
|
|
||||||
|
$("body").on("keypress", "span.editable", function(e) { /* {{{ */
|
||||||
|
if(e.which == 13) {
|
||||||
|
$(this).blur();
|
||||||
|
}
|
||||||
|
return e.which != 13;
|
||||||
|
}); /* }}} */
|
||||||
});
|
});
|
||||||
|
|
||||||
function onAddClipboard(ev) { /* {{{ */
|
function onAddClipboard(ev) { /* {{{ */
|
||||||
|
|
|
@ -2038,6 +2038,22 @@ $(function() {
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrap text in inline editing tags
|
||||||
|
*
|
||||||
|
* @param string text
|
||||||
|
*/
|
||||||
|
function printInlineEdit($text, $object){ /* {{{ */
|
||||||
|
if(!empty($this->params['settings']->_inlineEditing)) {
|
||||||
|
echo "<span class=\"editable\" contenteditable=\"true\"";
|
||||||
|
if($object->isType('document'))
|
||||||
|
echo " data-document=\"".$object->getId()."\"";
|
||||||
|
echo ">".$text;
|
||||||
|
echo "</span>\n";
|
||||||
|
} else
|
||||||
|
echo $text;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print button with link for deleting a document
|
* Print button with link for deleting a document
|
||||||
*
|
*
|
||||||
|
|
|
@ -299,6 +299,7 @@ $this->showStartPaneContent('site', (!$currenttab || $currenttab == 'site'));
|
||||||
-->
|
-->
|
||||||
<?php $this->showConfigHeadline('settings_Edition'); ?>
|
<?php $this->showConfigHeadline('settings_Edition'); ?>
|
||||||
<?php $this->showConfigCheckbox('settings_strictFormCheck', 'strictFormCheck'); ?>
|
<?php $this->showConfigCheckbox('settings_strictFormCheck', 'strictFormCheck'); ?>
|
||||||
|
<?php $this->showConfigCheckbox('settings_inlineEditing', 'inlineEditing'); ?>
|
||||||
<?php $this->showConfigOption('settings_noDocumentFormFields', 'noDocumentFormFields', array('comment', 'keywords', 'categories', 'sequence', 'expires', 'version', 'version_comment', 'notification'), true, true); ?>
|
<?php $this->showConfigOption('settings_noDocumentFormFields', 'noDocumentFormFields', array('comment', 'keywords', 'categories', 'sequence', 'expires', 'version', 'version_comment', 'notification'), true, true); ?>
|
||||||
<?php $this->showConfigText('settings_viewOnlineFileTypes', 'viewOnlineFileTypes', 'array'); ?>
|
<?php $this->showConfigText('settings_viewOnlineFileTypes', 'viewOnlineFileTypes', 'array'); ?>
|
||||||
<?php $this->showConfigText('settings_editOnlineFileTypes', 'editOnlineFileTypes', 'array'); ?>
|
<?php $this->showConfigText('settings_editOnlineFileTypes', 'editOnlineFileTypes', 'array'); ?>
|
||||||
|
|
|
@ -201,7 +201,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php printMLText("name");?>:</td>
|
<td><?php printMLText("name");?>:</td>
|
||||||
<td><?php print htmlspecialchars($document->getName());?></td>
|
<td><?php $this->printInlineEdit(htmlspecialchars($document->getName()), $document);?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php printMLText("owner");?>:</td>
|
<td><?php printMLText("owner");?>:</td>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user