list available view scripts
17638
public function listviewscriptsAction()
    {
        $config = $this->config;

        $table = new Table(
            array('columnWidths' => array(40, 40, 40),
                                 'decorator' => 'ascii')
        );

        $table->appendRow(array('Module', 'Name', 'Description'));

        $offset=strlen(getcwd())+1;
        $links="";
        $github='https://github.com/cross-solution/YAWIK/blob/master/';

        foreach ($config['view_manager']['template_map'] as $key => $absolute_filename) {
            // strip the application_root plus an additional slash
            $filename=substr(realpath($absolute_filename), $offset);
            if (preg_match('~module/([^/]+)~', $filename, $match)) {
                $module=$match[1];
            } else {
                $module="not found ($key)";
            }

            $viewModel = new ViewModel();
            $viewModel->setTemplate($key);

            $row = new Row();
            $row->appendColumn(new Column($module));
            if ($filename) {
                $row->appendColumn(new Column('`' . $key . '`_'));
                $links.='.. _'. $key .': '. $github.$filename .PHP_EOL;
            } else {
                $row->appendColumn(new Column("WRONG CONFIGURATION"));
            }
            $comment="";
            if (file_exists($absolute_filename)) {
                $src=file_get_contents($absolute_filename);
                $comment="file exists";
                if (preg_match("/{{rtd:\s*(.*)}}/", $src, $match)) {
                    $comment=$match['1'];
                }
            }
            $row->appendColumn(new Column($comment));
            $table->appendRow($row);
        }

        echo $table.PHP_EOL;
        echo $links;

        return PHP_EOL;
    }
1039222
def _api_views(self, plugin):
        
        response.content_type = 'application/json; charset=utf-8'

        if plugin not in self.plugins_list:
            abort(400, "Unknown plugin %s (available plugins: %s)" % (plugin, self.plugins_list))

        # Update the stat
        # self.__update__()

        try:
            # Get the JSON value of the stat views
            ret = self.stats.get_plugin(plugin).get_views()
        except Exception as e:
            abort(404, "Cannot get views for plugin %s (%s)" % (plugin, str(e)))
        return ret
269276
def scripts( self, mydict ):
        """"""

        if isinstance( mydict, dict ):
            for src, type in list( mydict.items( ) ):
                self.script( '', src=src, type='text/%s' % type )
        else:
            try:
                for src in mydict:
                    self.script( '', src=src, type='text/javascript' )
            except:
                raise TypeError( "Script should be given a dictionary of src:type pairs or a list of javascript src's." )
407950
def update_views(self):
        """"""
        # Call the father's method
        super(Plugin, self).update_views()

        # Add specifics informations
        # Alert and log
        self.views['used']['decoration'] = self.get_alert_log(self.stats['used'], maximum=self.stats['total'])
        # Optional
        for key in ['active', 'inactive', 'buffers', 'cached']:
            if key in self.stats:
                self.views[key]['optional'] = True
1224715
protected function listScripts($scripts)
    {
        if (!$scripts) {
            $this->out()->out('No custom scripts.');

            return;
        }

        $this->out()->out('<comment>Available Scripts</comment>')
            ->out('-----------------------------');

        foreach ($scripts as $name => $script) {
            $this->out(sprintf('<info>%s</info>', $name));

            foreach ($script as $cmd) {
                if (!is_array($cmd)) {
                    $cmd = ['cmd' => $cmd, 'in' => null];
                }

                $input = Arr::get($cmd, 'in');
                $cmd   = Arr::get($cmd, 'cmd');

                $this->out('    <comment>$</comment> ' . $cmd, false);

                if ($input !== null) {
                    $this->out(sprintf('  <option>(Input: %s)</option>', preg_replace('/\s+/', ' ', $input)), false);
                }

                $this->out();
            }

            $this->out();
        }
    }
263361
public function loadSiteScripts()
    {
        if (is_singular() && comments_open() && get_option('thread_comments')) {
            wp_enqueue_script('comment-reply');
        }

        $mainHandle = 'site';
        $this->loadMainScriptByHandle($mainHandle);

        $viewHandle = $this->getViewHandle();

        if (file_exists(sprintf('%s/js/views/%s.js', $this->paths->getThemeAssetsDir(), $viewHandle))) {
            $viewSrc = sprintf('%s/js/views/%s.js', $this->paths->getThemeAssetsUri(), $viewHandle);
            $this->loadScript($viewHandle, $viewSrc, [$mainHandle], true);
        }
    }
159
function list(scriptModule, agent, msg, cb) {
    const servers = [];
    const scripts = [];
    const idMap = agent.idMap;

    for (const sid in idMap) {
        if (idMap.hasOwnProperty(sid)) {
            servers.push(sid);
        }
    }

    fs.readdir(scriptModule.root, (err, filenames) => {
        if (err) {
            filenames = [];
        }
        for (let i = 0, l = filenames.length; i < l; i++) {
            scripts.push(filenames[i]);
        }

        cb(null, {
            servers: servers,
            scripts: scripts
        });
    });
}
1211301
def _view(self, filepath, format):
        """"""
        methodnames = [
            '_view_%s_%s' % (format, backend.PLATFORM),
            '_view_%s' % backend.PLATFORM,
        ]
        for name in methodnames:
            view_method = getattr(self, name, None)
            if view_method is not None:
                break
        else:
            raise RuntimeError('%r has no built-in viewer support for %r '
                'on %r platform' % (self.__class__, format, backend.PLATFORM))
        view_method(filepath)
784075
function checkViews() {
  var self = this;
  // Nunjucks have 404 not found disabled by default
  if(this.config.views.engine === 'nunjucks' && typeof this.config.views.errors !== 'string') {
    self.errorViews = errorViews = {};
    return;
  }
  try {
    var errPath = Component.appPath(this.config.path.views, this.config.views.errors);
    var errorFiles = Crux.util.readDirectory(errPath, this.config.views.extension, null, true);
    _.forEach(errorFiles, function(fullPath) {
      var errCode = fullPath.replace(errPath, '').replace('.' + self.config.views.extension, '');
      var code = parseInt(errCode);
      if(!isNaN(code)) {
        errorViews[errCode] = fullPath.replace(Component.appPath(self.config.path.views), '');
      }
    });
  } catch(e) {}
  self.errorViews = errorViews;
}
906302
function getSoleInlineScript(eligibleScripts) {
  var i, len,
      script = null;
  eligibleScripts = eligibleScripts || scripts;
  for (i = 0, len = eligibleScripts.length; i < len; i++) {
    if (!eligibleScripts[i].hasAttribute("src")) {
      if (script) {
        script = null;
        break;
      }
      script = eligibleScripts[i];
    }
  }
  return script;
}
681813
def setViewsFromUiAutomatorDump(self, received):
        '''
        
        '''

        if not received or received == "":
            raise ValueError("received is empty")
        self.views = []
        ''' The list of Views represented as C{str} obtained after splitting it into lines after being received from the server. Done by L{self.setViews()}. '''
        self.__parseTreeFromUiAutomatorDump(received)
        if DEBUG:
            print >>sys.stderr, "there are %d views in this dump" % len(self.views)
1235906
def search_script(self, script):
        
        if self.import_statement.search(script):
            for installed in self.libraries_installed:
                for found in set(self.import_statement.findall(script)):
                    if found == installed.key:
                        self.libraries_installed.remove(installed)
                        self.libraries_found.append(installed)
742736
def new
      script_listing = Script::Listing.find(params[:listing_id])
      @script_url = script_listing.urls.build
      @script_url.user_id = current_user.id
      @script_url.org_id = current_user.org_id
    end
616402
def view_list(self):
        ''''''
        done = set()
        ret = []
        while len(done) != self.count():
            p = self.view_indexes(done)
            if len(p) > 0:
                ret.append(p)
        return ret
462
public function listViews()
    {
        $database = $this->_conn->getDatabase();
        $sql      = $this->_platform->getListViewsSQL($database);
        $views    = $this->_conn->fetchAll($sql);

        return $this->_getPortableViewsList($views);
    }
1357136
public static function getActionableViews() {
		static $views;
		if (isset($views)) {
			return $views;
		}

		$views = [];

		$plugin = elgg_get_plugin_from_id('hypeInteractions');
		$settings = $plugin->getAllSettings();
		foreach ($settings as $key => $value) {
			if (!$value) {
				continue;
			}
			list ($prefix, $view) = explode(':', $key);
			if ($prefix !== 'stream_object') {
				continue;
			}
			$views[] = $view;
		}

		return $views;
	}
524719
def GetListItems(self, viewname=None, fields=None, query=None, rowlimit=0, debug=False):
        

        # Build Request
        soap_request = soap('GetListItems')
        soap_request.add_parameter('listName', self.listName)
        # Convert Displayed View Name to View ID
        if viewname:
            soap_request.add_parameter('viewName', self.views[viewname]['Name'][1:-1])

        # Add viewFields
        if fields:
            # Convert to SharePoint Style Column Names
            for i, val in enumerate(fields):
                fields[i] = self._disp_cols[val]['name']
            viewfields = fields
            soap_request.add_view_fields(fields)
            # Check for viewname and query
            if [viewname, query] == [None, None]:
                # Add a query if the viewname and query are not provided
                # We sort by 'ID' here Ascending is the default
                soap_request.add_query({'OrderBy': ['ID']})

        elif viewname:
            viewfields = self.GetView(viewname)['fields']  ## Might be wrong
        else:
            # No fields or views provided so get everything
            viewfields = [x for x in self._sp_cols]

        # Add query
        if query:

            if 'Where' in query:
                where = etree.Element('Where')

                parents = []
                parents.append(where)
                for i, field in enumerate(query['Where']):
                    if field == 'And':
                        parents.append(etree.SubElement(parents[-1], 'And'))
                    elif field == 'Or':
                        if parents[-1].tag == 'Or':
                            parents.pop()
                        parents.append(etree.SubElement(parents[-1], 'Or'))
                    else:
                        _type = etree.SubElement(parents[-1], field[0])
                        field_ref = etree.SubElement(_type, 'FieldRef')
                        field_ref.set('Name', self._disp_cols[field[1]]['name'])
                        if len(field) == 3:
                            value = etree.SubElement(_type, 'Value')
                            value.set('Type', self._disp_cols[field[1]]['type'])
                            value.text = self._sp_type(field[1], field[2])

                query['Where'] = where

            soap_request.add_query(query)

        # Set Row Limit
        soap_request.add_parameter('rowLimit', str(rowlimit))
        self.last_request = str(soap_request)

        # Send Request
        response = self._session.post(url=self._url('Lists'),
                                      headers=self._headers('GetListItems'),
                                      data=str(soap_request),
                                      verify=self._verify_ssl,
                                      timeout=self.timeout)

        # Parse Response
        if response.status_code == 200:
            envelope = etree.fromstring(response.text.encode('utf-8'), parser=etree.XMLParser(huge_tree=self.huge_tree))
            listitems = envelope[0][0][0][0][0]
            data = []
            for row in listitems:
                # Strip the 'ows_' from the beginning with key[4:]
                data.append({key[4:]: value for (key, value) in row.items() if key[4:] in viewfields})

            self._convert_to_display(data)

            if debug:
                return response
            else:
                return data
        else:
            return response