Example #1
0
                    break;
                case "lock":
                    if ($bWorkFlow && !CIBlockElementRights::UserHasRightTo($intSubIBlockID, $subID, "element_edit")) {
                        $lAdmin->AddGroupError(GetMessage("IBEL_A_UPDERR3") . " (ID:" . $subID . ")", $subID);
                    }
                    CIBlockElement::WF_Lock($subID);
                    break;
                case "unlock":
                    if ($bWorkFlow && !CIBlockElementRights::UserHasRightTo($intSubIBlockID, $subID, "element_edit")) {
                        $lAdmin->AddGroupError(GetMessage("IBEL_A_UPDERR3") . " (ID:" . $ID . ")", $ID);
                        continue;
                    }
                    if ($bBizproc) {
                        call_user_func(array(ENTITY, "UnlockDocument"), $subID, "");
                    } else {
                        CIBlockElement::WF_UnLock($subID);
                    }
                    break;
            }
        }
    }
}
CUtil::InitJSCore(array('translit'));
$CAdminCalendar_ShowScript = '';
if (true == B_ADMIN_SUBELEMENTS_LIST) {
    $CAdminCalendar_ShowScript = CAdminCalendar::ShowScript();
}
$arHeader = array();
$arHeader[] = array("id" => "NAME", "content" => GetMessage("IBLOCK_FIELD_NAME"), "sort" => "name", "default" => true);
$arHeader[] = array("id" => "ACTIVE", "content" => GetMessage("IBLOCK_FIELD_ACTIVE"), "sort" => "active", "default" => true, "align" => "center");
$arHeader[] = array("id" => "SORT", "content" => GetMessage("IBLOCK_FIELD_SORT"), "sort" => "sort", "default" => true, "align" => "right");
Example #2
0
					CIBlockElement::WF_Lock($ID);
				}
			}
			break;
		case "unlock":
			if ($TYPE=="E")
			{
				if ($bWorkflow && !CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_edit"))
				{
					$lAdmin->AddGroupError(GetMessage("IBLIST_A_UPDERR_ACCESS", array("#ID#" => $ID)), $TYPE.$ID);
					continue;
				}
				if ($bBizproc)
					call_user_func(array(ENTITY, "UnlockDocument"), $ID, "");
				else
					CIBlockElement::WF_UnLock($ID);
			}
			break;
		case 'clear_counter':
			if ($TYPE=="E")
			{
				if(CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_edit"))
				{
					$obE = new CIBlockElement();
					$arFields = array('SHOW_COUNTER' => false, 'SHOW_COUNTER_START' => false);
					if(!$obE->Update($ID, $arFields, false, false))
						$lAdmin->AddGroupError(GetMessage("IBLIST_A_SAVE_ERROR", array("#ID#" => $ID, "#ERROR_MESSAGE#" => $obE->LAST_ERROR)), $TYPE.$ID);
				}
				else
				{
					$lAdmin->AddGroupError(GetMessage("IBLIST_A_UPDERR_ACCESS", array("#ID#" => $ID)), $TYPE.$ID);
Example #3
0
 function _set_lock(&$options, $op)
 {
     $lock = $op == 'LOCK';
     $is_dir = false;
     $ID = 0;
     $bFirstElement = false;
     $arProps = $this->_get_lock($options);
     if (!$this->CheckWebRights("", array('action' => 'lock', 'arElement' => $this->arParams))) {
         return $this->ThrowAccessDenied(__LINE__);
     }
     if (!is_array($arProps)) {
         if ($lock && $this->arParams['not_found'] === true) {
             if (!$this->CheckName($this->arParams["basename"])) {
                 return "400 bad request";
             } elseif ($this->check_creator && $this->arParams["is_file"] === true && $this->arParams["element_array"]["CREATED_BY"] != $GLOBALS["USER"]->GetID()) {
                 return $this->ThrowAccessDenied(__LINE__);
             } elseif ($this->arParams["parent_id"] !== false) {
                 $options1 = array('path' => $options["path"], 'content_length' => 0, 'content_type' => "", 'WF_COMMENTS' => GetMessage("WD_FILE_IS_CREATED_BY_LOCK"));
                 $stat = $this->PUT($options1);
                 if ($stat === false) {
                     return $this->ThrowAccessDenied(__LINE__);
                 } elseif (is_string($stat)) {
                     return $stat;
                 } else {
                     if (is_resource($stat) && get_resource_type($stat) == 'stream') {
                         fclose($stat);
                     }
                     if (!$this->CheckWebRights("", array("action" => "create", "arElement" => $this->arParams))) {
                         return $this->ThrowAccessDenied(__LINE__);
                     }
                     $this->put_commit($options1);
                 }
                 $ID = intVal($options1["ELEMENT_ID"]);
                 if ($ID <= 0) {
                     return "409 Conflict";
                 } else {
                     return "200 OK";
                 }
             } else {
                 return $arProps;
                 // 404 not found
             }
         }
         return $arProps;
         // error in _get_lock
     }
     $ID = $this->arParams['item_id'];
     $is_dir = $this->arParams["is_dir"];
     if ($lock) {
         if ($is_dir && !empty($options["depth"])) {
             return "409 Conflict";
         } elseif (!$is_dir && CIBlockElement::WF_IsLocked($ID, $locked_by, $date_lock)) {
             return false;
         }
         $options["timeout"] = time() + 300;
         // 5min. hardcoded
         if (isset($options["update"])) {
             $token = $options["update"];
             $arProps["LOCK"] = is_array($arProps["LOCK"]) ? $arProps["LOCK"] : array();
             if (array_key_exists($token, $arProps["LOCK"]) && strlen($arProps["LOCK"][$token]["exclusivelock"]) > 0) {
                 $arProps["LOCK"][$token]["expires"] = $options["timeout"];
                 $arProps["LOCK"][$token]["modified"] = time();
                 if (array_key_exists("owner", $arProps["LOCK"][$token])) {
                     $options["owner"] = $arProps["LOCK"][$token]["owner"];
                 }
                 $options["scope"] = $arProps["LOCK"][$token]["exclusivelock"] ? "exclusive" : "shared";
                 $options["type"] = $arProps["LOCK"][$token]["exclusivelock"] ? "write" : "read";
                 if ($bFirstElement) {
                     $arProps["FIRST"] = "Y";
                 }
                 CIBlockElement::SetPropertyValues($ID, $this->IBLOCK_ID, serialize($arProps), "WEBDAV_INFO");
                 CIBlockElement::WF_Lock($ID);
                 $this->_onEvent('Lock', $ID);
                 return true;
             } else {
                 return false;
             }
         }
         $arProps["LOCK"][$options["locktoken"]] = array("created" => time(), "modified" => time(), "owner" => $options["owner"], "expires" => $options["timeout"], "locktoken" => $options["locktoken"], "exclusivelock" => $options["scope"] === "exclusive" ? 1 : 0);
     } else {
         if (!empty($options["token"])) {
             $token = $options["token"];
             unset($arProps["LOCK"][$token]);
         } else {
             unset($arProps["LOCK"]);
         }
         if ($this->workflow == 'bizproc' && $GLOBALS['USER']->CanDoOperation('webdav_change_settings')) {
             $arDocId = $this->wfParams["DOCUMENT_TYPE"];
             $arDocId[2] = $ID;
             $arStates = CBPDocument::GetDocumentStates($this->wfParams["DOCUMENT_TYPE"], $arDocId);
             foreach ($arStates as $workflowId => $arState) {
                 CIBlockDocumentWebdav::UnlockDocument($ID, $workflowId);
             }
         }
     }
     if ($is_dir) {
         $se = new CIBlockSection();
         $x = $se->Update($ID, array("DESCRIPTION" => serialize($arProps)));
     } else {
         if ($lock && $bFirstElement) {
             $arProps["FIRST"] = "Y";
         }
         CIBlockElement::SetPropertyValues($ID, $this->IBLOCK_ID, serialize($arProps), "WEBDAV_INFO");
         if ($lock) {
             CIBlockElement::WF_Lock($ID, $this->workflow == "workflow");
         } else {
             CIBlockElement::WF_UnLock($ID, $this->workflow == "workflow");
         }
         $this->_onEvent($lock ? 'Lock' : 'Unlock', $ID);
         $x = true;
     }
     return $x ? $lock ? "200 OK" : "204 No Content" : "409 Conflict";
 }