Пример #1
0
             nc_print_status("<a href='" . $ADMIN_PATH . "subdivision/index.php?view=system&phase=5&SubdivisionID=" . $from_sub . "'>" . CONTROL_CLASS_COMPONENT_TEMPLATE_RETURN_TO_SUB, 'info');
         }
         if (isset($from_trash)) {
             nc_print_status("<a href='" . $ADMIN_PATH . "trash/index.php'>" . CONTROL_CLASS_COMPONENT_TEMPLATE_RETURN_TO_TRASH, 'info');
         }
         $UI_CONFIG = new ui_config_class_template('edit', $ClassID);
         $className = $db->get_var("SELECT `Class_Name` FROM `Class` WHERE `Class_ID` = '" . $ClassID . "'");
         $sql = "SELECT COUNT(`Class_ID`) FROM `Class` WHERE `ClassTemplate` = '{$componentClassId}'";
         $templatesCount = $db->get_var($sql);
         $fs_suffix = $_REQUEST['fs'] ? '_fs' : '';
         if ($templatesCount == 1) {
             $class_template_buttons = array();
             $class_template_buttons[] = nc_get_array_2json_button(CONTROL_CLASS_CLASS_TEMPLATE_ADD, "classtemplate{$fs_suffix}.add(" . $componentClassId . ")", "nc-icon nc--file-add nc--hovered");
             $UI_CONFIG->treeChanges['addNode'][] = array("nodeId" => "classtemplates-" . $componentClassId, "parentNodeId" => "dataclass-{$componentClassId}", "name" => CONTROL_CLASS_CLASS_TEMPLATES, "href" => "#classtemplates" . $fs_suffix . ".edit(" . $componentClassId . ")", "sprite" => 'dev-templates' . ($fs == 1 ? '' : '-v4'), "acceptDropFn" => "treeClassAcceptDrop", "onDropFn" => "treeClassOnDrop", "hasChildren" => true, "dragEnabled" => false, "buttons" => $class_template_buttons);
         }
         $UI_CONFIG->treeChanges['addNode'][] = array("nodeId" => "classtemplate-" . $ClassID, "parentNodeId" => "classtemplates-{$componentClassId}", "name" => $ClassID . ". " . $className, "href" => "#classtemplate" . $fs_suffix . ".edit(" . $ClassID . ")", "sprite" => 'dev-templates' . ($fs == 1 ? '' : '-v4'), "acceptDropFn" => "treeFieldAcceptDrop", "onDropFn" => "treeFieldOnDrop", "hasChildren" => false, "dragEnabled" => false, "buttons" => array(nc_get_array_2json_button(CONTROL_CLASS_DELETE, "classtemplate" . $fs_suffix . ".delete(" . $ClassID . ")", "nc-icon nc--remove nc--hovered")));
         ClassForm($ClassID, "index.php", 17, 2, 0);
     } else {
         nc_print_status(CONTROL_CLASS_COMPONENT_TEMPLATE_CREATED_FOR_ERROR, 'error');
         exit;
     }
     break;
 case 1411:
     //добавление шаблона и вывод в модалку
     $AJAX_SAVER = true;
     if ($perm->isGuest()) {
         $AJAX_SAVER = false;
     }
     if ($ClassID = nc_classtempalte_make($ClassID, $Type, $base)) {
         ClassForm_developer_mode($ClassID);
     } else {
 public function action_edit($template_id, $partial_name)
 {
     $this->partial = $partial_name;
     $this->template_id = (int) $template_id;
     $data = array('action' => 'edit');
     $this->ui_config('edit', CONTROL_TEMPLATE_PARTIALS . ' <small>' . $partial_name . '</small>');
     $this->ui_config->locationHash = "template.partials_edit({$this->template_id}, {$partial_name})";
     if (nc_core()->input->fetch_get('addNode')) {
         $node_id = $template_id;
         $partial = $partial_name;
         $fs_suffix = '_fs';
         $this->ui_config->treeChanges['addNode'][] = array("parentNodeId" => "template_partials-{$node_id}", "nodeId" => "template_partial-{$node_id}-{$partial}", "name" => $partial, "href" => "#template.partials_edit({$node_id}, {$partial})", "sprite" => 'dev-com-templates', "buttons" => array(nc_get_array_2json_button(CONTROL_TEMPLATE_PARTIALS_REMOVE, "template{$fs_suffix}.partials_remove({$node_id}, {$partial})", "nc-icon nc--remove nc--hovered")));
     }
     $partial_file = $this->nc_core->template->get_partials_path($this->template_id, $partial_name);
     if (file_exists($partial_file)) {
         if (isset($_POST['partial_source'])) {
             $partial_source = $this->nc_core->input->fetch_post('partial_source');
             file_put_contents($partial_file, $partial_source);
         }
         $partial_source = file_get_contents($partial_file);
         $data['partial_name'] = $partial_name;
         $data['partial_source'] = $partial_source;
     } else {
         nc_print_status('Template not found', 'error');
         return;
     }
     $this->ui_config->actionButtons[] = array('caption' => NETCAT_CUSTOM_ONCE_SAVE, 'action' => "nc.view.main('form').submit(); return false");
     return $this->view('template_partials/edit', $data);
 }
Пример #3
0
            continue;
        }
        $widgetfield_buttons = array();
        $widgetfield_buttons[] = nc_get_array_2json_button(CONTROL_FIELD_LIST_DELETE, "widgetfield{$fs_suffix}.delete(" . $node_id . "," . $field['Field_ID'] . ")", "nc-icon nc--remove nc--hovered");
        $ret_widgetfields[] = array("nodeId" => "field-" . $field['Field_ID'], "name" => $field["Field_ID"] . ". " . $field["Field_Name"], "href" => "#widgetfield.edit(" . $field['Field_ID'] . ")", "sprite" => $field_types[$field["TypeOfData_ID"]], "acceptDropFn" => "treeFieldAcceptDrop", "onDropFn" => "treeFieldOnDrop", "hasChildren" => false, "dragEnabled" => true, "buttons" => $widgetfield_buttons);
    }
} elseif ($node_type == 'classificator.list') {
    // получение дерева списков
    $classificators = $db->get_results("SELECT `Classificator_ID`, `Classificator_Name`, `System` FROM `Classificator`\n    ORDER BY `Classificator_ID`", ARRAY_A);
    $admin_cl = $perm->isAccess(NC_PERM_CLASSIFICATOR, NC_PERM_ACTION_DEL, 0, 0);
    foreach ((array) $classificators as $classificator) {
        $c_id = $classificator['Classificator_ID'];
        //for short
        // Проверка на право
        if (!$classificator['System'] && !$perm->isAccess(NC_PERM_CLASSIFICATOR, NC_PERM_ACTION_VIEW, $c_id)) {
            continue;
        }
        //Системные списки показываем только при наличии соответствующих прав
        if ($classificator['System'] && !$perm->isDirectAccessClassificator(NC_PERM_ACTION_VIEW, $c_id)) {
            continue;
        }
        $classificator_buttons = array();
        // Кнопка удалить только для админа всех списков, при условии что список не системный
        if ($admin_cl && !$classificator['System']) {
            $classificator_buttons[] = nc_get_array_2json_button(CONTENT_CLASSIFICATORS_LIST_DELETE, "classificator.delete(" . $c_id . ")", "nc-icon nc--remove nc--hovered");
        }
        $ret_classificators[] = array("nodeId" => "classificator-" . $c_id, "name" => $classificator["Classificator_ID"] . ". " . $classificator['Classificator_Name'], "href" => "#classificator.edit(" . $c_id . ")", "sprite" => 'dev-classificator', "hasChildren" => false, "dragEnabled" => false, "buttons" => $classificator_buttons);
    }
}
$ret = array_merge(array_values($ret_dev), array_values($ret_groups), array_values($ret_widgetgroups), array_values($ret_classes), array_values($ret_widgetclasses), array_values($ret_class_templates), array_values($ret_fields), array_values($ret_widgetfields), array_values($ret_classificators), array_values($ret_templates), array_values($ret_class_group), array_values($ret_system_class), array_values($ret_system_fields));
print "while(1);" . nc_array_json($ret);