Index: trunk/core/units/general/cat_event_handler.php
===================================================================
diff -u -N -r8472 -r8546
--- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8472)
+++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8546)
@@ -188,8 +188,10 @@
$type_clauses = Array();
$user_id = $this->Application->RecallVar('user_id');
- $type_clauses['my_items']['include'] = '%1$s.CreatedById = '.$user_id;
- $type_clauses['my_items']['except'] = '%1$s.CreatedById <> '.$user_id;
+ $owner_field = $this->getOwnerField($event->Prefix);
+
+ $type_clauses['my_items']['include'] = '%1$s.'.$owner_field.' = '.$user_id;
+ $type_clauses['my_items']['except'] = '%1$s.'.$owner_field.' <> '.$user_id;
$type_clauses['my_items']['having_filter'] = false;
$type_clauses['pick']['include'] = '%1$s.EditorsPick = 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1';
@@ -535,7 +537,8 @@
WHERE Status = '.STATUS_PENDING_EDITING.' AND OrgId IS NOT NULL';
if (isset($user_id)) {
- $sql .= ' AND CreatedById = '.$user_id;
+ $owner_field = $this->getOwnerField($object->Prefix);
+ $sql .= ' AND '.$owner_field.' = '.$user_id;
}
$pending_ids = $this->Conn->GetCol($sql);
@@ -1710,8 +1713,10 @@
return true;
}
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
- if ($perm_helper->ModifyCheckPermission($object->GetDBField('CreatedById'), $object->GetDBField('CategoryId'), $event->Prefix) == 2) {
+ $owner_field = $this->getOwnerField($event->Prefix);
+ if ($perm_helper->ModifyCheckPermission($object->GetDBField($owner_field), $object->GetDBField('CategoryId'), $event->Prefix) == 2) {
+
// 1. clone original item
$temp_handler =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
$cloned_ids = $temp_handler->CloneItems($event->Prefix, $event->Special, Array($object->GetID()), null, null, null, true);
@@ -1764,7 +1769,9 @@
if ($event->status == erSUCCESS) {
$object =& $event->getObject();
- $object->SetDBField('CreatedById', $this->Application->RecallVar('user_id'));
+ $owner_field = $this->getOwnerField($event->Prefix);
+
+ $object->SetDBField($owner_field, $this->Application->RecallVar('user_id'));
}
}
@@ -1860,9 +1867,11 @@
$temp_handler =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
/* @var $temp_handler kTempTablesHandler */
+ $owner_field = $this->getOwnerField($event->Prefix);
+
foreach ($items_info as $id => $field_values) {
$object->Load($id);
- $edit_perm = $perm_helper->ModifyCheckPermission($object->GetDBField('CreatedById'), $object->GetDBField('CategoryId'), $event->Prefix);
+ $edit_perm = $perm_helper->ModifyCheckPermission($object->GetDBField($owner_field), $object->GetDBField('CategoryId'), $event->Prefix);
if ($use_pending && !$object->GetDBField('OrgId') && ($edit_perm == STATUS_PENDING)) {
// pending editing enabled + not pending copy -> get/create pending copy & save changes to it
@@ -1945,8 +1954,10 @@
switch ($event->Name) {
case 'OnCreate':
$event_suffix = $is_active ? 'ADD' : 'ADD.PENDING';
+ $owner_field = $this->getOwnerField($event->Prefix);
+
$this->Application->EmailEventAdmin($perm_prefix.'.'.$event_suffix); // there are no ADD.PENDING event for admin :(
- $this->Application->EmailEventUser($perm_prefix.'.'.$event_suffix, $object->GetDBField('CreatedById'));
+ $this->Application->EmailEventUser($perm_prefix.'.'.$event_suffix, $object->GetDBField($owner_field));
break;
case 'OnUpdate':
@@ -2044,9 +2055,10 @@
}
$status = $object->GetDBField('Status');
-
$user_id = $this->Application->RecallVar('user_id');
- if (($status == -2 || $status == STATUS_PENDING) && ($object->GetDBField('CreatedById') == $user_id)) {
+ $owner_field = $this->getOwnerField($event->Prefix);
+
+ if (($status == -2 || $status == STATUS_PENDING) && ($object->GetDBField($owner_field) == $user_id)) {
return true;
}
@@ -2105,6 +2117,16 @@
return parent::getPerPage($event);
}
+ function getOwnerField($prefix)
+ {
+ $owner_field = $this->Application->getUnitOption($prefix, 'OwnerField');
+ if (!$owner_field) {
+ $owner_field = 'CreatedById';
+ }
+
+ return $owner_field;
+ }
+
}
?>
\ No newline at end of file
Index: trunk/themes/default2007/platform/designs/forms.tpl
===================================================================
diff -u -N
--- trunk/themes/default2007/platform/designs/forms.tpl (revision 8514)
+++ trunk/themes/default2007/platform/designs/forms.tpl (revision 0)
@@ -1,211 +0,0 @@
-
-
-
-
- img/warning_icon.gif" width="21" height="18" alt=""/>
- |
-
-
- |
-
-
-
-
-
-
-
-
-
- ">
- error">
- *:
-
- |
-
-
-
-
">
-
-
-
- |
- |
-
-
-
-
-
">
-
-
-
-
-
- " value="" tabindex="" maxlength="" style="">
-
- |
-
-
-
- img/s.gif" width="3" height="1" alt=""/>
- |
-
-
-
-
-
">
-
-
-
-
-
- " id="" value="" tabindex="" style="" />
-
- |
-
-
-
- img/s.gif" width="3" height="1" alt=""/>
- |
-
-
-
-
-
">
-
-
- " tabindex="" style="">
-
- ()
-
- [upload]" value="" />
- |
- |
-
-
-
-
- " value="" />
-
-
-
-
">
-
-
-
-
-
- " id="" value="" tabindex="" size="" class="" datepickerIcon="core/admin_templates/img/calendar_icon.gif"> ()
-
- " id="" value="" />
- |
-
-
-
- img/s.gif" width="3" height="1" alt=""/>
- |
-
-
-
-
-
">
-
-
- " id="" value="" tabindex="" size="" class="">
- ()
-
- " id="" value="" />
- |
- |
-
-
-
-
-
">
-
-
- " id="" value="" tabindex="" size="" class="" datepickerIcon="core/admin_templates/img/calendar_icon.gif">
- ()
-
- " id="" value="" tabindex="" size="" class=""> ()
- |
- |
-
-
-
-
-
">
-
-
-
-
-
-
- " name="" cols="" rows="" style="">
- |
-
-
-
-
- ">
-
-
-
- ">
-
-
-
-
">
-
-
- " name="" style="">
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- " style="" name="" id="_" value="">_">
-
-
-
- " style="" name="" id="_" value="">_">
-
-
-
-
">
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
">
-
-
- " name="" value="" />
- " type="checkbox" id="_cb_" name="_cb_" style="" onchange="update_checkbox(this, document.getElementById(''));">
-
- |
- |
-
-
\ No newline at end of file
Index: trunk/core/units/general/cat_dbitem.php
===================================================================
diff -u -N -r8363 -r8546
--- trunk/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 8363)
+++ trunk/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 8546)
@@ -51,7 +51,11 @@
$this->UpdateFormattersSubFields(array('Modified'));
if ($this->mode != 't' && !$this->Application->IsAdmin()) {
- $this->SetDBField('CreatedById', $this->Application->RecallVar('user_id'));
+ $owner_field = $this->Application->getUnitOption($this->Prefix, 'OwnerField');
+ if (!$owner_field) {
+ $owner_field = 'CreatedById';
+ }
+ $this->SetDBField($owner_field, $this->Application->RecallVar('user_id'));
}
if ($this->useFilenames) {
Index: trunk/themes/default2007/platform/inc/script.js
===================================================================
diff -u -N -r8368 -r8546
--- trunk/themes/default2007/platform/inc/script.js (.../script.js) (revision 8368)
+++ trunk/themes/default2007/platform/inc/script.js (.../script.js) (revision 8546)
@@ -1 +1,4 @@
+function update_checkbox(cb, cb_hidden)
+{
+ cb_hidden.value = cb.checked ? 1 : 0;
+}
\ No newline at end of file
Index: trunk/themes/default2007/platform/designs/default_design.tpl
===================================================================
diff -u -N -r8503 -r8546
--- trunk/themes/default2007/platform/designs/default_design.tpl (.../default_design.tpl) (revision 8503)
+++ trunk/themes/default2007/platform/designs/default_design.tpl (.../default_design.tpl) (revision 8546)
@@ -1,7 +1,7 @@
-
+
@@ -12,7 +12,7 @@
-
+
-
+
img/s.gif" width="1" height="1" alt=""/>
img/grey_pix.gif" width="100%" height="1" alt=""/>
img/s.gif" width="1" height="1" alt=""/>
@@ -52,6 +52,6 @@
-
+