Commit 0a97d35f7ece46b563d2b35bbceeaea763e24a76

Authored by Kevin G Fourie
1 parent 097e46b6

Applied large text and date metadata fields patch from Wasiq. Thanks Wasiq!

lib/documentmanagement/DocumentField.inc 100644 โ†’ 100755
@@ -70,6 +70,8 @@ class DocumentField extends KTEntity { @@ -70,6 +70,8 @@ class DocumentField extends KTEntity {
70 var $bHasLookupTree; 70 var $bHasLookupTree;
71 var $bIsMandatory; 71 var $bIsMandatory;
72 var $iPosition; 72 var $iPosition;
  73 + var $bIsHTML;
  74 + var $iMax;
73 75
74 var $_aFieldToSelect = array( 76 var $_aFieldToSelect = array(
75 'iId' => 'id', 77 'iId' => 'id',
@@ -82,10 +84,12 @@ class DocumentField extends KTEntity { @@ -82,10 +84,12 @@ class DocumentField extends KTEntity {
82 'iParentFieldset' => 'parent_fieldset', 84 'iParentFieldset' => 'parent_fieldset',
83 'bIsMandatory' => 'is_mandatory', 85 'bIsMandatory' => 'is_mandatory',
84 'iPosition' => 'position', 86 'iPosition' => 'position',
  87 + 'bIsHTML' => 'is_html',
  88 + 'iMax' => 'max_length',
85 ); 89 );
86 90
87 // FIXME deprecate constructor use. Use DocumentField::createFromArray instead. 91 // FIXME deprecate constructor use. Use DocumentField::createFromArray instead.
88 - function DocumentField($sNewName = null, $sNewDataType = null, $bNewIsGeneric = null, $bNewHasLookup = null, $iParentFieldset = null, $bHasLookupTree = null) { 92 + function DocumentField($sNewName = null, $sNewDataType = null, $bNewIsGeneric = null, $bNewHasLookup = null, $iParentFieldset = null, $bHasLookupTree = null, $bNewIsHTML = null, $iNewMaxLength = null) {
89 93
90 $this->iId = -1; 94 $this->iId = -1;
91 $this->sName = $sNewName; 95 $this->sName = $sNewName;
@@ -95,6 +99,8 @@ class DocumentField extends KTEntity { @@ -95,6 +99,8 @@ class DocumentField extends KTEntity {
95 $this->iParentFieldset = $iParentFieldset; 99 $this->iParentFieldset = $iParentFieldset;
96 $this->bHasLookupTree = $bHasLookupTree; 100 $this->bHasLookupTree = $bHasLookupTree;
97 $this->iPosition = $this->getNextFieldPosition($iParentFieldset); 101 $this->iPosition = $this->getNextFieldPosition($iParentFieldset);
  102 + $this->bIsHTML = $bNewIsHTML;
  103 + $this->iMax = $iNewMaxLength;
98 } 104 }
99 105
100 function getID() { return $this->iId; } 106 function getID() { return $this->iId; }
@@ -118,6 +124,10 @@ class DocumentField extends KTEntity { @@ -118,6 +124,10 @@ class DocumentField extends KTEntity {
118 function setIsMandatory($iNewValue) { $this->bIsMandatory = KTUtil::anyToBool($iNewValue); } 124 function setIsMandatory($iNewValue) { $this->bIsMandatory = KTUtil::anyToBool($iNewValue); }
119 function getPosition() { return $this->iPosition; } 125 function getPosition() { return $this->iPosition; }
120 function setPosition($iNewValue) { $this->iPosition = $iNewValue; } 126 function setPosition($iNewValue) { $this->iPosition = $iNewValue; }
  127 + function getIsHTML() { return $this->bIsHTML; }
  128 + function setIsHTML($iNewValue) { $this->bIsHTML = $iNewValue; }
  129 + function getMaxLength() { return $this->iMax; }
  130 + function setMaxLength($iNewValue) { $this->iMax = $iNewValue; }
121 131
122 function _fieldValues () { 132 function _fieldValues () {
123 return array( 133 return array(
@@ -130,6 +140,8 @@ class DocumentField extends KTEntity { @@ -130,6 +140,8 @@ class DocumentField extends KTEntity {
130 'has_lookuptree' => KTUtil::anyToBool($this->bHasLookupTree), 140 'has_lookuptree' => KTUtil::anyToBool($this->bHasLookupTree),
131 'is_mandatory' => KTUtil::anyToBool($this->bIsMandatory), 141 'is_mandatory' => KTUtil::anyToBool($this->bIsMandatory),
132 'position' => $this->iPosition, 142 'position' => $this->iPosition,
  143 + 'is_html' => KTUtil::anyToBool($this->bIsHTML),
  144 + 'max_length' => $this->iMax,
133 ); 145 );
134 } 146 }
135 147
lib/metadata/fieldsetregistry.inc.php 100644 โ†’ 100755
@@ -172,6 +172,16 @@ class KTFieldsetRegistry { @@ -172,6 +172,16 @@ class KTFieldsetRegistry {
172 } else { 172 } else {
173 $type = 'ktcore.fields.string'; 173 $type = 'ktcore.fields.string';
174 } 174 }
  175 +
  176 + /* ------------------------------------
  177 + ---- Changes for Custom Fields -----
  178 + ------------------------------------ */
  179 +
  180 + if ($oField->getDataType() == 'LARGE TEXT') {
  181 + $type = 'ktcore.fields.largetext';
  182 + } else if ($oField->getDataType() == 'DATE') {
  183 + $type = 'ktcore.fields.date';
  184 + }
175 185
176 if ($type == 'ktcore.fields.string') { 186 if ($type == 'ktcore.fields.string') {
177 $widgets[] = $this->oWF->get('ktcore.widgets.string', array( 187 $widgets[] = $this->oWF->get('ktcore.widgets.string', array(
@@ -204,6 +214,29 @@ class KTFieldsetRegistry { @@ -204,6 +214,29 @@ class KTFieldsetRegistry {
204 'vocab' => MetaData::getEnabledByDocumentField($oField), 214 'vocab' => MetaData::getEnabledByDocumentField($oField),
205 'field_id' => $oField->getId(), 215 'field_id' => $oField->getId(),
206 )); 216 ));
  217 + } else if ($type == 'ktcore.fields.largetext') {
  218 + /* ------------------------------------
  219 + ---- Changes for Custom Fields -----
  220 + ------------------------------------ */
  221 + $widgets[] = $this->oWF->get('ktcore.widgets.textarea', array(
  222 + 'label' => $oField->getName(),
  223 + 'required' => $oField->getIsMandatory(),
  224 + 'name' => $fname,
  225 + 'value' => $value,
  226 + 'description' => $oField->getDescription(),
  227 + 'field' => $oField,
  228 + ));
  229 + } else if ($type == 'ktcore.fields.date') {
  230 + /* ------------------------------------
  231 + ---- Changes for Custom Fields -----
  232 + ------------------------------------ */
  233 + $widgets[] = $this->oWF->get('ktcore.widgets.date', array(
  234 + 'label' => $oField->getName(),
  235 + 'required' => $oField->getIsMandatory(),
  236 + 'name' => $fname,
  237 + 'value' => $value,
  238 + 'description' => $oField->getDescription(),
  239 + ));
207 } 240 }
208 } 241 }
209 242
plugins/ktcore/KTCorePlugin.php 100644 โ†’ 100755
@@ -190,6 +190,10 @@ class KTCorePlugin extends KTPlugin { @@ -190,6 +190,10 @@ class KTCorePlugin extends KTPlugin {
190 $this->registerWidget('KTCoreTreeMetadataWidget', 'ktcore.widgets.treemetadata', 'KTWidgets.php'); 190 $this->registerWidget('KTCoreTreeMetadataWidget', 'ktcore.widgets.treemetadata', 'KTWidgets.php');
191 $this->registerWidget('KTDescriptorSelectionWidget', 'ktcore.widgets.descriptorselection', 'KTWidgets.php'); 191 $this->registerWidget('KTDescriptorSelectionWidget', 'ktcore.widgets.descriptorselection', 'KTWidgets.php');
192 $this->registerWidget('KTCoreFolderCollectionWidget', 'ktcore.widgets.foldercollection', 'KTWidgets.php'); 192 $this->registerWidget('KTCoreFolderCollectionWidget', 'ktcore.widgets.foldercollection', 'KTWidgets.php');
  193 + $this->registerWidget('KTCoreFolderCollectionWidget', 'ktcore.widgets.foldercollection', 'KTWidgets.php');
  194 +
  195 + $this->registerWidget('KTCoreTextAreaWidget', 'ktcore.widgets.textarea', 'KTWidgets.php');
  196 + $this->registerWidget('KTCoreDateWidget', 'ktcore.widgets.date', 'KTWidgets.php');
193 197
194 $this->registerWidget('KTCoreConditionalSelectionWidget', 'ktcore.widgets.conditionalselection', 'KTWidgets.php'); 198 $this->registerWidget('KTCoreConditionalSelectionWidget', 'ktcore.widgets.conditionalselection', 'KTWidgets.php');
195 199
@@ -280,6 +284,13 @@ class KTCorePlugin extends KTPlugin { @@ -280,6 +284,13 @@ class KTCorePlugin extends KTPlugin {
280 _kt('Document Fieldsets'), 284 _kt('Document Fieldsets'),
281 _kt('Manage the different types of information that can be associated with classes of documents.'), 285 _kt('Manage the different types of information that can be associated with classes of documents.'),
282 'admin/documentFieldsv2.php', null); 286 'admin/documentFieldsv2.php', null);
  287 + if(KTPluginUtil::pluginIsActive('ktdms.wintools'))
  288 + {
  289 + $this->registerAdminPage('emailtypemanagement', 'KTEmailDocumentTypeDispatcher', 'documents',
  290 + _kt('Email Document Types'),
  291 + _kt('Manage the addition of Email document types to the system.'),
  292 + '../wintools/email/emailDocumentTypes.php', null);
  293 + }
283 $this->registerAdminPage('workflows_2', 'KTWorkflowAdminV2', 'documents', 294 $this->registerAdminPage('workflows_2', 'KTWorkflowAdminV2', 'documents',
284 _kt('Workflows'), _kt('Configure automated Workflows that map to document life-cycles.'), 295 _kt('Workflows'), _kt('Configure automated Workflows that map to document life-cycles.'),
285 'admin/workflowsv2.php', null); 296 'admin/workflowsv2.php', null);
plugins/ktcore/KTWidgets.php 100644 โ†’ 100755
@@ -927,9 +927,30 @@ class KTCoreConditionalSelectionWidget extends KTCoreSelectionWidget { @@ -927,9 +927,30 @@ class KTCoreConditionalSelectionWidget extends KTCoreSelectionWidget {
927 ); 927 );
928 return $oTemplate->render($aTemplateData); 928 return $oTemplate->render($aTemplateData);
929 } 929 }
  930 +}
930 931
  932 +class KTCoreTextAreaWidget extends KTWidget {
  933 + var $sNamespace = 'ktcore.widgets.textarea';
  934 + var $sTemplate = 'ktcore/forms/widgets/textarea';
931 935
  936 + function configure($aOptions) {
  937 + $res = parent::configure($aOptions);
  938 + if (PEAR::isError($res)) {
  939 + return $res;
  940 + }
932 941
933 -} 942 + // FIXME make required *either* per-action property
  943 + // FIXME or a global pref.
  944 + $global_required_default = true;
  945 + $this->bRequired = KTUtil::arrayGet($aOptions, 'required', $global_required_default, false);
934 946
  947 + $this->aOptions['cols'] = KTUtil::arrayGet($aOptions, 'cols', 60);
  948 + $this->aOptions['rows'] = KTUtil::arrayGet($aOptions, 'rows', 3);
  949 + $this->aOptions['field'] = KTUtil::arrayGet($aOptions, 'field');
  950 + }
  951 +}
935 952
  953 +class KTCoreDateWidget extends KTWidget {
  954 + var $sNamespace = 'ktcore.widgets.date';
  955 + var $sTemplate = 'ktcore/forms/widgets/date';
  956 +}
936 \ No newline at end of file 957 \ No newline at end of file
plugins/ktcore/admin/fieldsets/basic.inc.php 100644 โ†’ 100755
@@ -84,6 +84,8 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher { @@ -84,6 +84,8 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
84 'normal' => _kt("Normal (String)"), 84 'normal' => _kt("Normal (String)"),
85 'lookup' => _kt("Lookup"), 85 'lookup' => _kt("Lookup"),
86 'tree' => _kt("Tree"), 86 'tree' => _kt("Tree"),
  87 + 'largetextbox' => _kt("Large Textbox"),
  88 + 'date' => _kt("Date"),
87 ); 89 );
88 return $types; 90 return $types;
89 } 91 }
@@ -185,17 +187,27 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher { @@ -185,17 +187,27 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
185 $lookup = false; 187 $lookup = false;
186 $tree = false; 188 $tree = false;
187 189
  190 + //$largeField = false;
  191 +
  192 + $DataType = 'STRING';
  193 +
188 if ($data['field_type'] == 'lookup') { 194 if ($data['field_type'] == 'lookup') {
189 $lookup = true; 195 $lookup = true;
190 } else if ($data['field_type'] == 'tree') { 196 } else if ($data['field_type'] == 'tree') {
191 $lookup = true; 197 $lookup = true;
192 $tree = true; 198 $tree = true;
193 - }  
194 - 199 + } else if ($data['field_type'] == 'largetextbox') {
  200 + //$largeField = true;
  201 + $DataType = 'LARGE TEXT';
  202 + } else if ($data['field_type'] == 'date') {
  203 + //$largeField = true;
  204 + $DataType = 'DATE';
  205 + }
  206 +
195 $oField = DocumentField::createFromArray(array( 207 $oField = DocumentField::createFromArray(array(
196 'Name' => $data['name'], 208 'Name' => $data['name'],
197 'Description' => $data['description'], 209 'Description' => $data['description'],
198 - 'DataType' => 'STRING', 210 + 'DataType' => $DataType,
199 'IsGeneric' => false, 211 'IsGeneric' => false,
200 'HasLookup' => $lookup, 212 'HasLookup' => $lookup,
201 'HasLookupTree' => $tree, 213 'HasLookupTree' => $tree,
@@ -276,6 +288,31 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher { @@ -276,6 +288,31 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
276 )); 288 ));
277 return $oTemplate->render(); 289 return $oTemplate->render();
278 } 290 }
  291 +
  292 + function do_updatelargetextoptions() {
  293 +
  294 + $this->oField = DocumentField::get(KTUtil::arrayGet($_REQUEST, 'fFieldId'));
  295 +
  296 + $oValues = KTUtil::arrayGet($_REQUEST, 'largefield');
  297 +
  298 + if($oValues['size'] != "")
  299 + $this->oField->setMaxLength($oValues['size']);
  300 +
  301 + $this->oField->setIsHTML($oValues['html']);
  302 + //$this->oField->setIsHTML(true);
  303 +
  304 + //$oValue = $this->oField->_fieldValues();
  305 + //$this->successRedirectTo('managefield',_kt("Field updated. -> ") . $this->oField->getMaxLength() . " -> " . $oValue['max_length']);
  306 +
  307 + //$this->successRedirectTo('managefield',_kt("Field updated. -> ") . $oValues['html']);
  308 +
  309 + $res = $this->oField->update();
  310 + if (PEAR::isError($res)) {
  311 + return $oForm->handleError(sprintf(_kt("Failed to update field: %s"), $res->getMessage()));
  312 + }
  313 +
  314 + $this->successRedirectTo('managefield',_kt("Field updated."));
  315 + }
279 316
280 function do_updatefield() { 317 function do_updatefield() {
281 $oForm = $this->form_editfield($this->oField); 318 $oForm = $this->form_editfield($this->oField);
@@ -287,7 +324,7 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher { @@ -287,7 +324,7 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
287 // check that the field name either hasn't changed, or doesn't exist. 324 // check that the field name either hasn't changed, or doesn't exist.
288 if ($data['name'] != $this->oField->getName()) { 325 if ($data['name'] != $this->oField->getName()) {
289 $oOldField = DocumentField::getByFieldsetAndName($this->oFieldset, $data['name']); 326 $oOldField = DocumentField::getByFieldsetAndName($this->oFieldset, $data['name']);
290 - // If the field exists throw an error. Mysql doesn't distinguish between ลฝ and e so check the names are different in php. 327 + // If the field exists throw an error. Mysql doesn't distinguish between รƒยฉ and e so check the names are different in php.
291 if (!PEAR::isError($oOldField) && $oOldField->getName() == $data['name']) { 328 if (!PEAR::isError($oOldField) && $oOldField->getName() == $data['name']) {
292 $extra_errors['name'] = _kt("That name is already in use in this fieldset. Please specify a unique name."); 329 $extra_errors['name'] = _kt("That name is already in use in this fieldset. Please specify a unique name.");
293 } 330 }
plugins/ktcore/document/edit.php 100644 โ†’ 100755
@@ -217,6 +217,14 @@ class KTDocumentEditAction extends KTDocumentAction { @@ -217,6 +217,14 @@ class KTDocumentEditAction extends KTDocumentAction {
217 foreach ($fields as $oField) { 217 foreach ($fields as $oField) {
218 $val = KTUtil::arrayGet($values, 'metadata_' . $oField->getId()); 218 $val = KTUtil::arrayGet($values, 'metadata_' . $oField->getId());
219 219
  220 + if($oField->getDataType() == "LARGE TEXT")
  221 + {
  222 + if(strlen(strip_tags($val)) > $oField->getMaxLength())
  223 + {
  224 + $oForm->handleError(sprintf(_kt("Value exceeds max allowed length of %d characters for %s. Current value is %d characters."), $oField->getMaxLength(), $oField->getName(), strlen(strip_tags($val))));
  225 + }
  226 + }
  227 +
220 // FIXME "null" has strange meanings here. 228 // FIXME "null" has strange meanings here.
221 if (!is_null($val)) { 229 if (!is_null($val)) {
222 $MDPack[] = array( 230 $MDPack[] = array(
search2/search/expr.inc.php
@@ -298,6 +298,10 @@ class Expr @@ -298,6 +298,10 @@ class Expr
298 return $this instanceof MetadataField; 298 return $this instanceof MetadataField;
299 } 299 }
300 300
  301 +
  302 +
  303 +
  304 +
301 public function toViz(&$str, $phase) 305 public function toViz(&$str, $phase)
302 { 306 {
303 throw new Exception('To be implemented' . get_class($this)); 307 throw new Exception('To be implemented' . get_class($this));
@@ -494,6 +498,7 @@ class DBFieldExpr extends FieldExpr @@ -494,6 +498,7 @@ class DBFieldExpr extends FieldExpr
494 protected $matchfield; 498 protected $matchfield;
495 protected $quotedvalue; 499 protected $quotedvalue;
496 500
  501 +
497 /** 502 /**
498 * Constructor for the database field 503 * Constructor for the database field
499 * 504 *
@@ -546,6 +551,7 @@ class DBFieldExpr extends FieldExpr @@ -546,6 +551,7 @@ class DBFieldExpr extends FieldExpr
546 return $value; 551 return $value;
547 } 552 }
548 553
  554 +
549 public function getJoinTable() { return $this->jointable; } 555 public function getJoinTable() { return $this->jointable; }
550 public function getJoinField() { return $this->joinfield; } 556 public function getJoinField() { return $this->joinfield; }
551 public function getMatchingField() { return $this->matchfield; } 557 public function getMatchingField() { return $this->matchfield; }
@@ -679,6 +685,9 @@ class ValueExpr extends Expr @@ -679,6 +685,9 @@ class ValueExpr extends Expr
679 } 685 }
680 } 686 }
681 687
  688 +
  689 +
  690 +
682 public function getSQL($field, $fieldname, $op, $not=false) 691 public function getSQL($field, $fieldname, $op, $not=false)
683 { 692 {
684 $val = $this->getValue(); 693 $val = $this->getValue();
@@ -761,7 +770,7 @@ class ValueExpr extends Expr @@ -761,7 +770,7 @@ class ValueExpr extends Expr
761 default: 770 default:
762 throw new Exception(sprintf(_kt('Unknown op: %s'), $op)); 771 throw new Exception(sprintf(_kt('Unknown op: %s'), $op));
763 } 772 }
764 - 773 +
765 return $sql; 774 return $sql;
766 } 775 }
767 776
@@ -792,6 +801,7 @@ class ValueListExpr extends Expr @@ -792,6 +801,7 @@ class ValueListExpr extends Expr
792 $this->values[] = $value; 801 $this->values[] = $value;
793 } 802 }
794 803
  804 +
795 public function getValue($param=null) 805 public function getValue($param=null)
796 { 806 {
797 if (!empty($param)) 807 if (!empty($param))
@@ -837,6 +847,8 @@ class ValueListExpr extends Expr @@ -837,6 +847,8 @@ class ValueListExpr extends Expr
837 } 847 }
838 } 848 }
839 849
  850 +
  851 +
840 public function rewrite(&$left, &$op, &$right, &$not) 852 public function rewrite(&$left, &$op, &$right, &$not)
841 { 853 {
842 if (count($this->values) == 1) 854 if (count($this->values) == 1)
@@ -866,6 +878,7 @@ class ValueListExpr extends Expr @@ -866,6 +878,7 @@ class ValueListExpr extends Expr
866 878
867 } 879 }
868 880
  881 +
869 class BetweenValueExpr extends ValueExpr 882 class BetweenValueExpr extends ValueExpr
870 { 883 {
871 protected $endvalue; 884 protected $endvalue;
@@ -1018,7 +1031,7 @@ class TextQueryBuilder implements QueryBuilder @@ -1018,7 +1031,7 @@ class TextQueryBuilder implements QueryBuilder
1018 else 1031 else
1019 $query .= "$not$fieldname:$value"; 1032 $query .= "$not$fieldname:$value";
1020 } 1033 }
1021 - 1034 +
1022 return $query; 1035 return $query;
1023 } 1036 }
1024 1037
@@ -1089,7 +1102,7 @@ class SQLQueryBuilder implements QueryBuilder @@ -1089,7 +1102,7 @@ class SQLQueryBuilder implements QueryBuilder
1089 'tag_words'=>'tw', 1102 'tag_words'=>'tw',
1090 'document_fields_link'=>'pdfl' 1103 'document_fields_link'=>'pdfl'
1091 ); 1104 );
1092 - break; 1105 + break;
1093 case ExprContext::FOLDER: 1106 case ExprContext::FOLDER:
1094 $this->used_tables = array( 1107 $this->used_tables = array(
1095 'folders'=>1, 1108 'folders'=>1,
@@ -1098,7 +1111,7 @@ class SQLQueryBuilder implements QueryBuilder @@ -1098,7 +1111,7 @@ class SQLQueryBuilder implements QueryBuilder
1098 $this->aliases = array( 1111 $this->aliases = array(
1099 'folders'=>'f', 1112 'folders'=>'f',
1100 ); 1113 );
1101 - break; 1114 + break;
1102 default: 1115 default:
1103 throw new Exception('This was not expected - Context = ' . $context); 1116 throw new Exception('This was not expected - Context = ' . $context);
1104 } 1117 }
@@ -1123,7 +1136,7 @@ class SQLQueryBuilder implements QueryBuilder @@ -1123,7 +1136,7 @@ class SQLQueryBuilder implements QueryBuilder
1123 /** 1136 /**
1124 * This looks up a table name to find the appropriate alias. 1137 * This looks up a table name to find the appropriate alias.
1125 * 1138 *
1126 - * @access private 1139 + * @access private
1127 * @param string $tablename 1140 * @param string $tablename
1128 * @return string 1141 * @return string
1129 */ 1142 */
@@ -1147,7 +1160,7 @@ class SQLQueryBuilder implements QueryBuilder @@ -1147,7 +1160,7 @@ class SQLQueryBuilder implements QueryBuilder
1147 */ 1160 */
1148 private function exploreExprs($expr, $parent=null) 1161 private function exploreExprs($expr, $parent=null)
1149 { 1162 {
1150 - if ($expr->isMetadataField()) 1163 + if ($expr->isMetadataField())
1151 { 1164 {
1152 $this->metadata[] = & $parent; 1165 $this->metadata[] = & $parent;
1153 } 1166 }
@@ -1180,7 +1193,6 @@ class SQLQueryBuilder implements QueryBuilder @@ -1180,7 +1193,6 @@ class SQLQueryBuilder implements QueryBuilder
1180 } 1193 }
1181 } 1194 }
1182 } 1195 }
1183 -  
1184 /** 1196 /**
1185 * Determine table usage for a simple (metadata) query 1197 * Determine table usage for a simple (metadata) query
1186 * 1198 *
@@ -1284,7 +1296,6 @@ class SQLQueryBuilder implements QueryBuilder @@ -1284,7 +1296,6 @@ class SQLQueryBuilder implements QueryBuilder
1284 $query = $right->getSQL($left, $left->modifyName($fieldname), $expr->op(), $isNot); 1296 $query = $right->getSQL($left, $left->modifyName($fieldname), $expr->op(), $isNot);
1285 } 1297 }
1286 } 1298 }
1287 -  
1288 return $query; 1299 return $query;
1289 } 1300 }
1290 1301
@@ -1374,11 +1385,10 @@ class SQLQueryBuilder implements QueryBuilder @@ -1374,11 +1385,10 @@ class SQLQueryBuilder implements QueryBuilder
1374 // . 'ON dmv.id=pdfl' . $counter . '.metadata_version_id ' . "\n"; 1385 // . 'ON dmv.id=pdfl' . $counter . '.metadata_version_id ' . "\n";
1375 // } 1386 // }
1376 // } 1387 // }
1377 -  
1378 if ($this->used_tables['tag_words'] > 0) 1388 if ($this->used_tables['tag_words'] > 0)
1379 { 1389 {
1380 - $sql .= ' LEFT OUTER JOIN document_tags dt ON dt.document_id=d.id ' . "\n"  
1381 - . ' LEFT OUTER JOIN tag_words tw ON dt.tag_id = tw.id ' . "\n"; 1390 + $sql .= ' LEFT OUTER JOIN document_tags dt ON dt.document_id=d.id ' . "\n" .
  1391 + ' LEFT OUTER JOIN tag_words tw ON dt.tag_id = tw.id ' . "\n";
1382 } 1392 }
1383 } 1393 }
1384 else 1394 else
@@ -1452,7 +1462,7 @@ class SQLQueryBuilder implements QueryBuilder @@ -1452,7 +1462,7 @@ class SQLQueryBuilder implements QueryBuilder
1452 $sql .= "f.linked_folder_id is null"; 1462 $sql .= "f.linked_folder_id is null";
1453 } 1463 }
1454 $sql .= ' AND '; 1464 $sql .= ' AND ';
1455 - 1465 +
1456 return $sql; 1466 return $sql;
1457 } 1467 }
1458 1468
@@ -1515,7 +1525,7 @@ class SQLQueryBuilder implements QueryBuilder @@ -1515,7 +1525,7 @@ class SQLQueryBuilder implements QueryBuilder
1515 $query = 'false'; 1525 $query = 'false';
1516 } 1526 }
1517 } 1527 }
1518 - 1528 +
1519 return $query; 1529 return $query;
1520 } 1530 }
1521 1531
@@ -1537,7 +1547,7 @@ class SQLQueryBuilder implements QueryBuilder @@ -1537,7 +1547,7 @@ class SQLQueryBuilder implements QueryBuilder
1537 { 1547 {
1538 return ''; 1548 return '';
1539 } 1549 }
1540 - 1550 +
1541 $expr = $this->buildCoreSQLExpr($expr); 1551 $expr = $this->buildCoreSQLExpr($expr);
1542 $sql .= $expr; 1552 $sql .= $expr;
1543 1553
@@ -1546,7 +1556,7 @@ class SQLQueryBuilder implements QueryBuilder @@ -1546,7 +1556,7 @@ class SQLQueryBuilder implements QueryBuilder
1546 1556
1547 $sql .= " limit $maxSqlResults"; 1557 $sql .= " limit $maxSqlResults";
1548 1558
1549 - return $sql; 1559 + return $sql;
1550 } 1560 }
1551 1561
1552 /** 1562 /**
@@ -1573,17 +1583,18 @@ class SQLQueryBuilder implements QueryBuilder @@ -1573,17 +1583,18 @@ class SQLQueryBuilder implements QueryBuilder
1573 $field = $expr->left(); 1583 $field = $expr->left();
1574 1584
1575 if (is_null($field->getJoinTable())) 1585 if (is_null($field->getJoinTable()))
1576 - {  
1577 - $alias = $this->resolveTableToAlias($field->getTable());  
1578 - $fieldname = $alias . '.' . $field->getField();  
1579 - }  
1580 - else  
1581 - {  
1582 - $offset = $this->resolveJoinOffset($expr);  
1583 - $matching = $field->getMatchingField();  
1584 - $tablename = $field->getJoinTable();  
1585 - $fieldname = "$tablename$offset.$matching";  
1586 - } 1586 + {
  1587 + $alias = $this->resolveTableToAlias($field->getTable());
  1588 + $fieldname = $alias . '.' . $field->getField();
  1589 + }
  1590 + else
  1591 + {
  1592 + $offset = $this->resolveJoinOffset($expr);
  1593 + $matching = $field->getMatchingField();
  1594 + $tablename = $field->getJoinTable();
  1595 + $fieldname = "$tablename$offset.$matching";
  1596 + }
  1597 +
1587 1598
1588 $value = $expr->right(); 1599 $value = $expr->right();
1589 $sql .= $value->getSQL($field, $left->modifyName($fieldname), $expr->op(), $expr->not()); 1600 $sql .= $value->getSQL($field, $left->modifyName($fieldname), $expr->op(), $expr->not());
@@ -1688,6 +1699,8 @@ class SQLQueryBuilder implements QueryBuilder @@ -1688,6 +1699,8 @@ class SQLQueryBuilder implements QueryBuilder
1688 } 1699 }
1689 } 1700 }
1690 1701
  1702 +
  1703 +
1691 class OpExpr extends Expr 1704 class OpExpr extends Expr
1692 { 1705 {
1693 /** 1706 /**
@@ -2323,6 +2336,107 @@ class OpExpr extends Expr @@ -2323,6 +2336,107 @@ class OpExpr extends Expr
2323 $this->exploreItem($right, $group, $interest); 2336 $this->exploreItem($right, $group, $interest);
2324 } 2337 }
2325 2338
  2339 + public function checkComplexQuery($expr)
  2340 + {
  2341 + $left = $expr->left();
  2342 + $right = $expr->right();
  2343 +
  2344 + $oCriteria = array();
  2345 +
  2346 + if (DefaultOpCollection::isBoolean($expr))
  2347 + {
  2348 + //$query = '(' . $this->buildComplexQuery($left) . ' ' . $expr->op() . ' ' . $this->buildComplexQuery($right) . ')';
  2349 + $iCriteria = $this->checkComplexQuery($left);
  2350 + if(!empty($iCriteria))
  2351 + //$oCriteria = $iCriteria;
  2352 + $oCriteria[] = $iCriteria;
  2353 +
  2354 + $iCriteria = $this->checkComplexQuery($right);
  2355 + if(!empty($iCriteria))
  2356 + //$oCriteria = array_merge($oCriteria, $iCriteria);
  2357 + $oCriteria[] = $iCriteria;
  2358 +
  2359 + /*if ($expr->not())
  2360 + {
  2361 + $query = "NOT $query";
  2362 + }*/
  2363 + }
  2364 + else
  2365 + {
  2366 + $fieldname = $left->getField();
  2367 + $value = addslashes($right->getValue());
  2368 +
  2369 + //$not = $expr->not()?' NOT ':'';
  2370 + if (empty($value))
  2371 + {
  2372 + // minor hack to prevent the case of 'field:'. results are no 'field:""'
  2373 + $value = ' ';
  2374 + }
  2375 +
  2376 + $rsField = DBUtil::getResultArray("SELECT * FROM document_fields WHERE name = \"$fieldname\";");
  2377 +
  2378 + if($rsField[0]['data_type'] == 'LARGE TEXT')
  2379 + {
  2380 + $iCriteria = array();
  2381 +
  2382 + $iCriteria[0] = array();
  2383 +
  2384 + $iCriteria[0]['field'] = $fieldname;
  2385 + $iCriteria[0]['value'] = $value;
  2386 + $iCriteria[0]['not'] = $expr->not();
  2387 +
  2388 + $oCriteria[] = $iCriteria[0];
  2389 + }
  2390 +
  2391 + //global $default;
  2392 + //$default->log->debug("FIELD-TYPE: " . $iCriteria[0]['field']);
  2393 + //$default->log->debug("FIELD-TYPE: " . $oCriteria[0]['field']);
  2394 +
  2395 + /*if (strpos($value, ' ') === false)
  2396 + {
  2397 + $query = "$not$fieldname:$value";
  2398 + }
  2399 + else
  2400 + {
  2401 + $query = "$not$fieldname:\"$value\"";
  2402 + }*/
  2403 + }
  2404 +
  2405 + return $oCriteria;
  2406 + }
  2407 +
  2408 + public function checkValues($document_id, $oColumns)
  2409 + {
  2410 +
  2411 + foreach($oColumns as $column)
  2412 + {
  2413 + $rsField = DBUtil::getResultArray("SELECT df.name, dfl.value FROM documents d
  2414 + INNER JOIN document_metadata_version dmv ON d.metadata_version_id=dmv.id
  2415 + INNER JOIN document_fields_link dfl ON dfl.metadata_version_id=d.metadata_version_id
  2416 + INNER JOIN document_fields df ON df.id = dfl.document_field_id AND df.name = '" . $column['field'] . "'
  2417 + WHERE d.id = $document_id;");
  2418 +
  2419 + /*global $default;
  2420 + $default->log->debug("MATCH QUERY: SELECT df.name, dfl.value FROM documents d
  2421 + INNER JOIN document_metadata_version dmv ON d.metadata_version_id=dmv.id
  2422 + INNER JOIN document_fields_link dfl ON dfl.metadata_version_id=d.metadata_version_id
  2423 + INNER JOIN document_fields df ON df.id = dfl.document_field_id AND df.name = '" . $column['field'] . "'
  2424 + WHERE d.id = $document_id;");
  2425 +
  2426 + $default->log->debug("MATCH: $document_id, " . $column['field'] . ", " . $rsField[0]['value'] . ", " . $column['value'] . " - "
  2427 + . strip_tags($rsField[0]['value']));*/
  2428 +
  2429 + $position = strpos(strtolower(strip_tags($rsField[0]['value'])), strtolower($column['value']));
  2430 +
  2431 + //$default->log->debug("POSITION: " . $position);
  2432 +
  2433 + if($position === false)
  2434 + return false;
  2435 + }
  2436 +
  2437 + return true;
  2438 + }
  2439 +
2326 /** 2440 /**
2327 * Executes a database query 2441 * Executes a database query
2328 * 2442 *
@@ -2337,7 +2451,7 @@ class OpExpr extends Expr @@ -2337,7 +2451,7 @@ class OpExpr extends Expr
2337 if (empty($group)) { return array(); } 2451 if (empty($group)) { return array(); }
2338 2452
2339 $exprbuilder = new SQLQueryBuilder($this->getContext()); 2453 $exprbuilder = new SQLQueryBuilder($this->getContext());
2340 - $exprbuilder->setIncludeStatus($this->incl_status); 2454 + $exprbuilder->setIncludeStatus($this->incl_status);
2341 2455
2342 if (count($group) == 1) 2456 if (count($group) == 1)
2343 { 2457 {
@@ -2363,15 +2477,66 @@ class OpExpr extends Expr @@ -2363,15 +2477,66 @@ class OpExpr extends Expr
2363 throw new Exception($rs->getMessage()); 2477 throw new Exception($rs->getMessage());
2364 } 2478 }
2365 2479
  2480 + if (count($group) == 1)
  2481 + {
  2482 + //$default->log->debug("CASE 1");
  2483 +
  2484 + $oCriteria = $this->checkComplexQuery($group[0]);
  2485 + }
  2486 + else
  2487 + {
  2488 + //$default->log->debug("CASE 2");
  2489 +
  2490 + foreach($group as $expr)
  2491 + {
  2492 + $left = $expr->left();
  2493 + $right = $expr->right();
  2494 +
  2495 + $default->log->debug("FIELD-IS: " . $left->isOpExpr());
  2496 +
  2497 + $fieldname = $left->getField();
  2498 + $value = addslashes($right->getValue());
  2499 +
  2500 + $rsField = DBUtil::getResultArray("SELECT * FROM document_fields WHERE name = \"$fieldname\";");
  2501 +
  2502 + if($rsField[0]['data_type'] == 'LARGE TEXT')
  2503 + {
  2504 + $iCriteria = array();
  2505 +
  2506 + $iCriteria[0] = array();
  2507 +
  2508 + $iCriteria[0]['field'] = $fieldname;
  2509 + $iCriteria[0]['value'] = $value;
  2510 + $iCriteria[0]['not'] = $expr->not();
  2511 +
  2512 + $oCriteria[] = $iCriteria[0];
  2513 +
  2514 + /*$not = $expr->not()?' NOT ':'';
  2515 +
  2516 + if (strpos($value, ' ') !== false)
  2517 + $default->log->debug("CRITERION: $not$fieldname:\"$value\"");
  2518 + else
  2519 + $default->log->debug("CRITERION: $not$fieldname:$value");*/
  2520 + }
  2521 +
  2522 + //$default->log->debug("FIELD-TYPE: " . $oCriteria[0]['field']);
  2523 + }
  2524 + }
  2525 +
  2526 + //$default->log->debug("TOTAL CRITERIA: " . count($oCriteria));
  2527 +
2366 foreach($rs as $item) 2528 foreach($rs as $item)
2367 { 2529 {
2368 $id = $item['id']; 2530 $id = $item['id'];
2369 $rank = $exprbuilder->getRanking($item); 2531 $rank = $exprbuilder->getRanking($item);
2370 if (!array_key_exists($id, $results) || $rank > $results[$id]->Rank) 2532 if (!array_key_exists($id, $results) || $rank > $results[$id]->Rank)
2371 { 2533 {
2372 - if ($this->context == ExprContext::DOCUMENT) 2534 + if ($this->context == ExprContext::DOCUMENT)
2373 { 2535 {
2374 - $results[$id] = new DocumentResultItem($id, $rank, $item['title'], $exprbuilder->getResultText($item), null, $this->incl_status); 2536 + if((count($oCriteria) > 0 && $this->checkValues($id, $oCriteria)) || count($oCriteria) == 0)
  2537 + {
  2538 + $results[$id] = new DocumentResultItem($id, $rank, $item['title'], $exprbuilder->getResultText($item), null, $this->incl_status);
  2539 + }
2375 } 2540 }
2376 else 2541 else
2377 { 2542 {
@@ -2379,9 +2544,8 @@ class OpExpr extends Expr @@ -2379,9 +2544,8 @@ class OpExpr extends Expr
2379 } 2544 }
2380 } 2545 }
2381 } 2546 }
2382 - 2547 +
2383 return $results; 2548 return $results;
2384 -  
2385 } 2549 }
2386 2550
2387 /** 2551 /**
@@ -2425,6 +2589,7 @@ class OpExpr extends Expr @@ -2425,6 +2589,7 @@ class OpExpr extends Expr
2425 $indexer = Indexer::get(); 2589 $indexer = Indexer::get();
2426 $indexer->setIncludeStatus($this->incl_status); 2590 $indexer->setIncludeStatus($this->incl_status);
2427 2591
  2592 + global $default;
2428 $default->log->debug("SEARCH LUCENE: $query"); 2593 $default->log->debug("SEARCH LUCENE: $query");
2429 2594
2430 $results = $indexer->query($query); 2595 $results = $indexer->query($query);
@@ -2446,8 +2611,12 @@ class OpExpr extends Expr @@ -2446,8 +2611,12 @@ class OpExpr extends Expr
2446 */ 2611 */
2447 public function evaluate($context = ExprContext::DOCUMENT_AND_FOLDER) 2612 public function evaluate($context = ExprContext::DOCUMENT_AND_FOLDER)
2448 { 2613 {
2449 - if ($context == ExprContext::DOCUMENT_AND_FOLDER)  
2450 - { 2614 +
  2615 + global $default;
  2616 + $default->log->debug("START EVALUATE");
  2617 +
  2618 + if ($context == ExprContext::DOCUMENT_AND_FOLDER)
  2619 + {
2451 $docs = $this->evaluate(ExprContext::DOCUMENT); 2620 $docs = $this->evaluate(ExprContext::DOCUMENT);
2452 $folders = $this->evaluate(ExprContext::FOLDER); 2621 $folders = $this->evaluate(ExprContext::FOLDER);
2453 2622
@@ -2455,7 +2624,8 @@ class OpExpr extends Expr @@ -2455,7 +2624,8 @@ class OpExpr extends Expr
2455 'docs' => $docs['docs'], 2624 'docs' => $docs['docs'],
2456 'folders' => $folders['folders']); 2625 'folders' => $folders['folders']);
2457 } 2626 }
2458 - $this->setContext($context); 2627 +
  2628 + $this->setContext($context);
2459 2629
2460 $left = $this->left(); 2630 $left = $this->left();
2461 $left->setIncludeStatus($this->incl_status); 2631 $left->setIncludeStatus($this->incl_status);
@@ -2469,7 +2639,7 @@ class OpExpr extends Expr @@ -2469,7 +2639,7 @@ class OpExpr extends Expr
2469 $point = 'point'; 2639 $point = 'point';
2470 } 2640 }
2471 $resultContext = ($this->getContext() == ExprContext::DOCUMENT)?'docs':'folders'; 2641 $resultContext = ($this->getContext() == ExprContext::DOCUMENT)?'docs':'folders';
2472 - 2642 +
2473 if ($point == 'merge') 2643 if ($point == 'merge')
2474 { 2644 {
2475 $leftres = $left->evaluate($context); 2645 $leftres = $left->evaluate($context);
@@ -2572,4 +2742,4 @@ class OpExpr extends Expr @@ -2572,4 +2742,4 @@ class OpExpr extends Expr
2572 } 2742 }
2573 } 2743 }
2574 2744
2575 -?> 2745 -?>
  2746 +?>
2576 \ No newline at end of file 2747 \ No newline at end of file
sql/mysql/install/data.sql
@@ -313,7 +313,9 @@ INSERT INTO `data_types` VALUES @@ -313,7 +313,9 @@ INSERT INTO `data_types` VALUES
313 (2,'CHAR'), 313 (2,'CHAR'),
314 (3,'TEXT'), 314 (3,'TEXT'),
315 (4,'INT'), 315 (4,'INT'),
316 -(5,'FLOAT'); 316 +(5,'FLOAT'),
  317 +(6,'LARGE TEXT'),
  318 +(7,'DATE');
317 /*!40000 ALTER TABLE `data_types` ENABLE KEYS */; 319 /*!40000 ALTER TABLE `data_types` ENABLE KEYS */;
318 UNLOCK TABLES; 320 UNLOCK TABLES;
319 321
@@ -1758,8 +1760,10 @@ INSERT INTO `upgrades` VALUES @@ -1758,8 +1760,10 @@ INSERT INTO `upgrades` VALUES
1758 (219,'upgrade*3.6.0*99*upgrade3.6.0','Upgrade from version 3.5.4a to 3.6.0','2009-01-01 00:00:00',1,'upgrade*3.6.0*99*upgrade3.6.0'), 1760 (219,'upgrade*3.6.0*99*upgrade3.6.0','Upgrade from version 3.5.4a to 3.6.0','2009-01-01 00:00:00',1,'upgrade*3.6.0*99*upgrade3.6.0'),
1759 (220, 'sql*3.6.1*0*3.6.1/search_ranking.sql', 'Database upgrade to version 3.6.1: Search ranking','2009-04-01 00:00:00',1,'upgrade*3.6.1*99*upgrade3.6.1'), 1761 (220, 'sql*3.6.1*0*3.6.1/search_ranking.sql', 'Database upgrade to version 3.6.1: Search ranking','2009-04-01 00:00:00',1,'upgrade*3.6.1*99*upgrade3.6.1'),
1760 (221,'upgrade*3.6.1*99*upgrade3.6.1','Upgrade from version 3.6.0 to 3.6.1','2009-04-01 00:00:00',1,'upgrade*3.6.1*99*upgrade3.6.1'), 1762 (221,'upgrade*3.6.1*99*upgrade3.6.1','Upgrade from version 3.6.0 to 3.6.1','2009-04-01 00:00:00',1,'upgrade*3.6.1*99*upgrade3.6.1'),
1761 -(222,'upgrade*3.6.2*99*upgrade3.6.2','Upgrade from version 3.6.1 to 3.6.2','2009-05-01 00:00:00',1,'upgrade*3.6.2*99*upgrade3.6.2'),  
1762 -(223,'upgrade*3.6.3*99*upgrade3.6.3','Upgrade from version 3.6.2 to 3.6.3','2009-06-01 00:00:00',1,'upgrade*3.6.3*99*upgrade3.6.3'); 1763 +(222, 'sql*3.6.2*0*3.6.2/folders.sql', 'Folder created and modified timestamp fix','2009-05-01 00:00:00',1,'upgrade*3.6.2*99*upgrade3.6.2'),
  1764 +(223, 'sql*3.6.2*0*3.6.2/data_types.sql', 'Add large text and date fields','2009-05-01 00:00:00',1,'upgrade*3.6.2*99*upgrade3.6.2'),
  1765 +(224,'upgrade*3.6.2*99*upgrade3.6.2','Upgrade from version 3.6.1 to 3.6.2','2009-05-01 00:00:00',1,'upgrade*3.6.2*99*upgrade3.6.2'),
  1766 +(225,'upgrade*3.6.3*99*upgrade3.6.3','Upgrade from version 3.6.2 to 3.6.3','2009-06-01 00:00:00',1,'upgrade*3.6.3*99*upgrade3.6.3');
1763 /*!40000 ALTER TABLE `upgrades` ENABLE KEYS */; 1767 /*!40000 ALTER TABLE `upgrades` ENABLE KEYS */;
1764 UNLOCK TABLES; 1768 UNLOCK TABLES;
1765 1769
@@ -2690,7 +2694,7 @@ UNLOCK TABLES; @@ -2690,7 +2694,7 @@ UNLOCK TABLES;
2690 LOCK TABLES `zseq_upgrades` WRITE; 2694 LOCK TABLES `zseq_upgrades` WRITE;
2691 /*!40000 ALTER TABLE `zseq_upgrades` DISABLE KEYS */; 2695 /*!40000 ALTER TABLE `zseq_upgrades` DISABLE KEYS */;
2692 INSERT INTO `zseq_upgrades` VALUES 2696 INSERT INTO `zseq_upgrades` VALUES
2693 -(223); 2697 +(225);
2694 /*!40000 ALTER TABLE `zseq_upgrades` ENABLE KEYS */; 2698 /*!40000 ALTER TABLE `zseq_upgrades` ENABLE KEYS */;
2695 UNLOCK TABLES; 2699 UNLOCK TABLES;
2696 2700
sql/mysql/install/structure.sql
@@ -314,6 +314,8 @@ CREATE TABLE `document_fields` ( @@ -314,6 +314,8 @@ CREATE TABLE `document_fields` (
314 `is_mandatory` tinyint(1) NOT NULL default '0', 314 `is_mandatory` tinyint(1) NOT NULL default '0',
315 `description` mediumtext NOT NULL, 315 `description` mediumtext NOT NULL,
316 `position` int(11) NOT NULL default '0', 316 `position` int(11) NOT NULL default '0',
  317 + `is_html` tinyint(1) default null,
  318 + `max_length` int default null,
317 PRIMARY KEY (`id`), 319 PRIMARY KEY (`id`),
318 KEY `parent_fieldset` (`parent_fieldset`), 320 KEY `parent_fieldset` (`parent_fieldset`),
319 CONSTRAINT `document_fields_ibfk_1` FOREIGN KEY (`parent_fieldset`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE 321 CONSTRAINT `document_fields_ibfk_1` FOREIGN KEY (`parent_fieldset`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
sql/mysql/upgrade/3.6.2/data_types.sql 0 โ†’ 100755
  1 +INSERT INTO data_types VALUES(6, 'LARGE TEXT');
  2 +INSERT INTO data_types VALUES(7, 'DATE');
  3 +
  4 +ALTER TABLE document_fields ADD COLUMN is_html tinyint(1) default null;
  5 +ALTER TABLE document_fields ADD COLUMN max_length int default null;
0 \ No newline at end of file 6 \ No newline at end of file
templates/kt3/fieldsets/simple.smarty 100644 โ†’ 100755
templates/ktcore/forms/widgets/textarea.smarty 0 โ†’ 100755
  1 +<!--------------------------------------
  2 + ---- Changes for Custom Fields -----
  3 + -------------------------------------->
  4 +<div name="div_{$name}" id="div_{$name}"></div>
  5 +
  6 +{literal}
  7 +<link rel="stylesheet" type="text/css" href="/thirdpartyjs/extjs/resources/css/ext-all.css">
  8 +
  9 +<script type="text/javascript" src="/thirdpartyjs/extjs/adapter/ext/ext-base.js"></script>
  10 +<script type="text/javascript" src="/thirdpartyjs/extjs/ext-all.js"></script>
  11 +<script type="text/javascript">
  12 +
  13 +Ext.BLANK_IMAGE_URL = '/thirdpartyjs/extjs/resources/images/default/s.gif';
  14 +
  15 +Ext.onReady(function(){
  16 +
  17 + Ext.QuickTips.init();
  18 +
  19 + var dp = new Ext.form.DateField({
  20 + name: '{/literal}{$name}{literal}',
  21 + allowBlank:false,
  22 + size:10,
  23 + format: 'Y-m-d',
  24 + fieldClass: 'metadatadate'
  25 + {/literal}{if $has_value},value: '{$value|sanitize_input}'{/if}{literal}
  26 + });
  27 +
  28 + dp.render('div_{/literal}{$name}{literal}');
  29 +});
  30 +
  31 +</script>
  32 +
  33 +{/literal}
0 \ No newline at end of file 34 \ No newline at end of file
templates/ktcore/metadata/admin/manage_field.smarty 100644 โ†’ 100755
@@ -24,6 +24,9 @@ aspects of this particular field.{/i18n}&lt;/p&gt; @@ -24,6 +24,9 @@ aspects of this particular field.{/i18n}&lt;/p&gt;
24 {if ($field->getHasLookup())} 24 {if ($field->getHasLookup())}
25 <div class="twocolumn"> 25 <div class="twocolumn">
26 {/if} 26 {/if}
  27 +{if ($field->getDataType() == "LARGE TEXT")}
  28 +<div class="twocolumn">
  29 +{/if}
27 {$form->render()} 30 {$form->render()}
28 {if ($field->getHasLookup())} 31 {if ($field->getHasLookup())}
29 </div> 32 </div>
@@ -48,4 +51,38 @@ available.{/i18n}&lt;/p&gt; @@ -48,4 +51,38 @@ available.{/i18n}&lt;/p&gt;
48 </fieldset> 51 </fieldset>
49 </div> 52 </div>
50 {/if} 53 {/if}
  54 +{if ($field->getDataType() == "LARGE TEXT")}
  55 +</div>
  56 +<div class="twocolumn second">
  57 +<fieldset>
  58 +<legend>{i18n}Extra Options{/i18n}</legend>
  59 +
  60 +<p class="descriptiveText">{i18n}Different fields have different actions and options
  61 +available.{/i18n}</p>
  62 +
  63 +<form method="POST" action="/admin.php?kt_path_info=documents/fieldmanagement2&fieldset_action=updatelargetextoptions&fFieldId={$field_id}&fFieldsetId={$field->getParentFieldsetId()}&action=edit">
  64 +
  65 +<div class="field">
  66 +<label for="largefield[size]">Max Length</label>
  67 +<p class="descriptiveText">Maximum length allowed for the field.</p>
  68 +<p class="errorMessage"></p>
  69 +<input type="text" name="largefield[size]" value="{$field->getMaxLength()}" size="3" />
  70 +</div>
  71 +
  72 +<div class="field ">
  73 +<label for="largefield[html]">HTML</label>
  74 +<p class="descriptiveText">Defines the format of the field.</p>
  75 +<p class="errorMessage"></p>
  76 +<input type="checkbox" name="largefield[html]" {if $field->getIsHTML()==1}checked="true"{/if} class="noborder"/>
  77 +</div>
  78 +
  79 +<div class="form_actions">
  80 +<input type="submit" name="" value="Update Options" />
  81 +</div>
  82 +
  83 +</form>
  84 +
  85 +</fieldset>
  86 +</div>
  87 +{/if}
51 <hr class="floatClear" /> 88 <hr class="floatClear" />