mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 13:42:04 +00:00
Merge branch 'seeddms-5.0.x' into seeddms-5.1.x
This commit is contained in:
commit
d3c12a84fd
|
@ -27,6 +27,7 @@
|
||||||
Changes in version 5.0.7
|
Changes in version 5.0.7
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
- merged changes from 4.3.30
|
- merged changes from 4.3.30
|
||||||
|
- validate email address of attributes of type email
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Changes in version 5.0.6
|
Changes in version 5.0.6
|
||||||
|
|
|
@ -926,6 +926,7 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
||||||
break;
|
break;
|
||||||
case self::type_email:
|
case self::type_email:
|
||||||
foreach($values as $value) {
|
foreach($values as $value) {
|
||||||
|
$success &= preg_match('/^[a-z0-9._-]+@+[a-z0-9._-]+\.+[a-z]{2,4}$/i', $value);
|
||||||
}
|
}
|
||||||
if(!$success)
|
if(!$success)
|
||||||
$this->_validation_error = 5;
|
$this->_validation_error = 5;
|
||||||
|
|
|
@ -986,7 +986,7 @@ class Settings { /* {{{ */
|
||||||
function searchConfigFilePath() { /* {{{ */
|
function searchConfigFilePath() { /* {{{ */
|
||||||
$configFilePath = null;
|
$configFilePath = null;
|
||||||
|
|
||||||
if($configDir = $this->getConfigDir()) {
|
if($configDir = Settings::getConfigDir()) {
|
||||||
if (file_exists($configDir."/settings.xml"))
|
if (file_exists($configDir."/settings.xml"))
|
||||||
return $configDir."/settings.xml";
|
return $configDir."/settings.xml";
|
||||||
}
|
}
|
||||||
|
@ -1002,7 +1002,7 @@ class Settings { /* {{{ */
|
||||||
* If none was found a final try will be made checking /etc/seeddms
|
* If none was found a final try will be made checking /etc/seeddms
|
||||||
* @return NULL|string config directory
|
* @return NULL|string config directory
|
||||||
*/
|
*/
|
||||||
function getConfigDir() { /* {{{ */
|
static function getConfigDir() { /* {{{ */
|
||||||
$_tmp = dirname($_SERVER['SCRIPT_FILENAME']);
|
$_tmp = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||||
$_arr = preg_split('/\//', rtrim(str_replace('\\', '/', $_tmp)));
|
$_arr = preg_split('/\//', rtrim(str_replace('\\', '/', $_tmp)));
|
||||||
$configDir = null;
|
$configDir = null;
|
||||||
|
|
|
@ -1298,21 +1298,25 @@ $('#acceptkeywords').click(function(ev) {
|
||||||
switch($attrdef->getType()) {
|
switch($attrdef->getType()) {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_boolean:
|
case SeedDMS_Core_AttributeDefinition::type_boolean:
|
||||||
echo "<input type=\"hidden\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"0\" />";
|
echo "<input type=\"hidden\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"0\" />";
|
||||||
echo "<input type=\"checkbox\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"1\" ".(($attribute && $attribute->getValue()) ? 'checked' : '')." />";
|
echo "<input type=\"checkbox\" id=\"".$fieldname."_".$attrdef->getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"1\" ".(($attribute && $attribute->getValue()) ? 'checked' : '')." />";
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : '';
|
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : '';
|
||||||
?>
|
?>
|
||||||
<span class="input-append date datepicker" style="_display: inline;" data-date="<?php echo date('Y-m-d'); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>">
|
<span class="input-append date datepicker" style="_display: inline;" data-date="<?php echo date('Y-m-d'); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>">
|
||||||
<input class="span4" size="16" name="<?php echo $fieldname ?>[<?php echo $attrdef->getId() ?>]" type="text" value="<?php if($objvalue) echo $objvalue; else echo "" /*date('Y-m-d')*/; ?>">
|
<input id="<?php echo $fieldname."_".$attrdef->getId();?>" class="span4" size="16" name="<?php echo $fieldname ?>[<?php echo $attrdef->getId() ?>]" type="text" value="<?php if($objvalue) echo $objvalue; else echo "" /*date('Y-m-d')*/; ?>">
|
||||||
<span class="add-on"><i class="icon-calendar"></i></span>
|
<span class="add-on"><i class="icon-calendar"></i></span>
|
||||||
</span>
|
</span>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_email:
|
||||||
|
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : '';
|
||||||
|
echo "<input type=\"text\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').' data-rule-email="true"'." />";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if($valueset = $attrdef->getValueSetAsArray()) {
|
if($valueset = $attrdef->getValueSetAsArray()) {
|
||||||
echo "<input type=\"hidden\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"\" />";
|
echo "<input type=\"hidden\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"\" />";
|
||||||
echo "<select name=\"".$fieldname."[".$attrdef->getId()."]";
|
echo "<select id=\"".$fieldname."_".$attrdef->getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]";
|
||||||
if($attrdef->getMultipleValues()) {
|
if($attrdef->getMultipleValues()) {
|
||||||
echo "[]\" multiple";
|
echo "[]\" multiple";
|
||||||
} else {
|
} else {
|
||||||
|
@ -1337,9 +1341,9 @@ $('#acceptkeywords').click(function(ev) {
|
||||||
} else {
|
} else {
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : '';
|
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : '';
|
||||||
if(strlen($objvalue) > 80) {
|
if(strlen($objvalue) > 80) {
|
||||||
echo "<textarea name=\"".$fieldname."[".$attrdef->getId()."]\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').">".htmlspecialchars($objvalue)."</textarea>";
|
echo "<textarea id=\"".$fieldname."_".$attrdef->getId()."\" class=\"input-xxlarge\" name=\"".$fieldname."[".$attrdef->getId()."]\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').">".htmlspecialchars($objvalue)."</textarea>";
|
||||||
} else {
|
} else {
|
||||||
echo "<input type=\"text\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_int ? ' data-rule-digits="true"' : '')." />";
|
echo "<input type=\"text\" id=\"".$fieldname."_".$attrdef->getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_int ? ' data-rule-digits="true"' : '')." />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1948,6 +1952,89 @@ $(document).ready( function() {
|
||||||
<?php
|
<?php
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output left-arrow with link which takes over a string into
|
||||||
|
* a input field.
|
||||||
|
*
|
||||||
|
* Clicking on the button will preset the string
|
||||||
|
* in data-ref the value of the input field with name $name
|
||||||
|
*
|
||||||
|
* @param string $name id of select box
|
||||||
|
* @param string $text text
|
||||||
|
*/
|
||||||
|
function printInputPresetButtonHtml($name, $text, $sep='') { /* {{{ */
|
||||||
|
?>
|
||||||
|
<span id="<?php echo $name; ?>_btn" class="inputpreset_btn" style="cursor: pointer;" title="<?php printMLText("takeOverAttributeValue"); ?>" data-ref="<?php echo $name; ?>" data-text="<?php echo is_array($text) ? implode($sep, $text) : htmlspecialchars($text);?>"<?php if($sep) echo "data-sep=\"".$sep."\""; ?>><i class="icon-arrow-left"></i></span>
|
||||||
|
<?php
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Javascript code for input preset button
|
||||||
|
* This code workѕ for input fields and single select fields
|
||||||
|
*/
|
||||||
|
function printInputPresetButtonJs() { /* {{{ */
|
||||||
|
?>
|
||||||
|
$(document).ready( function() {
|
||||||
|
$('.inputpreset_btn').click(function(ev){
|
||||||
|
ev.preventDefault();
|
||||||
|
if (typeof $(ev.currentTarget).data('text') != 'undefined') {
|
||||||
|
target = $(ev.currentTarget).data('ref');
|
||||||
|
value = $(ev.currentTarget).data('text');
|
||||||
|
sep = $(ev.currentTarget).data('sep');
|
||||||
|
if(sep) {
|
||||||
|
// Use attr() instead of data() because data() converts to int which cannot be split
|
||||||
|
arr = value.split(sep);
|
||||||
|
for(var i in arr) {
|
||||||
|
$("#"+target+" option[value='"+arr[i]+"']").attr("selected", "selected");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$("#"+target).val(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
<?php
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output left-arrow with link which takes over a boolean value
|
||||||
|
* into a checkbox field.
|
||||||
|
*
|
||||||
|
* Clicking on the button will preset the checkbox
|
||||||
|
* in data-ref the value of the input field with name $name
|
||||||
|
*
|
||||||
|
* @param string $name id of select box
|
||||||
|
* @param string $text text
|
||||||
|
*/
|
||||||
|
function printCheckboxPresetButtonHtml($name, $text) { /* {{{ */
|
||||||
|
?>
|
||||||
|
<span id="<?php echo $name; ?>_btn" class="checkboxpreset_btn" style="cursor: pointer;" title="<?php printMLText("takeOverAttributeValue"); ?>" data-ref="<?php echo $name; ?>" data-text="<?php echo is_array($text) ? implode($sep, $text) : htmlspecialchars($text);?>"<?php if($sep) echo "data-sep=\"".$sep."\""; ?>><i class="icon-arrow-left"></i></span>
|
||||||
|
<?php
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Javascript code for checkboxt preset button
|
||||||
|
* This code workѕ for checkboxes
|
||||||
|
*/
|
||||||
|
function printCheckboxPresetButtonJs() { /* {{{ */
|
||||||
|
?>
|
||||||
|
$(document).ready( function() {
|
||||||
|
$('.checkboxpreset_btn').click(function(ev){
|
||||||
|
ev.preventDefault();
|
||||||
|
if (typeof $(ev.currentTarget).data('text') != 'undefined') {
|
||||||
|
target = $(ev.currentTarget).data('ref');
|
||||||
|
value = $(ev.currentTarget).data('text');
|
||||||
|
if(value) {
|
||||||
|
$("#"+target).attr('checked', '');
|
||||||
|
} else {
|
||||||
|
$("#"+target).removeAttribute('checked');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
<?php
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return HTML of a single row in the document list table
|
* Return HTML of a single row in the document list table
|
||||||
*
|
*
|
||||||
|
|
|
@ -37,6 +37,8 @@ class SeedDMS_View_UpdateDocument extends SeedDMS_Bootstrap_Style {
|
||||||
header('Content-Type: application/javascript');
|
header('Content-Type: application/javascript');
|
||||||
$this->printDropFolderChooserJs("form1");
|
$this->printDropFolderChooserJs("form1");
|
||||||
$this->printSelectPresetButtonJs();
|
$this->printSelectPresetButtonJs();
|
||||||
|
$this->printInputPresetButtonJs();
|
||||||
|
$this->printCheckboxPresetButtonJs();
|
||||||
?>
|
?>
|
||||||
function checkForm()
|
function checkForm()
|
||||||
{
|
{
|
||||||
|
@ -247,7 +249,23 @@ console.log(element);
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
||||||
<td><?php $this->printAttributeEditField($attrdef, '') ?></td>
|
<td><?php $this->printAttributeEditField($attrdef, '') ?>
|
||||||
|
<?php
|
||||||
|
if($latestContent->getAttributeValue($attrdef)) {
|
||||||
|
switch($attrdef->getType()) {
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_string:
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_int:
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_float:
|
||||||
|
$this->printInputPresetButtonHtml('attributes_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef), $attrdef->getValueSetSeparator());
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_boolean:
|
||||||
|
$this->printCheckboxPresetButtonHtml('attributes_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// print_r($latestContent->getAttributeValue($attrdef));
|
||||||
|
}
|
||||||
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user