try {
$this->_DB->query($queryStr);
$this->_updateToolRelation($data['id'],$data['tool']);
+ if($data['doRightsForEntries'] === true) {
+ $this->_updateEntryRights($data['id'], $data['owner'], $data['group'], $data['rights']);
+ }
$ret = true;
}
catch (Exception $e) {
}
$this->_DB->commit();
$ret = true;
- } catch (Exception $e) {
+ }
+ catch (Exception $e) {
$this->_DB->rollback();
error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
}
+
+ private function _updateEntryRights($collectionId, $owner=false, $group=false, $rights=false) {
+ if(!empty($collectionId)) {
+ $queryStr = "UPDATE `".DB_PREFIX."_collection_entry_".$collectionId."` SET";
+
+ if(Summoner::validate($owner, "digit")) {
+ $queryStr .= " `owner` = '".$this->_DB->real_escape_string($owner)."',";
+ }
+ if(Summoner::validate($group, "digit")) {
+ $queryStr .= " `group` = '".$this->_DB->real_escape_string($group)."',";
+ }
+ if(Summoner::validate($rights, "rights")) {
+ $queryStr .= " `rights` = '".$this->_DB->real_escape_string($rights)."',";
+ }
+ $queryStr = trim($queryStr, ",");
+
+ if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ try {
+ $this->_DB->query($queryStr);
+ }
+ catch (Exception $e) {
+ error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ }
+ }
+ }
}
value="<?php echo Summoner::ifset($TemplateData['editData'], 'description'); ?>">
</div>
</div>
+ <div class="uk-margin">
+ <label class="uk-form-label" for="defaultSearchField">Default global search field</label>
+ <div class="uk-form-controls">
+ <select class="uk-select" id="defaultSearchField" name="fdata[defaultSearchField]">
+ <option value="">Please select</option>
+ <?php foreach($TemplateData['existingFields'] as $k=>$v) { ?>
+ <option value="<?php echo $v['identifier']; ?>"
+ <?php if(Summoner::ifsetValue($TemplateData['editData'], 'defaultSearchField', $v['identifier'])) echo 'selected'; ?>
+ ><?php echo $v['displayname']; ?> (<?php echo $v['type']; ?>)</option>
+ <?php } ?>
+ </select>
+ <small>The field is used in the global search.
+ <span class="" uk-icon="icon: warning"></span> Altering the default search field results in
+ a DB reindex. This could take some time, depending on the amount of data.</small>
+ </div>
+ </div>
+ <div class="uk-margin">
+ <label class="uk-form-label" for="tool">Tools</label>
+ <div class="uk-form-controls">
+ <select class="uk-select" id="tool" name="fdata[tool][]" multiple="multiple" size="5">
+ <option value="">None</option>
+ <?php foreach($TemplateData['toolSelection'] as $k=>$v) { ?>
+ <option value="<?php echo $k; ?>"
+ <?php if(Summoner::ifset($TemplateData['editData']['tool'],$k)) echo 'selected'; ?>
+ ><?php echo $v['name']; ?> (<?php echo $v['description']; ?>)</option>
+ <?php } ?>
+ </select>
+ </div>
+ </div>
+ <hr class="uk-margin-large">
<div class="uk-margin">
<label class="uk-form-label" for="owner">Owner</label>
<div class="uk-form-controls">
</table>
</div>
</div>
+ <?php if(Summoner::ifset($TemplateData['editData'], 'name')) { ?>
<div class="uk-margin">
- <label class="uk-form-label" for="tool">Tools</label>
- <div class="uk-form-controls">
- <select class="uk-select" id="tool" name="fdata[tool][]" multiple="multiple" size="5">
- <option value="">None</option>
- <?php foreach($TemplateData['toolSelection'] as $k=>$v) { ?>
- <option value="<?php echo $k; ?>"
- <?php if(Summoner::ifset($TemplateData['editData']['tool'],$k)) echo 'selected'; ?>
- ><?php echo $v['name']; ?> (<?php echo $v['description']; ?>)</option>
- <?php } ?>
- </select>
+ <div class="uk-form-label">Update entry with collection rights</div>
+ <div class="uk-form-controls uk-form-controls-text">
+ <label>
+ <input class="uk-checkbox" type="checkbox" name="fdata[doRightsForEntries]" value="1">
+ Warning: This will overwrite existing entry rights (user, group, rights) with the ones from the collection!
+ </label>
</div>
</div>
- <?php if(Summoner::ifset($TemplateData['editData'], 'name')) { ?>
<div class="uk-margin">
<div class="uk-form-label">Delete <span uk-icon="warning"></span></div>
<div class="uk-form-controls uk-form-controls-text">
<label>
<input class="uk-checkbox" type="checkbox" name="fdata[doDelete]" value="1">
- Warning: this will delete ALL the data in this collection!
+ Warning: This will delete ALL the data in this collection!
</label>
</div>
</div>
<?php } ?>
- <div class="uk-margin">
- <label class="uk-form-label" for="defaultSearchField">Default global search field</label>
- <div class="uk-form-controls">
- <select class="uk-select" id="defaultSearchField" name="fdata[defaultSearchField]">
- <option value="">Please select</option>
- <?php foreach($TemplateData['existingFields'] as $k=>$v) { ?>
- <option value="<?php echo $v['identifier']; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], 'defaultSearchField', $v['identifier'])) echo 'selected'; ?>
- ><?php echo $v['displayname']; ?> (<?php echo $v['type']; ?>)</option>
- <?php } ?>
- </select>
- <small>The field is used in the global search.
- <span class="" uk-icon="icon: warning"></span> Altering the default search field results in
- a DB reindex. This could take some time, depending on the amount of data.</small>
- </div>
- </div>
<div class="uk-margin">
<button class="uk-button uk-button-primary" type="submit" name="submitForm">
Save