Exemple #1
0
$errMess = "";
$bVarsFromForm = false;

if($_SERVER['REQUEST_METHOD']=="POST" && ($_POST['save']<>"" || $_POST['apply']<>"") && check_freetrix_sessid())
{
	$arFields = array(
			"CLASS_NAME"=>$_REQUEST["CLASS_NAME"],
			"CODE"=>$_REQUEST["CODE"],
			"NAME"=>$_REQUEST["NAME"],
			"COMMENTS" => $_REQUEST["COMMENTS"],
			"TITLE_OBJ"=>$_REQUEST["TITLE_OBJ"],
			"URL"=>$_REQUEST["URL"],
	);

	if($ID>0)
		$res = $hotKeyCodes->Update($ID, $arFields);

	else
	{
		$ID = $hotKeyCodes->Add($arFields);
		$res = ($ID>0);
	}

	if($res)
	{
		if(isset($_POST['apply']))
			LocalRedirect("hot_keys_edit.php?ID=".$ID."&lang=".LANG."&applied=ok");
		else
			LocalRedirect(($_REQUEST["addhk"]<>""? $_REQUEST["addhk"]:"hot_keys_list.php?lang=".LANG));
	}
	else
Exemple #2
0
 function Add($arFields, $checkDuplicate = false)
 {
     global $DB;
     if (!CFavorites::CheckFields($arFields)) {
         return false;
     }
     if ($checkDuplicate) {
         $duplicate = CFavorites::IsExistDuplicate($arFields);
         if ($duplicate) {
             return $duplicate;
         }
     }
     $codes = new CHotKeysCode();
     $codeID = $codes->Add(array("CODE" => "location.href='" . $arFields["URL"] . "';", "NAME" => $arFields["NAME"], "COMMENTS" => "FAVORITES"));
     $codes->Update($codeID, array("CLASS_NAME" => "FAV-" . $codeID, "TITLE_OBJ" => "FAV-" . $codeID));
     $arFields["CODE_ID"] = intval($codeID);
     $ID = $DB->Add("b_favorite", $arFields);
     return $ID;
 }
Exemple #3
0
 function SetHotKeys()
 {
     $arHK = array("B" => "Alt+66", "I" => "Alt+73", "U" => "Alt+85", "QUOTE" => "Alt+81", "CODE" => "Alt+67", "TRANSLIT" => "Alt+84");
     $hkc = new CHotKeysCode();
     foreach ($arHK as $s => $hk) {
         $className = "TICKET_EDIT_{$s}";
         $arHKC = array(CLASS_NAME => $className, CODE => "var d=document.getElementById('{$s}'); if (d) d.click();", NAME => " ({$id})", TITLE_OBJ => "TICKET_EDIT_" . $s . "_T", IS_CUSTOM => "1");
         $objK = $hkc->GetList(array(), array("CLASS_NAME" => $className));
         if ($arK = $objK->Fetch()) {
             $hkc->Update($arK["ID"], $arHKC);
         } else {
             $id = $hkc->Add($arHKC);
             if ($id > 0) {
                 $result = CHotKeys::GetInstance()->AddDefaultKeyToAll($id, $hk);
             }
         }
     }
 }
Exemple #4
0
	"CODE"			=> $find_code,
	"NAME"			=> $find_name,
	"URL"			=> $find_url,
	"IS_CUSTOM"		=> $find_is_custom,
);

if ($isAdmin)
{
	if($lAdmin->EditAction())
	{
		foreach($FIELDS as $ID=>$arFields)
		{
			$ID = IntVal($ID);
			if($ID <= 0)
				continue;
			if(!$hotKeyCodes->Update($ID, $arFields))
			{
				$e = $APPLICATION->GetException();
				$lAdmin->AddUpdateError(($e? $e->GetString():GetMessage("HK_UPDATE_ERROR")), $ID);
			}
		}
	}

	if(($arID = $lAdmin->GroupAction()))
	{
		if($_REQUEST['action_target']=='selected')
		{
			$rsData = $hotKeyCodes->GetList(array($by=>$order), $arFilter);
			while($arRes = $rsData->Fetch())
				$arID[] = $arRes['ID'];
		}